From 7b7ac0ab51dd4571b752d14c7af2443839ff85bb Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 28 Nov 2001 09:47:53 +0000 Subject: [PATCH] Added wxChildFocusEvent Updated wxHtmlWindow Added wxEditableListBox git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12739 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/contrib/gizmos/gizmos.cpp | 199 +++++++++++++++++++++++++++++ wxPython/contrib/gizmos/gizmos.i | 32 ++++- wxPython/contrib/gizmos/gizmos.py | 20 +++ wxPython/demo/Main.py | 2 + wxPython/demo/wxEditableListBox.py | 40 ++++++ wxPython/src/_defs.i | 1 + wxPython/src/_extras.py | 3 + wxPython/src/events.i | 12 ++ wxPython/src/export.h | 2 + wxPython/src/helpers.h | 4 +- wxPython/src/html.i | 11 +- wxPython/src/msw/events.cpp | 92 +++++++++++++ wxPython/src/msw/events.py | 17 +++ wxPython/src/msw/html.cpp | 85 ++++++++++++ wxPython/src/msw/html.py | 9 ++ wxPython/src/msw/windows.cpp | 6 +- wxPython/src/msw/windows.py | 1 + wxPython/src/msw/wx.cpp | 2 + wxPython/src/msw/wx.py | 4 + wxPython/src/windows.i | 4 +- wxPython/src/wx.i | 1 + wxPython/wxPython/.cvsignore | 38 +----- 22 files changed, 538 insertions(+), 47 deletions(-) create mode 100644 wxPython/demo/wxEditableListBox.py diff --git a/wxPython/contrib/gizmos/gizmos.cpp b/wxPython/contrib/gizmos/gizmos.cpp index 65cb5bad2a..cb9d8ac35d 100644 --- a/wxPython/contrib/gizmos/gizmos.cpp +++ b/wxPython/contrib/gizmos/gizmos.cpp @@ -57,6 +57,7 @@ extern PyObject *SWIG_newvarlink(void); #include "export.h" #include "wx/gizmos/dynamicsash.h" +#include "wx/gizmos/editlbox.h" static PyObject* t_output_helper(PyObject* target, PyObject* o) { @@ -456,7 +457,201 @@ static PyObject *_wrap_wxDynamicSashWindow_GetVScrollBar(PyObject *self, PyObjec return _resultobj; } +static void *SwigwxEditableListBoxTowxPanel(void *ptr) { + wxEditableListBox *src; + wxPanel *dest; + src = (wxEditableListBox *) ptr; + dest = (wxPanel *) src; + return (void *) dest; +} + +static void *SwigwxEditableListBoxTowxWindow(void *ptr) { + wxEditableListBox *src; + wxWindow *dest; + src = (wxEditableListBox *) ptr; + dest = (wxWindow *) src; + return (void *) dest; +} + +static void *SwigwxEditableListBoxTowxEvtHandler(void *ptr) { + wxEditableListBox *src; + wxEvtHandler *dest; + src = (wxEditableListBox *) ptr; + dest = (wxEvtHandler *) src; + return (void *) dest; +} + +static void *SwigwxEditableListBoxTowxObject(void *ptr) { + wxEditableListBox *src; + wxObject *dest; + src = (wxEditableListBox *) ptr; + dest = (wxObject *) src; + return (void *) dest; +} + +#define new_wxEditableListBox(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (new wxEditableListBox(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) +static PyObject *_wrap_new_wxEditableListBox(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxEditableListBox * _result; + wxWindow * _arg0; + wxWindowID _arg1; + wxString * _arg2; + wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition; + wxSize * _arg4 = (wxSize *) &wxDefaultSize; + char * _arg5 = (char *) "editableListBox"; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + wxPoint temp; + PyObject * _obj3 = 0; + wxSize temp0; + PyObject * _obj4 = 0; + char *_kwnames[] = { "parent","id","label","pos","size","name", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiO|OOs:new_wxEditableListBox",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_obj4,&_arg5)) + 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 new_wxEditableListBox. Expected _wxWindow_p."); + return NULL; + } + } +{ +#if PYTHON_API_VERSION >= 1009 + char* tmpPtr; int tmpSize; + if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1) + return NULL; + _arg2 = new wxString(tmpPtr, tmpSize); +#else + if (!PyString_Check(_obj2)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2)); +#endif +} + if (_obj3) +{ + _arg3 = &temp; + if (! wxPoint_helper(_obj3, &_arg3)) + return NULL; +} + if (_obj4) +{ + _arg4 = &temp0; + if (! wxSize_helper(_obj4, &_arg4)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxEditableListBox *)new_wxEditableListBox(_arg0,_arg1,*_arg2,*_arg3,*_arg4,_arg5); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxEditableListBox_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } +{ + if (_obj2) + delete _arg2; +} + return _resultobj; +} + +#define wxEditableListBox_SetStrings(_swigobj,_swigarg0) (_swigobj->SetStrings(_swigarg0)) +static PyObject *_wrap_wxEditableListBox_SetStrings(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxEditableListBox * _arg0; + wxArrayString * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","strings", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxEditableListBox_SetStrings",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxEditableListBox_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxEditableListBox_SetStrings. Expected _wxEditableListBox_p."); + return NULL; + } + } +{ + if (! PySequence_Check(_obj1)) { + PyErr_SetString(PyExc_TypeError, "Sequence of strings expected."); + return NULL; + } + _arg1 = new wxArrayString; + int i, len=PySequence_Length(_obj1); + for (i=0; iAdd(PyString_AsString(item)); + Py_DECREF(item); + Py_DECREF(str); + } +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxEditableListBox_SetStrings(_arg0,*_arg1); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + if (_obj1) + delete _arg1; +} + return _resultobj; +} + +static PyObject * wxEditableListBox_GetStrings(wxEditableListBox *self) { + wxArrayString strings; + self->GetStrings(strings); + return wxArrayString2PyList_helper(strings); + } +static PyObject *_wrap_wxEditableListBox_GetStrings(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + PyObject * _result; + wxEditableListBox * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxEditableListBox_GetStrings",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxEditableListBox_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxEditableListBox_GetStrings. Expected _wxEditableListBox_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (PyObject *)wxEditableListBox_GetStrings(_arg0); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = _result; +} + return _resultobj; +} + static PyMethodDef gizmoscMethods[] = { + { "wxEditableListBox_GetStrings", (PyCFunction) _wrap_wxEditableListBox_GetStrings, METH_VARARGS | METH_KEYWORDS }, + { "wxEditableListBox_SetStrings", (PyCFunction) _wrap_wxEditableListBox_SetStrings, METH_VARARGS | METH_KEYWORDS }, + { "new_wxEditableListBox", (PyCFunction) _wrap_new_wxEditableListBox, METH_VARARGS | METH_KEYWORDS }, { "wxDynamicSashWindow_GetVScrollBar", (PyCFunction) _wrap_wxDynamicSashWindow_GetVScrollBar, METH_VARARGS | METH_KEYWORDS }, { "wxDynamicSashWindow_GetHScrollBar", (PyCFunction) _wrap_wxDynamicSashWindow_GetHScrollBar, METH_VARARGS | METH_KEYWORDS }, { "wxDynamicSashWindow_Create", (PyCFunction) _wrap_wxDynamicSashWindow_Create, METH_VARARGS | METH_KEYWORDS }, @@ -495,6 +690,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_size_t","_int",0}, { "_size_t","_wxWindowID",0}, { "_size_t","_uint",0}, + { "_wxPanel","_wxEditableListBox",SwigwxEditableListBoxTowxPanel}, { "_uint","_wxCoord",0}, { "_uint","_wxPrintQuality",0}, { "_uint","_time_t",0}, @@ -526,6 +722,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_unsigned_short","_wxDateTime_t",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, + { "_wxObject","_wxEditableListBox",SwigwxEditableListBoxTowxObject}, { "_wxObject","_wxDynamicSashWindow",SwigwxDynamicSashWindowTowxObject}, { "_wxObject","_wxDynamicSashUnifyEvent",SwigwxDynamicSashUnifyEventTowxObject}, { "_wxObject","_wxDynamicSashSplitEvent",SwigwxDynamicSashSplitEventTowxObject}, @@ -580,7 +777,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxCoord","_size_t",0}, { "_wxCoord","_time_t",0}, { "_wxCoord","_wxPrintQuality",0}, + { "_wxEvtHandler","_wxEditableListBox",SwigwxEditableListBoxTowxEvtHandler}, { "_wxEvtHandler","_wxDynamicSashWindow",SwigwxDynamicSashWindowTowxEvtHandler}, + { "_wxWindow","_wxEditableListBox",SwigwxEditableListBoxTowxWindow}, { "_wxWindow","_wxDynamicSashWindow",SwigwxDynamicSashWindowTowxWindow}, {0,0,0}}; diff --git a/wxPython/contrib/gizmos/gizmos.i b/wxPython/contrib/gizmos/gizmos.i index 36a475aab7..2702de80b8 100644 --- a/wxPython/contrib/gizmos/gizmos.i +++ b/wxPython/contrib/gizmos/gizmos.i @@ -16,6 +16,7 @@ %{ #include "export.h" #include "wx/gizmos/dynamicsash.h" +#include "wx/gizmos/editlbox.h" %} //--------------------------------------------------------------------------- @@ -149,6 +150,35 @@ def EVT_DYNAMIC_SASH_UNIFY(win, id, func): win.Connect(id, -1, wxEVT_DYNAMIC_SASH_UNIFY, func) " +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- + + +// This class provides a composite control that lets the +// user easily enter list of strings +class wxEditableListBox : public wxPanel +{ +public: + wxEditableListBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const char* name = "editableListBox"); + + void SetStrings(const wxArrayString& strings); + + //void GetStrings(wxArrayString& strings); + %addmethods { + PyObject* GetStrings() { + wxArrayString strings; + self->GetStrings(strings); + return wxArrayString2PyList_helper(strings); + } + } +}; + + + //---------------------------------------------------------------------- %init %{ @@ -159,8 +189,6 @@ def EVT_DYNAMIC_SASH_UNIFY(win, id, func): %} -//---------------------------------------------------------------------- - %pragma(python) include="_gizmoextras.py"; //---------------------------------------------------------------------- diff --git a/wxPython/contrib/gizmos/gizmos.py b/wxPython/contrib/gizmos/gizmos.py index 35c80ee5f8..7828ecd390 100644 --- a/wxPython/contrib/gizmos/gizmos.py +++ b/wxPython/contrib/gizmos/gizmos.py @@ -107,6 +107,26 @@ def wxPreDynamicSashWindow(*_args,**_kwargs): return val +class wxEditableListBoxPtr(wxPanelPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def SetStrings(self, *_args, **_kwargs): + val = apply(gizmosc.wxEditableListBox_SetStrings,(self,) + _args, _kwargs) + return val + def GetStrings(self, *_args, **_kwargs): + val = apply(gizmosc.wxEditableListBox_GetStrings,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "" % (self.this,) +class wxEditableListBox(wxEditableListBoxPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(gizmosc.new_wxEditableListBox,_args,_kwargs) + self.thisown = 1 + + + + #-------------- FUNCTION WRAPPERS ------------------ diff --git a/wxPython/demo/Main.py b/wxPython/demo/Main.py index 07e93efb9a..2b4f3eae84 100644 --- a/wxPython/demo/Main.py +++ b/wxPython/demo/Main.py @@ -37,6 +37,7 @@ _treeList = [ 'wxMimeTypesManager', 'wxPopupWindow', 'wxDynamicSashWindow', + 'wxEditableListBox', ]), ('Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame', @@ -60,6 +61,7 @@ _treeList = [ 'wxTreeCtrl', 'wxSpinButton', 'wxSpinCtrl', 'wxStaticText', 'wxStaticBitmap', 'wxRadioBox', 'wxSlider', 'wxToolBar', 'wxCalendarCtrl', 'wxToggleButton', + 'wxEditableListBox', ]), ('Window Layout', ['wxLayoutConstraints', 'LayoutAnchors', 'Sizers', 'XML_Resource']), diff --git a/wxPython/demo/wxEditableListBox.py b/wxPython/demo/wxEditableListBox.py new file mode 100644 index 0000000000..6dab278ed6 --- /dev/null +++ b/wxPython/demo/wxEditableListBox.py @@ -0,0 +1,40 @@ +from wxPython.wx import * +from wxPython.gizmos import * + +#---------------------------------------------------------------------- + +class TestPanel(wxPanel): + def __init__(self, parent, log): + wxPanel.__init__(self, parent, -1) + self.log = log + + self.elb = wxEditableListBox(self, -1, "List of Stuff", + (50,50), (250, 250)) + + self.elb.SetStrings(["This is a nifty ListBox widget", + "that is editable by the user.", + "", + "Use the buttons above to", + "manipulate items in the list", + "Or to add new ones.", + ]) + + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = TestPanel(nb, log) + return win + + +#---------------------------------------------------------------------- + + + + + +overview = """\ +This class provides a composite control that lets the +user easily enter list of strings. +""" diff --git a/wxPython/src/_defs.i b/wxPython/src/_defs.i index 41f9c3e94d..4e393463b1 100644 --- a/wxPython/src/_defs.i +++ b/wxPython/src/_defs.i @@ -886,6 +886,7 @@ enum wxEventType { wxEVT_COMMAND_TOOL_ENTER, wxEVT_SET_FOCUS, wxEVT_KILL_FOCUS, + wxEVT_CHILD_FOCUS, wxEVT_MOUSEWHEEL, /* Mouse event types */ diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index 0e8da6d20e..851e4557c5 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -75,6 +75,9 @@ def EVT_SET_FOCUS(win, func): def EVT_KILL_FOCUS(win, func): win.Connect(-1, -1, wxEVT_KILL_FOCUS, func) +def EVT_CHILD_FOCUS(win, func): + win.Connect(-1, -1, wxEVT_CHILD_FOCUS, func) + def EVT_ACTIVATE(win, func): win.Connect(-1, -1, wxEVT_ACTIVATE, func) diff --git a/wxPython/src/events.i b/wxPython/src/events.i index 8e4190a2cc..9b1ef37431 100644 --- a/wxPython/src/events.i +++ b/wxPython/src/events.i @@ -269,6 +269,18 @@ public: wxFocusEvent(WXTYPE eventType = 0, int id = 0); }; +//--------------------------------------------------------------------------- + +// wxChildFocusEvent notifies the parent that a child has got the focus: unlike +// wxFocusEvent it is propgated upwards the window chain +class wxChildFocusEvent : public wxCommandEvent +{ +public: + wxChildFocusEvent(wxWindow *win = NULL); + wxWindow *GetWindow() const; +}; + + //--------------------------------------------------------------------------- class wxActivateEvent: public wxEvent{ diff --git a/wxPython/src/export.h b/wxPython/src/export.h index a1b172ebba..97587e9d21 100644 --- a/wxPython/src/export.h +++ b/wxPython/src/export.h @@ -64,6 +64,8 @@ static void wxPyCoreAPI_IMPORT() { #define wxPyMake_wxObject2(a,b) (wxPyCoreAPIPtr->p_wxPyMake_wxObject(a,b)) #define wxPyMake_wxSizer(a) (wxPyCoreAPIPtr->p_wxPyMake_wxSizer(a)) #define wxPyPtrTypeMap_Add(a, b) (wxPyCoreAPIPtr->p_wxPyPtrTypeMap_Add(a, b)) +#define wxArrayString2PyList_helper(a) (wxPyCoreAPIPtr->p_wxArrayString2PyList_helper(a)) + // This one is special. It's the first function called in SWIG generated diff --git a/wxPython/src/helpers.h b/wxPython/src/helpers.h index 318d202842..3eb8574c22 100644 --- a/wxPython/src/helpers.h +++ b/wxPython/src/helpers.h @@ -152,7 +152,7 @@ bool _2int_seq_helper(PyObject* source, int* i1, int* i2); bool _4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4); -PyObject* wxArrayString2PyList_helper(const wxArrayString& app); +PyObject* wxArrayString2PyList_helper(const wxArrayString& arr); #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; } @@ -288,7 +288,7 @@ struct wxPyCoreAPI { PyObject* (*p_wxPyMake_wxObject)(wxObject* source, bool checkEvtHandler); PyObject* (*p_wxPyMake_wxSizer)(wxSizer* source); void (*p_wxPyPtrTypeMap_Add)(const char* commonName, const char* ptrName); - + PyObject* (*p_wxArrayString2PyList_helper)(const wxArrayString& arr); }; #ifdef wxPyUSE_EXPORT diff --git a/wxPython/src/html.i b/wxPython/src/html.i index 5cc5a25304..1b4f46ef92 100644 --- a/wxPython/src/html.i +++ b/wxPython/src/html.i @@ -419,6 +419,7 @@ public: long style = wxHW_SCROLLBAR_AUTO, const wxString& name = "htmlWindow") : wxHtmlWindow(parent, id, pos, size, style, name) {}; + wxPyHtmlWindow() : wxHtmlWindow() {}; void OnLinkClicked(const wxHtmlLinkInfo& link); void base_OnLinkClicked(const wxHtmlLinkInfo& link); @@ -462,11 +463,19 @@ public: wxSize& size = wxDefaultSize, int flags=wxHW_SCROLLBAR_AUTO, char* name = "htmlWindow"); + %name(wxPreHtmlWindow)wxPyHtmlWindow(); + + bool Create(wxWindow *parent, int id = -1, + wxPoint& pos = wxDefaultPosition, + wxSize& size = wxDefaultSize, + int flags=wxHW_SCROLLBAR_AUTO, + char* name = "htmlWindow"); + void _setCallbackInfo(PyObject* self, PyObject* _class); %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxHtmlWindow)" - %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" + %pragma(python) addtomethod = "wxPreHtmlWindow:val._setOORInfo(val)" bool SetPage(const wxString& source); bool LoadPage(const wxString& location); diff --git a/wxPython/src/msw/events.cpp b/wxPython/src/msw/events.cpp index f926938d6d..ca6551994a 100644 --- a/wxPython/src/msw/events.cpp +++ b/wxPython/src/msw/events.cpp @@ -4459,6 +4459,93 @@ static PyObject *_wrap_new_wxFocusEvent(PyObject *self, PyObject *args, PyObject return _resultobj; } +static void *SwigwxChildFocusEventTowxCommandEvent(void *ptr) { + wxChildFocusEvent *src; + wxCommandEvent *dest; + src = (wxChildFocusEvent *) ptr; + dest = (wxCommandEvent *) src; + return (void *) dest; +} + +static void *SwigwxChildFocusEventTowxEvent(void *ptr) { + wxChildFocusEvent *src; + wxEvent *dest; + src = (wxChildFocusEvent *) ptr; + dest = (wxEvent *) src; + return (void *) dest; +} + +static void *SwigwxChildFocusEventTowxObject(void *ptr) { + wxChildFocusEvent *src; + wxObject *dest; + src = (wxChildFocusEvent *) ptr; + dest = (wxObject *) src; + return (void *) dest; +} + +#define new_wxChildFocusEvent(_swigarg0) (new wxChildFocusEvent(_swigarg0)) +static PyObject *_wrap_new_wxChildFocusEvent(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxChildFocusEvent * _result; + wxWindow * _arg0 = (wxWindow *) NULL; + PyObject * _argo0 = 0; + char *_kwnames[] = { "win", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|O:new_wxChildFocusEvent",_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 new_wxChildFocusEvent. Expected _wxWindow_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxChildFocusEvent *)new_wxChildFocusEvent(_arg0); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxChildFocusEvent_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxChildFocusEvent_GetWindow(_swigobj) (_swigobj->GetWindow()) +static PyObject *_wrap_wxChildFocusEvent_GetWindow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxWindow * _result; + wxChildFocusEvent * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxChildFocusEvent_GetWindow",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxChildFocusEvent_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxChildFocusEvent_GetWindow. Expected _wxChildFocusEvent_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxWindow *)wxChildFocusEvent_GetWindow(_arg0); + + wxPy_END_ALLOW_THREADS; + if (PyErr_Occurred()) return NULL; +}{ _resultobj = wxPyMake_wxObject(_result); } + return _resultobj; +} + static void *SwigwxActivateEventTowxEvent(void *ptr) { wxActivateEvent *src; wxEvent *dest; @@ -7059,6 +7146,8 @@ static PyMethodDef eventscMethods[] = { { "new_wxInitDialogEvent", (PyCFunction) _wrap_new_wxInitDialogEvent, METH_VARARGS | METH_KEYWORDS }, { "wxActivateEvent_GetActive", (PyCFunction) _wrap_wxActivateEvent_GetActive, METH_VARARGS | METH_KEYWORDS }, { "new_wxActivateEvent", (PyCFunction) _wrap_new_wxActivateEvent, METH_VARARGS | METH_KEYWORDS }, + { "wxChildFocusEvent_GetWindow", (PyCFunction) _wrap_wxChildFocusEvent_GetWindow, METH_VARARGS | METH_KEYWORDS }, + { "new_wxChildFocusEvent", (PyCFunction) _wrap_new_wxChildFocusEvent, METH_VARARGS | METH_KEYWORDS }, { "new_wxFocusEvent", (PyCFunction) _wrap_new_wxFocusEvent, METH_VARARGS | METH_KEYWORDS }, { "wxEraseEvent_GetDC", (PyCFunction) _wrap_wxEraseEvent_GetDC, METH_VARARGS | METH_KEYWORDS }, { "new_wxEraseEvent", (PyCFunction) _wrap_new_wxEraseEvent, METH_VARARGS | METH_KEYWORDS }, @@ -7229,6 +7318,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxEvent","_wxMenuEvent",SwigwxMenuEventTowxEvent}, { "_wxEvent","_wxInitDialogEvent",SwigwxInitDialogEventTowxEvent}, { "_wxEvent","_wxActivateEvent",SwigwxActivateEventTowxEvent}, + { "_wxEvent","_wxChildFocusEvent",SwigwxChildFocusEventTowxEvent}, { "_wxEvent","_wxFocusEvent",SwigwxFocusEventTowxEvent}, { "_wxEvent","_wxEraseEvent",SwigwxEraseEventTowxEvent}, { "_wxEvent","_wxPaintEvent",SwigwxPaintEventTowxEvent}, @@ -7275,6 +7365,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxCommandEvent","_wxWindowDestroyEvent",SwigwxWindowDestroyEventTowxCommandEvent}, { "_wxCommandEvent","_wxWindowCreateEvent",SwigwxWindowCreateEventTowxCommandEvent}, { "_wxCommandEvent","_wxNotifyEvent",SwigwxNotifyEventTowxCommandEvent}, + { "_wxCommandEvent","_wxChildFocusEvent",SwigwxChildFocusEventTowxCommandEvent}, { "_wxCommandEvent","_wxSpinEvent",SwigwxSpinEventTowxCommandEvent}, { "_wxCommandEvent","_wxScrollEvent",SwigwxScrollEventTowxCommandEvent}, { "_char","_wxChar",0}, @@ -7317,6 +7408,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxObject","_wxMenuEvent",SwigwxMenuEventTowxObject}, { "_wxObject","_wxInitDialogEvent",SwigwxInitDialogEventTowxObject}, { "_wxObject","_wxActivateEvent",SwigwxActivateEventTowxObject}, + { "_wxObject","_wxChildFocusEvent",SwigwxChildFocusEventTowxObject}, { "_wxObject","_wxFocusEvent",SwigwxFocusEventTowxObject}, { "_wxObject","_wxEraseEvent",SwigwxEraseEventTowxObject}, { "_wxObject","_wxPaintEvent",SwigwxPaintEventTowxObject}, diff --git a/wxPython/src/msw/events.py b/wxPython/src/msw/events.py index a50e4f988c..03051a0702 100644 --- a/wxPython/src/msw/events.py +++ b/wxPython/src/msw/events.py @@ -574,6 +574,23 @@ class wxFocusEvent(wxFocusEventPtr): +class wxChildFocusEventPtr(wxCommandEventPtr): + def __init__(self,this): + self.this = this + self.thisown = 0 + def GetWindow(self, *_args, **_kwargs): + val = apply(eventsc.wxChildFocusEvent_GetWindow,(self,) + _args, _kwargs) + return val + def __repr__(self): + return "" % (self.this,) +class wxChildFocusEvent(wxChildFocusEventPtr): + def __init__(self,*_args,**_kwargs): + self.this = apply(eventsc.new_wxChildFocusEvent,_args,_kwargs) + self.thisown = 1 + + + + class wxActivateEventPtr(wxEventPtr): def __init__(self,this): self.this = this diff --git a/wxPython/src/msw/html.cpp b/wxPython/src/msw/html.cpp index fa722814e8..c240f45c06 100644 --- a/wxPython/src/msw/html.cpp +++ b/wxPython/src/msw/html.cpp @@ -201,6 +201,7 @@ public: long style = wxHW_SCROLLBAR_AUTO, const wxString& name = "htmlWindow") : wxHtmlWindow(parent, id, pos, size, style, name) {}; + wxPyHtmlWindow() : wxHtmlWindow() {}; void OnLinkClicked(const wxHtmlLinkInfo& link); void base_OnLinkClicked(const wxHtmlLinkInfo& link); @@ -4076,6 +4077,88 @@ static PyObject *_wrap_new_wxHtmlWindow(PyObject *self, PyObject *args, PyObject return _resultobj; } +#define new_wxPreHtmlWindow() (new wxPyHtmlWindow()) +static PyObject *_wrap_new_wxPreHtmlWindow(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPyHtmlWindow * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxPreHtmlWindow",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxPyHtmlWindow *)new_wxPreHtmlWindow(); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxPyHtmlWindow_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +#define wxHtmlWindow_Create(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->Create(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) +static PyObject *_wrap_wxHtmlWindow_Create(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxPyHtmlWindow * _arg0; + wxWindow * _arg1; + int _arg2 = (int ) -1; + wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition; + wxSize * _arg4 = (wxSize *) &wxDefaultSize; + int _arg5 = (int ) wxHW_SCROLLBAR_AUTO; + char * _arg6 = (char *) "htmlWindow"; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + wxPoint temp; + PyObject * _obj3 = 0; + wxSize temp0; + PyObject * _obj4 = 0; + char *_kwnames[] = { "self","parent","id","pos","size","flags","name", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|iOOis:wxHtmlWindow_Create",_kwnames,&_argo0,&_argo1,&_arg2,&_obj3,&_obj4,&_arg5,&_arg6)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyHtmlWindow_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxHtmlWindow_Create. Expected _wxPyHtmlWindow_p."); + 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 wxHtmlWindow_Create. Expected _wxWindow_p."); + return NULL; + } + } + if (_obj3) +{ + _arg3 = &temp; + if (! wxPoint_helper(_obj3, &_arg3)) + return NULL; +} + if (_obj4) +{ + _arg4 = &temp0; + if (! wxSize_helper(_obj4, &_arg4)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxHtmlWindow_Create(_arg0,_arg1,_arg2,*_arg3,*_arg4,_arg5,_arg6); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxHtmlWindow__setCallbackInfo(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setCallbackInfo(_swigarg0,_swigarg1)) static PyObject *_wrap_wxHtmlWindow__setCallbackInfo(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -6266,6 +6349,8 @@ static PyMethodDef htmlcMethods[] = { { "wxHtmlWindow_LoadPage", (PyCFunction) _wrap_wxHtmlWindow_LoadPage, METH_VARARGS | METH_KEYWORDS }, { "wxHtmlWindow_SetPage", (PyCFunction) _wrap_wxHtmlWindow_SetPage, METH_VARARGS | METH_KEYWORDS }, { "wxHtmlWindow__setCallbackInfo", (PyCFunction) _wrap_wxHtmlWindow__setCallbackInfo, METH_VARARGS | METH_KEYWORDS }, + { "wxHtmlWindow_Create", (PyCFunction) _wrap_wxHtmlWindow_Create, METH_VARARGS | METH_KEYWORDS }, + { "new_wxPreHtmlWindow", (PyCFunction) _wrap_new_wxPreHtmlWindow, METH_VARARGS | METH_KEYWORDS }, { "new_wxHtmlWindow", (PyCFunction) _wrap_new_wxHtmlWindow, METH_VARARGS | METH_KEYWORDS }, { "new_wxHtmlWidgetCell", (PyCFunction) _wrap_new_wxHtmlWidgetCell, METH_VARARGS | METH_KEYWORDS }, { "new_wxHtmlFontCell", (PyCFunction) _wrap_new_wxHtmlFontCell, METH_VARARGS | METH_KEYWORDS }, diff --git a/wxPython/src/msw/html.py b/wxPython/src/msw/html.py index b2db058c73..030ed6b2b8 100644 --- a/wxPython/src/msw/html.py +++ b/wxPython/src/msw/html.py @@ -511,6 +511,9 @@ class wxHtmlWindowPtr(wxScrolledWindowPtr): def __init__(self,this): self.this = this self.thisown = 0 + def Create(self, *_args, **_kwargs): + val = apply(htmlc.wxHtmlWindow_Create,(self,) + _args, _kwargs) + return val def _setCallbackInfo(self, *_args, **_kwargs): val = apply(htmlc.wxHtmlWindow__setCallbackInfo,(self,) + _args, _kwargs) return val @@ -602,6 +605,12 @@ class wxHtmlWindow(wxHtmlWindowPtr): +def wxPreHtmlWindow(*_args,**_kwargs): + val = wxHtmlWindowPtr(apply(htmlc.new_wxPreHtmlWindow,_args,_kwargs)) + val.thisown = 1 + val._setOORInfo(val) + return val + class wxHtmlDCRendererPtr(wxObjectPtr): def __init__(self,this): diff --git a/wxPython/src/msw/windows.cpp b/wxPython/src/msw/windows.cpp index 817c0970c8..4ac2d168ac 100644 --- a/wxPython/src/msw/windows.cpp +++ b/wxPython/src/msw/windows.cpp @@ -4595,13 +4595,13 @@ static PyObject *_wrap_wxWindow_Show(PyObject *self, PyObject *args, PyObject *k PyObject * _resultobj; bool _result; wxWindow * _arg0; - bool _arg1; + bool _arg1 = (bool ) TRUE; PyObject * _argo0 = 0; - int tempbool1; + int tempbool1 = (int) TRUE; char *_kwnames[] = { "self","show", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxWindow_Show",_kwnames,&_argo0,&tempbool1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxWindow_Show",_kwnames,&_argo0,&tempbool1)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } diff --git a/wxPython/src/msw/windows.py b/wxPython/src/msw/windows.py index 0a66bdd9aa..e874ed06ed 100644 --- a/wxPython/src/msw/windows.py +++ b/wxPython/src/msw/windows.py @@ -609,6 +609,7 @@ class wxPanel(wxPanelPtr): def wxPrePanel(*_args,**_kwargs): val = wxPanelPtr(apply(windowsc.new_wxPrePanel,_args,_kwargs)) val.thisown = 1 + val._setOORInfo(val) return val diff --git a/wxPython/src/msw/wx.cpp b/wxPython/src/msw/wx.cpp index d180d84759..11a4f295bb 100644 --- a/wxPython/src/msw/wx.cpp +++ b/wxPython/src/msw/wx.cpp @@ -674,6 +674,7 @@ static wxPyCoreAPI API = { wxPyMake_wxObject, wxPyMake_wxSizer, wxPyPtrTypeMap_Add, + wxArrayString2PyList_helper }; @@ -2507,6 +2508,7 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxEVT_COMMAND_TOOL_ENTER", PyInt_FromLong((long) wxEVT_COMMAND_TOOL_ENTER)); PyDict_SetItemString(d,"wxEVT_SET_FOCUS", PyInt_FromLong((long) wxEVT_SET_FOCUS)); PyDict_SetItemString(d,"wxEVT_KILL_FOCUS", PyInt_FromLong((long) wxEVT_KILL_FOCUS)); + PyDict_SetItemString(d,"wxEVT_CHILD_FOCUS", PyInt_FromLong((long) wxEVT_CHILD_FOCUS)); PyDict_SetItemString(d,"wxEVT_MOUSEWHEEL", PyInt_FromLong((long) wxEVT_MOUSEWHEEL)); PyDict_SetItemString(d,"wxEVT_LEFT_DOWN", PyInt_FromLong((long) wxEVT_LEFT_DOWN)); PyDict_SetItemString(d,"wxEVT_LEFT_UP", PyInt_FromLong((long) wxEVT_LEFT_UP)); diff --git a/wxPython/src/msw/wx.py b/wxPython/src/msw/wx.py index 120679b480..149b682239 100644 --- a/wxPython/src/msw/wx.py +++ b/wxPython/src/msw/wx.py @@ -771,6 +771,7 @@ wxEVT_COMMAND_TOOL_RCLICKED = wxc.wxEVT_COMMAND_TOOL_RCLICKED wxEVT_COMMAND_TOOL_ENTER = wxc.wxEVT_COMMAND_TOOL_ENTER wxEVT_SET_FOCUS = wxc.wxEVT_SET_FOCUS wxEVT_KILL_FOCUS = wxc.wxEVT_KILL_FOCUS +wxEVT_CHILD_FOCUS = wxc.wxEVT_CHILD_FOCUS wxEVT_MOUSEWHEEL = wxc.wxEVT_MOUSEWHEEL wxEVT_LEFT_DOWN = wxc.wxEVT_LEFT_DOWN wxEVT_LEFT_UP = wxc.wxEVT_LEFT_UP @@ -947,6 +948,9 @@ def EVT_SET_FOCUS(win, func): def EVT_KILL_FOCUS(win, func): win.Connect(-1, -1, wxEVT_KILL_FOCUS, func) +def EVT_CHILD_FOCUS(win, func): + win.Connect(-1, -1, wxEVT_CHILD_FOCUS, func) + def EVT_ACTIVATE(win, func): win.Connect(-1, -1, wxEVT_ACTIVATE, func) diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 53d137d72b..c941ed2e6d 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -336,7 +336,7 @@ public: void SetEventHandler(wxEvtHandler* handler); void SetExtraStyle(long exStyle); void SetTitle(const wxString& title); - bool Show(bool show); + bool Show(bool show=TRUE); bool TransferDataFromWindow(); bool TransferDataToWindow(); bool Validate(); @@ -452,7 +452,7 @@ public: const char* name = "panel"); %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" - %pragma(python) addtomethod = "XXX:val._setOORInfo(self)" + %pragma(python) addtomethod = "wxPrePanel:val._setOORInfo(val)" void InitDialog(); wxButton* GetDefaultItem(); diff --git a/wxPython/src/wx.i b/wxPython/src/wx.i index 4fdfa903e9..6b45c74e3f 100644 --- a/wxPython/src/wx.i +++ b/wxPython/src/wx.i @@ -192,6 +192,7 @@ static wxPyCoreAPI API = { wxPyMake_wxObject, wxPyMake_wxSizer, wxPyPtrTypeMap_Add, + wxArrayString2PyList_helper }; diff --git a/wxPython/wxPython/.cvsignore b/wxPython/wxPython/.cvsignore index 8550dc66c9..3ca2ed886a 100644 --- a/wxPython/wxPython/.cvsignore +++ b/wxPython/wxPython/.cvsignore @@ -1,39 +1,3 @@ *.pyc *.pyd -__init__.py -__version__.py -calendar.py -clip_dnd.py -cmndlgs.py -controls.py -controls2.py -events.py -filesys.py -frames.py -gdi.py -glcanvas.py -grid.py -help.py -html.py -htmlhelp.py -image.py -mdi.py -misc.py -misc2.py -ogl.py -oglbasic.py -oglcanvas.py -oglshapes.py -oglshapes2.py -printfw.py -sizers.py -stattool.py -stc.py -stc_.py -streams.py -utils.py -windows.py -windows2.py -windows3.py -wx.py -xrc.py +*.py -- 2.47.2