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"
32 #include "wx/colordlg.h"
33 #endif // wxUSE_COLOURDLG
36 #include "wx/choicdlg.h"
37 #endif // wxUSE_CHOICEDLG
39 #if wxUSE_STARTUP_TIPS
40 #include "wx/tipdlg.h"
41 #endif // wxUSE_STARTUP_TIPS
44 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
45 #include "wx/datetime.h" // wxDateTime
48 #include "wx/progdlg.h"
49 #endif // wxUSE_PROGRESSDLG
52 #include "wx/busyinfo.h"
53 #endif // wxUSE_BUSYINFO
56 #include "wx/numdlg.h"
57 #endif // wxUSE_NUMBERDLG
60 #include "wx/filedlg.h"
61 #endif // wxUSE_FILEDLG
64 #include "wx/dirdlg.h"
65 #endif // wxUSE_DIRDLG
68 #include "wx/fontdlg.h"
69 #endif // wxUSE_FONTDLG
72 #include "wx/fdrepdlg.h"
73 #endif // wxUSE_FINDREPLDLG
76 #include "wx/spinctrl.h"
79 #include "wx/propdlg.h"
83 #if USE_COLOURDLG_GENERIC
84 #include "wx/generic/colrdlgg.h"
85 #endif // USE_COLOURDLG_GENERIC
87 #if USE_DIRDLG_GENERIC
88 #include "wx/generic/dirdlgg.h"
89 #endif // USE_DIRDLG_GENERIC
91 #if USE_FILEDLG_GENERIC
92 #include "wx/generic/filedlgg.h"
93 #endif // USE_FILEDLG_GENERIC
95 #if USE_FONTDLG_GENERIC
96 #include "wx/generic/fontdlgg.h"
97 #endif // USE_FONTDLG_GENERIC
101 BEGIN_EVENT_TABLE(MyCanvas
, wxScrolledWindow
)
102 EVT_PAINT(MyCanvas::OnPaint
)
107 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
108 EVT_MENU(DIALOGS_MESSAGE_BOX
, MyFrame::MessageBox
)
111 EVT_MENU(DIALOGS_CHOOSE_COLOUR
, MyFrame::ChooseColour
)
112 #endif // wxUSE_COLOURDLG
115 EVT_MENU(DIALOGS_CHOOSE_FONT
, MyFrame::ChooseFont
)
116 #endif // wxUSE_FONTDLG
119 EVT_MENU(DIALOGS_LOG_DIALOG
, MyFrame::LogDialog
)
120 #endif // wxUSE_LOG_DIALOG
123 EVT_MENU(DIALOGS_TEXT_ENTRY
, MyFrame::TextEntry
)
124 EVT_MENU(DIALOGS_PASSWORD_ENTRY
, MyFrame::PasswordEntry
)
125 #endif // wxUSE_TEXTDLG
128 EVT_MENU(DIALOGS_NUM_ENTRY
, MyFrame::NumericEntry
)
129 #endif // wxUSE_NUMBERDLG
132 EVT_MENU(DIALOGS_SINGLE_CHOICE
, MyFrame::SingleChoice
)
133 EVT_MENU(DIALOGS_MULTI_CHOICE
, MyFrame::MultiChoice
)
134 #endif // wxUSE_CHOICEDLG
137 EVT_MENU(DIALOGS_FILE_OPEN
, MyFrame::FileOpen
)
138 EVT_MENU(DIALOGS_FILE_OPEN2
, MyFrame::FileOpen2
)
139 EVT_MENU(DIALOGS_FILES_OPEN
, MyFrame::FilesOpen
)
140 EVT_MENU(DIALOGS_FILE_SAVE
, MyFrame::FileSave
)
141 #endif // wxUSE_FILEDLG
143 #if USE_FILEDLG_GENERIC
144 EVT_MENU(DIALOGS_FILE_OPEN_GENERIC
, MyFrame::FileOpenGeneric
)
145 EVT_MENU(DIALOGS_FILES_OPEN_GENERIC
, MyFrame::FilesOpenGeneric
)
146 EVT_MENU(DIALOGS_FILE_SAVE_GENERIC
, MyFrame::FileSaveGeneric
)
147 #endif // USE_FILEDLG_GENERIC
150 EVT_MENU(DIALOGS_DIR_CHOOSE
, MyFrame::DirChoose
)
151 EVT_MENU(DIALOGS_DIRNEW_CHOOSE
, MyFrame::DirChooseNew
)
152 #endif // wxUSE_DIRDLG
154 #if USE_MODAL_PRESENTATION
155 EVT_MENU(DIALOGS_MODAL
, MyFrame::ModalDlg
)
156 EVT_MENU(DIALOGS_MODELESS
, MyFrame::ModelessDlg
)
157 EVT_MENU(DIALOGS_CENTRE_SCREEN
, MyFrame::DlgCenteredScreen
)
158 EVT_MENU(DIALOGS_CENTRE_PARENT
, MyFrame::DlgCenteredParent
)
161 #if wxUSE_STARTUP_TIPS
162 EVT_MENU(DIALOGS_TIP
, MyFrame::ShowTip
)
163 #endif // wxUSE_STARTUP_TIPS
165 #if USE_FONTDLG_GENERIC
166 EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC
, MyFrame::ChooseFontGeneric
)
167 #endif // USE_FONTDLG_GENERIC
169 #if USE_DIRDLG_GENERIC
170 EVT_MENU(DIALOGS_GENERIC_DIR_CHOOSE
, MyFrame::GenericDirChoose
)
171 #endif // wxMSW || wxMAC
173 #if USE_COLOURDLG_GENERIC
174 EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC
, MyFrame::ChooseColourGeneric
)
175 #endif // USE_COLOURDLG_GENERIC
177 #if wxUSE_PROGRESSDLG
178 EVT_MENU(DIALOGS_PROGRESS
, MyFrame::ShowProgress
)
179 #endif // wxUSE_PROGRESSDLG
182 EVT_MENU(DIALOGS_BUSYINFO
, MyFrame::ShowBusyInfo
)
183 #endif // wxUSE_BUSYINFO
185 #if wxUSE_FINDREPLDLG
186 EVT_MENU(DIALOGS_FIND
, MyFrame::ShowFindDialog
)
187 EVT_MENU(DIALOGS_REPLACE
, MyFrame::ShowReplaceDialog
)
189 EVT_FIND(wxID_ANY
, MyFrame::OnFindDialog
)
190 EVT_FIND_NEXT(wxID_ANY
, MyFrame::OnFindDialog
)
191 EVT_FIND_REPLACE(wxID_ANY
, MyFrame::OnFindDialog
)
192 EVT_FIND_REPLACE_ALL(wxID_ANY
, MyFrame::OnFindDialog
)
193 EVT_FIND_CLOSE(wxID_ANY
, MyFrame::OnFindDialog
)
194 #endif // wxUSE_FINDREPLDLG
196 #if USE_SETTINGS_DIALOG
197 EVT_MENU(DIALOGS_PROPERTY_SHEET
, MyFrame::OnPropertySheet
)
198 EVT_MENU(DIALOGS_PROPERTY_SHEET_TOOLBOOK
, MyFrame::OnPropertySheetToolBook
)
201 EVT_MENU(DIALOGS_REQUEST
, MyFrame::OnRequestUserAttention
)
203 EVT_MENU(wxID_EXIT
, MyFrame::OnExit
)
206 #if USE_MODAL_PRESENTATION
208 BEGIN_EVENT_TABLE(MyModalDialog
, wxDialog
)
209 EVT_BUTTON(wxID_ANY
, MyModalDialog::OnButton
)
212 BEGIN_EVENT_TABLE(MyModelessDialog
, wxDialog
)
213 EVT_BUTTON(DIALOGS_MODELESS_BTN
, MyModelessDialog::OnButton
)
214 EVT_CLOSE(MyModelessDialog::OnClose
)
217 #endif // USE_MODAL_PRESENTATION
219 MyCanvas
*myCanvas
= (MyCanvas
*) NULL
;
221 // `Main program' equivalent, creating windows and returning main app frame
225 wxInitAllImageHandlers();
228 m_canvasTextColour
= wxColour(_T("BLACK"));
229 m_canvasFont
= *wxNORMAL_FONT
;
231 // Create the main frame window
232 MyFrame
*frame
= new MyFrame((wxFrame
*) NULL
, _T("wxWidgets dialogs example"));
235 wxMenu
*file_menu
= new wxMenu
;
237 file_menu
->Append(DIALOGS_MESSAGE_BOX
, _T("&Message box\tCtrl-M"));
240 #if wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
242 wxMenu
*choices_menu
= new wxMenu
;
245 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR
, _T("&Choose colour"));
246 #endif // wxUSE_COLOURDLG
249 choices_menu
->Append(DIALOGS_CHOOSE_FONT
, _T("Choose &font"));
250 #endif // wxUSE_FONTDLG
253 choices_menu
->Append(DIALOGS_SINGLE_CHOICE
, _T("&Single choice\tCtrl-C"));
254 choices_menu
->Append(DIALOGS_MULTI_CHOICE
, _T("M&ultiple choice\tCtrl-U"));
255 #endif // wxUSE_CHOICEDLG
257 #if USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
258 choices_menu
->AppendSeparator();
259 #endif // USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
261 #if USE_COLOURDLG_GENERIC
262 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR_GENERIC
, _T("&Choose colour (generic)"));
263 #endif // USE_COLOURDLG_GENERIC
265 #if USE_FONTDLG_GENERIC
266 choices_menu
->Append(DIALOGS_CHOOSE_FONT_GENERIC
, _T("Choose &font (generic)"));
267 #endif // USE_FONTDLG_GENERIC
269 file_menu
->Append(wxID_ANY
,_T("&Choices and selectors"),choices_menu
);
270 #endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
273 #if wxUSE_TEXTDLG || wxUSE_NUMBERDLG
275 wxMenu
*entry_menu
= new wxMenu
;
278 entry_menu
->Append(DIALOGS_TEXT_ENTRY
, _T("Text &entry\tCtrl-E"));
279 entry_menu
->Append(DIALOGS_PASSWORD_ENTRY
, _T("&Password entry\tCtrl-P"));
280 #endif // wxUSE_TEXTDLG
283 entry_menu
->Append(DIALOGS_NUM_ENTRY
, _T("&Numeric entry\tCtrl-N"));
284 #endif // wxUSE_NUMBERDLG
286 file_menu
->Append(wxID_ANY
,_T("&Entry dialogs"),entry_menu
);
288 #endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG
293 wxMenu
*filedlg_menu
= new wxMenu
;
294 filedlg_menu
->Append(DIALOGS_FILE_OPEN
, _T("&Open file\tCtrl-O"));
295 filedlg_menu
->Append(DIALOGS_FILE_OPEN2
, _T("&Second open file\tCtrl-2"));
296 filedlg_menu
->Append(DIALOGS_FILES_OPEN
, _T("Open &files\tCtrl-Q"));
297 filedlg_menu
->Append(DIALOGS_FILE_SAVE
, _T("Sa&ve file\tCtrl-S"));
299 #if USE_FILEDLG_GENERIC
300 filedlg_menu
->AppendSeparator();
301 filedlg_menu
->Append(DIALOGS_FILE_OPEN_GENERIC
, _T("&Open file (generic)"));
302 filedlg_menu
->Append(DIALOGS_FILES_OPEN_GENERIC
, _T("Open &files (generic)"));
303 filedlg_menu
->Append(DIALOGS_FILE_SAVE_GENERIC
, _T("Sa&ve file (generic)"));
304 #endif // USE_FILEDLG_GENERIC
306 file_menu
->Append(wxID_ANY
,_T("&File operations"),filedlg_menu
);
308 #endif // wxUSE_FILEDLG
311 wxMenu
*dir_menu
= new wxMenu
;
313 dir_menu
->Append(DIALOGS_DIR_CHOOSE
, _T("&Choose a directory\tCtrl-D"));
314 dir_menu
->Append(DIALOGS_DIRNEW_CHOOSE
, _T("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"));
315 file_menu
->Append(wxID_ANY
,_T("&Directory operations"),dir_menu
);
317 #if USE_DIRDLG_GENERIC
318 dir_menu
->AppendSeparator();
319 dir_menu
->Append(DIALOGS_GENERIC_DIR_CHOOSE
, _T("&Choose a directory (generic)"));
320 #endif // USE_DIRDLG_GENERIC
322 #endif // wxUSE_DIRDLG
325 #if wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
327 wxMenu
*info_menu
= new wxMenu
;
329 #if wxUSE_STARTUP_TIPS
330 info_menu
->Append(DIALOGS_TIP
, _T("&Tip of the day\tCtrl-T"));
331 #endif // wxUSE_STARTUP_TIPS
333 #if wxUSE_PROGRESSDLG
334 info_menu
->Append(DIALOGS_PROGRESS
, _T("Pro&gress dialog\tCtrl-G"));
335 #endif // wxUSE_PROGRESSDLG
338 info_menu
->Append(DIALOGS_BUSYINFO
, _T("&Busy info dialog\tCtrl-B"));
339 #endif // wxUSE_BUSYINFO
342 info_menu
->Append(DIALOGS_LOG_DIALOG
, _T("&Log dialog\tCtrl-L"));
343 #endif // wxUSE_LOG_DIALOG
345 file_menu
->Append(wxID_ANY
,_T("&Informative dialogs"),info_menu
);
347 #endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
350 #if wxUSE_FINDREPLDLG
351 wxMenu
*find_menu
= new wxMenu
;
352 find_menu
->AppendCheckItem(DIALOGS_FIND
, _T("&Find dialog\tCtrl-F"));
353 find_menu
->AppendCheckItem(DIALOGS_REPLACE
, _T("Find and &replace dialog\tShift-Ctrl-F"));
354 file_menu
->Append(wxID_ANY
,_T("&Searching"),find_menu
);
355 #endif // wxUSE_FINDREPLDLG
357 #if USE_MODAL_PRESENTATION
358 wxMenu
*dialogs_menu
= new wxMenu
;
359 dialogs_menu
->Append(DIALOGS_MODAL
, _T("&Modal dialog\tCtrl-W"));
360 dialogs_menu
->AppendCheckItem(DIALOGS_MODELESS
, _T("Mode&less dialog\tCtrl-Z"));
361 dialogs_menu
->AppendCheckItem(DIALOGS_CENTRE_SCREEN
, _T("Centered on &screen\tShift-Ctrl-1"));
362 dialogs_menu
->AppendCheckItem(DIALOGS_CENTRE_PARENT
, _T("Centered on &parent\tShift-Ctrl-2"));
363 file_menu
->Append(wxID_ANY
, _T("&Generic dialogs"), dialogs_menu
);
364 #endif // USE_MODAL_PRESENTATION
366 #if USE_SETTINGS_DIALOG
367 wxMenu
*sheet_menu
= new wxMenu
;
368 sheet_menu
->Append(DIALOGS_PROPERTY_SHEET
, _T("&Standard property sheet\tShift-Ctrl-P"));
369 sheet_menu
->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK
, _T("&Toolbook sheet\tShift-Ctrl-T"));
370 file_menu
->Append(wxID_ANY
, _T("&Property sheets"), sheet_menu
);
371 #endif // USE_SETTINGS_DIALOG
373 file_menu
->Append(DIALOGS_REQUEST
, _T("&Request user attention\tCtrl-R"));
375 file_menu
->AppendSeparator();
376 file_menu
->Append(wxID_EXIT
, _T("E&xit\tAlt-X"));
378 wxMenuBar
*menu_bar
= new wxMenuBar
;
379 menu_bar
->Append(file_menu
, _T("&File"));
380 frame
->SetMenuBar(menu_bar
);
382 myCanvas
= new MyCanvas(frame
);
383 myCanvas
->SetBackgroundColour(*wxWHITE
);
385 frame
->Centre(wxBOTH
);
395 // My frame constructor
396 MyFrame::MyFrame(wxWindow
*parent
,
397 const wxString
& title
)
398 : wxFrame(parent
, wxID_ANY
, title
)
402 #if USE_MODAL_PRESENTATION
403 m_dialog
= (MyModelessDialog
*)NULL
;
404 #endif // USE_MODAL_PRESENTATION
406 #if wxUSE_FINDREPLDLG
412 m_clrData
.SetChooseFull(true);
413 for (int i
= 0; i
< 16; i
++)
415 m_clrData
.SetCustomColour(
418 (unsigned char)(i
*16),
419 (unsigned char)(i
*16),
420 (unsigned char)(i
*16)
424 #endif // wxUSE_COLOURDLG
428 void MyFrame::ChooseColour(wxCommandEvent
& WXUNUSED(event
) )
430 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
432 wxColourDialog
dialog(this, &m_clrData
);
433 dialog
.SetTitle(_T("Choose the background colour"));
434 if (dialog
.ShowModal() == wxID_OK
)
436 m_clrData
= dialog
.GetColourData();
437 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
438 myCanvas
->ClearBackground();
442 #endif // wxUSE_COLOURDLG
444 #if USE_COLOURDLG_GENERIC
445 void MyFrame::ChooseColourGeneric(wxCommandEvent
& WXUNUSED(event
))
447 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
449 //FIXME:TODO:This has no effect...
450 m_clrData
.SetChooseFull(true);
452 for (int i
= 0; i
< 16; i
++)
455 (unsigned char)(i
*16),
456 (unsigned char)(i
*16),
457 (unsigned char)(i
*16)
459 m_clrData
.SetCustomColour(i
, colour
);
462 wxGenericColourDialog
*dialog
= new wxGenericColourDialog(this, &m_clrData
);
463 if (dialog
->ShowModal() == wxID_OK
)
465 m_clrData
= dialog
->GetColourData();
466 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
467 myCanvas
->ClearBackground();
472 #endif // USE_COLOURDLG_GENERIC
475 void MyFrame::ChooseFont(wxCommandEvent
& WXUNUSED(event
) )
478 data
.SetInitialFont(wxGetApp().m_canvasFont
);
479 data
.SetColour(wxGetApp().m_canvasTextColour
);
481 // you might also do this:
483 // wxFontDialog dialog;
484 // if ( !dialog.Create(this, data) { ... error ... }
486 wxFontDialog
dialog(this, data
);
488 if (dialog
.ShowModal() == wxID_OK
)
490 wxFontData retData
= dialog
.GetFontData();
491 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
492 wxGetApp().m_canvasTextColour
= retData
.GetColour();
495 //else: cancelled by the user, don't change the font
497 #endif // wxUSE_FONTDLG
499 #if USE_FONTDLG_GENERIC
500 void MyFrame::ChooseFontGeneric(wxCommandEvent
& WXUNUSED(event
) )
503 data
.SetInitialFont(wxGetApp().m_canvasFont
);
504 data
.SetColour(wxGetApp().m_canvasTextColour
);
506 wxGenericFontDialog
*dialog
= new wxGenericFontDialog(this, &data
);
507 if (dialog
->ShowModal() == wxID_OK
)
509 wxFontData retData
= dialog
->GetFontData();
510 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
511 wxGetApp().m_canvasTextColour
= retData
.GetColour();
516 #endif // USE_FONTDLG_GENERIC
519 void MyFrame::LogDialog(wxCommandEvent
& WXUNUSED(event
))
521 // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
522 // being flushed -- test it
525 wxLogMessage(wxT("This is some message - everything is ok so far."));
526 wxLogMessage(wxT("Another message...\n... this one is on multiple lines"));
527 wxLogWarning(wxT("And then something went wrong!"));
529 // and if ~wxBusyCursor doesn't do it, then call it manually
533 wxLogError(wxT("Intermediary error handler decided to abort."));
534 wxLogError(wxT("The top level caller detected an unrecoverable error."));
536 wxLog::FlushActive();
538 wxLogMessage(wxT("And this is the same dialog but with only one message."));
540 #endif // wxUSE_LOG_DIALOG
542 void MyFrame::MessageBox(wxCommandEvent
& WXUNUSED(event
) )
544 wxMessageDialog
dialog( NULL
, _T("This is a message box\nA long, long string to test out the message box properly"),
545 _T("Message box text"), wxNO_DEFAULT
|wxYES_NO
|wxCANCEL
|wxICON_INFORMATION
);
547 switch ( dialog
.ShowModal() )
550 wxLogStatus(wxT("You pressed \"Yes\""));
554 wxLogStatus(wxT("You pressed \"No\""));
558 wxLogStatus(wxT("You pressed \"Cancel\""));
562 wxLogError(wxT("Unexpected wxMessageDialog return code!"));
567 void MyFrame::NumericEntry(wxCommandEvent
& WXUNUSED(event
) )
569 long res
= wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n")
570 _T("Even two rows of text."),
571 _T("Enter a number:"), _T("Numeric input test"),
578 msg
= _T("Invalid number entered or dialog cancelled.");
583 msg
.Printf(_T("You've entered %lu"), res
);
584 icon
= wxICON_INFORMATION
;
587 wxMessageBox(msg
, _T("Numeric test result"), wxOK
| icon
, this);
589 #endif // wxUSE_NUMBERDLG
592 void MyFrame::PasswordEntry(wxCommandEvent
& WXUNUSED(event
))
594 wxString pwd
= wxGetPasswordFromUser(_T("Enter password:"),
595 _T("Password entry dialog"),
600 wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd
.c_str()),
601 _T("Got password"), wxOK
| wxICON_INFORMATION
, this);
605 void MyFrame::TextEntry(wxCommandEvent
& WXUNUSED(event
))
607 wxTextEntryDialog
dialog(this,
608 _T("This is a small sample\n")
609 _T("A long, long string to test out the text entrybox"),
610 _T("Please enter a string"),
614 if (dialog
.ShowModal() == wxID_OK
)
616 wxMessageBox(dialog
.GetValue(), _T("Got string"), wxOK
| wxICON_INFORMATION
, this);
619 #endif // wxUSE_TEXTDLG
622 void MyFrame::SingleChoice(wxCommandEvent
& WXUNUSED(event
) )
624 const wxString choices
[] = { _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five") } ;
626 wxSingleChoiceDialog
dialog(this,
627 _T("This is a small sample\n")
628 _T("A single-choice convenience dialog"),
629 _T("Please select a value"),
630 WXSIZEOF(choices
), choices
);
632 dialog
.SetSelection(2);
634 if (dialog
.ShowModal() == wxID_OK
)
636 wxMessageDialog
dialog2(this, dialog
.GetStringSelection(), _T("Got string"));
641 void MyFrame::MultiChoice(wxCommandEvent
& WXUNUSED(event
) )
643 const wxString choices
[] =
645 _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five"),
646 _T("Six"), _T("Seven"), _T("Eight"), _T("Nine"), _T("Ten"),
647 _T("Eleven"), _T("Twelve"), _T("Seventeen"),
650 wxArrayInt selections
;
651 size_t count
= wxGetMultipleChoices(selections
,
652 _T("This is a small sample\n")
653 _T("A multi-choice convenience dialog"),
654 _T("Please select a value"),
655 WXSIZEOF(choices
), choices
,
660 msg
.Printf(wxT("You selected %u items:\n"), (unsigned)count
);
661 for ( size_t n
= 0; n
< count
; n
++ )
663 msg
+= wxString::Format(wxT("\t%u: %u (%s)\n"),
664 (unsigned)n
, (unsigned)selections
[n
],
665 choices
[selections
[n
]].c_str());
669 //else: cancelled or nothing selected
671 #endif // wxUSE_CHOICEDLG
674 void MyFrame::FileOpen(wxCommandEvent
& WXUNUSED(event
) )
679 _T("Testing open file dialog"),
683 _T("C++ files (*.cpp)|*.cpp")
685 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
689 dialog
.SetDirectory(wxGetHomeDir());
690 dialog
.CentreOnParent();
692 if (dialog
.ShowModal() == wxID_OK
)
695 info
.Printf(_T("Full file name: %s\n")
698 dialog
.GetPath().c_str(),
699 dialog
.GetDirectory().c_str(),
700 dialog
.GetFilename().c_str());
701 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
706 // this shows how to take advantage of specifying a default extension in the
707 // call to wxFileSelector: it is remembered after each new call and the next
708 // one will use it by default
709 void MyFrame::FileOpen2(wxCommandEvent
& WXUNUSED(event
) )
711 static wxString s_extDef
;
712 wxString path
= wxFileSelector(
713 _T("Select the file to load"),
714 wxEmptyString
, wxEmptyString
,
718 _T("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"),
719 wxFileSelectorDefaultWildcardStr
,
720 wxFileSelectorDefaultWildcardStr
729 // it is just a sample, would use wxSplitPath in real program
730 s_extDef
= path
.AfterLast(_T('.'));
732 wxLogMessage(_T("You selected the file '%s', remembered extension '%s'"),
733 (const wxChar
*) path
, (const wxChar
*) s_extDef
);
736 void MyFrame::FilesOpen(wxCommandEvent
& WXUNUSED(event
) )
740 _T("C++ files (*.cpp)|*.cpp");
744 _T("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"),
745 wxFileSelectorDefaultWildcardStr
,
746 wxFileSelectorDefaultWildcardStr
749 wxFileDialog
dialog(this, _T("Testing open multiple file dialog"),
750 wxEmptyString
, wxEmptyString
, wildcards
,
753 if (dialog
.ShowModal() == wxID_OK
)
755 wxArrayString paths
, filenames
;
757 dialog
.GetPaths(paths
);
758 dialog
.GetFilenames(filenames
);
761 size_t count
= paths
.GetCount();
762 for ( size_t n
= 0; n
< count
; n
++ )
764 s
.Printf(_T("File %d: %s (%s)\n"),
765 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
769 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
772 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
777 void MyFrame::FileSave(wxCommandEvent
& WXUNUSED(event
) )
779 wxFileDialog
dialog(this,
780 _T("Testing save file dialog"),
783 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
784 wxSAVE
|wxOVERWRITE_PROMPT
);
786 dialog
.SetFilterIndex(1);
788 if (dialog
.ShowModal() == wxID_OK
)
790 wxLogMessage(_T("%s, filter %d"),
791 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
794 #endif // wxUSE_FILEDLG
796 #if USE_FILEDLG_GENERIC
797 void MyFrame::FileOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
799 wxGenericFileDialog dialog
802 _T("Testing open file dialog"),
805 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
808 dialog
.SetDirectory(wxGetHomeDir());
810 if (dialog
.ShowModal() == wxID_OK
)
813 info
.Printf(_T("Full file name: %s\n")
816 dialog
.GetPath().c_str(),
817 dialog
.GetDirectory().c_str(),
818 dialog
.GetFilename().c_str());
819 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
824 void MyFrame::FilesOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
826 wxString wildcards
= _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
827 wxGenericFileDialog
dialog(this, _T("Testing open multiple file dialog"),
828 wxEmptyString
, wxEmptyString
, wildcards
,
831 if (dialog
.ShowModal() == wxID_OK
)
833 wxArrayString paths
, filenames
;
835 dialog
.GetPaths(paths
);
836 dialog
.GetFilenames(filenames
);
839 size_t count
= paths
.GetCount();
840 for ( size_t n
= 0; n
< count
; n
++ )
842 s
.Printf(_T("File %d: %s (%s)\n"),
843 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
847 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
850 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
855 void MyFrame::FileSaveGeneric(wxCommandEvent
& WXUNUSED(event
) )
857 wxGenericFileDialog
dialog(this,
858 _T("Testing save file dialog"),
861 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
862 wxSAVE
|wxOVERWRITE_PROMPT
);
864 dialog
.SetFilterIndex(1);
866 if (dialog
.ShowModal() == wxID_OK
)
868 wxLogMessage(_T("%s, filter %d"),
869 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
872 #endif // USE_FILEDLG_GENERIC
875 void MyFrame::DoDirChoose(int style
)
877 // pass some initial dir to wxDirDialog
879 wxGetHomeDir(&dirHome
);
881 wxDirDialog
dialog(this, _T("Testing directory picker"), dirHome
, style
);
883 if (dialog
.ShowModal() == wxID_OK
)
885 wxLogMessage(_T("Selected path: %s"), dialog
.GetPath().c_str());
889 void MyFrame::DirChoose(wxCommandEvent
& WXUNUSED(event
) )
891 DoDirChoose(wxDD_DEFAULT_STYLE
& ~wxDD_NEW_DIR_BUTTON
);
894 void MyFrame::DirChooseNew(wxCommandEvent
& WXUNUSED(event
) )
896 DoDirChoose(wxDD_DEFAULT_STYLE
| wxDD_NEW_DIR_BUTTON
);
898 #endif // wxUSE_DIRDLG
900 #if USE_DIRDLG_GENERIC
901 void MyFrame::GenericDirChoose(wxCommandEvent
& WXUNUSED(event
) )
903 // pass some initial dir to wxDirDialog
905 wxGetHomeDir(&dirHome
);
907 wxGenericDirDialog
dialog(this, _T("Testing generic directory picker"), dirHome
);
909 if (dialog
.ShowModal() == wxID_OK
)
911 wxMessageDialog
dialog2(this, dialog
.GetPath(), _T("Selected path"));
915 #endif // USE_DIRDLG_GENERIC
917 #if USE_MODAL_PRESENTATION
918 void MyFrame::ModalDlg(wxCommandEvent
& WXUNUSED(event
))
920 MyModalDialog
dlg(this);
924 void MyFrame::ModelessDlg(wxCommandEvent
& event
)
926 bool show
= GetMenuBar()->IsChecked(event
.GetId());
932 m_dialog
= new MyModelessDialog(this);
935 m_dialog
->Show(true);
939 // If m_dialog is NULL, then possibly the system
940 // didn't report the checked menu item status correctly.
941 // It should be true just after the menu item was selected,
942 // if there was no modeless dialog yet.
944 wxASSERT( m_dialog
!= NULL
);
950 void MyFrame::DlgCenteredScreen(wxCommandEvent
& WXUNUSED(event
))
952 wxDialog
dlg(this, wxID_ANY
, _T("Dialog centered on screen"),
953 wxDefaultPosition
, wxSize(200, 100));
954 new wxButton(&dlg
, wxID_OK
, _T("Close"), wxPoint(10, 10));
955 dlg
.CentreOnScreen();
959 void MyFrame::DlgCenteredParent(wxCommandEvent
& WXUNUSED(event
))
961 wxDialog
dlg(this, wxID_ANY
, _T("Dialog centered on parent"),
962 wxDefaultPosition
, wxSize(200, 100));
963 new wxButton(&dlg
, wxID_OK
, _T("Close"), wxPoint(10, 10));
964 dlg
.CentreOnParent();
968 #endif // USE_MODAL_PRESENTATION
970 #if wxUSE_STARTUP_TIPS
971 void MyFrame::ShowTip(wxCommandEvent
& WXUNUSED(event
))
973 static size_t s_index
= (size_t)-1;
975 if ( s_index
== (size_t)-1 )
979 // this is completely bogus, we don't know how many lines are there
980 // in the file, but who cares, it's a demo only...
981 s_index
= rand() % 5;
984 wxTipProvider
*tipProvider
= wxCreateFileTipProvider(_T("tips.txt"), s_index
);
986 bool showAtStartup
= wxShowTip(this, tipProvider
);
990 wxMessageBox(_T("Will show tips on startup"), _T("Tips dialog"),
991 wxOK
| wxICON_INFORMATION
, this);
994 s_index
= tipProvider
->GetCurrentTip();
997 #endif // wxUSE_STARTUP_TIPS
999 #if USE_SETTINGS_DIALOG
1000 void MyFrame::OnPropertySheet(wxCommandEvent
& WXUNUSED(event
))
1002 SettingsDialog
dialog(this);
1006 void MyFrame::OnPropertySheetToolBook(wxCommandEvent
& WXUNUSED(event
))
1008 SettingsDialog
dialog(this, true);
1011 #endif // USE_SETTINGS_DIALOG
1013 void MyFrame::OnRequestUserAttention(wxCommandEvent
& WXUNUSED(event
))
1015 wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window"));
1019 RequestUserAttention(wxUSER_ATTENTION_ERROR
);
1022 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
) )
1027 #if wxUSE_PROGRESSDLG
1029 void MyFrame::ShowProgress( wxCommandEvent
& WXUNUSED(event
) )
1031 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1032 // check the performance
1033 int countrandomnumbers
= 0, count
= 0;
1034 wxTimeSpan
tsTest(0,0,0,250);
1035 wxDateTime DT2
, DT1
= wxDateTime::UNow();
1040 ++countrandomnumbers
;
1041 if ( countrandomnumbers
== 1000 )
1044 countrandomnumbers
= 0;
1046 DT2
= wxDateTime::UNow();
1047 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1048 if ( ts
.IsLongerThan( tsTest
) )
1054 const int max
= 40 * count
;
1056 static const int max
= 10;
1057 #endif // wxUSE_STOPWATCH && wxUSE_LONGLONG
1059 wxProgressDialog
dialog(_T("Progress dialog example"),
1060 _T("An informative message"),
1066 // wxPD_AUTO_HIDE | -- try this as well
1068 wxPD_ESTIMATED_TIME
|
1069 wxPD_REMAINING_TIME
|
1074 // each skip will move progress about quarter forward
1075 for ( int i
= 0; i
<= max
; i
= wxMin(i
+(skip
?int(max
/4):1), max
+1), skip
= false )
1077 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1078 // do (almost) the same operations as we did for the performance test
1080 for ( int j
= 0; j
< 1000; j
++ )
1085 DT2
= wxDateTime::UNow();
1086 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1087 if ( ts
.IsLongerThan( tsTest
) )
1101 msg
= _T("That's all, folks!");
1103 else if ( i
> max
/ 2 )
1105 msg
= _T("Only a half left (very long message)!");
1108 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1109 if ( (i
% (max
/100)) == 0 ) // // only 100 updates, this makes it much faster
1111 cont
= dialog
.Update(i
, msg
, &skip
);
1114 cont
= dialog
.Update(i
, msg
, &skip
);
1119 if ( wxMessageBox(_T("Do you really want to cancel?"),
1120 _T("Progress dialog question"), // caption
1121 wxYES_NO
| wxICON_QUESTION
) == wxYES
)
1131 wxLogStatus(wxT("Progress dialog aborted!"));
1135 wxLogStatus(wxT("Countdown from %d finished"), max
);
1139 #endif // wxUSE_PROGRESSDLG
1143 void MyFrame::ShowBusyInfo(wxCommandEvent
& WXUNUSED(event
))
1145 wxWindowDisabler disableAll
;
1147 wxBusyInfo
info(_T("Working, please wait..."), this);
1149 for ( int i
= 0; i
< 18; i
++ )
1159 #endif // wxUSE_BUSYINFO
1161 #if wxUSE_FINDREPLDLG
1163 void MyFrame::ShowReplaceDialog( wxCommandEvent
& WXUNUSED(event
) )
1167 delete m_dlgReplace
;
1168 m_dlgReplace
= NULL
;
1172 m_dlgReplace
= new wxFindReplaceDialog
1176 _T("Find and replace dialog"),
1180 m_dlgReplace
->Show(true);
1184 void MyFrame::ShowFindDialog( wxCommandEvent
& WXUNUSED(event
) )
1193 m_dlgFind
= new wxFindReplaceDialog
1202 m_dlgFind
->Show(true);
1206 static wxString
DecodeFindDialogEventFlags(int flags
)
1209 str
<< (flags
& wxFR_DOWN
? _T("down") : _T("up")) << _T(", ")
1210 << (flags
& wxFR_WHOLEWORD
? _T("whole words only, ") : _T(""))
1211 << (flags
& wxFR_MATCHCASE
? _T("") : _T("not "))
1212 << _T("case sensitive");
1217 void MyFrame::OnFindDialog(wxFindDialogEvent
& event
)
1219 wxEventType type
= event
.GetEventType();
1221 if ( type
== wxEVT_COMMAND_FIND
|| type
== wxEVT_COMMAND_FIND_NEXT
)
1223 wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
1224 type
== wxEVT_COMMAND_FIND_NEXT
? wxT("next ") : wxT(""),
1225 event
.GetFindString().c_str(),
1226 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1228 else if ( type
== wxEVT_COMMAND_FIND_REPLACE
||
1229 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
)
1231 wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
1232 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
? _T("all ") : wxT(""),
1233 event
.GetFindString().c_str(),
1234 event
.GetReplaceString().c_str(),
1235 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1237 else if ( type
== wxEVT_COMMAND_FIND_CLOSE
)
1239 wxFindReplaceDialog
*dlg
= event
.GetDialog();
1243 if ( dlg
== m_dlgFind
)
1246 idMenu
= DIALOGS_FIND
;
1249 else if ( dlg
== m_dlgReplace
)
1251 txt
= _T("Replace");
1252 idMenu
= DIALOGS_REPLACE
;
1253 m_dlgReplace
= NULL
;
1257 txt
= _T("Unknown");
1260 wxFAIL_MSG( _T("unexpected event") );
1263 wxLogMessage(wxT("%s dialog is being closed."), txt
);
1265 if ( idMenu
!= wxID_ANY
)
1267 GetMenuBar()->Check(idMenu
, false);
1274 wxLogError(wxT("Unknown find dialog event!"));
1278 #endif // wxUSE_FINDREPLDLG
1280 // ----------------------------------------------------------------------------
1282 // ----------------------------------------------------------------------------
1284 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
1287 dc
.SetFont(wxGetApp().m_canvasFont
);
1288 dc
.SetTextForeground(wxGetApp().m_canvasTextColour
);
1289 dc
.SetBackgroundMode(wxTRANSPARENT
);
1291 _T("wxWidgets common dialogs")
1292 #if !defined(__SMARTPHONE__)
1293 _T(" test application")
1298 #if USE_MODAL_PRESENTATION
1300 // ----------------------------------------------------------------------------
1302 // ----------------------------------------------------------------------------
1304 MyModelessDialog::MyModelessDialog(wxWindow
*parent
)
1305 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modeless dialog")))
1307 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
1309 wxButton
*btn
= new wxButton(this, DIALOGS_MODELESS_BTN
, _T("Press me"));
1310 wxCheckBox
*check
= new wxCheckBox(this, wxID_ANY
, _T("Should be disabled"));
1313 sizerTop
->Add(btn
, 1, wxEXPAND
| wxALL
, 5);
1314 sizerTop
->Add(check
, 1, wxEXPAND
| wxALL
, 5);
1318 sizerTop
->SetSizeHints(this);
1319 sizerTop
->Fit(this);
1322 void MyModelessDialog::OnButton(wxCommandEvent
& WXUNUSED(event
))
1324 wxMessageBox(_T("Button pressed in modeless dialog"), _T("Info"),
1325 wxOK
| wxICON_INFORMATION
, this);
1328 void MyModelessDialog::OnClose(wxCloseEvent
& event
)
1330 if ( event
.CanVeto() )
1332 wxMessageBox(_T("Use the menu item to close this dialog"),
1333 _T("Modeless dialog"),
1334 wxOK
| wxICON_INFORMATION
, this);
1340 // ----------------------------------------------------------------------------
1342 // ----------------------------------------------------------------------------
1344 MyModalDialog::MyModalDialog(wxWindow
*parent
)
1345 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modal dialog")))
1347 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
1349 m_btnModal
= new wxButton(this, wxID_ANY
, _T("&Modal dialog..."));
1350 m_btnModeless
= new wxButton(this, wxID_ANY
, _T("Mode&less dialog"));
1351 m_btnDelete
= new wxButton(this, wxID_ANY
, _T("&Delete button"));
1353 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _T("&Close"));
1354 sizerTop
->Add(m_btnModal
, 0, wxALIGN_CENTER
| wxALL
, 5);
1355 sizerTop
->Add(m_btnModeless
, 0, wxALIGN_CENTER
| wxALL
, 5);
1356 sizerTop
->Add(m_btnDelete
, 0, wxALIGN_CENTER
| wxALL
, 5);
1357 sizerTop
->Add(btnOk
, 0, wxALIGN_CENTER
| wxALL
, 5);
1361 sizerTop
->SetSizeHints(this);
1362 sizerTop
->Fit(this);
1364 m_btnModal
->SetFocus();
1365 m_btnModal
->SetDefault();
1368 void MyModalDialog::OnButton(wxCommandEvent
& event
)
1370 if ( event
.GetEventObject() == m_btnDelete
)
1375 m_btnDelete
->Disable();
1377 else if ( event
.GetEventObject() == m_btnModal
)
1380 wxGetTextFromUser(_T("Dummy prompt"),
1381 _T("Modal dialog called from dialog"),
1382 wxEmptyString
, this);
1384 wxMessageBox(_T("Modal dialog called from dialog"));
1385 #endif // wxUSE_TEXTDLG
1387 else if ( event
.GetEventObject() == m_btnModeless
)
1389 (new MyModelessDialog(this))->Show();
1397 #endif // USE_MODAL_PRESENTATION
1399 #if USE_SETTINGS_DIALOG
1400 // ----------------------------------------------------------------------------
1402 // ----------------------------------------------------------------------------
1404 IMPLEMENT_CLASS(SettingsDialog
, wxPropertySheetDialog
)
1406 BEGIN_EVENT_TABLE(SettingsDialog
, wxPropertySheetDialog
)
1409 SettingsDialog::SettingsDialog(wxWindow
* win
, bool useToolBook
)
1411 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
|wxWS_EX_VALIDATE_RECURSIVELY
);
1420 SetSheetStyle(wxPROPSHEET_TOOLBOOK
|wxPROPSHEET_SHRINKTOFIT
);
1422 // create a dummy image list with a few icons
1423 const wxSize
imageSize(32, 32);
1425 m_imageList
= new wxImageList(imageSize
.GetWidth(), imageSize
.GetHeight());
1427 Add(wxArtProvider::GetIcon(wxART_INFORMATION
, wxART_OTHER
, imageSize
));
1429 Add(wxArtProvider::GetIcon(wxART_QUESTION
, wxART_OTHER
, imageSize
));
1431 Add(wxArtProvider::GetIcon(wxART_WARNING
, wxART_OTHER
, imageSize
));
1433 Add(wxArtProvider::GetIcon(wxART_ERROR
, wxART_OTHER
, imageSize
));
1438 Create(win
, wxID_ANY
, _("Preferences"), wxDefaultPosition
, wxDefaultSize
,
1439 wxDEFAULT_DIALOG_STYLE
1445 // If using a toolbook, also follow Mac style and don't create buttons
1447 CreateButtons(wxOK
|wxCANCEL
1448 #ifndef __POCKETPC__
1453 wxBookCtrlBase
* notebook
= GetBookCtrl();
1454 notebook
->SetImageList(m_imageList
);
1456 wxPanel
* generalSettings
= CreateGeneralSettingsPage(notebook
);
1457 wxPanel
* aestheticSettings
= CreateAestheticSettingsPage(notebook
);
1459 notebook
->AddPage(generalSettings
, _("General"), true, tabImage1
);
1460 notebook
->AddPage(aestheticSettings
, _("Aesthetics"), false, tabImage2
);
1465 SettingsDialog::~SettingsDialog()
1470 wxPanel
* SettingsDialog::CreateGeneralSettingsPage(wxWindow
* parent
)
1472 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1474 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1475 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1479 wxBoxSizer
* itemSizer3
= new wxBoxSizer( wxHORIZONTAL
);
1480 wxCheckBox
* checkBox3
= new wxCheckBox(panel
, ID_LOAD_LAST_PROJECT
, _("&Load last project on startup"), wxDefaultPosition
, wxDefaultSize
);
1481 itemSizer3
->Add(checkBox3
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1482 item0
->Add(itemSizer3
, 0, wxGROW
|wxALL
, 0);
1486 wxString autoSaveLabel
= _("&Auto-save every");
1487 wxString minsLabel
= _("mins");
1489 wxBoxSizer
* itemSizer12
= new wxBoxSizer( wxHORIZONTAL
);
1490 wxCheckBox
* checkBox12
= new wxCheckBox(panel
, ID_AUTO_SAVE
, autoSaveLabel
, wxDefaultPosition
, wxDefaultSize
);
1493 wxSpinCtrl
* spinCtrl12
= new wxSpinCtrl(panel
, ID_AUTO_SAVE_MINS
, wxEmptyString
,
1494 wxDefaultPosition
, wxSize(40, wxDefaultCoord
), wxSP_ARROW_KEYS
, 1, 60, 1);
1497 itemSizer12
->Add(checkBox12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1499 itemSizer12
->Add(spinCtrl12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1501 itemSizer12
->Add(new wxStaticText(panel
, wxID_STATIC
, minsLabel
), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1502 item0
->Add(itemSizer12
, 0, wxGROW
|wxALL
, 0);
1506 wxBoxSizer
* itemSizer8
= new wxBoxSizer( wxHORIZONTAL
);
1507 wxCheckBox
* checkBox6
= new wxCheckBox(panel
, ID_SHOW_TOOLTIPS
, _("Show &tooltips"), wxDefaultPosition
, wxDefaultSize
);
1508 itemSizer8
->Add(checkBox6
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1509 item0
->Add(itemSizer8
, 0, wxGROW
|wxALL
, 0);
1511 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1513 panel
->SetSizer(topSizer
);
1514 topSizer
->Fit(panel
);
1519 wxPanel
* SettingsDialog::CreateAestheticSettingsPage(wxWindow
* parent
)
1521 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1523 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1524 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1526 //// PROJECT OR GLOBAL
1527 wxString globalOrProjectChoices
[2];
1528 globalOrProjectChoices
[0] = _("&New projects");
1529 globalOrProjectChoices
[1] = _("&This project");
1531 wxRadioBox
* projectOrGlobal
= new wxRadioBox(panel
, ID_APPLY_SETTINGS_TO
, _("&Apply settings to:"),
1532 wxDefaultPosition
, wxDefaultSize
, 2, globalOrProjectChoices
);
1533 item0
->Add(projectOrGlobal
, 0, wxGROW
|wxALL
, 5);
1535 projectOrGlobal
->SetSelection(0);
1537 //// BACKGROUND STYLE
1538 wxArrayString backgroundStyleChoices
;
1539 backgroundStyleChoices
.Add(wxT("Colour"));
1540 backgroundStyleChoices
.Add(wxT("Image"));
1541 wxStaticBox
* staticBox3
= new wxStaticBox(panel
, wxID_ANY
, _("Background style:"));
1543 wxBoxSizer
* styleSizer
= new wxStaticBoxSizer( staticBox3
, wxVERTICAL
);
1544 item0
->Add(styleSizer
, 0, wxGROW
|wxALL
, 5);
1546 wxBoxSizer
* itemSizer2
= new wxBoxSizer( wxHORIZONTAL
);
1548 wxChoice
* choice2
= new wxChoice(panel
, ID_BACKGROUND_STYLE
, wxDefaultPosition
, wxDefaultSize
, backgroundStyleChoices
);
1550 itemSizer2
->Add(new wxStaticText(panel
, wxID_ANY
, _("&Window:")), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1551 itemSizer2
->Add(5, 5, 1, wxALL
, 0);
1552 itemSizer2
->Add(choice2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1554 styleSizer
->Add(itemSizer2
, 0, wxGROW
|wxALL
, 5);
1557 //// FONT SIZE SELECTION
1559 wxStaticBox
* staticBox1
= new wxStaticBox(panel
, wxID_ANY
, _("Tile font size:"));
1560 wxBoxSizer
* itemSizer5
= new wxStaticBoxSizer( staticBox1
, wxHORIZONTAL
);
1562 wxSpinCtrl
* spinCtrl
= new wxSpinCtrl(panel
, ID_FONT_SIZE
, wxEmptyString
, wxDefaultPosition
,
1563 wxSize(80, wxDefaultCoord
));
1564 itemSizer5
->Add(spinCtrl
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
1566 item0
->Add(itemSizer5
, 0, wxGROW
|wxLEFT
|wxRIGHT
, 5);
1569 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1570 topSizer
->AddSpacer(5);
1572 panel
->SetSizer(topSizer
);
1573 topSizer
->Fit(panel
);
1578 #endif // USE_SETTINGS_DIALOG