]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
added a section about Connect(), improve/streamline the one about event tables
[wxWidgets.git] / src / msw / notebook.cpp
index 6c4342ed9101c2acc210bc384dd516b6ba880a1b..5c9cd14cd21832c3ecab7e958bdf14a74cc60d72 100644 (file)
@@ -36,6 +36,7 @@
 #include "wx/sysopt.h"
 
 #include "wx/msw/private.h"
+#include "wx/msw/dc.h"
 
 #include <windowsx.h>
 #include "wx/msw/winundef.h"
@@ -122,7 +123,7 @@ WX_DEFINE_LIST( wxNotebookPageInfoList )
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
 
-BEGIN_EVENT_TABLE(wxNotebook, wxControl)
+BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
     EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange)
     EVT_SIZE(wxNotebook::OnSize)
     EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
@@ -175,7 +176,7 @@ wxBEGIN_FLAGS( wxNotebookStyle )
 
 wxEND_FLAGS( wxNotebookStyle )
 
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxControl,"wx/notebook.h")
+IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxBookCtrlBase,"wx/notebook.h")
 IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebookPageInfo, wxObject , "wx/notebook.h" )
 
 wxCOLLECTION_TYPE_INFO( wxNotebookPageInfo * , wxNotebookPageInfoList ) ;
@@ -212,7 +213,7 @@ wxEND_HANDLERS_TABLE()
 wxCONSTRUCTOR_4( wxNotebookPageInfo , wxNotebookPage* , Page , wxString , Text , bool , Selected , int , ImageId )
 
 #else
-IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
 IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject )
 #endif
 IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
@@ -383,7 +384,7 @@ bool wxNotebook::Create(wxWindow *parent,
             wxUxThemeEngine::GetIfActive()->SetWindowTheme(GetHwnd(), L"", L"");
 
             // correct the background color for the new non-themed control
-            SetBackgroundColour(GetThemeBackgroundColour()); 
+            SetBackgroundColour(GetThemeBackgroundColour());
         }
     }
 #endif // wxUSE_UXTHEME
@@ -945,9 +946,11 @@ void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event))
         hbr = GetHbrushOf(brush);
     }
 
-    ::FillRect(GetHdcOf(memdc), &rc, hbr);
+    wxMSWDCImpl *impl = (wxMSWDCImpl*) memdc.GetImpl();
 
-    MSWDefWindowProc(WM_PAINT, (WPARAM)memdc.GetHDC(), 0);
+    ::FillRect(GetHdcOf(*impl), &rc, hbr);
+
+    MSWDefWindowProc(WM_PAINT, (WPARAM)(impl->GetHDC()), 0);
 
     // For some reason in RTL mode, source offset has to be -1, otherwise the
     // right border (physical) remains unpainted.
@@ -1143,7 +1146,7 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
                 event.SetEventObject(this);
 
                 wxWindow *page = m_pages[m_nSelection];
-                if ( !page->GetEventHandler()->ProcessEvent(event) )
+                if ( !page->HandleWindowEvent(event) )
                 {
                     page->SetFocus();
                 }
@@ -1167,7 +1170,7 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
             else if ( parent )
             {
                 event.SetCurrentFocus(this);
-                parent->GetEventHandler()->ProcessEvent(event);
+                parent->HandleWindowEvent(event);
             }
         }
     }
@@ -1441,7 +1444,7 @@ bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
   event.SetEventObject(this);
   event.SetInt(idCtrl);
 
-  bool processed = GetEventHandler()->ProcessEvent(event);
+  bool processed = HandleWindowEvent(event);
   *result = !event.IsAllowed();
   return processed;
 }