]>
Commit | Line | Data |
---|---|---|
60fef964 WS |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: dialog.tex | |
3 | %% Purpose: wxDialog documentation | |
4 | %% Author: wxWidgets Team | |
5 | %% Modified by: | |
6 | %% Created: | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) wxWidgets Team | |
9 | %% License: wxWindows license | |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | ||
a660d684 KB |
12 | \section{\class{wxDialog}}\label{wxdialog} |
13 | ||
1e4709b3 VZ |
14 | A dialog box is a window with a title bar and sometimes a system menu, which |
15 | can be moved around the screen. It can contain controls and other windows and | |
f9db2cda VZ |
16 | is often used to allow the user to make some choice or to answer a question. |
17 | ||
3aa8e4ea | 18 | Dialogs can be made scrollable, automatically: please see \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for further details. |
a660d684 | 19 | |
eda9a7d8 | 20 | \wxheading{Dialog Buttons} |
2f483a69 VZ |
21 | |
22 | The dialog usually contains either a single button allowing to close the | |
23 | dialog or two buttons, one accepting the changes and the other one discarding | |
24 | them (such button, if present, is automatically activated if the user presses | |
25 | the \texttt{"Esc"} key). By default, buttons with the standard \texttt{wxID\_OK} | |
26 | and \texttt{wxID\_CANCEL} identifiers behave as expected. Starting with | |
27 | wxWidgets 2.7 it is also possible to use a button with a different identifier | |
28 | instead, see \helpref{SetAffirmativeId}{wxdialogsetaffirmativeid} and | |
29 | \helpref{SetEscapeId}{wxdialogsetescapeid}. | |
30 | ||
31 | Also notice that the \helpref{CreateButtonSizer()}{wxdialogcreatebuttonsizer} | |
32 | should be used to create the buttons appropriate for the current platform and | |
33 | positioned correctly (including their order which is platform-dependent). | |
34 | ||
a660d684 KB |
35 | \wxheading{Derived from} |
36 | ||
834ed994 | 37 | \helpref{wxTopLevelWindow}{wxtoplevelwindow}\\ |
a660d684 KB |
38 | \helpref{wxWindow}{wxwindow}\\ |
39 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
40 | \helpref{wxObject}{wxobject} | |
41 | ||
954b8ae6 JS |
42 | \wxheading{Include files} |
43 | ||
44 | <wx/dialog.h> | |
45 | ||
a7af285d VZ |
46 | \wxheading{Library} |
47 | ||
48 | \helpref{wxCore}{librarieslist} | |
49 | ||
eda9a7d8 | 50 | \wxheading{Modal and modeless dialogs} |
a660d684 | 51 | |
1e4709b3 VZ |
52 | There are two kinds of dialog -- {\it modal}\ and {\it modeless}. A modal dialog |
53 | blocks program flow and user input on other windows until it is dismissed, | |
54 | whereas a modeless dialog behaves more like a frame in that program flow | |
0032ddbb JS |
55 | continues, and input in other windows is still possible. To show a modal dialog |
56 | you should use the \helpref{ShowModal}{wxdialogshowmodal} method while to show | |
57 | a dialog modelessly you simply use \helpref{Show}{wxdialogshow}, just as with | |
1e4709b3 | 58 | frames. |
a660d684 | 59 | |
0032ddbb | 60 | Note that the modal dialog is one of the very few examples of |
1e4709b3 | 61 | wxWindow-derived objects which may be created on the stack and not on the heap. |
d2c2afc9 JS |
62 | In other words, although this code snippet: |
63 | ||
1e4709b3 VZ |
64 | \begin{verbatim} |
65 | void AskUser() | |
66 | { | |
67 | MyAskDialog *dlg = new MyAskDialog(...); | |
68 | if ( dlg->ShowModal() == wxID_OK ) | |
69 | ... | |
70 | //else: dialog was cancelled or some another button pressed | |
a660d684 | 71 | |
1e4709b3 VZ |
72 | dlg->Destroy(); |
73 | } | |
74 | \end{verbatim} | |
d2c2afc9 | 75 | |
1e4709b3 VZ |
76 | works, you can also achieve the same result by using a simpler code fragment |
77 | below: | |
d2c2afc9 | 78 | |
1e4709b3 VZ |
79 | \begin{verbatim} |
80 | void AskUser() | |
81 | { | |
82 | MyAskDialog dlg(...); | |
83 | if ( dlg.ShowModal() == wxID_OK ) | |
84 | ... | |
85 | ||
86 | // no need to call Destroy() here | |
87 | } | |
88 | \end{verbatim} | |
89 | ||
3980000c | 90 | An application can define a \helpref{wxCloseEvent}{wxcloseevent} handler for |
1e4709b3 | 91 | the dialog to respond to system close events. |
a660d684 KB |
92 | |
93 | \wxheading{Window styles} | |
94 | ||
95 | \twocolwidtha{5cm} | |
96 | \begin{twocollist}\itemsep=0pt | |
f6bcfd97 | 97 | \twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the dialog box.} |
850c6ed4 | 98 | \twocolitem{\windowstyle{wxDEFAULT\_DIALOG\_STYLE}}{Equivalent to a combination of wxCAPTION, wxCLOSE\_BOX and wxSYSTEM\_MENU (the last one is not used under Unix)} |
f6bcfd97 | 99 | \twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Display a resizeable frame around the window.} |
bbcdf8bc | 100 | \twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Display a system menu.} |
850c6ed4 | 101 | \twocolitem{\windowstyle{wxCLOSE\_BOX}}{Displays a close box on the frame.} |
0032ddbb JS |
102 | \twocolitem{\windowstyle{wxMAXIMIZE\_BOX}}{Displays a maximize box on the dialog.} |
103 | \twocolitem{\windowstyle{wxMINIMIZE\_BOX}}{Displays a minimize box on the dialog.} | |
bbcdf8bc | 104 | \twocolitem{\windowstyle{wxTHICK\_FRAME}}{Display a thick frame around the window.} |
3faa8195 | 105 | \twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{The dialog stays on top of all other windows.} |
a660d684 KB |
106 | \twocolitem{\windowstyle{wxNO\_3D}}{Under Windows, specifies that the child controls |
107 | should not have 3D borders unless specified in the control.} | |
0032ddbb | 108 | \twocolitem{\windowstyle{wxDIALOG\_NO\_PARENT}}{By default, a dialog created |
60fef964 | 109 | with a {\tt NULL} parent window will be given the |
0032ddbb JS |
110 | \helpref{application's top level window}{wxappgettopwindow} as parent. Use this |
111 | style to prevent this from happening and create an orphan dialog. This is not recommended for modal dialogs.} | |
26a80c22 | 112 | \twocolitem{\windowstyle{wxDIALOG\_EX\_CONTEXTHELP}}{Under Windows, puts a query button on the |
fc2171bd | 113 | caption. When pressed, Windows will go into a context-sensitive help mode and wxWidgets will send |
1e4709b3 | 114 | a wxEVT\_HELP event if the user clicked on an application window. {\it Note}\ that this is an extended |
26a80c22 | 115 | style and must be set by calling \helpref{SetExtraStyle}{wxwindowsetextrastyle} before Create is called (two-step construction).} |
03d77609 | 116 | \twocolitem{\windowstyle{wxDIALOG\_EX\_METAL}}{On Mac OS X, frames with this style will be shown with a metallic look. This is an {\it extra} style.} |
a660d684 KB |
117 | \end{twocollist} |
118 | ||
b3daa5a3 | 119 | Under Unix or Linux, MWM (the Motif Window Manager) or other window managers |
2edb0bde | 120 | recognizing the MHM hints should be running for any of these styles to have an |
b3daa5a3 | 121 | effect. |
a660d684 KB |
122 | |
123 | See also \helpref{Generic window styles}{windowstyles}. | |
124 | ||
125 | \wxheading{See also} | |
126 | ||
965b4f87 | 127 | \helpref{wxDialog overview}{wxdialogoverview}, \helpref{wxFrame}{wxframe},\rtfsp |
a660d684 KB |
128 | \helpref{Validator overview}{validatoroverview} |
129 | ||
130 | \latexignore{\rtfignore{\wxheading{Members}}} | |
131 | ||
c6ece595 | 132 | |
b236c10f | 133 | \membersection{wxDialog::wxDialog}\label{wxdialogctor} |
a660d684 KB |
134 | |
135 | \func{}{wxDialog}{\void} | |
136 | ||
137 | Default constructor. | |
138 | ||
eaaa6a06 | 139 | \func{}{wxDialog}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp |
a660d684 KB |
140 | \param{const wxString\& }{title},\rtfsp |
141 | \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp | |
142 | \param{const wxSize\& }{size = wxDefaultSize},\rtfsp | |
eaaa6a06 | 143 | \param{long}{ style = wxDEFAULT\_DIALOG\_STYLE},\rtfsp |
a660d684 KB |
144 | \param{const wxString\& }{name = ``dialogBox"}} |
145 | ||
146 | Constructor. | |
147 | ||
148 | \wxheading{Parameters} | |
149 | ||
150 | \docparam{parent}{Can be NULL, a frame or another dialog box.} | |
151 | ||
152 | \docparam{id}{An identifier for the dialog. A value of -1 is taken to mean a default.} | |
153 | ||
154 | \docparam{title}{The title of the dialog.} | |
155 | ||
156 | \docparam{pos}{The dialog position. A value of (-1, -1) indicates a default position, chosen by | |
fc2171bd | 157 | either the windowing system or wxWidgets, depending on platform.} |
a660d684 KB |
158 | |
159 | \docparam{size}{The dialog size. A value of (-1, -1) indicates a default size, chosen by | |
fc2171bd | 160 | either the windowing system or wxWidgets, depending on platform.} |
a660d684 KB |
161 | |
162 | \docparam{style}{The window style. See \helpref{wxDialog}{wxdialog}.} | |
163 | ||
164 | \docparam{name}{Used to associate a name with the window, | |
165 | allowing the application user to set Motif resource values for | |
166 | individual dialog boxes.} | |
167 | ||
168 | \wxheading{See also} | |
169 | ||
170 | \helpref{wxDialog::Create}{wxdialogcreate} | |
171 | ||
c6ece595 | 172 | |
b236c10f | 173 | \membersection{wxDialog::\destruct{wxDialog}}\label{wxdialogdtor} |
a660d684 KB |
174 | |
175 | \func{}{\destruct{wxDialog}}{\void} | |
176 | ||
177 | Destructor. Deletes any child windows before deleting the physical window. | |
178 | ||
3aa8e4ea JS |
179 | \membersection{wxDialog::AddMainButtonId}\label{wxdialogaddmainbuttonid} |
180 | ||
181 | \func{void}{AddMainButtonId}{\param{wxWindowID}{ id}} | |
182 | ||
183 | Adds an identifier to be regarded as a main button for the non-scrolling area of a dialog. | |
184 | ||
185 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
186 | ||
187 | \membersection{wxDialog::CanDoLayoutAdaptation}\label{wxdialogcandolayoutadaptation} | |
188 | ||
189 | \func{bool}{CanDoLayoutAdapation}{\void} | |
190 | ||
191 | Returns \true if this dialog can and should perform layout adaptation using \helpref{DoLayoutAdaptation}{wxdialogdolayoutadaptation}, usually if | |
192 | the dialog is too large to fit on the display. | |
193 | ||
194 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
c6ece595 | 195 | |
a660d684 KB |
196 | \membersection{wxDialog::Centre}\label{wxdialogcentre} |
197 | ||
eaaa6a06 | 198 | \func{void}{Centre}{\param{int}{ direction = wxBOTH}} |
a660d684 KB |
199 | |
200 | Centres the dialog box on the display. | |
201 | ||
202 | \wxheading{Parameters} | |
203 | ||
204 | \docparam{direction}{May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL} or {\tt wxBOTH}.} | |
205 | ||
c6ece595 | 206 | |
a660d684 KB |
207 | \membersection{wxDialog::Create}\label{wxdialogcreate} |
208 | ||
eaaa6a06 | 209 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp |
a660d684 KB |
210 | \param{const wxString\& }{title},\rtfsp |
211 | \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp | |
212 | \param{const wxSize\& }{size = wxDefaultSize},\rtfsp | |
eaaa6a06 | 213 | \param{long}{ style = wxDEFAULT\_DIALOG\_STYLE},\rtfsp |
a660d684 KB |
214 | \param{const wxString\& }{name = ``dialogBox"}} |
215 | ||
b236c10f | 216 | Used for two-step dialog box construction. See \helpref{wxDialog::wxDialog}{wxdialogctor}\rtfsp |
a660d684 KB |
217 | for details. |
218 | ||
c6ece595 | 219 | |
67edd0c7 JS |
220 | \membersection{wxDialog::CreateButtonSizer}\label{wxdialogcreatebuttonsizer} |
221 | ||
222 | \func{wxSizer*}{CreateButtonSizer}{\param{long}{ flags}} | |
223 | ||
224 | Creates a sizer with standard buttons. {\it flags} is a bit list | |
57d7f988 VZ |
225 | of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE, |
226 | wxHELP, wxNO\_DEFAULT. | |
67edd0c7 JS |
227 | |
228 | The sizer lays out the buttons in a manner appropriate to the platform. | |
229 | ||
6500a868 VZ |
230 | This function uses \helpref{CreateStdDialogButtonSizer}{wxdialogcreatestddialogbuttonsizer} |
231 | internally for most platforms but doesn't create the sizer at all for the | |
232 | platforms with hardware buttons (such as smartphones) for which it sets up the | |
233 | hardware buttons appropriately and returns \NULL, so don't forget to test that | |
234 | the return value is valid before using it. | |
235 | ||
236 | ||
237 | \membersection{wxDialog::CreateSeparatedButtonSizer}\label{wxdialogcreateseparatedbuttonsizer} | |
238 | ||
239 | \func{wxSizer*}{CreateSeparatedButtonSizer}{\param{long}{ flags}} | |
240 | ||
241 | Creates a sizer with standard buttons using | |
242 | \helpref{CreateButtonSizer}{wxdialogcreatebuttonsizer} separated from the rest | |
243 | of the dialog contents by a horizontal \helpref{wxStaticLine}{wxstaticline}. | |
244 | ||
245 | Please notice that just like CreateButtonSizer() this function may return \NULL | |
246 | if no buttons were created. | |
67edd0c7 | 247 | |
c6ece595 | 248 | |
67edd0c7 JS |
249 | \membersection{wxDialog::CreateStdDialogButtonSizer}\label{wxdialogcreatestddialogbuttonsizer} |
250 | ||
251 | \func{wxStdDialogButtonSizer*}{CreateStdDialogButtonSizer}{\param{long}{ flags}} | |
252 | ||
253 | Creates a \helpref{wxStdDialogButtonSizer}{wxstddialogbuttonsizer} with standard buttons. {\it flags} is a bit list | |
57d7f988 VZ |
254 | of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE, |
255 | wxHELP, wxNO\_DEFAULT. | |
67edd0c7 JS |
256 | |
257 | The sizer lays out the buttons in a manner appropriate to the platform. | |
258 | ||
3aa8e4ea JS |
259 | \membersection{wxDialog::DoLayoutAdaptation}\label{wxdialogdolayoutadaptation} |
260 | ||
261 | \func{bool}{DoLayoutAdapation}{\void} | |
262 | ||
263 | Performs layout adaptation, usually if the dialog is too large to fit on the display. | |
264 | ||
265 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
c6ece595 | 266 | |
9ceeecb9 JS |
267 | \membersection{wxDialog::DoOK}\label{wxdialogdook} |
268 | ||
269 | \func{virtual bool}{DoOK}{\void} | |
270 | ||
271 | This function is called when the titlebar OK button is pressed (PocketPC only). | |
272 | A command event for the identifier returned by GetAffirmativeId is sent by | |
273 | default. You can override this function. If the function returns false, wxWidgets | |
274 | will call Close() for the dialog. | |
275 | ||
3aa8e4ea JS |
276 | \membersection{wxDialog::EnableLayoutAdaptation}\label{wxdialogenablelayoutadaptation} |
277 | ||
278 | \func{static void}{EnableLayoutAdaptation}{\param{bool}{ enable}} | |
279 | ||
280 | A static function enabling or disabling layout adaptation for all dialogs. | |
281 | ||
282 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
283 | ||
c6ece595 | 284 | |
a660d684 KB |
285 | \membersection{wxDialog::EndModal}\label{wxdialogendmodal} |
286 | ||
287 | \func{void}{EndModal}{\param{int }{retCode}} | |
288 | ||
289 | Ends a modal dialog, passing a value to be returned from the \helpref{wxDialog::ShowModal}{wxdialogshowmodal}\rtfsp | |
290 | invocation. | |
291 | ||
292 | \wxheading{Parameters} | |
293 | ||
294 | \docparam{retCode}{The value that should be returned by {\bf ShowModal}.} | |
295 | ||
296 | \wxheading{See also} | |
297 | ||
298 | \helpref{wxDialog::ShowModal}{wxdialogshowmodal},\rtfsp | |
6453876e RR |
299 | \helpref{wxDialog::GetReturnCode}{wxdialoggetreturncode},\rtfsp |
300 | \helpref{wxDialog::SetReturnCode}{wxdialogsetreturncode} | |
301 | ||
c6ece595 | 302 | |
9ceeecb9 JS |
303 | \membersection{wxDialog::GetAffirmativeId}\label{wxdialoggetaffirmativeid} |
304 | ||
305 | \constfunc{int}{GetAffirmativeId}{\void} | |
306 | ||
684e5b95 VZ |
307 | Gets the identifier of the button which works like standard OK button in this |
308 | dialog. | |
9ceeecb9 JS |
309 | |
310 | \wxheading{See also} | |
311 | ||
312 | \helpref{wxDialog::SetAffirmativeId}{wxdialogsetaffirmativeid} | |
313 | ||
3aa8e4ea JS |
314 | \membersection{wxDialog::GetContentWindow}\label{wxdialoggetcontentwindow} |
315 | ||
316 | \constfunc{wxWindow*}{GetContentWindow}{\void} | |
317 | ||
318 | Override this to return a window containing the main content of the dialog. This is | |
319 | particularly useful when the dialog implements pages, such as wxPropertySheetDialog, | |
320 | and allows the \helpref{layout adaptation code}{wxdialogoverview} to know that only the pages need to be made scrollable. | |
c6ece595 VZ |
321 | |
322 | \membersection{wxDialog::GetEscapeId}\label{wxdialoggetescapeid} | |
323 | ||
324 | \constfunc{int}{GetEscapeId}{\void} | |
325 | ||
326 | Gets the identifier of the button to map presses of \texttt{\textsc{ESC}} | |
327 | button to. | |
328 | ||
329 | \wxheading{See also} | |
330 | ||
331 | \helpref{wxDialog::SetEscapeId}{wxdialogsetescapeid} | |
332 | ||
333 | ||
3aa8e4ea JS |
334 | \membersection{wxDialog::GetLayoutAdaptationDone}\label{wxdialoggetlayoutadaptationdone} |
335 | ||
336 | \constfunc{bool}{GetLayoutAdaptationDone}{\void} | |
337 | ||
338 | Returns \true if the dialog has been adapted, usually by making it scrollable to work with a small display. | |
339 | ||
340 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
341 | ||
342 | ||
343 | \membersection{wxDialog::GetLayoutAdaptationLevel}\label{wxdialoggetlayoutadaptationlevel} | |
344 | ||
345 | \func{int}{GetLayoutAdaptationLevel}{\void} | |
346 | ||
347 | Gets a value representing the aggressiveness of search for buttons and sizers to be in the non-scrolling part of a layout-adapted dialog. | |
348 | Zero switches off adaptation, and 3 allows search for standard buttons anywhere in the dialog. | |
349 | ||
350 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
351 | ||
352 | ||
353 | \membersection{wxDialog::GetLayoutAdaptationMode}\label{wxdialoggetlayoutadaptationmode} | |
354 | ||
355 | \constfunc{wxDialogLayoutAdaptationMode}{GetLayoutAdaptationMode}{\void} | |
356 | ||
357 | Gets the adaptation mode, overriding the global adaptation flag. | |
358 | ||
359 | See also \helpref{SetLayoutAdaptationMode}{wxdialogsetlayoutadaptationmode} and \helpref{Automatic scrolling dialogs}{autoscrollingdialogs}. | |
360 | ||
361 | \membersection{wxDialog::GetLayoutAdapter}\label{wxdialoggetlayoutadapter} | |
362 | ||
363 | \func{static wxDialogLayoutAdapter*}{GetLayoutAdapter}{\void} | |
364 | ||
365 | A static function getting the current layout adapter object. | |
366 | ||
367 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
368 | ||
369 | ||
370 | \membersection{wxDialog::GetMainButtonIds}\label{wxdialoggetmainbuttonids} | |
371 | ||
372 | \func{wxArrayInt\&}{GetMainButtonIds}{\void} | |
373 | ||
374 | Returns an array of identifiers to be regarded as the main buttons for the non-scrolling area of a dialog. | |
375 | ||
376 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
377 | ||
6453876e RR |
378 | \membersection{wxDialog::GetReturnCode}\label{wxdialoggetreturncode} |
379 | ||
380 | \func{int}{GetReturnCode}{\void} | |
381 | ||
382 | Gets the return code for this window. | |
383 | ||
384 | \wxheading{Remarks} | |
385 | ||
386 | A return code is normally associated with a modal dialog, where \helpref{wxDialog::ShowModal}{wxdialogshowmodal} returns | |
387 | a code to the application. | |
388 | ||
389 | \wxheading{See also} | |
390 | ||
391 | \helpref{wxDialog::SetReturnCode}{wxdialogsetreturncode}, \helpref{wxDialog::ShowModal}{wxdialogshowmodal},\rtfsp | |
392 | \helpref{wxDialog::EndModal}{wxdialogendmodal} | |
a660d684 | 393 | |
c6ece595 | 394 | |
ec5f0c24 JS |
395 | \membersection{wxDialog::GetToolBar}\label{wxdialoggettoolbar} |
396 | ||
397 | \constfunc{wxToolBar*}{GetToolBar}{\void} | |
398 | ||
399 | On PocketPC, a dialog is automatically provided with an empty toolbar. GetToolBar | |
400 | allows you to access the toolbar and add tools to it. Removing tools and adding | |
401 | arbitrary controls are not currently supported. | |
402 | ||
403 | This function is not available on any other platform. | |
404 | ||
c6ece595 | 405 | |
a660d684 KB |
406 | \membersection{wxDialog::Iconize}\label{wxdialogiconized} |
407 | ||
19f6bff4 | 408 | \func{void}{Iconize}{\param{bool}{ iconize}} |
a660d684 | 409 | |
6453876e | 410 | Iconizes or restores the dialog. Windows only. |
a660d684 KB |
411 | |
412 | \wxheading{Parameters} | |
413 | ||
cc81d32f | 414 | \docparam{iconize}{If true, iconizes the dialog box; if false, shows and restores it.} |
a660d684 KB |
415 | |
416 | \wxheading{Remarks} | |
417 | ||
418 | Note that in Windows, iconization has no effect since dialog boxes cannot be | |
419 | iconized. However, applications may need to explicitly restore dialog | |
420 | boxes under Motif which have user-iconizable frames, and under Windows | |
cc81d32f VS |
421 | calling {\tt Iconize(false)} will bring the window to the front, as does |
422 | \rtfsp{\tt Show(true)}. | |
a660d684 | 423 | |
c6ece595 | 424 | |
a660d684 KB |
425 | \membersection{wxDialog::IsIconized}\label{wxdialogisiconized} |
426 | ||
427 | \constfunc{bool}{IsIconized}{\void} | |
428 | ||
cc81d32f | 429 | Returns true if the dialog box is iconized. Windows only. |
a660d684 KB |
430 | |
431 | \wxheading{Remarks} | |
432 | ||
cc81d32f | 433 | Always returns false under Windows since dialogs cannot be iconized. |
a660d684 | 434 | |
c6ece595 | 435 | |
3aa8e4ea JS |
436 | \membersection{wxDialog::IsLayoutAdaptationEnabled}\label{wxdialogislayoutadaptationenabled} |
437 | ||
438 | \func{static bool}{IsLayoutAdaptationEnabled}{\void} | |
439 | ||
440 | A static function returning \true if layout adaptation is enabled for all dialogs. | |
441 | ||
442 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
443 | ||
444 | ||
445 | \membersection{wxDialog::IsMainButton}\label{wxdialogismainbutton} | |
446 | ||
447 | \constfunc{bool}{IsMainButton}{\param{wxWindowID\& }{id}} | |
448 | ||
449 | Returns \true if {\it id} is in the array of identifiers to be regarded as the main buttons for the non-scrolling area of a dialog. | |
450 | ||
451 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
452 | ||
453 | ||
a660d684 KB |
454 | \membersection{wxDialog::IsModal}\label{wxdialogismodal} |
455 | ||
456 | \constfunc{bool}{IsModal}{\void} | |
457 | ||
cc81d32f | 458 | Returns true if the dialog box is modal, false otherwise. |
a660d684 | 459 | |
c6ece595 | 460 | |
c6ece595 | 461 | |
a660d684 KB |
462 | \membersection{wxDialog::OnSysColourChanged}\label{wxdialogonsyscolourchanged} |
463 | ||
464 | \func{void}{OnSysColourChanged}{\param{wxSysColourChangedEvent\& }{event}} | |
465 | ||
466 | The default handler for wxEVT\_SYS\_COLOUR\_CHANGED. | |
467 | ||
468 | \wxheading{Parameters} | |
469 | ||
470 | \docparam{event}{The colour change event.} | |
471 | ||
472 | \wxheading{Remarks} | |
473 | ||
474 | Changes the dialog's colour to conform to the current settings (Windows only). | |
475 | Add an event table entry for your dialog class if you wish the behaviour | |
476 | to be different (such as keeping a user-defined | |
f4fcc291 | 477 | background colour). If you do override this function, call wxEvent::Skip to |
a660d684 KB |
478 | propagate the notification to child windows and controls. |
479 | ||
480 | \wxheading{See also} | |
481 | ||
482 | \helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent} | |
483 | ||
c6ece595 | 484 | |
9ceeecb9 JS |
485 | \membersection{wxDialog::SetAffirmativeId}\label{wxdialogsetaffirmativeid} |
486 | ||
487 | \func{void}{SetAffirmativeId}{\param{int }{id}} | |
488 | ||
684e5b95 VZ |
489 | Sets the identifier to be used as OK button. When the button with this |
490 | identifier is pressed, the dialog calls \helpref{Validate}{wxwindowvalidate} | |
491 | and \helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow} | |
492 | and, if they both return \true, closes the dialog with \texttt{wxID\_OK} return | |
493 | code. | |
494 | ||
495 | Also, when the user presses a hardware OK button on the devices having one or | |
496 | the special OK button in the PocketPC title bar, an event with this id is | |
497 | generated. | |
498 | ||
499 | By default, the affirmative id is wxID\_OK. | |
9ceeecb9 JS |
500 | |
501 | \wxheading{See also} | |
502 | ||
684e5b95 | 503 | \helpref{wxDialog::GetAffirmativeId}{wxdialoggetaffirmativeid}, \helpref{wxDialog::SetEscapeId}{wxdialogsetescapeid} |
9ceeecb9 | 504 | |
c6ece595 VZ |
505 | |
506 | \membersection{wxDialog::SetEscapeId}\label{wxdialogsetescapeid} | |
507 | ||
508 | \func{void}{SetEscapeId}{\param{int }{id}} | |
509 | ||
684e5b95 VZ |
510 | Sets the identifier of the button which should work like the standard |
511 | \texttt{\textsc{Cancel}} button in this dialog. When the button with this id is | |
512 | clicked, the dialog is closed. Also, when the user presses \texttt{\textsc{ESC}} | |
513 | key in the dialog or closes the dialog using the close button in the title bar, | |
514 | this is mapped to the click of the button with the specified id. | |
515 | ||
516 | By default, the escape id is the special value \texttt{wxID\_ANY} meaning that | |
517 | \texttt{wxID\_CANCEL} button is used if it's present in the dialog and | |
518 | otherwise the button with \helpref{GetAffirmativeId()}{wxdialoggetaffirmativeid} | |
519 | is used. Another special value for \arg{id} is \texttt{wxID\_NONE} meaning that | |
520 | \texttt{\textsc{ESC}} presses should be ignored. If any other value is given, it | |
c6ece595 VZ |
521 | is interpreted as the id of the button to map the escape key to. |
522 | ||
523 | ||
9a6a5530 MB |
524 | \membersection{wxDialog::SetIcon}\label{wxdialogseticon} |
525 | ||
526 | \func{void}{SetIcon}{\param{const wxIcon\& }{icon}} | |
527 | ||
528 | Sets the icon for this dialog. | |
529 | ||
530 | \wxheading{Parameters} | |
531 | ||
532 | \docparam{icon}{The icon to associate with this dialog.} | |
533 | ||
534 | See also \helpref{wxIcon}{wxicon}. | |
535 | ||
c6ece595 | 536 | |
9a6a5530 MB |
537 | \membersection{wxDialog::SetIcons}\label{wxdialogseticons} |
538 | ||
539 | \func{void}{SetIcons}{\param{const wxIconBundle\& }{icons}} | |
540 | ||
541 | Sets the icons for this dialog. | |
542 | ||
543 | \wxheading{Parameters} | |
544 | ||
545 | \docparam{icons}{The icons to associate with this dialog.} | |
546 | ||
547 | See also \helpref{wxIconBundle}{wxiconbundle}. | |
548 | ||
c6ece595 | 549 | |
3aa8e4ea JS |
550 | \membersection{wxDialog::SetLayoutAdaptationDone}\label{wxdialogsetlayoutadaptationdone} |
551 | ||
552 | \func{void}{SetLayoutAdaptationDone}{\param{bool }{done}} | |
553 | ||
554 | Marks the dialog as having been adapted, usually by making it scrollable to work with a small display. | |
555 | ||
556 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
557 | ||
558 | ||
559 | \membersection{wxDialog::SetLayoutAdaptationLevel}\label{wxdialogsetlayoutadaptationlevel} | |
560 | ||
561 | \func{void}{SetLayoutAdaptationLevel}{\param{int }{level}} | |
562 | ||
563 | Sets the aggressiveness of search for buttons and sizers to be in the non-scrolling part of a layout-adapted dialog. | |
564 | Zero switches off adaptation, and 3 allows search for standard buttons anywhere in the dialog. | |
565 | ||
566 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
567 | ||
568 | ||
569 | \membersection{wxDialog::SetLayoutAdaptationMode}\label{wxdialogsetlayoutadaptationmode} | |
570 | ||
571 | \func{void}{SetLayoutAdaptationMode}{\param{wxDialogLayoutAdaptationMode }{mode}} | |
572 | ||
573 | Sets the adaptation mode, overriding the global adaptation flag. {\it mode} may be one of the following values: | |
574 | ||
575 | \begin{verbatim} | |
576 | enum wxDialogLayoutAdaptationMode | |
577 | { | |
578 | wxDIALOG_ADAPTATION_MODE_DEFAULT = 0, // use global adaptation enabled status | |
579 | wxDIALOG_ADAPTATION_MODE_ENABLED = 1, // enable this dialog overriding global status | |
580 | wxDIALOG_ADAPTATION_MODE_DISABLED = 2 // disable this dialog overriding global status | |
581 | }; | |
582 | \end{verbatim} | |
583 | ||
584 | See also \helpref{Automatic scrolling dialogs}{autoscrollingdialogs} for more on layout adaptation. | |
585 | ||
586 | ||
587 | \membersection{wxDialog::SetLayoutAdapter}\label{wxdialogsetlayoutadapter} | |
588 | ||
589 | \func{static wxDialogLayoutAdapter*}{SetLayoutAdapter}{\param{wxDialogLayoutAdapter*}{ adapter}} | |
590 | ||
591 | A static function for setting the current layout adapter object, returning the old adapter. If you call this, you should | |
592 | delete the old adapter object. | |
593 | ||
594 | See also \helpref{wxDialogLayoutAdapter}{wxdialoglayoutadapter} and \helpref{Automatic scrolling dialogs}{autoscrollingdialogs}. | |
595 | ||
596 | ||
a660d684 KB |
597 | \membersection{wxDialog::SetModal}\label{wxdialogsetmodal} |
598 | ||
19f6bff4 | 599 | \func{void}{SetModal}{\param{bool}{ flag}} |
a660d684 | 600 | |
60fef964 | 601 | {\bf NB:} This function is deprecated and doesn't work for all ports, just use |
f6bcfd97 BP |
602 | \helpref{ShowModal}{wxdialogshowmodal} to show a modal dialog instead. |
603 | ||
a660d684 KB |
604 | Allows the programmer to specify whether the dialog box is modal (wxDialog::Show blocks control |
605 | until the dialog is hidden) or modeless (control returns immediately). | |
606 | ||
607 | \wxheading{Parameters} | |
608 | ||
cc81d32f | 609 | \docparam{flag}{If true, the dialog will be modal, otherwise it will be modeless.} |
a660d684 | 610 | |
c6ece595 | 611 | |
6453876e RR |
612 | \membersection{wxDialog::SetReturnCode}\label{wxdialogsetreturncode} |
613 | ||
614 | \func{void}{SetReturnCode}{\param{int }{retCode}} | |
615 | ||
616 | Sets the return code for this window. | |
617 | ||
618 | \wxheading{Parameters} | |
619 | ||
620 | \docparam{retCode}{The integer return code, usually a control identifier.} | |
621 | ||
622 | \wxheading{Remarks} | |
623 | ||
624 | A return code is normally associated with a modal dialog, where \helpref{wxDialog::ShowModal}{wxdialogshowmodal} returns | |
625 | a code to the application. The function \helpref{wxDialog::EndModal}{wxdialogendmodal} calls {\bf SetReturnCode}. | |
626 | ||
627 | \wxheading{See also} | |
628 | ||
d7cb14ce | 629 | \helpref{wxDialog::GetReturnCode}{wxdialoggetreturncode}, \helpref{wxDialog::ShowModal}{wxdialogshowmodal},\rtfsp |
6453876e RR |
630 | \helpref{wxDialog::EndModal}{wxdialogendmodal} |
631 | ||
c6ece595 | 632 | |
a660d684 KB |
633 | \membersection{wxDialog::Show}\label{wxdialogshow} |
634 | ||
19f6bff4 | 635 | \func{bool}{Show}{\param{bool}{ show}} |
a660d684 KB |
636 | |
637 | Hides or shows the dialog. | |
638 | ||
639 | \wxheading{Parameters} | |
640 | ||
cc81d32f VS |
641 | \docparam{show}{If true, the dialog box is shown and brought to the front; |
642 | otherwise the box is hidden. If false and the dialog is | |
a660d684 KB |
643 | modal, control is returned to the calling program.} |
644 | ||
645 | \wxheading{Remarks} | |
646 | ||
647 | The preferred way of dismissing a modal dialog is to use \helpref{wxDialog::EndModal}{wxdialogendmodal}. | |
648 | ||
c6ece595 | 649 | |
a660d684 KB |
650 | \membersection{wxDialog::ShowModal}\label{wxdialogshowmodal} |
651 | ||
652 | \func{int}{ShowModal}{\void} | |
653 | ||
654 | Shows a modal dialog. Program flow does not return until the dialog has been dismissed with\rtfsp | |
655 | \helpref{wxDialog::EndModal}{wxdialogendmodal}. | |
656 | ||
657 | \wxheading{Return value} | |
658 | ||
d7cb14ce | 659 | The return value is the value set with \helpref{wxDialog::SetReturnCode}{wxdialogsetreturncode}. |
a660d684 KB |
660 | |
661 | \wxheading{See also} | |
662 | ||
663 | \helpref{wxDialog::EndModal}{wxdialogendmodal},\rtfsp | |
d7cb14ce JS |
664 | \helpref{wxDialog:GetReturnCode}{wxdialoggetreturncode},\rtfsp |
665 | \helpref{wxDialog::SetReturnCode}{wxdialogsetreturncode} | |
b67a86d5 | 666 |