Added wxGetMouseState which returns the current state of the mouse.
Returns an instance of a wxMouseState object that contains the current position of the mouse pointer in screen coordinants, as well as boolean values indicating the up/down status of the mouse buttons and the modifier keys. Implemented for wxMSW, wxGTK and wxMac. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2672,6 +2672,31 @@ wxWindow *wxGetActiveWindow()
|
||||
return wxWindow::FindFocus();
|
||||
}
|
||||
|
||||
|
||||
wxMouseState wxGetMouseState()
|
||||
{
|
||||
wxMouseState ms;
|
||||
|
||||
gint x;
|
||||
gint y;
|
||||
GdkModifierType mask;
|
||||
|
||||
gdk_window_get_pointer(NULL, &x, &y, &mask);
|
||||
|
||||
ms.SetX(x);
|
||||
ms.SetY(y);
|
||||
ms.SetLeftDown(mask & GDK_BUTTON1_MASK);
|
||||
ms.SetMiddleDown(mask & GDK_BUTTON2_MASK);
|
||||
ms.SetRightDown(mask & GDK_BUTTON3_MASK);
|
||||
|
||||
ms.SetControlDown(mask & GDK_CONTROL_MASK);
|
||||
ms.SetShiftDown(mask & GDK_SHIFT_MASK);
|
||||
ms.SetAltDown(mask & GDK_MOD1_MASK);
|
||||
ms.SetMetaDown(mask & GDK_MOD2_MASK);
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindowGTK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user