X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a2f9a636883d3207c0c36bd9f283a7beb23f6c43..5e0d7b6bce53ad3ceb3c832925c25d2e614a0d62:/src/generic/splitter.cpp?ds=inline diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index ecacc1f253..01e143d8b8 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -16,6 +16,7 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#if wxUSE_SPLITTER #ifdef __BORLANDC__ #pragma hdrstop #endif @@ -168,11 +169,8 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) int x = (int)event.GetX(), y = (int)event.GetY(); - // reset the cursor -#if defined( __WXMOTIF__ ) || defined( __WXGTK__ ) || defined( __WXMAC__ ) - SetCursor(* wxSTANDARD_CURSOR); -#elif defined(__WXMSW__) - SetCursor(wxCursor()); +#if defined(__WXMSW__) + // SetCursor(wxCursor()); // Is this required? #endif if (GetWindowStyle() & wxSP_NOSASH) @@ -188,9 +186,12 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) { if ( SashHitTest(x, y) ) { - CaptureMouse(); - + // Start the drag now m_dragMode = wxSPLIT_DRAG_DRAGGING; + + // Capture mouse and set the cursor + CaptureMouse(); + SetResizeCursor(); if ( !isLive ) { @@ -212,7 +213,10 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) { // We can stop dragging now and see what we've got. m_dragMode = wxSPLIT_DRAG_NONE; + + // Release mouse and unset the cursor ReleaseMouse(); + SetCursor(* wxSTANDARD_CURSOR); // exit if unsplit after doubleclick if ( !IsSplit() ) @@ -249,6 +253,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) m_windowOne = m_windowTwo; m_windowTwo = (wxWindow *) NULL; OnUnsplit(removedWindow); + wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); + event.m_data.win = removedWindow; + (void)DoSendEvent(event); SetSashPositionAndNotify(0); } else if ( posSashNew == GetWindowSize() ) @@ -257,6 +264,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) wxWindow *removedWindow = m_windowTwo; m_windowTwo = (wxWindow *) NULL; OnUnsplit(removedWindow); + wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); + event.m_data.win = removedWindow; + (void)DoSendEvent(event); SetSashPositionAndNotify(0); } else @@ -271,34 +281,20 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) SizeWindows(); } // left up && dragging - else if (event.Moving() && !event.Dragging()) + else if ((event.Moving() || event.Leaving() || event.Entering()) && (m_dragMode == wxSPLIT_DRAG_NONE)) { - // Just change the cursor if required - if ( SashHitTest(x, y) ) + // Just change the cursor as required + if ( !event.Leaving() && SashHitTest(x, y) ) { SetResizeCursor(); } -#if defined(__WXGTK__) || defined(__WXMSW__) || defined(__WXMAC__) else { - // We must set the normal cursor in MSW, because - // if the child window doesn't have a cursor, the - // parent's (splitter window) will be used, and this - // must be the standard cursor. - - // where else do we unset the cursor? SetCursor(* wxSTANDARD_CURSOR); } -#endif // __WXGTK__ } else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING)) { -#if defined( __WXMSW__ ) || defined( __WXMAC__ ) - // Otherwise, the cursor sometimes reverts to the normal cursor - // during dragging. - SetResizeCursor(); -#endif // __WXMSW__ - int diff = m_splitMode == wxSPLIT_VERTICAL ? x - m_oldX : y - m_oldY; if ( !diff ) { @@ -892,7 +888,7 @@ bool wxSplitterWindow::Unsplit(wxWindow *toRemove) return FALSE; } - win->Show(FALSE); + OnUnsplit(win); DoSetSashPosition(0); SizeWindows(); @@ -1073,8 +1069,12 @@ void wxSplitterWindow::OnDoubleClickSash(int x, int y) if ( GetMinimumPaneSize() == 0 || m_permitUnsplitAlways ) { wxWindow* win = m_windowTwo; - if (Unsplit(win)) - OnUnsplit(win); + if ( Unsplit(win) ) + { + wxSplitterEvent unsplitEvent(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); + unsplitEvent.m_data.win = win; + (void)DoSendEvent(unsplitEvent); + } } } //else: blocked by user @@ -1082,13 +1082,8 @@ void wxSplitterWindow::OnDoubleClickSash(int x, int y) void wxSplitterWindow::OnUnsplit(wxWindow *winRemoved) { - // do it before calling the event handler which may delete the window + // call this before calling the event handler which may delete the window winRemoved->Show(FALSE); - - wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this); - event.m_data.win = winRemoved; - - (void)DoSendEvent(event); } #if defined( __WXMSW__ ) || defined( __WXMAC__) @@ -1108,5 +1103,6 @@ void wxSplitterWindow::OnSetCursor(wxSetCursorEvent& event) //else: do nothing, in particular, don't call Skip() } +#endif // wxUSE_SPLITTER #endif // wxMSW