]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msgdlg.h
check that the version of __sync_sub_and_fetch that returns a value is supported...
[wxWidgets.git] / include / wx / msgdlg.h
CommitLineData
e5b50758
WS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/msgdlgg.h
3// Purpose: common header and base class for wxMessageDialog
99d80019 4// Author: Julian Smart
e5b50758
WS
5// Modified by:
6// Created:
7// RCS-ID: $Id$
99d80019 8// Copyright: (c) Julian Smart
e5b50758
WS
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_MSGDLG_H_BASE_
13#define _WX_MSGDLG_H_BASE_
c801d85f 14
2ecf902b 15#include "wx/defs.h"
13a7abf9 16
e421922f
VZ
17#if wxUSE_MSGDLG
18
2afb9e16
VZ
19#include "wx/dialog.h"
20
f36e602b 21WXDLLEXPORT_DATA(extern const char) wxMessageBoxCaptionStr[];
2afb9e16
VZ
22
23class WXDLLEXPORT wxMessageDialogBase : public wxDialog
e5b50758 24{
2afb9e16
VZ
25public:
26 // ctors
27 wxMessageDialogBase() { m_dialogStyle = 0; }
28 wxMessageDialogBase(wxWindow *parent,
29 const wxString& message,
30 const wxString& caption,
31 long style)
32 : m_message(message),
33 m_caption(caption)
34 {
35 m_parent = parent;
36 SetMessageDialogStyle(style);
37 }
38
39 // virtual dtor for the base class
40 virtual ~wxMessageDialogBase() { }
41
42
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))
47 {
48 return false;
49 }
50
51 virtual bool SetYesNoCancelLabels(const wxString& WXUNUSED(yes),
52 const wxString& WXUNUSED(no),
53 const wxString& WXUNUSED(cancel))
54 {
55 return false;
56 }
57
58 virtual bool SetOKLabel(const wxString& WXUNUSED(ok))
59 {
60 return false;
61 }
62
63 virtual bool SetOKCancelLabels(const wxString& WXUNUSED(ok),
64 const wxString& WXUNUSED(cancel))
65 {
66 return false;
67 }
68
69 virtual void SetMessage(const wxString& message)
70 {
71 m_message = message;
72 }
73
74 virtual void SetExtendedMessage(const wxString& extendedMessage)
75 {
76 m_extendedMessage = extendedMessage;
77 }
78
e5b50758
WS
79protected:
80 // common validation of wxMessageDialog style
81 void SetMessageDialogStyle(long style)
82 {
83 wxASSERT_MSG( ((style & wxYES_NO) == wxYES_NO) || ((style & wxYES_NO) == 0),
84 _T("wxYES and wxNO may only be used together in wxMessageDialog") );
85
86 wxASSERT_MSG( (style & wxID_OK) != wxID_OK,
87 _T("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") );
88
89 m_dialogStyle = style;
90 }
2afb9e16
VZ
91
92 long GetMessageDialogStyle() const { return m_dialogStyle; }
93
94
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
e5b50758 98 {
2afb9e16
VZ
99 wxString msg = m_message;
100 if ( !m_extendedMessage.empty() )
101 msg << "\n\n" << m_extendedMessage;
102
103 return msg;
e5b50758
WS
104 }
105
2afb9e16
VZ
106 wxString m_message,
107 m_extendedMessage,
108 m_caption;
e5b50758
WS
109 long m_dialogStyle;
110};
111
2afb9e16
VZ
112#if defined(__WX_COMPILING_MSGDLGG_CPP__) || \
113 defined(__WXUNIVERSAL__) || defined(__WXGPE__) || \
2afb9e16
VZ
114 (defined(__WXGTK__) && !defined(__WXGTK20__))
115 #include "wx/generic/msgdlgg.h"
116
117 #define wxMessageDialog wxGenericMessageDialog
e9871aaf
DE
118#elif defined(__WXCOCOA__)
119 #include "wx/cocoa/msgdlg.h"
4055ed82 120#elif defined(__WXPALMOS__)
2afb9e16 121 #include "wx/palmos/msgdlg.h"
21709999 122#elif defined(__WXMSW__)
2afb9e16 123 #include "wx/msw/msgdlg.h"
2049ba38 124#elif defined(__WXMOTIF__)
2afb9e16 125 #include "wx/motif/msgdlg.h"
1be7a35c 126#elif defined(__WXGTK20__)
2afb9e16 127 #include "wx/gtk/msgdlg.h"
34138703 128#elif defined(__WXMAC__)
2afb9e16 129 #include "wx/mac/msgdlg.h"
1777b9bb 130#elif defined(__WXPM__)
2afb9e16 131 #include "wx/os2/msgdlg.h"
c801d85f
KB
132#endif
133
e421922f
VZ
134// ----------------------------------------------------------------------------
135// wxMessageBox: the simplest way to use wxMessageDialog
136// ----------------------------------------------------------------------------
137
138int WXDLLEXPORT wxMessageBox(const wxString& message,
e5b50758
WS
139 const wxString& caption = wxMessageBoxCaptionStr,
140 long style = wxOK | wxCENTRE,
141 wxWindow *parent = NULL,
142 int x = wxDefaultCoord, int y = wxDefaultCoord);
e421922f
VZ
143
144#endif // wxUSE_MSGDLG
145
2afb9e16 146#endif // _WX_MSGDLG_H_BASE_