1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Common dialogs demo
4 // Author: Julian Smart
5 // Modified by: ABX (2004) - adjustements for conditional building + new menu
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
23 #include "../sample.xpm"
25 #include "wx/datetime.h"
27 #include "wx/bookctrl.h"
28 #include "wx/artprov.h"
29 #include "wx/imaglist.h"
30 #include "wx/minifram.h"
31 #include "wx/sysopt.h"
32 #include "wx/notifmsg.h"
35 #include "wx/colordlg.h"
36 #endif // wxUSE_COLOURDLG
39 #include "wx/choicdlg.h"
40 #endif // wxUSE_CHOICEDLG
42 #if wxUSE_STARTUP_TIPS
43 #include "wx/tipdlg.h"
44 #endif // wxUSE_STARTUP_TIPS
47 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
48 #include "wx/datetime.h" // wxDateTime
51 #include "wx/progdlg.h"
52 #endif // wxUSE_PROGRESSDLG
55 #include "wx/aboutdlg.h"
57 // these headers are only needed for custom about dialog
58 #include "wx/statline.h"
59 #include "wx/generic/aboutdlgg.h"
60 #endif // wxUSE_ABOUTDLG
63 #include "wx/busyinfo.h"
64 #endif // wxUSE_BUSYINFO
67 #include "wx/numdlg.h"
68 #endif // wxUSE_NUMBERDLG
71 #include "wx/filedlg.h"
72 #endif // wxUSE_FILEDLG
75 #include "wx/dirdlg.h"
76 #endif // wxUSE_DIRDLG
79 #include "wx/fontdlg.h"
80 #endif // wxUSE_FONTDLG
83 #include "wx/fdrepdlg.h"
84 #endif // wxUSE_FINDREPLDLG
87 #include "wx/spinctrl.h"
90 #include "wx/propdlg.h"
94 #if USE_COLOURDLG_GENERIC
95 #include "wx/generic/colrdlgg.h"
96 #endif // USE_COLOURDLG_GENERIC
98 #if USE_DIRDLG_GENERIC
99 #include "wx/generic/dirdlgg.h"
100 #endif // USE_DIRDLG_GENERIC
102 #if USE_FILEDLG_GENERIC
103 #include "wx/generic/filedlgg.h"
104 #endif // USE_FILEDLG_GENERIC
106 #if USE_FONTDLG_GENERIC
107 #include "wx/generic/fontdlgg.h"
108 #endif // USE_FONTDLG_GENERIC
112 BEGIN_EVENT_TABLE(MyCanvas
, wxScrolledWindow
)
113 EVT_PAINT(MyCanvas::OnPaint
)
118 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
120 EVT_MENU(DIALOGS_MESSAGE_BOX
, MyFrame::MessageBox
)
121 EVT_MENU(DIALOGS_MESSAGE_BOX_WXINFO
, MyFrame::MessageBoxInfo
)
122 #endif // wxUSE_MSGDLG
124 EVT_MENU(DIALOGS_CHOOSE_COLOUR
, MyFrame::ChooseColour
)
125 EVT_MENU(DIALOGS_GET_COLOUR
, MyFrame::GetColour
)
126 #endif // wxUSE_COLOURDLG
129 EVT_MENU(DIALOGS_CHOOSE_FONT
, MyFrame::ChooseFont
)
130 #endif // wxUSE_FONTDLG
133 EVT_MENU(DIALOGS_LOG_DIALOG
, MyFrame::LogDialog
)
134 #endif // wxUSE_LOG_DIALOG
137 EVT_MENU(DIALOGS_TEXT_ENTRY
, MyFrame::TextEntry
)
138 EVT_MENU(DIALOGS_PASSWORD_ENTRY
, MyFrame::PasswordEntry
)
139 #endif // wxUSE_TEXTDLG
142 EVT_MENU(DIALOGS_NUM_ENTRY
, MyFrame::NumericEntry
)
143 #endif // wxUSE_NUMBERDLG
146 EVT_MENU(DIALOGS_SINGLE_CHOICE
, MyFrame::SingleChoice
)
147 EVT_MENU(DIALOGS_MULTI_CHOICE
, MyFrame::MultiChoice
)
148 #endif // wxUSE_CHOICEDLG
151 EVT_MENU(DIALOGS_FILE_OPEN
, MyFrame::FileOpen
)
152 EVT_MENU(DIALOGS_FILE_OPEN2
, MyFrame::FileOpen2
)
153 EVT_MENU(DIALOGS_FILES_OPEN
, MyFrame::FilesOpen
)
154 EVT_MENU(DIALOGS_FILE_SAVE
, MyFrame::FileSave
)
155 #endif // wxUSE_FILEDLG
157 #if USE_FILEDLG_GENERIC
158 EVT_MENU(DIALOGS_FILE_OPEN_GENERIC
, MyFrame::FileOpenGeneric
)
159 EVT_MENU(DIALOGS_FILES_OPEN_GENERIC
, MyFrame::FilesOpenGeneric
)
160 EVT_MENU(DIALOGS_FILE_SAVE_GENERIC
, MyFrame::FileSaveGeneric
)
161 #endif // USE_FILEDLG_GENERIC
164 EVT_MENU(DIALOGS_DIR_CHOOSE
, MyFrame::DirChoose
)
165 EVT_MENU(DIALOGS_DIRNEW_CHOOSE
, MyFrame::DirChooseNew
)
166 #endif // wxUSE_DIRDLG
168 #if USE_MODAL_PRESENTATION
169 EVT_MENU(DIALOGS_MODAL
, MyFrame::ModalDlg
)
170 #endif // USE_MODAL_PRESENTATION
171 EVT_MENU(DIALOGS_MODELESS
, MyFrame::ModelessDlg
)
172 EVT_MENU(DIALOGS_CENTRE_SCREEN
, MyFrame::DlgCenteredScreen
)
173 EVT_MENU(DIALOGS_CENTRE_PARENT
, MyFrame::DlgCenteredParent
)
174 EVT_MENU(DIALOGS_MINIFRAME
, MyFrame::MiniFrame
)
175 EVT_MENU(DIALOGS_ONTOP
, MyFrame::DlgOnTop
)
177 #if wxUSE_STARTUP_TIPS
178 EVT_MENU(DIALOGS_TIP
, MyFrame::ShowTip
)
179 #endif // wxUSE_STARTUP_TIPS
181 #if USE_FONTDLG_GENERIC
182 EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC
, MyFrame::ChooseFontGeneric
)
183 #endif // USE_FONTDLG_GENERIC
185 #if USE_DIRDLG_GENERIC
186 EVT_MENU(DIALOGS_GENERIC_DIR_CHOOSE
, MyFrame::GenericDirChoose
)
187 #endif // wxMSW || wxMAC
189 #if USE_COLOURDLG_GENERIC
190 EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC
, MyFrame::ChooseColourGeneric
)
191 #endif // USE_COLOURDLG_GENERIC
193 #if wxUSE_PROGRESSDLG
194 EVT_MENU(DIALOGS_PROGRESS
, MyFrame::ShowProgress
)
195 #endif // wxUSE_PROGRESSDLG
198 EVT_MENU(DIALOGS_ABOUTDLG_SIMPLE
, MyFrame::ShowSimpleAboutDialog
)
199 EVT_MENU(DIALOGS_ABOUTDLG_FANCY
, MyFrame::ShowFancyAboutDialog
)
200 EVT_MENU(DIALOGS_ABOUTDLG_FULL
, MyFrame::ShowFullAboutDialog
)
201 EVT_MENU(DIALOGS_ABOUTDLG_CUSTOM
, MyFrame::ShowCustomAboutDialog
)
202 #endif // wxUSE_ABOUTDLG
205 EVT_MENU(DIALOGS_BUSYINFO
, MyFrame::ShowBusyInfo
)
206 #endif // wxUSE_BUSYINFO
208 #if wxUSE_FINDREPLDLG
209 EVT_MENU(DIALOGS_FIND
, MyFrame::ShowFindDialog
)
210 EVT_MENU(DIALOGS_REPLACE
, MyFrame::ShowReplaceDialog
)
212 EVT_FIND(wxID_ANY
, MyFrame::OnFindDialog
)
213 EVT_FIND_NEXT(wxID_ANY
, MyFrame::OnFindDialog
)
214 EVT_FIND_REPLACE(wxID_ANY
, MyFrame::OnFindDialog
)
215 EVT_FIND_REPLACE_ALL(wxID_ANY
, MyFrame::OnFindDialog
)
216 EVT_FIND_CLOSE(wxID_ANY
, MyFrame::OnFindDialog
)
217 #endif // wxUSE_FINDREPLDLG
219 #if USE_SETTINGS_DIALOG
220 EVT_MENU(DIALOGS_PROPERTY_SHEET
, MyFrame::OnPropertySheet
)
221 EVT_MENU(DIALOGS_PROPERTY_SHEET_TOOLBOOK
, MyFrame::OnPropertySheet
)
222 EVT_MENU(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK
, MyFrame::OnPropertySheet
)
223 #endif // USE_SETTINGS_DIALOG
225 EVT_MENU(DIALOGS_STANDARD_BUTTON_SIZER_DIALOG
, MyFrame::OnStandardButtonsSizerDialog
)
226 EVT_MENU(DIALOGS_TEST_DEFAULT_ACTION
, MyFrame::OnTestDefaultActionDialog
)
228 EVT_MENU(DIALOGS_REQUEST
, MyFrame::OnRequestUserAttention
)
229 #if wxUSE_NOTIFICATION_MESSAGE
230 EVT_MENU(DIALOGS_NOTIFY_AUTO
, MyFrame::OnNotifMsgAuto
)
231 EVT_MENU(DIALOGS_NOTIFY_SHOW
, MyFrame::OnNotifMsgShow
)
232 EVT_MENU(DIALOGS_NOTIFY_HIDE
, MyFrame::OnNotifMsgHide
)
233 #endif // wxUSE_NOTIFICATION_MESSAGE
235 EVT_MENU(wxID_EXIT
, MyFrame::OnExit
)
238 #if USE_MODAL_PRESENTATION
240 BEGIN_EVENT_TABLE(MyModalDialog
, wxDialog
)
241 EVT_BUTTON(wxID_ANY
, MyModalDialog::OnButton
)
244 BEGIN_EVENT_TABLE(MyModelessDialog
, wxDialog
)
245 EVT_BUTTON(DIALOGS_MODELESS_BTN
, MyModelessDialog::OnButton
)
246 EVT_CLOSE(MyModelessDialog::OnClose
)
249 #endif // USE_MODAL_PRESENTATION
251 BEGIN_EVENT_TABLE(StdButtonSizerDialog
, wxDialog
)
252 EVT_CHECKBOX(wxID_ANY
, StdButtonSizerDialog::OnEvent
)
253 EVT_RADIOBUTTON(wxID_ANY
, StdButtonSizerDialog::OnEvent
)
256 MyCanvas
*myCanvas
= (MyCanvas
*) NULL
;
258 // `Main program' equivalent, creating windows and returning main app frame
261 if ( !wxApp::OnInit() )
265 wxInitAllImageHandlers();
268 m_canvasTextColour
= *wxBLACK
;
269 m_canvasFont
= *wxNORMAL_FONT
;
271 // Create the main frame window
272 MyFrame
*frame
= new MyFrame((wxFrame
*) NULL
, _T("wxWidgets dialogs example"));
275 wxMenu
*menuDlg
= new wxMenu
;
277 menuDlg
->Append(DIALOGS_MESSAGE_BOX
, _T("&Message box\tCtrl-M"));
280 #if wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
282 wxMenu
*choices_menu
= new wxMenu
;
285 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR
, _T("&Choose bg colour"));
286 choices_menu
->Append(DIALOGS_GET_COLOUR
, _T("&Choose fg colour"));
287 #endif // wxUSE_COLOURDLG
290 choices_menu
->Append(DIALOGS_CHOOSE_FONT
, _T("Choose &font"));
291 #endif // wxUSE_FONTDLG
294 choices_menu
->Append(DIALOGS_SINGLE_CHOICE
, _T("&Single choice\tCtrl-C"));
295 choices_menu
->Append(DIALOGS_MULTI_CHOICE
, _T("M&ultiple choice\tCtrl-U"));
296 #endif // wxUSE_CHOICEDLG
298 #if USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
299 choices_menu
->AppendSeparator();
300 #endif // USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
302 #if USE_COLOURDLG_GENERIC
303 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR_GENERIC
, _T("&Choose colour (generic)"));
304 #endif // USE_COLOURDLG_GENERIC
306 #if USE_FONTDLG_GENERIC
307 choices_menu
->Append(DIALOGS_CHOOSE_FONT_GENERIC
, _T("Choose &font (generic)"));
308 #endif // USE_FONTDLG_GENERIC
310 menuDlg
->Append(wxID_ANY
,_T("&Choices and selectors"),choices_menu
);
311 #endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
314 #if wxUSE_TEXTDLG || wxUSE_NUMBERDLG
316 wxMenu
*entry_menu
= new wxMenu
;
319 entry_menu
->Append(DIALOGS_TEXT_ENTRY
, _T("Text &entry\tCtrl-E"));
320 entry_menu
->Append(DIALOGS_PASSWORD_ENTRY
, _T("&Password entry\tCtrl-P"));
321 #endif // wxUSE_TEXTDLG
324 entry_menu
->Append(DIALOGS_NUM_ENTRY
, _T("&Numeric entry\tCtrl-N"));
325 #endif // wxUSE_NUMBERDLG
327 menuDlg
->Append(wxID_ANY
,_T("&Entry dialogs"),entry_menu
);
329 #endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG
334 wxMenu
*filedlg_menu
= new wxMenu
;
335 filedlg_menu
->Append(DIALOGS_FILE_OPEN
, _T("&Open file\tCtrl-O"));
336 filedlg_menu
->Append(DIALOGS_FILE_OPEN2
, _T("&Second open file\tCtrl-2"));
337 filedlg_menu
->Append(DIALOGS_FILES_OPEN
, _T("Open &files\tCtrl-Q"));
338 filedlg_menu
->Append(DIALOGS_FILE_SAVE
, _T("Sa&ve file\tCtrl-S"));
340 #if USE_FILEDLG_GENERIC
341 filedlg_menu
->AppendSeparator();
342 filedlg_menu
->Append(DIALOGS_FILE_OPEN_GENERIC
, _T("&Open file (generic)"));
343 filedlg_menu
->Append(DIALOGS_FILES_OPEN_GENERIC
, _T("Open &files (generic)"));
344 filedlg_menu
->Append(DIALOGS_FILE_SAVE_GENERIC
, _T("Sa&ve file (generic)"));
345 #endif // USE_FILEDLG_GENERIC
347 menuDlg
->Append(wxID_ANY
,_T("&File operations"),filedlg_menu
);
349 #endif // wxUSE_FILEDLG
352 wxMenu
*dir_menu
= new wxMenu
;
354 dir_menu
->Append(DIALOGS_DIR_CHOOSE
, _T("&Choose a directory\tCtrl-D"));
355 dir_menu
->Append(DIALOGS_DIRNEW_CHOOSE
, _T("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"));
356 menuDlg
->Append(wxID_ANY
,_T("&Directory operations"),dir_menu
);
358 #if USE_DIRDLG_GENERIC
359 dir_menu
->AppendSeparator();
360 dir_menu
->Append(DIALOGS_GENERIC_DIR_CHOOSE
, _T("&Choose a directory (generic)"));
361 #endif // USE_DIRDLG_GENERIC
363 #endif // wxUSE_DIRDLG
366 #if wxUSE_STARTUP_TIPS || \
367 wxUSE_PROGRESSDLG || \
369 wxUSE_LOG_DIALOG || \
372 wxMenu
*info_menu
= new wxMenu
;
374 #if wxUSE_STARTUP_TIPS
375 info_menu
->Append(DIALOGS_TIP
, _T("&Tip of the day\tCtrl-T"));
376 #endif // wxUSE_STARTUP_TIPS
378 #if wxUSE_PROGRESSDLG
379 info_menu
->Append(DIALOGS_PROGRESS
, _T("Pro&gress dialog\tCtrl-G"));
380 #endif // wxUSE_PROGRESSDLG
383 info_menu
->Append(DIALOGS_BUSYINFO
, _T("&Busy info dialog\tCtrl-B"));
384 #endif // wxUSE_BUSYINFO
387 info_menu
->Append(DIALOGS_LOG_DIALOG
, _T("&Log dialog\tCtrl-L"));
388 #endif // wxUSE_LOG_DIALOG
391 info_menu
->Append(DIALOGS_MESSAGE_BOX_WXINFO
,
392 _T("&wxWidgets information\tCtrl-I"));
393 #endif // wxUSE_MSGDLG
395 menuDlg
->Append(wxID_ANY
,_T("&Informative dialogs"),info_menu
);
397 #endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
400 #if wxUSE_FINDREPLDLG
401 wxMenu
*find_menu
= new wxMenu
;
402 find_menu
->AppendCheckItem(DIALOGS_FIND
, _T("&Find dialog\tCtrl-F"));
403 find_menu
->AppendCheckItem(DIALOGS_REPLACE
, _T("Find and &replace dialog\tShift-Ctrl-F"));
404 menuDlg
->Append(wxID_ANY
,_T("&Searching"),find_menu
);
405 #endif // wxUSE_FINDREPLDLG
407 wxMenu
*dialogs_menu
= new wxMenu
;
408 #if USE_MODAL_PRESENTATION
409 dialogs_menu
->Append(DIALOGS_MODAL
, _T("&Modal dialog\tCtrl-W"));
410 #endif // USE_MODAL_PRESENTATION
411 dialogs_menu
->AppendCheckItem(DIALOGS_MODELESS
, _T("Mode&less dialog\tCtrl-Z"));
412 dialogs_menu
->Append(DIALOGS_CENTRE_SCREEN
, _T("Centered on &screen\tShift-Ctrl-1"));
413 dialogs_menu
->Append(DIALOGS_CENTRE_PARENT
, _T("Centered on &parent\tShift-Ctrl-2"));
414 dialogs_menu
->Append(DIALOGS_MINIFRAME
, _T("&Mini frame"));
415 dialogs_menu
->Append(DIALOGS_ONTOP
, _T("Dialog staying on &top"));
416 menuDlg
->Append(wxID_ANY
, _T("&Generic dialogs"), dialogs_menu
);
418 #if USE_SETTINGS_DIALOG
419 wxMenu
*sheet_menu
= new wxMenu
;
420 sheet_menu
->Append(DIALOGS_PROPERTY_SHEET
, _T("&Standard property sheet\tShift-Ctrl-P"));
421 sheet_menu
->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK
, _T("&Toolbook sheet\tShift-Ctrl-T"));
423 if (wxPlatformIs(wxPORT_MAC
))
424 sheet_menu
->Append(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK
, _T("Button &Toolbook sheet\tShift-Ctrl-U"));
427 sheet_menu->Append(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, _T("Button &Toolbook sheet\tShift-Ctrl-U"));
430 menuDlg
->Append(wxID_ANY
, _T("&Property sheets"), sheet_menu
);
431 #endif // USE_SETTINGS_DIALOG
433 wxMenu
*menuNotif
= new wxMenu
;
434 menuNotif
->Append(DIALOGS_REQUEST
, _T("&Request user attention\tCtrl-R"));
435 #if wxUSE_NOTIFICATION_MESSAGE
436 menuNotif
->Append(DIALOGS_NOTIFY_AUTO
, "&Automatically hidden notification");
437 menuNotif
->Append(DIALOGS_NOTIFY_SHOW
, "&Show manual notification");
438 menuNotif
->Append(DIALOGS_NOTIFY_HIDE
, "&Hide manual notification");
439 #endif // wxUSE_NOTIFICATION_MESSAGE
440 menuDlg
->AppendSubMenu(menuNotif
, "&User notifications");
442 menuDlg
->Append(DIALOGS_STANDARD_BUTTON_SIZER_DIALOG
, _T("&Standard Buttons Sizer Dialog"));
443 menuDlg
->Append(DIALOGS_TEST_DEFAULT_ACTION
, _T("&Test dialog default action"));
445 menuDlg
->AppendSeparator();
446 menuDlg
->Append(wxID_EXIT
, _T("E&xit\tAlt-X"));
449 wxMenu
*menuHelp
= new wxMenu
;
450 menuHelp
->Append(DIALOGS_ABOUTDLG_SIMPLE
, _T("&About (simple)...\tF1"));
451 menuHelp
->Append(DIALOGS_ABOUTDLG_FANCY
, _T("About (&fancy)...\tShift-F1"));
452 menuHelp
->Append(DIALOGS_ABOUTDLG_FULL
, _T("About (f&ull)...\tCtrl-F1"));
453 menuHelp
->Append(DIALOGS_ABOUTDLG_CUSTOM
, _T("About (&custom)...\tCtrl-Shift-F1"));
454 #endif // wxUSE_ABOUTDLG
456 wxMenuBar
*menubar
= new wxMenuBar
;
457 menubar
->Append(menuDlg
, _T("&Dialogs"));
459 menubar
->Append(menuHelp
, _T("&Help"));
460 #endif // wxUSE_ABOUTDLG
462 frame
->SetMenuBar(menubar
);
464 myCanvas
= new MyCanvas(frame
);
465 myCanvas
->SetBackgroundColour(*wxWHITE
);
467 frame
->Centre(wxBOTH
);
477 // My frame constructor
478 MyFrame::MyFrame(wxWindow
*parent
,
479 const wxString
& title
)
480 : wxFrame(parent
, wxID_ANY
, title
)
484 #if USE_MODAL_PRESENTATION
485 m_dialog
= (MyModelessDialog
*)NULL
;
486 #endif // USE_MODAL_PRESENTATION
488 #if wxUSE_FINDREPLDLG
494 m_clrData
.SetChooseFull(true);
495 for (int i
= 0; i
< wxColourData::NUM_CUSTOM
; i
++)
497 unsigned char n
= i
*16;
498 m_clrData
.SetCustomColour(i
, wxColour(n
, n
, n
));
500 #endif // wxUSE_COLOURDLG
502 #if wxUSE_NOTIFICATION_MESSAGE
504 #endif // wxUSE_NOTIFICATION_MESSAGE
508 #endif // wxUSE_STATUSBAR
513 #if wxUSE_NOTIFICATION_MESSAGE
515 #endif // wxUSE_NOTIFICATION_MESSAGE
520 void MyFrame::ChooseColour(wxCommandEvent
& WXUNUSED(event
))
522 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
524 wxColourDialog
dialog(this, &m_clrData
);
525 dialog
.SetTitle(_("Please choose the background colour"));
526 if ( dialog
.ShowModal() == wxID_OK
)
528 m_clrData
= dialog
.GetColourData();
529 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
530 myCanvas
->ClearBackground();
535 void MyFrame::GetColour(wxCommandEvent
& WXUNUSED(event
))
537 wxColour clr
= wxGetColourFromUser
540 wxGetApp().m_canvasTextColour
,
541 "Please choose the foreground colour"
545 wxGetApp().m_canvasTextColour
= clr
;
548 //else: dialog cancelled by user
551 #endif // wxUSE_COLOURDLG
554 #if USE_COLOURDLG_GENERIC
555 void MyFrame::ChooseColourGeneric(wxCommandEvent
& WXUNUSED(event
))
557 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
559 //FIXME:TODO:This has no effect...
560 m_clrData
.SetChooseFull(true);
562 for (int i
= 0; i
< 16; i
++)
565 (unsigned char)(i
*16),
566 (unsigned char)(i
*16),
567 (unsigned char)(i
*16)
569 m_clrData
.SetCustomColour(i
, colour
);
572 wxGenericColourDialog
*dialog
= new wxGenericColourDialog(this, &m_clrData
);
573 if (dialog
->ShowModal() == wxID_OK
)
575 m_clrData
= dialog
->GetColourData();
576 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
577 myCanvas
->ClearBackground();
582 #endif // USE_COLOURDLG_GENERIC
585 void MyFrame::ChooseFont(wxCommandEvent
& WXUNUSED(event
) )
588 data
.SetInitialFont(wxGetApp().m_canvasFont
);
589 data
.SetColour(wxGetApp().m_canvasTextColour
);
591 // you might also do this:
593 // wxFontDialog dialog;
594 // if ( !dialog.Create(this, data) { ... error ... }
596 wxFontDialog
dialog(this, data
);
598 if (dialog
.ShowModal() == wxID_OK
)
600 wxFontData retData
= dialog
.GetFontData();
601 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
602 wxGetApp().m_canvasTextColour
= retData
.GetColour();
605 //else: cancelled by the user, don't change the font
607 #endif // wxUSE_FONTDLG
609 #if USE_FONTDLG_GENERIC
610 void MyFrame::ChooseFontGeneric(wxCommandEvent
& WXUNUSED(event
) )
613 data
.SetInitialFont(wxGetApp().m_canvasFont
);
614 data
.SetColour(wxGetApp().m_canvasTextColour
);
616 wxGenericFontDialog
*dialog
= new wxGenericFontDialog(this, data
);
617 if (dialog
->ShowModal() == wxID_OK
)
619 wxFontData retData
= dialog
->GetFontData();
620 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
621 wxGetApp().m_canvasTextColour
= retData
.GetColour();
626 #endif // USE_FONTDLG_GENERIC
629 void MyFrame::LogDialog(wxCommandEvent
& WXUNUSED(event
))
631 // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
632 // being flushed -- test it
635 wxLogMessage(wxT("This is some message - everything is ok so far."));
636 wxLogMessage(wxT("Another message...\n... this one is on multiple lines"));
637 wxLogWarning(wxT("And then something went wrong!"));
639 // and if ~wxBusyCursor doesn't do it, then call it manually
643 wxLogError(wxT("Intermediary error handler decided to abort."));
644 wxLogError(wxT("The top level caller detected an unrecoverable error."));
646 wxLog::FlushActive();
648 wxLogMessage(wxT("And this is the same dialog but with only one message."));
650 #endif // wxUSE_LOG_DIALOG
653 void MyFrame::MessageBox(wxCommandEvent
& WXUNUSED(event
) )
655 wxMessageDialog
dialog(this,
656 "This is a message box\n"
657 "A long, long string to test out the message box "
660 wxCENTER
| wxNO_DEFAULT
| wxYES_NO
| wxCANCEL
| wxICON_INFORMATION
);
663 if ( dialog
.SetYesNoCancelLabels
670 extmsg
= "This platform supports custom button labels,\n"
671 "so you should see the descriptiva text below.";
675 extmsg
= "Custom button labels are not supported on this platform,\n"
676 "so the default \"Yes\"/\"No\"/\"Cancel\" buttons are used.";
678 dialog
.SetExtendedMessage(extmsg
);
680 switch ( dialog
.ShowModal() )
683 wxLogStatus(wxT("You pressed \"Yes\""));
687 wxLogStatus(wxT("You pressed \"No\""));
691 wxLogStatus(wxT("You pressed \"Cancel\""));
695 wxLogError(wxT("Unexpected wxMessageDialog return code!"));
699 void MyFrame::MessageBoxInfo(wxCommandEvent
& WXUNUSED(event
))
701 ::wxInfoMessageBox(this);
703 #endif // wxUSE_MSGDLG
706 void MyFrame::NumericEntry(wxCommandEvent
& WXUNUSED(event
))
708 long res
= wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n")
709 _T("Even two rows of text."),
710 _T("Enter a number:"), _T("Numeric input test"),
717 msg
= _T("Invalid number entered or dialog cancelled.");
722 msg
.Printf(_T("You've entered %lu"), res
);
723 icon
= wxICON_INFORMATION
;
726 wxMessageBox(msg
, _T("Numeric test result"), wxOK
| icon
, this);
728 #endif // wxUSE_NUMBERDLG
731 void MyFrame::PasswordEntry(wxCommandEvent
& WXUNUSED(event
))
733 wxString pwd
= wxGetPasswordFromUser(_T("Enter password:"),
734 _T("Password entry dialog"),
739 wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd
.c_str()),
740 _T("Got password"), wxOK
| wxICON_INFORMATION
, this);
744 void MyFrame::TextEntry(wxCommandEvent
& WXUNUSED(event
))
746 wxTextEntryDialog
dialog(this,
747 _T("This is a small sample\n")
748 _T("A long, long string to test out the text entrybox"),
749 _T("Please enter a string"),
753 if (dialog
.ShowModal() == wxID_OK
)
755 wxMessageBox(dialog
.GetValue(), _T("Got string"), wxOK
| wxICON_INFORMATION
, this);
758 #endif // wxUSE_TEXTDLG
761 void MyFrame::SingleChoice(wxCommandEvent
& WXUNUSED(event
) )
763 const wxString choices
[] = { _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five") } ;
765 wxSingleChoiceDialog
dialog(this,
766 _T("This is a small sample\n")
767 _T("A single-choice convenience dialog"),
768 _T("Please select a value"),
769 WXSIZEOF(choices
), choices
);
771 dialog
.SetSelection(2);
773 if (dialog
.ShowModal() == wxID_OK
)
775 wxMessageDialog
dialog2(this, dialog
.GetStringSelection(), _T("Got string"));
780 void MyFrame::MultiChoice(wxCommandEvent
& WXUNUSED(event
) )
782 const wxString choices
[] =
784 _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five"),
785 _T("Six"), _T("Seven"), _T("Eight"), _T("Nine"), _T("Ten"),
786 _T("Eleven"), _T("Twelve"), _T("Seventeen"),
789 wxArrayInt selections
;
790 size_t count
= wxGetMultipleChoices(selections
,
791 _T("This is a small sample\n")
792 _T("A multi-choice convenience dialog"),
793 _T("Please select a value"),
794 WXSIZEOF(choices
), choices
,
799 msg
.Printf(wxT("You selected %u items:\n"), (unsigned)count
);
800 for ( size_t n
= 0; n
< count
; n
++ )
802 msg
+= wxString::Format(wxT("\t%u: %u (%s)\n"),
803 (unsigned)n
, (unsigned)selections
[n
],
804 choices
[selections
[n
]].c_str());
808 //else: cancelled or nothing selected
810 #endif // wxUSE_CHOICEDLG
814 // panel with custom controls for file dialog
815 class MyExtraPanel
: public wxPanel
818 MyExtraPanel(wxWindow
*parent
);
819 void OnCheckBox(wxCommandEvent
& event
) { m_btn
->Enable(event
.IsChecked()); }
820 wxString
GetInfo() const
822 return wxString::Format("checkbox value = %d", (int) m_cb
->GetValue());
829 MyExtraPanel::MyExtraPanel(wxWindow
*parent
)
832 m_btn
= new wxButton(this, -1, _T("Custom Button"));
833 m_btn
->Enable(false);
834 m_cb
= new wxCheckBox(this, -1, _T("Enable Custom Button"));
835 m_cb
->Connect(wxID_ANY
, wxEVT_COMMAND_CHECKBOX_CLICKED
,
836 wxCommandEventHandler(MyExtraPanel::OnCheckBox
), NULL
, this);
837 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
838 sizerTop
->Add(m_cb
, wxSizerFlags().Centre().Border());
839 sizerTop
->AddStretchSpacer();
840 sizerTop
->Add(m_btn
, wxSizerFlags().Right().Border());
841 SetSizerAndFit(sizerTop
);
844 // a static method can be used instead of a function with most of compilers
845 static wxWindow
* createMyExtraPanel(wxWindow
*parent
)
847 return new MyExtraPanel(parent
);
850 void MyFrame::FileOpen(wxCommandEvent
& WXUNUSED(event
) )
855 _T("Testing open file dialog"),
859 _T("C++ files (*.cpp)|*.cpp")
861 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
865 dialog
.SetExtraControlCreator(&createMyExtraPanel
);
866 dialog
.CentreOnParent();
867 dialog
.SetDirectory(wxGetHomeDir());
869 if (dialog
.ShowModal() == wxID_OK
)
872 MyExtraPanel
*extra_panel
873 = static_cast<MyExtraPanel
*>(dialog
.GetExtraControl());
874 info
.Printf(_T("Full file name: %s\n")
877 _T("Custom window: %s"),
878 dialog
.GetPath().c_str(),
879 dialog
.GetDirectory().c_str(),
880 dialog
.GetFilename().c_str(),
881 extra_panel
->GetInfo().c_str());
882 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
887 // this shows how to take advantage of specifying a default extension in the
888 // call to wxFileSelector: it is remembered after each new call and the next
889 // one will use it by default
890 void MyFrame::FileOpen2(wxCommandEvent
& WXUNUSED(event
) )
892 static wxString s_extDef
;
893 wxString path
= wxFileSelector(
894 _T("Select the file to load"),
895 wxEmptyString
, wxEmptyString
,
899 _T("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"),
900 wxFileSelectorDefaultWildcardStr
,
901 wxFileSelectorDefaultWildcardStr
903 wxFD_OPEN
|wxFD_CHANGE_DIR
|wxFD_PREVIEW
,
910 // it is just a sample, would use wxSplitPath in real program
911 s_extDef
= path
.AfterLast(_T('.'));
913 wxLogMessage(_T("You selected the file '%s', remembered extension '%s'"),
917 void MyFrame::FilesOpen(wxCommandEvent
& WXUNUSED(event
) )
921 _T("C++ files (*.cpp)|*.cpp");
925 _T("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"),
926 wxFileSelectorDefaultWildcardStr
,
927 wxFileSelectorDefaultWildcardStr
930 wxFileDialog
dialog(this, _T("Testing open multiple file dialog"),
931 wxEmptyString
, wxEmptyString
, wildcards
,
932 wxFD_OPEN
|wxFD_MULTIPLE
);
934 if (dialog
.ShowModal() == wxID_OK
)
936 wxArrayString paths
, filenames
;
938 dialog
.GetPaths(paths
);
939 dialog
.GetFilenames(filenames
);
942 size_t count
= paths
.GetCount();
943 for ( size_t n
= 0; n
< count
; n
++ )
945 s
.Printf(_T("File %d: %s (%s)\n"),
946 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
950 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
953 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
958 void MyFrame::FileSave(wxCommandEvent
& WXUNUSED(event
) )
960 wxFileDialog
dialog(this,
961 _T("Testing save file dialog"),
964 _T("Text files (*.txt)|*.txt|Document files (*.doc;*.ods)|*.doc;*.ods"),
965 wxFD_SAVE
|wxFD_OVERWRITE_PROMPT
);
967 dialog
.SetFilterIndex(1);
969 if (dialog
.ShowModal() == wxID_OK
)
971 wxLogMessage(_T("%s, filter %d"),
972 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
975 #endif // wxUSE_FILEDLG
977 #if USE_FILEDLG_GENERIC
978 void MyFrame::FileOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
980 wxGenericFileDialog dialog
983 _T("Testing open file dialog"),
986 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
989 dialog
.SetExtraControlCreator(&createMyExtraPanel
);
990 dialog
.SetDirectory(wxGetHomeDir());
992 if (dialog
.ShowModal() == wxID_OK
)
995 info
.Printf(_T("Full file name: %s\n")
998 dialog
.GetPath().c_str(),
999 dialog
.GetDirectory().c_str(),
1000 dialog
.GetFilename().c_str());
1001 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
1002 dialog2
.ShowModal();
1006 void MyFrame::FilesOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
1008 // On PocketPC you can disable OK-only dialogs policy using system option
1009 int buttons
= wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel"));
1010 wxSystemOptions::SetOption(wxT("wince.dialog.real-ok-cancel"), 1);
1012 wxString wildcards
= _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
1013 wxGenericFileDialog
dialog(this, _T("Testing open multiple file dialog"),
1014 wxEmptyString
, wxEmptyString
, wildcards
,
1017 if (dialog
.ShowModal() == wxID_OK
)
1019 wxArrayString paths
, filenames
;
1021 dialog
.GetPaths(paths
);
1022 dialog
.GetFilenames(filenames
);
1025 size_t count
= paths
.GetCount();
1026 for ( size_t n
= 0; n
< count
; n
++ )
1028 s
.Printf(_T("File %d: %s (%s)\n"),
1029 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
1033 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
1036 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
1037 dialog2
.ShowModal();
1040 // restore system option
1041 wxSystemOptions::SetOption(wxT("wince.dialog.real-ok-cancel"), buttons
);
1044 void MyFrame::FileSaveGeneric(wxCommandEvent
& WXUNUSED(event
) )
1046 wxGenericFileDialog
dialog(this,
1047 _T("Testing save file dialog"),
1050 _T("Text files (*.txt)|*.txt|Document files (*.doc;*.ods)|*.doc;*.ods"),
1051 wxFD_SAVE
|wxFD_OVERWRITE_PROMPT
);
1053 dialog
.SetFilterIndex(1);
1055 if (dialog
.ShowModal() == wxID_OK
)
1057 wxLogMessage(_T("%s, filter %d"),
1058 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
1061 #endif // USE_FILEDLG_GENERIC
1064 void MyFrame::DoDirChoose(int style
)
1066 // pass some initial dir to wxDirDialog
1068 wxGetHomeDir(&dirHome
);
1070 wxDirDialog
dialog(this, _T("Testing directory picker"), dirHome
, style
);
1072 if (dialog
.ShowModal() == wxID_OK
)
1074 wxLogMessage(_T("Selected path: %s"), dialog
.GetPath().c_str());
1078 void MyFrame::DirChoose(wxCommandEvent
& WXUNUSED(event
) )
1080 DoDirChoose(wxDD_DEFAULT_STYLE
| wxDD_DIR_MUST_EXIST
);
1083 void MyFrame::DirChooseNew(wxCommandEvent
& WXUNUSED(event
) )
1085 DoDirChoose(wxDD_DEFAULT_STYLE
& ~wxDD_DIR_MUST_EXIST
);
1087 #endif // wxUSE_DIRDLG
1089 #if USE_DIRDLG_GENERIC
1090 void MyFrame::GenericDirChoose(wxCommandEvent
& WXUNUSED(event
) )
1092 // pass some initial dir to wxDirDialog
1094 wxGetHomeDir(&dirHome
);
1096 wxGenericDirDialog
dialog(this, _T("Testing generic directory picker"), dirHome
);
1098 if (dialog
.ShowModal() == wxID_OK
)
1100 wxMessageDialog
dialog2(this, dialog
.GetPath(), _T("Selected path"));
1101 dialog2
.ShowModal();
1104 #endif // USE_DIRDLG_GENERIC
1106 #if USE_MODAL_PRESENTATION
1107 void MyFrame::ModalDlg(wxCommandEvent
& WXUNUSED(event
))
1109 MyModalDialog
dlg(this);
1112 #endif // USE_MODAL_PRESENTATION
1114 void MyFrame::ModelessDlg(wxCommandEvent
& event
)
1116 bool show
= GetMenuBar()->IsChecked(event
.GetId());
1122 m_dialog
= new MyModelessDialog(this);
1125 m_dialog
->Show(true);
1129 // If m_dialog is NULL, then possibly the system
1130 // didn't report the checked menu item status correctly.
1131 // It should be true just after the menu item was selected,
1132 // if there was no modeless dialog yet.
1134 wxASSERT( m_dialog
!= NULL
);
1140 void MyFrame::DlgCenteredScreen(wxCommandEvent
& WXUNUSED(event
))
1142 wxDialog
dlg(this, wxID_ANY
, _T("Dialog centered on screen"),
1143 wxDefaultPosition
, wxSize(200, 100));
1144 (new wxButton(&dlg
, wxID_OK
, _T("Close")))->Centre();
1145 dlg
.CentreOnScreen();
1149 void MyFrame::DlgCenteredParent(wxCommandEvent
& WXUNUSED(event
))
1151 wxDialog
dlg(this, wxID_ANY
, _T("Dialog centered on parent"),
1152 wxDefaultPosition
, wxSize(200, 100));
1153 (new wxButton(&dlg
, wxID_OK
, _T("Close")))->Centre();
1154 dlg
.CentreOnParent();
1158 void MyFrame::MiniFrame(wxCommandEvent
& WXUNUSED(event
))
1160 wxFrame
*frame
= new wxMiniFrame(this, wxID_ANY
, _T("Mini frame"),
1161 wxDefaultPosition
, wxSize(300, 100),
1162 wxCAPTION
| wxCLOSE_BOX
);
1163 new wxStaticText(frame
,
1165 _T("Mini frames have slightly different appearance"),
1167 new wxStaticText(frame
,
1169 _T("from the normal frames but that's the only difference."),
1172 frame
->CentreOnParent();
1176 void MyFrame::DlgOnTop(wxCommandEvent
& WXUNUSED(event
))
1178 wxDialog
dlg(this, wxID_ANY
, _T("Dialog staying on top of other windows"),
1179 wxDefaultPosition
, wxSize(300, 100),
1180 wxDEFAULT_DIALOG_STYLE
| wxSTAY_ON_TOP
);
1181 (new wxButton(&dlg
, wxID_OK
, _T("Close")))->Centre();
1185 #if wxUSE_STARTUP_TIPS
1186 void MyFrame::ShowTip(wxCommandEvent
& WXUNUSED(event
))
1188 static size_t s_index
= (size_t)-1;
1190 if ( s_index
== (size_t)-1 )
1194 // this is completely bogus, we don't know how many lines are there
1195 // in the file, but who cares, it's a demo only...
1196 s_index
= rand() % 5;
1199 wxTipProvider
*tipProvider
= wxCreateFileTipProvider(_T("tips.txt"), s_index
);
1201 bool showAtStartup
= wxShowTip(this, tipProvider
);
1203 if ( showAtStartup
)
1205 wxMessageBox(_T("Will show tips on startup"), _T("Tips dialog"),
1206 wxOK
| wxICON_INFORMATION
, this);
1209 s_index
= tipProvider
->GetCurrentTip();
1212 #endif // wxUSE_STARTUP_TIPS
1214 #if USE_SETTINGS_DIALOG
1215 void MyFrame::OnPropertySheet(wxCommandEvent
& event
)
1217 SettingsDialog
dialog(this, event
.GetId());
1220 #endif // USE_SETTINGS_DIALOG
1222 void MyFrame::OnRequestUserAttention(wxCommandEvent
& WXUNUSED(event
))
1224 wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window"));
1228 RequestUserAttention(wxUSER_ATTENTION_ERROR
);
1231 #if wxUSE_NOTIFICATION_MESSAGE
1233 void MyFrame::OnNotifMsgAuto(wxCommandEvent
& WXUNUSED(event
))
1235 if ( !wxNotificationMessage
1237 "Automatic Notification",
1238 "Nothing important has happened\n"
1239 "this notification will disappear soon."
1242 wxLogStatus("Failed to show notification message");
1246 void MyFrame::OnNotifMsgShow(wxCommandEvent
& WXUNUSED(event
))
1250 m_notifMsg
= new wxNotificationMessage
1252 "wxWidgets Manual Notification",
1253 "You can hide this notification from the menu",
1258 if ( !m_notifMsg
->Show(wxNotificationMessage::Timeout_Never
) )
1260 wxLogStatus("Failed to show manual notification message");
1264 void MyFrame::OnNotifMsgHide(wxCommandEvent
& WXUNUSED(event
))
1268 if ( !m_notifMsg
->Close() )
1269 wxLogStatus("Failed to hide manual notification message");
1273 #endif // wxUSE_NOTIFICATION_MESSAGE
1275 void MyFrame::OnStandardButtonsSizerDialog(wxCommandEvent
& WXUNUSED(event
))
1277 StdButtonSizerDialog
dialog(this);
1281 // TestDefaultAction
1283 #define ID_CATCH_LISTBOX_DCLICK 100
1284 #define ID_LISTBOX 101
1286 BEGIN_EVENT_TABLE(TestDefaultActionDialog
, wxDialog
)
1287 EVT_CHECKBOX(ID_CATCH_LISTBOX_DCLICK
, TestDefaultActionDialog::OnCatchListBoxDClick
)
1288 EVT_LISTBOX_DCLICK(ID_LISTBOX
, TestDefaultActionDialog::OnListBoxDClick
)
1291 TestDefaultActionDialog::TestDefaultActionDialog( wxWindow
*parent
) :
1292 wxDialog( parent
, -1, "Test default action" )
1294 m_catchListBoxDClick
= false;
1296 wxBoxSizer
*main_sizer
= new wxBoxSizer( wxVERTICAL
);
1298 wxFlexGridSizer
*grid_sizer
= new wxFlexGridSizer( 2, 5, 5 );
1300 wxListBox
*listbox
= new wxListBox( this, ID_LISTBOX
);
1301 listbox
->Append( "String 1" );
1302 listbox
->Append( "String 2" );
1303 listbox
->Append( "String 3" );
1304 listbox
->Append( "String 4" );
1305 grid_sizer
->Add( listbox
);
1307 grid_sizer
->Add( new wxCheckBox( this, ID_CATCH_LISTBOX_DCLICK
, "Catch DoubleClick from wxListBox" ), 0, wxALIGN_CENTRE_VERTICAL
);
1309 grid_sizer
->Add( new wxTextCtrl( this, -1, "", wxDefaultPosition
, wxSize(80,-1), 0 ), 0, wxALIGN_CENTRE_VERTICAL
);
1310 grid_sizer
->Add( new wxStaticText( this, -1, "wxTextCtrl without wxTE_PROCESS_ENTER" ), 0, wxALIGN_CENTRE_VERTICAL
);
1312 grid_sizer
->Add( new wxTextCtrl( this, -1, "", wxDefaultPosition
, wxSize(80,-1), wxTE_PROCESS_ENTER
), 0, wxALIGN_CENTRE_VERTICAL
);
1313 grid_sizer
->Add( new wxStaticText( this, -1, "wxTextCtrl with wxTE_PROCESS_ENTER" ), 0, wxALIGN_CENTRE_VERTICAL
);
1315 main_sizer
->Add( grid_sizer
, 0, wxALL
, 10 );
1317 wxSizer
*button_sizer
= CreateSeparatedButtonSizer( wxOK
|wxCANCEL
);
1319 main_sizer
->Add( button_sizer
, 0, wxALL
|wxGROW
, 5 );
1321 SetSizerAndFit( main_sizer
);
1324 void TestDefaultActionDialog::OnListBoxDClick(wxCommandEvent
& event
)
1326 event
.Skip( !m_catchListBoxDClick
);
1329 void TestDefaultActionDialog::OnCatchListBoxDClick(wxCommandEvent
& WXUNUSED(event
))
1331 m_catchListBoxDClick
= !m_catchListBoxDClick
;
1334 void MyFrame::OnTestDefaultActionDialog(wxCommandEvent
& WXUNUSED(event
))
1336 TestDefaultActionDialog
dialog( this );
1340 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
) )
1345 #if wxUSE_PROGRESSDLG
1347 void MyFrame::ShowProgress( wxCommandEvent
& WXUNUSED(event
) )
1349 static const int max
= 100;
1351 wxProgressDialog
dialog(_T("Progress dialog example"),
1352 _T("An informative message"),
1358 // wxPD_AUTO_HIDE | -- try this as well
1360 wxPD_ESTIMATED_TIME
|
1362 | wxPD_SMOOTH
// - makes indeterminate mode bar on WinXP very small
1366 for ( int i
= 0; i
<= max
; i
++ )
1372 // test both modes of wxProgressDialog behaviour: start in
1373 // indeterminate mode but switch to the determinate one later
1374 const bool determinate
= i
> max
/2;
1378 msg
= _T("That's all, folks!");
1380 else if ( !determinate
)
1382 msg
= _T("Testing indeterminate mode");
1384 else if ( determinate
)
1386 msg
= _T("Now in standard determinate mode");
1389 // will be set to true if "Skip" button was pressed
1393 cont
= dialog
.Update(i
, msg
, &skip
);
1397 cont
= dialog
.Pulse(msg
, &skip
);
1400 // each skip will move progress about quarter forward
1406 if ( wxMessageBox(_T("Do you really want to cancel?"),
1407 _T("Progress dialog question"), // caption
1408 wxYES_NO
| wxICON_QUESTION
) == wxYES
)
1418 wxLogStatus(wxT("Progress dialog aborted!"));
1422 wxLogStatus(wxT("Countdown from %d finished"), max
);
1426 #endif // wxUSE_PROGRESSDLG
1430 static void InitAboutInfoMinimal(wxAboutDialogInfo
& info
)
1432 info
.SetName(_T("Dialogs Sample"));
1433 info
.SetVersion(wxVERSION_NUM_DOT_STRING_T
);
1434 info
.SetDescription(_T("This sample shows different wxWidgets dialogs"));
1435 info
.SetCopyright(_T("(C) 1998-2006 wxWidgets dev team"));
1436 info
.AddDeveloper(_T("Vadim Zeitlin"));
1439 static void InitAboutInfoWebsite(wxAboutDialogInfo
& info
)
1441 InitAboutInfoMinimal(info
);
1443 info
.SetWebSite(_T("http://www.wxwidgets.org/"), _T("wxWidgets web site"));
1446 static void InitAboutInfoAll(wxAboutDialogInfo
& info
)
1448 InitAboutInfoWebsite(info
);
1450 // we can add a second developer
1451 info
.AddDeveloper(_T("A.N. Other"));
1453 // or we can add several persons at once like this
1454 static const wxChar
*docwriters
[] =
1456 _T("First D. Writer"),
1460 info
.SetDocWriters(wxArrayString(WXSIZEOF(docwriters
), docwriters
));
1461 info
.SetLicence(wxString::FromAscii(
1462 " wxWindows Library Licence, Version 3.1\n"
1463 " ======================================\n"
1465 " Copyright (c) 1998-2005 Julian Smart, Robert Roebling et al\n"
1467 " Everyone is permitted to copy and distribute verbatim copies\n"
1468 " of this licence document, but changing it is not allowed.\n"
1470 " WXWINDOWS LIBRARY LICENCE\n"
1471 " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n"
1473 " ...and so on and so forth...\n"
1476 info
.AddTranslator(_T("Wun Ngo Wen (Martian)"));
1479 void MyFrame::ShowSimpleAboutDialog(wxCommandEvent
& WXUNUSED(event
))
1481 wxAboutDialogInfo info
;
1482 InitAboutInfoMinimal(info
);
1487 void MyFrame::ShowFancyAboutDialog(wxCommandEvent
& WXUNUSED(event
))
1489 wxAboutDialogInfo info
;
1490 InitAboutInfoWebsite(info
);
1495 void MyFrame::ShowFullAboutDialog(wxCommandEvent
& WXUNUSED(event
))
1497 wxAboutDialogInfo info
;
1498 InitAboutInfoAll(info
);
1503 // a trivial example of a custom dialog class
1504 class MyAboutDialog
: public wxGenericAboutDialog
1507 MyAboutDialog(const wxAboutDialogInfo
& info
)
1512 // add some custom controls
1513 virtual void DoAddCustomControls()
1515 AddControl(new wxStaticLine(this), wxSizerFlags().Expand());
1516 AddText(_T("Some custom text"));
1517 AddControl(new wxStaticLine(this), wxSizerFlags().Expand());
1521 void MyFrame::ShowCustomAboutDialog(wxCommandEvent
& WXUNUSED(event
))
1523 wxAboutDialogInfo info
;
1524 InitAboutInfoAll(info
);
1526 MyAboutDialog
dlg(info
);
1530 #endif // wxUSE_ABOUTDLG
1534 void MyFrame::ShowBusyInfo(wxCommandEvent
& WXUNUSED(event
))
1536 wxWindowDisabler disableAll
;
1538 wxBusyInfo
info(_T("Working, please wait..."), this);
1540 for ( int i
= 0; i
< 18; i
++ )
1550 #endif // wxUSE_BUSYINFO
1552 #if wxUSE_FINDREPLDLG
1554 void MyFrame::ShowReplaceDialog( wxCommandEvent
& WXUNUSED(event
) )
1558 delete m_dlgReplace
;
1559 m_dlgReplace
= NULL
;
1563 m_dlgReplace
= new wxFindReplaceDialog
1567 _T("Find and replace dialog"),
1571 m_dlgReplace
->Show(true);
1575 void MyFrame::ShowFindDialog( wxCommandEvent
& WXUNUSED(event
) )
1584 m_dlgFind
= new wxFindReplaceDialog
1593 m_dlgFind
->Show(true);
1597 static wxString
DecodeFindDialogEventFlags(int flags
)
1600 str
<< (flags
& wxFR_DOWN
? _T("down") : _T("up")) << _T(", ")
1601 << (flags
& wxFR_WHOLEWORD
? _T("whole words only, ") : _T(""))
1602 << (flags
& wxFR_MATCHCASE
? _T("") : _T("not "))
1603 << _T("case sensitive");
1608 void MyFrame::OnFindDialog(wxFindDialogEvent
& event
)
1610 wxEventType type
= event
.GetEventType();
1612 if ( type
== wxEVT_COMMAND_FIND
|| type
== wxEVT_COMMAND_FIND_NEXT
)
1614 wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
1615 type
== wxEVT_COMMAND_FIND_NEXT
? wxT("next ") : wxT(""),
1616 event
.GetFindString().c_str(),
1617 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1619 else if ( type
== wxEVT_COMMAND_FIND_REPLACE
||
1620 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
)
1622 wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
1623 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
? _T("all ") : wxT(""),
1624 event
.GetFindString().c_str(),
1625 event
.GetReplaceString().c_str(),
1626 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1628 else if ( type
== wxEVT_COMMAND_FIND_CLOSE
)
1630 wxFindReplaceDialog
*dlg
= event
.GetDialog();
1634 if ( dlg
== m_dlgFind
)
1637 idMenu
= DIALOGS_FIND
;
1640 else if ( dlg
== m_dlgReplace
)
1642 txt
= _T("Replace");
1643 idMenu
= DIALOGS_REPLACE
;
1644 m_dlgReplace
= NULL
;
1648 txt
= _T("Unknown");
1651 wxFAIL_MSG( _T("unexpected event") );
1654 wxLogMessage(wxT("%s dialog is being closed."), txt
);
1656 if ( idMenu
!= wxID_ANY
)
1658 GetMenuBar()->Check(idMenu
, false);
1665 wxLogError(wxT("Unknown find dialog event!"));
1669 #endif // wxUSE_FINDREPLDLG
1671 // ----------------------------------------------------------------------------
1673 // ----------------------------------------------------------------------------
1675 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
1678 dc
.SetFont(wxGetApp().m_canvasFont
);
1679 dc
.SetTextForeground(wxGetApp().m_canvasTextColour
);
1680 dc
.SetBackgroundMode(wxTRANSPARENT
);
1682 _T("wxWidgets common dialogs")
1683 #if !defined(__SMARTPHONE__)
1684 _T(" test application")
1689 #if USE_MODAL_PRESENTATION
1691 // ----------------------------------------------------------------------------
1693 // ----------------------------------------------------------------------------
1695 MyModelessDialog::MyModelessDialog(wxWindow
*parent
)
1696 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modeless dialog")))
1698 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
1700 wxButton
*btn
= new wxButton(this, DIALOGS_MODELESS_BTN
, _T("Press me"));
1701 wxCheckBox
*check
= new wxCheckBox(this, wxID_ANY
, _T("Should be disabled"));
1704 sizerTop
->Add(btn
, 1, wxEXPAND
| wxALL
, 5);
1705 sizerTop
->Add(check
, 1, wxEXPAND
| wxALL
, 5);
1707 SetSizerAndFit(sizerTop
);
1710 void MyModelessDialog::OnButton(wxCommandEvent
& WXUNUSED(event
))
1712 wxMessageBox(_T("Button pressed in modeless dialog"), _T("Info"),
1713 wxOK
| wxICON_INFORMATION
, this);
1716 void MyModelessDialog::OnClose(wxCloseEvent
& event
)
1718 if ( event
.CanVeto() )
1720 wxMessageBox(_T("Use the menu item to close this dialog"),
1721 _T("Modeless dialog"),
1722 wxOK
| wxICON_INFORMATION
, this);
1728 // ----------------------------------------------------------------------------
1730 // ----------------------------------------------------------------------------
1732 MyModalDialog::MyModalDialog(wxWindow
*parent
)
1733 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modal dialog")))
1735 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
1737 m_btnModal
= new wxButton(this, wxID_ANY
, _T("&Modal dialog..."));
1738 m_btnModeless
= new wxButton(this, wxID_ANY
, _T("Mode&less dialog"));
1739 m_btnDelete
= new wxButton(this, wxID_ANY
, _T("&Delete button"));
1741 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _T("&Close"));
1742 sizerTop
->Add(m_btnModal
, 0, wxALIGN_CENTER
| wxALL
, 5);
1743 sizerTop
->Add(m_btnModeless
, 0, wxALIGN_CENTER
| wxALL
, 5);
1744 sizerTop
->Add(m_btnDelete
, 0, wxALIGN_CENTER
| wxALL
, 5);
1745 sizerTop
->Add(btnOk
, 0, wxALIGN_CENTER
| wxALL
, 5);
1747 SetSizerAndFit(sizerTop
);
1749 m_btnModal
->SetFocus();
1750 m_btnModal
->SetDefault();
1753 void MyModalDialog::OnButton(wxCommandEvent
& event
)
1755 if ( event
.GetEventObject() == m_btnDelete
)
1760 m_btnDelete
->Disable();
1762 else if ( event
.GetEventObject() == m_btnModal
)
1765 wxGetTextFromUser(_T("Dummy prompt"),
1766 _T("Modal dialog called from dialog"),
1767 wxEmptyString
, this);
1769 wxMessageBox(_T("Modal dialog called from dialog"));
1770 #endif // wxUSE_TEXTDLG
1772 else if ( event
.GetEventObject() == m_btnModeless
)
1774 (new MyModelessDialog(this))->Show();
1782 #endif // USE_MODAL_PRESENTATION
1784 // ----------------------------------------------------------------------------
1785 // StdButtonSizerDialog
1786 // ----------------------------------------------------------------------------
1788 StdButtonSizerDialog::StdButtonSizerDialog(wxWindow
*parent
)
1789 : wxDialog(parent
, wxID_ANY
, wxString(_T("StdButtonSizer dialog")),
1790 wxDefaultPosition
, wxDefaultSize
, wxDEFAULT_DIALOG_STYLE
|wxRESIZE_BORDER
),
1791 m_buttonsSizer(NULL
)
1793 wxBoxSizer
*const sizerTop
= new wxBoxSizer(wxVERTICAL
);
1795 wxBoxSizer
*const sizer
= new wxBoxSizer(wxHORIZONTAL
);
1796 wxBoxSizer
*const sizerInside1
= new wxBoxSizer(wxVERTICAL
);
1798 m_chkboxAffirmativeButton
= new wxCheckBox(this, wxID_ANY
, _("Enable Affirmative Button"));
1800 wxStaticBoxSizer
*const sizer1
= new wxStaticBoxSizer(wxVERTICAL
, this, wxT("Affirmative Button"));
1802 m_radiobtnOk
= new wxRadioButton(this, wxID_ANY
, _("Ok"), wxDefaultPosition
, wxDefaultSize
, wxRB_GROUP
);
1803 m_radiobtnYes
= new wxRadioButton(this, wxID_ANY
, _("Yes"));
1805 wxBoxSizer
*const sizerInside2
= new wxBoxSizer(wxVERTICAL
);
1807 m_chkboxDismissButton
= new wxCheckBox(this, wxID_ANY
, _("Enable Dismiss Button"));
1809 wxStaticBoxSizer
*const sizer2
= new wxStaticBoxSizer(wxVERTICAL
, this, wxT("Dismiss Button"));
1811 m_radiobtnCancel
= new wxRadioButton(this, wxID_ANY
, _("Cancel"), wxDefaultPosition
, wxDefaultSize
, wxRB_GROUP
);
1812 m_radiobtnClose
= new wxRadioButton(this, wxID_ANY
, _("Close"));
1814 wxBoxSizer
*const sizer3
= new wxBoxSizer(wxHORIZONTAL
);
1816 m_chkboxNo
= new wxCheckBox(this, wxID_ANY
, _("No"));
1817 m_chkboxHelp
= new wxCheckBox(this, wxID_ANY
, _("Help"));
1818 m_chkboxApply
= new wxCheckBox(this, wxID_ANY
, _("Apply"));
1820 m_chkboxNoDefault
= new wxCheckBox(this, wxID_ANY
, wxT("No Default"));
1822 sizer1
->Add(m_radiobtnOk
, 0, wxALL
, 5);
1823 sizer1
->Add(m_radiobtnYes
, 0, wxALL
, 5);
1825 sizer
->Add(sizerInside1
, 0, 0, 0);
1826 sizerInside1
->Add(m_chkboxAffirmativeButton
, 0, wxALL
, 5);
1827 sizerInside1
->Add(sizer1
, 0, wxALL
, 5);
1828 sizerInside1
->SetItemMinSize(sizer1
, sizer1
->GetStaticBox()->GetBestSize()); // to prevent wrapping of static box label
1830 sizer2
->Add(m_radiobtnCancel
, 0, wxALL
, 5);
1831 sizer2
->Add(m_radiobtnClose
, 0, wxALL
, 5);
1833 sizer
->Add(sizerInside2
, 0, 0, 0);
1834 sizerInside2
->Add(m_chkboxDismissButton
, 0, wxALL
, 5);
1835 sizerInside2
->Add(sizer2
, 0, wxALL
, 5);
1836 sizerInside2
->SetItemMinSize(sizer2
, sizer2
->GetStaticBox()->GetBestSize()); // to prevent wrapping of static box label
1838 sizerTop
->Add(sizer
, 0, wxALL
, 5);
1840 sizer3
->Add(m_chkboxNo
, 0, wxALL
, 5);
1841 sizer3
->Add(m_chkboxHelp
, 0, wxALL
, 5);
1842 sizer3
->Add(m_chkboxApply
, 0, wxALL
, 5);
1844 sizerTop
->Add(sizer3
, 0, wxALL
, 5);
1846 sizerTop
->Add(m_chkboxNoDefault
, 0, wxLEFT
|wxRIGHT
, 10);
1848 EnableDisableControls();
1850 SetSizerAndFit(sizerTop
);
1856 void StdButtonSizerDialog::OnEvent(wxCommandEvent
& WXUNUSED(event
))
1860 m_buttonsSizer
->DeleteWindows();
1861 GetSizer()->Remove(m_buttonsSizer
);
1864 EnableDisableControls();
1867 unsigned long numButtons
= 0;
1869 if (m_chkboxAffirmativeButton
->IsChecked())
1871 if (m_radiobtnOk
->GetValue())
1876 else if (m_radiobtnYes
->GetValue())
1883 if (m_chkboxDismissButton
->IsChecked())
1885 if (m_radiobtnCancel
->GetValue())
1891 else if (m_radiobtnClose
->GetValue())
1899 if (m_chkboxApply
->IsChecked())
1905 if (m_chkboxNo
->IsChecked())
1911 if (m_chkboxHelp
->IsChecked())
1917 if (m_chkboxNoDefault
->IsChecked())
1919 flags
|= wxNO_DEFAULT
;
1922 m_buttonsSizer
= CreateStdDialogButtonSizer(flags
);
1923 GetSizer()->Add(m_buttonsSizer
, 0, wxGROW
|wxALL
, 5);
1926 GetSizer()->SetSizeHints(this);
1929 void StdButtonSizerDialog::EnableDisableControls()
1931 const bool affButtonEnabled
= m_chkboxAffirmativeButton
->IsChecked();
1933 m_radiobtnOk
->Enable(affButtonEnabled
);
1934 m_radiobtnYes
->Enable(affButtonEnabled
);
1936 const bool dismissButtonEnabled
= m_chkboxDismissButton
->IsChecked();
1938 m_radiobtnCancel
->Enable(dismissButtonEnabled
);
1939 m_radiobtnClose
->Enable(dismissButtonEnabled
);
1942 #if USE_SETTINGS_DIALOG
1943 // ----------------------------------------------------------------------------
1945 // ----------------------------------------------------------------------------
1947 IMPLEMENT_CLASS(SettingsDialog
, wxPropertySheetDialog
)
1949 BEGIN_EVENT_TABLE(SettingsDialog
, wxPropertySheetDialog
)
1952 SettingsDialog::SettingsDialog(wxWindow
* win
, int dialogType
)
1954 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
|wxWS_EX_VALIDATE_RECURSIVELY
);
1959 bool useToolBook
= (dialogType
== DIALOGS_PROPERTY_SHEET_TOOLBOOK
|| dialogType
== DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK
);
1960 int resizeBorder
= wxRESIZE_BORDER
;
1968 int sheetStyle
= wxPROPSHEET_SHRINKTOFIT
;
1969 if (dialogType
== DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK
)
1970 sheetStyle
|= wxPROPSHEET_BUTTONTOOLBOOK
;
1972 sheetStyle
|= wxPROPSHEET_TOOLBOOK
;
1974 SetSheetStyle(sheetStyle
);
1975 SetSheetInnerBorder(0);
1976 SetSheetOuterBorder(0);
1978 // create a dummy image list with a few icons
1979 const wxSize
imageSize(32, 32);
1981 m_imageList
= new wxImageList(imageSize
.GetWidth(), imageSize
.GetHeight());
1983 Add(wxArtProvider::GetIcon(wxART_INFORMATION
, wxART_OTHER
, imageSize
));
1985 Add(wxArtProvider::GetIcon(wxART_QUESTION
, wxART_OTHER
, imageSize
));
1987 Add(wxArtProvider::GetIcon(wxART_WARNING
, wxART_OTHER
, imageSize
));
1989 Add(wxArtProvider::GetIcon(wxART_ERROR
, wxART_OTHER
, imageSize
));
1994 Create(win
, wxID_ANY
, _("Preferences"), wxDefaultPosition
, wxDefaultSize
,
1995 wxDEFAULT_DIALOG_STYLE
| (int)wxPlatform::IfNot(wxOS_WINDOWS_CE
, resizeBorder
)
1998 // If using a toolbook, also follow Mac style and don't create buttons
2000 CreateButtons(wxOK
| wxCANCEL
|
2001 (int)wxPlatform::IfNot(wxOS_WINDOWS_CE
, wxHELP
)
2004 wxBookCtrlBase
* notebook
= GetBookCtrl();
2005 notebook
->SetImageList(m_imageList
);
2007 wxPanel
* generalSettings
= CreateGeneralSettingsPage(notebook
);
2008 wxPanel
* aestheticSettings
= CreateAestheticSettingsPage(notebook
);
2010 notebook
->AddPage(generalSettings
, _("General"), true, tabImage1
);
2011 notebook
->AddPage(aestheticSettings
, _("Aesthetics"), false, tabImage2
);
2016 SettingsDialog::~SettingsDialog()
2021 wxPanel
* SettingsDialog::CreateGeneralSettingsPage(wxWindow
* parent
)
2023 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
2025 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
2026 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
2030 wxBoxSizer
* itemSizer3
= new wxBoxSizer( wxHORIZONTAL
);
2031 wxCheckBox
* checkBox3
= new wxCheckBox(panel
, ID_LOAD_LAST_PROJECT
, _("&Load last project on startup"), wxDefaultPosition
, wxDefaultSize
);
2032 itemSizer3
->Add(checkBox3
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
2033 item0
->Add(itemSizer3
, 0, wxGROW
|wxALL
, 0);
2037 wxString autoSaveLabel
= _("&Auto-save every");
2038 wxString minsLabel
= _("mins");
2040 wxBoxSizer
* itemSizer12
= new wxBoxSizer( wxHORIZONTAL
);
2041 wxCheckBox
* checkBox12
= new wxCheckBox(panel
, ID_AUTO_SAVE
, autoSaveLabel
, wxDefaultPosition
, wxDefaultSize
);
2044 wxSpinCtrl
* spinCtrl12
= new wxSpinCtrl(panel
, ID_AUTO_SAVE_MINS
, wxEmptyString
,
2045 wxDefaultPosition
, wxSize(40, wxDefaultCoord
), wxSP_ARROW_KEYS
, 1, 60, 1);
2048 itemSizer12
->Add(checkBox12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
2050 itemSizer12
->Add(spinCtrl12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
2052 itemSizer12
->Add(new wxStaticText(panel
, wxID_STATIC
, minsLabel
), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
2053 item0
->Add(itemSizer12
, 0, wxGROW
|wxALL
, 0);
2057 wxBoxSizer
* itemSizer8
= new wxBoxSizer( wxHORIZONTAL
);
2058 wxCheckBox
* checkBox6
= new wxCheckBox(panel
, ID_SHOW_TOOLTIPS
, _("Show &tooltips"), wxDefaultPosition
, wxDefaultSize
);
2059 itemSizer8
->Add(checkBox6
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
2060 item0
->Add(itemSizer8
, 0, wxGROW
|wxALL
, 0);
2062 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
2064 panel
->SetSizerAndFit(topSizer
);
2069 wxPanel
* SettingsDialog::CreateAestheticSettingsPage(wxWindow
* parent
)
2071 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
2073 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
2074 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
2076 //// PROJECT OR GLOBAL
2077 wxString globalOrProjectChoices
[2];
2078 globalOrProjectChoices
[0] = _("&New projects");
2079 globalOrProjectChoices
[1] = _("&This project");
2081 wxRadioBox
* projectOrGlobal
= new wxRadioBox(panel
, ID_APPLY_SETTINGS_TO
, _("&Apply settings to:"),
2082 wxDefaultPosition
, wxDefaultSize
, 2, globalOrProjectChoices
);
2083 item0
->Add(projectOrGlobal
, 0, wxGROW
|wxALL
, 5);
2085 projectOrGlobal
->SetSelection(0);
2087 //// BACKGROUND STYLE
2088 wxArrayString backgroundStyleChoices
;
2089 backgroundStyleChoices
.Add(wxT("Colour"));
2090 backgroundStyleChoices
.Add(wxT("Image"));
2091 wxStaticBox
* staticBox3
= new wxStaticBox(panel
, wxID_ANY
, _("Background style:"));
2093 wxBoxSizer
* styleSizer
= new wxStaticBoxSizer( staticBox3
, wxVERTICAL
);
2094 item0
->Add(styleSizer
, 0, wxGROW
|wxALL
, 5);
2096 wxBoxSizer
* itemSizer2
= new wxBoxSizer( wxHORIZONTAL
);
2098 wxChoice
* choice2
= new wxChoice(panel
, ID_BACKGROUND_STYLE
, wxDefaultPosition
, wxDefaultSize
, backgroundStyleChoices
);
2100 itemSizer2
->Add(new wxStaticText(panel
, wxID_ANY
, _("&Window:")), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
2101 itemSizer2
->Add(5, 5, 1, wxALL
, 0);
2102 itemSizer2
->Add(choice2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
2104 styleSizer
->Add(itemSizer2
, 0, wxGROW
|wxALL
, 5);
2107 //// FONT SIZE SELECTION
2109 wxStaticBox
* staticBox1
= new wxStaticBox(panel
, wxID_ANY
, _("Tile font size:"));
2110 wxBoxSizer
* itemSizer5
= new wxStaticBoxSizer( staticBox1
, wxHORIZONTAL
);
2112 wxSpinCtrl
* spinCtrl
= new wxSpinCtrl(panel
, ID_FONT_SIZE
, wxEmptyString
, wxDefaultPosition
,
2113 wxSize(80, wxDefaultCoord
));
2114 itemSizer5
->Add(spinCtrl
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
2116 item0
->Add(itemSizer5
, 0, wxGROW
|wxLEFT
|wxRIGHT
, 5);
2119 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
2120 topSizer
->AddSpacer(5);
2122 panel
->SetSizerAndFit(topSizer
);
2127 #endif // USE_SETTINGS_DIALOG