1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPropertySheetDialog
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 Values used by wxPropertySheetDialog::SetSheetStyle
13 enum wxPropertySheetDialogFlags
16 Uses the default look and feel for the controller window,
17 normally a notebook except on Smartphone where a choice control is used.
19 wxPROPSHEET_DEFAULT
= 0x0001,
22 Uses a notebook for the controller window.
24 wxPROPSHEET_NOTEBOOK
= 0x0002,
27 Uses a toolbook for the controller window.
29 wxPROPSHEET_TOOLBOOK
= 0x0004,
32 Uses a choicebook for the controller window.
34 wxPROPSHEET_CHOICEBOOK
= 0x0008,
37 Uses a listbook for the controller window.
39 wxPROPSHEET_LISTBOOK
= 0x0010,
42 Uses a button toolbox for the controller window.
44 wxPROPSHEET_BUTTONTOOLBOOK
= 0x0020,
47 Uses a treebook for the controller window.
49 wxPROPSHEET_TREEBOOK
= 0x0040,
52 Shrinks the dialog window to fit the currently selected page
53 (common behaviour for property sheets on Mac OS X).
55 wxPROPSHEET_SHRINKTOFIT
= 0x0100,
60 @class wxPropertySheetDialog
62 This class represents a property sheet dialog: a tabbed dialog
63 for showing settings. It is optimized to show flat tabs
64 on PocketPC devices, and can be customized to use different
65 controllers instead of the default notebook style.
67 To use this class, call Create() from your own Create function.
68 Then call CreateButtons(), and create pages, adding them to the book control.
69 Finally call LayoutDialog().
74 bool MyPropertySheetDialog::Create(...)
76 if (!wxPropertySheetDialog::Create(...))
79 CreateButtons(wxOK|wxCANCEL|wxHELP);
82 wxPanel* panel = new wxPanel(GetBookCtrl(), ...);
83 GetBookCtrl()->AddPage(panel, wxT("General"));
90 If necessary, override CreateBookCtrl() and AddBookCtrl() to create and add a
91 different kind of book control. You will then need to use two-step construction
92 for the dialog or change the style of the book control by calling SetSheetStyle()
93 before calling Create().
95 The @ref page_samples_dialogs shows this class being used with notebook and toolbook
96 controllers (for Windows-style and Mac-style settings dialogs).
98 To make pages of the dialog scroll when the display is too small to fit the
99 whole dialog, you can switch layout adaptation on globally with
100 wxDialog::EnableLayoutAdaptation() or per dialog with
101 wxDialog::SetLayoutAdaptationMode().
103 For more about layout adaptation, see @ref overview_dialog_autoscrolling.
106 @category{managedwnd}
108 class wxPropertySheetDialog
: public wxDialog
114 wxPropertySheetDialog(wxWindow
* parent
, wxWindowID id
,
115 const wxString
& title
,
116 const wxPoint
& pos
= wxDefaultPosition
,
117 const wxSize
& size
= wxDefaultSize
,
118 long style
= wxDEFAULT_DIALOG_STYLE
,
119 const wxString
& name
= "dialogBox");
122 Override this if you wish to add the book control in a way different from the
123 standard way (for example, using different spacing).
125 virtual void AddBookCtrl(wxSizer
* sizer
);
128 Call this from your own Create function, before adding buttons and pages.
130 bool Create(wxWindow
* parent
, wxWindowID id
,
131 const wxString
& title
,
132 const wxPoint
& pos
= wxDefaultPosition
,
133 const wxSize
& size
= wxDefaultSize
,
134 long style
= wxDEFAULT_DIALOG_STYLE
,
135 const wxString
& name
= "dialogBox");
138 Override this if you wish to create a different kind of book control; by
139 default, the value passed to SetSheetStyle() is used to determine the control.
141 The default behaviour is to create a notebook except on Smartphone, where a
144 virtual wxBookCtrlBase
* CreateBookCtrl();
147 Call this to create the buttons for the dialog.
148 This calls wxDialog::CreateButtonSizer(), and the flags are the same.
150 @note On PocketPC, no buttons are created.
152 virtual void CreateButtons(int flags
= wxOK
|wxCANCEL
);
155 Returns the book control that will contain your settings pages.
157 wxBookCtrlBase
* GetBookCtrl() const;
160 Returns the inner sizer that contains the book control and button sizer.
162 wxSizer
* GetInnerSizer() const;
165 Returns the sheet style.
167 See SetSheetStyle() for allowed values.
169 long GetSheetStyle() const;
172 Call this to lay out the dialog.
174 @note On PocketPC, this does nothing, since the dialog will be shown full-screen,
175 and the layout will be done when the dialog receives a size event.
177 virtual void LayoutDialog(int centreFlags
= wxBOTH
);
180 Sets the book control used for the dialog.
182 You will normally not need to use this.
184 void SetBookCtrl(wxBookCtrlBase
* bookCtrl
);
187 Sets the inner sizer that contains the book control and button sizer.
189 You will normally not need to use this.
191 void SetInnerSizer(wxSizer
* sizer
);
194 You can customize the look and feel of the dialog by setting the sheet style.
195 It is a bit list of the ::wxPropertySheetDialogFlags values.
197 void SetSheetStyle(long style
);