]> git.saurik.com Git - wxWidgets.git/blame - samples/dialogs/dialogs.h
Missed labels to replace number of 'topicNNN' in anchors. Consistent use of -dtor...
[wxWidgets.git] / samples / dialogs / dialogs.h
CommitLineData
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
4c8fc4d6
WS
12/*
13This sample shows how to use the common dialogs available from wxWidgets.
14It also shows that generic implementations of common dialogs can be exchanged
15with native dialogs and can coexist in one application. The need for generic
16dialogs addition is recognized thanks to setup of below USE_*** setting. Their
17combinations reflects conditions of makefiles and project files to avoid unresolved
18references during linking. For now some generic dialogs are added in static builds
19of MSW, MAC and OS2
20*/
21
457814b5
JS
22#ifndef __DIALOGSH__
23#define __DIALOGSH__
24
da7a8602
WS
25#ifdef __WXUNIVERSAL__
26 #define USE_WXUNIVERSAL 1
27#else
28 #define USE_WXUNIVERSAL 0
29#endif
30
f50ff87b
WS
31#ifdef WXUSINGDLL
32 #define USE_DLL 1
33#else
34 #define USE_DLL 0
35#endif
36
b6352c09 37#if defined(__WXMSW__) && !defined(__WXWINCE__)
da7a8602
WS
38 #define USE_WXMSW 1
39#else
40 #define USE_WXMSW 0
41#endif
42
43#ifdef __WXMAC__
44 #define USE_WXMAC 1
45#else
46 #define USE_WXMAC 0
47#endif
48
49#ifdef __WXGTK__
50 #define USE_WXGTK 1
51#else
52 #define USE_WXGTK 0
53#endif
54
55#ifdef __WXPM__
56 #define USE_WXPM 1
57#else
58 #define USE_WXPM 0
59#endif
60
29e3d1f9 61#define USE_GENERIC_DIALOGS (!USE_WXUNIVERSAL && !USE_DLL)
13188def 62
29e3d1f9
VZ
63#define USE_COLOURDLG_GENERIC \
64 ((USE_WXMSW || USE_WXMAC) && USE_GENERIC_DIALOGS && wxUSE_COLOURDLG)
65#define USE_DIRDLG_GENERIC \
66 ((USE_WXMSW || USE_WXMAC) && USE_GENERIC_DIALOGS && wxUSE_DIRDLG)
67#define USE_FILEDLG_GENERIC \
68 ((USE_WXMSW || USE_WXMAC || USE_WXPM) && USE_GENERIC_DIALOGS && wxUSE_FILEDLG)
69#define USE_FONTDLG_GENERIC \
70 ((USE_WXMSW || USE_WXPM) && USE_GENERIC_DIALOGS && wxUSE_FONTDLG)
13188def 71
4c8fc4d6
WS
72
73// Turn to 0 if there is any reason for not presenting difference between
74// modal and modeless dialogs (ie. not implemented it in your port yet)
75#define USE_MODAL_PRESENTATION 1
76
13188def 77
457814b5
JS
78// Define a new application type
79class MyApp: public wxApp
c49245f8
VZ
80{
81public:
82 bool OnInit();
457814b5
JS
83
84 wxFont m_canvasFont;
85 wxColour m_canvasTextColour;
86};
87
b4954d19
WS
88#if USE_MODAL_PRESENTATION
89
f6bcfd97 90// A custom modeless dialog
4c45f240
VZ
91class MyModelessDialog : public wxDialog
92{
93public:
94 MyModelessDialog(wxWindow *parent);
abceee76 95
5d987909 96 void OnButton(wxCommandEvent& event);
abceee76
VZ
97 void OnClose(wxCloseEvent& event);
98
99private:
100 DECLARE_EVENT_TABLE()
4c45f240
VZ
101};
102
f6bcfd97
BP
103// A custom modal dialog
104class MyModalDialog : public wxDialog
105{
106public:
107 MyModalDialog(wxWindow *parent);
108
109 void OnButton(wxCommandEvent& event);
110
111private:
5315ebfa
VZ
112 wxButton *m_btnModal,
113 *m_btnModeless,
114 *m_btnDelete;
f6bcfd97
BP
115
116 DECLARE_EVENT_TABLE()
117};
118
b4954d19
WS
119#endif // USE_MODAL_PRESENTATION
120
457814b5
JS
121// Define a new frame type
122class MyFrame: public wxFrame
c49245f8
VZ
123{
124public:
13188def
WS
125 MyFrame(wxWindow *parent, const wxString& title);
126
127 void MessageBox(wxCommandEvent& event);
457814b5 128
13188def 129#if wxUSE_COLOURDLG
329e86bf 130 void ChooseColour(wxCommandEvent& event);
13188def
WS
131#endif // wxUSE_COLOURDLG
132
133#if wxUSE_FONTDLG
329e86bf 134 void ChooseFont(wxCommandEvent& event);
13188def
WS
135#endif // wxUSE_FONTDLG
136
137#if wxUSE_LOG_DIALOG
d93c719a 138 void LogDialog(wxCommandEvent& event);
13188def
WS
139#endif // wxUSE_LOG_DIALOG
140
141#if wxUSE_CHOICEDLG
457814b5 142 void SingleChoice(wxCommandEvent& event);
d6c9c1b7 143 void MultiChoice(wxCommandEvent& event);
13188def
WS
144#endif // wxUSE_CHOICEDLG
145
146#if wxUSE_TEXTDLG
457814b5 147 void TextEntry(wxCommandEvent& event);
a294c6d5 148 void PasswordEntry(wxCommandEvent& event);
13188def
WS
149#endif // wxUSE_TEXTDLG
150
151#if wxUSE_NUMBERDLG
c49245f8 152 void NumericEntry(wxCommandEvent& event);
13188def
WS
153#endif // wxUSE_NUMBERDLG
154
155#if wxUSE_FILEDLG
457814b5 156 void FileOpen(wxCommandEvent& event);
35b45b33 157 void FileOpen2(wxCommandEvent& event);
c61f4f6d 158 void FilesOpen(wxCommandEvent& event);
457814b5 159 void FileSave(wxCommandEvent& event);
13188def
WS
160#endif // wxUSE_FILEDLG
161
695fe764
WS
162#if USE_FILEDLG_GENERIC
163 void FileOpenGeneric(wxCommandEvent& event);
164 void FilesOpenGeneric(wxCommandEvent& event);
165 void FileSaveGeneric(wxCommandEvent& event);
166#endif // USE_FILEDLG_GENERIC
167
13188def 168#if wxUSE_DIRDLG
457814b5 169 void DirChoose(wxCommandEvent& event);
f09c8393 170 void DirChooseNew(wxCommandEvent& event);
13188def
WS
171#endif // wxUSE_DIRDLG
172
173#if USE_DIRDLG_GENERIC
51a58d8b 174 void GenericDirChoose(wxCommandEvent& event);
13188def
WS
175#endif // USE_DIRDLG_GENERIC
176
177#if wxUSE_STARTUP_TIPS
c50f1fb9 178 void ShowTip(wxCommandEvent& event);
13188def
WS
179#endif // wxUSE_STARTUP_TIPS
180
181#if USE_MODAL_PRESENTATION
f6bcfd97 182 void ModalDlg(wxCommandEvent& event);
4c45f240 183 void ModelessDlg(wxCommandEvent& event);
13188def
WS
184#endif // USE_MODAL_PRESENTATION
185
761989ff 186#if wxUSE_PROGRESSDLG
abceee76 187 void ShowProgress(wxCommandEvent& event);
761989ff 188#endif // wxUSE_PROGRESSDLG
13188def 189
a62b0bcc
VZ
190#if wxUSE_BUSYINFO
191 void ShowBusyInfo(wxCommandEvent& event);
192#endif // wxUSE_BUSYINFO
13188def 193
761989ff
VZ
194#if wxUSE_FINDREPLDLG
195 void ShowFindDialog(wxCommandEvent& event);
196 void ShowReplaceDialog(wxCommandEvent& event);
761989ff
VZ
197 void OnFindDialog(wxFindDialogEvent& event);
198#endif // wxUSE_FINDREPLDLG
457814b5 199
13188def 200#if USE_COLOURDLG_GENERIC
329e86bf 201 void ChooseColourGeneric(wxCommandEvent& event);
13188def
WS
202#endif // USE_COLOURDLG_GENERIC
203
204#if USE_FONTDLG_GENERIC
329e86bf 205 void ChooseFontGeneric(wxCommandEvent& event);
13188def 206#endif // USE_FONTDLG_GENERIC
c49245f8 207
29e3d1f9 208 void OnRequestUserAttention(wxCommandEvent& event);
329e86bf 209 void OnExit(wxCommandEvent& event);
c49245f8 210
4c45f240 211private:
13188def 212#if wxUSE_DIRDLG
f09c8393 213 void DoDirChoose(int style);
13188def 214#endif // wxUSE_DIRDLG
f09c8393 215
13188def 216#if USE_MODAL_PRESENTATION
4c45f240 217 MyModelessDialog *m_dialog;
13188def 218#endif // USE_MODAL_PRESENTATION
4c45f240 219
761989ff
VZ
220#if wxUSE_FINDREPLDLG
221 wxFindReplaceData m_findData;
14fca738
VZ
222
223 wxFindReplaceDialog *m_dlgFind,
224 *m_dlgReplace;
761989ff
VZ
225#endif // wxUSE_FINDREPLDLG
226
d33dd9ef
VS
227 wxColourData m_clrData;
228
4c45f240 229 DECLARE_EVENT_TABLE()
457814b5
JS
230};
231
232class MyCanvas: public wxScrolledWindow
233{
c49245f8 234public:
c2c0dabf 235 MyCanvas(wxWindow *parent) :
13188def 236 wxScrolledWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxNO_FULL_REPAINT_ON_RESIZE) { }
c49245f8
VZ
237
238 void OnPaint(wxPaintEvent& event);
239
240 DECLARE_EVENT_TABLE()
457814b5
JS
241};
242
243
244// Menu IDs
a294c6d5
VZ
245enum
246{
13188def 247 DIALOGS_CHOOSE_COLOUR = wxID_HIGHEST,
a294c6d5
VZ
248 DIALOGS_CHOOSE_COLOUR_GENERIC,
249 DIALOGS_CHOOSE_FONT,
250 DIALOGS_CHOOSE_FONT_GENERIC,
251 DIALOGS_MESSAGE_BOX,
252 DIALOGS_SINGLE_CHOICE,
d6c9c1b7 253 DIALOGS_MULTI_CHOICE,
a294c6d5
VZ
254 DIALOGS_TEXT_ENTRY,
255 DIALOGS_PASSWORD_ENTRY,
256 DIALOGS_FILE_OPEN,
35b45b33 257 DIALOGS_FILE_OPEN2,
a294c6d5
VZ
258 DIALOGS_FILES_OPEN,
259 DIALOGS_FILE_SAVE,
695fe764
WS
260 DIALOGS_FILE_OPEN_GENERIC,
261 DIALOGS_FILES_OPEN_GENERIC,
262 DIALOGS_FILE_SAVE_GENERIC,
a294c6d5 263 DIALOGS_DIR_CHOOSE,
f09c8393 264 DIALOGS_DIRNEW_CHOOSE,
51a58d8b 265 DIALOGS_GENERIC_DIR_CHOOSE,
a294c6d5
VZ
266 DIALOGS_TIP,
267 DIALOGS_NUM_ENTRY,
4c45f240 268 DIALOGS_LOG_DIALOG,
f6bcfd97 269 DIALOGS_MODAL,
4c45f240 270 DIALOGS_MODELESS,
abceee76 271 DIALOGS_MODELESS_BTN,
761989ff 272 DIALOGS_PROGRESS,
a62b0bcc 273 DIALOGS_BUSYINFO,
761989ff 274 DIALOGS_FIND,
29e3d1f9
VZ
275 DIALOGS_REPLACE,
276 DIALOGS_REQUEST
a294c6d5 277};
457814b5
JS
278
279#endif
280