X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b2dc104421c340091342156d6b01f61f1ccff438..fe45b493dcc42fea4ad4f781a4fb7844d2e95fd0:/wxPython/src/wizard.i?ds=inline diff --git a/wxPython/src/wizard.i b/wxPython/src/wizard.i index 0eac0cdb21..5ff034f4db 100644 --- a/wxPython/src/wizard.i +++ b/wxPython/src/wizard.i @@ -10,7 +10,12 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -%module wizard +%define DOCSTRING +"`Wizard` is a dialog class that guides the user through a sequence of steps, +or pages." +%enddef + +%module(package="wx", docstring=DOCSTRING) wizard %{ #include "wx/wxPython/wxPython.h" @@ -24,9 +29,8 @@ //---------------------------------------------------------------------- %import windows.i -%pythoncode { wx = core } - -%include _wizard_rename.i +%pythoncode { wx = _core } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } MAKE_CONST_WXSTRING_NOSWIG(EmptyString); @@ -59,16 +63,19 @@ class wxWizardEvent : public wxNotifyEvent public: wxWizardEvent(wxEventType type = wxEVT_NULL, int id = -1, - bool direction = True, + bool direction = true, wxWizardPage* page = NULL); // for EVT_WIZARD_PAGE_CHANGING, return True if we're going forward or // False otherwise and for EVT_WIZARD_PAGE_CHANGED return True if we came // from the previous page and False if we returned from the next one // (this function doesn't make sense for CANCEL events) - bool GetDirection() const { return m_direction; } + bool GetDirection() const; + + wxWizardPage* GetPage() const; - wxWizardPage* GetPage() const { return m_page; } + %property(Direction, GetDirection, doc="See `GetDirection`"); + %property(Page, GetPage, doc="See `GetPage`"); }; @@ -79,6 +86,7 @@ public: // // Other than GetNext/Prev() functions, wxWizardPage is just a panel and may be // used as such (i.e. controls may be placed directly on it &c). +MustHaveApp(wxWizardPage); class wxWizardPage : public wxPanel { public: @@ -87,20 +95,11 @@ public: // // that no other parameters are needed because the wizard will resize and // // reposition the page anyhow // wxWizardPage(wxWizard *parent, -// const wxBitmap& bitmap = wxNullBitmap, -// const char* resource = NULL); -// %name(PreWizardPage)wxWizardPage(); - - %extend { - bool Create(wxWizard *parent, - const wxBitmap& bitmap = wxNullBitmap, - const wxString& resource = wxPyEmptyString) { - wxChar* res = NULL; - if (resource.Length()) - res = (wxChar*)resource.c_str(); - return self->Create(parent, bitmap, res); - } - } +// const wxBitmap& bitmap = wxNullBitmap); +// %RenameCtor(PreWizardPage, wxWizardPage()); + + bool Create(wxWizard *parent, + const wxBitmap& bitmap = wxNullBitmap); // these functions are used by the wizard to show another page when the @@ -113,19 +112,22 @@ public: // dynamically or to do something even more fancy. It's ok to return // wxNullBitmap from here - the default one will be used then. virtual wxBitmap GetBitmap() const; + + %property(Bitmap, GetBitmap, doc="See `GetBitmap`"); + %property(Next, GetNext, doc="See `GetNext`"); + %property(Prev, GetPrev, doc="See `GetPrev`"); }; %{ // C++ Version of a Python aware class class wxPyWizardPage : public wxWizardPage { - DECLARE_ABSTRACT_CLASS(wxPyWizardPage); + DECLARE_ABSTRACT_CLASS(wxPyWizardPage) public: wxPyWizardPage() : wxWizardPage() {} wxPyWizardPage(wxWizard *parent, - const wxBitmap& bitmap = wxNullBitmap, - const wxChar* resource = NULL) - : wxWizardPage(parent, bitmap, resource) {} + const wxBitmap& bitmap = wxNullBitmap) + : wxWizardPage(parent, bitmap) {} DEC_PYCALLBACK_WIZPG__pure(GetPrev); DEC_PYCALLBACK_WIZPG__pure(GetNext); @@ -193,72 +195,90 @@ IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWizardPage, wxWizardPage, RemoveChild); +MustHaveApp(wxPyWizardPage); + class wxPyWizardPage : public wxWizardPage { public: - %addtofunc wxPyWizardPage "self._setCallbackInfo(self, PyWizardPage);self._setOORInfo(self)" - %addtofunc wxPyWizardPage() "" + %pythonAppend wxPyWizardPage "self._setOORInfo(self);" setCallbackInfo(PyWizardPage) + %pythonAppend wxPyWizardPage() "" + %typemap(out) wxPyWizardPage*; // turn off this typemap // ctor accepts an optional bitmap which will be used for this page instead // of the default one for this wizard (should be of the same size). Notice // that no other parameters are needed because the wizard will resize and // reposition the page anyhow - %extend { - wxPyWizardPage(wxWizard *parent, - const wxBitmap* bitmap = &wxNullBitmap, - const wxString* resource = &wxPyEmptyString) { - wxChar* res = NULL; - if (resource->Length()) - res = (wxChar*)resource->c_str(); - return new wxPyWizardPage(parent, *bitmap, res); - } - } - - %name(PrePyWizardPage)wxPyWizardPage(); - - %extend { - bool Create(wxWizard *parent, - const wxBitmap& bitmap = wxNullBitmap, - const wxString& resource = wxPyEmptyString) { - wxChar* res = NULL; - if (resource.Length()) - res = (wxChar*)resource.c_str(); - return self->Create(parent, bitmap, res); - } - } + wxPyWizardPage(wxWizard *parent, + const wxBitmap& bitmap = wxNullBitmap); + + %RenameCtor(PrePyWizardPage, wxPyWizardPage()); + + // Turn it back on again + %typemap(out) wxPyWizardPage* { $result = wxPyMake_wxObject($1, $owner); } + + bool Create(wxWizard *parent, + const wxBitmap& bitmap = wxNullBitmap); void _setCallbackInfo(PyObject* self, PyObject* _class); - void base_DoMoveWindow(int x, int y, int width, int height); - void base_DoSetSize(int x, int y, int width, int height, + void DoMoveWindow(int x, int y, int width, int height); + void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - void base_DoSetClientSize(int width, int height); - void base_DoSetVirtualSize( int x, int y ); + void DoSetClientSize(int width, int height); + void DoSetVirtualSize( int x, int y ); DocDeclA( - void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetSize() -> (width, height)"); + void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetSize() -> (width, height)"); DocDeclA( - void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetClientSize() -> (width, height)"); + void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, + "DoGetClientSize() -> (width, height)"); DocDeclA( - void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const, - "base_DoGetPosition() -> (x,y)"); - - wxSize base_DoGetVirtualSize() const; - wxSize base_DoGetBestSize() const; - - void base_InitDialog(); - bool base_TransferDataToWindow(); - bool base_TransferDataFromWindow(); - bool base_Validate(); - - bool base_AcceptsFocus() const; - bool base_AcceptsFocusFromKeyboard() const; - wxSize base_GetMaxSize() const; - - void base_AddChild(wxWindow* child); - void base_RemoveChild(wxWindow* child); + void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, + "DoGetPosition() -> (x,y)"); + + wxSize DoGetVirtualSize() const; + wxSize DoGetBestSize() const; + + void InitDialog(); + bool TransferDataToWindow(); + bool TransferDataFromWindow(); + bool Validate(); + + bool AcceptsFocus() const; + bool AcceptsFocusFromKeyboard() const; + wxSize GetMaxSize() const; + + void AddChild(wxWindow* child); + void RemoveChild(wxWindow* child); + + bool ShouldInheritColours() const; + wxVisualAttributes GetDefaultAttributes(); + + void OnInternalIdle(); + + %MAKE_BASE_FUNC(PyWizardPage, DoMoveWindow); + %MAKE_BASE_FUNC(PyWizardPage, DoSetSize); + %MAKE_BASE_FUNC(PyWizardPage, DoSetClientSize); + %MAKE_BASE_FUNC(PyWizardPage, DoSetVirtualSize); + %MAKE_BASE_FUNC(PyWizardPage, DoGetSize); + %MAKE_BASE_FUNC(PyWizardPage, DoGetClientSize); + %MAKE_BASE_FUNC(PyWizardPage, DoGetPosition); + %MAKE_BASE_FUNC(PyWizardPage, DoGetVirtualSize); + %MAKE_BASE_FUNC(PyWizardPage, DoGetBestSize); + %MAKE_BASE_FUNC(PyWizardPage, InitDialog); + %MAKE_BASE_FUNC(PyWizardPage, TransferDataToWindow); + %MAKE_BASE_FUNC(PyWizardPage, TransferDataFromWindow); + %MAKE_BASE_FUNC(PyWizardPage, Validate); + %MAKE_BASE_FUNC(PyWizardPage, AcceptsFocus); + %MAKE_BASE_FUNC(PyWizardPage, AcceptsFocusFromKeyboard); + %MAKE_BASE_FUNC(PyWizardPage, GetMaxSize); + %MAKE_BASE_FUNC(PyWizardPage, AddChild); + %MAKE_BASE_FUNC(PyWizardPage, RemoveChild); + %MAKE_BASE_FUNC(PyWizardPage, ShouldInheritColours); + %MAKE_BASE_FUNC(PyWizardPage, GetDefaultAttributes); + %MAKE_BASE_FUNC(PyWizardPage, OnInternalIdle); + }; //---------------------------------------------------------------------- @@ -270,26 +290,25 @@ public: // OTOH, it is also possible to dynamicly decide which page to return (i.e. // depending on the user's choices) as the wizard sample shows - in order to do // this, you must derive from wxWizardPage directly. +MustHaveApp(wxWizardPageSimple); class wxWizardPageSimple : public wxWizardPage { public: - %addtofunc wxWizardPageSimple "self._setOORInfo(self)" - %addtofunc wxWizardPageSimple() "" + %pythonAppend wxWizardPageSimple "self._setOORInfo(self)" + %pythonAppend wxWizardPageSimple() "" // ctor takes the previous and next pages wxWizardPageSimple(wxWizard *parent, wxWizardPage *prev = NULL, wxWizardPage *next = NULL, - const wxBitmap& bitmap = wxNullBitmap, - const wxChar* resource = NULL); - %name(PreWizardPageSimple)wxWizardPageSimple(); + const wxBitmap& bitmap = wxNullBitmap); + %RenameCtor(PreWizardPageSimple, wxWizardPageSimple()); bool Create(wxWizard *parent = NULL, wxWizardPage *prev = NULL, wxWizardPage *next = NULL, - const wxBitmap& bitmap = wxNullBitmap, - const wxChar* resource = NULL); + const wxBitmap& bitmap = wxNullBitmap); // the pointers may be also set later - but before starting the wizard void SetPrev(wxWizardPage *prev); @@ -302,11 +321,13 @@ public: //---------------------------------------------------------------------- +MustHaveApp(wxWizard); + class wxWizard : public wxDialog { public: - %addtofunc wxWizard "self._setOORInfo(self)" - %addtofunc wxWizard() "" + %pythonAppend wxWizard "self._setOORInfo(self)" + %pythonAppend wxWizard() "" // ctor wxWizard(wxWindow *parent, @@ -315,7 +336,7 @@ public: const wxBitmap& bitmap = wxNullBitmap, const wxPoint& pos = wxDefaultPosition, long style = wxDEFAULT_DIALOG_STYLE); - %name(PreWizard)wxWizard(); + %RenameCtor(PreWizard, wxWizard()); bool Create(wxWindow *parent, int id = -1, @@ -359,15 +380,19 @@ public: virtual void SetBorder(int border); // is the wizard running? - bool IsRunning() const { return m_page != NULL; } + bool IsRunning() const; // show the prev/next page, but call TransferDataFromWindow on the current // page first and return False without changing the page if // TransferDataFromWindow() returns False - otherwise, returns True - bool ShowPage(wxWizardPage *page, bool goingForward = True); + bool ShowPage(wxWizardPage *page, bool goingForward = true); bool HasNextPage(wxWizardPage* page); bool HasPrevPage(wxWizardPage* page); + + %property(CurrentPage, GetCurrentPage, doc="See `GetCurrentPage`"); + %property(PageAreaSizer, GetPageAreaSizer, doc="See `GetPageAreaSizer`"); + %property(PageSize, GetPageSize, SetPageSize, doc="See `GetPageSize` and `SetPageSize`"); };