Cleaned the mess in wxSplitterWindow::OnMouse()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -168,11 +168,8 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
int x = (int)event.GetX(),
|
int x = (int)event.GetX(),
|
||||||
y = (int)event.GetY();
|
y = (int)event.GetY();
|
||||||
|
|
||||||
// reset the cursor
|
#if defined(__WXMSW__)
|
||||||
#if defined( __WXMOTIF__ ) || defined( __WXGTK__ ) || defined( __WXMAC__ )
|
// SetCursor(wxCursor()); // Is this required?
|
||||||
SetCursor(* wxSTANDARD_CURSOR);
|
|
||||||
#elif defined(__WXMSW__)
|
|
||||||
SetCursor(wxCursor());
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (GetWindowStyle() & wxSP_NOSASH)
|
if (GetWindowStyle() & wxSP_NOSASH)
|
||||||
@@ -188,9 +185,12 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
{
|
{
|
||||||
if ( SashHitTest(x, y) )
|
if ( SashHitTest(x, y) )
|
||||||
{
|
{
|
||||||
CaptureMouse();
|
// Start the drag now
|
||||||
|
|
||||||
m_dragMode = wxSPLIT_DRAG_DRAGGING;
|
m_dragMode = wxSPLIT_DRAG_DRAGGING;
|
||||||
|
|
||||||
|
// Capture mouse and set the cursor
|
||||||
|
CaptureMouse();
|
||||||
|
SetResizeCursor();
|
||||||
|
|
||||||
if ( !isLive )
|
if ( !isLive )
|
||||||
{
|
{
|
||||||
@@ -204,7 +204,6 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
m_oldX = x;
|
m_oldX = x;
|
||||||
m_oldY = y;
|
m_oldY = y;
|
||||||
|
|
||||||
SetResizeCursor();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +211,10 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
{
|
{
|
||||||
// We can stop dragging now and see what we've got.
|
// We can stop dragging now and see what we've got.
|
||||||
m_dragMode = wxSPLIT_DRAG_NONE;
|
m_dragMode = wxSPLIT_DRAG_NONE;
|
||||||
|
|
||||||
|
// Release mouse and unset the cursor
|
||||||
ReleaseMouse();
|
ReleaseMouse();
|
||||||
|
SetCursor(* wxSTANDARD_CURSOR);
|
||||||
|
|
||||||
// exit if unsplit after doubleclick
|
// exit if unsplit after doubleclick
|
||||||
if ( !IsSplit() )
|
if ( !IsSplit() )
|
||||||
@@ -271,34 +273,16 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
|
|
||||||
SizeWindows();
|
SizeWindows();
|
||||||
} // left up && dragging
|
} // 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
|
// Just change the cursor as required
|
||||||
if ( SashHitTest(x, y) )
|
if ( SashHitTest(x, y) )
|
||||||
{
|
|
||||||
SetResizeCursor();
|
SetResizeCursor();
|
||||||
}
|
|
||||||
#if defined(__WXGTK__) || defined(__WXMSW__) || defined(__WXMAC__)
|
|
||||||
else
|
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);
|
SetCursor(* wxSTANDARD_CURSOR);
|
||||||
}
|
|
||||||
#endif // __WXGTK__
|
|
||||||
}
|
}
|
||||||
else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING))
|
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;
|
int diff = m_splitMode == wxSPLIT_VERTICAL ? x - m_oldX : y - m_oldY;
|
||||||
if ( !diff )
|
if ( !diff )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user