1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: common header and base class for wxMessageDialog
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MSGDLG_H_BASE_
13 #define _WX_MSGDLG_H_BASE_
19 #include "wx/dialog.h"
21 WXDLLEXPORT_DATA(extern const wxChar
) wxMessageBoxCaptionStr
[];
23 class WXDLLEXPORT wxMessageDialogBase
: public wxDialog
27 wxMessageDialogBase() { m_dialogStyle
= 0; }
28 wxMessageDialogBase(wxWindow
*parent
,
29 const wxString
& message
,
30 const wxString
& caption
,
36 SetMessageDialogStyle(style
);
39 // virtual dtor for the base class
40 virtual ~wxMessageDialogBase() { }
43 // methods for setting up more custom message dialogs -- all functions
44 // return false if they're not implemented
45 virtual bool SetYesNoLabels(const wxString
& WXUNUSED(yes
),
46 const wxString
& WXUNUSED(no
))
51 virtual bool SetYesNoCancelLabels(const wxString
& WXUNUSED(yes
),
52 const wxString
& WXUNUSED(no
),
53 const wxString
& WXUNUSED(cancel
))
58 virtual bool SetOKLabel(const wxString
& WXUNUSED(ok
))
63 virtual bool SetOKCancelLabels(const wxString
& WXUNUSED(ok
),
64 const wxString
& WXUNUSED(cancel
))
69 virtual void SetMessage(const wxString
& message
)
74 virtual void SetExtendedMessage(const wxString
& extendedMessage
)
76 m_extendedMessage
= extendedMessage
;
80 // common validation of wxMessageDialog style
81 void SetMessageDialogStyle(long style
)
83 wxASSERT_MSG( ((style
& wxYES_NO
) == wxYES_NO
) || ((style
& wxYES_NO
) == 0),
84 _T("wxYES and wxNO may only be used together in wxMessageDialog") );
86 wxASSERT_MSG( (style
& wxID_OK
) != wxID_OK
,
87 _T("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") );
89 m_dialogStyle
= style
;
92 long GetMessageDialogStyle() const { return m_dialogStyle
; }
95 // for the platforms not supporting separate main and extended messages
96 // this function should be used to combine both of them in a single string
97 wxString
GetFullMessage() const
99 wxString msg
= m_message
;
100 if ( !m_extendedMessage
.empty() )
101 msg
<< "\n\n" << m_extendedMessage
;
112 #if defined(__WX_COMPILING_MSGDLGG_CPP__) || \
113 defined(__WXUNIVERSAL__) || defined(__WXGPE__) || \
114 defined(__WXCOCOA__) || \
115 (defined(__WXGTK__) && !defined(__WXGTK20__))
116 #include "wx/generic/msgdlgg.h"
118 #define wxMessageDialog wxGenericMessageDialog
119 #elif defined(__WXPALMOS__)
120 #include "wx/palmos/msgdlg.h"
121 #elif defined(__WXMSW__)
122 #include "wx/msw/msgdlg.h"
123 #elif defined(__WXMOTIF__)
124 #include "wx/motif/msgdlg.h"
125 #elif defined(__WXGTK20__)
126 #include "wx/gtk/msgdlg.h"
127 #elif defined(__WXMAC__)
128 #include "wx/mac/msgdlg.h"
129 #elif defined(__WXPM__)
130 #include "wx/os2/msgdlg.h"
133 // ----------------------------------------------------------------------------
134 // wxMessageBox: the simplest way to use wxMessageDialog
135 // ----------------------------------------------------------------------------
137 int WXDLLEXPORT
wxMessageBox(const wxString
& message
,
138 const wxString
& caption
= wxMessageBoxCaptionStr
,
139 long style
= wxOK
| wxCENTRE
,
140 wxWindow
*parent
= NULL
,
141 int x
= wxDefaultCoord
, int y
= wxDefaultCoord
);
143 #endif // wxUSE_MSGDLG
145 #endif // _WX_MSGDLG_H_BASE_