]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/splitter.cpp
Upported fix to mouse capture event handling.
[wxWidgets.git] / src / generic / splitter.cpp
index 2927eacbdb88ed68b969d6d4bb6c7523f610a6ce..ecacc1f253008ff0ab15456915443d3d3e892e17 100644 (file)
@@ -52,7 +52,7 @@ BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
     EVT_IDLE(wxSplitterWindow::OnIdle)
     EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent)
 
-#ifdef __WXMSW__
+#if defined( __WXMSW__ ) || defined( __WXMAC__)
     EVT_SET_CURSOR(wxSplitterWindow::OnSetCursor)
 #endif // wxMSW
 
@@ -358,7 +358,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
             m_needUpdating = TRUE;
         }
     }
-    else if ( event.LeftDClick() )
+    else if ( event.LeftDClick() && m_windowTwo )
     {
         OnDoubleClickSash(x, y);
     }
@@ -892,7 +892,7 @@ bool wxSplitterWindow::Unsplit(wxWindow *toRemove)
         return FALSE;
     }
 
-    OnUnsplit(win);
+    win->Show(FALSE);
     DoSetSashPosition(0);
     SizeWindows();
 
@@ -1062,6 +1062,8 @@ int wxSplitterWindow::OnSashPositionChanging(int newSashPosition)
 // the sash if the minimum pane size is zero.
 void wxSplitterWindow::OnDoubleClickSash(int x, int y)
 {
+    wxCHECK_RET(m_windowTwo, wxT("splitter: no window to remove"));
+
     // new code should handle events instead of using the virtual functions
     wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, this);
     event.m_data.pt.x = x;
@@ -1070,7 +1072,9 @@ void wxSplitterWindow::OnDoubleClickSash(int x, int y)
     {
         if ( GetMinimumPaneSize() == 0 || m_permitUnsplitAlways )
         {
-            Unsplit();
+            wxWindow* win = m_windowTwo;
+            if (Unsplit(win))
+                OnUnsplit(win);
         }
     }
     //else: blocked by user
@@ -1087,7 +1091,7 @@ void wxSplitterWindow::OnUnsplit(wxWindow *winRemoved)
     (void)DoSendEvent(event);
 }
 
-#ifdef __WXMSW__
+#if defined( __WXMSW__ ) || defined( __WXMAC__)
 
 // this is currently called (and needed) under MSW only...
 void wxSplitterWindow::OnSetCursor(wxSetCursorEvent& event)