From 6d26dc89c5e7a421f4f8807728928eee91aa5f7e Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 13 Apr 2002 01:37:32 +0000 Subject: [PATCH] Added wxMouseCaptureChangedEvent. Added some missing Capture related methods. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_defs.i | 2 + wxPython/src/_extras.py | 3 + wxPython/src/events.i | 9 ++ wxPython/src/msw/events.cpp | 84 +++++++++++++ wxPython/src/msw/events.py | 17 +++ wxPython/src/msw/windows.cpp | 226 +++++++++++++++++++++-------------- wxPython/src/msw/windows.py | 25 ++-- wxPython/src/msw/wx.cpp | 2 +- wxPython/src/msw/wx.py | 5 +- wxPython/src/windows.i | 20 +++- wxPython/src/wx.i | 1 + 11 files changed, 291 insertions(+), 103 deletions(-) diff --git a/wxPython/src/_defs.i b/wxPython/src/_defs.i index ab05f012bd..754f84007f 100644 --- a/wxPython/src/_defs.i +++ b/wxPython/src/_defs.i @@ -956,6 +956,8 @@ enum wxEventType { wxEVT_MIDDLE_DCLICK, wxEVT_RIGHT_DCLICK, + wxEVT_MOUSE_CAPTURE_CHANGED, + // Non-client mouse events wxEVT_NC_LEFT_DOWN, wxEVT_NC_LEFT_UP, diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index 9e22cad5f2..68677a3da8 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -198,6 +198,9 @@ def EVT_MOUSE_EVENTS(win, func): win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func) win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func) +def EVT_MOUSE_CAPTURE_CHANGED(win, func): + win.Connect(-1, -1, wxEVT_MOUSE_CAPTURE_CHANGED, func) + # EVT_COMMAND def EVT_COMMAND(win, id, cmd, func): win.Connect(id, -1, cmd, func) diff --git a/wxPython/src/events.i b/wxPython/src/events.i index c270a652bc..5d2bd07da5 100644 --- a/wxPython/src/events.i +++ b/wxPython/src/events.i @@ -193,6 +193,15 @@ public: //--------------------------------------------------------------------------- +class wxMouseCaptureChangedEvent : public wxEvent +{ +public: + wxMouseCaptureChangedEvent(wxWindowID id = 0, wxWindow* gainedCapture = NULL); + wxWindow* GetCapturedWindow() const; +}; + +//--------------------------------------------------------------------------- + class wxKeyEvent: public wxEvent { public: wxKeyEvent(int keyEventType); diff --git a/wxPython/src/msw/events.cpp b/wxPython/src/msw/events.cpp index d50d9e5b3b..285afc6ef6 100644 --- a/wxPython/src/msw/events.cpp +++ b/wxPython/src/msw/events.cpp @@ -3132,6 +3132,86 @@ static PyObject *_wrap_wxMouseEvent_m_linesPerAction_get(PyObject *self, PyObjec return _resultobj; } +static void *SwigwxMouseCaptureChangedEventTowxEvent(void *ptr) { + wxMouseCaptureChangedEvent *src; + wxEvent *dest; + src = (wxMouseCaptureChangedEvent *) ptr; + dest = (wxEvent *) src; + return (void *) dest; +} + +static void *SwigwxMouseCaptureChangedEventTowxObject(void *ptr) { + wxMouseCaptureChangedEvent *src; + wxObject *dest; + src = (wxMouseCaptureChangedEvent *) ptr; + dest = (wxObject *) src; + return (void *) dest; +} + +#define new_wxMouseCaptureChangedEvent(_swigarg0,_swigarg1) (new wxMouseCaptureChangedEvent(_swigarg0,_swigarg1)) +static PyObject *_wrap_new_wxMouseCaptureChangedEvent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxMouseCaptureChangedEvent * _result; + wxWindowID _arg0 = (wxWindowID ) 0; + wxWindow * _arg1 = (wxWindow *) NULL; + PyObject * _argo1 = 0; + char *_kwnames[] = { "id","gainedCapture", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|iO:new_wxMouseCaptureChangedEvent",_kwnames,&_arg0,&_argo1)) + return NULL; + if (_argo1) { + if (_argo1 == Py_None) { _arg1 = NULL; } + else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of new_wxMouseCaptureChangedEvent. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxMouseCaptureChangedEvent *)new_wxMouseCaptureChangedEvent(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxMouseCaptureChangedEvent_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxMouseCaptureChangedEvent_GetCapturedWindow(_swigobj) (_swigobj->GetCapturedWindow()) +static PyObject *_wrap_wxMouseCaptureChangedEvent_GetCapturedWindow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _result; + wxMouseCaptureChangedEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxMouseCaptureChangedEvent_GetCapturedWindow",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxMouseCaptureChangedEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxMouseCaptureChangedEvent_GetCapturedWindow. Expected _wxMouseCaptureChangedEvent_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxWindow *)wxMouseCaptureChangedEvent_GetCapturedWindow(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + static void *SwigwxKeyEventTowxEvent(void *ptr) { wxKeyEvent *src; wxEvent *dest; @@ -7417,6 +7497,8 @@ static PyMethodDef eventscMethods[] = { { "wxKeyEvent_MetaDown", (PyCFunction) _wrap_wxKeyEvent_MetaDown, METH_VARARGS | METH_KEYWORDS }, { "wxKeyEvent_ControlDown", (PyCFunction) _wrap_wxKeyEvent_ControlDown, METH_VARARGS | METH_KEYWORDS }, { "new_wxKeyEvent", (PyCFunction) _wrap_new_wxKeyEvent, METH_VARARGS | METH_KEYWORDS }, + { "wxMouseCaptureChangedEvent_GetCapturedWindow", (PyCFunction) _wrap_wxMouseCaptureChangedEvent_GetCapturedWindow, METH_VARARGS | METH_KEYWORDS }, + { "new_wxMouseCaptureChangedEvent", (PyCFunction) _wrap_new_wxMouseCaptureChangedEvent, METH_VARARGS | METH_KEYWORDS }, { "wxMouseEvent_m_linesPerAction_get", (PyCFunction) _wrap_wxMouseEvent_m_linesPerAction_get, METH_VARARGS | METH_KEYWORDS }, { "wxMouseEvent_m_linesPerAction_set", (PyCFunction) _wrap_wxMouseEvent_m_linesPerAction_set, METH_VARARGS | METH_KEYWORDS }, { "wxMouseEvent_m_wheelDelta_get", (PyCFunction) _wrap_wxMouseEvent_m_wheelDelta_get, METH_VARARGS | METH_KEYWORDS }, @@ -7554,6 +7636,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEvent","_wxMoveEvent",SwigwxMoveEventTowxEvent}, { "_wxEvent","_wxNavigationKeyEvent",SwigwxNavigationKeyEventTowxEvent}, { "_wxEvent","_wxKeyEvent",SwigwxKeyEventTowxEvent}, + { "_wxEvent","_wxMouseCaptureChangedEvent",SwigwxMouseCaptureChangedEventTowxEvent}, { "_wxEvent","_wxMouseEvent",SwigwxMouseEventTowxEvent}, { "_wxEvent","_wxSpinEvent",SwigwxSpinEventTowxEvent}, { "_wxEvent","_wxScrollWinEvent",SwigwxScrollWinEventTowxEvent}, @@ -7645,6 +7728,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxObject","_wxMoveEvent",SwigwxMoveEventTowxObject}, { "_wxObject","_wxNavigationKeyEvent",SwigwxNavigationKeyEventTowxObject}, { "_wxObject","_wxKeyEvent",SwigwxKeyEventTowxObject}, + { "_wxObject","_wxMouseCaptureChangedEvent",SwigwxMouseCaptureChangedEventTowxObject}, { "_wxObject","_wxMouseEvent",SwigwxMouseEventTowxObject}, { "_wxObject","_wxSpinEvent",SwigwxSpinEventTowxObject}, { "_wxObject","_wxScrollWinEvent",SwigwxScrollWinEventTowxObject}, diff --git a/wxPython/src/msw/events.py b/wxPython/src/msw/events.py index f92eb87163..067c8ed1f5 100644 --- a/wxPython/src/msw/events.py +++ b/wxPython/src/msw/events.py @@ -389,6 +389,23 @@ class wxMouseEvent(wxMouseEventPtr): +class wxMouseCaptureChangedEventPtr(wxEventPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def GetCapturedWindow(self, *_args, **_kwargs): + val = apply(eventsc.wxMouseCaptureChangedEvent_GetCapturedWindow,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "" % (self.this,) +class wxMouseCaptureChangedEvent(wxMouseCaptureChangedEventPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(eventsc.new_wxMouseCaptureChangedEvent,_args,_kwargs) + self.thisown = 1 + + + + class wxKeyEventPtr(wxEventPtr): def __init__(self,this): self.this = this diff --git a/wxPython/src/msw/windows.cpp b/wxPython/src/msw/windows.cpp index 93f30a99af..74e174776d 100644 --- a/wxPython/src/msw/windows.cpp +++ b/wxPython/src/msw/windows.cpp @@ -1021,34 +1021,6 @@ static PyObject *_wrap_wxWindow_Create(PyObject *self, PyObject *args, PyObject return _resultobj; } -#define wxWindow_CaptureMouse(_swigobj) (_swigobj->CaptureMouse()) -static PyObject *_wrap_wxWindow_CaptureMouse(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_CaptureMouse",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_CaptureMouse. Expected _wxWindow_p."); - return NULL; - } - } -{ - PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxWindow_CaptureMouse(_arg0); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) return NULL; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - #define wxWindow_Center(_swigobj,_swigarg0) (_swigobj->Center(_swigarg0)) static PyObject *_wrap_wxWindow_Center(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -3662,34 +3634,6 @@ static PyObject *_wrap_wxWindow_RefreshRect(PyObject *self, PyObject *args, PyOb return _resultobj; } -#define wxWindow_ReleaseMouse(_swigobj) (_swigobj->ReleaseMouse()) -static PyObject *_wrap_wxWindow_ReleaseMouse(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxWindow * _arg0; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_ReleaseMouse",_kwnames,&_argo0)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_ReleaseMouse. Expected _wxWindow_p."); - return NULL; - } - } -{ - PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxWindow_ReleaseMouse(_arg0); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) return NULL; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - #define wxWindow_RemoveChild(_swigobj,_swigarg0) (_swigobj->RemoveChild(_swigarg0)) static PyObject *_wrap_wxWindow_RemoveChild(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -4859,36 +4803,6 @@ static PyObject *_wrap_wxWindow_Validate(PyObject *self, PyObject *args, PyObjec return _resultobj; } -#define wxWindow_WarpPointer(_swigobj,_swigarg0,_swigarg1) (_swigobj->WarpPointer(_swigarg0,_swigarg1)) -static PyObject *_wrap_wxWindow_WarpPointer(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxWindow * _arg0; - int _arg1; - int _arg2; - PyObject * _argo0 = 0; - char *_kwnames[] = { "self","x","y", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxWindow_WarpPointer",_kwnames,&_argo0,&_arg1,&_arg2)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_WarpPointer. Expected _wxWindow_p."); - return NULL; - } - } -{ - PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxWindow_WarpPointer(_arg0,_arg1,_arg2); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) return NULL; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - #define wxWindow_ConvertDialogPointToPixels(_swigobj,_swigarg0) (_swigobj->ConvertDialogToPixels(_swigarg0)) static PyObject *_wrap_wxWindow_ConvertDialogPointToPixels(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -6164,6 +6078,138 @@ static PyObject *_wrap_wxWindow_SetDefaultItem(PyObject *self, PyObject *args, P return _resultobj; } +#define wxWindow_WarpPointer(_swigobj,_swigarg0,_swigarg1) (_swigobj->WarpPointer(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxWindow_WarpPointer(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","x","y", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxWindow_WarpPointer",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_WarpPointer. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxWindow_WarpPointer(_arg0,_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxWindow_CaptureMouse(_swigobj) (_swigobj->CaptureMouse()) +static PyObject *_wrap_wxWindow_CaptureMouse(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_CaptureMouse",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_CaptureMouse. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxWindow_CaptureMouse(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxWindow_ReleaseMouse(_swigobj) (_swigobj->ReleaseMouse()) +static PyObject *_wrap_wxWindow_ReleaseMouse(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_ReleaseMouse",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_ReleaseMouse. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxWindow_ReleaseMouse(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static PyObject *_wrap_wxWindow_GetCapture(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _result; + char *_kwnames[] = { NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxWindow_GetCapture",_kwnames)) + return NULL; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxWindow *)wxWindow::GetCapture(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + +#define wxWindow_HasCapture(_swigobj) (_swigobj->HasCapture()) +static PyObject *_wrap_wxWindow_HasCapture(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxWindow * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_HasCapture",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxWindow_HasCapture. Expected _wxWindow_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxWindow_HasCapture(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + static void *SwigwxPanelTowxWindow(void *ptr) { wxPanel *src; wxWindow *dest; @@ -11442,6 +11488,11 @@ static PyMethodDef windowscMethods[] = { { "wxPanel_Create", (PyCFunction) _wrap_wxPanel_Create, METH_VARARGS | METH_KEYWORDS }, { "new_wxPrePanel", (PyCFunction) _wrap_new_wxPrePanel, METH_VARARGS | METH_KEYWORDS }, { "new_wxPanel", (PyCFunction) _wrap_new_wxPanel, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_HasCapture", (PyCFunction) _wrap_wxWindow_HasCapture, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_GetCapture", (PyCFunction) _wrap_wxWindow_GetCapture, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_ReleaseMouse", (PyCFunction) _wrap_wxWindow_ReleaseMouse, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_CaptureMouse", (PyCFunction) _wrap_wxWindow_CaptureMouse, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_WarpPointer", (PyCFunction) _wrap_wxWindow_WarpPointer, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetDefaultItem", (PyCFunction) _wrap_wxWindow_SetDefaultItem, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetDefaultItem", (PyCFunction) _wrap_wxWindow_GetDefaultItem, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_OnPaint", (PyCFunction) _wrap_wxWindow_OnPaint, METH_VARARGS | METH_KEYWORDS }, @@ -11484,7 +11535,6 @@ static PyMethodDef windowscMethods[] = { { "wxWindow_DLG_PNT", (PyCFunction) _wrap_wxWindow_ConvertDialogPointToPixels, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_ConvertDialogSizeToPixels", (PyCFunction) _wrap_wxWindow_ConvertDialogSizeToPixels, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_ConvertDialogPointToPixels", (PyCFunction) _wrap_wxWindow_ConvertDialogPointToPixels, METH_VARARGS | METH_KEYWORDS }, - { "wxWindow_WarpPointer", (PyCFunction) _wrap_wxWindow_WarpPointer, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_Validate", (PyCFunction) _wrap_wxWindow_Validate, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_UpdateWindowUI", (PyCFunction) _wrap_wxWindow_UpdateWindowUI, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_TransferDataToWindow", (PyCFunction) _wrap_wxWindow_TransferDataToWindow, METH_VARARGS | METH_KEYWORDS }, @@ -11519,7 +11569,6 @@ static PyMethodDef windowscMethods[] = { { "wxWindow_ScreenToClientXY", (PyCFunction) _wrap_wxWindow_ScreenToClientXY, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_Reparent", (PyCFunction) _wrap_wxWindow_Reparent, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_RemoveChild", (PyCFunction) _wrap_wxWindow_RemoveChild, METH_VARARGS | METH_KEYWORDS }, - { "wxWindow_ReleaseMouse", (PyCFunction) _wrap_wxWindow_ReleaseMouse, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_RefreshRect", (PyCFunction) _wrap_wxWindow_RefreshRect, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_Refresh", (PyCFunction) _wrap_wxWindow_Refresh, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_Raise", (PyCFunction) _wrap_wxWindow_Raise, METH_VARARGS | METH_KEYWORDS }, @@ -11598,7 +11647,6 @@ static PyMethodDef windowscMethods[] = { { "wxWindow_CentreOnParent", (PyCFunction) _wrap_wxWindow_CentreOnParent, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_Centre", (PyCFunction) _wrap_wxWindow_Centre, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_Center", (PyCFunction) _wrap_wxWindow_Center, METH_VARARGS | METH_KEYWORDS }, - { "wxWindow_CaptureMouse", (PyCFunction) _wrap_wxWindow_CaptureMouse, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_Create", (PyCFunction) _wrap_wxWindow_Create, METH_VARARGS | METH_KEYWORDS }, { "new_wxPreWindow", (PyCFunction) _wrap_new_wxPreWindow, METH_VARARGS | METH_KEYWORDS }, { "new_wxWindow", (PyCFunction) _wrap_new_wxWindow, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/windows.py b/wxPython/src/msw/windows.py index 476245bcbb..2cce494709 100644 --- a/wxPython/src/msw/windows.py +++ b/wxPython/src/msw/windows.py @@ -119,9 +119,6 @@ class wxWindowPtr(wxEvtHandlerPtr): def Create(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_Create,(self,) + _args, _kwargs) return val - def CaptureMouse(self, *_args, **_kwargs): - val = apply(windowsc.wxWindow_CaptureMouse,(self,) + _args, _kwargs) - return val def Center(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_Center,(self,) + _args, _kwargs) return val @@ -368,9 +365,6 @@ class wxWindowPtr(wxEvtHandlerPtr): def RefreshRect(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_RefreshRect,(self,) + _args, _kwargs) return val - def ReleaseMouse(self, *_args, **_kwargs): - val = apply(windowsc.wxWindow_ReleaseMouse,(self,) + _args, _kwargs) - return val def RemoveChild(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_RemoveChild,(self,) + _args, _kwargs) return val @@ -474,9 +468,6 @@ class wxWindowPtr(wxEvtHandlerPtr): def Validate(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_Validate,(self,) + _args, _kwargs) return val - def WarpPointer(self, *_args, **_kwargs): - val = apply(windowsc.wxWindow_WarpPointer,(self,) + _args, _kwargs) - return val def ConvertDialogPointToPixels(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_ConvertDialogPointToPixels,(self,) + _args, _kwargs) if val: val = wxPointPtr(val) ; val.thisown = 1 @@ -603,6 +594,18 @@ class wxWindowPtr(wxEvtHandlerPtr): def SetDefaultItem(self, *_args, **_kwargs): val = apply(windowsc.wxWindow_SetDefaultItem,(self,) + _args, _kwargs) return val + def WarpPointer(self, *_args, **_kwargs): + val = apply(windowsc.wxWindow_WarpPointer,(self,) + _args, _kwargs) + return val + def CaptureMouse(self, *_args, **_kwargs): + val = apply(windowsc.wxWindow_CaptureMouse,(self,) + _args, _kwargs) + return val + def ReleaseMouse(self, *_args, **_kwargs): + val = apply(windowsc.wxWindow_ReleaseMouse,(self,) + _args, _kwargs) + return val + def HasCapture(self, *_args, **_kwargs): + val = apply(windowsc.wxWindow_HasCapture,(self,) + _args, _kwargs) + return val def __repr__(self): return "" % (self.this,) # replaces broken shadow method @@ -1144,6 +1147,10 @@ wxWindow_NextControlId = windowsc.wxWindow_NextControlId wxWindow_PrevControlId = windowsc.wxWindow_PrevControlId +def wxWindow_GetCapture(*_args, **_kwargs): + val = apply(windowsc.wxWindow_GetCapture,_args,_kwargs) + return val + wxMenuItem_GetLabelFromText = windowsc.wxMenuItem_GetLabelFromText wxMenuItem_GetDefaultMarginWidth = windowsc.wxMenuItem_GetDefaultMarginWidth diff --git a/wxPython/src/msw/wx.cpp b/wxPython/src/msw/wx.cpp index 07996bab6b..c718ca7b53 100644 --- a/wxPython/src/msw/wx.cpp +++ b/wxPython/src/msw/wx.cpp @@ -2533,6 +2533,7 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxEVT_LEFT_DCLICK", PyInt_FromLong((long) wxEVT_LEFT_DCLICK)); PyDict_SetItemString(d,"wxEVT_MIDDLE_DCLICK", PyInt_FromLong((long) wxEVT_MIDDLE_DCLICK)); PyDict_SetItemString(d,"wxEVT_RIGHT_DCLICK", PyInt_FromLong((long) wxEVT_RIGHT_DCLICK)); + PyDict_SetItemString(d,"wxEVT_MOUSE_CAPTURE_CHANGED", PyInt_FromLong((long) wxEVT_MOUSE_CAPTURE_CHANGED)); PyDict_SetItemString(d,"wxEVT_NC_LEFT_DOWN", PyInt_FromLong((long) wxEVT_NC_LEFT_DOWN)); PyDict_SetItemString(d,"wxEVT_NC_LEFT_UP", PyInt_FromLong((long) wxEVT_NC_LEFT_UP)); PyDict_SetItemString(d,"wxEVT_NC_MIDDLE_DOWN", PyInt_FromLong((long) wxEVT_NC_MIDDLE_DOWN)); @@ -2578,7 +2579,6 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxEVT_SHOW", PyInt_FromLong((long) wxEVT_SHOW)); PyDict_SetItemString(d,"wxEVT_ICONIZE", PyInt_FromLong((long) wxEVT_ICONIZE)); PyDict_SetItemString(d,"wxEVT_MAXIMIZE", PyInt_FromLong((long) wxEVT_MAXIMIZE)); - PyDict_SetItemString(d,"wxEVT_MOUSE_CAPTURE_CHANGED", PyInt_FromLong((long) wxEVT_MOUSE_CAPTURE_CHANGED)); PyDict_SetItemString(d,"wxEVT_PAINT", PyInt_FromLong((long) wxEVT_PAINT)); PyDict_SetItemString(d,"wxEVT_ERASE_BACKGROUND", PyInt_FromLong((long) wxEVT_ERASE_BACKGROUND)); PyDict_SetItemString(d,"wxEVT_NC_PAINT", PyInt_FromLong((long) wxEVT_NC_PAINT)); diff --git a/wxPython/src/msw/wx.py b/wxPython/src/msw/wx.py index b6c74e105f..55d3282d8e 100644 --- a/wxPython/src/msw/wx.py +++ b/wxPython/src/msw/wx.py @@ -819,6 +819,7 @@ wxEVT_LEAVE_WINDOW = wxc.wxEVT_LEAVE_WINDOW wxEVT_LEFT_DCLICK = wxc.wxEVT_LEFT_DCLICK wxEVT_MIDDLE_DCLICK = wxc.wxEVT_MIDDLE_DCLICK wxEVT_RIGHT_DCLICK = wxc.wxEVT_RIGHT_DCLICK +wxEVT_MOUSE_CAPTURE_CHANGED = wxc.wxEVT_MOUSE_CAPTURE_CHANGED wxEVT_NC_LEFT_DOWN = wxc.wxEVT_NC_LEFT_DOWN wxEVT_NC_LEFT_UP = wxc.wxEVT_NC_LEFT_UP wxEVT_NC_MIDDLE_DOWN = wxc.wxEVT_NC_MIDDLE_DOWN @@ -864,7 +865,6 @@ wxEVT_DESTROY = wxc.wxEVT_DESTROY wxEVT_SHOW = wxc.wxEVT_SHOW wxEVT_ICONIZE = wxc.wxEVT_ICONIZE wxEVT_MAXIMIZE = wxc.wxEVT_MAXIMIZE -wxEVT_MOUSE_CAPTURE_CHANGED = wxc.wxEVT_MOUSE_CAPTURE_CHANGED wxEVT_PAINT = wxc.wxEVT_PAINT wxEVT_ERASE_BACKGROUND = wxc.wxEVT_ERASE_BACKGROUND wxEVT_NC_PAINT = wxc.wxEVT_NC_PAINT @@ -1106,6 +1106,9 @@ def EVT_MOUSE_EVENTS(win, func): win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func) win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func) +def EVT_MOUSE_CAPTURE_CHANGED(win, func): + win.Connect(-1, -1, wxEVT_MOUSE_CAPTURE_CHANGED, func) + # EVT_COMMAND def EVT_COMMAND(win, id, cmd, func): win.Connect(id, -1, cmd, func) diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 10778765a6..e1e0cae794 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -195,7 +195,6 @@ public: %pragma(python) addtomethod = "wxPreWindow:val._setOORInfo(val)" - void CaptureMouse(); void Center(int direction = wxBOTH); void Centre(int direction = wxBOTH); void CentreOnParent(int direction = wxBOTH ); @@ -313,7 +312,6 @@ public: void Refresh(bool eraseBackground = TRUE, const wxRect* rect = NULL); void RefreshRect(const wxRect& rect); - void ReleaseMouse(); void RemoveChild(wxWindow* child); bool Reparent( wxWindow* newParent ); @@ -364,7 +362,6 @@ public: bool TransferDataToWindow(); void UpdateWindowUI(); bool Validate(); - void WarpPointer(int x, int y); %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt); %name(ConvertDialogSizeToPixels) wxSize ConvertDialogToPixels(const wxSize& sz); @@ -438,6 +435,23 @@ public: wxWindow* GetDefaultItem(); wxWindow* SetDefaultItem(wxWindow *btn); + + + // move the mouse to the specified position + void WarpPointer(int x, int y); + + // start or end mouse capture, these functions maintain the stack of + // windows having captured the mouse and after calling ReleaseMouse() + // 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 + static wxWindow *GetCapture(); + + // does this window have the capture? + bool HasCapture() const; }; diff --git a/wxPython/src/wx.i b/wxPython/src/wx.i index 351c6e4bb1..27d5a3d51a 100644 --- a/wxPython/src/wx.i +++ b/wxPython/src/wx.i @@ -12,6 +12,7 @@ %module wx + %{ #include "helpers.h" %} -- 2.45.2