]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/dialog.h | |
3 | // Purpose: wxDialogBase class | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 29.06.99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Vadim Zeitlin | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_DIALOG_H_BASE_ | |
13 | #define _WX_DIALOG_H_BASE_ | |
14 | ||
15 | #include "wx/defs.h" | |
16 | #include "wx/containr.h" | |
17 | #include "wx/toplevel.h" | |
18 | ||
19 | class WXDLLEXPORT wxSizer; | |
20 | class WXDLLEXPORT wxStdDialogButtonSizer; | |
21 | ||
22 | #define wxDIALOG_NO_PARENT 0x0001 // Don't make owned by apps top window | |
23 | ||
24 | #ifdef __WXWINCE__ | |
25 | #define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxMAXIMIZE | wxCLOSE_BOX | wxNO_BORDER) | |
26 | #else | |
27 | #define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX) | |
28 | #endif | |
29 | ||
30 | extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[]; | |
31 | ||
32 | class WXDLLEXPORT wxDialogBase : public wxTopLevelWindow | |
33 | { | |
34 | public: | |
35 | ||
36 | enum | |
37 | { | |
38 | // all flags allowed in wxDialogBase::CreateButtonSizer() | |
39 | ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT | |
40 | }; | |
41 | ||
42 | wxDialogBase() { Init(); } | |
43 | virtual ~wxDialogBase() { } | |
44 | ||
45 | void Init(); | |
46 | ||
47 | // Modal dialogs have a return code - usually the id of the last | |
48 | // pressed button | |
49 | void SetReturnCode(int returnCode) { m_returnCode = returnCode; } | |
50 | int GetReturnCode() const { return m_returnCode; } | |
51 | ||
52 | // The identifier for the affirmative button | |
53 | void SetAffirmativeId(int affirmativeId) { m_affirmativeId = affirmativeId; } | |
54 | int GetAffirmativeId() const { return m_affirmativeId; } | |
55 | ||
56 | // Identifier for Esc key translation | |
57 | void SetEscapeId(int escapeId) { m_escapeId = escapeId; } | |
58 | int GetEscapeId() const { return m_escapeId; } | |
59 | ||
60 | #if wxUSE_STATTEXT // && wxUSE_TEXTCTRL | |
61 | // splits text up at newlines and places the | |
62 | // lines into a vertical wxBoxSizer | |
63 | wxSizer *CreateTextSizer( const wxString &message ); | |
64 | #endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL | |
65 | ||
66 | // places buttons into a horizontal wxBoxSizer | |
67 | wxSizer *CreateButtonSizer( long flags, | |
68 | bool separated = false, | |
69 | wxCoord distance = 0 ); | |
70 | #if wxUSE_BUTTON | |
71 | wxStdDialogButtonSizer *CreateStdDialogButtonSizer( long flags ); | |
72 | #endif // wxUSE_BUTTON | |
73 | ||
74 | protected: | |
75 | // The return code from modal dialog | |
76 | int m_returnCode; | |
77 | ||
78 | // The identifier for the affirmative button (usually wxID_OK) | |
79 | int m_affirmativeId; | |
80 | ||
81 | // The identifier for cancel button (usually wxID_CANCEL) | |
82 | int m_escapeId; | |
83 | ||
84 | DECLARE_NO_COPY_CLASS(wxDialogBase) | |
85 | DECLARE_EVENT_TABLE() | |
86 | WX_DECLARE_CONTROL_CONTAINER(); | |
87 | }; | |
88 | ||
89 | ||
90 | #if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__) | |
91 | #include "wx/univ/dialog.h" | |
92 | #else | |
93 | #if defined(__WXPALMOS__) | |
94 | #include "wx/palmos/dialog.h" | |
95 | #elif defined(__WXMSW__) | |
96 | #include "wx/msw/dialog.h" | |
97 | #elif defined(__WXMOTIF__) | |
98 | #include "wx/motif/dialog.h" | |
99 | #elif defined(__WXGTK__) | |
100 | #include "wx/gtk/dialog.h" | |
101 | #elif defined(__WXMAC__) | |
102 | #include "wx/mac/dialog.h" | |
103 | #elif defined(__WXCOCOA__) | |
104 | #include "wx/cocoa/dialog.h" | |
105 | #elif defined(__WXPM__) | |
106 | #include "wx/os2/dialog.h" | |
107 | #endif | |
108 | #endif | |
109 | ||
110 | #endif | |
111 | // _WX_DIALOG_H_BASE_ |