]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/doxygen/overviews/commondialogs.h
Pass wxWANTS_CHARS to the wxRichTextCtrl constructor in the unit tests.
[wxWidgets.git] / docs / doxygen / overviews / commondialogs.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: commondialogs.h
3// Purpose: topic overview
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows licence
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10
11@page overview_cmndlg Common Dialogs
12
13@tableofcontents
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
28@see @ref group_class_cmndlg
29
30
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
49
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
88
89
90
91@section overview_cmndlg_font wxFontDialog Overview
92
93Classes: wxFontDialog, wxFontData
94
95The wxFontDialog presents a font selector to the user, and returns with font
96and colour information.
97
98@subsection overview_cmndlg_font_msw The MS Windows Font Selector
99
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).
107
108@subsection overview_cmndlg_font_generic The Generic Font Selector
109
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.
114
115@subsection overview_cmndlg_font_example Example
116
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:
120
121@code
122wxFontData data;
123data.SetInitialFont(canvasFont);
124data.SetColour(canvasTextColour);
125
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
135
136
137
138@section overview_cmndlg_print wxPrintDialog Overview
139
140Classes: wxPrintDialog, wxPrintData
141
142This class represents the print and print setup common dialogs. You may obtain
143a wxPrinterDC device context from a successfully dismissed print dialog.
144
145The samples/printing example shows how to use it: see @ref overview_printing
146for an excerpt from this example.
147
148
149
150@section overview_cmndlg_file wxFileDialog Overview
151
152Classes: wxFileDialog
153
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.
158
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.
165
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.
172
173The wildcard may be a specification for multiple types of file with a
174description for each, such as:
175
176@verbatim
177"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
178@endverbatim
179
180
181
182@section overview_cmndlg_dir wxDirDialog Overview
183
184Classes: wxDirDialog
185
186This dialog shows a directory selector dialog, allowing the user to select a
187single directory.
188
189
190
191@section overview_cmndlg_textentry wxTextEntryDialog Overview
192
193Classes: wxTextEntryDialog
194
195This is a dialog with a text entry field. The value that the user entered is
196obtained using wxTextEntryDialog::GetValue().
197
198
199
200@section overview_cmndlg_password wxPasswordEntryDialog Overview
201
202Classes: wxPasswordEntryDialog
203
204This is a dialog with a password entry field. The value that the user entered
205is obtained using wxTextEntryDialog::GetValue().
206
207
208
209@section overview_cmndlg_msg wxMessageDialog Overview
210
211Classes: wxMessageDialog
212
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.
216
217The return value of wxMessageDialog::ShowModal() indicates which button the
218user pressed.
219
220
221
222@section overview_cmndlg_singlechoice wxSingleChoiceDialog Overview
223
224Classes: wxSingleChoiceDialog
225
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.
229
230
231
232@section overview_cmndlg_multichoice wxMultiChoiceDialog Overview
233
234Classes: wxMultiChoiceDialog
235
236This dialog shows a list of choices, plus OK and (optionally) Cancel. The user
237can select one or more of them.
238
239*/