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