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

Method InsertPage

src/SFGUI/Notebook.cpp:116–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116Notebook::IndexType Notebook::InsertPage( Widget::Ptr child, Widget::Ptr tab_label, IndexType position ) {
117 if( ( position >= GetPageCount() ) || ( position < 0 ) ) {
118 m_children.push_back( ChildLabelPair( child, tab_label ) );
119
120 Add( child );
121 Add( tab_label );
122
123 child->Show( false );
124
125 SetCurrentPage( GetCurrentPage() );
126
127 RecalculateSize();
128
129 return GetPageCount() - 1;
130 }
131
132 m_children.insert( m_children.begin() + position, ChildLabelPair( child, tab_label ) );
133
134 Add( child );
135 Add( tab_label );
136
137 child->Show( false );
138
139 // If the current page was after or at the position of the insertion,
140 // make sure it stays active.
141 if( GetCurrentPage() >= position ) {
142 NextPage();
143 }
144
145 RecalculateSize();
146
147 return position;
148}
149
150void Notebook::RemovePage( IndexType page_number ) {
151 if( GetPageCount() <= 1 ) {

Callers

nothing calls this directly

Calls 2

ChildLabelPairClass · 0.85
ShowMethod · 0.45

Tested by

no test coverage detected