maintaint the mouse capture stack in all ports, not just wxUniv
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -65,8 +65,6 @@ public:
|
|||||||
virtual bool Reparent( wxWindowBase *newParent );
|
virtual bool Reparent( wxWindowBase *newParent );
|
||||||
|
|
||||||
virtual void WarpPointer(int x, int y);
|
virtual void WarpPointer(int x, int y);
|
||||||
virtual void CaptureMouse();
|
|
||||||
virtual void ReleaseMouse();
|
|
||||||
|
|
||||||
virtual void Refresh( bool eraseBackground = TRUE,
|
virtual void Refresh( bool eraseBackground = TRUE,
|
||||||
const wxRect *rect = (const wxRect *) NULL );
|
const wxRect *rect = (const wxRect *) NULL );
|
||||||
@@ -159,7 +157,7 @@ public:
|
|||||||
// the layouting functions have to be called later on
|
// the layouting functions have to be called later on
|
||||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
||||||
|
|
||||||
// position and size of the window
|
// position and size of the window
|
||||||
int m_x, m_y;
|
int m_x, m_y;
|
||||||
int m_width, m_height;
|
int m_width, m_height;
|
||||||
@@ -168,7 +166,7 @@ public:
|
|||||||
// see the docs in src/gtk/window.cpp
|
// see the docs in src/gtk/window.cpp
|
||||||
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
||||||
GtkWidget *m_wxwindow; // mostly the client area as per wxWindows
|
GtkWidget *m_wxwindow; // mostly the client area as per wxWindows
|
||||||
|
|
||||||
// this widget will be queried for GTK's focus events
|
// this widget will be queried for GTK's focus events
|
||||||
GtkWidget *m_focusWidget;
|
GtkWidget *m_focusWidget;
|
||||||
|
|
||||||
@@ -229,6 +227,9 @@ public:
|
|||||||
virtual void DoSetClientSize(int width, int height);
|
virtual void DoSetClientSize(int width, int height);
|
||||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||||
|
|
||||||
|
virtual void DoCaptureMouse();
|
||||||
|
virtual void DoReleaseMouse();
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
virtual void DoSetToolTip( wxToolTip *tip );
|
virtual void DoSetToolTip( wxToolTip *tip );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
@@ -65,8 +65,6 @@ public:
|
|||||||
virtual bool Reparent( wxWindowBase *newParent );
|
virtual bool Reparent( wxWindowBase *newParent );
|
||||||
|
|
||||||
virtual void WarpPointer(int x, int y);
|
virtual void WarpPointer(int x, int y);
|
||||||
virtual void CaptureMouse();
|
|
||||||
virtual void ReleaseMouse();
|
|
||||||
|
|
||||||
virtual void Refresh( bool eraseBackground = TRUE,
|
virtual void Refresh( bool eraseBackground = TRUE,
|
||||||
const wxRect *rect = (const wxRect *) NULL );
|
const wxRect *rect = (const wxRect *) NULL );
|
||||||
@@ -159,7 +157,7 @@ public:
|
|||||||
// the layouting functions have to be called later on
|
// the layouting functions have to be called later on
|
||||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
||||||
|
|
||||||
// position and size of the window
|
// position and size of the window
|
||||||
int m_x, m_y;
|
int m_x, m_y;
|
||||||
int m_width, m_height;
|
int m_width, m_height;
|
||||||
@@ -168,7 +166,7 @@ public:
|
|||||||
// see the docs in src/gtk/window.cpp
|
// see the docs in src/gtk/window.cpp
|
||||||
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
||||||
GtkWidget *m_wxwindow; // mostly the client area as per wxWindows
|
GtkWidget *m_wxwindow; // mostly the client area as per wxWindows
|
||||||
|
|
||||||
// this widget will be queried for GTK's focus events
|
// this widget will be queried for GTK's focus events
|
||||||
GtkWidget *m_focusWidget;
|
GtkWidget *m_focusWidget;
|
||||||
|
|
||||||
@@ -229,6 +227,9 @@ public:
|
|||||||
virtual void DoSetClientSize(int width, int height);
|
virtual void DoSetClientSize(int width, int height);
|
||||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||||
|
|
||||||
|
virtual void DoCaptureMouse();
|
||||||
|
virtual void DoReleaseMouse();
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
virtual void DoSetToolTip( wxToolTip *tip );
|
virtual void DoSetToolTip( wxToolTip *tip );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
@@ -90,8 +90,6 @@ public:
|
|||||||
virtual bool Reparent(wxWindowBase *newParent);
|
virtual bool Reparent(wxWindowBase *newParent);
|
||||||
|
|
||||||
virtual void WarpPointer(int x, int y);
|
virtual void WarpPointer(int x, int y);
|
||||||
virtual void CaptureMouse();
|
|
||||||
virtual void ReleaseMouse();
|
|
||||||
|
|
||||||
virtual void Refresh( bool eraseBackground = TRUE,
|
virtual void Refresh( bool eraseBackground = TRUE,
|
||||||
const wxRect *rect = (const wxRect *) NULL );
|
const wxRect *rect = (const wxRect *) NULL );
|
||||||
@@ -438,6 +436,9 @@ protected:
|
|||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
virtual void DoSetClientSize(int width, int height);
|
virtual void DoSetClientSize(int width, int height);
|
||||||
|
|
||||||
|
virtual void DoCaptureMouse();
|
||||||
|
virtual void DoReleaseMouse();
|
||||||
|
|
||||||
// move the window to the specified location and resize it: this is called
|
// move the window to the specified location and resize it: this is called
|
||||||
// from both DoSetSize() and DoSetClientSize() and would usually just call
|
// from both DoSetSize() and DoSetClientSize() and would usually just call
|
||||||
// ::MoveWindow() except for composite controls which will want to arrange
|
// ::MoveWindow() except for composite controls which will want to arrange
|
||||||
|
@@ -200,13 +200,6 @@ public:
|
|||||||
// we refresh the window when it is dis/enabled
|
// we refresh the window when it is dis/enabled
|
||||||
virtual bool Enable(bool enable = TRUE);
|
virtual bool Enable(bool enable = TRUE);
|
||||||
|
|
||||||
// our Capture/ReleaseMouse() maintains the stack of windows which had
|
|
||||||
// captured the mouse and when ReleaseMouse() is called, the mouse freed
|
|
||||||
// only if the stack is empty, otherwise it is captured back by the window
|
|
||||||
// on top of the stack
|
|
||||||
virtual void CaptureMouse();
|
|
||||||
virtual void ReleaseMouse();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -460,9 +460,12 @@ public:
|
|||||||
// move the mouse to the specified position
|
// move the mouse to the specified position
|
||||||
virtual void WarpPointer(int x, int y) = 0;
|
virtual void WarpPointer(int x, int y) = 0;
|
||||||
|
|
||||||
// start or end mouse capture
|
// start or end mouse capture, these functions maintain the stack of
|
||||||
virtual void CaptureMouse() = 0;
|
// windows having captured the mouse and after calling ReleaseMouse()
|
||||||
virtual void ReleaseMouse() = 0;
|
// the mouse is not released but returns to the window which had had
|
||||||
|
// captured it previously (if any)
|
||||||
|
void CaptureMouse();
|
||||||
|
void ReleaseMouse();
|
||||||
|
|
||||||
// get the window which currently captures the mouse or NULL
|
// get the window which currently captures the mouse or NULL
|
||||||
static wxWindow *GetCapture();
|
static wxWindow *GetCapture();
|
||||||
@@ -883,6 +886,10 @@ protected:
|
|||||||
|
|
||||||
virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const;
|
virtual wxHitTest DoHitTest(wxCoord x, wxCoord y) const;
|
||||||
|
|
||||||
|
// capture/release the mouse, used by Capture/ReleaseMouse()
|
||||||
|
virtual void DoCaptureMouse();
|
||||||
|
virtual void DoReleaseMouse();
|
||||||
|
|
||||||
// retrieve the position/size of the window
|
// retrieve the position/size of the window
|
||||||
virtual void DoGetPosition( int *x, int *y ) const = 0;
|
virtual void DoGetPosition( int *x, int *y ) const = 0;
|
||||||
virtual void DoGetSize( int *width, int *height ) const = 0;
|
virtual void DoGetSize( int *width, int *height ) const = 0;
|
||||||
|
@@ -1612,3 +1612,50 @@ wxHitTest wxWindowBase::DoHitTest(wxCoord x, wxCoord y) const
|
|||||||
return outside ? wxHT_WINDOW_OUTSIDE : wxHT_WINDOW_INSIDE;
|
return outside ? wxHT_WINDOW_OUTSIDE : wxHT_WINDOW_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// mouse capture
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
struct WXDLLEXPORT wxWindowNext
|
||||||
|
{
|
||||||
|
wxWindow *win;
|
||||||
|
wxWindowNext *next;
|
||||||
|
} *wxWindow::ms_winCaptureNext = NULL;
|
||||||
|
|
||||||
|
void wxWindow::CaptureMouse()
|
||||||
|
{
|
||||||
|
wxLogTrace(_T("mousecapture"), _T("CaptureMouse(0x%08x)"), this);
|
||||||
|
|
||||||
|
wxWindow *winOld = GetCapture();
|
||||||
|
if ( winOld )
|
||||||
|
{
|
||||||
|
// save it on stack
|
||||||
|
wxWindowNext *item = new wxWindowNext;
|
||||||
|
item->win = winOld;
|
||||||
|
item->next = ms_winCaptureNext;
|
||||||
|
ms_winCaptureNext = item;
|
||||||
|
}
|
||||||
|
//else: no mouse capture to save
|
||||||
|
|
||||||
|
DoCaptureMouse();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxWindow::ReleaseMouse()
|
||||||
|
{
|
||||||
|
DoReleaseMouse();
|
||||||
|
|
||||||
|
if ( ms_winCaptureNext )
|
||||||
|
{
|
||||||
|
ms_winCaptureNext->win->CaptureMouse();
|
||||||
|
|
||||||
|
wxWindowNext *item = ms_winCaptureNext;
|
||||||
|
ms_winCaptureNext = item->next;
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
//else: stack is empty, no previous capture
|
||||||
|
|
||||||
|
wxLogTrace(_T("mousecapture"),
|
||||||
|
_T("After ReleaseMouse() mouse is captured by 0x%08x"),
|
||||||
|
GetCapture());
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1356,9 +1356,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
InitMouseEvent( win, event, gdk_event );
|
InitMouseEvent( win, event, gdk_event );
|
||||||
|
|
||||||
AdjustEventButtonState(event);
|
AdjustEventButtonState(event);
|
||||||
|
|
||||||
// wxListBox actually get mouse events from the item
|
// wxListBox actually get mouse events from the item
|
||||||
|
|
||||||
if (win->m_isListBox)
|
if (win->m_isListBox)
|
||||||
{
|
{
|
||||||
event.m_x += widget->allocation.x;
|
event.m_x += widget->allocation.x;
|
||||||
@@ -1489,7 +1489,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
AdjustEventButtonState(event);
|
AdjustEventButtonState(event);
|
||||||
|
|
||||||
// wxListBox actually get mouse events from the item
|
// wxListBox actually get mouse events from the item
|
||||||
|
|
||||||
if (win->m_isListBox)
|
if (win->m_isListBox)
|
||||||
{
|
{
|
||||||
event.m_x += widget->allocation.x;
|
event.m_x += widget->allocation.x;
|
||||||
@@ -2370,7 +2370,7 @@ void wxWindowGTK::Init()
|
|||||||
|
|
||||||
m_noExpose = FALSE;
|
m_noExpose = FALSE;
|
||||||
m_nativeSizeEvent = FALSE;
|
m_nativeSizeEvent = FALSE;
|
||||||
|
|
||||||
m_hasScrolling = FALSE;
|
m_hasScrolling = FALSE;
|
||||||
m_isScrolling = FALSE;
|
m_isScrolling = FALSE;
|
||||||
|
|
||||||
@@ -2545,7 +2545,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
|
|||||||
|
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
m_focusWidget = m_wxwindow;
|
m_focusWidget = m_wxwindow;
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
@@ -2639,7 +2639,7 @@ bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const w
|
|||||||
void wxWindowGTK::PostCreation()
|
void wxWindowGTK::PostCreation()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
|
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
|
||||||
|
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
{
|
{
|
||||||
if (!m_noExpose)
|
if (!m_noExpose)
|
||||||
@@ -3087,7 +3087,7 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const
|
|||||||
dx = pizza->xoffset;
|
dx = pizza->xoffset;
|
||||||
dy = pizza->yoffset;
|
dy = pizza->yoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x) (*x) = m_x - dx;
|
if (x) (*x) = m_x - dx;
|
||||||
if (y) (*y) = m_y - dy;
|
if (y) (*y) = m_y - dy;
|
||||||
}
|
}
|
||||||
@@ -3280,7 +3280,7 @@ void wxWindowGTK::SetFocus()
|
|||||||
// ?
|
// ?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
wxPrintf( "SetFocus finished in " );
|
wxPrintf( "SetFocus finished in " );
|
||||||
if (GetClassInfo() && GetClassInfo()->GetClassName())
|
if (GetClassInfo() && GetClassInfo()->GetClassName())
|
||||||
@@ -3872,7 +3872,7 @@ bool wxWindowGTK::SetFont( const wxFont &font )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::CaptureMouse()
|
void wxWindowGTK::DoCaptureMouse()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
||||||
|
|
||||||
@@ -3901,7 +3901,7 @@ void wxWindowGTK::CaptureMouse()
|
|||||||
g_captureWindowHasMouse = TRUE;
|
g_captureWindowHasMouse = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::ReleaseMouse()
|
void wxWindowGTK::DoReleaseMouse()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
||||||
|
|
||||||
|
@@ -1356,9 +1356,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
InitMouseEvent( win, event, gdk_event );
|
InitMouseEvent( win, event, gdk_event );
|
||||||
|
|
||||||
AdjustEventButtonState(event);
|
AdjustEventButtonState(event);
|
||||||
|
|
||||||
// wxListBox actually get mouse events from the item
|
// wxListBox actually get mouse events from the item
|
||||||
|
|
||||||
if (win->m_isListBox)
|
if (win->m_isListBox)
|
||||||
{
|
{
|
||||||
event.m_x += widget->allocation.x;
|
event.m_x += widget->allocation.x;
|
||||||
@@ -1489,7 +1489,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
AdjustEventButtonState(event);
|
AdjustEventButtonState(event);
|
||||||
|
|
||||||
// wxListBox actually get mouse events from the item
|
// wxListBox actually get mouse events from the item
|
||||||
|
|
||||||
if (win->m_isListBox)
|
if (win->m_isListBox)
|
||||||
{
|
{
|
||||||
event.m_x += widget->allocation.x;
|
event.m_x += widget->allocation.x;
|
||||||
@@ -2370,7 +2370,7 @@ void wxWindowGTK::Init()
|
|||||||
|
|
||||||
m_noExpose = FALSE;
|
m_noExpose = FALSE;
|
||||||
m_nativeSizeEvent = FALSE;
|
m_nativeSizeEvent = FALSE;
|
||||||
|
|
||||||
m_hasScrolling = FALSE;
|
m_hasScrolling = FALSE;
|
||||||
m_isScrolling = FALSE;
|
m_isScrolling = FALSE;
|
||||||
|
|
||||||
@@ -2545,7 +2545,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
|
|||||||
|
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
m_focusWidget = m_wxwindow;
|
m_focusWidget = m_wxwindow;
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
@@ -2639,7 +2639,7 @@ bool wxWindowGTK::PreCreation( wxWindowGTK *parent, const wxPoint &pos, const w
|
|||||||
void wxWindowGTK::PostCreation()
|
void wxWindowGTK::PostCreation()
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
|
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
|
||||||
|
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
{
|
{
|
||||||
if (!m_noExpose)
|
if (!m_noExpose)
|
||||||
@@ -3087,7 +3087,7 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const
|
|||||||
dx = pizza->xoffset;
|
dx = pizza->xoffset;
|
||||||
dy = pizza->yoffset;
|
dy = pizza->yoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x) (*x) = m_x - dx;
|
if (x) (*x) = m_x - dx;
|
||||||
if (y) (*y) = m_y - dy;
|
if (y) (*y) = m_y - dy;
|
||||||
}
|
}
|
||||||
@@ -3280,7 +3280,7 @@ void wxWindowGTK::SetFocus()
|
|||||||
// ?
|
// ?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
wxPrintf( "SetFocus finished in " );
|
wxPrintf( "SetFocus finished in " );
|
||||||
if (GetClassInfo() && GetClassInfo()->GetClassName())
|
if (GetClassInfo() && GetClassInfo()->GetClassName())
|
||||||
@@ -3872,7 +3872,7 @@ bool wxWindowGTK::SetFont( const wxFont &font )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::CaptureMouse()
|
void wxWindowGTK::DoCaptureMouse()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
||||||
|
|
||||||
@@ -3901,7 +3901,7 @@ void wxWindowGTK::CaptureMouse()
|
|||||||
g_captureWindowHasMouse = TRUE;
|
g_captureWindowHasMouse = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::ReleaseMouse()
|
void wxWindowGTK::DoReleaseMouse()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
||||||
|
|
||||||
|
@@ -546,7 +546,7 @@ wxString wxWindowMSW::GetTitle() const
|
|||||||
return wxGetWindowText(GetHWND());
|
return wxGetWindowText(GetHWND());
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMSW::CaptureMouse()
|
void wxWindowMSW::DoCaptureMouse()
|
||||||
{
|
{
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
if ( hWnd )
|
if ( hWnd )
|
||||||
@@ -555,7 +555,7 @@ void wxWindowMSW::CaptureMouse()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMSW::ReleaseMouse()
|
void wxWindowMSW::DoReleaseMouse()
|
||||||
{
|
{
|
||||||
if ( !::ReleaseCapture() )
|
if ( !::ReleaseCapture() )
|
||||||
{
|
{
|
||||||
|
@@ -933,53 +933,6 @@ wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal)
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// mouse capture
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct WXDLLEXPORT wxWindowNext
|
|
||||||
{
|
|
||||||
wxWindow *win;
|
|
||||||
wxWindowNext *next;
|
|
||||||
} *wxWindow::ms_winCaptureNext = NULL;
|
|
||||||
|
|
||||||
void wxWindow::CaptureMouse()
|
|
||||||
{
|
|
||||||
wxLogTrace(_T("mousecapture"), _T("CaptureMouse(0x%08x)"), this);
|
|
||||||
|
|
||||||
wxWindow *winOld = GetCapture();
|
|
||||||
if ( winOld )
|
|
||||||
{
|
|
||||||
// save it on stack
|
|
||||||
wxWindowNext *item = new wxWindowNext;
|
|
||||||
item->win = winOld;
|
|
||||||
item->next = ms_winCaptureNext;
|
|
||||||
ms_winCaptureNext = item;
|
|
||||||
}
|
|
||||||
//else: no mouse capture to save
|
|
||||||
|
|
||||||
wxWindowNative::CaptureMouse();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindow::ReleaseMouse()
|
|
||||||
{
|
|
||||||
wxWindowNative::ReleaseMouse();
|
|
||||||
|
|
||||||
if ( ms_winCaptureNext )
|
|
||||||
{
|
|
||||||
ms_winCaptureNext->win->CaptureMouse();
|
|
||||||
|
|
||||||
wxWindowNext *item = ms_winCaptureNext;
|
|
||||||
ms_winCaptureNext = item->next;
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
//else: stack is empty, no previous capture
|
|
||||||
|
|
||||||
wxLogTrace(_T("mousecapture"),
|
|
||||||
_T("After ReleaseMouse() mouse is captured by 0x%08x"),
|
|
||||||
GetCapture());
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// accelerators and menu hot keys
|
// accelerators and menu hot keys
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user