]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: propdlg.h | |
e54c96f1 | 3 | // Purpose: interface of wxPropertySheetDialog |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
3e8ec954 FM |
8 | |
9 | /** | |
10 | Values used by wxPropertySheetDialog::SetSheetStyle | |
11 | */ | |
12 | enum wxPropertySheetDialogFlags | |
13 | { | |
14 | /** | |
15 | Uses the default look and feel for the controller window, | |
16 | normally a notebook except on Smartphone where a choice control is used. | |
17 | */ | |
18 | wxPROPSHEET_DEFAULT = 0x0001, | |
19 | ||
20 | /** | |
21 | Uses a notebook for the controller window. | |
22 | */ | |
23 | wxPROPSHEET_NOTEBOOK = 0x0002, | |
24 | ||
25 | /** | |
26 | Uses a toolbook for the controller window. | |
27 | */ | |
28 | wxPROPSHEET_TOOLBOOK = 0x0004, | |
29 | ||
30 | /** | |
31 | Uses a choicebook for the controller window. | |
32 | */ | |
33 | wxPROPSHEET_CHOICEBOOK = 0x0008, | |
34 | ||
35 | /** | |
36 | Uses a listbook for the controller window. | |
37 | */ | |
38 | wxPROPSHEET_LISTBOOK = 0x0010, | |
39 | ||
40 | /** | |
41 | Uses a button toolbox for the controller window. | |
42 | */ | |
43 | wxPROPSHEET_BUTTONTOOLBOOK = 0x0020, | |
44 | ||
45 | /** | |
46 | Uses a treebook for the controller window. | |
47 | */ | |
48 | wxPROPSHEET_TREEBOOK = 0x0040, | |
49 | ||
50 | /** | |
51 | Shrinks the dialog window to fit the currently selected page | |
52 | (common behaviour for property sheets on Mac OS X). | |
53 | */ | |
54 | wxPROPSHEET_SHRINKTOFIT = 0x0100, | |
55 | }; | |
56 | ||
57 | ||
23324ae1 FM |
58 | /** |
59 | @class wxPropertySheetDialog | |
7c913512 | 60 | |
23324ae1 FM |
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. | |
7c913512 | 65 | |
3e8ec954 FM |
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(). | |
7c913512 | 69 | |
23324ae1 | 70 | For example: |
7c913512 | 71 | |
23324ae1 FM |
72 | @code |
73 | bool MyPropertySheetDialog::Create(...) | |
74 | { | |
75 | if (!wxPropertySheetDialog::Create(...)) | |
6bfc18d0 | 76 | return false; |
7c913512 | 77 | |
23324ae1 | 78 | CreateButtons(wxOK|wxCANCEL|wxHELP); |
7c913512 | 79 | |
23324ae1 FM |
80 | // Add page |
81 | wxPanel* panel = new wxPanel(GetBookCtrl(), ...); | |
f8ebb70d | 82 | GetBookCtrl()->AddPage(panel, "General"); |
7c913512 | 83 | |
23324ae1 | 84 | LayoutDialog(); |
6bfc18d0 | 85 | return true; |
23324ae1 FM |
86 | } |
87 | @endcode | |
7c913512 | 88 | |
3e8ec954 FM |
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(). | |
7c913512 | 93 | |
3e8ec954 FM |
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). | |
7c913512 | 96 | |
23324ae1 | 97 | To make pages of the dialog scroll when the display is too small to fit the |
3e8ec954 FM |
98 | whole dialog, you can switch layout adaptation on globally with |
99 | wxDialog::EnableLayoutAdaptation() or per dialog with | |
100 | wxDialog::SetLayoutAdaptationMode(). | |
101 | ||
102 | For more about layout adaptation, see @ref overview_dialog_autoscrolling. | |
7c913512 | 103 | |
23324ae1 FM |
104 | @library{wxadv} |
105 | @category{managedwnd} | |
106 | */ | |
107 | class wxPropertySheetDialog : public wxDialog | |
108 | { | |
109 | public: | |
110 | /** | |
111 | Constructor. | |
112 | */ | |
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, | |
11e3af6e | 118 | const wxString& name = wxDialogNameStr); |
23324ae1 FM |
119 | |
120 | /** | |
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). | |
123 | */ | |
124 | virtual void AddBookCtrl(wxSizer* sizer); | |
125 | ||
126 | /** | |
127 | Call this from your own Create function, before adding buttons and pages. | |
128 | */ | |
43c48e1e | 129 | bool Create(wxWindow* parent, wxWindowID id, const wxString& title, |
23324ae1 FM |
130 | const wxPoint& pos = wxDefaultPosition, |
131 | const wxSize& size = wxDefaultSize, | |
132 | long style = wxDEFAULT_DIALOG_STYLE, | |
43c48e1e | 133 | const wxString& name = wxDialogNameStr); |
23324ae1 FM |
134 | |
135 | /** | |
136 | Override this if you wish to create a different kind of book control; by | |
3e8ec954 FM |
137 | default, the value passed to SetSheetStyle() is used to determine the control. |
138 | ||
23324ae1 FM |
139 | The default behaviour is to create a notebook except on Smartphone, where a |
140 | choicebook is used. | |
141 | */ | |
142 | virtual wxBookCtrlBase* CreateBookCtrl(); | |
143 | ||
144 | /** | |
3e8ec954 FM |
145 | Call this to create the buttons for the dialog. |
146 | This calls wxDialog::CreateButtonSizer(), and the flags are the same. | |
147 | ||
148 | @note On PocketPC, no buttons are created. | |
23324ae1 | 149 | */ |
0004982c | 150 | virtual void CreateButtons(int flags = wxOK|wxCANCEL); |
23324ae1 FM |
151 | |
152 | /** | |
153 | Returns the book control that will contain your settings pages. | |
154 | */ | |
328f5751 | 155 | wxBookCtrlBase* GetBookCtrl() const; |
23324ae1 FM |
156 | |
157 | /** | |
158 | Returns the inner sizer that contains the book control and button sizer. | |
159 | */ | |
328f5751 | 160 | wxSizer* GetInnerSizer() const; |
23324ae1 FM |
161 | |
162 | /** | |
3e8ec954 FM |
163 | Returns the sheet style. |
164 | ||
165 | See SetSheetStyle() for allowed values. | |
23324ae1 | 166 | */ |
328f5751 | 167 | long GetSheetStyle() const; |
23324ae1 FM |
168 | |
169 | /** | |
3e8ec954 FM |
170 | Call this to lay out the dialog. |
171 | ||
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. | |
23324ae1 | 174 | */ |
adaaa686 | 175 | virtual void LayoutDialog(int centreFlags = wxBOTH); |
23324ae1 FM |
176 | |
177 | /** | |
3e8ec954 FM |
178 | Sets the book control used for the dialog. |
179 | ||
180 | You will normally not need to use this. | |
23324ae1 FM |
181 | */ |
182 | void SetBookCtrl(wxBookCtrlBase* bookCtrl); | |
183 | ||
23324ae1 FM |
184 | /** |
185 | You can customize the look and feel of the dialog by setting the sheet style. | |
3e8ec954 | 186 | It is a bit list of the ::wxPropertySheetDialogFlags values. |
23324ae1 FM |
187 | */ |
188 | void SetSheetStyle(long style); | |
189 | }; | |
e54c96f1 | 190 |