]>
git.saurik.com Git - wxWidgets.git/blob - samples/wizard/wiztest.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxWindows sample demonstrating wxWizard control
4 // Author: Vadim Zeitlin
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "wiztest.cpp"
22 #pragma interface "wiztest.cpp"
25 // For compilers that support precompilation, includes "wx/wx.h".
26 #include "wx/wxprec.h"
32 // for all others, include the necessary headers (this file is usually all you
33 // need because it includes almost all "standard" wxWindows headers
38 #include "wx/wizard.h"
41 #include "wiztest.xpm"
44 // ----------------------------------------------------------------------------
46 // ----------------------------------------------------------------------------
48 // Define a new application type, each program should derive a class from wxApp
49 class MyApp
: public wxApp
52 // override base class virtuals
53 virtual bool OnInit();
58 // ----------------------------------------------------------------------------
59 // some pages for our wizard
60 // ----------------------------------------------------------------------------
62 // this shows how to simply control the validity of the user input by just
63 // overriding TransferDataFromWindow() - of course, in a real program, the
64 // check wouldn't be so trivial and the data will be probably saved somewhere
66 class wxCheckboxPage
: public wxPanel
69 wxCheckboxPage(wxWizard
*parent
) : wxPanel(parent
)
71 m_checkbox
= new wxCheckBox(this, -1, "Check me", wxPoint(20, 20));
74 virtual bool TransferDataFromWindow()
76 if ( m_checkbox
->GetValue() )
78 wxMessageBox("Clear the checkbox first", "No way",
79 wxICON_WARNING
| wxOK
, this);
88 wxCheckBox
*m_checkbox
;
91 // ============================================================================
93 // ============================================================================
95 // ----------------------------------------------------------------------------
96 // the application class
97 // ----------------------------------------------------------------------------
99 // `Main program' equivalent: the program execution "starts" here
103 wxBitmap
bmpWizard("wiztest.bmp", wxBITMAP_TYPE_BMP
);
105 wxBitmap
bmpWizard(wizimage
);
108 wxWizard
*wizard
= wxWizard::Create(NULL
, -1,
109 "Absolutely Useless Wizard",
112 wxPanel
*panel
= new wxPanel(wizard
);
113 (void)new wxStaticText(panel
, -1,
114 "This wizard doesn't help you to do anything at "
117 "The next pages will present you with more useless "
119 wizard
->AddPage(panel
);
121 wizard
->AddPage(new wxCheckboxPage(wizard
));
123 if ( wizard
->RunWizard() )
125 wxMessageBox("The wizard successfully completed", "That's all",
126 wxICON_INFORMATION
| wxOK
);