From: Jamie Gadd Date: Thu, 9 Feb 2006 12:42:25 +0000 (+0000) Subject: Fix drag and drop inside static boxes. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/006b8dff84aa73203211c71ad2923acf53ca4f17 Fix drag and drop inside static boxes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 39ca9398b7..e1c1b632fa 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -123,6 +123,7 @@ wxMSW: - Fixed out by one error in wxTextCtrl::GetStyle. - Fixed problem with getting input in universal/unicode build of wxMSW. - Link oleacc.lib conditionally. +- Drag and drop now works inside static boxes. wxGTK: diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 422745e451..ee37aeb2c7 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1424,6 +1424,22 @@ void wxWindowMSW::Update() // drag and drop // --------------------------------------------------------------------------- +// we need to lower the sibling static boxes so controls contained within can be +// a drop target +static inline void AdjustStaticBoxZOrder(wxWindow *parent) +{ + for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst(); + node; + node = node->GetNext() ) + { + wxStaticBox *statbox = wxDynamicCast(node->GetData(), wxStaticBox); + if ( statbox ) + { + ::SetWindowPos(GetHwndOf(statbox), HWND_BOTTOM, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } + } +} #if wxUSE_DRAG_AND_DROP void wxWindowMSW::SetDropTarget(wxDropTarget *pDropTarget) @@ -1435,7 +1451,10 @@ void wxWindowMSW::SetDropTarget(wxDropTarget *pDropTarget) m_dropTarget = pDropTarget; if ( m_dropTarget != 0 ) + { + AdjustStaticBoxZOrder(GetParent()); m_dropTarget->Register(m_hWnd); + } } #endif // wxUSE_DRAG_AND_DROP @@ -1446,7 +1465,10 @@ void wxWindowMSW::DragAcceptFiles(bool WXUNUSED_IN_WINCE(accept)) #ifndef __WXWINCE__ HWND hWnd = GetHwnd(); if ( hWnd ) + { + AdjustStaticBoxZOrder(GetParent()); ::DragAcceptFiles(hWnd, (BOOL)accept); + } #endif }