]>
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"
40 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
44 // Define a new application type, each program should derive a class from wxApp
45 class MyApp
: public wxApp
48 // override base class virtuals
49 virtual bool OnInit();
54 // ----------------------------------------------------------------------------
55 // some pages for our wizard
56 // ----------------------------------------------------------------------------
58 // this shows how to simply control the validity of the user input by just
59 // overriding TransferDataFromWindow() - of course, in a real program, the
60 // check wouldn't be so trivial and the data will be probably saved somewhere
62 class wxCheckboxPage
: public wxPanel
65 wxCheckboxPage(wxWizard
*parent
) : wxPanel(parent
)
67 m_checkbox
= new wxCheckBox(this, -1, "Check me", wxPoint(20, 20));
70 virtual bool TransferDataFromWindow()
72 if ( m_checkbox
->GetValue() )
74 wxMessageBox("Clear the checkbox first", "No way",
75 wxICON_WARNING
, this);
84 wxCheckBox
*m_checkbox
;
87 // ============================================================================
89 // ============================================================================
91 // ----------------------------------------------------------------------------
92 // the application class
93 // ----------------------------------------------------------------------------
95 // `Main program' equivalent: the program execution "starts" here
98 wxBitmap
bmpWizard("wiztest.bmp", wxBITMAP_TYPE_BMP
);
100 wxWizard
*wizard
= wxWizard::Create(NULL
, -1,
101 "Absolutely Useless Wizard",
104 wxPanel
*panel
= new wxPanel(wizard
);
105 (void)new wxStaticText(panel
, -1,
106 "This wizard doesn't help you to do anything at "
109 "The next pages will present you with more useless "
111 wizard
->AddPage(panel
);
113 wizard
->AddPage(new wxCheckboxPage(wizard
));
115 if ( wizard
->RunWizard() )
117 wxMessageBox("The wizard successfully completed", "That's all",