]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
regenerated configure from new configure.in
[wxWidgets.git] / src / msw / notebook.cpp
index 80dad3b71399abc2280945a537354132e3f874b6..788da296c5cf3b8b373252202cc9e4e2529e8813 100644 (file)
@@ -9,22 +9,15 @@
 // Licence:     wxWindows license
 ///////////////////////////////////////////////////////////////////////////////
 
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
 #ifdef __GNUG__
-  #pragma implementation "notebook.h"
+#pragma implementation "notebook.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-  #pragma hdrstop
+#pragma hdrstop
 #endif
 
 // wxWindows
@@ -70,6 +63,7 @@
     EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
 
     EVT_SIZE(wxNotebook::OnSize)
+    EVT_ERASE_BACKGROUND(wxNotebook::OnEraseBackground)
     EVT_SET_FOCUS(wxNotebook::OnSetFocus)
     EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
   END_EVENT_TABLE()
@@ -130,9 +124,6 @@ bool wxNotebook::Create(wxWindow *parent,
   m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
   m_foregroundColour = *wxBLACK ;
 
-  m_defaultForegroundColour = *wxBLACK ;
-  m_defaultBackgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
-
   // style
   m_windowStyle = style | wxTAB_TRAVERSAL;
 
@@ -161,7 +152,11 @@ bool wxNotebook::Create(wxWindow *parent,
     return FALSE;
   }
 
-  SetWindowFont((HWND)m_hwnd, ::GetStockObject(DEFAULT_GUI_FONT), FALSE);
+  // Not all compilers recognise SetWindowFont
+//  SetWindowFont((HWND)m_hwnd, ::GetStockObject(DEFAULT_GUI_FONT), FALSE);
+  ::SendMessage((HWND) m_hwnd, WM_SETFONT,
+                  (WPARAM)::GetStockObject(DEFAULT_GUI_FONT),TRUE);
+
 
   if ( parent != NULL ) 
     parent->AddChild(this);
@@ -194,7 +189,7 @@ int wxNotebook::GetRowCount() const
 
 int wxNotebook::SetSelection(int nPage)
 {
-  wxASSERT( IS_VALID_PAGE(nPage) );
+  wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, "notebook page out of range" );
 
   ChangePage(m_nSelection, nPage);
 
@@ -213,7 +208,7 @@ void wxNotebook::AdvanceSelection(bool bForward)
 
 bool wxNotebook::SetPageText(int nPage, const wxString& strText)
 {
-  wxASSERT( IS_VALID_PAGE(nPage) );
+  wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" );
 
   TC_ITEM tcItem;
   tcItem.mask = TCIF_TEXT;
@@ -224,7 +219,7 @@ bool wxNotebook::SetPageText(int nPage, const wxString& strText)
 
 wxString wxNotebook::GetPageText(int nPage) const
 {
-  wxASSERT( IS_VALID_PAGE(nPage) );
+  wxCHECK_MSG( IS_VALID_PAGE(nPage), "", "notebook page out of range" );
 
   char buf[256];
   TC_ITEM tcItem;
@@ -241,7 +236,7 @@ wxString wxNotebook::GetPageText(int nPage) const
 
 int wxNotebook::GetPageImage(int nPage) const
 {
-  wxASSERT( IS_VALID_PAGE(nPage) );
+  wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, "notebook page out of range" );
 
   TC_ITEM tcItem;
   tcItem.mask = TCIF_IMAGE;
@@ -251,7 +246,7 @@ int wxNotebook::GetPageImage(int nPage) const
 
 bool wxNotebook::SetPageImage(int nPage, int nImage)
 {
-  wxASSERT( IS_VALID_PAGE(nPage) );
+  wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" );
 
   TC_ITEM tcItem;
   tcItem.mask = TCIF_IMAGE;
@@ -273,7 +268,7 @@ void wxNotebook::SetImageList(wxImageList* imageList)
 // remove one page from the notebook
 bool wxNotebook::DeletePage(int nPage)
 {
-  wxCHECK( IS_VALID_PAGE(nPage), FALSE );
+  wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" );
 
   TabCtrl_DeleteItem(m_hwnd, nPage);
 
@@ -403,7 +398,7 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
     // pass to the parent
     if ( GetParent() ) {
       event.SetCurrentFocus(this);
-      GetParent()->ProcessEvent(event);
+      GetParent()->GetEventHandler()->ProcessEvent(event);
     }
   }
 }
@@ -458,7 +453,7 @@ bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
   event.SetEventObject(this);
   event.SetInt(LOWORD(wParam));
 
-  return ProcessEvent(event);
+  return GetEventHandler()->ProcessEvent(event);
 }
 
 // ----------------------------------------------------------------------------
@@ -482,3 +477,9 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
 
   m_nSelection = nSel;
 }
+
+void wxNotebook::OnEraseBackground(wxEraseEvent& event)
+{
+    Default();
+}
+