2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: msgdlg.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxMessageDialog
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxMessageDialog
|
|
|
|
@wxheader{msgdlg.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class represents a dialog that shows a single or multi-line message,
|
|
|
|
with a choice of OK, Yes, No and Cancel buttons.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{cmndlg}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see @ref overview_wxmessagedialogoverview "wxMessageDialog overview"
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxMessageDialog : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor. Use ShowModal() to show the dialog.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param message
|
2008-03-09 08:33:59 -04:00
|
|
|
Message to show on the dialog.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param caption
|
2008-03-09 08:33:59 -04:00
|
|
|
The dialog caption.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
A dialog style (bitlist) containing flags chosen from the following:
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxOK
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Show an OK button.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxCANCEL
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Show a Cancel button.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxYES_NO
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Show Yes and No buttons.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxYES_DEFAULT
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Used with wxYES_NO, makes Yes button the default - which is the default
|
2008-03-08 08:52:38 -05:00
|
|
|
behaviour.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxNO_DEFAULT
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Used with wxYES_NO, makes No button the default.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxICON_EXCLAMATION
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Shows an exclamation mark icon.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxICON_HAND
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Shows an error icon.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxICON_ERROR
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Shows an error icon - the same as wxICON_HAND.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxICON_QUESTION
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Shows a question mark icon.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxICON_INFORMATION
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
Shows an information (i) icon.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
wxSTAY_ON_TOP
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
The message box stays on top of all other window, even those of the other
|
|
|
|
applications (Windows only).
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Dialog position. Not Windows.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxMessageDialog(wxWindow* parent, const wxString& message,
|
|
|
|
const wxString& caption = "Message box",
|
2008-03-09 08:33:59 -04:00
|
|
|
long style = wxOK | wxCANCEL,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
*/
|
|
|
|
~wxMessageDialog();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the extended message for the dialog: this message is usually an extension
|
2008-03-08 09:43:31 -05:00
|
|
|
of the short message specified in the constructor or set with
|
2008-03-08 08:52:38 -05:00
|
|
|
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 a new line separating them.
|
|
|
|
*/
|
|
|
|
void SetExtendedMessage(const wxString exMsg);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the message shown by the dialog.
|
|
|
|
*/
|
|
|
|
void SetMessage(const wxString msg);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Overrides the default labels of the OK and Cancel buttons.
|
2008-03-08 09:43:31 -05:00
|
|
|
Please see the remarks in
|
2008-03-08 08:52:38 -05:00
|
|
|
SetYesNoLabels() documentation.
|
|
|
|
*/
|
|
|
|
bool SetOKCancelLabels(const wxString ok, const wxString cancel);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Overrides the default label of the OK button.
|
2008-03-08 09:43:31 -05:00
|
|
|
Please see the remarks in
|
2008-03-08 08:52:38 -05:00
|
|
|
SetYesNoLabels() documentation.
|
|
|
|
*/
|
|
|
|
bool SetOKLabel(const wxString ok);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Overrides the default labels of the Yes, No and Cancel buttons.
|
2008-03-08 09:43:31 -05:00
|
|
|
Please see the remarks in
|
2008-03-08 08:52:38 -05:00
|
|
|
SetYesNoLabels() documentation.
|
|
|
|
*/
|
|
|
|
bool SetYesNoCancelLabels(const wxString yes, const wxString no,
|
|
|
|
const wxString cancel);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Overrides the default labels of the Yes and No buttons.
|
|
|
|
Notice that this function is not currently available on all platforms, so it
|
|
|
|
may return @false to indicate that the labels couldn't be changed. If it
|
|
|
|
returns @true (currently only under wxMac), the labels were set successfully.
|
|
|
|
Typically, if the function was used successfully, the main dialog message may
|
|
|
|
need to be changed, e.g.:
|
|
|
|
*/
|
|
|
|
bool SetYesNoLabels(const wxString yes, const wxString no);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Shows the dialog, returning one of wxID_OK, wxID_CANCEL, wxID_YES, wxID_NO.
|
|
|
|
*/
|
|
|
|
int ShowModal();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
// ============================================================================
|
|
|
|
// Global functions/macros
|
|
|
|
// ============================================================================
|
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
/** @ingroup group_funcmacro_dialog */
|
|
|
|
//@{
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-03-18 15:30:01 -04:00
|
|
|
General purpose message dialog. @c style may be a bit list of the
|
2008-03-08 08:52:38 -05:00
|
|
|
following identifiers:
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxYES_NO}
|
2008-03-18 15:30:01 -04:00
|
|
|
Puts Yes and No buttons on the message box. May be combined with
|
|
|
|
wxCANCEL.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxCANCEL}
|
2008-03-18 15:30:01 -04:00
|
|
|
Puts a Cancel button on the message box. May only be combined with
|
|
|
|
wxYES_NO or wxOK.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxOK}
|
2008-03-18 15:30:01 -04:00
|
|
|
Puts an Ok button on the message box. May be combined with wxCANCEL.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxICON_EXCLAMATION}
|
2008-03-18 15:30:01 -04:00
|
|
|
Displays an exclamation mark symbol.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxICON_HAND}
|
2008-03-18 15:30:01 -04:00
|
|
|
Displays an error symbol.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxICON_ERROR}
|
2008-03-18 15:30:01 -04:00
|
|
|
Displays an error symbol - the same as wxICON_HAND.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxICON_QUESTION}
|
2008-03-18 15:30:01 -04:00
|
|
|
Displays a question mark symbol.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxICON_INFORMATION}
|
2008-03-18 15:30:01 -04:00
|
|
|
Displays an information symbol.
|
|
|
|
|
|
|
|
The return value is one of: wxYES, wxNO, wxCANCEL, wxOK. For example:
|
2008-03-09 08:33:59 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
2008-03-18 15:30:01 -04:00
|
|
|
int answer = wxMessageBox("Quit program?", "Confirm",
|
|
|
|
wxYES_NO | wxCANCEL, main_frame);
|
|
|
|
if (answer == wxYES)
|
|
|
|
main_frame->Close();
|
2008-03-08 08:52:38 -05:00
|
|
|
@endcode
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
@a message may contain newline characters, in which case the message will
|
|
|
|
be split into separate lines, to cater for large messages.
|
|
|
|
|
|
|
|
@header{wx/msgdlg.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
int wxMessageBox(const wxString& message,
|
|
|
|
const wxString& caption = "Message",
|
|
|
|
int style = wxOK,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindow* parent = NULL,
|
2008-03-08 08:52:38 -05:00
|
|
|
int x = -1, int y = -1);
|
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
//@}
|
|
|
|
|