]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/wizard.h
Use wxGetTranslation() instead of _() in the public headers.
[wxWidgets.git] / include / wx / generic / wizard.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/wizard.h
3 // Purpose: declaration of generic wxWizard class
4 // Author: Vadim Zeitlin
5 // Modified by: Robert Vazan (sizers)
6 // Created: 28.09.99
7 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GENERIC_WIZARD_H_
12 #define _WX_GENERIC_WIZARD_H_
13
14 // ----------------------------------------------------------------------------
15 // wxWizard
16 // ----------------------------------------------------------------------------
17
18 class WXDLLIMPEXP_FWD_CORE wxButton;
19 class WXDLLIMPEXP_FWD_CORE wxStaticBitmap;
20 class WXDLLIMPEXP_FWD_ADV wxWizardEvent;
21 class WXDLLIMPEXP_FWD_CORE wxBoxSizer;
22 class WXDLLIMPEXP_FWD_ADV wxWizardSizer;
23
24 class WXDLLIMPEXP_ADV wxWizard : public wxWizardBase
25 {
26 public:
27 // ctor
28 wxWizard() { Init(); }
29 wxWizard(wxWindow *parent,
30 int id = wxID_ANY,
31 const wxString& title = wxEmptyString,
32 const wxBitmap& bitmap = wxNullBitmap,
33 const wxPoint& pos = wxDefaultPosition,
34 long style = wxDEFAULT_DIALOG_STYLE)
35 {
36 Init();
37 Create(parent, id, title, bitmap, pos, style);
38 }
39 bool Create(wxWindow *parent,
40 int id = wxID_ANY,
41 const wxString& title = wxEmptyString,
42 const wxBitmap& bitmap = wxNullBitmap,
43 const wxPoint& pos = wxDefaultPosition,
44 long style = wxDEFAULT_DIALOG_STYLE);
45 void Init();
46 virtual ~wxWizard();
47
48 // implement base class pure virtuals
49 virtual bool RunWizard(wxWizardPage *firstPage);
50 virtual wxWizardPage *GetCurrentPage() const;
51 virtual void SetPageSize(const wxSize& size);
52 virtual wxSize GetPageSize() const;
53 virtual void FitToPage(const wxWizardPage *firstPage);
54 virtual wxSizer *GetPageAreaSizer() const;
55 virtual void SetBorder(int border);
56
57 /// set/get bitmap
58 const wxBitmap& GetBitmap() const { return m_bitmap; }
59 void SetBitmap(const wxBitmap& bitmap);
60
61 // implementation only from now on
62 // -------------------------------
63
64 // is the wizard running?
65 bool IsRunning() const { return m_page != NULL; }
66
67 // show the prev/next page, but call TransferDataFromWindow on the current
68 // page first and return false without changing the page if
69 // TransferDataFromWindow() returns false - otherwise, returns true
70 virtual bool ShowPage(wxWizardPage *page, bool goingForward = true);
71
72 // do fill the dialog with controls
73 // this is app-overridable to, for example, set help and tooltip text
74 virtual void DoCreateControls();
75
76 // Do the adaptation
77 virtual bool DoLayoutAdaptation();
78
79 // Set/get bitmap background colour
80 void SetBitmapBackgroundColour(const wxColour& colour) { m_bitmapBackgroundColour = colour; }
81 const wxColour& GetBitmapBackgroundColour() const { return m_bitmapBackgroundColour; }
82
83 // Set/get bitmap placement (centred, tiled etc.)
84 void SetBitmapPlacement(int placement) { m_bitmapPlacement = placement; }
85 int GetBitmapPlacement() const { return m_bitmapPlacement; }
86
87 // Set/get minimum bitmap width
88 void SetMinimumBitmapWidth(int w) { m_bitmapMinimumWidth = w; }
89 int GetMinimumBitmapWidth() const { return m_bitmapMinimumWidth; }
90
91 // Tile bitmap
92 static bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap);
93
94 protected:
95 // for compatibility only, doesn't do anything any more
96 void FinishLayout() { }
97
98 // Do fit, and adjust to screen size if necessary
99 virtual void DoWizardLayout();
100
101 // Resize bitmap if necessary
102 virtual bool ResizeBitmap(wxBitmap& bmp);
103
104 // was the dialog really created?
105 bool WasCreated() const { return m_btnPrev != NULL; }
106
107 // event handlers
108 void OnCancel(wxCommandEvent& event);
109 void OnBackOrNext(wxCommandEvent& event);
110 void OnHelp(wxCommandEvent& event);
111
112 void OnWizEvent(wxWizardEvent& event);
113
114 void AddBitmapRow(wxBoxSizer *mainColumn);
115 void AddStaticLine(wxBoxSizer *mainColumn);
116 void AddBackNextPair(wxBoxSizer *buttonRow);
117 void AddButtonRow(wxBoxSizer *mainColumn);
118
119 // the page size requested by user
120 wxSize m_sizePage;
121
122 // the dialog position from the ctor
123 wxPoint m_posWizard;
124
125 // wizard state
126 wxWizardPage *m_page; // the current page or NULL
127 wxBitmap m_bitmap; // the default bitmap to show
128
129 // wizard controls
130 wxButton *m_btnPrev, // the "<Back" button
131 *m_btnNext; // the "Next>" or "Finish" button
132 wxStaticBitmap *m_statbmp; // the control for the bitmap
133
134 // Border around page area sizer requested using SetBorder()
135 int m_border;
136
137 // Whether RunWizard() was called
138 bool m_started;
139
140 // Whether was modal (modeless has to be destroyed on finish or cancel)
141 bool m_wasModal;
142
143 // True if pages are laid out using the sizer
144 bool m_usingSizer;
145
146 // Page area sizer will be inserted here with padding
147 wxBoxSizer *m_sizerBmpAndPage;
148
149 // Actual position and size of pages
150 wxWizardSizer *m_sizerPage;
151
152 // Bitmap background colour if resizing bitmap
153 wxColour m_bitmapBackgroundColour;
154
155 // Bitmap placement flags
156 int m_bitmapPlacement;
157
158 // Minimum bitmap width
159 int m_bitmapMinimumWidth;
160
161 friend class wxWizardSizer;
162
163 DECLARE_DYNAMIC_CLASS(wxWizard)
164 DECLARE_EVENT_TABLE()
165 wxDECLARE_NO_COPY_CLASS(wxWizard);
166 };
167
168 #endif // _WX_GENERIC_WIZARD_H_