1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPropertySheetDialog
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
10 Values used by wxPropertySheetDialog::SetSheetStyle
12 enum wxPropertySheetDialogFlags
15 Uses the default look and feel for the controller window,
16 normally a notebook except on Smartphone where a choice control is used.
18 wxPROPSHEET_DEFAULT
= 0x0001,
21 Uses a notebook for the controller window.
23 wxPROPSHEET_NOTEBOOK
= 0x0002,
26 Uses a toolbook for the controller window.
28 wxPROPSHEET_TOOLBOOK
= 0x0004,
31 Uses a choicebook for the controller window.
33 wxPROPSHEET_CHOICEBOOK
= 0x0008,
36 Uses a listbook for the controller window.
38 wxPROPSHEET_LISTBOOK
= 0x0010,
41 Uses a button toolbox for the controller window.
43 wxPROPSHEET_BUTTONTOOLBOOK
= 0x0020,
46 Uses a treebook for the controller window.
48 wxPROPSHEET_TREEBOOK
= 0x0040,
51 Shrinks the dialog window to fit the currently selected page
52 (common behaviour for property sheets on Mac OS X).
54 wxPROPSHEET_SHRINKTOFIT
= 0x0100,
59 @class wxPropertySheetDialog
61 This class represents a property sheet dialog: a tabbed dialog
62 for showing settings. It is optimized to show flat tabs
63 on PocketPC devices, and can be customized to use different
64 controllers instead of the default notebook style.
66 To use this class, call Create() from your own Create function.
67 Then call CreateButtons(), and create pages, adding them to the book control.
68 Finally call LayoutDialog().
73 bool MyPropertySheetDialog::Create(...)
75 if (!wxPropertySheetDialog::Create(...))
78 CreateButtons(wxOK|wxCANCEL|wxHELP);
81 wxPanel* panel = new wxPanel(GetBookCtrl(), ...);
82 GetBookCtrl()->AddPage(panel, "General");
89 If necessary, override CreateBookCtrl() and AddBookCtrl() to create and add a
90 different kind of book control. You will then need to use two-step construction
91 for the dialog or change the style of the book control by calling SetSheetStyle()
92 before calling Create().
94 The @ref page_samples_dialogs shows this class being used with notebook and toolbook
95 controllers (for Windows-style and Mac-style settings dialogs).
97 To make pages of the dialog scroll when the display is too small to fit the
98 whole dialog, you can switch layout adaptation on globally with
99 wxDialog::EnableLayoutAdaptation() or per dialog with
100 wxDialog::SetLayoutAdaptationMode().
102 For more about layout adaptation, see @ref overview_dialog_autoscrolling.
105 @category{managedwnd}
107 class wxPropertySheetDialog
: public wxDialog
113 wxPropertySheetDialog(wxWindow
* parent
, wxWindowID id
,
114 const wxString
& title
,
115 const wxPoint
& pos
= wxDefaultPosition
,
116 const wxSize
& size
= wxDefaultSize
,
117 long style
= wxDEFAULT_DIALOG_STYLE
,
118 const wxString
& name
= wxDialogNameStr
);
121 Override this if you wish to add the book control in a way different from the
122 standard way (for example, using different spacing).
124 virtual void AddBookCtrl(wxSizer
* sizer
);
127 Call this from your own Create function, before adding buttons and pages.
129 bool Create(wxWindow
* parent
, wxWindowID id
, const wxString
& title
,
130 const wxPoint
& pos
= wxDefaultPosition
,
131 const wxSize
& size
= wxDefaultSize
,
132 long style
= wxDEFAULT_DIALOG_STYLE
,
133 const wxString
& name
= wxDialogNameStr
);
136 Override this if you wish to create a different kind of book control; by
137 default, the value passed to SetSheetStyle() is used to determine the control.
139 The default behaviour is to create a notebook except on Smartphone, where a
142 virtual wxBookCtrlBase
* CreateBookCtrl();
145 Call this to create the buttons for the dialog.
146 This calls wxDialog::CreateButtonSizer(), and the flags are the same.
148 @note On PocketPC, no buttons are created.
150 virtual void CreateButtons(int flags
= wxOK
|wxCANCEL
);
153 Returns the book control that will contain your settings pages.
155 wxBookCtrlBase
* GetBookCtrl() const;
158 Returns the inner sizer that contains the book control and button sizer.
160 wxSizer
* GetInnerSizer() const;
163 Returns the sheet style.
165 See SetSheetStyle() for allowed values.
167 long GetSheetStyle() const;
170 Call this to lay out the dialog.
172 @note On PocketPC, this does nothing, since the dialog will be shown full-screen,
173 and the layout will be done when the dialog receives a size event.
175 virtual void LayoutDialog(int centreFlags
= wxBOTH
);
178 Sets the book control used for the dialog.
180 You will normally not need to use this.
182 void SetBookCtrl(wxBookCtrlBase
* bookCtrl
);
185 You can customize the look and feel of the dialog by setting the sheet style.
186 It is a bit list of the ::wxPropertySheetDialogFlags values.
188 void SetSheetStyle(long style
);