]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
Added wxWindowBase::CentreOnParent to allow top level windows to be
[wxWidgets.git] / src / msw / notebook.cpp
index eb551853d5318c6bebf6d3ee23ff6b19125bc49e..f16fa88b610298004b54d12418c3214a88811c09 100644 (file)
@@ -68,8 +68,7 @@
   BEGIN_EVENT_TABLE(wxNotebook, wxControl)
     EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
 
-    // doesn't work yet EVT_WINDOW_CREATE(wxNotebook::OnWindowCreate)
-    EVT_SIZE(wxNotebook::OnWindowCreate)
+    EVT_SIZE(wxNotebook::OnSize)
 
     EVT_SET_FOCUS(wxNotebook::OnSetFocus)
 
@@ -143,28 +142,16 @@ bool wxNotebook::Create(wxWindow *parent,
   if (m_windowStyle & wxNB_FIXEDWIDTH)
     tabStyle |= TCS_FIXEDWIDTH ;
 
-  // create the tab control.
-  m_hWnd = (WXHWND)CreateWindowEx
-    (
-      0,                                      // extended style
-      WC_TABCONTROL,                          // class name for the tab control
-      "",                                     // no caption
-      tabStyle,                               // style
-      pos.x, pos.y, size.x, size.y,           // size and position
-      (HWND)parent->GetHWND(),                // parent window
-      (HMENU)m_windowId,                      // child id
-      wxGetInstance(),                        // current instance
-      NULL                                    // no class data
-    );
-
-  if ( m_hWnd == 0 ) {
-    wxLogSysError("Can't create the notebook control");
+  if ( !MSWCreate(GetId(), GetParent(), WC_TABCONTROL,
+                  this, NULL, pos.x, pos.y, size.x, size.y,
+                  tabStyle, NULL, 0) )
+  {
     return FALSE;
   }
 
   // Not all compilers recognise SetWindowFont
-  ::SendMessage((HWND) m_hwnd, WM_SETFONT,
-                  (WPARAM)::GetStockObject(DEFAULT_GUI_FONT),TRUE);
+  ::SendMessage(GetHwnd(), WM_SETFONT,
+                (WPARAM)::GetStockObject(DEFAULT_GUI_FONT), TRUE);
 
 
   if ( parent != NULL )
@@ -390,7 +377,7 @@ bool wxNotebook::InsertPage(int nPage,
 // wxNotebook callbacks
 // ----------------------------------------------------------------------------
 
-void wxNotebook::OnWindowCreate(wxWindowCreateEvent& event)
+void wxNotebook::OnSize(wxSizeEvent& event)
 {
   // make sure the current page is shown and has focus (it's useful because all
   // pages are created invisible initially)