mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-25 17:15:45 +08:00
Added wxWizard and the wizard page classes, as well as a wizard sample
in the demo. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16575 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -148,7 +148,7 @@ Fixed the ActiveXWrapper problem. Looks like when the win32com
|
||||
modules make a "callback" that they (incorrectly, IMHO) allocate a
|
||||
transient thread state structure. Since wxPython is now saving
|
||||
tstates for it's own callbacks it ended up using garbage after
|
||||
win32com got rid of the tstate...
|
||||
win32com got rid of the temporary tstate...
|
||||
|
||||
Added a generic static text control to wxPython.lib.stattext. This is
|
||||
so things like Boa and PythonCard can have a static text that can
|
||||
@@ -164,6 +164,8 @@ tools in your own scripts or apps as needed.
|
||||
Added a sample to the demo that catches various key events and
|
||||
displays the details of the event.
|
||||
|
||||
Added wxWizard, wxWizardPage, wxWizardPageSimple and wxPyWizardPage.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ _treeList = [
|
||||
'wxMenu',
|
||||
'wxIEHtmlWin',
|
||||
'wxKeyEvents',
|
||||
'wxWizard',
|
||||
]),
|
||||
|
||||
# managed windows == things with a caption you can close
|
||||
@@ -43,6 +44,7 @@ _treeList = [
|
||||
'wxFrame',
|
||||
'wxMDIWindows',
|
||||
'wxMiniFrame',
|
||||
'wxWizard',
|
||||
]),
|
||||
|
||||
# the common dialogs
|
||||
@@ -60,7 +62,7 @@ _treeList = [
|
||||
'wxTextEntryDialog',
|
||||
]),
|
||||
|
||||
# dialogs form libraries
|
||||
# dialogs from libraries
|
||||
('More Dialogs', [
|
||||
'ErrorDialogs',
|
||||
'ImageBrowser',
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -55,7 +55,10 @@ command_lines = [
|
||||
"-a -u -n File1 -m #FFFFFF bmp_source/file1.bmp images.py",
|
||||
"-a -u -n File2 -m #FFFFFF bmp_source/file2.bmp images.py",
|
||||
|
||||
"-a -u -n NoIcon bmp_source/noicon.png images.py"
|
||||
"-a -u -n NoIcon bmp_source/noicon.png images.py",
|
||||
|
||||
"-a -u -n WizTest1 bmp_source/wiztest1.bmp images.py",
|
||||
"-a -u -n WizTest2 bmp_source/wiztest2.bmp images.py",
|
||||
|
||||
]
|
||||
|
||||
|
||||
+418
-35
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,115 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.wizard import *
|
||||
|
||||
import images
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TitledPage(wxWizardPageSimple):
|
||||
def __init__(self, parent, title):
|
||||
wxWizardPageSimple.__init__(self, parent)
|
||||
self.sizer = sizer = wxBoxSizer(wxVERTICAL)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
title = wxStaticText(self, -1, title)
|
||||
title.SetFont(wxFont(18, wxSWISS, wxNORMAL, wxBOLD))
|
||||
sizer.AddWindow(title, 0, wxALIGN_CENTRE|wxALL, 5)
|
||||
sizer.AddWindow(wxStaticLine(self, -1), 0, wxEXPAND|wxALL, 5)
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
ID_wiz = wxNewId()
|
||||
|
||||
def __init__(self, parent, log):
|
||||
self.log = log
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
|
||||
b = wxButton(self, -1, "Run Simple Wizard", pos=(50,50))
|
||||
EVT_BUTTON(self, b.GetId(), self.OnRunSimpleWizard)
|
||||
|
||||
EVT_WIZARD_PAGE_CHANGED(self, self.ID_wiz, self.OnWizPageChanged)
|
||||
EVT_WIZARD_PAGE_CHANGING(self, self.ID_wiz, self.OnWizPageChanging)
|
||||
EVT_WIZARD_CANCEL(self, self.ID_wiz, self.OnWizCancel)
|
||||
|
||||
|
||||
def OnWizPageChanged(self, evt):
|
||||
if evt.GetDirection():
|
||||
dir = "forward"
|
||||
else:
|
||||
dir = "backward"
|
||||
self.log.write("OnWizPageChanged: %s, %s\n" % (dir, evt.GetPage()))
|
||||
|
||||
def OnWizPageChanging(self, evt):
|
||||
if evt.GetDirection():
|
||||
dir = "forward"
|
||||
else:
|
||||
dir = "backward"
|
||||
self.log.write("OnWizPageChanging: %s, %s\n" % (dir, evt.GetPage()))
|
||||
|
||||
def OnWizCancel(self, evt):
|
||||
pass
|
||||
|
||||
|
||||
def OnRunSimpleWizard(self, evt):
|
||||
# Create the wizard and the pages
|
||||
wizard = wxWizard(self, self.ID_wiz, "Simple Wizard",
|
||||
images.getWizTest1Bitmap())
|
||||
page1 = TitledPage(wizard, "Page 1")
|
||||
page2 = TitledPage(wizard, "Page 2")
|
||||
page3 = TitledPage(wizard, "Page 3")
|
||||
page4 = TitledPage(wizard, "Page 4")
|
||||
|
||||
page1.sizer.Add(wxStaticText(page1, -1, """\
|
||||
This wizard is totally useless, but is meant to show how to
|
||||
chain simple wizard pages together in a non-dynamic manner.
|
||||
IOW, the order of the pages never changes, and so the
|
||||
wxWizardPageSimple class can be used for the pages."""))
|
||||
wizard.FitToPage(page1)
|
||||
|
||||
# Use the convenience Chain function to connect the pages
|
||||
wxWizardPageSimple_Chain(page1, page2)
|
||||
wxWizardPageSimple_Chain(page2, page3)
|
||||
wxWizardPageSimple_Chain(page3, page4)
|
||||
|
||||
if wizard.RunWizard(page1):
|
||||
wxMessageBox("Wizard completed successfully", "That's all folks!")
|
||||
else:
|
||||
wxMessageBox("Wizard was cancelled", "That's all folks!")
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
overview = """<html><body>
|
||||
<h2><center>wxWizard</center></h2>
|
||||
|
||||
wxWizard is the central class for implementing 'wizard-like'
|
||||
dialogs. These dialogs are mostly familiar to Windows users and are
|
||||
nothing else but a sequence of 'pages' each of them displayed inside a
|
||||
dialog which has the buttons to pass to the next (and previous) pages.
|
||||
<p>
|
||||
The wizards are typically used to decompose a complex dialog into
|
||||
several simple steps and are mainly useful to the novice users, hence
|
||||
it is important to keep them as simple as possible.
|
||||
|
||||
</body></html>
|
||||
"""
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys,os
|
||||
import run
|
||||
run.main(['', os.path.basename(sys.argv[0])])
|
||||
|
||||
@@ -473,6 +473,20 @@ if not GL_ONLY:
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
|
||||
# Extension for the wizard module
|
||||
swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR,
|
||||
USE_SWIG, swig_force, swig_args, swig_deps)
|
||||
ext = Extension('wizardc', swig_sources,
|
||||
include_dirs = includes,
|
||||
define_macros = defines,
|
||||
library_dirs = libdirs,
|
||||
libraries = libs,
|
||||
extra_compile_args = cflags,
|
||||
extra_link_args = lflags,
|
||||
)
|
||||
wxpExtensions.append(ext)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Define the GLCanvas extension module
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Stuff these names into the wx namespace so wxPyConstructObject can find them
|
||||
import wx
|
||||
wx.wxWizardEventPtr = wxWizardEventPtr
|
||||
@@ -1740,4 +1740,50 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
|
||||
wxWizardPage* CBNAME() const;
|
||||
|
||||
#define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
|
||||
wxWizardPage* CLASS::CBNAME() const { \
|
||||
wxWizardPage* rv = NULL; \
|
||||
bool found; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||
PyObject* ro; \
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
|
||||
if (ro) { \
|
||||
SWIG_GetPtrObj(ro, (void **)&rv, "_wxWizardPage_p"); \
|
||||
Py_DECREF(ro); \
|
||||
} \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
return rv; \
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
|
||||
wxBitmap CBNAME() const;
|
||||
|
||||
#define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
|
||||
wxBitmap CLASS::CBNAME() const { \
|
||||
wxBitmap rv; \
|
||||
bool found; \
|
||||
wxPyBeginBlockThreads(); \
|
||||
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
|
||||
PyObject* ro; \
|
||||
wxBitmap* ptr; \
|
||||
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
|
||||
if (ro) { \
|
||||
if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) \
|
||||
rv = *ptr; \
|
||||
Py_DECREF(ro); \
|
||||
} \
|
||||
} \
|
||||
wxPyEndBlockThreads(); \
|
||||
return rv; \
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,277 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import wizardc
|
||||
|
||||
from windows import *
|
||||
|
||||
from misc import *
|
||||
|
||||
from gdi import *
|
||||
|
||||
from fonts import *
|
||||
|
||||
from clip_dnd import *
|
||||
|
||||
from frames import *
|
||||
|
||||
from stattool import *
|
||||
|
||||
from controls import *
|
||||
|
||||
from events import *
|
||||
|
||||
# wizard events
|
||||
def EVT_WIZARD_PAGE_CHANGED(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_WIZARD_PAGE_CHANGED, func)
|
||||
|
||||
def EVT_WIZARD_PAGE_CHANGING(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_WIZARD_PAGE_CHANGING, func)
|
||||
|
||||
def EVT_WIZARD_CANCEL(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_WIZARD_CANCEL, func)
|
||||
|
||||
def EVT_WIZARD_HELP(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_WIZARD_HELP, func)
|
||||
|
||||
|
||||
class wxWizardEventPtr(wxNotifyEventPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def GetDirection(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardEvent_GetDirection,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetPage(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardEvent_GetPage,(self,) + _args, _kwargs)
|
||||
if val: val = wxWizardPagePtr(val)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxWizardEvent instance at %s>" % (self.this,)
|
||||
class wxWizardEvent(wxWizardEventPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(wizardc.new_wxWizardEvent,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
|
||||
|
||||
|
||||
|
||||
class wxWizardPagePtr(wxPanelPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def Create(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardPage_Create,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Init(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardPage_Init,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetPrev(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardPage_GetPrev,(self,) + _args, _kwargs)
|
||||
if val: val = wxWizardPagePtr(val)
|
||||
return val
|
||||
def GetNext(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardPage_GetNext,(self,) + _args, _kwargs)
|
||||
if val: val = wxWizardPagePtr(val)
|
||||
return val
|
||||
def GetBitmap(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardPage_GetBitmap,(self,) + _args, _kwargs)
|
||||
if val: val = wxBitmapPtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxWizardPage instance at %s>" % (self.this,)
|
||||
class wxWizardPage(wxWizardPagePtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
|
||||
|
||||
|
||||
|
||||
class wxPyWizardPagePtr(wxWizardPagePtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def Create(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_Create,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def _setCallbackInfo(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage__setCallbackInfo,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_DoMoveWindow(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_DoMoveWindow,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_DoSetSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_DoSetSize,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_DoSetClientSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_DoSetClientSize,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_DoSetVirtualSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_DoSetVirtualSize,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_DoGetSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_DoGetSize,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_DoGetClientSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_DoGetClientSize,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_DoGetPosition(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_DoGetPosition,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_DoGetVirtualSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_DoGetVirtualSize,(self,) + _args, _kwargs)
|
||||
if val: val = wxSizePtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def base_DoGetBestSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_DoGetBestSize,(self,) + _args, _kwargs)
|
||||
if val: val = wxSizePtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def base_InitDialog(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_InitDialog,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_TransferDataToWindow(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_TransferDataToWindow,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_TransferDataFromWindow(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_TransferDataFromWindow,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_Validate(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_Validate,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_AcceptsFocus(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_AcceptsFocus,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_AcceptsFocusFromKeyboard(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_AcceptsFocusFromKeyboard,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_GetMaxSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_GetMaxSize,(self,) + _args, _kwargs)
|
||||
if val: val = wxSizePtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def base_AddChild(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_AddChild,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def base_RemoveChild(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxPyWizardPage_base_RemoveChild,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxPyWizardPage instance at %s>" % (self.this,)
|
||||
class wxPyWizardPage(wxPyWizardPagePtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(wizardc.new_wxPyWizardPage,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setCallbackInfo(self, wxPyWizardPage)
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
def wxPrePyWizardPage(*_args,**_kwargs):
|
||||
val = wxPyWizardPagePtr(apply(wizardc.new_wxPrePyWizardPage,_args,_kwargs))
|
||||
val.thisown = 1
|
||||
val._setOORInfo(val)
|
||||
return val
|
||||
|
||||
|
||||
class wxWizardPageSimplePtr(wxWizardPagePtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def Create(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardPageSimple_Create,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Init(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardPageSimple_Init,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetPrev(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardPageSimple_SetPrev,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def SetNext(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizardPageSimple_SetNext,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxWizardPageSimple instance at %s>" % (self.this,)
|
||||
class wxWizardPageSimple(wxWizardPageSimplePtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(wizardc.new_wxWizardPageSimple,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
def wxPreWizardPageSimple(*_args,**_kwargs):
|
||||
val = wxWizardPageSimplePtr(apply(wizardc.new_wxPreWizardPageSimple,_args,_kwargs))
|
||||
val.thisown = 1
|
||||
val._setOORInfo(val)
|
||||
return val
|
||||
|
||||
|
||||
class wxWizardPtr(wxDialogPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def Create(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizard_Create,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def Init(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizard_Init,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def RunWizard(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizard_RunWizard,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetCurrentPage(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizard_GetCurrentPage,(self,) + _args, _kwargs)
|
||||
if val: val = wxWizardPagePtr(val)
|
||||
return val
|
||||
def SetPageSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizard_SetPageSize,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetPageSize(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizard_GetPageSize,(self,) + _args, _kwargs)
|
||||
if val: val = wxSizePtr(val) ; val.thisown = 1
|
||||
return val
|
||||
def FitToPage(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizard_FitToPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def IsRunning(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizard_IsRunning,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def ShowPage(self, *_args, **_kwargs):
|
||||
val = apply(wizardc.wxWizard_ShowPage,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxWizard instance at %s>" % (self.this,)
|
||||
class wxWizard(wxWizardPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = apply(wizardc.new_wxWizard,_args,_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
def wxPreWizard(*_args,**_kwargs):
|
||||
val = wxWizardPtr(apply(wizardc.new_wxPreWizard,_args,_kwargs))
|
||||
val.thisown = 1
|
||||
val._setOORInfo(val)
|
||||
return val
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
wxWizardPageSimple_Chain = wizardc.wxWizardPageSimple_Chain
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
||||
wxWIZARD_EX_HELPBUTTON = wizardc.wxWIZARD_EX_HELPBUTTON
|
||||
wxEVT_WIZARD_PAGE_CHANGED = wizardc.wxEVT_WIZARD_PAGE_CHANGED
|
||||
wxEVT_WIZARD_PAGE_CHANGING = wizardc.wxEVT_WIZARD_PAGE_CHANGING
|
||||
wxEVT_WIZARD_CANCEL = wizardc.wxEVT_WIZARD_CANCEL
|
||||
wxEVT_WIZARD_HELP = wizardc.wxEVT_WIZARD_HELP
|
||||
|
||||
|
||||
#-------------- USER INCLUDE -----------------------
|
||||
|
||||
# Stuff these names into the wx namespace so wxPyConstructObject can find them
|
||||
import wx
|
||||
wx.wxWizardEventPtr = wxWizardEventPtr
|
||||
@@ -0,0 +1,352 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wizard.i
|
||||
// Purpose: Classes for wxWizard and etc.
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 16-Aug-2002
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2002 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
%module wizard
|
||||
|
||||
%{
|
||||
#include "wxPython.h"
|
||||
#include <wx/wizard.h>
|
||||
%}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%include typemaps.i
|
||||
%include my_typemaps.i
|
||||
|
||||
// Import some definitions of other classes, etc.
|
||||
%import _defs.i
|
||||
%import windows.i
|
||||
%import frames.i
|
||||
%import misc.i
|
||||
%import controls.i
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
wxWIZARD_EX_HELPBUTTON,
|
||||
|
||||
wxEVT_WIZARD_PAGE_CHANGED,
|
||||
wxEVT_WIZARD_PAGE_CHANGING,
|
||||
wxEVT_WIZARD_CANCEL,
|
||||
wxEVT_WIZARD_HELP
|
||||
};
|
||||
|
||||
|
||||
%pragma(python) code = "
|
||||
# wizard events
|
||||
def EVT_WIZARD_PAGE_CHANGED(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_WIZARD_PAGE_CHANGED, func)
|
||||
|
||||
def EVT_WIZARD_PAGE_CHANGING(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_WIZARD_PAGE_CHANGING, func)
|
||||
|
||||
def EVT_WIZARD_CANCEL(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_WIZARD_CANCEL, func)
|
||||
|
||||
def EVT_WIZARD_HELP(win, id, func):
|
||||
win.Connect(id, -1, wxEVT_WIZARD_HELP, func)
|
||||
|
||||
"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class wxWizardEvent : public wxNotifyEvent
|
||||
{
|
||||
public:
|
||||
wxWizardEvent(wxEventType type = wxEVT_NULL,
|
||||
int id = -1,
|
||||
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; }
|
||||
|
||||
wxWizardPage* GetPage() const { return m_page; }
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// wxWizardPage is one of the wizards screen: it must know what are the
|
||||
// following and preceding pages (which may be NULL for the first/last page).
|
||||
//
|
||||
// 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).
|
||||
class wxWizardPage : public wxPanel
|
||||
{
|
||||
public:
|
||||
// // 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
|
||||
// wxWizardPage(wxWizard *parent,
|
||||
// const wxBitmap& bitmap = wxNullBitmap,
|
||||
// const char* resource = NULL);
|
||||
// %name(wxPreWizardPage)wxWizardPage();
|
||||
|
||||
bool Create(wxWizard *parent,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
const char* resource = NULL);
|
||||
|
||||
// common part of ctors:
|
||||
void Init();
|
||||
|
||||
// these functions are used by the wizard to show another page when the
|
||||
// user chooses "Back" or "Next" button
|
||||
virtual wxWizardPage *GetPrev() const;
|
||||
virtual wxWizardPage *GetNext() const;
|
||||
|
||||
// default GetBitmap() will just return m_bitmap which is ok in 99% of
|
||||
// cases - override this method if you want to create the bitmap to be used
|
||||
// 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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
%{ // C++ Version of a Python aware class
|
||||
class wxPyWizardPage : public wxWizardPage {
|
||||
DECLARE_ABSTRACT_CLASS(wxPyWizardPage);
|
||||
public:
|
||||
wxPyWizardPage() : wxWizardPage() {}
|
||||
wxPyWizardPage(wxWizard *parent,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
const wxChar* resource = NULL)
|
||||
: wxWizardPage(parent, bitmap, resource) {}
|
||||
|
||||
DEC_PYCALLBACK_WIZPG__pure(GetPrev);
|
||||
DEC_PYCALLBACK_WIZPG__pure(GetNext);
|
||||
DEC_PYCALLBACK_BITMAP__pure(GetBitmap);
|
||||
|
||||
DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
|
||||
DEC_PYCALLBACK_VOID_INT5(DoSetSize);
|
||||
DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
|
||||
DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
|
||||
|
||||
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
|
||||
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
|
||||
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
|
||||
|
||||
DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
|
||||
DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
|
||||
|
||||
DEC_PYCALLBACK__(InitDialog);
|
||||
DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
|
||||
DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
|
||||
DEC_PYCALLBACK_BOOL_(Validate);
|
||||
|
||||
DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
|
||||
DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
|
||||
DEC_PYCALLBACK_SIZE_const(GetMaxSize);
|
||||
|
||||
DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
|
||||
DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
|
||||
|
||||
PYPRIVATE;
|
||||
};
|
||||
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxPyWizardPage, wxWizardPage);
|
||||
|
||||
IMP_PYCALLBACK_WIZPG__pure(wxPyWizardPage, wxWizardPage, GetPrev);
|
||||
IMP_PYCALLBACK_WIZPG__pure(wxPyWizardPage, wxWizardPage, GetNext);
|
||||
IMP_PYCALLBACK_BITMAP__pure(wxPyWizardPage, wxWizardPage, GetBitmap);
|
||||
|
||||
IMP_PYCALLBACK_VOID_INT4(wxPyWizardPage, wxWizardPage, DoMoveWindow);
|
||||
IMP_PYCALLBACK_VOID_INT5(wxPyWizardPage, wxWizardPage, DoSetSize);
|
||||
IMP_PYCALLBACK_VOID_INTINT(wxPyWizardPage, wxWizardPage, DoSetClientSize);
|
||||
IMP_PYCALLBACK_VOID_INTINT(wxPyWizardPage, wxWizardPage, DoSetVirtualSize);
|
||||
|
||||
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWizardPage, wxWizardPage, DoGetSize);
|
||||
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWizardPage, wxWizardPage, DoGetClientSize);
|
||||
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWizardPage, wxWizardPage, DoGetPosition);
|
||||
|
||||
IMP_PYCALLBACK_SIZE_const(wxPyWizardPage, wxWizardPage, DoGetVirtualSize);
|
||||
IMP_PYCALLBACK_SIZE_const(wxPyWizardPage, wxWizardPage, DoGetBestSize);
|
||||
|
||||
IMP_PYCALLBACK__(wxPyWizardPage, wxWizardPage, InitDialog);
|
||||
IMP_PYCALLBACK_BOOL_(wxPyWizardPage, wxWizardPage, TransferDataFromWindow);
|
||||
IMP_PYCALLBACK_BOOL_(wxPyWizardPage, wxWizardPage, TransferDataToWindow);
|
||||
IMP_PYCALLBACK_BOOL_(wxPyWizardPage, wxWizardPage, Validate);
|
||||
|
||||
IMP_PYCALLBACK_BOOL_const(wxPyWizardPage, wxWizardPage, AcceptsFocus);
|
||||
IMP_PYCALLBACK_BOOL_const(wxPyWizardPage, wxWizardPage, AcceptsFocusFromKeyboard);
|
||||
IMP_PYCALLBACK_SIZE_const(wxPyWizardPage, wxWizardPage, GetMaxSize);
|
||||
|
||||
IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWizardPage, wxWizardPage, AddChild);
|
||||
IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWizardPage, wxWizardPage, RemoveChild);
|
||||
|
||||
%}
|
||||
|
||||
|
||||
|
||||
class wxPyWizardPage : public wxWizardPage {
|
||||
public:
|
||||
// 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
|
||||
wxPyWizardPage(wxWizard *parent,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
const char* resource = NULL);
|
||||
%name(wxPrePyWizardPage)wxPyWizardPage();
|
||||
|
||||
bool Create(wxWizard *parent,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
const char* resource = NULL);
|
||||
|
||||
void _setCallbackInfo(PyObject* self, PyObject* _class);
|
||||
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyWizardPage)"
|
||||
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
%pragma(python) addtomethod = "wxPrePyWizardPage:val._setOORInfo(val)"
|
||||
|
||||
void base_DoMoveWindow(int x, int y, int width, int height);
|
||||
void base_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 base_DoGetSize( int *OUTPUT, int *OUTPUT ) const;
|
||||
void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const;
|
||||
void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const;
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
// wxWizardPageSimple just returns the pointers given to the ctor and is useful
|
||||
// to create a simple wizard where the order of pages never changes.
|
||||
//
|
||||
// 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.
|
||||
class wxWizardPageSimple : public wxWizardPage
|
||||
{
|
||||
public:
|
||||
// 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(wxPreWizardPageSimple)wxWizardPageSimple();
|
||||
|
||||
bool Create(wxWizard *parent = NULL,
|
||||
wxWizardPage *prev = NULL,
|
||||
wxWizardPage *next = NULL,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
const wxChar* resource = NULL);
|
||||
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
%pragma(python) addtomethod = "wxPreWizardPageSimple:val._setOORInfo(val)"
|
||||
|
||||
// common part of ctors:
|
||||
void Init();
|
||||
|
||||
// the pointers may be also set later - but before starting the wizard
|
||||
void SetPrev(wxWizardPage *prev);
|
||||
void SetNext(wxWizardPage *next);
|
||||
|
||||
// a convenience function to make the pages follow each other
|
||||
static void Chain(wxWizardPageSimple *first, wxWizardPageSimple *second);
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class wxWizard : public wxDialog
|
||||
{
|
||||
public:
|
||||
// ctor
|
||||
wxWizard(wxWindow *parent,
|
||||
int id = -1,
|
||||
const wxString& title = wxEmptyString,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
%name(wxPreWizard)wxWizard();
|
||||
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
%pragma(python) addtomethod = "wxPreWizard:val._setOORInfo(val)"
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
int id = -1,
|
||||
const wxString& title = wxEmptyString,
|
||||
const wxBitmap& bitmap = wxNullBitmap,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
void Init();
|
||||
|
||||
|
||||
// executes the wizard starting from the given page, returns TRUE if it was
|
||||
// successfully finished, FALSE if user cancelled it
|
||||
virtual bool RunWizard(wxWizardPage *firstPage);
|
||||
|
||||
// get the current page (NULL if RunWizard() isn't running)
|
||||
virtual wxWizardPage *GetCurrentPage() const;
|
||||
|
||||
// set the min size which should be available for the pages: a
|
||||
// wizard will take into account the size of the bitmap (if any)
|
||||
// itself and will never be less than some predefined fixed size
|
||||
virtual void SetPageSize(const wxSize& size);
|
||||
|
||||
// get the size available for the page: the wizards are not resizeable, so
|
||||
// this size doesn't change
|
||||
virtual wxSize GetPageSize() const;
|
||||
|
||||
// set the best size for the wizard, i.e. make it big enough to contain all
|
||||
// of the pages starting from the given one
|
||||
//
|
||||
// this function may be called several times and possible with different
|
||||
// pages in which case it will only increase the page size if needed (this
|
||||
// may be useful if not all pages are accessible from the first one by
|
||||
// default)
|
||||
virtual void FitToPage(const wxWizardPage *firstPage);
|
||||
|
||||
// is the wizard running?
|
||||
bool IsRunning() const { return m_page != NULL; }
|
||||
|
||||
// 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);
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------
|
||||
// This file gets appended to the shadow class file.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%pragma(python) include="_wizardextras.py";
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user