X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/078cf5cb756c4f4113d7acf04ebd6a2535ef75b3..ba75967c9c0656ec0bcc342878cd9cdd27857ea9:/src/msw/nativdlg.cpp?ds=inline diff --git a/src/msw/nativdlg.cpp b/src/msw/nativdlg.cpp index fd61bcf8e2..d5cce1f1e5 100644 --- a/src/msw/nativdlg.cpp +++ b/src/msw/nativdlg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: nativdlg.cpp +// Name: src/msw/nativdlg.cpp // Purpose: Native dialog loading code (part of wxWindow) // Author: Julian Smart // Modified by: @@ -17,10 +17,6 @@ // headers // --------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -34,9 +30,7 @@ #include "wx/wx.h" #endif -#if defined(__WIN95__) #include "wx/spinbutt.h" -#endif #include "wx/msw/private.h" // --------------------------------------------------------------------------- @@ -152,20 +146,14 @@ wxWindow* wxWindow::GetWindowChild(wxWindowID id) wxWindow* win = GetWindowChild1(id); if ( !win ) { - HWND hWnd = ::GetDlgItem((HWND) GetHWND(), id); - - if (hWnd) + HWND hwnd = ::GetDlgItem(GetHwnd(), id); + if ( hwnd ) { - wxWindow* child = CreateWindowFromHWND(this, (WXHWND) hWnd); - if (child) - { - child->AddChild(this); - return child; - } + win = CreateWindowFromHWND(this, (WXHWND) hwnd); } } - return NULL; + return win; } // --------------------------------------------------------------------------- @@ -174,6 +162,8 @@ wxWindow* wxWindow::GetWindowChild(wxWindowID id) wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) { + wxCHECK_MSG( parent, NULL, wxT("must have valid parent for a control") ); + wxString str(wxGetWindowClass(hWnd)); str.UpperCase(); @@ -271,7 +261,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) win = new wxScrollBar; } #endif -#if defined(__WIN95__) && wxUSE_SPINBTN +#if wxUSE_SPINBTN else if (str == wxT("MSCTLS_UPDOWN32")) { win = new wxSpinButton; @@ -318,9 +308,6 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) if (win) { parent->AddChild(win); - win->SetEventHandler(win); - win->SetHWND(hWnd); - win->SetId(id); win->SubclassWin(hWnd); win->AdoptAttributesFromHWND(); win->SetupColours(); @@ -330,14 +317,14 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) } // Make sure the window style (etc.) reflects the HWND style (roughly) -void wxWindow::AdoptAttributesFromHWND(void) +void wxWindow::AdoptAttributesFromHWND() { - HWND hWnd = (HWND) GetHWND(); - long style = GetWindowLong((HWND) hWnd, GWL_STYLE); + SetId(wxGetWindowId(m_hWnd)); + + long style = GetWindowLong(GetHwnd(), GWL_STYLE); if (style & WS_VSCROLL) m_windowStyle |= wxVSCROLL; if (style & WS_HSCROLL) m_windowStyle |= wxHSCROLL; } -