]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix drag and drop inside static boxes.
authorJamie Gadd <jrgadd2@cs.latrobe.edu.au>
Thu, 9 Feb 2006 12:42:25 +0000 (12:42 +0000)
committerJamie Gadd <jrgadd2@cs.latrobe.edu.au>
Thu, 9 Feb 2006 12:42:25 +0000 (12:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/window.cpp

index 39ca9398b713d4b024018849ad968da4a2bade3f..e1c1b632fa813d2bf953c40bbad309dc2a0cf9e1 100644 (file)
@@ -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:
 
index 422745e451430f39fdb7dc57b84354aa48fef25b..ee37aeb2c73f808b2d53c05738d8ed51551157f5 100644 (file)
@@ -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
 }