]>
Commit | Line | Data |
---|---|---|
457814b5 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialogs.h | |
3 | // Purpose: Common dialogs demo | |
4 | // Author: Julian Smart | |
13188def | 5 | // Modified by: ABX (2004) - adjustementd for conditional building |
457814b5 JS |
6 | // Created: 04/01/98 |
7 | // RCS-ID: $Id$ | |
6aa89a22 | 8 | // Copyright: (c) Julian Smart |
c49245f8 | 9 | // Licence: wxWindows license |
457814b5 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef __DIALOGSH__ | |
13 | #define __DIALOGSH__ | |
14 | ||
13188def WS |
15 | #define USE_COLOURDLG_GENERIC \ |
16 | ( \ | |
17 | wxUSE_COLOURDLG && \ | |
63c83961 | 18 | ( defined(__WXMSW__) || defined(__WXMAC__) ) && \ |
13188def WS |
19 | !defined(__WXUNIVERSAL__) \ |
20 | ) | |
21 | ||
22 | ||
695fe764 | 23 | #define USE_DIRDLG_GENERIC \ |
13188def | 24 | ( \ |
695fe764 WS |
25 | wxUSE_DIRDLG && \ |
26 | ( defined(__WXMSW__) || defined(__WXMAC__) ) && \ | |
63c83961 WS |
27 | !defined(__WXUNIVERSAL__) \ |
28 | ) | |
29 | ||
695fe764 | 30 | #define USE_FILEDLG_GENERIC \ |
63c83961 | 31 | ( \ |
695fe764 WS |
32 | wxUSE_FILEDLG && \ |
33 | ( defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXPM__) ) && \ | |
34 | !defined(__WXUNIVERSAL__) \ | |
35 | ) | |
36 | ||
37 | #define USE_FONTDLG_GENERIC \ | |
38 | ( \ | |
39 | wxUSE_FONTDLG && \ | |
40 | ( defined(__WXMSW__) || defined(__WXPM__) ) && \ | |
13188def WS |
41 | !defined(__WXUNIVERSAL__) \ |
42 | ) | |
43 | ||
13188def WS |
44 | |
45 | #define USE_MODAL_PRESENTATION 1 | |
46 | ||
457814b5 JS |
47 | // Define a new application type |
48 | class MyApp: public wxApp | |
c49245f8 VZ |
49 | { |
50 | public: | |
51 | bool OnInit(); | |
457814b5 JS |
52 | |
53 | wxFont m_canvasFont; | |
54 | wxColour m_canvasTextColour; | |
55 | }; | |
56 | ||
f6bcfd97 | 57 | // A custom modeless dialog |
4c45f240 VZ |
58 | class MyModelessDialog : public wxDialog |
59 | { | |
60 | public: | |
61 | MyModelessDialog(wxWindow *parent); | |
abceee76 | 62 | |
5d987909 | 63 | void OnButton(wxCommandEvent& event); |
abceee76 VZ |
64 | void OnClose(wxCloseEvent& event); |
65 | ||
66 | private: | |
67 | DECLARE_EVENT_TABLE() | |
4c45f240 VZ |
68 | }; |
69 | ||
f6bcfd97 BP |
70 | // A custom modal dialog |
71 | class MyModalDialog : public wxDialog | |
72 | { | |
73 | public: | |
74 | MyModalDialog(wxWindow *parent); | |
75 | ||
76 | void OnButton(wxCommandEvent& event); | |
77 | ||
78 | private: | |
5315ebfa VZ |
79 | wxButton *m_btnModal, |
80 | *m_btnModeless, | |
81 | *m_btnDelete; | |
f6bcfd97 BP |
82 | |
83 | DECLARE_EVENT_TABLE() | |
84 | }; | |
85 | ||
457814b5 JS |
86 | // Define a new frame type |
87 | class MyFrame: public wxFrame | |
c49245f8 VZ |
88 | { |
89 | public: | |
13188def WS |
90 | MyFrame(wxWindow *parent, const wxString& title); |
91 | ||
92 | void MessageBox(wxCommandEvent& event); | |
457814b5 | 93 | |
13188def | 94 | #if wxUSE_COLOURDLG |
329e86bf | 95 | void ChooseColour(wxCommandEvent& event); |
13188def WS |
96 | #endif // wxUSE_COLOURDLG |
97 | ||
98 | #if wxUSE_FONTDLG | |
329e86bf | 99 | void ChooseFont(wxCommandEvent& event); |
13188def WS |
100 | #endif // wxUSE_FONTDLG |
101 | ||
102 | #if wxUSE_LOG_DIALOG | |
d93c719a | 103 | void LogDialog(wxCommandEvent& event); |
13188def WS |
104 | #endif // wxUSE_LOG_DIALOG |
105 | ||
106 | #if wxUSE_CHOICEDLG | |
457814b5 | 107 | void SingleChoice(wxCommandEvent& event); |
d6c9c1b7 | 108 | void MultiChoice(wxCommandEvent& event); |
13188def WS |
109 | #endif // wxUSE_CHOICEDLG |
110 | ||
111 | #if wxUSE_TEXTDLG | |
457814b5 | 112 | void TextEntry(wxCommandEvent& event); |
a294c6d5 | 113 | void PasswordEntry(wxCommandEvent& event); |
13188def WS |
114 | #endif // wxUSE_TEXTDLG |
115 | ||
116 | #if wxUSE_NUMBERDLG | |
c49245f8 | 117 | void NumericEntry(wxCommandEvent& event); |
13188def WS |
118 | #endif // wxUSE_NUMBERDLG |
119 | ||
120 | #if wxUSE_FILEDLG | |
457814b5 | 121 | void FileOpen(wxCommandEvent& event); |
35b45b33 | 122 | void FileOpen2(wxCommandEvent& event); |
c61f4f6d | 123 | void FilesOpen(wxCommandEvent& event); |
457814b5 | 124 | void FileSave(wxCommandEvent& event); |
13188def WS |
125 | #endif // wxUSE_FILEDLG |
126 | ||
695fe764 WS |
127 | #if USE_FILEDLG_GENERIC |
128 | void FileOpenGeneric(wxCommandEvent& event); | |
129 | void FilesOpenGeneric(wxCommandEvent& event); | |
130 | void FileSaveGeneric(wxCommandEvent& event); | |
131 | #endif // USE_FILEDLG_GENERIC | |
132 | ||
13188def | 133 | #if wxUSE_DIRDLG |
457814b5 | 134 | void DirChoose(wxCommandEvent& event); |
f09c8393 | 135 | void DirChooseNew(wxCommandEvent& event); |
13188def WS |
136 | #endif // wxUSE_DIRDLG |
137 | ||
138 | #if USE_DIRDLG_GENERIC | |
51a58d8b | 139 | void GenericDirChoose(wxCommandEvent& event); |
13188def WS |
140 | #endif // USE_DIRDLG_GENERIC |
141 | ||
142 | #if wxUSE_STARTUP_TIPS | |
c50f1fb9 | 143 | void ShowTip(wxCommandEvent& event); |
13188def WS |
144 | #endif // wxUSE_STARTUP_TIPS |
145 | ||
146 | #if USE_MODAL_PRESENTATION | |
f6bcfd97 | 147 | void ModalDlg(wxCommandEvent& event); |
4c45f240 | 148 | void ModelessDlg(wxCommandEvent& event); |
13188def WS |
149 | #endif // USE_MODAL_PRESENTATION |
150 | ||
761989ff | 151 | #if wxUSE_PROGRESSDLG |
abceee76 | 152 | void ShowProgress(wxCommandEvent& event); |
761989ff | 153 | #endif // wxUSE_PROGRESSDLG |
13188def | 154 | |
a62b0bcc VZ |
155 | #if wxUSE_BUSYINFO |
156 | void ShowBusyInfo(wxCommandEvent& event); | |
157 | #endif // wxUSE_BUSYINFO | |
13188def | 158 | |
761989ff VZ |
159 | #if wxUSE_FINDREPLDLG |
160 | void ShowFindDialog(wxCommandEvent& event); | |
161 | void ShowReplaceDialog(wxCommandEvent& event); | |
761989ff VZ |
162 | void OnFindDialog(wxFindDialogEvent& event); |
163 | #endif // wxUSE_FINDREPLDLG | |
457814b5 | 164 | |
13188def | 165 | #if USE_COLOURDLG_GENERIC |
329e86bf | 166 | void ChooseColourGeneric(wxCommandEvent& event); |
13188def WS |
167 | #endif // USE_COLOURDLG_GENERIC |
168 | ||
169 | #if USE_FONTDLG_GENERIC | |
329e86bf | 170 | void ChooseFontGeneric(wxCommandEvent& event); |
13188def | 171 | #endif // USE_FONTDLG_GENERIC |
c49245f8 | 172 | |
329e86bf | 173 | void OnExit(wxCommandEvent& event); |
c49245f8 | 174 | |
4c45f240 | 175 | private: |
13188def | 176 | #if wxUSE_DIRDLG |
f09c8393 | 177 | void DoDirChoose(int style); |
13188def | 178 | #endif // wxUSE_DIRDLG |
f09c8393 | 179 | |
13188def | 180 | #if USE_MODAL_PRESENTATION |
4c45f240 | 181 | MyModelessDialog *m_dialog; |
13188def | 182 | #endif // USE_MODAL_PRESENTATION |
4c45f240 | 183 | |
761989ff VZ |
184 | #if wxUSE_FINDREPLDLG |
185 | wxFindReplaceData m_findData; | |
14fca738 VZ |
186 | |
187 | wxFindReplaceDialog *m_dlgFind, | |
188 | *m_dlgReplace; | |
761989ff VZ |
189 | #endif // wxUSE_FINDREPLDLG |
190 | ||
d33dd9ef VS |
191 | wxColourData m_clrData; |
192 | ||
4c45f240 | 193 | DECLARE_EVENT_TABLE() |
457814b5 JS |
194 | }; |
195 | ||
196 | class MyCanvas: public wxScrolledWindow | |
197 | { | |
c49245f8 | 198 | public: |
c2c0dabf | 199 | MyCanvas(wxWindow *parent) : |
13188def | 200 | wxScrolledWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxNO_FULL_REPAINT_ON_RESIZE) { } |
c49245f8 VZ |
201 | |
202 | void OnPaint(wxPaintEvent& event); | |
203 | ||
204 | DECLARE_EVENT_TABLE() | |
457814b5 JS |
205 | }; |
206 | ||
207 | ||
208 | // Menu IDs | |
a294c6d5 VZ |
209 | enum |
210 | { | |
13188def | 211 | DIALOGS_CHOOSE_COLOUR = wxID_HIGHEST, |
a294c6d5 VZ |
212 | DIALOGS_CHOOSE_COLOUR_GENERIC, |
213 | DIALOGS_CHOOSE_FONT, | |
214 | DIALOGS_CHOOSE_FONT_GENERIC, | |
215 | DIALOGS_MESSAGE_BOX, | |
216 | DIALOGS_SINGLE_CHOICE, | |
d6c9c1b7 | 217 | DIALOGS_MULTI_CHOICE, |
a294c6d5 VZ |
218 | DIALOGS_TEXT_ENTRY, |
219 | DIALOGS_PASSWORD_ENTRY, | |
220 | DIALOGS_FILE_OPEN, | |
35b45b33 | 221 | DIALOGS_FILE_OPEN2, |
a294c6d5 VZ |
222 | DIALOGS_FILES_OPEN, |
223 | DIALOGS_FILE_SAVE, | |
695fe764 WS |
224 | DIALOGS_FILE_OPEN_GENERIC, |
225 | DIALOGS_FILES_OPEN_GENERIC, | |
226 | DIALOGS_FILE_SAVE_GENERIC, | |
a294c6d5 | 227 | DIALOGS_DIR_CHOOSE, |
f09c8393 | 228 | DIALOGS_DIRNEW_CHOOSE, |
51a58d8b | 229 | DIALOGS_GENERIC_DIR_CHOOSE, |
a294c6d5 VZ |
230 | DIALOGS_TIP, |
231 | DIALOGS_NUM_ENTRY, | |
4c45f240 | 232 | DIALOGS_LOG_DIALOG, |
f6bcfd97 | 233 | DIALOGS_MODAL, |
4c45f240 | 234 | DIALOGS_MODELESS, |
abceee76 | 235 | DIALOGS_MODELESS_BTN, |
761989ff | 236 | DIALOGS_PROGRESS, |
a62b0bcc | 237 | DIALOGS_BUSYINFO, |
761989ff VZ |
238 | DIALOGS_FIND, |
239 | DIALOGS_REPLACE | |
a294c6d5 | 240 | }; |
457814b5 JS |
241 | |
242 | #endif | |
243 |