Implement wxGetMouseState
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39747 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -168,7 +168,23 @@ wxPoint wxGetMousePosition()
|
|||||||
wxMouseState wxGetMouseState()
|
wxMouseState wxGetMouseState()
|
||||||
{
|
{
|
||||||
wxMouseState ms;
|
wxMouseState ms;
|
||||||
// TODO
|
int x, y;
|
||||||
|
|
||||||
|
wxGetMousePosition(&x, &y);
|
||||||
|
|
||||||
|
ms.SetX(x);
|
||||||
|
ms.SetY(y);
|
||||||
|
|
||||||
|
extern unsigned long g_buttonState;
|
||||||
|
ms.SetLeftDown(g_buttonState & EVT_LEFTBUT);
|
||||||
|
ms.SetMiddleDown(g_buttonState & EVT_MIDDLEBUT);
|
||||||
|
ms.SetRightDown(g_buttonState & EVT_RIGHTBUT);
|
||||||
|
|
||||||
|
ms.SetControlDown(EVT_isKeyDown(KB_leftCtrl) || EVT_isKeyDown(KB_rightCtrl));
|
||||||
|
ms.SetShiftDown(EVT_isKeyDown(KB_leftShift) || EVT_isKeyDown(KB_rightShift));
|
||||||
|
ms.SetAltDown(EVT_isKeyDown(KB_leftAlt));
|
||||||
|
ms.SetMetaDown(EVT_isKeyDown(KB_rightAlt));
|
||||||
|
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,6 +73,8 @@ static wxWindowMGL *gs_mouseCapture = NULL;
|
|||||||
// the frame that is currently active (i.e. its child has focus). It is
|
// the frame that is currently active (i.e. its child has focus). It is
|
||||||
// used to generate wxActivateEvents
|
// used to generate wxActivateEvents
|
||||||
static wxWindowMGL *gs_activeFrame = NULL;
|
static wxWindowMGL *gs_activeFrame = NULL;
|
||||||
|
// track the mouse button state for wxGetMouseState()
|
||||||
|
unsigned long g_buttonState = 0;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
@@ -151,6 +153,8 @@ static ibool MGLAPI wxWindowMouseHandler(window_t *wnd, event_t *e)
|
|||||||
wxPoint orig(win->GetClientAreaOrigin());
|
wxPoint orig(win->GetClientAreaOrigin());
|
||||||
wxPoint where;
|
wxPoint where;
|
||||||
|
|
||||||
|
g_buttonState = e->modifiers;
|
||||||
|
|
||||||
MGL_wmCoordGlobalToLocal(win->GetHandle(),
|
MGL_wmCoordGlobalToLocal(win->GetHandle(),
|
||||||
e->where_x, e->where_y, &where.x, &where.y);
|
e->where_x, e->where_y, &where.x, &where.y);
|
||||||
|
|
||||||
@@ -1153,7 +1157,7 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
|
|||||||
{
|
{
|
||||||
dc->setColorRGB(255,0,255);
|
dc->setColorRGB(255,0,255);
|
||||||
dc->fillRect(-1000,-1000,2000,2000);
|
dc->fillRect(-1000,-1000,2000,2000);
|
||||||
wxUsleep(50);
|
wxMilliSleep(50);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user