]>
git.saurik.com Git - wxWidgets.git/blob - interface/msgdlg.h
197224859b74938419cd550eb3e9eaf43221dee7
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxMessageDialog
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxMessageDialog
13 This class represents a dialog that shows a single or multi-line message,
14 with a choice of OK, Yes, No and Cancel buttons.
19 @see @ref overview_wxmessagedialogoverview "wxMessageDialog overview"
21 class wxMessageDialog
: public wxDialog
25 Constructor specifying the message box properties.
27 Use ShowModal() to show the dialog.
29 @a style may be a bit list of the following identifiers:
33 Puts an Ok button in the message box. May be combined with @c
36 Puts a Cancel button in the message box. Must be combined with
37 either @c wxOK or @c wxYES_NO.
39 Puts Yes and No buttons in the message box. May be combined with
42 Makes the "No" button default, can only be used with @c wxYES_NO.
44 Makes the "Yes" button default, this is the default behaviour and
45 this flag exists solely for symmetry with @c wxNO_DEFAULT.
46 @style{wxICON_EXCLAMATION}
47 Displays an exclamation mark symbol.
49 Displays an error symbol.
51 Displays an error symbol, this is a MSW-inspired synonym for @c
53 @style{wxICON_QUESTION}
54 Displays a question mark symbol. This icon is automatically used
55 with @c wxYES_NO so it's usually unnecessary to specify it
57 @style{wxICON_INFORMATION}
58 Displays an information symbol. This icon is used by default if @c
59 wxYES_NO is not given so it is usually unnecessary to specify it
62 Makes the message box stay on top of all other windows (currently
63 implemented only under MSW).
69 Message to show in the dialog.
73 Combination of style flags described above.
75 Dialog position (ignored under MSW).
77 wxMessageDialog(wxWindow
* parent
, const wxString
& message
,
78 const wxString
& caption
= "Message box",
79 long style
= wxOK
| wxCANCEL
,
80 const wxPoint
& pos
= wxDefaultPosition
);
83 Sets the extended message for the dialog: this message is usually an
84 extension of the short message specified in the constructor or set with
87 If it is set, the main message appears highlighted -- if supported --
88 and this message appears beneath it in normal font. On the platforms
89 which don't support extended messages, it is simply appended to the
90 normal message with a new line separating them.
92 void SetExtendedMessage(const wxString extendedMessage
);
95 Sets the message shown by the dialog.
97 void SetMessage(const wxString msg
);
100 Overrides the default labels of the OK and Cancel buttons.
102 Please see the remarks in SetYesNoLabels() documentation.
104 bool SetOKCancelLabels(const wxString ok
, const wxString cancel
);
107 Overrides the default label of the OK button.
109 Please see the remarks in SetYesNoLabels() documentation.
111 bool SetOKLabel(const wxString ok
);
114 Overrides the default labels of the Yes, No and Cancel buttons.
116 Please see the remarks in SetYesNoLabels() documentation.
118 bool SetYesNoCancelLabels(const wxString yes
, const wxString no
,
119 const wxString cancel
);
122 Overrides the default labels of the Yes and No buttons.
124 Notice that this function is not currently available on all platforms,
125 so it may return @false to indicate that the labels couldn't be
126 changed. If it returns @true (currently only under wxMac), the labels
127 were set successfully. Typically, if the function was used
128 successfully, the main dialog message may need to be changed, e.g.:
130 wxMessageDialog dlg(...);
131 if ( dlg.SetYesNoLabels(_("&Quit"), _("&Don't quit")) )
132 dlg.SetMessage(_("What do you want to do?"));
133 else // buttons have standard "Yes"/"No" values, so rephrase the question
134 dlg.SetMessage(_("Do you really want to quit?"));
137 bool SetYesNoLabels(const wxString yes
, const wxString no
);
140 Shows the dialog, returning one of wxID_OK, wxID_CANCEL, wxID_YES,
143 Notice that this method returns the identifier of the button which was
144 clicked unlike wxMessageBox() function.
151 // ============================================================================
152 // Global functions/macros
153 // ============================================================================
155 /** @ingroup group_funcmacro_dialog */
159 Show a general purpose message dialog.
161 This is a convenient function which is usually used instead of using
162 wxMessageDialog directly. Notice however that some of the features, such as
163 extended text and custom labels for the message box buttons, are not
164 provided by this function but only by wxMessageDialog.
166 The return value is one of: @c wxYES, @c wxNO, @c wxCANCEL or @c wxOK
167 (notice that this return value is @b different from the return value of
168 wxMessageDialog::ShowModal()).
172 int answer = wxMessageBox("Quit program?", "Confirm",
173 wxYES_NO | wxCANCEL, main_frame);
178 @a message may contain newline characters, in which case the message will
179 be split into separate lines, to cater for large messages.
182 Message to show in the dialog.
188 Combination of style flags described in wxMessageDialog documentation.
190 Horizontal dialog position (ignored under MSW). Use @c wxDefaultCoord
191 for @a x and @a y to let the system position the window.
193 Vertical dialog position (ignored under MSW).
196 int wxMessageBox(const wxString
& message
,
197 const wxString
& caption
= "Message",
199 wxWindow
* parent
= NULL
,
200 int x
= wxDefaultCoord
,
201 int y
= wxDefaultCoord
);