]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
BC++ compilation fix
[wxWidgets.git] / src / msw / notebook.cpp
index f8d4ed27d1877dd88c3227913994b5e0ddb1439e..b187fa931ea1b8de2d8e9101616ad8f740632df0 100644 (file)
 
 // wxWindows
 #ifndef WX_PRECOMP
-  #include  <wx/string.h>
+  #include  "wx/string.h"
 #endif  // WX_PRECOMP
 
-#include  <wx/log.h>
-#include  <wx/imaglist.h>
-#include  <wx/event.h>
-#include  <wx/control.h>
-#include  <wx/notebook.h>
+#include  "wx/log.h"
+#include  "wx/imaglist.h"
+#include  "wx/event.h"
+#include  "wx/control.h"
+#include  "wx/notebook.h"
 
-#include  <wx/msw/private.h>
+#include  "wx/msw/private.h"
 
 // Windows standard headers
 #ifndef   __WIN95__
@@ -83,8 +83,7 @@
 // event table
 // ----------------------------------------------------------------------------
 
-#if !USE_SHARED_LIBRARIES
-  BEGIN_EVENT_TABLE(wxNotebook, wxControl)
+BEGIN_EVENT_TABLE(wxNotebook, wxControl)
     EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
 
     EVT_SIZE(wxNotebook::OnSize)
     EVT_SET_FOCUS(wxNotebook::OnSetFocus)
 
     EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
-  END_EVENT_TABLE()
+END_EVENT_TABLE()
 
-  IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
-  IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
-#endif
+IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
 
 // ============================================================================
 // implementation
@@ -146,7 +144,7 @@ bool wxNotebook::Create(wxWindow *parent,
 
   // colors and font
   m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
-  m_foregroundColour = *wxBLACK ;
+  m_foregroundColour = *wxBLACK;
 
   // style
   m_windowStyle = style | wxTAB_TRAVERSAL;
@@ -316,6 +314,9 @@ bool wxNotebook::DeletePage(int nPage)
       // no selection if the notebook became empty
       m_nSelection = -1;
   }
+  else
+      m_nSelection = TabCtrl_GetCurSel(m_hwnd);
+
 
   return TRUE;
 }
@@ -329,6 +330,11 @@ bool wxNotebook::RemovePage(int nPage)
 
   m_aPages.Remove(nPage);
 
+  if ( m_aPages.IsEmpty() )
+      m_nSelection = -1;
+    else
+      m_nSelection = TabCtrl_GetCurSel(m_hwnd);
+
   return TRUE;
 }
 
@@ -344,6 +350,8 @@ bool wxNotebook::DeleteAllPages()
 
   TabCtrl_DeleteAllItems(m_hwnd);
 
+  m_nSelection = -1;
+
   return TRUE;
 }
 
@@ -414,8 +422,6 @@ bool wxNotebook::InsertPage(int nPage,
   GetSize((int *)&rc.right, (int *)&rc.bottom);
   TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
   pPage->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
-  if ( pPage->GetAutoLayout() )
-      pPage->Layout();
 
 
   // some page should be selected: either this one or the first one if there is
@@ -444,12 +450,13 @@ void wxNotebook::OnSize(wxSizeEvent& event)
   GetSize((int *)&rc.right, (int *)&rc.bottom);
 
   TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
+
+  int width = rc.right - rc.left,
+      height = rc.bottom - rc.top;
   size_t nCount = m_aPages.Count();
   for ( size_t nPage = 0; nPage < nCount; nPage++ ) {
     wxNotebookPage *pPage = m_aPages[nPage];
-    pPage->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
-    if ( pPage->GetAutoLayout() )
-      pPage->Layout();
+    pPage->SetSize(rc.left, rc.top, width, height);
   }
 
   event.Skip();
@@ -509,13 +516,13 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
 
 // override these 2 functions to do nothing: everything is done in OnSize
 
-void wxNotebook::SetConstraintSizes(bool /* recurse */)
+void wxNotebook::SetConstraintSizes(bool WXUNUSED(recurse))
 {
   // don't set the sizes of the pages - their correct size is not yet known
   wxControl::SetConstraintSizes(FALSE);
 }
 
-bool wxNotebook::DoPhase(int /* nPhase */)
+bool wxNotebook::DoPhase(int WXUNUSED(nPhase))
 {
   return TRUE;
 }