MCPcopy Create free account
hub / github.com/TankOs/SFGUI / ReorderChild

Method ReorderChild

src/SFGUI/Box.cpp:51–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void Box::ReorderChild( Widget::Ptr widget, std::size_t position ) {
52 ChildrenCont::iterator iter( std::find( m_box_children.begin(), m_box_children.end(), widget ) );
53
54 if( iter == m_box_children.end() ) {
55 return;
56 }
57
58 position = std::min( position, m_box_children.size() - 1 );
59
60 ChildrenCont::iterator insertion_point( m_box_children.begin() );
61 std::advance( insertion_point, static_cast<ChildrenCont::difference_type>( position ) );
62 m_box_children.insert( insertion_point, *iter );
63 m_box_children.erase( iter );
64
65 Invalidate();
66 AllocateChildren();
67}
68
69bool Box::HandleAdd( Widget::Ptr child ) {
70 ChildrenCont::const_iterator iter( std::find( m_box_children.begin(), m_box_children.end(), child ) );

Callers

nothing calls this directly

Calls 2

endMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected