Version: 2.9.4
Classes | Public Member Functions
wxMessageDialog Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/msgdlg.h>

Inheritance diagram for wxMessageDialog:

Detailed Description

This class represents a dialog that shows a single or multi-line message, with a choice of OK, Yes, No and Cancel buttons.

Styles

This class supports the following styles:

Library:  wxCore
Category:  Common Dialogs

クラス

class  ButtonLabel
 Helper class allowing to use either stock id or string labels. More...

Public Member Functions

 wxMessageDialog (wxWindow *parent, const wxString &message, const wxString &caption=wxMessageBoxCaptionStr, long style=wxOK|wxCENTRE, const wxPoint &pos=wxDefaultPosition)
 Constructor specifying the message box properties.
virtual void SetExtendedMessage (const wxString &extendedMessage)
 Sets the extended message for the dialog: this message is usually an extension of the short message specified in the constructor or set with SetMessage().
virtual bool SetHelpLabel (const ButtonLabel &help)
 Sets the label for the Help button.
virtual void SetMessage (const wxString &message)
 Sets the message shown by the dialog.
virtual bool SetOKCancelLabels (const ButtonLabel &ok, const ButtonLabel &cancel)
 Overrides the default labels of the OK and Cancel buttons.
virtual bool SetOKLabel (const ButtonLabel &ok)
 Overrides the default label of the OK button.
virtual bool SetYesNoCancelLabels (const ButtonLabel &yes, const ButtonLabel &no, const ButtonLabel &cancel)
 Overrides the default labels of the Yes, No and Cancel buttons.
virtual bool SetYesNoLabels (const ButtonLabel &yes, const ButtonLabel &no)
 Overrides the default labels of the Yes and No buttons.
virtual int ShowModal ()
 Shows the dialog, returning one of wxID_OK, wxID_CANCEL, wxID_YES, wxID_NO or wxID_HELP.
wxString GetCaption () const
wxString GetMessage () const
wxString GetExtendedMessage () const
long GetMessageDialogStyle () const
bool HasCustomLabels () const
wxString GetYesLabel () const
wxString GetNoLabel () const
wxString GetOKLabel () const
wxString GetCancelLabel () const
wxString GetHelpLabel () const
long GetEffectiveIcon () const

List of all members.


Constructor & Destructor Documentation

wxMessageDialog::wxMessageDialog ( wxWindow parent,
const wxString message,
const wxString caption = wxMessageBoxCaptionStr,
long  style = wxOK|wxCENTRE,
const wxPoint pos = wxDefaultPosition 
)

Constructor specifying the message box properties.

Use ShowModal() to show the dialog.

style may be a bit list of the identifiers described above.

Notice that not all styles are compatible: only one of wxOK and wxYES_NO may be specified (and one of them must be specified) and at most one default button style can be used and it is only valid if the corresponding button is shown in the message box.

Parameters:
parentParent window.
messageMessage to show in the dialog.
captionThe dialog title.
styleCombination of style flags described above.
posDialog position (ignored under MSW).

Member Function Documentation

wxString wxMessageDialog::GetCancelLabel ( ) const
wxString wxMessageDialog::GetCaption ( ) const
long wxMessageDialog::GetEffectiveIcon ( ) const
wxString wxMessageDialog::GetExtendedMessage ( ) const
wxString wxMessageDialog::GetHelpLabel ( ) const
wxString wxMessageDialog::GetMessage ( ) const
long wxMessageDialog::GetMessageDialogStyle ( ) const
wxString wxMessageDialog::GetNoLabel ( ) const
wxString wxMessageDialog::GetOKLabel ( ) const
wxString wxMessageDialog::GetYesLabel ( ) const
bool wxMessageDialog::HasCustomLabels ( ) const
virtual void wxMessageDialog::SetExtendedMessage ( const wxString extendedMessage) [virtual]

Sets the extended message for the dialog: this message is usually an extension of the short message specified in the constructor or set with SetMessage().

If it is set, the main message appears highlighted -- if supported -- and this message appears beneath it in normal font. On the platforms which don't support extended messages, it is simply appended to the normal message with an empty line separating them.

Since:
2.9.0
virtual bool wxMessageDialog::SetHelpLabel ( const ButtonLabel help) [virtual]

Sets the label for the Help button.

Please see the remarks in SetYesNoLabels() documentation.

Notice that changing the label of the help button resets its special status (if any, this depends on the platform) and it will be treated just like another button in this case.

Since:
2.9.3
virtual void wxMessageDialog::SetMessage ( const wxString message) [virtual]

Sets the message shown by the dialog.

Since:
2.9.0
virtual bool wxMessageDialog::SetOKCancelLabels ( const ButtonLabel ok,
const ButtonLabel cancel 
) [virtual]

Overrides the default labels of the OK and Cancel buttons.

Please see the remarks in SetYesNoLabels() documentation.

Since:
2.9.0
virtual bool wxMessageDialog::SetOKLabel ( const ButtonLabel ok) [virtual]

Overrides the default label of the OK button.

Please see the remarks in SetYesNoLabels() documentation.

Since:
2.9.0
virtual bool wxMessageDialog::SetYesNoCancelLabels ( const ButtonLabel yes,
const ButtonLabel no,
const ButtonLabel cancel 
) [virtual]

Overrides the default labels of the Yes, No and Cancel buttons.

Please see the remarks in SetYesNoLabels() documentation.

Since:
2.9.0
virtual bool wxMessageDialog::SetYesNoLabels ( const ButtonLabel yes,
const ButtonLabel no 
) [virtual]

Overrides the default labels of the Yes and No buttons.

The arguments of this function can be either strings or one of the standard identifiers, such as wxID_APPLY or wxID_OPEN. Notice that even if the label is specified as an identifier, the return value of the dialog ShowModal() method still remains one of wxID_OK, wxID_CANCEL, wxID_YES or wxID_NO values, i.e. this identifier changes only the label appearance but not the return code generated by the button. It is possible to mix stock identifiers and string labels in the same function call, for example:

        wxMessageDialog dlg(...);
        dlg.SetYesNoLabels(wxID_SAVE, _("&Don't save"));

Also notice that this function is not currently available on all platforms (although as of wxWidgets 2.9.0 it is implemented in all major ports), so it may return false to indicate that the labels couldn't be changed. If it returns true, the labels were set successfully.

Typically, if the function was used successfully, the main dialog message may need to be changed, e.g.:

        wxMessageDialog dlg(...);
        if ( dlg.SetYesNoLabels(_("&Quit"), _("&Don't quit")) )
            dlg.SetMessage(_("What do you want to do?"));
        else // buttons have standard "Yes"/"No" values, so rephrase the question
            dlg.SetMessage(_("Do you really want to quit?"));
Since:
2.9.0
virtual int wxMessageDialog::ShowModal ( ) [virtual]

Shows the dialog, returning one of wxID_OK, wxID_CANCEL, wxID_YES, wxID_NO or wxID_HELP.

Notice that this method returns the identifier of the button which was clicked unlike wxMessageBox() function.

Reimplemented from wxDialog.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines