]> git.saurik.com Git - wxWidgets.git/blame - docs/doxygen/overviews/commondialogs.h
Merge in from trunk r68684 - r69046
[wxWidgets.git] / docs / doxygen / overviews / commondialogs.h
CommitLineData
15b6757b 1/////////////////////////////////////////////////////////////////////////////
d54cf7ff 2// Name: commondialogs.h
15b6757b
FM
3// Purpose: topic overview
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
15b6757b
FM
7/////////////////////////////////////////////////////////////////////////////
8
880efa2a
BP
9/**
10
11@page overview_cmndlg Common Dialogs
12
13Classes:
14
15@li wxColourDialog
16@li wxFontDialog
17@li wxPrintDialog
18@li wxFileDialog
19@li wxDirDialog
20@li wxTextEntryDialog
21@li wxPasswordEntryDialog
22@li wxMessageDialog
23@li wxSingleChoiceDialog
24@li wxMultiChoiceDialog
25
26Common dialog classes and functions encapsulate commonly-needed dialog box
27requirements. They are all 'modal', grabbing the flow of control until the user
28dismisses the dialog, to make them easy to use within an application.
29
30Some dialogs have both platform-dependent and platform-independent
31implementations, so that if underlying windowing systems do not provide the
32required functionality, the generic classes and functions can stand in. For
33example, under MS Windows, wxColourDialog uses the standard colour selector.
34There is also an equivalent called wxGenericColourDialog for other platforms,
35and a macro defines wxColourDialog to be the same as wxGenericColourDialog on
36non-MS Windows platforms. However, under MS Windows, the generic dialog can
37also be used, for testing or other purposes.
38
39@li @ref overview_cmndlg_colour
40@li @ref overview_cmndlg_font
41@li @ref overview_cmndlg_print
42@li @ref overview_cmndlg_file
43@li @ref overview_cmndlg_dir
44@li @ref overview_cmndlg_textentry
45@li @ref overview_cmndlg_password
46@li @ref overview_cmndlg_msg
47@li @ref overview_cmndlg_singlechoice
48@li @ref overview_cmndlg_multichoice
49
50
51<hr>
52
53
54@section overview_cmndlg_colour wxColourDialog Overview
55
56Classes: wxColourDialog, wxColourData
57
58The wxColourDialog presents a colour selector to the user, and returns with
59colour information.
60
61@subsection overview_cmndlg_colour_msw The MS Windows Colour Selector
62
63Under Windows, the native colour selector common dialog is used. This presents
64a dialog box with three main regions: at the top left, a palette of 48
65commonly-used colours is shown. Under this, there is a palette of 16
66'custom colours' which can be set by the application if desired. Additionally,
67the user may open up the dialog box to show a right-hand panel containing
68controls to select a precise colour, and add it to the custom colour palette.
69
70@subsection overview_cmndlg_colour_generic The Generic Colour Selector
36c9828f 71
880efa2a
BP
72Under non-MS Windows platforms, the colour selector is a simulation of most of
73the features of the MS Windows selector. Two palettes of 48 standard and 16
74custom colours are presented, with the right-hand area containing three sliders
75for the user to select a colour from red, green and blue components. This
76colour may be added to the custom colour palette, and will replace either the
77currently selected custom colour, or the first one in the palette if none is
78selected. The RGB colour sliders are not optional in the generic colour
79selector. The generic colour selector is also available under MS Windows; use
80the name wxGenericColourDialog.
81
82@subsection overview_cmndlg_colour_example Example
83
84In the samples/dialogs directory, there is an example of using the
85wxColourDialog class. Here is an excerpt, which sets various parameters of a
86wxColourData object, including a grey scale for the custom colours. If the user
87did not cancel the dialog, the application retrieves the selected colour and
88uses it to set the background of a window.
89
90@code
91wxColourData data;
92data.SetChooseFull(true);
93for (int i = 0; i < 16; i++)
94{
95 wxColour colour(i*16, i*16, i*16);
96 data.SetCustomColour(i, colour);
97}
98
99wxColourDialog dialog(this, &data);
100if (dialog.ShowModal() == wxID_OK)
101{
102 wxColourData retData = dialog.GetColourData();
103 wxColour col = retData.GetColour();
104 wxBrush brush(col, wxSOLID);
105 myWindow->SetBackground(brush);
106 myWindow->Clear();
107 myWindow->Refresh();
108}
109@endcode
36c9828f 110
d54cf7ff 111
880efa2a 112@section overview_cmndlg_font wxFontDialog Overview
d54cf7ff 113
880efa2a 114Classes: wxFontDialog, wxFontData
d54cf7ff 115
880efa2a
BP
116The wxFontDialog presents a font selector to the user, and returns with font
117and colour information.
d54cf7ff 118
880efa2a 119@subsection overview_cmndlg_font_msw The MS Windows Font Selector
d54cf7ff 120
880efa2a
BP
121Under Windows, the native font selector common dialog is used. This presents a
122dialog box with controls for font name, point size, style, weight, underlining,
123strikeout and text foreground colour. A sample of the font is shown on a white
124area of the dialog box. Note that in the translation from full MS Windows fonts
125to wxWidgets font conventions, strikeout is ignored and a font family (such as
126Swiss or Modern) is deduced from the actual font name (such as Arial or
127Courier).
36c9828f 128
880efa2a 129@subsection overview_cmndlg_font_generic The Generic Font Selector
36c9828f 130
880efa2a
BP
131Under non-MS Windows platforms, the font selector is simpler. Controls for font
132family, point size, style, weight, underlining and text foreground colour are
133provided, and a sample is shown upon a white background. The generic font
134selector is also available under MS Windows; use the name wxGenericFontDialog.
36c9828f 135
880efa2a 136@subsection overview_cmndlg_font_example Example
36c9828f 137
880efa2a
BP
138In the samples/dialogs directory, there is an example of using the wxFontDialog
139class. The application uses the returned font and colour for drawing text on a
140canvas. Here is an excerpt:
36c9828f 141
880efa2a
BP
142@code
143wxFontData data;
144data.SetInitialFont(canvasFont);
145data.SetColour(canvasTextColour);
36c9828f 146
880efa2a
BP
147wxFontDialog dialog(this, &data);
148if (dialog.ShowModal() == wxID_OK)
149{
150 wxFontData retData = dialog.GetFontData();
151 canvasFont = retData.GetChosenFont();
152 canvasTextColour = retData.GetColour();
153 myWindow->Refresh();
154}
155@endcode
d54cf7ff 156
d54cf7ff 157
880efa2a 158@section overview_cmndlg_print wxPrintDialog Overview
d54cf7ff 159
880efa2a 160Classes: wxPrintDialog, wxPrintData
d54cf7ff 161
880efa2a
BP
162This class represents the print and print setup common dialogs. You may obtain
163a wxPrinterDC device context from a successfully dismissed print dialog.
d54cf7ff 164
880efa2a
BP
165The samples/printing example shows how to use it: see @ref overview_printing
166for an excerpt from this example.
d54cf7ff 167
d54cf7ff 168
880efa2a 169@section overview_cmndlg_file wxFileDialog Overview
36c9828f 170
880efa2a 171Classes: wxFileDialog
36c9828f 172
880efa2a
BP
173Pops up a file selector box. On Windows and GTK 2.4+, this is the common file
174selector dialog. In X, this is a file selector box with somewhat less
175functionality. The path and filename are distinct elements of a full file
176pathname.
36c9828f 177
880efa2a
BP
178If path is "", the current directory will be used. If filename is "", no
179default filename will be supplied. The wildcard determines what files are
180displayed in the file selector, and file extension supplies a type extension
181for the required filename. Flags may be a combination of wxFD_OPEN, wxFD_SAVE,
182wxFD_OVERWRITE_PROMPT, wxFD_HIDE_READONLY, wxFD_FILE_MUST_EXIST, wxFD_MULTIPLE,
183wxFD_CHANGE_DIR or 0.
36c9828f 184
880efa2a
BP
185Both the X and Windows versions implement a wildcard filter. Typing a filename
186containing wildcards (*, ?) in the filename text item, and clicking on Ok, will
187result in only those files matching the pattern being displayed. In the X
188version, supplying no default name will result in the wildcard filter being
189inserted in the filename text item; the filter is ignored if a default name is
190supplied.
d54cf7ff 191
880efa2a
BP
192The wildcard may be a specification for multiple types of file with a
193description for each, such as:
36c9828f 194
880efa2a
BP
195@verbatim
196"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
197@endverbatim
d54cf7ff 198
d54cf7ff 199
880efa2a 200@section overview_cmndlg_dir wxDirDialog Overview
36c9828f 201
880efa2a 202Classes: wxDirDialog
d54cf7ff 203
880efa2a
BP
204This dialog shows a directory selector dialog, allowing the user to select a
205single directory.
d54cf7ff 206
36c9828f 207
880efa2a 208@section overview_cmndlg_textentry wxTextEntryDialog Overview
d54cf7ff 209
880efa2a 210Classes: wxTextEntryDialog
d54cf7ff 211
880efa2a
BP
212This is a dialog with a text entry field. The value that the user entered is
213obtained using wxTextEntryDialog::GetValue().
d54cf7ff 214
d54cf7ff 215
880efa2a 216@section overview_cmndlg_password wxPasswordEntryDialog Overview
36c9828f 217
880efa2a 218Classes: wxPasswordEntryDialog
36c9828f 219
880efa2a
BP
220This is a dialog with a password entry field. The value that the user entered
221is obtained using wxTextEntryDialog::GetValue().
36c9828f 222
d54cf7ff 223
880efa2a 224@section overview_cmndlg_msg wxMessageDialog Overview
36c9828f 225
880efa2a 226Classes: wxMessageDialog
36c9828f 227
880efa2a
BP
228This dialog shows a message, plus buttons that can be chosen from OK, Cancel,
229Yes, and No. Under Windows, an optional icon can be shown, such as an
230exclamation mark or question mark.
d54cf7ff 231
880efa2a
BP
232The return value of wxMessageDialog::ShowModal() indicates which button the
233user pressed.
d54cf7ff
FM
234
235
880efa2a 236@section overview_cmndlg_singlechoice wxSingleChoiceDialog Overview
36c9828f 237
880efa2a 238Classes: wxSingleChoiceDialog
d54cf7ff 239
880efa2a
BP
240This dialog shows a list of choices, plus OK and (optionally) Cancel. The user
241can select one of them. The selection can be obtained from the dialog as an
242index, a string or client data.
36c9828f 243
d54cf7ff 244
880efa2a 245@section overview_cmndlg_multichoice wxMultiChoiceDialog Overview
d54cf7ff 246
880efa2a 247Classes: wxMultiChoiceDialog
36c9828f 248
880efa2a
BP
249This dialog shows a list of choices, plus OK and (optionally) Cancel. The user
250can select one or more of them.
36c9828f 251
d54cf7ff 252*/
36c9828f 253