+// This was supposed to cure the non-display of the notebook
+// until the user resizes the window.
+// What's going on?
+void wxNotebook::OnIdle(wxIdleEvent& event)
+{
+ static bool s_bFirstTime = TRUE;
+ if ( s_bFirstTime ) {
+ /*
+ wxSize sz(GetSize());
+ sz.x ++;
+ SetSize(sz);
+ sz.x --;
+ SetSize(sz);
+ */
+
+ /*
+ wxSize sz(GetSize());
+ wxSizeEvent sizeEvent(sz, GetId());
+ sizeEvent.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(sizeEvent);
+ Refresh();
+ */
+ s_bFirstTime = FALSE;
+ }
+ event.Skip();
+}
+
+// Implementation: calculate the layout of the view rect
+// and resize the children if required
+bool wxNotebook::RefreshLayout(bool force)
+{
+ if (m_tabView)
+ {
+ wxRect oldRect = m_tabView->GetViewRect();
+
+ 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();
+
+ if (!force && (rect == oldRect))
+ return FALSE;
+
+ // 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];
+ if (pPage->IsShown())
+ {
+ wxRect clientRect = GetAvailableClientSize();
+ pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
+ if ( pPage->GetAutoLayout() )
+ pPage->Layout();
+ }
+ }
+ Refresh();
+ }
+ return TRUE;
+}
+