| 114 | } |
| 115 | |
| 116 | Notebook::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 | |
| 150 | void Notebook::RemovePage( IndexType page_number ) { |
| 151 | if( GetPageCount() <= 1 ) { |
nothing calls this directly
no test coverage detected