]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/nativdlg.cpp
remove incorrect cast of wxString to char* (unnecessary and breaks wxUSE_STL build)
[wxWidgets.git] / src / msw / nativdlg.cpp
index 5e6ff9865a637e7c8240f2b7a2b50550a8ed67ba..b7ba64f61310acc4e55ef5668c7f242a59351262 100644 (file)
@@ -146,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;
 }
 
 // ---------------------------------------------------------------------------
@@ -168,6 +162,8 @@ wxWindow* wxWindow::GetWindowChild(wxWindowID id)
 
 wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
 {
+    wxCHECK_MSG( parent, NULL, _T("must have valid parent for a control") );
+
     wxString str(wxGetWindowClass(hWnd));
     str.UpperCase();
 
@@ -312,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();
@@ -324,10 +317,11 @@ 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;