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