]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/nativdlg.cpp
make sure we are removing ourselves from the focus of the toplevel frame when deletin...
[wxWidgets.git] / src / msw / nativdlg.cpp
index 9ce9195d15e80e15ff02c1461ae7b3601399fec0..85a7920b99224fcab297d6dc20333763ddd240b8 100644 (file)
@@ -43,7 +43,6 @@
 // global functions
 // ---------------------------------------------------------------------------
 
-extern wxWindow *wxWndHook;
 extern LONG APIENTRY _EXPORT wxDlgProc(HWND hWnd, UINT message,
                                        WPARAM wParam, LPARAM lParam);
 
@@ -54,12 +53,12 @@ extern LONG APIENTRY _EXPORT wxDlgProc(HWND hWnd, UINT message,
 bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID& id)
 {
     m_windowId = id;
-    wxWndHook = this;
+
+    wxWindowCreationHook hook(this);
     m_hWnd = (WXHWND)::CreateDialog((HINSTANCE)wxGetInstance(),
                                     MAKEINTRESOURCE(id),
                                     parent ? (HWND)parent->GetHWND() : 0,
                                     (DLGPROC) wxDlgProc);
-    wxWndHook = NULL;
 
     if ( !m_hWnd )
         return FALSE;
@@ -93,12 +92,11 @@ bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name)
 {
     SetName(name);
 
-    wxWndHook = this;
+    wxWindowCreationHook hook(this);
     m_hWnd = (WXHWND)::CreateDialog((HINSTANCE) wxGetInstance(),
                                     name.c_str(),
                                     parent ? (HWND)parent->GetHWND() : 0,
                                     (DLGPROC)wxDlgProc);
-    wxWndHook = NULL;
 
     if ( !m_hWnd )
         return FALSE;
@@ -245,11 +243,13 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
         win = new wxSpinButton;
     }
 #endif
+#if wxUSE_SLIDER
     else if (str == wxT("MSCTLS_TRACKBAR32"))
     {
         // Need to ascertain if it's horiz or vert
         win = new wxSlider;
     }
+#endif // wxUSE_SLIDER
     else if (str == wxT("STATIC"))
     {
         int style1 = (style & 0xFF);
@@ -282,11 +282,9 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
         win->SubclassWin(hWnd);
         win->AdoptAttributesFromHWND();
         win->SetupColours();
-
-        return win;
     }
-    else
-        return NULL;
+
+    return win;
 }
 
 // Make sure the window style (etc.) reflects the HWND style (roughly)