X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fd3f686c274a264e89ea97505350a82c1134f307..601d9e60e12e417584857fc430113346aecde105:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 65ffdccfe9..3fde173b1f 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -95,17 +95,16 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd); #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler) +#endif BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) -EVT_CHAR(wxWindow::OnChar) -EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) -EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) -EVT_INIT_DIALOG(wxWindow::OnInitDialog) -EVT_IDLE(wxWindow::OnIdle) + EVT_CHAR(wxWindow::OnChar) + EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) + EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) + EVT_INIT_DIALOG(wxWindow::OnInitDialog) + EVT_IDLE(wxWindow::OnIdle) END_EVENT_TABLE() -#endif - // Find an item given the MS Windows id wxWindow *wxWindow::FindItem(int id) const { @@ -364,8 +363,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { - Init(); - wxCHECK_MSG( parent, FALSE, "can't create wxWindow without parent" ); parent->AddChild(this); @@ -1590,7 +1587,8 @@ long wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam) if ( win ) { - win->MSWNotify(wParam, lParam, &result); + if ( win->MSWNotify(wParam, lParam, &result) ) + return result; } else { @@ -1601,14 +1599,17 @@ long wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam) { wxWindow *child = (wxWindow *)node->Data(); if ( child->MSWNotify(wParam, lParam, &result) ) - break; + return result; node = node->Next(); } - } - return result; + // finally try this window too (catches toolbar case) + if ( MSWNotify(wParam, lParam, &result) ) + return result; + } #endif // Win95 + // not processed return FALSE; } @@ -4342,6 +4343,35 @@ bool wxWindow::IsExposed(const wxRect& rect) const return (m_updateRegion.Contains(rect) != wxOutRegion); } +// Set this window to be the child of 'parent'. +bool wxWindow::Reparent(wxWindow *parent) +{ + if (parent == GetParent()) + return TRUE; + + // Unlink this window from the existing parent. + if (GetParent()) + { + GetParent()->RemoveChild(this); + } + else + wxTopLevelWindows.DeleteObject(this); + + HWND hWndParent = 0; + HWND hWndChild = (HWND) GetHWND(); + if (parent != (wxWindow*) NULL) + { + parent->AddChild(this); + hWndParent = (HWND) parent->GetHWND(); + } + else + wxTopLevelWindows.Append(this); + + ::SetParent(hWndChild, hWndParent); + + return TRUE; +} + #ifdef __WXDEBUG__ const char *wxGetMessageName(int message) {