]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialog.h | |
e54c96f1 | 3 | // Purpose: interface of wxDialog |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
1db8f1dc BP |
9 | /** |
10 | Modes used for wxDialog::SetLayoutAdaptationMode(). | |
11 | */ | |
12 | enum wxDialogLayoutAdaptationMode | |
13 | { | |
14 | wxDIALOG_ADAPTATION_MODE_DEFAULT = 0, ///< Use global adaptation enabled status. | |
15 | wxDIALOG_ADAPTATION_MODE_ENABLED = 1, ///< Enable this dialog overriding global status. | |
16 | wxDIALOG_ADAPTATION_MODE_DISABLED = 2 ///< Disable this dialog overriding global status. | |
17 | }; | |
18 | ||
23324ae1 FM |
19 | /** |
20 | @class wxDialog | |
7c913512 | 21 | |
1db8f1dc BP |
22 | A dialog box is a window with a title bar and sometimes a system menu, |
23 | which can be moved around the screen. It can contain controls and other | |
24 | windows and is often used to allow the user to make some choice or to | |
25 | answer a question. | |
26 | ||
27 | Dialogs can be made scrollable, automatically, for computers with low | |
28 | resolution screens: please see @ref overview_dialog_autoscrolling for | |
29 | further details. | |
30 | ||
31 | Dialogs usually contains either a single button allowing to close the | |
32 | dialog or two buttons, one accepting the changes and the other one | |
33 | discarding them (such button, if present, is automatically activated if the | |
34 | user presses the "Esc" key). By default, buttons with the standard wxID_OK | |
35 | and wxID_CANCEL identifiers behave as expected. Starting with wxWidgets 2.7 | |
36 | it is also possible to use a button with a different identifier instead, | |
37 | see SetAffirmativeId() and SetEscapeId(). | |
38 | ||
39 | Also notice that the CreateButtonSizer() should be used to create the | |
40 | buttons appropriate for the current platform and positioned correctly | |
41 | (including their order which is platform-dependent). | |
42 | ||
43 | @section dialog_modal Modal and Modeless | |
44 | ||
45 | There are two kinds of dialog, modal and modeless. A modal dialog blocks | |
46 | program flow and user input on other windows until it is dismissed, whereas | |
47 | a modeless dialog behaves more like a frame in that program flow continues, | |
48 | and input in other windows is still possible. To show a modal dialog you | |
49 | should use the ShowModal() method while to show a dialog modelessly you | |
50 | simply use Show(), just as with frames. | |
51 | ||
52 | Note that the modal dialog is one of the very few examples of | |
53 | wxWindow-derived objects which may be created on the stack and not on the | |
54 | heap. In other words, while most windows would be created like this: | |
55 | ||
56 | @code | |
57 | void AskUser() | |
58 | { | |
59 | MyAskDialog *dlg = new MyAskDialog(...); | |
60 | if ( dlg->ShowModal() == wxID_OK ) | |
61 | // ... | |
62 | //else: dialog was cancelled or some another button pressed | |
63 | ||
64 | dlg->Destroy(); | |
65 | } | |
66 | @endcode | |
67 | ||
68 | You can achieve the same result with dialogs by using simpler code: | |
69 | ||
70 | @code | |
71 | void AskUser() | |
72 | { | |
73 | MyAskDialog dlg(...); | |
74 | if ( dlg.ShowModal() == wxID_OK ) | |
75 | // ... | |
76 | ||
77 | // no need to call Destroy() here | |
78 | } | |
79 | @endcode | |
80 | ||
81 | An application can define a wxCloseEvent handler for the dialog to respond | |
82 | to system close events. | |
7c913512 | 83 | |
23324ae1 | 84 | @beginStyleTable |
8c6791e4 | 85 | @style{wxCAPTION} |
23324ae1 | 86 | Puts a caption on the dialog box. |
8c6791e4 | 87 | @style{wxDEFAULT_DIALOG_STYLE} |
23324ae1 | 88 | Equivalent to a combination of wxCAPTION, wxCLOSE_BOX and |
1db8f1dc | 89 | wxSYSTEM_MENU (the last one is not used under Unix). |
8c6791e4 | 90 | @style{wxRESIZE_BORDER} |
23324ae1 | 91 | Display a resizeable frame around the window. |
8c6791e4 | 92 | @style{wxSYSTEM_MENU} |
23324ae1 | 93 | Display a system menu. |
8c6791e4 | 94 | @style{wxCLOSE_BOX} |
23324ae1 | 95 | Displays a close box on the frame. |
8c6791e4 | 96 | @style{wxMAXIMIZE_BOX} |
23324ae1 | 97 | Displays a maximize box on the dialog. |
8c6791e4 | 98 | @style{wxMINIMIZE_BOX} |
23324ae1 | 99 | Displays a minimize box on the dialog. |
8c6791e4 | 100 | @style{wxTHICK_FRAME} |
23324ae1 | 101 | Display a thick frame around the window. |
8c6791e4 | 102 | @style{wxSTAY_ON_TOP} |
23324ae1 | 103 | The dialog stays on top of all other windows. |
8c6791e4 | 104 | @style{wxNO_3D} |
23324ae1 FM |
105 | Under Windows, specifies that the child controls should not have 3D |
106 | borders unless specified in the control. | |
8c6791e4 | 107 | @style{wxDIALOG_NO_PARENT} |
23324ae1 | 108 | By default, a dialog created with a @NULL parent window will be |
1db8f1dc BP |
109 | given the @ref wxApp::GetTopWindow() "application's top level window" |
110 | as parent. Use this style to prevent this from happening and create | |
111 | an orphan dialog. This is not recommended for modal dialogs. | |
8c6791e4 | 112 | @style{wxDIALOG_EX_CONTEXTHELP} |
23324ae1 FM |
113 | Under Windows, puts a query button on the caption. When pressed, |
114 | Windows will go into a context-sensitive help mode and wxWidgets | |
115 | will send a wxEVT_HELP event if the user clicked on an application | |
116 | window. Note that this is an extended style and must be set by | |
1db8f1dc | 117 | calling SetExtraStyle() before Create is called (two-step |
23324ae1 | 118 | construction). |
8c6791e4 | 119 | @style{wxDIALOG_EX_METAL} |
23324ae1 FM |
120 | On Mac OS X, frames with this style will be shown with a metallic |
121 | look. This is an extra style. | |
122 | @endStyleTable | |
7c913512 | 123 | |
1db8f1dc BP |
124 | Under Unix or Linux, MWM (the Motif Window Manager) or other window |
125 | managers recognizing the MHM hints should be running for any of these | |
126 | styles to have an effect. | |
127 | ||
23324ae1 FM |
128 | @library{wxcore} |
129 | @category{cmndlg} | |
7c913512 | 130 | |
1db8f1dc | 131 | @see @ref overview_dialog, wxFrame, @ref overview_validator |
23324ae1 FM |
132 | */ |
133 | class wxDialog : public wxTopLevelWindow | |
134 | { | |
135 | public: | |
1db8f1dc BP |
136 | /** |
137 | Default constructor. | |
138 | */ | |
139 | wxDialog(); | |
23324ae1 FM |
140 | /** |
141 | Constructor. | |
3c4f71cc | 142 | |
7c913512 | 143 | @param parent |
4cc4bfaf | 144 | Can be @NULL, a frame or another dialog box. |
7c913512 | 145 | @param id |
1db8f1dc BP |
146 | An identifier for the dialog. A value of -1 is taken to mean a |
147 | default. | |
7c913512 | 148 | @param title |
4cc4bfaf | 149 | The title of the dialog. |
7c913512 | 150 | @param pos |
1db8f1dc BP |
151 | The dialog position. The value wxDefaultPosition indicates a |
152 | default position, chosen by either the windowing system or | |
153 | wxWidgets, depending on platform. | |
7c913512 | 154 | @param size |
1db8f1dc BP |
155 | The dialog size. The value wxDefaultSize indicates a default size, |
156 | chosen by either the windowing system or wxWidgets, depending on | |
157 | platform. | |
7c913512 | 158 | @param style |
1db8f1dc | 159 | The window style. |
7c913512 | 160 | @param name |
1db8f1dc BP |
161 | Used to associate a name with the window, allowing the application |
162 | user to set Motif resource values for individual dialog boxes. | |
3c4f71cc | 163 | |
4cc4bfaf | 164 | @see Create() |
23324ae1 | 165 | */ |
1db8f1dc | 166 | wxDialog(wxWindow* parent, wxWindowID id, const wxString& title, |
7c913512 FM |
167 | const wxPoint& pos = wxDefaultPosition, |
168 | const wxSize& size = wxDefaultSize, | |
169 | long style = wxDEFAULT_DIALOG_STYLE, | |
170 | const wxString& name = "dialogBox"); | |
23324ae1 FM |
171 | |
172 | /** | |
1db8f1dc BP |
173 | Destructor. Deletes any child windows before deleting the physical |
174 | window. | |
23324ae1 | 175 | */ |
adaaa686 | 176 | virtual ~wxDialog(); |
23324ae1 FM |
177 | |
178 | /** | |
1db8f1dc BP |
179 | Adds an identifier to be regarded as a main button for the |
180 | non-scrolling area of a dialog. | |
181 | ||
182 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 FM |
183 | */ |
184 | void AddMainButtonId(wxWindowID id); | |
185 | ||
186 | /** | |
1db8f1dc BP |
187 | Returns @true if this dialog can and should perform layout adaptation |
188 | using DoLayoutAdaptation(), usually if the dialog is too large to fit | |
189 | on the display. | |
190 | ||
191 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 FM |
192 | */ |
193 | bool CanDoLayoutAdapation(); | |
194 | ||
195 | /** | |
196 | Centres the dialog box on the display. | |
3c4f71cc | 197 | |
7c913512 | 198 | @param direction |
4cc4bfaf | 199 | May be wxHORIZONTAL, wxVERTICAL or wxBOTH. |
23324ae1 FM |
200 | */ |
201 | void Centre(int direction = wxBOTH); | |
202 | ||
203 | /** | |
1db8f1dc BP |
204 | Used for two-step dialog box construction. |
205 | ||
206 | @see wxDialog() | |
23324ae1 | 207 | */ |
1db8f1dc | 208 | bool Create(wxWindow* parent, wxWindowID id, const wxString& title, |
23324ae1 | 209 | const wxPoint& pos = wxDefaultPosition, |
b91c4601 FM |
210 | const wxSize& size = wxDefaultSize, long style = 536877056, |
211 | const wxString& name = wxDialogNameStr); | |
23324ae1 FM |
212 | |
213 | /** | |
1db8f1dc BP |
214 | Creates a sizer with standard buttons. @a flags is a bit list of the |
215 | following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE, wxHELP, | |
216 | wxNO_DEFAULT. | |
217 | ||
23324ae1 | 218 | The sizer lays out the buttons in a manner appropriate to the platform. |
1db8f1dc BP |
219 | |
220 | This function uses CreateStdDialogButtonSizer() internally for most | |
221 | platforms but doesn't create the sizer at all for the platforms with | |
222 | hardware buttons (such as smartphones) for which it sets up the | |
223 | hardware buttons appropriately and returns @NULL, so don't forget to | |
224 | test that the return value is valid before using it. | |
23324ae1 FM |
225 | */ |
226 | wxSizer* CreateButtonSizer(long flags); | |
227 | ||
228 | /** | |
1db8f1dc BP |
229 | Creates a sizer with standard buttons using CreateButtonSizer() |
230 | separated from the rest of the dialog contents by a horizontal | |
231 | wxStaticLine. | |
232 | ||
233 | @note Just like CreateButtonSizer(), this function may return @NULL if | |
234 | no buttons were created. | |
23324ae1 FM |
235 | */ |
236 | wxSizer* CreateSeparatedButtonSizer(long flags); | |
237 | ||
238 | /** | |
1db8f1dc BP |
239 | Creates a wxStdDialogButtonSizer with standard buttons. @a flags is a |
240 | bit list of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, | |
241 | wxCLOSE, wxHELP, wxNO_DEFAULT. | |
242 | ||
23324ae1 FM |
243 | The sizer lays out the buttons in a manner appropriate to the platform. |
244 | */ | |
245 | wxStdDialogButtonSizer* CreateStdDialogButtonSizer(long flags); | |
246 | ||
247 | /** | |
1db8f1dc BP |
248 | Performs layout adaptation, usually if the dialog is too large to fit |
249 | on the display. | |
250 | ||
251 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 FM |
252 | */ |
253 | bool DoLayoutAdapation(); | |
254 | ||
255 | /** | |
1db8f1dc BP |
256 | This function is called when the titlebar OK button is pressed |
257 | (PocketPC only). A command event for the identifier returned by | |
258 | GetAffirmativeId() is sent by default. You can override this function. | |
259 | If the function returns @false, wxWidgets will call Close() for the | |
260 | dialog. | |
23324ae1 | 261 | */ |
4cc4bfaf | 262 | virtual bool DoOK(); |
23324ae1 FM |
263 | |
264 | /** | |
1db8f1dc BP |
265 | A static function enabling or disabling layout adaptation for all |
266 | dialogs. | |
267 | ||
268 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 FM |
269 | */ |
270 | static void EnableLayoutAdaptation(bool enable); | |
271 | ||
272 | /** | |
1db8f1dc BP |
273 | Ends a modal dialog, passing a value to be returned from the |
274 | ShowModal() invocation. | |
3c4f71cc | 275 | |
7c913512 | 276 | @param retCode |
4cc4bfaf | 277 | The value that should be returned by ShowModal. |
3c4f71cc | 278 | |
4cc4bfaf | 279 | @see ShowModal(), GetReturnCode(), SetReturnCode() |
23324ae1 | 280 | */ |
adaaa686 | 281 | virtual void EndModal(int retCode); |
23324ae1 FM |
282 | |
283 | /** | |
1db8f1dc BP |
284 | Gets the identifier of the button which works like standard OK button |
285 | in this dialog. | |
3c4f71cc | 286 | |
4cc4bfaf | 287 | @see SetAffirmativeId() |
23324ae1 | 288 | */ |
328f5751 | 289 | int GetAffirmativeId() const; |
23324ae1 FM |
290 | |
291 | /** | |
1db8f1dc BP |
292 | Override this to return a window containing the main content of the |
293 | dialog. This is particularly useful when the dialog implements pages, | |
294 | such as wxPropertySheetDialog, and allows the | |
295 | @ref overview_dialog "layout adaptation code" to know that only the | |
296 | pages need to be made scrollable. | |
23324ae1 | 297 | */ |
adaaa686 | 298 | virtual wxWindow* GetContentWindow() const; |
23324ae1 FM |
299 | |
300 | /** | |
1db8f1dc | 301 | Gets the identifier of the button to map presses of @c ESC button to. |
3c4f71cc | 302 | |
4cc4bfaf | 303 | @see SetEscapeId() |
23324ae1 | 304 | */ |
328f5751 | 305 | int GetEscapeId() const; |
23324ae1 FM |
306 | |
307 | /** | |
1db8f1dc BP |
308 | Returns @true if the dialog has been adapted, usually by making it |
309 | scrollable to work with a small display. | |
310 | ||
311 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 | 312 | */ |
328f5751 | 313 | bool GetLayoutAdaptationDone() const; |
23324ae1 FM |
314 | |
315 | /** | |
1db8f1dc BP |
316 | Gets a value representing the aggressiveness of search for buttons and |
317 | sizers to be in the non-scrolling part of a layout-adapted dialog. Zero | |
318 | switches off adaptation, and 3 allows search for standard buttons | |
319 | anywhere in the dialog. | |
320 | ||
321 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 | 322 | */ |
adaaa686 | 323 | int GetLayoutAdaptationLevel() const; |
23324ae1 FM |
324 | |
325 | /** | |
326 | Gets the adaptation mode, overriding the global adaptation flag. | |
1db8f1dc BP |
327 | |
328 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 | 329 | */ |
328f5751 | 330 | wxDialogLayoutAdaptationMode GetLayoutAdaptationMode() const; |
23324ae1 FM |
331 | |
332 | /** | |
333 | A static function getting the current layout adapter object. | |
1db8f1dc BP |
334 | |
335 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 FM |
336 | */ |
337 | static wxDialogLayoutAdapter* GetLayoutAdapter(); | |
338 | ||
339 | /** | |
1db8f1dc BP |
340 | Returns an array of identifiers to be regarded as the main buttons for |
341 | the non-scrolling area of a dialog. | |
342 | ||
343 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 | 344 | */ |
b91c4601 | 345 | wxArrayInt& GetMainButtonIds(); |
23324ae1 FM |
346 | |
347 | /** | |
348 | Gets the return code for this window. | |
3c4f71cc | 349 | |
1db8f1dc BP |
350 | @remarks A return code is normally associated with a modal dialog, |
351 | where ShowModal() returns a code to the application. | |
3c4f71cc | 352 | |
4cc4bfaf | 353 | @see SetReturnCode(), ShowModal(), EndModal() |
23324ae1 | 354 | */ |
adaaa686 | 355 | int GetReturnCode() const; |
23324ae1 FM |
356 | |
357 | /** | |
358 | On PocketPC, a dialog is automatically provided with an empty toolbar. | |
1db8f1dc BP |
359 | This function allows you to access the toolbar and add tools to it. |
360 | Removing tools and adding arbitrary controls are not currently | |
361 | supported. | |
362 | ||
23324ae1 FM |
363 | This function is not available on any other platform. |
364 | */ | |
328f5751 | 365 | wxToolBar* GetToolBar() const; |
23324ae1 FM |
366 | |
367 | /** | |
368 | Iconizes or restores the dialog. Windows only. | |
3c4f71cc | 369 | |
7c913512 | 370 | @param iconize |
4cc4bfaf | 371 | If @true, iconizes the dialog box; if @false, shows and restores it. |
3c4f71cc | 372 | |
23324ae1 | 373 | @remarks Note that in Windows, iconization has no effect since dialog |
1db8f1dc BP |
374 | boxes cannot be iconized. However, applications may need to |
375 | explicitly restore dialog boxes under Motif which have | |
376 | user-iconizable frames, and under Windows calling | |
377 | Iconize(@false) will bring the window to the front, as does | |
378 | Show(@true). | |
23324ae1 FM |
379 | */ |
380 | void Iconize(bool iconize); | |
381 | ||
382 | /** | |
383 | Returns @true if the dialog box is iconized. Windows only. | |
3c4f71cc | 384 | |
23324ae1 | 385 | @remarks Always returns @false under Windows since dialogs cannot be |
4cc4bfaf | 386 | iconized. |
23324ae1 | 387 | */ |
328f5751 | 388 | bool IsIconized() const; |
23324ae1 FM |
389 | |
390 | /** | |
1db8f1dc BP |
391 | A static function returning @true if layout adaptation is enabled for |
392 | all dialogs. | |
393 | ||
394 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 FM |
395 | */ |
396 | static bool IsLayoutAdaptationEnabled(); | |
397 | ||
398 | /** | |
1db8f1dc BP |
399 | Returns @true if @a id is in the array of identifiers to be regarded as |
400 | the main buttons for the non-scrolling area of a dialog. | |
401 | ||
402 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 | 403 | */ |
328f5751 | 404 | bool IsMainButton(wxWindowID& id) const; |
23324ae1 FM |
405 | |
406 | /** | |
407 | Returns @true if the dialog box is modal, @false otherwise. | |
408 | */ | |
adaaa686 | 409 | virtual bool IsModal() const; |
23324ae1 FM |
410 | |
411 | /** | |
412 | The default handler for wxEVT_SYS_COLOUR_CHANGED. | |
3c4f71cc | 413 | |
7c913512 | 414 | @param event |
4cc4bfaf | 415 | The colour change event. |
3c4f71cc | 416 | |
23324ae1 | 417 | @remarks Changes the dialog's colour to conform to the current settings |
1db8f1dc BP |
418 | (Windows only). Add an event table entry for your dialog class |
419 | if you wish the behaviour to be different (such as keeping a | |
420 | user-defined background colour). If you do override this | |
421 | function, call wxEvent::Skip() to propagate the notification | |
422 | to child windows and controls. | |
3c4f71cc | 423 | |
4cc4bfaf | 424 | @see wxSysColourChangedEvent |
23324ae1 FM |
425 | */ |
426 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
427 | ||
428 | /** | |
429 | Sets the identifier to be used as OK button. When the button with this | |
1db8f1dc BP |
430 | identifier is pressed, the dialog calls wxWindow::Validate() and |
431 | wxWindow::TransferDataFromWindow() and, if they both return @true, | |
432 | closes the dialog with wxID_OK return code. | |
433 | ||
434 | Also, when the user presses a hardware OK button on the devices having | |
435 | one or the special OK button in the PocketPC title bar, an event with | |
436 | this id is generated. | |
437 | ||
23324ae1 | 438 | By default, the affirmative id is wxID_OK. |
3c4f71cc | 439 | |
4cc4bfaf | 440 | @see GetAffirmativeId(), SetEscapeId() |
23324ae1 FM |
441 | */ |
442 | void SetAffirmativeId(int id); | |
443 | ||
444 | /** | |
7c913512 | 445 | Sets the identifier of the button which should work like the standard |
1db8f1dc BP |
446 | "Cancel" button in this dialog. When the button with this id is |
447 | clicked, the dialog is closed. Also, when the user presses @c ESC key | |
448 | in the dialog or closes the dialog using the close button in the title | |
449 | bar, this is mapped to the click of the button with the specified id. | |
450 | ||
451 | By default, the escape id is the special value wxID_ANY meaning that | |
452 | wxID_CANCEL button is used if it's present in the dialog and otherwise | |
453 | the button with GetAffirmativeId() is used. Another special value for | |
454 | @a id is wxID_NONE meaning that @c ESC presses should be ignored. If | |
455 | any other value is given, it is interpreted as the id of the button to | |
456 | map the escape key to. | |
23324ae1 FM |
457 | */ |
458 | void SetEscapeId(int id); | |
459 | ||
460 | /** | |
461 | Sets the icon for this dialog. | |
3c4f71cc | 462 | |
7c913512 | 463 | @param icon |
4cc4bfaf | 464 | The icon to associate with this dialog. |
1db8f1dc BP |
465 | |
466 | @see wxIcon | |
23324ae1 FM |
467 | */ |
468 | void SetIcon(const wxIcon& icon); | |
469 | ||
470 | /** | |
471 | Sets the icons for this dialog. | |
3c4f71cc | 472 | |
7c913512 | 473 | @param icons |
4cc4bfaf | 474 | The icons to associate with this dialog. |
1db8f1dc BP |
475 | |
476 | @see wxIconBundle | |
23324ae1 FM |
477 | */ |
478 | void SetIcons(const wxIconBundle& icons); | |
479 | ||
480 | /** | |
1db8f1dc BP |
481 | Marks the dialog as having been adapted, usually by making it |
482 | scrollable to work with a small display. | |
483 | ||
484 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 FM |
485 | */ |
486 | void SetLayoutAdaptationDone(bool done); | |
487 | ||
488 | /** | |
489 | Sets the aggressiveness of search for buttons and sizers to be in the | |
1db8f1dc BP |
490 | non-scrolling part of a layout-adapted dialog. Zero switches off |
491 | adaptation, and 3 allows search for standard buttons anywhere in the | |
492 | dialog. | |
493 | ||
494 | @see @ref overview_dialog_autoscrolling (for more on layout adaptation) | |
23324ae1 FM |
495 | */ |
496 | void SetLayoutAdaptationLevel(int level); | |
497 | ||
498 | /** | |
1db8f1dc | 499 | Sets the adaptation mode, overriding the global adaptation flag. |
3c4f71cc | 500 | |
1db8f1dc BP |
501 | @see wxDialogLayoutAdaptationMode, @ref overview_dialog_autoscrolling |
502 | (for more on layout adaptation) | |
23324ae1 FM |
503 | */ |
504 | void SetLayoutAdaptationMode(wxDialogLayoutAdaptationMode mode); | |
505 | ||
506 | /** | |
1db8f1dc BP |
507 | A static function for setting the current layout adapter object, |
508 | returning the old adapter. If you call this, you should delete the old | |
509 | adapter object. | |
510 | ||
511 | @see wxDialogLayoutAdapter, @ref overview_dialog_autoscrolling | |
23324ae1 FM |
512 | */ |
513 | static wxDialogLayoutAdapter* SetLayoutAdapter(wxDialogLayoutAdapter* adapter); | |
514 | ||
515 | /** | |
1db8f1dc BP |
516 | @deprecated This function doesn't work for all ports, just use |
517 | ShowModal() to show a modal dialog instead. | |
518 | ||
519 | Allows the programmer to specify whether the dialog box is modal | |
520 | (Show() blocks control until the dialog is hidden) or modeless (control | |
521 | returns immediately). | |
3c4f71cc | 522 | |
7c913512 | 523 | @param flag |
4cc4bfaf | 524 | If @true, the dialog will be modal, otherwise it will be modeless. |
23324ae1 FM |
525 | */ |
526 | void SetModal(bool flag); | |
527 | ||
528 | /** | |
529 | Sets the return code for this window. | |
3c4f71cc | 530 | |
1db8f1dc BP |
531 | A return code is normally associated with a modal dialog, where |
532 | ShowModal() returns a code to the application. The function EndModal() | |
533 | calls SetReturnCode(). | |
534 | ||
7c913512 | 535 | @param retCode |
4cc4bfaf | 536 | The integer return code, usually a control identifier. |
3c4f71cc | 537 | |
4cc4bfaf | 538 | @see GetReturnCode(), ShowModal(), EndModal() |
23324ae1 FM |
539 | */ |
540 | void SetReturnCode(int retCode); | |
541 | ||
542 | /** | |
1db8f1dc BP |
543 | Hides or shows the dialog. The preferred way of dismissing a modal |
544 | dialog is to use EndModal(). | |
3c4f71cc | 545 | |
7c913512 | 546 | @param show |
1db8f1dc BP |
547 | If @true, the dialog box is shown and brought to the front, |
548 | otherwise the box is hidden. If @false and the dialog is modal, | |
549 | control is returned to the calling program. | |
23324ae1 | 550 | */ |
b91c4601 | 551 | virtual bool Show(bool show = 1); |
23324ae1 FM |
552 | |
553 | /** | |
dc28b856 VZ |
554 | Shows a modal dialog. |
555 | ||
556 | Program flow does not return until the dialog has been dismissed with | |
557 | EndModal(). | |
558 | ||
559 | Notice that it is possible to call ShowModal() for a dialog which had | |
560 | been previously shown with Show(), this allows to make an existing | |
561 | modeless dialog modal. However ShowModal() can't be called twice | |
562 | without intervening EndModal() calls. | |
1db8f1dc | 563 | |
d29a9a8a | 564 | @return The value set with SetReturnCode(). |
3c4f71cc | 565 | |
1db8f1dc | 566 | @see EndModal(), GetReturnCode(), SetReturnCode() |
23324ae1 | 567 | */ |
adaaa686 | 568 | virtual int ShowModal(); |
23324ae1 FM |
569 | }; |
570 | ||
571 | ||
e54c96f1 | 572 | |
23324ae1 FM |
573 | /** |
574 | @class wxDialogLayoutAdapter | |
7c913512 | 575 | |
1db8f1dc BP |
576 | This abstract class is the base for classes that help wxWidgets peform |
577 | run-time layout adaptation of dialogs. Principally, this is to cater for | |
578 | small displays by making part of the dialog scroll, but the application | |
579 | developer may find other uses for layout adaption. | |
7c913512 | 580 | |
1db8f1dc BP |
581 | By default, there is one instance of wxStandardDialogLayoutAdapter which |
582 | can perform adaptation for most custom dialogs and dialogs with book | |
583 | controls such as wxPropertySheetDialog. | |
7c913512 | 584 | |
23324ae1 | 585 | @library{wxcore} |
1db8f1dc | 586 | @category{winlayout} |
7c913512 | 587 | |
1db8f1dc | 588 | @see @ref overview_dialog_autoscrolling |
23324ae1 | 589 | */ |
7c913512 | 590 | class wxDialogLayoutAdapter |
23324ae1 FM |
591 | { |
592 | public: | |
593 | /** | |
594 | Default constructor. | |
595 | */ | |
596 | wxDialogLayoutAdapter(); | |
597 | ||
598 | /** | |
599 | Override this to returns @true if adaptation can and should be done. | |
600 | */ | |
b91c4601 | 601 | virtual bool CanDoLayoutAdaptation(wxDialog* dialog) = 0; |
23324ae1 FM |
602 | |
603 | /** | |
1db8f1dc BP |
604 | Override this to perform layout adaptation, such as making parts of the |
605 | dialog scroll and resizing the dialog to fit the display. Normally this | |
606 | function will be called just before the dialog is shown. | |
23324ae1 | 607 | */ |
b91c4601 | 608 | virtual bool DoLayoutAdaptation(wxDialog* dialog) = 0; |
23324ae1 | 609 | }; |
e54c96f1 | 610 |