]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
Use status full, not client, size to determine frame client size in wxMSW.
[wxWidgets.git] / src / msw / notebook.cpp
index f5487c26b980e3f86a4912e566372502bbd457ee..4b3c6e0aee779b1c396d1a46ca4954cb85ac35db 100644 (file)
@@ -122,7 +122,6 @@ static bool HasTroubleWithNonTopTabs()
 WX_DEFINE_LIST( wxNotebookPageInfoList )
 
 BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
-    EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange)
     EVT_SIZE(wxNotebook::OnSize)
     EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
 
@@ -455,9 +454,13 @@ int wxNotebook::SetSelection(size_t nPage)
         if ( SendPageChangingEvent(nPage) )
         {
             // program allows the page change
-            SendPageChangedEvent(m_selection, nPage);
+            const int selectionOld = m_selection;
+
+            UpdateSelection(nPage);
 
             TabCtrl_SetCurSel(GetHwnd(), nPage);
+
+            SendPageChangedEvent(selectionOld, nPage);
         }
     }
 
@@ -842,16 +845,7 @@ bool wxNotebook::InsertPage(size_t nPage,
         m_selection++;
     }
 
-    // some page should be selected: either this one or the first one if there
-    // is still no selection
-    int selNew = wxNOT_FOUND;
-    if ( bSelect )
-        selNew = nPage;
-    else if ( m_selection == wxNOT_FOUND )
-        selNew = 0;
-
-    if ( selNew != wxNOT_FOUND )
-        SetSelection(selNew);
+    DoSetSelectionAfterInsertion(nPage, bSelect);
 
     InvalidateBestSize();
 
@@ -1091,18 +1085,6 @@ void wxNotebook::OnSize(wxSizeEvent& event)
     event.Skip();
 }
 
-void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
-{
-    // is it our tab control?
-    if ( event.GetEventObject() == this )
-    {
-        UpdateSelection(event.GetSelection());
-    }
-
-    // we want to give others a chance to process this message as well
-    event.Skip();
-}
-
 void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
 {
     if ( event.IsWindowChange() ) {
@@ -1455,6 +1437,9 @@ bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
   event.SetInt(idCtrl);
 
   bool processed = HandleWindowEvent(event);
+  if ( hdr->code == TCN_SELCHANGE )
+      UpdateSelection(event.GetSelection());
+
   *result = !event.IsAllowed();
   return processed;
 }