- // TODO: all this may or may not be necessary for your platform
-
- // emulate page change (it's esp. important to do it first time because
- // otherwise our page would stay invisible)
- int nSel = m_nSelection;
- m_nSelection = -1;
- SetSelection(nSel);
-
- // fit the notebook page to the tab control's display area
- int w, h;
- GetSize(&w, &h);
-
- unsigned int nCount = m_aPages.Count();
- for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
- wxNotebookPage *pPage = m_aPages[nPage];
- pPage->SetSize(0, 0, w, h);
- if ( pPage->GetAutoLayout() )
- pPage->Layout();
+ if (m_tabView)
+ {
+ int cw, ch;
+ GetClientSize(& cw, & ch);
+
+ int tabHeight = m_tabView->GetTotalTabHeight();
+ wxRect rect;
+ rect.x = 4;
+ rect.y = tabHeight + 4;
+ rect.width = cw - 8;
+ rect.height = ch - 4 - rect.y ;
+
+ m_tabView->SetViewRect(rect);
+
+ m_tabView->Layout();
+
+ // Need to do it a 2nd time to get the tab height with
+ // the new view width, since changing the view width changes the
+ // tab layout.
+ tabHeight = m_tabView->GetTotalTabHeight();
+ rect.x = 4;
+ rect.y = tabHeight + 4;
+ rect.width = cw - 8;
+ rect.height = ch - 4 - rect.y ;
+
+ m_tabView->SetViewRect(rect);
+
+ m_tabView->Layout();
+
+ // emulate page change (it's esp. important to do it first time because
+ // otherwise our page would stay invisible)
+ int nSel = m_nSelection;
+ m_nSelection = -1;
+ SetSelection(nSel);
+
+ // fit the notebook page to the tab control's display area
+
+ unsigned int nCount = m_aPages.Count();
+ for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
+ wxNotebookPage *pPage = m_aPages[nPage];
+ pPage->SetSize(rect.x + 2, rect.y + 2, rect.width - 2, rect.height - 2);
+ if ( pPage->GetAutoLayout() )
+ pPage->Layout();
+ }
+ Refresh();