]> git.saurik.com Git - wxWidgets.git/blame - samples/dialogs/dialogs.cpp
Fix compilation error
[wxWidgets.git] / samples / dialogs / dialogs.cpp
CommitLineData
457814b5
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: dialogs.cpp
3// Purpose: Common dialogs demo
4// Author: Julian Smart
695fe764 5// Modified by: ABX (2004) - adjustements for conditional building + new menu
457814b5
JS
6// Created: 04/01/98
7// RCS-ID: $Id$
6aa89a22 8// Copyright: (c) Julian Smart
c50f1fb9 9// Licence: wxWindows license
457814b5
JS
10/////////////////////////////////////////////////////////////////////////////
11
457814b5
JS
12// For compilers that support precompilation, includes "wx/wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
16#pragma hdrstop
17#endif
18
19#ifndef WX_PRECOMP
20#include "wx/wx.h"
21#endif
22
0f5d8ecf
JS
23#include "../sample.xpm"
24
fb8a56b7 25#include "wx/datetime.h"
f517634c 26#include "wx/image.h"
5378558e 27#include "wx/bookctrl.h"
cc8bc5aa 28#include "wx/artprov.h"
2b923807 29#include "wx/imaglist.h"
684883e3 30#include "wx/sysopt.h"
457814b5 31
13188def
WS
32#if wxUSE_COLOURDLG
33 #include "wx/colordlg.h"
34#endif // wxUSE_COLOURDLG
dfad0599 35
13188def
WS
36#if wxUSE_CHOICEDLG
37 #include "wx/choicdlg.h"
38#endif // wxUSE_CHOICEDLG
457814b5 39
13188def
WS
40#if wxUSE_STARTUP_TIPS
41 #include "wx/tipdlg.h"
42#endif // wxUSE_STARTUP_TIPS
d7d17624 43
13188def 44#if wxUSE_PROGRESSDLG
9b16ffef 45#if wxUSE_STOPWATCH && wxUSE_LONGLONG
b20edf8b 46 #include "wx/datetime.h" // wxDateTime
9b16ffef
VZ
47#endif
48
13188def
WS
49 #include "wx/progdlg.h"
50#endif // wxUSE_PROGRESSDLG
51
52#if wxUSE_BUSYINFO
53 #include "wx/busyinfo.h"
54#endif // wxUSE_BUSYINFO
55
56#if wxUSE_NUMBERDLG
57 #include "wx/numdlg.h"
58#endif // wxUSE_NUMBERDLG
59
60#if wxUSE_FILEDLG
61 #include "wx/filedlg.h"
62#endif // wxUSE_FILEDLG
63
64#if wxUSE_DIRDLG
65 #include "wx/dirdlg.h"
66#endif // wxUSE_DIRDLG
67
68#if wxUSE_FONTDLG
69 #include "wx/fontdlg.h"
70#endif // wxUSE_FONTDLG
71
72#if wxUSE_FINDREPLDLG
73 #include "wx/fdrepdlg.h"
74#endif // wxUSE_FINDREPLDLG
4ad3c82f 75
62675ef3 76#if wxUSE_SPINCTRL
0f5d8ecf 77#include "wx/spinctrl.h"
62675ef3
JS
78#endif
79
0f5d8ecf
JS
80#include "wx/propdlg.h"
81
457814b5
JS
82#include "dialogs.h"
83
13188def
WS
84#if USE_COLOURDLG_GENERIC
85 #include "wx/generic/colrdlgg.h"
86#endif // USE_COLOURDLG_GENERIC
87
13188def
WS
88#if USE_DIRDLG_GENERIC
89 #include "wx/generic/dirdlgg.h"
90#endif // USE_DIRDLG_GENERIC
91
695fe764
WS
92#if USE_FILEDLG_GENERIC
93 #include "wx/generic/filedlgg.h"
94#endif // USE_FILEDLG_GENERIC
95
96#if USE_FONTDLG_GENERIC
97 #include "wx/generic/fontdlgg.h"
98#endif // USE_FONTDLG_GENERIC
99
457814b5
JS
100IMPLEMENT_APP(MyApp)
101
4c45f240
VZ
102BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
103 EVT_PAINT(MyCanvas::OnPaint)
104END_EVENT_TABLE()
105
13188def
WS
106
107
4c45f240 108BEGIN_EVENT_TABLE(MyFrame, wxFrame)
13188def
WS
109 EVT_MENU(DIALOGS_MESSAGE_BOX, MyFrame::MessageBox)
110
111#if wxUSE_COLOURDLG
4c45f240 112 EVT_MENU(DIALOGS_CHOOSE_COLOUR, MyFrame::ChooseColour)
13188def
WS
113#endif // wxUSE_COLOURDLG
114
115#if wxUSE_FONTDLG
4c45f240 116 EVT_MENU(DIALOGS_CHOOSE_FONT, MyFrame::ChooseFont)
13188def
WS
117#endif // wxUSE_FONTDLG
118
119#if wxUSE_LOG_DIALOG
4c45f240 120 EVT_MENU(DIALOGS_LOG_DIALOG, MyFrame::LogDialog)
13188def
WS
121#endif // wxUSE_LOG_DIALOG
122
123#if wxUSE_TEXTDLG
4c45f240
VZ
124 EVT_MENU(DIALOGS_TEXT_ENTRY, MyFrame::TextEntry)
125 EVT_MENU(DIALOGS_PASSWORD_ENTRY, MyFrame::PasswordEntry)
13188def
WS
126#endif // wxUSE_TEXTDLG
127
128#if wxUSE_NUMBERDLG
4c45f240 129 EVT_MENU(DIALOGS_NUM_ENTRY, MyFrame::NumericEntry)
13188def
WS
130#endif // wxUSE_NUMBERDLG
131
132#if wxUSE_CHOICEDLG
4c45f240 133 EVT_MENU(DIALOGS_SINGLE_CHOICE, MyFrame::SingleChoice)
d6c9c1b7 134 EVT_MENU(DIALOGS_MULTI_CHOICE, MyFrame::MultiChoice)
13188def
WS
135#endif // wxUSE_CHOICEDLG
136
137#if wxUSE_FILEDLG
4c45f240 138 EVT_MENU(DIALOGS_FILE_OPEN, MyFrame::FileOpen)
35b45b33 139 EVT_MENU(DIALOGS_FILE_OPEN2, MyFrame::FileOpen2)
4c45f240
VZ
140 EVT_MENU(DIALOGS_FILES_OPEN, MyFrame::FilesOpen)
141 EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave)
13188def
WS
142#endif // wxUSE_FILEDLG
143
695fe764
WS
144#if USE_FILEDLG_GENERIC
145 EVT_MENU(DIALOGS_FILE_OPEN_GENERIC, MyFrame::FileOpenGeneric)
146 EVT_MENU(DIALOGS_FILES_OPEN_GENERIC, MyFrame::FilesOpenGeneric)
147 EVT_MENU(DIALOGS_FILE_SAVE_GENERIC, MyFrame::FileSaveGeneric)
148#endif // USE_FILEDLG_GENERIC
149
13188def 150#if wxUSE_DIRDLG
4c45f240 151 EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose)
f09c8393 152 EVT_MENU(DIALOGS_DIRNEW_CHOOSE, MyFrame::DirChooseNew)
13188def
WS
153#endif // wxUSE_DIRDLG
154
155#if USE_MODAL_PRESENTATION
f6bcfd97 156 EVT_MENU(DIALOGS_MODAL, MyFrame::ModalDlg)
4c45f240 157 EVT_MENU(DIALOGS_MODELESS, MyFrame::ModelessDlg)
cae50e6b
VZ
158 EVT_MENU(DIALOGS_CENTRE_SCREEN, MyFrame::DlgCenteredScreen)
159 EVT_MENU(DIALOGS_CENTRE_PARENT, MyFrame::DlgCenteredParent)
13188def
WS
160#endif // USE_MODAL
161
162#if wxUSE_STARTUP_TIPS
4c45f240 163 EVT_MENU(DIALOGS_TIP, MyFrame::ShowTip)
13188def
WS
164#endif // wxUSE_STARTUP_TIPS
165
166#if USE_FONTDLG_GENERIC
4c45f240 167 EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC, MyFrame::ChooseFontGeneric)
13188def
WS
168#endif // USE_FONTDLG_GENERIC
169
170#if USE_DIRDLG_GENERIC
171 EVT_MENU(DIALOGS_GENERIC_DIR_CHOOSE, MyFrame::GenericDirChoose)
172#endif // wxMSW || wxMAC
173
174#if USE_COLOURDLG_GENERIC
175 EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC, MyFrame::ChooseColourGeneric)
176#endif // USE_COLOURDLG_GENERIC
a62b0bcc 177
abceee76
VZ
178#if wxUSE_PROGRESSDLG
179 EVT_MENU(DIALOGS_PROGRESS, MyFrame::ShowProgress)
761989ff 180#endif // wxUSE_PROGRESSDLG
a62b0bcc
VZ
181
182#if wxUSE_BUSYINFO
183 EVT_MENU(DIALOGS_BUSYINFO, MyFrame::ShowBusyInfo)
184#endif // wxUSE_BUSYINFO
185
761989ff
VZ
186#if wxUSE_FINDREPLDLG
187 EVT_MENU(DIALOGS_FIND, MyFrame::ShowFindDialog)
188 EVT_MENU(DIALOGS_REPLACE, MyFrame::ShowReplaceDialog)
189
13188def
WS
190 EVT_FIND(wxID_ANY, MyFrame::OnFindDialog)
191 EVT_FIND_NEXT(wxID_ANY, MyFrame::OnFindDialog)
192 EVT_FIND_REPLACE(wxID_ANY, MyFrame::OnFindDialog)
193 EVT_FIND_REPLACE_ALL(wxID_ANY, MyFrame::OnFindDialog)
194 EVT_FIND_CLOSE(wxID_ANY, MyFrame::OnFindDialog)
761989ff 195#endif // wxUSE_FINDREPLDLG
13188def 196
532d575b 197#if USE_SETTINGS_DIALOG
0f5d8ecf 198 EVT_MENU(DIALOGS_PROPERTY_SHEET, MyFrame::OnPropertySheet)
cc8bc5aa 199 EVT_MENU(DIALOGS_PROPERTY_SHEET_TOOLBOOK, MyFrame::OnPropertySheetToolBook)
532d575b
WS
200#endif
201
0f5d8ecf 202 EVT_MENU(DIALOGS_REQUEST, MyFrame::OnRequestUserAttention)
9b16ffef 203
4c45f240 204 EVT_MENU(wxID_EXIT, MyFrame::OnExit)
4c45f240 205END_EVENT_TABLE()
abceee76 206
13188def 207#if USE_MODAL_PRESENTATION
f6bcfd97 208
13188def
WS
209 BEGIN_EVENT_TABLE(MyModalDialog, wxDialog)
210 EVT_BUTTON(wxID_ANY, MyModalDialog::OnButton)
211 END_EVENT_TABLE()
5d987909 212
13188def
WS
213 BEGIN_EVENT_TABLE(MyModelessDialog, wxDialog)
214 EVT_BUTTON(DIALOGS_MODELESS_BTN, MyModelessDialog::OnButton)
215 EVT_CLOSE(MyModelessDialog::OnClose)
216 END_EVENT_TABLE()
217
218#endif // USE_MODAL_PRESENTATION
abceee76 219
c67daf87 220MyCanvas *myCanvas = (MyCanvas *) NULL;
457814b5 221
457814b5 222// `Main program' equivalent, creating windows and returning main app frame
4c45f240 223bool MyApp::OnInit()
457814b5 224{
f517634c 225#if wxUSE_IMAGE
013e1fee 226 wxInitAllImageHandlers();
f517634c 227#endif
013e1fee 228
13188def
WS
229 m_canvasTextColour = wxColour(_T("BLACK"));
230 m_canvasFont = *wxNORMAL_FONT;
457814b5 231
13188def
WS
232 // Create the main frame window
233 MyFrame *frame = new MyFrame((wxFrame *) NULL, _T("wxWidgets dialogs example"));
457814b5 234
13188def
WS
235 // Make a menubar
236 wxMenu *file_menu = new wxMenu;
dabbc6a5 237
13188def 238 file_menu->Append(DIALOGS_MESSAGE_BOX, _T("&Message box\tCtrl-M"));
457814b5 239
457814b5 240
33bcca32 241#if wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
f09c8393 242
33bcca32 243 wxMenu *choices_menu = new wxMenu;
f09c8393 244
33bcca32
VZ
245 #if wxUSE_COLOURDLG
246 choices_menu->Append(DIALOGS_CHOOSE_COLOUR, _T("&Choose colour"));
247 #endif // wxUSE_COLOURDLG
f09c8393 248
33bcca32
VZ
249 #if wxUSE_FONTDLG
250 choices_menu->Append(DIALOGS_CHOOSE_FONT, _T("Choose &font"));
251 #endif // wxUSE_FONTDLG
457814b5 252
33bcca32
VZ
253 #if wxUSE_CHOICEDLG
254 choices_menu->Append(DIALOGS_SINGLE_CHOICE, _T("&Single choice\tCtrl-C"));
255 choices_menu->Append(DIALOGS_MULTI_CHOICE, _T("M&ultiple choice\tCtrl-U"));
256 #endif // wxUSE_CHOICEDLG
695fe764 257
33bcca32
VZ
258 #if USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
259 choices_menu->AppendSeparator();
260 #endif // USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
695fe764 261
33bcca32
VZ
262 #if USE_COLOURDLG_GENERIC
263 choices_menu->Append(DIALOGS_CHOOSE_COLOUR_GENERIC, _T("&Choose colour (generic)"));
264 #endif // USE_COLOURDLG_GENERIC
695fe764 265
33bcca32
VZ
266 #if USE_FONTDLG_GENERIC
267 choices_menu->Append(DIALOGS_CHOOSE_FONT_GENERIC, _T("Choose &font (generic)"));
268 #endif // USE_FONTDLG_GENERIC
d93c719a 269
33bcca32
VZ
270 file_menu->Append(wxID_ANY,_T("&Choices and selectors"),choices_menu);
271#endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
457814b5 272
457814b5 273
33bcca32 274#if wxUSE_TEXTDLG || wxUSE_NUMBERDLG
13188def 275
33bcca32 276 wxMenu *entry_menu = new wxMenu;
13188def 277
33bcca32
VZ
278 #if wxUSE_TEXTDLG
279 entry_menu->Append(DIALOGS_TEXT_ENTRY, _T("Text &entry\tCtrl-E"));
280 entry_menu->Append(DIALOGS_PASSWORD_ENTRY, _T("&Password entry\tCtrl-P"));
281 #endif // wxUSE_TEXTDLG
13188def 282
33bcca32
VZ
283 #if wxUSE_NUMBERDLG
284 entry_menu->Append(DIALOGS_NUM_ENTRY, _T("&Numeric entry\tCtrl-N"));
285 #endif // wxUSE_NUMBERDLG
13188def 286
33bcca32 287 file_menu->Append(wxID_ANY,_T("&Entry dialogs"),entry_menu);
13188def 288
33bcca32 289#endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG
13188def
WS
290
291
33bcca32 292#if wxUSE_FILEDLG
13188def 293
33bcca32
VZ
294 wxMenu *filedlg_menu = new wxMenu;
295 filedlg_menu->Append(DIALOGS_FILE_OPEN, _T("&Open file\tCtrl-O"));
296 filedlg_menu->Append(DIALOGS_FILE_OPEN2, _T("&Second open file\tCtrl-2"));
297 filedlg_menu->Append(DIALOGS_FILES_OPEN, _T("Open &files\tCtrl-Q"));
298 filedlg_menu->Append(DIALOGS_FILE_SAVE, _T("Sa&ve file\tCtrl-S"));
695fe764 299
33bcca32
VZ
300 #if USE_FILEDLG_GENERIC
301 filedlg_menu->AppendSeparator();
302 filedlg_menu->Append(DIALOGS_FILE_OPEN_GENERIC, _T("&Open file (generic)"));
303 filedlg_menu->Append(DIALOGS_FILES_OPEN_GENERIC, _T("Open &files (generic)"));
304 filedlg_menu->Append(DIALOGS_FILE_SAVE_GENERIC, _T("Sa&ve file (generic)"));
305 #endif // USE_FILEDLG_GENERIC
695fe764 306
33bcca32 307 file_menu->Append(wxID_ANY,_T("&File operations"),filedlg_menu);
13188def 308
33bcca32 309#endif // wxUSE_FILEDLG
13188def 310
33bcca32
VZ
311#if wxUSE_DIRDLG
312 wxMenu *dir_menu = new wxMenu;
13188def 313
33bcca32
VZ
314 dir_menu->Append(DIALOGS_DIR_CHOOSE, _T("&Choose a directory\tCtrl-D"));
315 dir_menu->Append(DIALOGS_DIRNEW_CHOOSE, _T("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"));
316 file_menu->Append(wxID_ANY,_T("&Directory operations"),dir_menu);
13188def 317
33bcca32
VZ
318 #if USE_DIRDLG_GENERIC
319 dir_menu->AppendSeparator();
320 dir_menu->Append(DIALOGS_GENERIC_DIR_CHOOSE, _T("&Choose a directory (generic)"));
321 #endif // USE_DIRDLG_GENERIC
13188def 322
33bcca32 323#endif // wxUSE_DIRDLG
13188def
WS
324
325
33bcca32 326#if wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
13188def 327
33bcca32 328 wxMenu *info_menu = new wxMenu;
13188def 329
33bcca32
VZ
330 #if wxUSE_STARTUP_TIPS
331 info_menu->Append(DIALOGS_TIP, _T("&Tip of the day\tCtrl-T"));
332 #endif // wxUSE_STARTUP_TIPS
13188def 333
33bcca32
VZ
334 #if wxUSE_PROGRESSDLG
335 info_menu->Append(DIALOGS_PROGRESS, _T("Pro&gress dialog\tCtrl-G"));
336 #endif // wxUSE_PROGRESSDLG
13188def 337
33bcca32
VZ
338 #if wxUSE_BUSYINFO
339 info_menu->Append(DIALOGS_BUSYINFO, _T("&Busy info dialog\tCtrl-B"));
340 #endif // wxUSE_BUSYINFO
13188def 341
33bcca32
VZ
342 #if wxUSE_LOG_DIALOG
343 info_menu->Append(DIALOGS_LOG_DIALOG, _T("&Log dialog\tCtrl-L"));
344 #endif // wxUSE_LOG_DIALOG
13188def 345
33bcca32 346 file_menu->Append(wxID_ANY,_T("&Informative dialogs"),info_menu);
13188def 347
33bcca32 348#endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
13188def
WS
349
350
33bcca32
VZ
351#if wxUSE_FINDREPLDLG
352 wxMenu *find_menu = new wxMenu;
353 find_menu->AppendCheckItem(DIALOGS_FIND, _T("&Find dialog\tCtrl-F"));
354 find_menu->AppendCheckItem(DIALOGS_REPLACE, _T("Find and &replace dialog\tShift-Ctrl-F"));
355 file_menu->Append(wxID_ANY,_T("&Searching"),find_menu);
356#endif // wxUSE_FINDREPLDLG
13188def 357
33bcca32 358#if USE_MODAL_PRESENTATION
cae50e6b
VZ
359 wxMenu *dialogs_menu = new wxMenu;
360 dialogs_menu->Append(DIALOGS_MODAL, _T("&Modal dialog\tCtrl-W"));
361 dialogs_menu->AppendCheckItem(DIALOGS_MODELESS, _T("Mode&less dialog\tCtrl-Z"));
362 dialogs_menu->AppendCheckItem(DIALOGS_CENTRE_SCREEN, _T("Centered on &screen\tShift-Ctrl-1"));
363 dialogs_menu->AppendCheckItem(DIALOGS_CENTRE_PARENT, _T("Centered on &parent\tShift-Ctrl-2"));
364 file_menu->Append(wxID_ANY, _T("&Generic dialogs"), dialogs_menu);
33bcca32 365#endif // USE_MODAL_PRESENTATION
13188def 366
532d575b 367#if USE_SETTINGS_DIALOG
b40bb73e
VZ
368 wxMenu *sheet_menu = new wxMenu;
369 sheet_menu->Append(DIALOGS_PROPERTY_SHEET, _T("&Standard property sheet\tShift-Ctrl-P"));
370 sheet_menu->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK, _T("&Toolbook sheet\tShift-Ctrl-T"));
371 file_menu->Append(wxID_ANY, _T("&Property sheets"), sheet_menu);
372#endif // USE_SETTINGS_DIALOG
532d575b 373
9b16ffef
VZ
374 file_menu->Append(DIALOGS_REQUEST, _T("&Request user attention\tCtrl-R"));
375
13188def
WS
376 file_menu->AppendSeparator();
377 file_menu->Append(wxID_EXIT, _T("E&xit\tAlt-X"));
378
379 wxMenuBar *menu_bar = new wxMenuBar;
380 menu_bar->Append(file_menu, _T("&File"));
381 frame->SetMenuBar(menu_bar);
382
383 myCanvas = new MyCanvas(frame);
384 myCanvas->SetBackgroundColour(*wxWHITE);
385
386 frame->Centre(wxBOTH);
387
388 // Show the frame
389 frame->Show(true);
390
391 SetTopWindow(frame);
392
393 return true;
457814b5
JS
394}
395
396// My frame constructor
4c45f240 397MyFrame::MyFrame(wxWindow *parent,
13188def
WS
398 const wxString& title)
399 : wxFrame(parent, wxID_ANY, title)
4c45f240 400{
0f5d8ecf 401 SetIcon(sample_xpm);
532d575b 402
13188def 403#if USE_MODAL_PRESENTATION
4c45f240 404 m_dialog = (MyModelessDialog *)NULL;
13188def 405#endif // USE_MODAL_PRESENTATION
f1e1ed3b 406
043dcdaa 407#if wxUSE_FINDREPLDLG
14fca738
VZ
408 m_dlgFind =
409 m_dlgReplace = NULL;
043dcdaa 410#endif
dabbc6a5
DS
411
412#if wxUSE_COLOURDLG
d33dd9ef
VS
413 m_clrData.SetChooseFull(true);
414 for (int i = 0; i < 16; i++)
415 {
8f6eaec9
WS
416 m_clrData.SetCustomColour(
417 i,
418 wxColour(
419 (unsigned char)(i*16),
420 (unsigned char)(i*16),
421 (unsigned char)(i*16)
422 )
423 );
d33dd9ef 424 }
13188def 425#endif // wxUSE_COLOURDLG
4c45f240 426}
457814b5 427
13188def 428#if wxUSE_COLOURDLG
d355d3fe 429void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) )
457814b5 430{
d33dd9ef 431 m_clrData.SetColour(myCanvas->GetBackgroundColour());
d93c719a 432
d33dd9ef 433 wxColourDialog dialog(this, &m_clrData);
9f84eccd 434 dialog.SetTitle(_T("Choose the background colour"));
afbd36dd 435 if (dialog.ShowModal() == wxID_OK)
f6bcfd97 436 {
d33dd9ef
VS
437 m_clrData = dialog.GetColourData();
438 myCanvas->SetBackgroundColour(m_clrData.GetColour());
1d14c005 439 myCanvas->ClearBackground();
457814b5 440 myCanvas->Refresh();
f6bcfd97 441 }
457814b5 442}
13188def 443#endif // wxUSE_COLOURDLG
457814b5 444
1e72e3cc
RN
445#if USE_COLOURDLG_GENERIC
446void MyFrame::ChooseColourGeneric(wxCommandEvent& WXUNUSED(event))
447{
448 m_clrData.SetColour(myCanvas->GetBackgroundColour());
449
450 //FIXME:TODO:This has no effect...
451 m_clrData.SetChooseFull(true);
452
453 for (int i = 0; i < 16; i++)
454 {
455 wxColour colour(
456 (unsigned char)(i*16),
457 (unsigned char)(i*16),
458 (unsigned char)(i*16)
459 );
460 m_clrData.SetCustomColour(i, colour);
461 }
462
463 wxGenericColourDialog *dialog = new wxGenericColourDialog(this, &m_clrData);
464 if (dialog->ShowModal() == wxID_OK)
465 {
466 m_clrData = dialog->GetColourData();
467 myCanvas->SetBackgroundColour(m_clrData.GetColour());
468 myCanvas->ClearBackground();
469 myCanvas->Refresh();
470 }
471 dialog->Destroy();
472}
473#endif // USE_COLOURDLG_GENERIC
474
13188def 475#if wxUSE_FONTDLG
d355d3fe 476void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) )
457814b5 477{
dbc65e27
VZ
478 wxFontData data;
479 data.SetInitialFont(wxGetApp().m_canvasFont);
480 data.SetColour(wxGetApp().m_canvasTextColour);
d93c719a 481
dbc65e27
VZ
482 // you might also do this:
483 //
484 // wxFontDialog dialog;
485 // if ( !dialog.Create(this, data) { ... error ... }
486 //
487 wxFontDialog dialog(this, data);
488
489 if (dialog.ShowModal() == wxID_OK)
490 {
491 wxFontData retData = dialog.GetFontData();
457814b5
JS
492 wxGetApp().m_canvasFont = retData.GetChosenFont();
493 wxGetApp().m_canvasTextColour = retData.GetColour();
494 myCanvas->Refresh();
dbc65e27
VZ
495 }
496 //else: cancelled by the user, don't change the font
457814b5 497}
13188def 498#endif // wxUSE_FONTDLG
457814b5 499
13188def 500#if USE_FONTDLG_GENERIC
d355d3fe 501void MyFrame::ChooseFontGeneric(wxCommandEvent& WXUNUSED(event) )
457814b5 502{
13188def
WS
503 wxFontData data;
504 data.SetInitialFont(wxGetApp().m_canvasFont);
505 data.SetColour(wxGetApp().m_canvasTextColour);
457814b5 506
13188def
WS
507 wxGenericFontDialog *dialog = new wxGenericFontDialog(this, &data);
508 if (dialog->ShowModal() == wxID_OK)
509 {
457814b5
JS
510 wxFontData retData = dialog->GetFontData();
511 wxGetApp().m_canvasFont = retData.GetChosenFont();
512 wxGetApp().m_canvasTextColour = retData.GetColour();
513 myCanvas->Refresh();
13188def
WS
514 }
515 dialog->Destroy();
457814b5 516}
13188def 517#endif // USE_FONTDLG_GENERIC
d93c719a 518
b4954d19 519#if wxUSE_LOG_DIALOG
87728739 520void MyFrame::LogDialog(wxCommandEvent& WXUNUSED(event))
d93c719a 521{
2c8e4738
VZ
522 // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
523 // being flushed -- test it
524 {
525 wxBusyCursor bc;
4693b20c
MB
526 wxLogMessage(wxT("This is some message - everything is ok so far."));
527 wxLogMessage(wxT("Another message...\n... this one is on multiple lines"));
528 wxLogWarning(wxT("And then something went wrong!"));
9fe52545
VZ
529
530 // and if ~wxBusyCursor doesn't do it, then call it manually
531 wxYield();
2c8e4738
VZ
532 }
533
4693b20c
MB
534 wxLogError(wxT("Intermediary error handler decided to abort."));
535 wxLogError(wxT("The top level caller detected an unrecoverable error."));
5888ef1e 536
7923c649
VZ
537 wxLog::FlushActive();
538
4693b20c 539 wxLogMessage(wxT("And this is the same dialog but with only one message."));
d93c719a 540}
b4954d19 541#endif // wxUSE_LOG_DIALOG
457814b5 542
d355d3fe 543void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) )
457814b5 544{
13188def
WS
545 wxMessageDialog dialog( NULL, _T("This is a message box\nA long, long string to test out the message box properly"),
546 _T("Message box text"), wxNO_DEFAULT|wxYES_NO|wxCANCEL|wxICON_INFORMATION);
457814b5 547
13188def
WS
548 switch ( dialog.ShowModal() )
549 {
550 case wxID_YES:
551 wxLogStatus(wxT("You pressed \"Yes\""));
552 break;
49b957be 553
13188def
WS
554 case wxID_NO:
555 wxLogStatus(wxT("You pressed \"No\""));
556 break;
49b957be 557
13188def
WS
558 case wxID_CANCEL:
559 wxLogStatus(wxT("You pressed \"Cancel\""));
560 break;
49b957be 561
13188def
WS
562 default:
563 wxLogError(wxT("Unexpected wxMessageDialog return code!"));
564 }
457814b5
JS
565}
566
13188def 567#if wxUSE_NUMBERDLG
c49245f8
VZ
568void MyFrame::NumericEntry(wxCommandEvent& WXUNUSED(event) )
569{
78a189c9
VZ
570 long res = wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n")
571 _T("Even two rows of text."),
572 _T("Enter a number:"), _T("Numeric input test"),
e65cc56a 573 50, 0, 100, this );
c49245f8
VZ
574
575 wxString msg;
576 int icon;
577 if ( res == -1 )
578 {
78a189c9 579 msg = _T("Invalid number entered or dialog cancelled.");
c49245f8
VZ
580 icon = wxICON_HAND;
581 }
582 else
d93c719a
VZ
583 {
584 msg.Printf(_T("You've entered %lu"), res );
c49245f8
VZ
585 icon = wxICON_INFORMATION;
586 }
587
78a189c9 588 wxMessageBox(msg, _T("Numeric test result"), wxOK | icon, this);
c49245f8 589}
13188def 590#endif // wxUSE_NUMBERDLG
c49245f8 591
13188def 592#if wxUSE_TEXTDLG
a294c6d5 593void MyFrame::PasswordEntry(wxCommandEvent& WXUNUSED(event))
457814b5 594{
2f1cd905 595 wxString pwd = wxGetPasswordFromUser(_T("Enter password:"),
78a189c9 596 _T("Password entry dialog"),
dabbc6a5 597 wxEmptyString,
a294c6d5 598 this);
ecda9475 599 if ( !pwd.empty() )
a294c6d5 600 {
4693b20c 601 wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd.c_str()),
78a189c9 602 _T("Got password"), wxOK | wxICON_INFORMATION, this);
a294c6d5
VZ
603 }
604}
605
606void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event))
607{
13188def
WS
608 wxTextEntryDialog dialog(this,
609 _T("This is a small sample\n")
610 _T("A long, long string to test out the text entrybox"),
611 _T("Please enter a string"),
612 _T("Default value"),
613 wxOK | wxCANCEL);
457814b5 614
13188def
WS
615 if (dialog.ShowModal() == wxID_OK)
616 {
b4954d19 617 wxMessageBox(dialog.GetValue(), _T("Got string"), wxOK | wxICON_INFORMATION, this);
13188def 618 }
457814b5 619}
13188def 620#endif // wxUSE_TEXTDLG
457814b5 621
13188def 622#if wxUSE_CHOICEDLG
d355d3fe 623void MyFrame::SingleChoice(wxCommandEvent& WXUNUSED(event) )
457814b5 624{
78a189c9 625 const wxString choices[] = { _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five") } ;
457814b5 626
5f95bb70 627 wxSingleChoiceDialog dialog(this,
78a189c9
VZ
628 _T("This is a small sample\n")
629 _T("A single-choice convenience dialog"),
630 _T("Please select a value"),
5f95bb70 631 WXSIZEOF(choices), choices);
457814b5 632
ef77f91e
JS
633 dialog.SetSelection(2);
634
635 if (dialog.ShowModal() == wxID_OK)
636 {
78a189c9 637 wxMessageDialog dialog2(this, dialog.GetStringSelection(), _T("Got string"));
ef77f91e
JS
638 dialog2.ShowModal();
639 }
457814b5
JS
640}
641
d6c9c1b7
VZ
642void MyFrame::MultiChoice(wxCommandEvent& WXUNUSED(event) )
643{
5f95bb70
VZ
644 const wxString choices[] =
645 {
78a189c9
VZ
646 _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five"),
647 _T("Six"), _T("Seven"), _T("Eight"), _T("Nine"), _T("Ten"),
648 _T("Eleven"), _T("Twelve"), _T("Seventeen"),
5f95bb70 649 };
d6c9c1b7
VZ
650
651 wxArrayInt selections;
652 size_t count = wxGetMultipleChoices(selections,
78a189c9
VZ
653 _T("This is a small sample\n")
654 _T("A multi-choice convenience dialog"),
655 _T("Please select a value"),
5f95bb70 656 WXSIZEOF(choices), choices,
d6c9c1b7
VZ
657 this);
658 if ( count )
659 {
3d49ce44 660 wxString msg;
fba1b53b 661 msg.Printf(wxT("You selected %u items:\n"), (unsigned)count);
d6c9c1b7
VZ
662 for ( size_t n = 0; n < count; n++ )
663 {
fba1b53b
VZ
664 msg += wxString::Format(wxT("\t%u: %u (%s)\n"),
665 (unsigned)n, (unsigned)selections[n],
3d49ce44 666 choices[selections[n]].c_str());
d6c9c1b7 667 }
3d49ce44 668 wxLogMessage(msg);
d6c9c1b7
VZ
669 }
670 //else: cancelled or nothing selected
671}
13188def 672#endif // wxUSE_CHOICEDLG
d6c9c1b7 673
13188def 674#if wxUSE_FILEDLG
d355d3fe 675void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) )
457814b5 676{
fbf4eacb
VZ
677 wxFileDialog dialog
678 (
679 this,
680 _T("Testing open file dialog"),
dabbc6a5
DS
681 wxEmptyString,
682 wxEmptyString,
a4e64fb5
MB
683#ifdef __WXMOTIF__
684 _T("C++ files (*.cpp)|*.cpp")
685#else
daf32463 686 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
a4e64fb5 687#endif
fbf4eacb 688 );
457814b5 689
5b636c67 690 dialog.SetDirectory(wxGetHomeDir());
3b6c3fc8 691 dialog.CentreOnParent();
5b636c67 692
c50f1fb9
VZ
693 if (dialog.ShowModal() == wxID_OK)
694 {
5919d76b 695 wxString info;
13393ab6
RR
696 info.Printf(_T("Full file name: %s\n")
697 _T("Path: %s\n")
698 _T("Name: %s"),
5919d76b
VZ
699 dialog.GetPath().c_str(),
700 dialog.GetDirectory().c_str(),
701 dialog.GetFilename().c_str());
78a189c9 702 wxMessageDialog dialog2(this, info, _T("Selected file"));
c50f1fb9
VZ
703 dialog2.ShowModal();
704 }
457814b5
JS
705}
706
35b45b33
VZ
707// this shows how to take advantage of specifying a default extension in the
708// call to wxFileSelector: it is remembered after each new call and the next
709// one will use it by default
710void MyFrame::FileOpen2(wxCommandEvent& WXUNUSED(event) )
711{
712 static wxString s_extDef;
713 wxString path = wxFileSelector(
714 _T("Select the file to load"),
dabbc6a5 715 wxEmptyString, wxEmptyString,
35b45b33 716 s_extDef,
3601f639
VZ
717 wxString::Format
718 (
719 _T("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"),
720 wxFileSelectorDefaultWildcardStr,
721 wxFileSelectorDefaultWildcardStr
722 ),
fbf4eacb 723 wxCHANGE_DIR,
35b45b33
VZ
724 this
725 );
726
727 if ( !path )
728 return;
729
730 // it is just a sample, would use wxSplitPath in real program
731 s_extDef = path.AfterLast(_T('.'));
732
733 wxLogMessage(_T("You selected the file '%s', remembered extension '%s'"),
37d403aa 734 (const wxChar*) path, (const wxChar*) s_extDef);
35b45b33
VZ
735}
736
c61f4f6d
VZ
737void MyFrame::FilesOpen(wxCommandEvent& WXUNUSED(event) )
738{
dabbc6a5 739 wxString wildcards =
f0f43012
JS
740#ifdef __WXMOTIF__
741 _T("C++ files (*.cpp)|*.cpp");
742#else
3601f639
VZ
743 wxString::Format
744 (
745 _T("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"),
746 wxFileSelectorDefaultWildcardStr,
747 wxFileSelectorDefaultWildcardStr
748 );
f0f43012 749#endif
78a189c9 750 wxFileDialog dialog(this, _T("Testing open multiple file dialog"),
dabbc6a5 751 wxEmptyString, wxEmptyString, wildcards,
470caaf9 752 wxMULTIPLE);
c61f4f6d
VZ
753
754 if (dialog.ShowModal() == wxID_OK)
755 {
756 wxArrayString paths, filenames;
757
758 dialog.GetPaths(paths);
759 dialog.GetFilenames(filenames);
760
761 wxString msg, s;
762 size_t count = paths.GetCount();
763 for ( size_t n = 0; n < count; n++ )
764 {
765 s.Printf(_T("File %d: %s (%s)\n"),
fba1b53b 766 (int)n, paths[n].c_str(), filenames[n].c_str());
c61f4f6d
VZ
767
768 msg += s;
769 }
f0f43012
JS
770 s.Printf(_T("Filter index: %d"), dialog.GetFilterIndex());
771 msg += s;
c61f4f6d 772
78a189c9 773 wxMessageDialog dialog2(this, msg, _T("Selected files"));
c61f4f6d
VZ
774 dialog2.ShowModal();
775 }
776}
777
d355d3fe 778void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
457814b5 779{
2f1cd905
VZ
780 wxFileDialog dialog(this,
781 _T("Testing save file dialog"),
dabbc6a5 782 wxEmptyString,
2b5f62a0 783 _T("myletter.doc"),
2f1cd905
VZ
784 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
785 wxSAVE|wxOVERWRITE_PROMPT);
c50f1fb9 786
2b5f62a0
VZ
787 dialog.SetFilterIndex(1);
788
c50f1fb9
VZ
789 if (dialog.ShowModal() == wxID_OK)
790 {
2b5f62a0
VZ
791 wxLogMessage(_T("%s, filter %d"),
792 dialog.GetPath().c_str(), dialog.GetFilterIndex());
c50f1fb9 793 }
457814b5 794}
13188def 795#endif // wxUSE_FILEDLG
457814b5 796
695fe764
WS
797#if USE_FILEDLG_GENERIC
798void MyFrame::FileOpenGeneric(wxCommandEvent& WXUNUSED(event) )
799{
800 wxGenericFileDialog dialog
801 (
802 this,
803 _T("Testing open file dialog"),
804 wxEmptyString,
805 wxEmptyString,
daf32463 806 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
695fe764
WS
807 );
808
809 dialog.SetDirectory(wxGetHomeDir());
810
811 if (dialog.ShowModal() == wxID_OK)
812 {
813 wxString info;
814 info.Printf(_T("Full file name: %s\n")
815 _T("Path: %s\n")
816 _T("Name: %s"),
817 dialog.GetPath().c_str(),
818 dialog.GetDirectory().c_str(),
819 dialog.GetFilename().c_str());
820 wxMessageDialog dialog2(this, info, _T("Selected file"));
821 dialog2.ShowModal();
822 }
823}
824
825void MyFrame::FilesOpenGeneric(wxCommandEvent& WXUNUSED(event) )
826{
684883e3
WS
827 // On PocketPC you can disable OK-only dialogs policy using system option
828 int buttons = wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel"));
829 wxSystemOptions::SetOption(wxT("wince.dialog.real-ok-cancel"), 1);
830
daf32463 831 wxString wildcards = _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
695fe764
WS
832 wxGenericFileDialog dialog(this, _T("Testing open multiple file dialog"),
833 wxEmptyString, wxEmptyString, wildcards,
834 wxMULTIPLE);
835
836 if (dialog.ShowModal() == wxID_OK)
837 {
838 wxArrayString paths, filenames;
839
840 dialog.GetPaths(paths);
841 dialog.GetFilenames(filenames);
842
843 wxString msg, s;
844 size_t count = paths.GetCount();
845 for ( size_t n = 0; n < count; n++ )
846 {
847 s.Printf(_T("File %d: %s (%s)\n"),
848 (int)n, paths[n].c_str(), filenames[n].c_str());
849
850 msg += s;
851 }
852 s.Printf(_T("Filter index: %d"), dialog.GetFilterIndex());
853 msg += s;
854
855 wxMessageDialog dialog2(this, msg, _T("Selected files"));
856 dialog2.ShowModal();
857 }
684883e3
WS
858
859 // restore system option
860 wxSystemOptions::SetOption(wxT("wince.dialog.real-ok-cancel"), buttons);
695fe764
WS
861}
862
863void MyFrame::FileSaveGeneric(wxCommandEvent& WXUNUSED(event) )
864{
865 wxGenericFileDialog dialog(this,
866 _T("Testing save file dialog"),
867 wxEmptyString,
868 _T("myletter.doc"),
869 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
870 wxSAVE|wxOVERWRITE_PROMPT);
871
872 dialog.SetFilterIndex(1);
873
874 if (dialog.ShowModal() == wxID_OK)
875 {
876 wxLogMessage(_T("%s, filter %d"),
877 dialog.GetPath().c_str(), dialog.GetFilterIndex());
878 }
879}
880#endif // USE_FILEDLG_GENERIC
881
13188def 882#if wxUSE_DIRDLG
f09c8393 883void MyFrame::DoDirChoose(int style)
457814b5 884{
3f2711d5
VZ
885 // pass some initial dir to wxDirDialog
886 wxString dirHome;
887 wxGetHomeDir(&dirHome);
888
f09c8393 889 wxDirDialog dialog(this, _T("Testing directory picker"), dirHome, style);
c50f1fb9
VZ
890
891 if (dialog.ShowModal() == wxID_OK)
892 {
2b5f62a0 893 wxLogMessage(_T("Selected path: %s"), dialog.GetPath().c_str());
c50f1fb9
VZ
894 }
895}
896
f09c8393
VZ
897void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) )
898{
899 DoDirChoose(wxDD_DEFAULT_STYLE & ~wxDD_NEW_DIR_BUTTON);
900}
901
902void MyFrame::DirChooseNew(wxCommandEvent& WXUNUSED(event) )
903{
8768548b 904 DoDirChoose(wxDD_DEFAULT_STYLE | wxDD_NEW_DIR_BUTTON);
f09c8393 905}
13188def 906#endif // wxUSE_DIRDLG
f09c8393 907
13188def 908#if USE_DIRDLG_GENERIC
51a58d8b
JS
909void MyFrame::GenericDirChoose(wxCommandEvent& WXUNUSED(event) )
910{
911 // pass some initial dir to wxDirDialog
912 wxString dirHome;
913 wxGetHomeDir(&dirHome);
914
78a189c9 915 wxGenericDirDialog dialog(this, _T("Testing generic directory picker"), dirHome);
51a58d8b
JS
916
917 if (dialog.ShowModal() == wxID_OK)
918 {
78a189c9 919 wxMessageDialog dialog2(this, dialog.GetPath(), _T("Selected path"));
51a58d8b
JS
920 dialog2.ShowModal();
921 }
922}
13188def 923#endif // USE_DIRDLG_GENERIC
51a58d8b 924
13188def 925#if USE_MODAL_PRESENTATION
f6bcfd97
BP
926void MyFrame::ModalDlg(wxCommandEvent& WXUNUSED(event))
927{
928 MyModalDialog dlg(this);
929 dlg.ShowModal();
930}
931
4c45f240
VZ
932void MyFrame::ModelessDlg(wxCommandEvent& event)
933{
2f82899b 934 bool show = GetMenuBar()->IsChecked(event.GetId());
4c45f240
VZ
935
936 if ( show )
937 {
938 if ( !m_dialog )
939 {
940 m_dialog = new MyModelessDialog(this);
941 }
942
13188def 943 m_dialog->Show(true);
4c45f240
VZ
944 }
945 else // hide
946 {
26a12ab3
JS
947 // If m_dialog is NULL, then possibly the system
948 // didn't report the checked menu item status correctly.
949 // It should be true just after the menu item was selected,
950 // if there was no modeless dialog yet.
951
952 wxASSERT( m_dialog != NULL );
953 if (m_dialog)
954 m_dialog->Hide();
4c45f240
VZ
955 }
956}
cae50e6b
VZ
957
958void MyFrame::DlgCenteredScreen(wxCommandEvent& WXUNUSED(event))
959{
960 wxDialog dlg(this, wxID_ANY, _T("Dialog centered on screen"),
961 wxDefaultPosition, wxSize(200, 100));
962 new wxButton(&dlg, wxID_OK, _T("Close"), wxPoint(10, 10));
963 dlg.CentreOnScreen();
964 dlg.ShowModal();
965}
966
967void MyFrame::DlgCenteredParent(wxCommandEvent& WXUNUSED(event))
968{
969 wxDialog dlg(this, wxID_ANY, _T("Dialog centered on parent"),
970 wxDefaultPosition, wxSize(200, 100));
971 new wxButton(&dlg, wxID_OK, _T("Close"), wxPoint(10, 10));
972 dlg.CentreOnParent();
973 dlg.ShowModal();
974}
975
13188def 976#endif // USE_MODAL_PRESENTATION
4c45f240 977
13188def 978#if wxUSE_STARTUP_TIPS
87728739 979void MyFrame::ShowTip(wxCommandEvent& WXUNUSED(event))
c50f1fb9
VZ
980{
981 static size_t s_index = (size_t)-1;
982
983 if ( s_index == (size_t)-1 )
984 {
985 srand(time(NULL));
986
987 // this is completely bogus, we don't know how many lines are there
988 // in the file, but who cares, it's a demo only...
989 s_index = rand() % 5;
990 }
991
2f1cd905 992 wxTipProvider *tipProvider = wxCreateFileTipProvider(_T("tips.txt"), s_index);
c50f1fb9
VZ
993
994 bool showAtStartup = wxShowTip(this, tipProvider);
995
996 if ( showAtStartup )
997 {
2f1cd905 998 wxMessageBox(_T("Will show tips on startup"), _T("Tips dialog"),
c50f1fb9
VZ
999 wxOK | wxICON_INFORMATION, this);
1000 }
457814b5 1001
c50f1fb9
VZ
1002 s_index = tipProvider->GetCurrentTip();
1003 delete tipProvider;
457814b5 1004}
13188def 1005#endif // wxUSE_STARTUP_TIPS
457814b5 1006
532d575b 1007#if USE_SETTINGS_DIALOG
0f5d8ecf
JS
1008void MyFrame::OnPropertySheet(wxCommandEvent& WXUNUSED(event))
1009{
1010 SettingsDialog dialog(this);
1011 dialog.ShowModal();
1012}
cc8bc5aa
JS
1013
1014void MyFrame::OnPropertySheetToolBook(wxCommandEvent& WXUNUSED(event))
1015{
1016 SettingsDialog dialog(this, true);
1017 dialog.ShowModal();
1018}
532d575b 1019#endif // USE_SETTINGS_DIALOG
0f5d8ecf 1020
9b16ffef
VZ
1021void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event))
1022{
1023 wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window"));
1024
1025 wxSleep(3);
1026
1027 RequestUserAttention(wxUSER_ATTENTION_ERROR);
1028}
1029
d355d3fe 1030void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event) )
457814b5 1031{
13188def 1032 Close(true);
457814b5
JS
1033}
1034
abceee76
VZ
1035#if wxUSE_PROGRESSDLG
1036
1037void MyFrame::ShowProgress( wxCommandEvent& WXUNUSED(event) )
1038{
9b16ffef
VZ
1039 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1040 // check the performance
1041 int countrandomnumbers = 0, count = 0;
1042 wxTimeSpan tsTest(0,0,0,250);
1043 wxDateTime DT2, DT1 = wxDateTime::UNow();
1044 srand(0);
1045 while(1)
1046 {
1047 rand();
1048 ++countrandomnumbers;
1049 if ( countrandomnumbers == 1000 )
1050 {
1051 srand(0);
1052 countrandomnumbers = 0;
1053 ++count;
1054 DT2 = wxDateTime::UNow();
1055 wxTimeSpan ts = DT2.Subtract( DT1 );
1056 if ( ts.IsLongerThan( tsTest ) )
1057 {
1058 break;
1059 }
1060 }
1061 }
1062 const int max = 40 * count;
1063 #else
abceee76 1064 static const int max = 10;
9b16ffef 1065 #endif // wxUSE_STOPWATCH && wxUSE_LONGLONG
abceee76 1066
2f1cd905 1067 wxProgressDialog dialog(_T("Progress dialog example"),
78a189c9 1068 _T("An informative message"),
abceee76
VZ
1069 max, // range
1070 this, // parent
1071 wxPD_CAN_ABORT |
ecda9475 1072 wxPD_CAN_SKIP |
abceee76 1073 wxPD_APP_MODAL |
df26c4c6 1074 // wxPD_AUTO_HIDE | -- try this as well
abceee76
VZ
1075 wxPD_ELAPSED_TIME |
1076 wxPD_ESTIMATED_TIME |
ecda9475
WS
1077 wxPD_REMAINING_TIME |
1078 wxPD_SMOOTH);
abceee76 1079
13188def 1080 bool cont = true;
ecda9475
WS
1081 bool skip = false;
1082 // each skip will move progress about quarter forward
1083 for ( int i = 0; i <= max; i = wxMin(i+(skip?int(max/4):1), max+1), skip = false )
abceee76 1084 {
9b16ffef
VZ
1085 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1086 // do (almost) the same operations as we did for the performance test
1087 srand(0);
1088 for ( int j = 0; j < 1000; j++ )
1089 {
1090 rand();
1091 if ( j == 999 )
1092 {
1093 DT2 = wxDateTime::UNow();
1094 wxTimeSpan ts = DT2.Subtract( DT1 );
1095 if ( ts.IsLongerThan( tsTest ) )
1096 {
1097 // nothing to do
1098 }
1099 }
1100 }
1101 #else
abceee76 1102 wxSleep(1);
9b16ffef 1103 #endif
ecda9475
WS
1104
1105 wxString msg;
1106
abceee76
VZ
1107 if ( i == max )
1108 {
ecda9475 1109 msg = _T("That's all, folks!");
abceee76 1110 }
ecda9475 1111 else if ( i > max / 2 )
abceee76 1112 {
ecda9475 1113 msg = _T("Only a half left (very long message)!");
abceee76 1114 }
ecda9475
WS
1115
1116#if wxUSE_STOPWATCH && wxUSE_LONGLONG
1117 if ( (i % (max/100)) == 0 ) // // only 100 updates, this makes it much faster
abceee76 1118 {
ecda9475 1119 cont = dialog.Update(i, msg, &skip);
abceee76 1120 }
ecda9475
WS
1121#else
1122 cont = dialog.Update(i, msg, &skip);
1123#endif
1124
d8ddee9c
VZ
1125 if ( !cont )
1126 {
78a189c9
VZ
1127 if ( wxMessageBox(_T("Do you really want to cancel?"),
1128 _T("Progress dialog question"), // caption
1129 wxYES_NO | wxICON_QUESTION) == wxYES )
d8ddee9c
VZ
1130 break;
1131
9b16ffef 1132 cont = true;
d8ddee9c
VZ
1133 dialog.Resume();
1134 }
abceee76
VZ
1135 }
1136
1137 if ( !cont )
1138 {
4693b20c 1139 wxLogStatus(wxT("Progress dialog aborted!"));
abceee76
VZ
1140 }
1141 else
1142 {
4693b20c 1143 wxLogStatus(wxT("Countdown from %d finished"), max);
abceee76
VZ
1144 }
1145}
1146
1147#endif // wxUSE_PROGRESSDLG
1148
a62b0bcc
VZ
1149#if wxUSE_BUSYINFO
1150
1151void MyFrame::ShowBusyInfo(wxCommandEvent& WXUNUSED(event))
1152{
21977bac
VZ
1153 wxWindowDisabler disableAll;
1154
9f84eccd 1155 wxBusyInfo info(_T("Working, please wait..."), this);
a62b0bcc 1156
5b636c67 1157 for ( int i = 0; i < 18; i++ )
a62b0bcc 1158 {
5b636c67 1159 //wxUsleep(100);
a62b0bcc
VZ
1160 wxTheApp->Yield();
1161 }
5b636c67
VZ
1162
1163 wxSleep(2);
1164 //wxWakeUpIdle();
a62b0bcc
VZ
1165}
1166
1167#endif // wxUSE_BUSYINFO
1168
761989ff
VZ
1169#if wxUSE_FINDREPLDLG
1170
1171void MyFrame::ShowReplaceDialog( wxCommandEvent& WXUNUSED(event) )
1172{
14fca738
VZ
1173 if ( m_dlgReplace )
1174 {
1175 delete m_dlgReplace;
1176 m_dlgReplace = NULL;
1177 }
1178 else
1179 {
1180 m_dlgReplace = new wxFindReplaceDialog
1181 (
1182 this,
1183 &m_findData,
78a189c9 1184 _T("Find and replace dialog"),
14fca738
VZ
1185 wxFR_REPLACEDIALOG
1186 );
1187
13188def 1188 m_dlgReplace->Show(true);
14fca738 1189 }
761989ff
VZ
1190}
1191
1192void MyFrame::ShowFindDialog( wxCommandEvent& WXUNUSED(event) )
1193{
14fca738
VZ
1194 if ( m_dlgFind )
1195 {
1196 delete m_dlgFind;
1197 m_dlgFind = NULL;
1198 }
1199 else
1200 {
1201 m_dlgFind = new wxFindReplaceDialog
1202 (
1203 this,
1204 &m_findData,
78a189c9 1205 _T("Find dialog"),
14fca738
VZ
1206 // just for testing
1207 wxFR_NOWHOLEWORD
1208 );
1209
13188def 1210 m_dlgFind->Show(true);
14fca738 1211 }
761989ff
VZ
1212}
1213
1214static wxString DecodeFindDialogEventFlags(int flags)
1215{
1216 wxString str;
78a189c9 1217 str << (flags & wxFR_DOWN ? _T("down") : _T("up")) << _T(", ")
2f1cd905
VZ
1218 << (flags & wxFR_WHOLEWORD ? _T("whole words only, ") : _T(""))
1219 << (flags & wxFR_MATCHCASE ? _T("") : _T("not "))
78a189c9 1220 << _T("case sensitive");
761989ff
VZ
1221
1222 return str;
1223}
1224
1225void MyFrame::OnFindDialog(wxFindDialogEvent& event)
1226{
1227 wxEventType type = event.GetEventType();
1228
1229 if ( type == wxEVT_COMMAND_FIND || type == wxEVT_COMMAND_FIND_NEXT )
1230 {
4693b20c 1231 wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
eba33006 1232 type == wxEVT_COMMAND_FIND_NEXT ? wxT("next ") : wxT(""),
761989ff
VZ
1233 event.GetFindString().c_str(),
1234 DecodeFindDialogEventFlags(event.GetFlags()).c_str());
1235 }
1236 else if ( type == wxEVT_COMMAND_FIND_REPLACE ||
1237 type == wxEVT_COMMAND_FIND_REPLACE_ALL )
1238 {
4693b20c 1239 wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
eba33006 1240 type == wxEVT_COMMAND_FIND_REPLACE_ALL ? _T("all ") : wxT(""),
761989ff
VZ
1241 event.GetFindString().c_str(),
1242 event.GetReplaceString().c_str(),
1243 DecodeFindDialogEventFlags(event.GetFlags()).c_str());
1244 }
1245 else if ( type == wxEVT_COMMAND_FIND_CLOSE )
1246 {
14fca738
VZ
1247 wxFindReplaceDialog *dlg = event.GetDialog();
1248
df26c4c6 1249 int idMenu;
14fca738
VZ
1250 const wxChar *txt;
1251 if ( dlg == m_dlgFind )
1252 {
1253 txt = _T("Find");
df26c4c6 1254 idMenu = DIALOGS_FIND;
14fca738
VZ
1255 m_dlgFind = NULL;
1256 }
1257 else if ( dlg == m_dlgReplace )
1258 {
1259 txt = _T("Replace");
df26c4c6 1260 idMenu = DIALOGS_REPLACE;
14fca738
VZ
1261 m_dlgReplace = NULL;
1262 }
1263 else
1264 {
1265 txt = _T("Unknown");
13188def 1266 idMenu = wxID_ANY;
14fca738 1267
2f1cd905 1268 wxFAIL_MSG( _T("unexpected event") );
14fca738
VZ
1269 }
1270
df26c4c6
VZ
1271 wxLogMessage(wxT("%s dialog is being closed."), txt);
1272
13188def 1273 if ( idMenu != wxID_ANY )
df26c4c6 1274 {
13188def 1275 GetMenuBar()->Check(idMenu, false);
df26c4c6 1276 }
761989ff 1277
14fca738 1278 dlg->Destroy();
761989ff
VZ
1279 }
1280 else
1281 {
4693b20c 1282 wxLogError(wxT("Unknown find dialog event!"));
761989ff
VZ
1283 }
1284}
1285
1286#endif // wxUSE_FINDREPLDLG
1287
abceee76
VZ
1288// ----------------------------------------------------------------------------
1289// MyCanvas
1290// ----------------------------------------------------------------------------
1291
d355d3fe 1292void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) )
457814b5 1293{
c50f1fb9 1294 wxPaintDC dc(this);
457814b5
JS
1295 dc.SetFont(wxGetApp().m_canvasFont);
1296 dc.SetTextForeground(wxGetApp().m_canvasTextColour);
1297 dc.SetBackgroundMode(wxTRANSPARENT);
dc96b1b6
WS
1298 dc.DrawText(
1299 _T("wxWidgets common dialogs")
1300#if !defined(__SMARTPHONE__)
1301 _T(" test application")
1302#endif
1303 , 10, 10);
457814b5
JS
1304}
1305
b4954d19
WS
1306#if USE_MODAL_PRESENTATION
1307
4c45f240
VZ
1308// ----------------------------------------------------------------------------
1309// MyModelessDialog
1310// ----------------------------------------------------------------------------
457814b5 1311
4c45f240 1312MyModelessDialog::MyModelessDialog(wxWindow *parent)
13188def 1313 : wxDialog(parent, wxID_ANY, wxString(_T("Modeless dialog")))
4c45f240 1314{
cbc66a27
VZ
1315 wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
1316
78a189c9 1317 wxButton *btn = new wxButton(this, DIALOGS_MODELESS_BTN, _T("Press me"));
13188def 1318 wxCheckBox *check = new wxCheckBox(this, wxID_ANY, _T("Should be disabled"));
cbc66a27
VZ
1319 check->Disable();
1320
1321 sizerTop->Add(btn, 1, wxEXPAND | wxALL, 5);
1322 sizerTop->Add(check, 1, wxEXPAND | wxALL, 5);
1323
cbc66a27
VZ
1324 SetSizer(sizerTop);
1325
1326 sizerTop->SetSizeHints(this);
1327 sizerTop->Fit(this);
4c45f240 1328}
abceee76 1329
5d987909
VZ
1330void MyModelessDialog::OnButton(wxCommandEvent& WXUNUSED(event))
1331{
2f1cd905 1332 wxMessageBox(_T("Button pressed in modeless dialog"), _T("Info"),
5d987909
VZ
1333 wxOK | wxICON_INFORMATION, this);
1334}
1335
abceee76
VZ
1336void MyModelessDialog::OnClose(wxCloseEvent& event)
1337{
1338 if ( event.CanVeto() )
1339 {
2f1cd905 1340 wxMessageBox(_T("Use the menu item to close this dialog"),
78a189c9 1341 _T("Modeless dialog"),
abceee76
VZ
1342 wxOK | wxICON_INFORMATION, this);
1343
1344 event.Veto();
1345 }
1346}
1347
f6bcfd97
BP
1348// ----------------------------------------------------------------------------
1349// MyModalDialog
1350// ----------------------------------------------------------------------------
1351
1352MyModalDialog::MyModalDialog(wxWindow *parent)
13188def 1353 : wxDialog(parent, wxID_ANY, wxString(_T("Modal dialog")))
f6bcfd97
BP
1354{
1355 wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
1356
13188def
WS
1357 m_btnModal = new wxButton(this, wxID_ANY, _T("&Modal dialog..."));
1358 m_btnModeless = new wxButton(this, wxID_ANY, _T("Mode&less dialog"));
1359 m_btnDelete = new wxButton(this, wxID_ANY, _T("&Delete button"));
5315ebfa 1360
78a189c9 1361 wxButton *btnOk = new wxButton(this, wxID_CANCEL, _T("&Close"));
5315ebfa
VZ
1362 sizerTop->Add(m_btnModal, 0, wxALIGN_CENTER | wxALL, 5);
1363 sizerTop->Add(m_btnModeless, 0, wxALIGN_CENTER | wxALL, 5);
f6bcfd97 1364 sizerTop->Add(m_btnDelete, 0, wxALIGN_CENTER | wxALL, 5);
9b70bb91 1365 sizerTop->Add(btnOk, 0, wxALIGN_CENTER | wxALL, 5);
f6bcfd97 1366
f6bcfd97
BP
1367 SetSizer(sizerTop);
1368
1369 sizerTop->SetSizeHints(this);
1370 sizerTop->Fit(this);
1371
5315ebfa
VZ
1372 m_btnModal->SetFocus();
1373 m_btnModal->SetDefault();
f6bcfd97
BP
1374}
1375
1376void MyModalDialog::OnButton(wxCommandEvent& event)
1377{
1378 if ( event.GetEventObject() == m_btnDelete )
1379 {
5315ebfa
VZ
1380 delete m_btnModal;
1381 m_btnModal = NULL;
f6bcfd97
BP
1382
1383 m_btnDelete->Disable();
1384 }
5315ebfa 1385 else if ( event.GetEventObject() == m_btnModal )
f6bcfd97 1386 {
13188def 1387#if wxUSE_TEXTDLG
78a189c9
VZ
1388 wxGetTextFromUser(_T("Dummy prompt"),
1389 _T("Modal dialog called from dialog"),
dabbc6a5 1390 wxEmptyString, this);
13188def
WS
1391#else
1392 wxMessageBox(_T("Modal dialog called from dialog"));
1393#endif // wxUSE_TEXTDLG
f6bcfd97 1394 }
5315ebfa
VZ
1395 else if ( event.GetEventObject() == m_btnModeless )
1396 {
1397 (new MyModelessDialog(this))->Show();
1398 }
f6bcfd97
BP
1399 else
1400 {
1401 event.Skip();
1402 }
1403}
b4954d19
WS
1404
1405#endif // USE_MODAL_PRESENTATION
1406
532d575b 1407#if USE_SETTINGS_DIALOG
0f5d8ecf
JS
1408// ----------------------------------------------------------------------------
1409// SettingsDialog
1410// ----------------------------------------------------------------------------
1411
1412IMPLEMENT_CLASS(SettingsDialog, wxPropertySheetDialog)
1413
1414BEGIN_EVENT_TABLE(SettingsDialog, wxPropertySheetDialog)
1415END_EVENT_TABLE()
1416
cc8bc5aa 1417SettingsDialog::SettingsDialog(wxWindow* win, bool useToolBook)
0f5d8ecf 1418{
0f4991f4 1419 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY);
0f5d8ecf 1420
cc8bc5aa
JS
1421 int tabImage1 = -1;
1422 int tabImage2 = -1;
684883e3 1423
cc8bc5aa
JS
1424 if (useToolBook)
1425 {
1426 tabImage1 = 0;
1427 tabImage2 = 1;
1428 SetSheetStyle(wxPROPSHEET_TOOLBOOK|wxPROPSHEET_SHRINKTOFIT);
1429
1430 // create a dummy image list with a few icons
1431 const wxSize imageSize(32, 32);
1432
1433 m_imageList = new wxImageList(imageSize.GetWidth(), imageSize.GetHeight());
1434 m_imageList->
1435 Add(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, imageSize));
1436 m_imageList->
1437 Add(wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, imageSize));
1438 m_imageList->
1439 Add(wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, imageSize));
1440 m_imageList->
1441 Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, imageSize));
1442 }
1443 else
1444 m_imageList = NULL;
1445
532d575b 1446 Create(win, wxID_ANY, _("Preferences"), wxDefaultPosition, wxDefaultSize,
3103e8a9
JS
1447 wxDEFAULT_DIALOG_STYLE
1448#ifndef __WXWINCE__
1449 |wxRESIZE_BORDER
532d575b 1450#endif
3103e8a9 1451 );
cc8bc5aa 1452
684883e3 1453 // If using a toolbook, also follow Mac style and don't create buttons
cc8bc5aa
JS
1454 if (!useToolBook)
1455 CreateButtons(wxOK|wxCANCEL
897b24cf 1456#ifndef __POCKETPC__
cc8bc5aa 1457 |wxHELP
897b24cf
WS
1458#endif
1459 );
0f5d8ecf
JS
1460
1461 wxBookCtrlBase* notebook = GetBookCtrl();
cc8bc5aa 1462 notebook->SetImageList(m_imageList);
0f5d8ecf
JS
1463
1464 wxPanel* generalSettings = CreateGeneralSettingsPage(notebook);
1465 wxPanel* aestheticSettings = CreateAestheticSettingsPage(notebook);
1466
cc8bc5aa
JS
1467 notebook->AddPage(generalSettings, _("General"), true, tabImage1);
1468 notebook->AddPage(aestheticSettings, _("Aesthetics"), false, tabImage2);
0f5d8ecf
JS
1469
1470 LayoutDialog();
1471}
1472
cc8bc5aa
JS
1473SettingsDialog::~SettingsDialog()
1474{
1475 delete m_imageList;
1476}
1477
0f5d8ecf
JS
1478wxPanel* SettingsDialog::CreateGeneralSettingsPage(wxWindow* parent)
1479{
1480 wxPanel* panel = new wxPanel(parent, wxID_ANY);
1481
1482 wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
1483 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
1484
1485 //// LOAD LAST FILE
1486
1487 wxBoxSizer* itemSizer3 = new wxBoxSizer( wxHORIZONTAL );
1488 wxCheckBox* checkBox3 = new wxCheckBox(panel, ID_LOAD_LAST_PROJECT, _("&Load last project on startup"), wxDefaultPosition, wxDefaultSize);
1489 itemSizer3->Add(checkBox3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
1490 item0->Add(itemSizer3, 0, wxGROW|wxALL, 0);
1491
1492 //// AUTOSAVE
1493
1494 wxString autoSaveLabel = _("&Auto-save every");
1495 wxString minsLabel = _("mins");
1496
1497 wxBoxSizer* itemSizer12 = new wxBoxSizer( wxHORIZONTAL );
1498 wxCheckBox* checkBox12 = new wxCheckBox(panel, ID_AUTO_SAVE, autoSaveLabel, wxDefaultPosition, wxDefaultSize);
62675ef3
JS
1499
1500#if wxUSE_SPINCTRL
0f5d8ecf 1501 wxSpinCtrl* spinCtrl12 = new wxSpinCtrl(panel, ID_AUTO_SAVE_MINS, wxEmptyString,
532d575b 1502 wxDefaultPosition, wxSize(40, wxDefaultCoord), wxSP_ARROW_KEYS, 1, 60, 1);
62675ef3 1503#endif
532d575b 1504
0f5d8ecf 1505 itemSizer12->Add(checkBox12, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
62675ef3 1506#if wxUSE_SPINCTRL
0f5d8ecf 1507 itemSizer12->Add(spinCtrl12, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
62675ef3 1508#endif
0f5d8ecf
JS
1509 itemSizer12->Add(new wxStaticText(panel, wxID_STATIC, minsLabel), 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
1510 item0->Add(itemSizer12, 0, wxGROW|wxALL, 0);
1511
1512 //// TOOLTIPS
532d575b 1513
0f5d8ecf
JS
1514 wxBoxSizer* itemSizer8 = new wxBoxSizer( wxHORIZONTAL );
1515 wxCheckBox* checkBox6 = new wxCheckBox(panel, ID_SHOW_TOOLTIPS, _("Show &tooltips"), wxDefaultPosition, wxDefaultSize);
1516 itemSizer8->Add(checkBox6, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
1517 item0->Add(itemSizer8, 0, wxGROW|wxALL, 0);
1518
1519 topSizer->Add( item0, 1, wxGROW|wxALIGN_CENTRE|wxALL, 5 );
1520
1521 panel->SetSizer(topSizer);
1522 topSizer->Fit(panel);
532d575b 1523
0f5d8ecf
JS
1524 return panel;
1525}
1526
1527wxPanel* SettingsDialog::CreateAestheticSettingsPage(wxWindow* parent)
1528{
1529 wxPanel* panel = new wxPanel(parent, wxID_ANY);
1530
1531 wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
1532 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
1533
1534 //// PROJECT OR GLOBAL
1535 wxString globalOrProjectChoices[2];
1536 globalOrProjectChoices[0] = _("&New projects");
1537 globalOrProjectChoices[1] = _("&This project");
1538
1539 wxRadioBox* projectOrGlobal = new wxRadioBox(panel, ID_APPLY_SETTINGS_TO, _("&Apply settings to:"),
1540 wxDefaultPosition, wxDefaultSize, 2, globalOrProjectChoices);
1541 item0->Add(projectOrGlobal, 0, wxGROW|wxALL, 5);
1542
1543 projectOrGlobal->SetSelection(0);
1544
1545 //// BACKGROUND STYLE
1546 wxArrayString backgroundStyleChoices;
1547 backgroundStyleChoices.Add(wxT("Colour"));
1548 backgroundStyleChoices.Add(wxT("Image"));
532d575b 1549 wxStaticBox* staticBox3 = new wxStaticBox(panel, wxID_ANY, _("Background style:"));
0f5d8ecf
JS
1550
1551 wxBoxSizer* styleSizer = new wxStaticBoxSizer( staticBox3, wxVERTICAL );
1552 item0->Add(styleSizer, 0, wxGROW|wxALL, 5);
1553
1554 wxBoxSizer* itemSizer2 = new wxBoxSizer( wxHORIZONTAL );
1555
1556 wxChoice* choice2 = new wxChoice(panel, ID_BACKGROUND_STYLE, wxDefaultPosition, wxDefaultSize, backgroundStyleChoices);
1557
1558 itemSizer2->Add(new wxStaticText(panel, wxID_ANY, _("&Window:")), 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
1559 itemSizer2->Add(5, 5, 1, wxALL, 0);
1560 itemSizer2->Add(choice2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
1561
1562 styleSizer->Add(itemSizer2, 0, wxGROW|wxALL, 5);
1563
62675ef3 1564#if wxUSE_SPINCTRL
0f5d8ecf
JS
1565 //// FONT SIZE SELECTION
1566
532d575b 1567 wxStaticBox* staticBox1 = new wxStaticBox(panel, wxID_ANY, _("Tile font size:"));
0f5d8ecf
JS
1568 wxBoxSizer* itemSizer5 = new wxStaticBoxSizer( staticBox1, wxHORIZONTAL );
1569
1570 wxSpinCtrl* spinCtrl = new wxSpinCtrl(panel, ID_FONT_SIZE, wxEmptyString, wxDefaultPosition,
532d575b 1571 wxSize(80, wxDefaultCoord));
0f5d8ecf
JS
1572 itemSizer5->Add(spinCtrl, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
1573
1574 item0->Add(itemSizer5, 0, wxGROW|wxLEFT|wxRIGHT, 5);
62675ef3 1575#endif
0f5d8ecf
JS
1576
1577 topSizer->Add( item0, 1, wxGROW|wxALIGN_CENTRE|wxALL, 5 );
0f4991f4 1578 topSizer->AddSpacer(5);
0f5d8ecf
JS
1579
1580 panel->SetSizer(topSizer);
1581 topSizer->Fit(panel);
532d575b 1582
0f5d8ecf
JS
1583 return panel;
1584}
1585
532d575b 1586#endif // USE_SETTINGS_DIALOG