00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _WX_SCROLLING_WIZARD_H_
00026 #define _WX_SCROLLING_WIZARD_H_
00027
00028 #include "wx/wizard.h"
00029
00030 #include "uiutils/scrollingdialog.h"
00031
00032
00033
00034
00035
00036 class WXDLLIMPEXP_FWD_CORE wxButton;
00037 class WXDLLIMPEXP_FWD_CORE wxStaticBitmap;
00038 class WXDLLIMPEXP_FWD_ADV wxWizardEvent;
00039 class WXDLLIMPEXP_FWD_CORE wxBoxSizer;
00040 class wxScrollingWizardSizer;
00041
00042
00043 #define wxWIZARD_VALIGN_TOP 0x01
00044 #define wxWIZARD_VALIGN_CENTRE 0x02
00045 #define wxWIZARD_VALIGN_BOTTOM 0x04
00046 #define wxWIZARD_HALIGN_LEFT 0x08
00047 #define wxWIZARD_HALIGN_CENTRE 0x10
00048 #define wxWIZARD_HALIGN_RIGHT 0x20
00049 #define wxWIZARD_TILE 0x40
00050
00051 class wxScrollingWizard : public wxWizard, public wxDialogHelper
00052 {
00053 public:
00054
00055 wxScrollingWizard() { Init(); }
00056 wxScrollingWizard(wxWindow *parent,
00057 int id = wxID_ANY,
00058 const wxString& title = wxEmptyString,
00059 const wxBitmap& bitmap = wxNullBitmap,
00060 const wxPoint& pos = wxDefaultPosition,
00061 long style = wxDEFAULT_DIALOG_STYLE)
00062 {
00063 Init();
00064 Create(parent, id, title, bitmap, pos, style);
00065 }
00066 bool Create(wxWindow *parent,
00067 int id = wxID_ANY,
00068 const wxString& title = wxEmptyString,
00069 const wxBitmap& bitmap = wxNullBitmap,
00070 const wxPoint& pos = wxDefaultPosition,
00071 long style = wxDEFAULT_DIALOG_STYLE);
00072 void Init();
00073 virtual ~wxScrollingWizard();
00074
00075
00076 virtual bool RunWizard(wxWizardPage *firstPage);
00077 virtual wxWizardPage *GetCurrentPage() const;
00078 virtual void SetPageSize(const wxSize& size);
00079 virtual wxSize GetPageSize() const;
00080 virtual void FitToPage(const wxWizardPage *firstPage);
00081 virtual wxSizer *GetPageAreaSizer() const;
00082 virtual void SetBorder(int border);
00083
00085 const wxBitmap& GetBitmap() const { return m_bitmap; }
00086 void SetBitmap(const wxBitmap& bitmap);
00087
00088
00089
00090
00091
00092 bool IsRunning() const { return m_page != NULL; }
00093
00094
00095
00096
00097 bool ShowPage(wxWizardPage *page, bool goingForward = true);
00098
00099
00100
00101 virtual void DoCreateControls();
00102
00104 virtual bool DoLayoutAdaptation();
00105
00107 void SetBitmapBackgroundColour(const wxColour& colour) { m_bitmapBackgroundColour = colour; }
00108 const wxColour& GetBitmapBackgroundColour() const { return m_bitmapBackgroundColour; }
00109
00111 void SetBitmapPlacement(int placement) { m_bitmapPlacement = placement; }
00112 int GetBitmapPlacement() const { return m_bitmapPlacement; }
00113
00115 void SetMinimumBitmapWidth(int w) { m_bitmapMinimumWidth = w; }
00116 int GetMinimumBitmapWidth() const { return m_bitmapMinimumWidth; }
00117
00119 static bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap);
00120
00121 protected:
00122
00123 void FinishLayout() { }
00124
00126 virtual void DoWizardLayout();
00127
00129 virtual bool ResizeBitmap(wxBitmap& bmp);
00130
00131
00132 bool WasCreated() const { return m_btnPrev != NULL; }
00133
00134
00135 void OnCancel(wxCommandEvent& event);
00136 void OnBackOrNext(wxCommandEvent& event);
00137 void OnHelp(wxCommandEvent& event);
00138
00139 void OnWizEvent(wxWizardEvent& event);
00140
00141 void AddBitmapRow(wxBoxSizer *mainColumn);
00142 void AddStaticLine(wxBoxSizer *mainColumn);
00143 void AddBackNextPair(wxBoxSizer *buttonRow);
00144 void AddButtonRow(wxBoxSizer *mainColumn);
00145
00146
00147 wxSize m_sizePage;
00148
00149
00150 wxPoint m_posWizard;
00151
00152
00153 wxWizardPage *m_page;
00154 wxBitmap m_bitmap;
00155
00156
00157 wxButton *m_btnPrev,
00158 *m_btnNext;
00159 wxStaticBitmap *m_statbmp;
00160
00161
00162 int m_border;
00163
00164
00165 bool m_started;
00166
00167
00168 bool m_wasModal;
00169
00170
00171 bool m_usingSizer;
00172
00173
00174 wxBoxSizer *m_sizerBmpAndPage;
00175
00176
00177 wxScrollingWizardSizer *m_sizerPage;
00178
00179 wxColour m_bitmapBackgroundColour;
00180 int m_bitmapPlacement;
00181 int m_bitmapMinimumWidth;
00182
00183 friend class wxScrollingWizardSizer;
00184
00185 DECLARE_DYNAMIC_CLASS(wxScrollingWizard)
00186 DECLARE_EVENT_TABLE()
00187 DECLARE_NO_COPY_CLASS(wxScrollingWizard)
00188 };
00189
00190
00191
00192
00193
00194 class wxScrollingWizardSizer : public wxSizer
00195 {
00196 public:
00197 wxScrollingWizardSizer(wxScrollingWizard *owner);
00198
00199 virtual wxSizerItem *Insert(size_t index, wxSizerItem *item);
00200
00201 virtual void RecalcSizes();
00202 virtual wxSize CalcMin();
00203
00204
00205 wxSize GetMaxChildSize();
00206
00207
00208
00209 int GetBorder() const;
00210
00211
00212
00213 void HidePages();
00214
00215 private:
00216 wxSize SiblingSize(wxSizerItem *child);
00217
00218 wxScrollingWizard *m_owner;
00219 wxSize m_childSize;
00220 };
00221
00222
00223 #endif // _WX_SCROLLING_WIZARD_H_