]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/splitter.cpp
Changed Socket() and SocketEvent() to Get... in the samples, also added
[wxWidgets.git] / src / generic / splitter.cpp
index 7070960e1e047667d7fdef8a01bd8d618b048fb4..6f45254813e16188c000d716f43d8d4ecae62391 100644 (file)
@@ -42,6 +42,8 @@ BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
     EVT_IDLE(wxSplitterWindow::OnIdle)
     EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent)
 
+    EVT_SET_CURSOR(wxSplitterWindow::OnSetCursor)
+
     EVT_SPLITTER_SASH_POS_CHANGED(-1, wxSplitterWindow::OnSashPosChanged)
     // NB: we borrow OnSashPosChanged for purposes of
     // EVT_SPLITTER_SASH_POS_CHANGING since default implementation is identical
@@ -162,8 +164,8 @@ void wxSplitterWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
 
 void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
 {
-    long x = event.GetX();
-    long y = event.GetY();
+    wxCoord x = (wxCoord)event.GetX(),
+            y = (wxCoord)event.GetY();
 
     // reset the cursor
 #ifdef __WXMOTIF__
@@ -189,6 +191,15 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
 
             m_oldX = x;
             m_oldY = y;
+
+            if ( m_splitMode == wxSPLIT_VERTICAL )
+            {
+                SetCursor(*m_sashCursorWE);
+            }
+            else
+            {
+                SetCursor(*m_sashCursorNS);
+            }
             return;
         }
     }
@@ -225,8 +236,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
             }
         }
 
-        if ( m_permitUnsplitAlways
-                || m_minimumPaneSize == 0 )
+        if ( m_permitUnsplitAlways || m_minimumPaneSize == 0 )
         {
             // Deal with possible unsplit scenarios
             if ( new_sash_position == 0 )
@@ -257,6 +267,7 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
         }
 
         SizeWindows();
+        m_needUpdating = FALSE;
     }  // left up && dragging
     else if (event.Moving() && !event.Dragging())
     {
@@ -279,9 +290,24 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
             SetCursor(* wxSTANDARD_CURSOR);
         }
 #endif // __WXGTK__
+
+        m_needUpdating = FALSE;
     }
     else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING))
     {
+#ifdef __WXMSW__
+        // Otherwise, the cursor sometimes reverts to the normal cursor
+        // during dragging.
+        if ( m_splitMode == wxSPLIT_VERTICAL )
+        {
+            SetCursor(*m_sashCursorWE);
+        }
+        else
+        {
+            SetCursor(*m_sashCursorNS);
+        }
+#endif
+
         // Obtain window size. We are only interested in the dimension the sash
         // splits up
         int new_sash_position =
@@ -905,3 +931,21 @@ void wxSplitterWindow::OnUnsplitEvent(wxSplitterEvent& event)
     // for compatibility, call the virtual function
     OnUnsplit(win);
 }
+
+void wxSplitterWindow::OnSetCursor(wxSetCursorEvent& event)
+{
+    // this is currently called (and needed) under MSW only...
+#ifdef __WXMSW__
+
+    // if we don't do it, the resizing cursor might be set for child window:
+    // and like this we explicitly say that our cursor should not be used for
+    // children windows which overlap us
+
+    if ( SashHitTest(event.GetX(), event.GetY()) )
+    {
+        // default processing is ok
+        event.Skip();
+    }
+    //else: do nothing, in particular, don't call Skip()
+#endif // wxMSW
+}