From 694759cfeb701f8b96d720e72f760cc21e2e6b00 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 25 Nov 1999 07:08:14 +0000 Subject: [PATCH] Bug fixes, new tests and demos, new generated source... Added FileBrowseButton class to the library git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/wxPython/demo/DragAndDrop.py | 8 +- utils/wxPython/demo/FileBrowseButton.py | 19 +++ utils/wxPython/demo/Main.py | 9 +- utils/wxPython/demo/wxListCtrl.py | 2 +- utils/wxPython/lib/filebrowsebutton.py | 155 ++++++++++++++++++++++++ utils/wxPython/lib/grids.py | 2 +- utils/wxPython/src/_defs.i | 1 - utils/wxPython/src/build.cfg | 8 ++ utils/wxPython/src/controls.i | 3 +- utils/wxPython/src/controls2.i | 17 ++- utils/wxPython/src/gdi.i | 3 +- utils/wxPython/src/helpers.cpp | 11 +- utils/wxPython/src/helpers.h | 2 +- utils/wxPython/src/misc.i | 4 +- utils/wxPython/src/misc2.i | 1 + utils/wxPython/src/msw/clip_dnd.cpp | 11 +- utils/wxPython/src/msw/clip_dnd.py | 2 +- utils/wxPython/src/msw/controls.cpp | 55 ++++++++- utils/wxPython/src/msw/controls.py | 3 + utils/wxPython/src/msw/controls2.cpp | 23 ++-- utils/wxPython/src/msw/controls2.py | 5 + utils/wxPython/src/msw/gdi.cpp | 30 ++++- utils/wxPython/src/msw/gdi.py | 3 + utils/wxPython/src/msw/misc.cpp | 76 +++++++++++- utils/wxPython/src/msw/misc.py | 9 +- utils/wxPython/src/msw/misc2.cpp | 18 +++ utils/wxPython/src/msw/misc2.py | 2 + utils/wxPython/src/msw/windows.cpp | 63 +++++++--- utils/wxPython/src/msw/windows.py | 4 + utils/wxPython/src/msw/wx.cpp | 9 +- utils/wxPython/src/msw/wx.py | 9 +- utils/wxPython/src/windows.i | 55 +++------ utils/wxPython/tests/test6.py | 25 ---- 33 files changed, 519 insertions(+), 128 deletions(-) create mode 100644 utils/wxPython/demo/FileBrowseButton.py create mode 100644 utils/wxPython/lib/filebrowsebutton.py diff --git a/utils/wxPython/demo/DragAndDrop.py b/utils/wxPython/demo/DragAndDrop.py index f389bf80b9..090c162b89 100644 --- a/utils/wxPython/demo/DragAndDrop.py +++ b/utils/wxPython/demo/DragAndDrop.py @@ -8,8 +8,6 @@ class ClipTextPanel(wxPanel): wxPanel.__init__(self, parent, -1) self.log = log - self.do = wxTextDataObject() - #self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false)) sizer = wxBoxSizer(wxVERTICAL) @@ -35,6 +33,7 @@ class ClipTextPanel(wxPanel): def OnCopy(self, evt): + self.do = wxTextDataObject() self.do.SetText(self.text.GetValue()) wxTheClipboard.Open() wxTheClipboard.SetData(self.do) @@ -42,11 +41,12 @@ class ClipTextPanel(wxPanel): def OnPaste(self, evt): + do = wxTextDataObject() wxTheClipboard.Open() - success = wxTheClipboard.GetData(self.do) + success = wxTheClipboard.GetData(do) wxTheClipboard.Close() if success: - self.text.SetValue(self.do.GetText()) + self.text.SetValue(do.GetText()) else: wxMessageBox("There is no data in the clipboard in the required format", "Error") diff --git a/utils/wxPython/demo/FileBrowseButton.py b/utils/wxPython/demo/FileBrowseButton.py new file mode 100644 index 0000000000..ed322b67b4 --- /dev/null +++ b/utils/wxPython/demo/FileBrowseButton.py @@ -0,0 +1,19 @@ + +from wxPython.wx import * +from wxPython.lib.filebrowsebtn import FileBrowseButton + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + win = wxPanel(nb, -1) + fbb = FileBrowseButton(win, -1, wxPoint(20,20), wxSize(350, -1)) + return win + + + +#---------------------------------------------------------------------- + + + +overview = FileBrowseButton.__doc__ diff --git a/utils/wxPython/demo/Main.py b/utils/wxPython/demo/Main.py index f5292d51f0..aa3d1776da 100644 --- a/utils/wxPython/demo/Main.py +++ b/utils/wxPython/demo/Main.py @@ -21,7 +21,8 @@ _useSplitter = true _useNestedSplitter = true _treeList = [ - ('New since last release', ['wxMVCTree', 'wxVTKRenderWindow']), + ('New since last release', ['wxMVCTree', 'wxVTKRenderWindow', + 'FileBrowseButton']), ('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']), @@ -49,7 +50,8 @@ _treeList = [ ('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog', 'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar', - 'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow']), + 'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow', + 'FileBrowseButton',]), ('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']), @@ -61,6 +63,8 @@ class wxPythonDemo(wxFrame): def __init__(self, parent, id, title): wxFrame.__init__(self, parent, -1, title, size = (725, 550)) + self.cwd = os.getcwd() + if wxPlatform == '__WXMSW__': self.icon = wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO) self.SetIcon(self.icon) @@ -238,6 +242,7 @@ class wxPythonDemo(wxFrame): #--------------------------------------------- def RunDemo(self, itemText): + os.chdir(self.cwd) if self.nb.GetPageCount() == 3: if self.nb.GetSelection() == 2: self.nb.SetSelection(0) diff --git a/utils/wxPython/demo/wxListCtrl.py b/utils/wxPython/demo/wxListCtrl.py index 7fe5c5387a..bd8487818c 100644 --- a/utils/wxPython/demo/wxListCtrl.py +++ b/utils/wxPython/demo/wxListCtrl.py @@ -23,7 +23,7 @@ class TestListCtrlPanel(wxPanel): tID = NewId() self.il = wxImageList(16, 16) - idx1 = self.il.Add(wxNoRefBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP)) + idx1 = self.il.Add(wxBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP)) self.list = wxListCtrl(self, tID, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSUNKEN_BORDER) diff --git a/utils/wxPython/lib/filebrowsebutton.py b/utils/wxPython/lib/filebrowsebutton.py new file mode 100644 index 0000000000..22e0069311 --- /dev/null +++ b/utils/wxPython/lib/filebrowsebutton.py @@ -0,0 +1,155 @@ +from wxPython.wx import * +import os + +#---------------------------------------------------------------------- + +class FileBrowseButton(wxPanel): + ''' A control to allow the user to type in a filename + or browse with the standard file dialog to select file + + __init__ ( + parent, id, pos, size -- passed directly to wxPanel initialisation + style = wxTAB_TRAVERSAL -- passed directly to wxPanel initialisation + labelText -- Text for label to left of text field + buttonText -- Text for button which launches the file dialog + toolTip -- Help text + dialogTitle -- Title used in file dialog + startDirectory -- Default directory for file dialog startup + fileMask -- File mask (glob pattern, such as *.*) to use in file dialog + fileMode -- wxOPEN or wxSAVE, indicates type of file dialog to use + changeCallback -- callback receives all changes in value of control + ) + GetValue() -- retrieve current value of text control + SetValue(string) -- set current value of text control + label -- pointer to internal label widget + textControl -- pointer to internal text control + browseButton -- pointer to button + ''' + def __init__ (self, parent, id= -1, + pos = wxDefaultPosition, size = wxDefaultSize, + style = wxTAB_TRAVERSAL, + labelText= "File Entry:", + buttonText= "Browse", + toolTip= "Type filename or browse computer to choose file", + # following are the values for a file dialog box + dialogTitle = "Choose a file", + startDirectory = ".", + initialValue = "", + fileMask = "*.*", + fileMode = wxOPEN, + # callback for when value changes (optional) + changeCallback= None + ): + wxPanel.__init__ (self, parent, id, pos, size, style) + # store variables + self.dialogTitle = dialogTitle + self.startDirectory = startDirectory + self.fileMask = fileMask + self.fileMode = fileMode + self.changeCallback = changeCallback + + box = wxBoxSizer(wxHORIZONTAL) + self.label = wxStaticText(self, -1, labelText, style =wxALIGN_RIGHT ) + font = self.label.GetFont() + w, h, d, e = self.GetFullTextExtent(labelText, font) + self.label.SetSize(wxSize(w+5, h)) + box.Add( self.label, 0, wxCENTER ) + + ID = wxNewId() + self.textControl = wxTextCtrl(self, ID) + self.textControl.SetToolTipString( toolTip ) + box.Add( self.textControl, 1, wxLEFT|wxCENTER, 5) + if changeCallback: + EVT_TEXT(self.textControl, ID, changeCallback) + + ID = wxNewId() + self.browseButton = button =wxButton(self, ID, buttonText) + box.Add( button, 0, wxCENTER) + button.SetToolTipString( toolTip ) + EVT_BUTTON(button, ID, self.OnBrowse) + + # add a border around the whole thing and resize the panel to fit + outsidebox = wxBoxSizer(wxVERTICAL) + outsidebox.Add(box, 1, wxEXPAND|wxALL, 3) + outsidebox.Fit(self) + + self.SetAutoLayout(true) + self.SetSizer( outsidebox ) + self.Layout() + if size.width != -1 or size.height != -1: + self.SetSize(size) + + + + def OnBrowse (self, event = None): + ''' Going to browse for file... ''' + current = self.GetValue () + directory = os.path.split(current) + if os.path.isdir( current): + directory =current + elif directory and os.path.isdir( directory[0] ): + directory = directory [0] + else: + directory = self.startDirectory + dlg = wxFileDialog(self, self.dialogTitle, directory, current, self.fileMask, self.fileMode) + if dlg.ShowModal() == wxID_OK: + self.SetValue (dlg.GetPath()) + dlg.Destroy() + self.textControl.SetFocus() + + + def GetValue (self): + ''' Convenient access to text control value ''' + return self.textControl.GetValue () + + + def SetValue (self, value): + ''' Convenient setting of text control value ''' + return self.textControl.SetValue (value) + + +#---------------------------------------------------------------------- + + +if __name__ == "__main__": + #from skeletonbuilder import rulesfile + class DemoFrame( wxFrame ): + def __init__(self, parent): + wxFrame.__init__(self, parent, 2400, "File entry with browse", size=(500,100) ) + panel = wxPanel (self,-1) + innerbox = wxBoxSizer(wxVERTICAL) + control = FileBrowseButton(panel) + innerbox.Add( control, 0, wxEXPAND ) + control = FileBrowseButton(panel, labelText = "With Callback", style = wxSUNKEN_BORDER ,changeCallback= self.OnFileNameChanged) + innerbox.Add( control, 0, wxEXPAND|wxALIGN_BOTTOM ) + panel.SetAutoLayout(true) + panel.SetSizer( innerbox ) + + def OnFileNameChanged (self, event): + print "Filename changed", event.GetString () + + def OnCloseMe(self, event): + self.Close(true) + + def OnCloseWindow(self, event): + self.Destroy() + + class DemoApp(wxApp): + def OnInit(self): + wxImage_AddHandler(wxJPEGHandler()) + wxImage_AddHandler(wxPNGHandler()) + wxImage_AddHandler(wxGIFHandler()) + frame = DemoFrame(NULL) + #frame = RulesPanel(NULL ) + frame.Show(true) + self.SetTopWindow(frame) + return true + + def test( ): + app = DemoApp(0) + app.MainLoop() + print 'Creating dialogue' + test( ) + + + diff --git a/utils/wxPython/lib/grids.py b/utils/wxPython/lib/grids.py index df4d7c9969..061dc95075 100644 --- a/utils/wxPython/lib/grids.py +++ b/utils/wxPython/lib/grids.py @@ -1,5 +1,5 @@ #---------------------------------------------------------------------- -# Name: wxPython.lib.GridSizer +# Name: wxPython.lib.grids # Purpose: An example sizer derived from the C++ wxPySizer that # sizes items in a fixed or flexible grid. # diff --git a/utils/wxPython/src/_defs.i b/utils/wxPython/src/_defs.i index fbed419f63..aa786e903e 100644 --- a/utils/wxPython/src/_defs.i +++ b/utils/wxPython/src/_defs.i @@ -471,7 +471,6 @@ enum { wxLI_HORIZONTAL, wxLI_VERTICAL, - wxHW_SCROLLBAR_NEVER, wxHW_SCROLLBAR_AUTO, diff --git a/utils/wxPython/src/build.cfg b/utils/wxPython/src/build.cfg index e0cd0cd43b..44be386dbe 100644 --- a/utils/wxPython/src/build.cfg +++ b/utils/wxPython/src/build.cfg @@ -22,6 +22,14 @@ dist: cd ..\.. wxPython\distrib\zipit.bat $(VERSION) +dbg: + cd ..\distrib + makedbg.bat $(VERSION) + +dev: + cd ..\distrib + makedev.bat $(VERSION) + __version__.py: ../distrib/build.py build.cfg echo ver = '$(VERSION)' > __version__.py diff --git a/utils/wxPython/src/controls.i b/utils/wxPython/src/controls.i index 57875bd049..5504ddf43b 100644 --- a/utils/wxPython/src/controls.i +++ b/utils/wxPython/src/controls.i @@ -323,7 +323,8 @@ public: %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" bool IsChecked(int uiIndex); - void Check(int uiIndex, bool bCheck = TRUE); + void Check(int uiIndex, int bCheck = TRUE); + void InsertItems(int LCOUNT, wxString* LIST, int pos); int GetItemHeight(); }; diff --git a/utils/wxPython/src/controls2.i b/utils/wxPython/src/controls2.i index 804b3465c7..4d4911a575 100644 --- a/utils/wxPython/src/controls2.i +++ b/utils/wxPython/src/controls2.i @@ -229,6 +229,15 @@ public: //---------------------------------------------------------------------- +enum wxTreeItemIcon +{ + wxTreeItemIcon_Normal, // not selected, not expanded + wxTreeItemIcon_Selected, // selected, not expanded + wxTreeItemIcon_Expanded, // not selected, expanded + wxTreeItemIcon_SelectedExpanded, // selected, expanded + wxTreeItemIcon_Max +}; + class wxTreeItemId { public: @@ -317,18 +326,20 @@ public: void SetIndent(unsigned int indent); wxImageList *GetImageList(); wxImageList *GetStateImageList(); - void SetImageList(wxImageList *imageList); + void SetImageList(wxImageList *imageList/*, int which = wxIMAGE_LIST_NORMAL*/); void SetStateImageList(wxImageList *imageList); unsigned int GetSpacing(); void SetSpacing(unsigned int spacing); wxString GetItemText(const wxTreeItemId& item); - int GetItemImage(const wxTreeItemId& item); + int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal); int GetItemSelectedImage(const wxTreeItemId& item); void SetItemText(const wxTreeItemId& item, const wxString& text); - void SetItemImage(const wxTreeItemId& item, int image); + void SetItemImage(const wxTreeItemId& item, int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal); void SetItemSelectedImage(const wxTreeItemId& item, int image); void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE); diff --git a/utils/wxPython/src/gdi.i b/utils/wxPython/src/gdi.i index 0f6047ec04..b97cb5a756 100644 --- a/utils/wxPython/src/gdi.i +++ b/utils/wxPython/src/gdi.i @@ -198,11 +198,12 @@ public: wxFontEncoding encoding=wxFONTENCODING_DEFAULT) { return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight, - underline, faceName); + underline, faceName, encoding); } // NO Destructor. } + bool Ok(); wxString GetFaceName(); int GetFamily(); diff --git a/utils/wxPython/src/helpers.cpp b/utils/wxPython/src/helpers.cpp index 87ec5fbe71..7333d3ebad 100644 --- a/utils/wxPython/src/helpers.cpp +++ b/utils/wxPython/src/helpers.cpp @@ -10,14 +10,12 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// - -#ifdef __WXGTK__ -#include -#endif +#include // get the correct definition of NULL #undef DEBUG #include #include "helpers.h" + #ifdef __WXMSW__ #include #undef FindWindow @@ -26,7 +24,10 @@ #undef GetClassInfo #undef GetClassName #endif -#include + +#ifdef __WXGTK__ +#include +#endif //--------------------------------------------------------------------------- diff --git a/utils/wxPython/src/helpers.h b/utils/wxPython/src/helpers.h index c257924cdc..57f670fb19 100644 --- a/utils/wxPython/src/helpers.h +++ b/utils/wxPython/src/helpers.h @@ -231,7 +231,7 @@ public: //--------------------------------------------------------------------------- #define PYPRIVATE \ - void _setSelf(PyObject* self, int incref=TRUE) { \ + void _setSelf(PyObject* self, int incref=1) { \ m_myInst.setSelf(self, incref); \ } \ private: wxPyCallbackHelper m_myInst; diff --git a/utils/wxPython/src/misc.i b/utils/wxPython/src/misc.i index a8791dd6c5..4c0a08255a 100644 --- a/utils/wxPython/src/misc.i +++ b/utils/wxPython/src/misc.i @@ -191,6 +191,7 @@ void wxEnableTopLevelWindows(bool enable); } %} +wxString wxStripMenuCodes(const wxString& in); //---------------------------------------------------------------------- @@ -198,7 +199,8 @@ class wxPyTimer { public: wxPyTimer(PyObject* notify); ~wxPyTimer(); - int Interval(); + int GetInterval(); + bool IsOneShot(); void Start(int milliseconds=-1, int oneShot=FALSE); void Stop(); }; diff --git a/utils/wxPython/src/misc2.i b/utils/wxPython/src/misc2.i index 77428e2ae3..6f1d507e0a 100644 --- a/utils/wxPython/src/misc2.i +++ b/utils/wxPython/src/misc2.i @@ -353,6 +353,7 @@ public: //---------------------------------------------------------------------- void wxPostEvent(wxEvtHandler *dest, wxEvent& event); +void wxWakeUpIdle(); //---------------------------------------------------------------------- //---------------------------------------------------------------------- diff --git a/utils/wxPython/src/msw/clip_dnd.cpp b/utils/wxPython/src/msw/clip_dnd.cpp index ef5836c4a9..2a75d1ccbd 100644 --- a/utils/wxPython/src/msw/clip_dnd.cpp +++ b/utils/wxPython/src/msw/clip_dnd.cpp @@ -223,6 +223,8 @@ public: const wxIcon &go = wxNullIcon) : wxDropSource(win, go) {} #endif + ~wxPyDropSource() { } + DEC_PYCALLBACK_BOOL_DR(GiveFeedback); PYPRIVATE; }; @@ -2229,17 +2231,18 @@ static PyObject *_wrap_new_wxDropSource(PyObject *self, PyObject *args, PyObject return _resultobj; } -#define wxDropSource__setSelf(_swigobj,_swigarg0) (_swigobj->_setSelf(_swigarg0)) +#define wxDropSource__setSelf(_swigobj,_swigarg0,_swigarg1) (_swigobj->_setSelf(_swigarg0,_swigarg1)) static PyObject *_wrap_wxDropSource__setSelf(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxPyDropSource * _arg0; PyObject * _arg1; + int _arg2; PyObject * _argo0 = 0; PyObject * _obj1 = 0; - char *_kwnames[] = { "self","self", NULL }; + char *_kwnames[] = { "self","self","incref", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDropSource__setSelf",_kwnames,&_argo0,&_obj1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi:wxDropSource__setSelf",_kwnames,&_argo0,&_obj1,&_arg2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -2253,7 +2256,7 @@ static PyObject *_wrap_wxDropSource__setSelf(PyObject *self, PyObject *args, PyO } { wxPy_BEGIN_ALLOW_THREADS; - wxDropSource__setSelf(_arg0,_arg1); + wxDropSource__setSelf(_arg0,_arg1,_arg2); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); diff --git a/utils/wxPython/src/msw/clip_dnd.py b/utils/wxPython/src/msw/clip_dnd.py index 7ebfabdb1a..471aecf292 100644 --- a/utils/wxPython/src/msw/clip_dnd.py +++ b/utils/wxPython/src/msw/clip_dnd.py @@ -333,7 +333,7 @@ class wxDropSource(wxDropSourcePtr): def __init__(self,*_args,**_kwargs): self.this = apply(clip_dndc.new_wxDropSource,_args,_kwargs) self.thisown = 1 - self._setSelf(self) + self._setSelf(self, 0) diff --git a/utils/wxPython/src/msw/controls.cpp b/utils/wxPython/src/msw/controls.cpp index 0c37b6dda6..ee50c44961 100644 --- a/utils/wxPython/src/msw/controls.cpp +++ b/utils/wxPython/src/msw/controls.cpp @@ -3686,13 +3686,12 @@ static PyObject *_wrap_wxCheckListBox_Check(PyObject *self, PyObject *args, PyOb PyObject * _resultobj; wxCheckListBox * _arg0; int _arg1; - bool _arg2 = (bool ) TRUE; + int _arg2 = (int ) TRUE; PyObject * _argo0 = 0; - int tempbool2 = (int) TRUE; char *_kwnames[] = { "self","uiIndex","bCheck", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxCheckListBox_Check",_kwnames,&_argo0,&_arg1,&tempbool2)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|i:wxCheckListBox_Check",_kwnames,&_argo0,&_arg1,&_arg2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -3701,7 +3700,6 @@ static PyObject *_wrap_wxCheckListBox_Check(PyObject *self, PyObject *args, PyOb return NULL; } } - _arg2 = (bool ) tempbool2; { wxPy_BEGIN_ALLOW_THREADS; wxCheckListBox_Check(_arg0,_arg1,_arg2); @@ -3712,6 +3710,54 @@ static PyObject *_wrap_wxCheckListBox_Check(PyObject *self, PyObject *args, PyOb return _resultobj; } +#define wxCheckListBox_InsertItems(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->InsertItems(_swigarg0,_swigarg1,_swigarg2)) +static PyObject *_wrap_wxCheckListBox_InsertItems(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxCheckListBox * _arg0; + int _arg1; + wxString * _arg2; + int _arg3; + PyObject * _argo0 = 0; + PyObject * _obj2 = 0; + char *_kwnames[] = { "self","LIST","pos", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi:wxCheckListBox_InsertItems",_kwnames,&_argo0,&_obj2,&_arg3)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxCheckListBox_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxCheckListBox_InsertItems. Expected _wxCheckListBox_p."); + return NULL; + } + } +{ + _arg2 = wxString_LIST_helper(_obj2); + if (_arg2 == NULL) { + return NULL; + } +} +{ + if (_obj2) { + _arg1 = PyList_Size(_obj2); + } + else { + _arg1 = 0; + } +} +{ + wxPy_BEGIN_ALLOW_THREADS; + wxCheckListBox_InsertItems(_arg0,_arg1,_arg2,_arg3); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; +{ + delete [] _arg2; +} + return _resultobj; +} + #define wxCheckListBox_GetItemHeight(_swigobj) (_swigobj->GetItemHeight()) static PyObject *_wrap_wxCheckListBox_GetItemHeight(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -7041,6 +7087,7 @@ static PyMethodDef controlscMethods[] = { { "wxTextCtrl_Clear", (PyCFunction) _wrap_wxTextCtrl_Clear, METH_VARARGS | METH_KEYWORDS }, { "new_wxTextCtrl", (PyCFunction) _wrap_new_wxTextCtrl, METH_VARARGS | METH_KEYWORDS }, { "wxCheckListBox_GetItemHeight", (PyCFunction) _wrap_wxCheckListBox_GetItemHeight, METH_VARARGS | METH_KEYWORDS }, + { "wxCheckListBox_InsertItems", (PyCFunction) _wrap_wxCheckListBox_InsertItems, METH_VARARGS | METH_KEYWORDS }, { "wxCheckListBox_Check", (PyCFunction) _wrap_wxCheckListBox_Check, METH_VARARGS | METH_KEYWORDS }, { "wxCheckListBox_IsChecked", (PyCFunction) _wrap_wxCheckListBox_IsChecked, METH_VARARGS | METH_KEYWORDS }, { "new_wxCheckListBox", (PyCFunction) _wrap_new_wxCheckListBox, METH_VARARGS | METH_KEYWORDS }, diff --git a/utils/wxPython/src/msw/controls.py b/utils/wxPython/src/msw/controls.py index 5cb2cae1a2..6029fc3844 100644 --- a/utils/wxPython/src/msw/controls.py +++ b/utils/wxPython/src/msw/controls.py @@ -408,6 +408,9 @@ class wxCheckListBoxPtr(wxListBoxPtr): def Check(self, *_args, **_kwargs): val = apply(controlsc.wxCheckListBox_Check,(self,) + _args, _kwargs) return val + def InsertItems(self, *_args, **_kwargs): + val = apply(controlsc.wxCheckListBox_InsertItems,(self,) + _args, _kwargs) + return val def GetItemHeight(self, *_args, **_kwargs): val = apply(controlsc.wxCheckListBox_GetItemHeight,(self,) + _args, _kwargs) return val diff --git a/utils/wxPython/src/msw/controls2.cpp b/utils/wxPython/src/msw/controls2.cpp index 00cafc83b8..ce7a252c54 100644 --- a/utils/wxPython/src/msw/controls2.cpp +++ b/utils/wxPython/src/msw/controls2.cpp @@ -3801,18 +3801,19 @@ static PyObject *_wrap_wxTreeCtrl_GetItemText(PyObject *self, PyObject *args, Py return _resultobj; } -#define wxTreeCtrl_GetItemImage(_swigobj,_swigarg0) (_swigobj->GetItemImage(_swigarg0)) +#define wxTreeCtrl_GetItemImage(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetItemImage(_swigarg0,_swigarg1)) static PyObject *_wrap_wxTreeCtrl_GetItemImage(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; int _result; wxTreeCtrl * _arg0; wxTreeItemId * _arg1; + wxTreeItemIcon _arg2 = (wxTreeItemIcon ) (wxTreeItemIcon_Normal); PyObject * _argo0 = 0; PyObject * _argo1 = 0; - char *_kwnames[] = { "self","item", NULL }; + char *_kwnames[] = { "self","item","which", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeCtrl_GetItemImage",_kwnames,&_argo0,&_argo1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxTreeCtrl_GetItemImage",_kwnames,&_argo0,&_argo1,&_arg2)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -3830,7 +3831,7 @@ static PyObject *_wrap_wxTreeCtrl_GetItemImage(PyObject *self, PyObject *args, P } { wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxTreeCtrl_GetItemImage(_arg0,*_arg1); + _result = (int )wxTreeCtrl_GetItemImage(_arg0,*_arg1,_arg2); wxPy_END_ALLOW_THREADS; } _resultobj = Py_BuildValue("i",_result); @@ -3922,18 +3923,19 @@ static PyObject *_wrap_wxTreeCtrl_SetItemText(PyObject *self, PyObject *args, Py return _resultobj; } -#define wxTreeCtrl_SetItemImage(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetItemImage(_swigarg0,_swigarg1)) +#define wxTreeCtrl_SetItemImage(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetItemImage(_swigarg0,_swigarg1,_swigarg2)) static PyObject *_wrap_wxTreeCtrl_SetItemImage(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxTreeCtrl * _arg0; wxTreeItemId * _arg1; int _arg2; + wxTreeItemIcon _arg3 = (wxTreeItemIcon ) (wxTreeItemIcon_Normal); PyObject * _argo0 = 0; PyObject * _argo1 = 0; - char *_kwnames[] = { "self","item","image", NULL }; + char *_kwnames[] = { "self","item","image","which", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi:wxTreeCtrl_SetItemImage",_kwnames,&_argo0,&_argo1,&_arg2)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi|i:wxTreeCtrl_SetItemImage",_kwnames,&_argo0,&_argo1,&_arg2,&_arg3)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } @@ -3951,7 +3953,7 @@ static PyObject *_wrap_wxTreeCtrl_SetItemImage(PyObject *self, PyObject *args, P } { wxPy_BEGIN_ALLOW_THREADS; - wxTreeCtrl_SetItemImage(_arg0,*_arg1,_arg2); + wxTreeCtrl_SetItemImage(_arg0,*_arg1,_arg2,_arg3); wxPy_END_ALLOW_THREADS; } Py_INCREF(Py_None); @@ -6442,6 +6444,11 @@ SWIGEXPORT(void) initcontrols2c() { PyDict_SetItemString(d,"wxLIST_FIND_DOWN", PyInt_FromLong((long) wxLIST_FIND_DOWN)); PyDict_SetItemString(d,"wxLIST_FIND_LEFT", PyInt_FromLong((long) wxLIST_FIND_LEFT)); PyDict_SetItemString(d,"wxLIST_FIND_RIGHT", PyInt_FromLong((long) wxLIST_FIND_RIGHT)); + PyDict_SetItemString(d,"wxTreeItemIcon_Normal", PyInt_FromLong((long) wxTreeItemIcon_Normal)); + PyDict_SetItemString(d,"wxTreeItemIcon_Selected", PyInt_FromLong((long) wxTreeItemIcon_Selected)); + PyDict_SetItemString(d,"wxTreeItemIcon_Expanded", PyInt_FromLong((long) wxTreeItemIcon_Expanded)); + PyDict_SetItemString(d,"wxTreeItemIcon_SelectedExpanded", PyInt_FromLong((long) wxTreeItemIcon_SelectedExpanded)); + PyDict_SetItemString(d,"wxTreeItemIcon_Max", PyInt_FromLong((long) wxTreeItemIcon_Max)); { int i; for (i = 0; _swig_mapping[i].n1; i++) diff --git a/utils/wxPython/src/msw/controls2.py b/utils/wxPython/src/msw/controls2.py index ee15e0d20d..e3c0b297bb 100644 --- a/utils/wxPython/src/msw/controls2.py +++ b/utils/wxPython/src/msw/controls2.py @@ -673,3 +673,8 @@ wxLIST_FIND_UP = controls2c.wxLIST_FIND_UP wxLIST_FIND_DOWN = controls2c.wxLIST_FIND_DOWN wxLIST_FIND_LEFT = controls2c.wxLIST_FIND_LEFT wxLIST_FIND_RIGHT = controls2c.wxLIST_FIND_RIGHT +wxTreeItemIcon_Normal = controls2c.wxTreeItemIcon_Normal +wxTreeItemIcon_Selected = controls2c.wxTreeItemIcon_Selected +wxTreeItemIcon_Expanded = controls2c.wxTreeItemIcon_Expanded +wxTreeItemIcon_SelectedExpanded = controls2c.wxTreeItemIcon_SelectedExpanded +wxTreeItemIcon_Max = controls2c.wxTreeItemIcon_Max diff --git a/utils/wxPython/src/msw/gdi.cpp b/utils/wxPython/src/msw/gdi.cpp index 7b7a63d8f1..a3eb011657 100644 --- a/utils/wxPython/src/msw/gdi.cpp +++ b/utils/wxPython/src/msw/gdi.cpp @@ -2079,7 +2079,7 @@ static PyObject *_wrap_wxCursor_Ok(PyObject *self, PyObject *args, PyObject *kwa static wxFont *new_wxFont(int pointSize,int family,int style,int weight,int underline,char *faceName,wxFontEncoding encoding) { return wxTheFontList->FindOrCreateFont(pointSize, family, style, weight, - underline, faceName); + underline, faceName, encoding); } static PyObject *_wrap_new_wxFont(PyObject *self, PyObject *args, PyObject *kwargs) { @@ -2113,6 +2113,33 @@ static PyObject *_wrap_new_wxFont(PyObject *self, PyObject *args, PyObject *kwar return _resultobj; } +#define wxFont_Ok(_swigobj) (_swigobj->Ok()) +static PyObject *_wrap_wxFont_Ok(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxFont * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxFont_Ok",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxFont_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxFont_Ok. Expected _wxFont_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (bool )wxFont_Ok(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxFont_GetFaceName(_swigobj) (_swigobj->GetFaceName()) static PyObject *_wrap_wxFont_GetFaceName(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -7249,6 +7276,7 @@ static PyMethodDef gdicMethods[] = { { "wxFont_GetFontId", (PyCFunction) _wrap_wxFont_GetFontId, METH_VARARGS | METH_KEYWORDS }, { "wxFont_GetFamily", (PyCFunction) _wrap_wxFont_GetFamily, METH_VARARGS | METH_KEYWORDS }, { "wxFont_GetFaceName", (PyCFunction) _wrap_wxFont_GetFaceName, METH_VARARGS | METH_KEYWORDS }, + { "wxFont_Ok", (PyCFunction) _wrap_wxFont_Ok, METH_VARARGS | METH_KEYWORDS }, { "new_wxFont", (PyCFunction) _wrap_new_wxFont, METH_VARARGS | METH_KEYWORDS }, { "wxCursor_Ok", (PyCFunction) _wrap_wxCursor_Ok, METH_VARARGS | METH_KEYWORDS }, { "delete_wxCursor", (PyCFunction) _wrap_delete_wxCursor, METH_VARARGS | METH_KEYWORDS }, diff --git a/utils/wxPython/src/msw/gdi.py b/utils/wxPython/src/msw/gdi.py index f8f9d8292b..2675107717 100644 --- a/utils/wxPython/src/msw/gdi.py +++ b/utils/wxPython/src/msw/gdi.py @@ -145,6 +145,9 @@ class wxFontPtr : def __init__(self,this): self.this = this self.thisown = 0 + def Ok(self, *_args, **_kwargs): + val = apply(gdic.wxFont_Ok,(self,) + _args, _kwargs) + return val def GetFaceName(self, *_args, **_kwargs): val = apply(gdic.wxFont_GetFaceName,(self,) + _args, _kwargs) return val diff --git a/utils/wxPython/src/msw/misc.cpp b/utils/wxPython/src/msw/misc.cpp index eb348bcc6b..90b698bed7 100644 --- a/utils/wxPython/src/msw/misc.cpp +++ b/utils/wxPython/src/msw/misc.cpp @@ -579,6 +579,41 @@ static PyObject *_wrap_wxGetResource(PyObject *self, PyObject *args, PyObject *k return _resultobj; } +static PyObject *_wrap_wxStripMenuCodes(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + wxString * _arg0; + PyObject * _obj0 = 0; + char *_kwnames[] = { "in", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStripMenuCodes",_kwnames,&_obj0)) + return NULL; +{ + if (!PyString_Check(_obj0)) { + PyErr_SetString(PyExc_TypeError, wxStringErrorMsg); + return NULL; + } + _arg0 = new wxString(PyString_AsString(_obj0), PyString_Size(_obj0)); +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxString (wxStripMenuCodes(*_arg0)); + + wxPy_END_ALLOW_THREADS; +}{ + _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); +} +{ + if (_obj0) + delete _arg0; +} +{ + delete _result; +} + return _resultobj; +} + #define wxSize_x_set(_swigobj,_swigval) (_swigobj->x = _swigval,_swigval) static PyObject *_wrap_wxSize_x_set(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -2134,8 +2169,8 @@ static PyObject *_wrap_delete_wxPyTimer(PyObject *self, PyObject *args, PyObject return _resultobj; } -#define wxPyTimer_Interval(_swigobj) (_swigobj->Interval()) -static PyObject *_wrap_wxPyTimer_Interval(PyObject *self, PyObject *args, PyObject *kwargs) { +#define wxPyTimer_GetInterval(_swigobj) (_swigobj->GetInterval()) +static PyObject *_wrap_wxPyTimer_GetInterval(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; int _result; wxPyTimer * _arg0; @@ -2143,18 +2178,45 @@ static PyObject *_wrap_wxPyTimer_Interval(PyObject *self, PyObject *args, PyObje char *_kwnames[] = { "self", NULL }; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxPyTimer_Interval",_kwnames,&_argo0)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxPyTimer_GetInterval",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTimer_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyTimer_GetInterval. Expected _wxPyTimer_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (int )wxPyTimer_GetInterval(_arg0); + + wxPy_END_ALLOW_THREADS; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + +#define wxPyTimer_IsOneShot(_swigobj) (_swigobj->IsOneShot()) +static PyObject *_wrap_wxPyTimer_IsOneShot(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxPyTimer * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxPyTimer_IsOneShot",_kwnames,&_argo0)) return NULL; if (_argo0) { if (_argo0 == Py_None) { _arg0 = NULL; } else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTimer_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyTimer_Interval. Expected _wxPyTimer_p."); + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxPyTimer_IsOneShot. Expected _wxPyTimer_p."); return NULL; } } { wxPy_BEGIN_ALLOW_THREADS; - _result = (int )wxPyTimer_Interval(_arg0); + _result = (bool )wxPyTimer_IsOneShot(_arg0); wxPy_END_ALLOW_THREADS; } _resultobj = Py_BuildValue("i",_result); @@ -3929,7 +3991,8 @@ static PyMethodDef misccMethods[] = { { "wxIndividualLayoutConstraint_Above", (PyCFunction) _wrap_wxIndividualLayoutConstraint_Above, METH_VARARGS | METH_KEYWORDS }, { "wxPyTimer_Stop", (PyCFunction) _wrap_wxPyTimer_Stop, METH_VARARGS | METH_KEYWORDS }, { "wxPyTimer_Start", (PyCFunction) _wrap_wxPyTimer_Start, METH_VARARGS | METH_KEYWORDS }, - { "wxPyTimer_Interval", (PyCFunction) _wrap_wxPyTimer_Interval, METH_VARARGS | METH_KEYWORDS }, + { "wxPyTimer_IsOneShot", (PyCFunction) _wrap_wxPyTimer_IsOneShot, METH_VARARGS | METH_KEYWORDS }, + { "wxPyTimer_GetInterval", (PyCFunction) _wrap_wxPyTimer_GetInterval, METH_VARARGS | METH_KEYWORDS }, { "delete_wxPyTimer", (PyCFunction) _wrap_delete_wxPyTimer, METH_VARARGS | METH_KEYWORDS }, { "new_wxPyTimer", (PyCFunction) _wrap_new_wxPyTimer, METH_VARARGS | METH_KEYWORDS }, { "wxRect_asTuple", (PyCFunction) _wrap_wxRect_asTuple, METH_VARARGS | METH_KEYWORDS }, @@ -3991,6 +4054,7 @@ static PyMethodDef misccMethods[] = { { "wxSize_y_set", (PyCFunction) _wrap_wxSize_y_set, METH_VARARGS | METH_KEYWORDS }, { "wxSize_x_get", (PyCFunction) _wrap_wxSize_x_get, METH_VARARGS | METH_KEYWORDS }, { "wxSize_x_set", (PyCFunction) _wrap_wxSize_x_set, METH_VARARGS | METH_KEYWORDS }, + { "wxStripMenuCodes", (PyCFunction) _wrap_wxStripMenuCodes, METH_VARARGS | METH_KEYWORDS }, { "wxGetResource", (PyCFunction) _wrap_wxGetResource, METH_VARARGS | METH_KEYWORDS }, { "wxEnableTopLevelWindows", (PyCFunction) _wrap_wxEnableTopLevelWindows, METH_VARARGS | METH_KEYWORDS }, { "wxSafeYield", (PyCFunction) _wrap_wxSafeYield, METH_VARARGS | METH_KEYWORDS }, diff --git a/utils/wxPython/src/msw/misc.py b/utils/wxPython/src/msw/misc.py index c238689678..378b31b85e 100644 --- a/utils/wxPython/src/msw/misc.py +++ b/utils/wxPython/src/msw/misc.py @@ -242,8 +242,11 @@ class wxPyTimerPtr : def __del__(self,miscc=miscc): if self.thisown == 1 : miscc.delete_wxPyTimer(self) - def Interval(self, *_args, **_kwargs): - val = apply(miscc.wxPyTimer_Interval,(self,) + _args, _kwargs) + def GetInterval(self, *_args, **_kwargs): + val = apply(miscc.wxPyTimer_GetInterval,(self,) + _args, _kwargs) + return val + def IsOneShot(self, *_args, **_kwargs): + val = apply(miscc.wxPyTimer_IsOneShot,(self,) + _args, _kwargs) return val def Start(self, *_args, **_kwargs): val = apply(miscc.wxPyTimer_Start,(self,) + _args, _kwargs) @@ -567,6 +570,8 @@ wxEnableTopLevelWindows = miscc.wxEnableTopLevelWindows wxGetResource = miscc.wxGetResource +wxStripMenuCodes = miscc.wxStripMenuCodes + #-------------- VARIABLE WRAPPERS ------------------ diff --git a/utils/wxPython/src/msw/misc2.cpp b/utils/wxPython/src/msw/misc2.cpp index b4a4573fa8..fee12a3390 100644 --- a/utils/wxPython/src/msw/misc2.cpp +++ b/utils/wxPython/src/msw/misc2.cpp @@ -1136,6 +1136,23 @@ static PyObject *_wrap_wxPostEvent(PyObject *self, PyObject *args, PyObject *kwa return _resultobj; } +static PyObject *_wrap_wxWakeUpIdle(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + char *_kwnames[] = { NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxWakeUpIdle",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + wxWakeUpIdle(); + + wxPy_END_ALLOW_THREADS; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + #define new_wxToolTip(_swigarg0) (new wxToolTip(_swigarg0)) static PyObject *_wrap_new_wxToolTip(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -2065,6 +2082,7 @@ static PyMethodDef misc2cMethods[] = { { "wxToolTip_GetTip", (PyCFunction) _wrap_wxToolTip_GetTip, METH_VARARGS | METH_KEYWORDS }, { "wxToolTip_SetTip", (PyCFunction) _wrap_wxToolTip_SetTip, METH_VARARGS | METH_KEYWORDS }, { "new_wxToolTip", (PyCFunction) _wrap_new_wxToolTip, METH_VARARGS | METH_KEYWORDS }, + { "wxWakeUpIdle", (PyCFunction) _wrap_wxWakeUpIdle, METH_VARARGS | METH_KEYWORDS }, { "wxPostEvent", (PyCFunction) _wrap_wxPostEvent, METH_VARARGS | METH_KEYWORDS }, { "wxCaret_SetBlinkTime", (PyCFunction) _wrap_wxCaret_SetBlinkTime, METH_VARARGS | METH_KEYWORDS }, { "wxCaret_GetBlinkTime", (PyCFunction) _wrap_wxCaret_GetBlinkTime, METH_VARARGS | METH_KEYWORDS }, diff --git a/utils/wxPython/src/msw/misc2.py b/utils/wxPython/src/msw/misc2.py index 6b558f6ca7..bae1cec70f 100644 --- a/utils/wxPython/src/msw/misc2.py +++ b/utils/wxPython/src/msw/misc2.py @@ -231,6 +231,8 @@ wxCaret_SetBlinkTime = misc2c.wxCaret_SetBlinkTime wxPostEvent = misc2c.wxPostEvent +wxWakeUpIdle = misc2c.wxWakeUpIdle + #-------------- VARIABLE WRAPPERS ------------------ diff --git a/utils/wxPython/src/msw/windows.cpp b/utils/wxPython/src/msw/windows.cpp index dff668bd2d..f12227019e 100644 --- a/utils/wxPython/src/msw/windows.cpp +++ b/utils/wxPython/src/msw/windows.cpp @@ -124,25 +124,24 @@ public: } wxObject* wxPyValidator::Clone() const { - wxPyValidator* ptr = NULL; - wxPyValidator* self = (wxPyValidator*)this; + wxPyValidator* ptr = NULL; + wxPyValidator* self = (wxPyValidator*)this; - bool doSave = wxPyRestoreThread(); - if (self->m_myInst.findCallback("Clone")) { - PyObject* ro; - ro = self->m_myInst.callCallbackObj(Py_BuildValue("()")); - SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p"); - } - // This is very dangerous!!! But is the only way I could find - // to squash a memory leak. Currently it is okay, but if the - // validator architecture in wxWindows ever changes, problems - // could arise. - delete self; - - wxPySaveThread(doSave); - return ptr; -} + bool doSave = wxPyRestoreThread(); + if (self->m_myInst.findCallback("Clone")) { + PyObject* ro; + ro = self->m_myInst.callCallbackObj(Py_BuildValue("()")); + SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p"); + } + // This is very dangerous!!! But is the only way I could find + // to squash a memory leak. Currently it is okay, but if the + // validator architecture in wxWindows ever changes, problems + // could arise. + delete self; + wxPySaveThread(doSave); + return ptr; + } DEC_PYCALLBACK_BOOL_WXWIN(Validate); DEC_PYCALLBACK_BOOL_(TransferToWindow); @@ -4490,6 +4489,35 @@ static PyObject *_wrap_wxWindow_GetDropTarget(PyObject *self, PyObject *args, Py return _resultobj; } +#define wxWindow_GetBestSize(_swigobj) (_swigobj->GetBestSize()) +static PyObject *_wrap_wxWindow_GetBestSize(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxSize * _result; + wxWindow * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxWindow_GetBestSize",_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_GetBestSize. Expected _wxWindow_p."); + return NULL; + } + } +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxSize (wxWindow_GetBestSize(_arg0)); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxSize_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + static void *SwigwxPanelTowxWindow(void *ptr) { wxPanel *src; wxWindow *dest; @@ -8471,6 +8499,7 @@ static PyMethodDef windowscMethods[] = { { "wxPanel_GetDefaultItem", (PyCFunction) _wrap_wxPanel_GetDefaultItem, METH_VARARGS | METH_KEYWORDS }, { "wxPanel_InitDialog", (PyCFunction) _wrap_wxPanel_InitDialog, METH_VARARGS | METH_KEYWORDS }, { "new_wxPanel", (PyCFunction) _wrap_new_wxPanel, METH_VARARGS | METH_KEYWORDS }, + { "wxWindow_GetBestSize", (PyCFunction) _wrap_wxWindow_GetBestSize, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_GetDropTarget", (PyCFunction) _wrap_wxWindow_GetDropTarget, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetDropTarget", (PyCFunction) _wrap_wxWindow_SetDropTarget, METH_VARARGS | METH_KEYWORDS }, { "wxWindow_SetValidator", (PyCFunction) _wrap_wxWindow_SetValidator, METH_VARARGS | METH_KEYWORDS }, diff --git a/utils/wxPython/src/msw/windows.py b/utils/wxPython/src/msw/windows.py index e4b71736f5..d94f570c62 100644 --- a/utils/wxPython/src/msw/windows.py +++ b/utils/wxPython/src/msw/windows.py @@ -466,6 +466,10 @@ class wxWindowPtr(wxEvtHandlerPtr): val = apply(windowsc.wxWindow_GetDropTarget,(self,) + _args, _kwargs) if val: val = wxDropTargetPtr(val) return val + def GetBestSize(self, *_args, **_kwargs): + val = apply(windowsc.wxWindow_GetBestSize,(self,) + _args, _kwargs) + if val: val = wxSizePtr(val) ; val.thisown = 1 + return val def __repr__(self): return "" % (self.this,) class wxWindow(wxWindowPtr): diff --git a/utils/wxPython/src/msw/wx.cpp b/utils/wxPython/src/msw/wx.cpp index 92da2b7243..df1fa72d29 100644 --- a/utils/wxPython/src/msw/wx.cpp +++ b/utils/wxPython/src/msw/wx.cpp @@ -2134,11 +2134,16 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxCOLOURED", PyInt_FromLong((long) wxCOLOURED)); PyDict_SetItemString(d,"wxFIXED_LENGTH", PyInt_FromLong((long) wxFIXED_LENGTH)); PyDict_SetItemString(d,"wxALIGN_LEFT", PyInt_FromLong((long) wxALIGN_LEFT)); - PyDict_SetItemString(d,"wxALIGN_CENTER", PyInt_FromLong((long) wxALIGN_CENTER)); - PyDict_SetItemString(d,"wxALIGN_CENTRE", PyInt_FromLong((long) wxALIGN_CENTRE)); + PyDict_SetItemString(d,"wxALIGN_CENTER_HORIZONTAL", PyInt_FromLong((long) wxALIGN_CENTER_HORIZONTAL)); + PyDict_SetItemString(d,"wxALIGN_CENTRE_HORIZONTAL", PyInt_FromLong((long) wxALIGN_CENTRE_HORIZONTAL)); PyDict_SetItemString(d,"wxALIGN_RIGHT", PyInt_FromLong((long) wxALIGN_RIGHT)); PyDict_SetItemString(d,"wxALIGN_BOTTOM", PyInt_FromLong((long) wxALIGN_BOTTOM)); + PyDict_SetItemString(d,"wxALIGN_CENTER_VERTICAL", PyInt_FromLong((long) wxALIGN_CENTER_VERTICAL)); + PyDict_SetItemString(d,"wxALIGN_CENTRE_VERTICAL", PyInt_FromLong((long) wxALIGN_CENTRE_VERTICAL)); PyDict_SetItemString(d,"wxALIGN_TOP", PyInt_FromLong((long) wxALIGN_TOP)); + PyDict_SetItemString(d,"wxALIGN_CENTER", PyInt_FromLong((long) wxALIGN_CENTER)); + PyDict_SetItemString(d,"wxALIGN_CENTRE", PyInt_FromLong((long) wxALIGN_CENTRE)); + PyDict_SetItemString(d,"wxSHAPED", PyInt_FromLong((long) wxSHAPED)); PyDict_SetItemString(d,"wxLB_NEEDED_SB", PyInt_FromLong((long) wxLB_NEEDED_SB)); PyDict_SetItemString(d,"wxLB_ALWAYS_SB", PyInt_FromLong((long) wxLB_ALWAYS_SB)); PyDict_SetItemString(d,"wxLB_SORT", PyInt_FromLong((long) wxLB_SORT)); diff --git a/utils/wxPython/src/msw/wx.py b/utils/wxPython/src/msw/wx.py index c6f47acf82..eec94a10b7 100644 --- a/utils/wxPython/src/msw/wx.py +++ b/utils/wxPython/src/msw/wx.py @@ -203,11 +203,16 @@ wxTB_DOCKABLE = wxc.wxTB_DOCKABLE wxCOLOURED = wxc.wxCOLOURED wxFIXED_LENGTH = wxc.wxFIXED_LENGTH wxALIGN_LEFT = wxc.wxALIGN_LEFT -wxALIGN_CENTER = wxc.wxALIGN_CENTER -wxALIGN_CENTRE = wxc.wxALIGN_CENTRE +wxALIGN_CENTER_HORIZONTAL = wxc.wxALIGN_CENTER_HORIZONTAL +wxALIGN_CENTRE_HORIZONTAL = wxc.wxALIGN_CENTRE_HORIZONTAL wxALIGN_RIGHT = wxc.wxALIGN_RIGHT wxALIGN_BOTTOM = wxc.wxALIGN_BOTTOM +wxALIGN_CENTER_VERTICAL = wxc.wxALIGN_CENTER_VERTICAL +wxALIGN_CENTRE_VERTICAL = wxc.wxALIGN_CENTRE_VERTICAL wxALIGN_TOP = wxc.wxALIGN_TOP +wxALIGN_CENTER = wxc.wxALIGN_CENTER +wxALIGN_CENTRE = wxc.wxALIGN_CENTRE +wxSHAPED = wxc.wxSHAPED wxLB_NEEDED_SB = wxc.wxLB_NEEDED_SB wxLB_ALWAYS_SB = wxc.wxLB_ALWAYS_SB wxLB_SORT = wxc.wxLB_SORT diff --git a/utils/wxPython/src/windows.i b/utils/wxPython/src/windows.i index 34a42121c0..6f913b7e2c 100644 --- a/utils/wxPython/src/windows.i +++ b/utils/wxPython/src/windows.i @@ -94,25 +94,24 @@ public: } wxObject* wxPyValidator::Clone() const { - wxPyValidator* ptr = NULL; - wxPyValidator* self = (wxPyValidator*)this; - - bool doSave = wxPyRestoreThread(); - if (self->m_myInst.findCallback("Clone")) { - PyObject* ro; - ro = self->m_myInst.callCallbackObj(Py_BuildValue("()")); - SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p"); + wxPyValidator* ptr = NULL; + wxPyValidator* self = (wxPyValidator*)this; + + bool doSave = wxPyRestoreThread(); + if (self->m_myInst.findCallback("Clone")) { + PyObject* ro; + ro = self->m_myInst.callCallbackObj(Py_BuildValue("()")); + SWIG_GetPtrObj(ro, (void **)&ptr, "_wxPyValidator_p"); + } + // This is very dangerous!!! But is the only way I could find + // to squash a memory leak. Currently it is okay, but if the + // validator architecture in wxWindows ever changes, problems + // could arise. + delete self; + + wxPySaveThread(doSave); + return ptr; } - // This is very dangerous!!! But is the only way I could find - // to squash a memory leak. Currently it is okay, but if the - // validator architecture in wxWindows ever changes, problems - // could arise. - delete self; - - wxPySaveThread(doSave); - return ptr; -} - DEC_PYCALLBACK_BOOL_WXWIN(Validate); DEC_PYCALLBACK_BOOL_(TransferToWindow); @@ -313,6 +312,8 @@ public: void SetDropTarget(wxDropTarget* target); wxDropTarget* GetDropTarget(); %pragma(python) addtomethod = "SetDropTarget:_args[0].thisown = 0" + + wxSize GetBestSize(); }; //%clear int* x, int* y; @@ -574,25 +575,9 @@ public: wxAcceleratorEntry *GetAccel(); void SetAccel(wxAcceleratorEntry *accel); -// #ifdef __WXMSW__ -// wxColour& GetBackgroundColour(); -// wxBitmap GetBitmap(bool checked = TRUE); -// wxFont& GetFont(); -// int GetMarginWidth(); -// wxColour& GetTextColour(); -// void SetBackgroundColour(const wxColour& colour); -// void SetBitmaps(const wxBitmap& checked, const wxBitmap& unchecked = wxNullBitmap); -// void SetFont(const wxFont& font); -// void SetMarginWidth(int width); -// void SetText(const wxString& str); -// const wxString& GetText(); -// void SetTextColour(const wxColour& colour); -// void DeleteSubMenu(); -// void SetCheckable(bool checkable); -// void SetSubMenu(wxMenu *menu); -// #endif }; //--------------------------------------------------------------------------- + diff --git a/utils/wxPython/tests/test6.py b/utils/wxPython/tests/test6.py index 7d24149fd4..07568e227e 100644 --- a/utils/wxPython/tests/test6.py +++ b/utils/wxPython/tests/test6.py @@ -79,28 +79,3 @@ if __name__ == '__main__': #---------------------------------------------------------------------------- -# -# $Log$ -# Revision 1.2 1999/02/25 07:09:51 RD -# wxPython version 2.0b5 -# -# Revision 1.1 1998/12/15 20:44:37 RD -# Changed the import semantics from "from wxPython import *" to "from -# wxPython.wx import *" This is for people who are worried about -# namespace pollution, they can use "from wxPython import wx" and then -# prefix all the wxPython identifiers with "wx." -# -# Added wxTaskbarIcon for wxMSW. -# -# Made the events work for wxGrid. -# -# Added wxConfig. -# -# Added wxMiniFrame for wxGTK, (untested.) -# -# Changed many of the args and return values that were pointers to gdi -# objects to references to reflect changes in the wxWindows API. -# -# Other assorted fixes and additions. -# -# -- 2.45.2