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
)
159 #if wxUSE_STARTUP_TIPS
160 EVT_MENU(DIALOGS_TIP
, MyFrame
::ShowTip
)
161 #endif // wxUSE_STARTUP_TIPS
163 #if USE_FONTDLG_GENERIC
164 EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC
, MyFrame
::ChooseFontGeneric
)
165 #endif // USE_FONTDLG_GENERIC
167 #if USE_DIRDLG_GENERIC
168 EVT_MENU(DIALOGS_GENERIC_DIR_CHOOSE
, MyFrame
::GenericDirChoose
)
169 #endif // wxMSW || wxMAC
171 #if USE_COLOURDLG_GENERIC
172 EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC
, MyFrame
::ChooseColourGeneric
)
173 #endif // USE_COLOURDLG_GENERIC
175 #if wxUSE_PROGRESSDLG
176 EVT_MENU(DIALOGS_PROGRESS
, MyFrame
::ShowProgress
)
177 #endif // wxUSE_PROGRESSDLG
180 EVT_MENU(DIALOGS_BUSYINFO
, MyFrame
::ShowBusyInfo
)
181 #endif // wxUSE_BUSYINFO
183 #if wxUSE_FINDREPLDLG
184 EVT_MENU(DIALOGS_FIND
, MyFrame
::ShowFindDialog
)
185 EVT_MENU(DIALOGS_REPLACE
, MyFrame
::ShowReplaceDialog
)
187 EVT_FIND(wxID_ANY
, MyFrame
::OnFindDialog
)
188 EVT_FIND_NEXT(wxID_ANY
, MyFrame
::OnFindDialog
)
189 EVT_FIND_REPLACE(wxID_ANY
, MyFrame
::OnFindDialog
)
190 EVT_FIND_REPLACE_ALL(wxID_ANY
, MyFrame
::OnFindDialog
)
191 EVT_FIND_CLOSE(wxID_ANY
, MyFrame
::OnFindDialog
)
192 #endif // wxUSE_FINDREPLDLG
194 #if USE_SETTINGS_DIALOG
195 EVT_MENU(DIALOGS_PROPERTY_SHEET
, MyFrame
::OnPropertySheet
)
196 EVT_MENU(DIALOGS_PROPERTY_SHEET_TOOLBOOK
, MyFrame
::OnPropertySheetToolBook
)
199 EVT_MENU(DIALOGS_REQUEST
, MyFrame
::OnRequestUserAttention
)
201 EVT_MENU(wxID_EXIT
, MyFrame
::OnExit
)
204 #if USE_MODAL_PRESENTATION
206 BEGIN_EVENT_TABLE(MyModalDialog
, wxDialog
)
207 EVT_BUTTON(wxID_ANY
, MyModalDialog
::OnButton
)
210 BEGIN_EVENT_TABLE(MyModelessDialog
, wxDialog
)
211 EVT_BUTTON(DIALOGS_MODELESS_BTN
, MyModelessDialog
::OnButton
)
212 EVT_CLOSE(MyModelessDialog
::OnClose
)
215 #endif // USE_MODAL_PRESENTATION
217 MyCanvas
*myCanvas
= (MyCanvas
*) NULL
;
219 // `Main program' equivalent, creating windows and returning main app frame
223 wxInitAllImageHandlers();
226 m_canvasTextColour
= wxColour(_T("BLACK"));
227 m_canvasFont
= *wxNORMAL_FONT
;
229 // Create the main frame window
230 MyFrame
*frame
= new MyFrame((wxFrame
*) NULL
, _T("wxWidgets dialogs example"));
233 wxMenu
*file_menu
= new wxMenu
;
235 file_menu
->Append(DIALOGS_MESSAGE_BOX
, _T("&Message box\tCtrl-M"));
238 #if wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
240 wxMenu
*choices_menu
= new wxMenu
;
243 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR
, _T("&Choose colour"));
244 #endif // wxUSE_COLOURDLG
247 choices_menu
->Append(DIALOGS_CHOOSE_FONT
, _T("Choose &font"));
248 #endif // wxUSE_FONTDLG
251 choices_menu
->Append(DIALOGS_SINGLE_CHOICE
, _T("&Single choice\tCtrl-C"));
252 choices_menu
->Append(DIALOGS_MULTI_CHOICE
, _T("M&ultiple choice\tCtrl-U"));
253 #endif // wxUSE_CHOICEDLG
255 #if USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
256 choices_menu
->AppendSeparator();
257 #endif // USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
259 #if USE_COLOURDLG_GENERIC
260 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR_GENERIC
, _T("&Choose colour (generic)"));
261 #endif // USE_COLOURDLG_GENERIC
263 #if USE_FONTDLG_GENERIC
264 choices_menu
->Append(DIALOGS_CHOOSE_FONT_GENERIC
, _T("Choose &font (generic)"));
265 #endif // USE_FONTDLG_GENERIC
267 file_menu
->Append(wxID_ANY
,_T("&Choices and selectors"),choices_menu
);
268 #endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
271 #if wxUSE_TEXTDLG || wxUSE_NUMBERDLG
273 wxMenu
*entry_menu
= new wxMenu
;
276 entry_menu
->Append(DIALOGS_TEXT_ENTRY
, _T("Text &entry\tCtrl-E"));
277 entry_menu
->Append(DIALOGS_PASSWORD_ENTRY
, _T("&Password entry\tCtrl-P"));
278 #endif // wxUSE_TEXTDLG
281 entry_menu
->Append(DIALOGS_NUM_ENTRY
, _T("&Numeric entry\tCtrl-N"));
282 #endif // wxUSE_NUMBERDLG
284 file_menu
->Append(wxID_ANY
,_T("&Entry dialogs"),entry_menu
);
286 #endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG
291 wxMenu
*filedlg_menu
= new wxMenu
;
292 filedlg_menu
->Append(DIALOGS_FILE_OPEN
, _T("&Open file\tCtrl-O"));
293 filedlg_menu
->Append(DIALOGS_FILE_OPEN2
, _T("&Second open file\tCtrl-2"));
294 filedlg_menu
->Append(DIALOGS_FILES_OPEN
, _T("Open &files\tCtrl-Q"));
295 filedlg_menu
->Append(DIALOGS_FILE_SAVE
, _T("Sa&ve file\tCtrl-S"));
297 #if USE_FILEDLG_GENERIC
298 filedlg_menu
->AppendSeparator();
299 filedlg_menu
->Append(DIALOGS_FILE_OPEN_GENERIC
, _T("&Open file (generic)"));
300 filedlg_menu
->Append(DIALOGS_FILES_OPEN_GENERIC
, _T("Open &files (generic)"));
301 filedlg_menu
->Append(DIALOGS_FILE_SAVE_GENERIC
, _T("Sa&ve file (generic)"));
302 #endif // USE_FILEDLG_GENERIC
304 file_menu
->Append(wxID_ANY
,_T("&File operations"),filedlg_menu
);
306 #endif // wxUSE_FILEDLG
309 wxMenu
*dir_menu
= new wxMenu
;
311 dir_menu
->Append(DIALOGS_DIR_CHOOSE
, _T("&Choose a directory\tCtrl-D"));
312 dir_menu
->Append(DIALOGS_DIRNEW_CHOOSE
, _T("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"));
313 file_menu
->Append(wxID_ANY
,_T("&Directory operations"),dir_menu
);
315 #if USE_DIRDLG_GENERIC
316 dir_menu
->AppendSeparator();
317 dir_menu
->Append(DIALOGS_GENERIC_DIR_CHOOSE
, _T("&Choose a directory (generic)"));
318 #endif // USE_DIRDLG_GENERIC
320 #endif // wxUSE_DIRDLG
323 #if wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
325 wxMenu
*info_menu
= new wxMenu
;
327 #if wxUSE_STARTUP_TIPS
328 info_menu
->Append(DIALOGS_TIP
, _T("&Tip of the day\tCtrl-T"));
329 #endif // wxUSE_STARTUP_TIPS
331 #if wxUSE_PROGRESSDLG
332 info_menu
->Append(DIALOGS_PROGRESS
, _T("Pro&gress dialog\tCtrl-G"));
333 #endif // wxUSE_PROGRESSDLG
336 info_menu
->Append(DIALOGS_BUSYINFO
, _T("&Busy info dialog\tCtrl-B"));
337 #endif // wxUSE_BUSYINFO
340 info_menu
->Append(DIALOGS_LOG_DIALOG
, _T("&Log dialog\tCtrl-L"));
341 #endif // wxUSE_LOG_DIALOG
343 file_menu
->Append(wxID_ANY
,_T("&Informative dialogs"),info_menu
);
345 #endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
348 #if wxUSE_FINDREPLDLG
349 wxMenu
*find_menu
= new wxMenu
;
350 find_menu
->AppendCheckItem(DIALOGS_FIND
, _T("&Find dialog\tCtrl-F"));
351 find_menu
->AppendCheckItem(DIALOGS_REPLACE
, _T("Find and &replace dialog\tShift-Ctrl-F"));
352 file_menu
->Append(wxID_ANY
,_T("&Searching"),find_menu
);
353 #endif // wxUSE_FINDREPLDLG
355 #if USE_MODAL_PRESENTATION
356 wxMenu
*modal_menu
= new wxMenu
;
357 modal_menu
->Append(DIALOGS_MODAL
, _T("Mo&dal dialog\tCtrl-W"));
358 modal_menu
->AppendCheckItem(DIALOGS_MODELESS
, _T("Modeless &dialog\tCtrl-Z"));
359 file_menu
->Append(wxID_ANY
,_T("&Modal/Modeless"),modal_menu
);
360 #endif // USE_MODAL_PRESENTATION
362 #if USE_SETTINGS_DIALOG
363 wxMenu
*sheet_menu
= new wxMenu
;
364 sheet_menu
->Append(DIALOGS_PROPERTY_SHEET
, _T("&Standard property sheet\tShift-Ctrl-P"));
365 sheet_menu
->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK
, _T("&Toolbook sheet\tShift-Ctrl-T"));
366 file_menu
->Append(wxID_ANY
, _T("&Property sheets"), sheet_menu
);
367 #endif // USE_SETTINGS_DIALOG
369 file_menu
->Append(DIALOGS_REQUEST
, _T("&Request user attention\tCtrl-R"));
371 file_menu
->AppendSeparator();
372 file_menu
->Append(wxID_EXIT
, _T("E&xit\tAlt-X"));
374 wxMenuBar
*menu_bar
= new wxMenuBar
;
375 menu_bar
->Append(file_menu
, _T("&File"));
376 frame
->SetMenuBar(menu_bar
);
378 myCanvas
= new MyCanvas(frame
);
379 myCanvas
->SetBackgroundColour(*wxWHITE
);
381 frame
->Centre(wxBOTH
);
391 // My frame constructor
392 MyFrame
::MyFrame(wxWindow
*parent
,
393 const wxString
& title
)
394 : wxFrame(parent
, wxID_ANY
, title
)
398 #if USE_MODAL_PRESENTATION
399 m_dialog
= (MyModelessDialog
*)NULL
;
400 #endif // USE_MODAL_PRESENTATION
402 #if wxUSE_FINDREPLDLG
408 m_clrData
.SetChooseFull(true);
409 for (int i
= 0; i
< 16; i
++)
411 m_clrData
.SetCustomColour(
414 (unsigned char)(i
*16),
415 (unsigned char)(i
*16),
416 (unsigned char)(i
*16)
420 #endif // wxUSE_COLOURDLG
424 void MyFrame
::ChooseColour(wxCommandEvent
& WXUNUSED(event
) )
426 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
428 wxColourDialog
dialog(this, &m_clrData
);
429 dialog
.SetTitle(_T("Choose the background colour"));
430 if (dialog
.ShowModal() == wxID_OK
)
432 m_clrData
= dialog
.GetColourData();
433 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
434 myCanvas
->ClearBackground();
438 #endif // wxUSE_COLOURDLG
440 #if USE_COLOURDLG_GENERIC
441 void MyFrame
::ChooseColourGeneric(wxCommandEvent
& WXUNUSED(event
))
443 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
445 //FIXME:TODO:This has no effect...
446 m_clrData
.SetChooseFull(true);
448 for (int i
= 0; i
< 16; i
++)
451 (unsigned char)(i
*16),
452 (unsigned char)(i
*16),
453 (unsigned char)(i
*16)
455 m_clrData
.SetCustomColour(i
, colour
);
458 wxGenericColourDialog
*dialog
= new wxGenericColourDialog(this, &m_clrData
);
459 if (dialog
->ShowModal() == wxID_OK
)
461 m_clrData
= dialog
->GetColourData();
462 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
463 myCanvas
->ClearBackground();
468 #endif // USE_COLOURDLG_GENERIC
471 void MyFrame
::ChooseFont(wxCommandEvent
& WXUNUSED(event
) )
474 data
.SetInitialFont(wxGetApp().m_canvasFont
);
475 data
.SetColour(wxGetApp().m_canvasTextColour
);
477 // you might also do this:
479 // wxFontDialog dialog;
480 // if ( !dialog.Create(this, data) { ... error ... }
482 wxFontDialog
dialog(this, data
);
484 if (dialog
.ShowModal() == wxID_OK
)
486 wxFontData retData
= dialog
.GetFontData();
487 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
488 wxGetApp().m_canvasTextColour
= retData
.GetColour();
491 //else: cancelled by the user, don't change the font
493 #endif // wxUSE_FONTDLG
495 #if USE_FONTDLG_GENERIC
496 void MyFrame
::ChooseFontGeneric(wxCommandEvent
& WXUNUSED(event
) )
499 data
.SetInitialFont(wxGetApp().m_canvasFont
);
500 data
.SetColour(wxGetApp().m_canvasTextColour
);
502 wxGenericFontDialog
*dialog
= new wxGenericFontDialog(this, &data
);
503 if (dialog
->ShowModal() == wxID_OK
)
505 wxFontData retData
= dialog
->GetFontData();
506 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
507 wxGetApp().m_canvasTextColour
= retData
.GetColour();
512 #endif // USE_FONTDLG_GENERIC
515 void MyFrame
::LogDialog(wxCommandEvent
& WXUNUSED(event
))
517 // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
518 // being flushed -- test it
521 wxLogMessage(wxT("This is some message - everything is ok so far."));
522 wxLogMessage(wxT("Another message...\n... this one is on multiple lines"));
523 wxLogWarning(wxT("And then something went wrong!"));
525 // and if ~wxBusyCursor doesn't do it, then call it manually
529 wxLogError(wxT("Intermediary error handler decided to abort."));
530 wxLogError(wxT("The top level caller detected an unrecoverable error."));
532 wxLog
::FlushActive();
534 wxLogMessage(wxT("And this is the same dialog but with only one message."));
536 #endif // wxUSE_LOG_DIALOG
538 void MyFrame
::MessageBox(wxCommandEvent
& WXUNUSED(event
) )
540 wxMessageDialog
dialog( NULL
, _T("This is a message box\nA long, long string to test out the message box properly"),
541 _T("Message box text"), wxNO_DEFAULT
|wxYES_NO
|wxCANCEL
|wxICON_INFORMATION
);
543 switch ( dialog
.ShowModal() )
546 wxLogStatus(wxT("You pressed \"Yes\""));
550 wxLogStatus(wxT("You pressed \"No\""));
554 wxLogStatus(wxT("You pressed \"Cancel\""));
558 wxLogError(wxT("Unexpected wxMessageDialog return code!"));
563 void MyFrame
::NumericEntry(wxCommandEvent
& WXUNUSED(event
) )
565 long res
= wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n")
566 _T("Even two rows of text."),
567 _T("Enter a number:"), _T("Numeric input test"),
574 msg
= _T("Invalid number entered or dialog cancelled.");
579 msg
.Printf(_T("You've entered %lu"), res
);
580 icon
= wxICON_INFORMATION
;
583 wxMessageBox(msg
, _T("Numeric test result"), wxOK
| icon
, this);
585 #endif // wxUSE_NUMBERDLG
588 void MyFrame
::PasswordEntry(wxCommandEvent
& WXUNUSED(event
))
590 wxString pwd
= wxGetPasswordFromUser(_T("Enter password:"),
591 _T("Password entry dialog"),
596 wxMessageBox(wxString
::Format(wxT("Your password is '%s'"), pwd
.c_str()),
597 _T("Got password"), wxOK
| wxICON_INFORMATION
, this);
601 void MyFrame
::TextEntry(wxCommandEvent
& WXUNUSED(event
))
603 wxTextEntryDialog
dialog(this,
604 _T("This is a small sample\n")
605 _T("A long, long string to test out the text entrybox"),
606 _T("Please enter a string"),
610 if (dialog
.ShowModal() == wxID_OK
)
612 wxMessageBox(dialog
.GetValue(), _T("Got string"), wxOK
| wxICON_INFORMATION
, this);
615 #endif // wxUSE_TEXTDLG
618 void MyFrame
::SingleChoice(wxCommandEvent
& WXUNUSED(event
) )
620 const wxString choices
[] = { _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five") } ;
622 wxSingleChoiceDialog
dialog(this,
623 _T("This is a small sample\n")
624 _T("A single-choice convenience dialog"),
625 _T("Please select a value"),
626 WXSIZEOF(choices
), choices
);
628 dialog
.SetSelection(2);
630 if (dialog
.ShowModal() == wxID_OK
)
632 wxMessageDialog
dialog2(this, dialog
.GetStringSelection(), _T("Got string"));
637 void MyFrame
::MultiChoice(wxCommandEvent
& WXUNUSED(event
) )
639 const wxString choices
[] =
641 _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five"),
642 _T("Six"), _T("Seven"), _T("Eight"), _T("Nine"), _T("Ten"),
643 _T("Eleven"), _T("Twelve"), _T("Seventeen"),
646 wxArrayInt selections
;
647 size_t count
= wxGetMultipleChoices(selections
,
648 _T("This is a small sample\n")
649 _T("A multi-choice convenience dialog"),
650 _T("Please select a value"),
651 WXSIZEOF(choices
), choices
,
656 msg
.Printf(wxT("You selected %u items:\n"), (unsigned)count
);
657 for ( size_t n
= 0; n
< count
; n
++ )
659 msg
+= wxString
::Format(wxT("\t%u: %u (%s)\n"),
660 (unsigned)n
, (unsigned)selections
[n
],
661 choices
[selections
[n
]].c_str());
665 //else: cancelled or nothing selected
667 #endif // wxUSE_CHOICEDLG
670 void MyFrame
::FileOpen(wxCommandEvent
& WXUNUSED(event
) )
675 _T("Testing open file dialog"),
679 _T("C++ files (*.cpp)|*.cpp")
681 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
685 dialog
.SetDirectory(wxGetHomeDir());
686 dialog
.CentreOnParent();
688 if (dialog
.ShowModal() == wxID_OK
)
691 info
.Printf(_T("Full file name: %s\n")
694 dialog
.GetPath().c_str(),
695 dialog
.GetDirectory().c_str(),
696 dialog
.GetFilename().c_str());
697 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
702 // this shows how to take advantage of specifying a default extension in the
703 // call to wxFileSelector: it is remembered after each new call and the next
704 // one will use it by default
705 void MyFrame
::FileOpen2(wxCommandEvent
& WXUNUSED(event
) )
707 static wxString s_extDef
;
708 wxString path
= wxFileSelector(
709 _T("Select the file to load"),
710 wxEmptyString
, wxEmptyString
,
714 _T("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"),
715 wxFileSelectorDefaultWildcardStr
,
716 wxFileSelectorDefaultWildcardStr
725 // it is just a sample, would use wxSplitPath in real program
726 s_extDef
= path
.AfterLast(_T('.'));
728 wxLogMessage(_T("You selected the file '%s', remembered extension '%s'"),
729 (const wxChar
*) path
, (const wxChar
*) s_extDef
);
732 void MyFrame
::FilesOpen(wxCommandEvent
& WXUNUSED(event
) )
736 _T("C++ files (*.cpp)|*.cpp");
740 _T("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"),
741 wxFileSelectorDefaultWildcardStr
,
742 wxFileSelectorDefaultWildcardStr
745 wxFileDialog
dialog(this, _T("Testing open multiple file dialog"),
746 wxEmptyString
, wxEmptyString
, wildcards
,
749 if (dialog
.ShowModal() == wxID_OK
)
751 wxArrayString paths
, filenames
;
753 dialog
.GetPaths(paths
);
754 dialog
.GetFilenames(filenames
);
757 size_t count
= paths
.GetCount();
758 for ( size_t n
= 0; n
< count
; n
++ )
760 s
.Printf(_T("File %d: %s (%s)\n"),
761 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
765 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
768 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
773 void MyFrame
::FileSave(wxCommandEvent
& WXUNUSED(event
) )
775 wxFileDialog
dialog(this,
776 _T("Testing save file dialog"),
779 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
780 wxSAVE
|wxOVERWRITE_PROMPT
);
782 dialog
.SetFilterIndex(1);
784 if (dialog
.ShowModal() == wxID_OK
)
786 wxLogMessage(_T("%s, filter %d"),
787 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
790 #endif // wxUSE_FILEDLG
792 #if USE_FILEDLG_GENERIC
793 void MyFrame
::FileOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
795 wxGenericFileDialog dialog
798 _T("Testing open file dialog"),
801 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
804 dialog
.SetDirectory(wxGetHomeDir());
806 if (dialog
.ShowModal() == wxID_OK
)
809 info
.Printf(_T("Full file name: %s\n")
812 dialog
.GetPath().c_str(),
813 dialog
.GetDirectory().c_str(),
814 dialog
.GetFilename().c_str());
815 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
820 void MyFrame
::FilesOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
822 wxString wildcards
= _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
823 wxGenericFileDialog
dialog(this, _T("Testing open multiple file dialog"),
824 wxEmptyString
, wxEmptyString
, wildcards
,
827 if (dialog
.ShowModal() == wxID_OK
)
829 wxArrayString paths
, filenames
;
831 dialog
.GetPaths(paths
);
832 dialog
.GetFilenames(filenames
);
835 size_t count
= paths
.GetCount();
836 for ( size_t n
= 0; n
< count
; n
++ )
838 s
.Printf(_T("File %d: %s (%s)\n"),
839 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
843 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
846 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
851 void MyFrame
::FileSaveGeneric(wxCommandEvent
& WXUNUSED(event
) )
853 wxGenericFileDialog
dialog(this,
854 _T("Testing save file dialog"),
857 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
858 wxSAVE
|wxOVERWRITE_PROMPT
);
860 dialog
.SetFilterIndex(1);
862 if (dialog
.ShowModal() == wxID_OK
)
864 wxLogMessage(_T("%s, filter %d"),
865 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
868 #endif // USE_FILEDLG_GENERIC
871 void MyFrame
::DoDirChoose(int style
)
873 // pass some initial dir to wxDirDialog
875 wxGetHomeDir(&dirHome
);
877 wxDirDialog
dialog(this, _T("Testing directory picker"), dirHome
, style
);
879 if (dialog
.ShowModal() == wxID_OK
)
881 wxLogMessage(_T("Selected path: %s"), dialog
.GetPath().c_str());
885 void MyFrame
::DirChoose(wxCommandEvent
& WXUNUSED(event
) )
887 DoDirChoose(wxDD_DEFAULT_STYLE
& ~wxDD_NEW_DIR_BUTTON
);
890 void MyFrame
::DirChooseNew(wxCommandEvent
& WXUNUSED(event
) )
892 DoDirChoose(wxDD_DEFAULT_STYLE
| wxDD_NEW_DIR_BUTTON
);
894 #endif // wxUSE_DIRDLG
896 #if USE_DIRDLG_GENERIC
897 void MyFrame
::GenericDirChoose(wxCommandEvent
& WXUNUSED(event
) )
899 // pass some initial dir to wxDirDialog
901 wxGetHomeDir(&dirHome
);
903 wxGenericDirDialog
dialog(this, _T("Testing generic directory picker"), dirHome
);
905 if (dialog
.ShowModal() == wxID_OK
)
907 wxMessageDialog
dialog2(this, dialog
.GetPath(), _T("Selected path"));
911 #endif // USE_DIRDLG_GENERIC
913 #if USE_MODAL_PRESENTATION
914 void MyFrame
::ModalDlg(wxCommandEvent
& WXUNUSED(event
))
916 MyModalDialog
dlg(this);
920 void MyFrame
::ModelessDlg(wxCommandEvent
& event
)
922 bool show
= GetMenuBar()->IsChecked(event
.GetId());
928 m_dialog
= new MyModelessDialog(this);
931 m_dialog
->Show(true);
935 // If m_dialog is NULL, then possibly the system
936 // didn't report the checked menu item status correctly.
937 // It should be true just after the menu item was selected,
938 // if there was no modeless dialog yet.
940 wxASSERT( m_dialog
!= NULL
);
945 #endif // USE_MODAL_PRESENTATION
947 #if wxUSE_STARTUP_TIPS
948 void MyFrame
::ShowTip(wxCommandEvent
& WXUNUSED(event
))
950 static size_t s_index
= (size_t)-1;
952 if ( s_index
== (size_t)-1 )
956 // this is completely bogus, we don't know how many lines are there
957 // in the file, but who cares, it's a demo only...
958 s_index
= rand() % 5;
961 wxTipProvider
*tipProvider
= wxCreateFileTipProvider(_T("tips.txt"), s_index
);
963 bool showAtStartup
= wxShowTip(this, tipProvider
);
967 wxMessageBox(_T("Will show tips on startup"), _T("Tips dialog"),
968 wxOK
| wxICON_INFORMATION
, this);
971 s_index
= tipProvider
->GetCurrentTip();
974 #endif // wxUSE_STARTUP_TIPS
976 #if USE_SETTINGS_DIALOG
977 void MyFrame
::OnPropertySheet(wxCommandEvent
& WXUNUSED(event
))
979 SettingsDialog
dialog(this);
983 void MyFrame
::OnPropertySheetToolBook(wxCommandEvent
& WXUNUSED(event
))
985 SettingsDialog
dialog(this, true);
988 #endif // USE_SETTINGS_DIALOG
990 void MyFrame
::OnRequestUserAttention(wxCommandEvent
& WXUNUSED(event
))
992 wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window"));
996 RequestUserAttention(wxUSER_ATTENTION_ERROR
);
999 void MyFrame
::OnExit(wxCommandEvent
& WXUNUSED(event
) )
1004 #if wxUSE_PROGRESSDLG
1006 void MyFrame
::ShowProgress( wxCommandEvent
& WXUNUSED(event
) )
1008 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1009 // check the performance
1010 int countrandomnumbers
= 0, count
= 0;
1011 wxTimeSpan
tsTest(0,0,0,250);
1012 wxDateTime DT2
, DT1
= wxDateTime
::UNow();
1017 ++countrandomnumbers
;
1018 if ( countrandomnumbers
== 1000 )
1021 countrandomnumbers
= 0;
1023 DT2
= wxDateTime
::UNow();
1024 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1025 if ( ts
.IsLongerThan( tsTest
) )
1031 const int max
= 40 * count
;
1033 static const int max
= 10;
1034 #endif // wxUSE_STOPWATCH && wxUSE_LONGLONG
1036 wxProgressDialog
dialog(_T("Progress dialog example"),
1037 _T("An informative message"),
1043 // wxPD_AUTO_HIDE | -- try this as well
1045 wxPD_ESTIMATED_TIME
|
1046 wxPD_REMAINING_TIME
|
1051 // each skip will move progress about quarter forward
1052 for ( int i
= 0; i
<= max
; i
= wxMin(i
+(skip?
int(max
/4):1), max
+1), skip
= false )
1054 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1055 // do (almost) the same operations as we did for the performance test
1057 for ( int j
= 0; j
< 1000; j
++ )
1062 DT2
= wxDateTime
::UNow();
1063 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1064 if ( ts
.IsLongerThan( tsTest
) )
1078 msg
= _T("That's all, folks!");
1080 else if ( i
> max
/ 2 )
1082 msg
= _T("Only a half left (very long message)!");
1085 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1086 if ( (i
% (max
/100)) == 0 ) // // only 100 updates, this makes it much faster
1088 cont
= dialog
.Update(i
, msg
, &skip
);
1091 cont
= dialog
.Update(i
, msg
, &skip
);
1096 if ( wxMessageBox(_T("Do you really want to cancel?"),
1097 _T("Progress dialog question"), // caption
1098 wxYES_NO
| wxICON_QUESTION
) == wxYES
)
1108 wxLogStatus(wxT("Progress dialog aborted!"));
1112 wxLogStatus(wxT("Countdown from %d finished"), max
);
1116 #endif // wxUSE_PROGRESSDLG
1120 void MyFrame
::ShowBusyInfo(wxCommandEvent
& WXUNUSED(event
))
1122 wxWindowDisabler disableAll
;
1124 wxBusyInfo
info(_T("Working, please wait..."), this);
1126 for ( int i
= 0; i
< 18; i
++ )
1136 #endif // wxUSE_BUSYINFO
1138 #if wxUSE_FINDREPLDLG
1140 void MyFrame
::ShowReplaceDialog( wxCommandEvent
& WXUNUSED(event
) )
1144 delete m_dlgReplace
;
1145 m_dlgReplace
= NULL
;
1149 m_dlgReplace
= new wxFindReplaceDialog
1153 _T("Find and replace dialog"),
1157 m_dlgReplace
->Show(true);
1161 void MyFrame
::ShowFindDialog( wxCommandEvent
& WXUNUSED(event
) )
1170 m_dlgFind
= new wxFindReplaceDialog
1179 m_dlgFind
->Show(true);
1183 static wxString
DecodeFindDialogEventFlags(int flags
)
1186 str
<< (flags
& wxFR_DOWN ?
_T("down") : _T("up")) << _T(", ")
1187 << (flags
& wxFR_WHOLEWORD ?
_T("whole words only, ") : _T(""))
1188 << (flags
& wxFR_MATCHCASE ?
_T("") : _T("not "))
1189 << _T("case sensitive");
1194 void MyFrame
::OnFindDialog(wxFindDialogEvent
& event
)
1196 wxEventType type
= event
.GetEventType();
1198 if ( type
== wxEVT_COMMAND_FIND
|| type
== wxEVT_COMMAND_FIND_NEXT
)
1200 wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
1201 type
== wxEVT_COMMAND_FIND_NEXT ?
wxT("next ") : wxT(""),
1202 event
.GetFindString().c_str(),
1203 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1205 else if ( type
== wxEVT_COMMAND_FIND_REPLACE
||
1206 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
)
1208 wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
1209 type
== wxEVT_COMMAND_FIND_REPLACE_ALL ?
_T("all ") : wxT(""),
1210 event
.GetFindString().c_str(),
1211 event
.GetReplaceString().c_str(),
1212 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1214 else if ( type
== wxEVT_COMMAND_FIND_CLOSE
)
1216 wxFindReplaceDialog
*dlg
= event
.GetDialog();
1220 if ( dlg
== m_dlgFind
)
1223 idMenu
= DIALOGS_FIND
;
1226 else if ( dlg
== m_dlgReplace
)
1228 txt
= _T("Replace");
1229 idMenu
= DIALOGS_REPLACE
;
1230 m_dlgReplace
= NULL
;
1234 txt
= _T("Unknown");
1237 wxFAIL_MSG( _T("unexpected event") );
1240 wxLogMessage(wxT("%s dialog is being closed."), txt
);
1242 if ( idMenu
!= wxID_ANY
)
1244 GetMenuBar()->Check(idMenu
, false);
1251 wxLogError(wxT("Unknown find dialog event!"));
1255 #endif // wxUSE_FINDREPLDLG
1257 // ----------------------------------------------------------------------------
1259 // ----------------------------------------------------------------------------
1261 void MyCanvas
::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
1264 dc
.SetFont(wxGetApp().m_canvasFont
);
1265 dc
.SetTextForeground(wxGetApp().m_canvasTextColour
);
1266 dc
.SetBackgroundMode(wxTRANSPARENT
);
1268 _T("wxWidgets common dialogs")
1269 #if !defined(__SMARTPHONE__)
1270 _T(" test application")
1275 #if USE_MODAL_PRESENTATION
1277 // ----------------------------------------------------------------------------
1279 // ----------------------------------------------------------------------------
1281 MyModelessDialog
::MyModelessDialog(wxWindow
*parent
)
1282 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modeless dialog")))
1284 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
1286 wxButton
*btn
= new wxButton(this, DIALOGS_MODELESS_BTN
, _T("Press me"));
1287 wxCheckBox
*check
= new wxCheckBox(this, wxID_ANY
, _T("Should be disabled"));
1290 sizerTop
->Add(btn
, 1, wxEXPAND
| wxALL
, 5);
1291 sizerTop
->Add(check
, 1, wxEXPAND
| wxALL
, 5);
1295 sizerTop
->SetSizeHints(this);
1296 sizerTop
->Fit(this);
1299 void MyModelessDialog
::OnButton(wxCommandEvent
& WXUNUSED(event
))
1301 wxMessageBox(_T("Button pressed in modeless dialog"), _T("Info"),
1302 wxOK
| wxICON_INFORMATION
, this);
1305 void MyModelessDialog
::OnClose(wxCloseEvent
& event
)
1307 if ( event
.CanVeto() )
1309 wxMessageBox(_T("Use the menu item to close this dialog"),
1310 _T("Modeless dialog"),
1311 wxOK
| wxICON_INFORMATION
, this);
1317 // ----------------------------------------------------------------------------
1319 // ----------------------------------------------------------------------------
1321 MyModalDialog
::MyModalDialog(wxWindow
*parent
)
1322 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modal dialog")))
1324 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
1326 m_btnModal
= new wxButton(this, wxID_ANY
, _T("&Modal dialog..."));
1327 m_btnModeless
= new wxButton(this, wxID_ANY
, _T("Mode&less dialog"));
1328 m_btnDelete
= new wxButton(this, wxID_ANY
, _T("&Delete button"));
1330 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _T("&Close"));
1331 sizerTop
->Add(m_btnModal
, 0, wxALIGN_CENTER
| wxALL
, 5);
1332 sizerTop
->Add(m_btnModeless
, 0, wxALIGN_CENTER
| wxALL
, 5);
1333 sizerTop
->Add(m_btnDelete
, 0, wxALIGN_CENTER
| wxALL
, 5);
1334 sizerTop
->Add(btnOk
, 0, wxALIGN_CENTER
| wxALL
, 5);
1338 sizerTop
->SetSizeHints(this);
1339 sizerTop
->Fit(this);
1341 m_btnModal
->SetFocus();
1342 m_btnModal
->SetDefault();
1345 void MyModalDialog
::OnButton(wxCommandEvent
& event
)
1347 if ( event
.GetEventObject() == m_btnDelete
)
1352 m_btnDelete
->Disable();
1354 else if ( event
.GetEventObject() == m_btnModal
)
1357 wxGetTextFromUser(_T("Dummy prompt"),
1358 _T("Modal dialog called from dialog"),
1359 wxEmptyString
, this);
1361 wxMessageBox(_T("Modal dialog called from dialog"));
1362 #endif // wxUSE_TEXTDLG
1364 else if ( event
.GetEventObject() == m_btnModeless
)
1366 (new MyModelessDialog(this))->Show();
1374 #endif // USE_MODAL_PRESENTATION
1376 #if USE_SETTINGS_DIALOG
1377 // ----------------------------------------------------------------------------
1379 // ----------------------------------------------------------------------------
1381 IMPLEMENT_CLASS(SettingsDialog
, wxPropertySheetDialog
)
1383 BEGIN_EVENT_TABLE(SettingsDialog
, wxPropertySheetDialog
)
1386 SettingsDialog
::SettingsDialog(wxWindow
* win
, bool useToolBook
)
1388 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
|wxWS_EX_VALIDATE_RECURSIVELY
);
1397 SetSheetStyle(wxPROPSHEET_TOOLBOOK
|wxPROPSHEET_SHRINKTOFIT
);
1399 // create a dummy image list with a few icons
1400 const wxSize
imageSize(32, 32);
1402 m_imageList
= new wxImageList(imageSize
.GetWidth(), imageSize
.GetHeight());
1404 Add(wxArtProvider
::GetIcon(wxART_INFORMATION
, wxART_OTHER
, imageSize
));
1406 Add(wxArtProvider
::GetIcon(wxART_QUESTION
, wxART_OTHER
, imageSize
));
1408 Add(wxArtProvider
::GetIcon(wxART_WARNING
, wxART_OTHER
, imageSize
));
1410 Add(wxArtProvider
::GetIcon(wxART_ERROR
, wxART_OTHER
, imageSize
));
1415 Create(win
, wxID_ANY
, _("Preferences"), wxDefaultPosition
, wxDefaultSize
,
1416 wxDEFAULT_DIALOG_STYLE
1422 // If using a toolbook, also follow Mac style and don't create buttons
1424 CreateButtons(wxOK
|wxCANCEL
1425 #ifndef __POCKETPC__
1430 wxBookCtrlBase
* notebook
= GetBookCtrl();
1431 notebook
->SetImageList(m_imageList
);
1433 wxPanel
* generalSettings
= CreateGeneralSettingsPage(notebook
);
1434 wxPanel
* aestheticSettings
= CreateAestheticSettingsPage(notebook
);
1436 notebook
->AddPage(generalSettings
, _("General"), true, tabImage1
);
1437 notebook
->AddPage(aestheticSettings
, _("Aesthetics"), false, tabImage2
);
1442 SettingsDialog
::~SettingsDialog()
1447 wxPanel
* SettingsDialog
::CreateGeneralSettingsPage(wxWindow
* parent
)
1449 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1451 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1452 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1456 wxBoxSizer
* itemSizer3
= new wxBoxSizer( wxHORIZONTAL
);
1457 wxCheckBox
* checkBox3
= new wxCheckBox(panel
, ID_LOAD_LAST_PROJECT
, _("&Load last project on startup"), wxDefaultPosition
, wxDefaultSize
);
1458 itemSizer3
->Add(checkBox3
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1459 item0
->Add(itemSizer3
, 0, wxGROW
|wxALL
, 0);
1463 wxString autoSaveLabel
= _("&Auto-save every");
1464 wxString minsLabel
= _("mins");
1466 wxBoxSizer
* itemSizer12
= new wxBoxSizer( wxHORIZONTAL
);
1467 wxCheckBox
* checkBox12
= new wxCheckBox(panel
, ID_AUTO_SAVE
, autoSaveLabel
, wxDefaultPosition
, wxDefaultSize
);
1470 wxSpinCtrl
* spinCtrl12
= new wxSpinCtrl(panel
, ID_AUTO_SAVE_MINS
, wxEmptyString
,
1471 wxDefaultPosition
, wxSize(40, wxDefaultCoord
), wxSP_ARROW_KEYS
, 1, 60, 1);
1474 itemSizer12
->Add(checkBox12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1476 itemSizer12
->Add(spinCtrl12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1478 itemSizer12
->Add(new wxStaticText(panel
, wxID_STATIC
, minsLabel
), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1479 item0
->Add(itemSizer12
, 0, wxGROW
|wxALL
, 0);
1483 wxBoxSizer
* itemSizer8
= new wxBoxSizer( wxHORIZONTAL
);
1484 wxCheckBox
* checkBox6
= new wxCheckBox(panel
, ID_SHOW_TOOLTIPS
, _("Show &tooltips"), wxDefaultPosition
, wxDefaultSize
);
1485 itemSizer8
->Add(checkBox6
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1486 item0
->Add(itemSizer8
, 0, wxGROW
|wxALL
, 0);
1488 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1490 panel
->SetSizer(topSizer
);
1491 topSizer
->Fit(panel
);
1496 wxPanel
* SettingsDialog
::CreateAestheticSettingsPage(wxWindow
* parent
)
1498 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1500 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1501 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1503 //// PROJECT OR GLOBAL
1504 wxString globalOrProjectChoices
[2];
1505 globalOrProjectChoices
[0] = _("&New projects");
1506 globalOrProjectChoices
[1] = _("&This project");
1508 wxRadioBox
* projectOrGlobal
= new wxRadioBox(panel
, ID_APPLY_SETTINGS_TO
, _("&Apply settings to:"),
1509 wxDefaultPosition
, wxDefaultSize
, 2, globalOrProjectChoices
);
1510 item0
->Add(projectOrGlobal
, 0, wxGROW
|wxALL
, 5);
1512 projectOrGlobal
->SetSelection(0);
1514 //// BACKGROUND STYLE
1515 wxArrayString backgroundStyleChoices
;
1516 backgroundStyleChoices
.Add(wxT("Colour"));
1517 backgroundStyleChoices
.Add(wxT("Image"));
1518 wxStaticBox
* staticBox3
= new wxStaticBox(panel
, wxID_ANY
, _("Background style:"));
1520 wxBoxSizer
* styleSizer
= new wxStaticBoxSizer( staticBox3
, wxVERTICAL
);
1521 item0
->Add(styleSizer
, 0, wxGROW
|wxALL
, 5);
1523 wxBoxSizer
* itemSizer2
= new wxBoxSizer( wxHORIZONTAL
);
1525 wxChoice
* choice2
= new wxChoice(panel
, ID_BACKGROUND_STYLE
, wxDefaultPosition
, wxDefaultSize
, backgroundStyleChoices
);
1527 itemSizer2
->Add(new wxStaticText(panel
, wxID_ANY
, _("&Window:")), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1528 itemSizer2
->Add(5, 5, 1, wxALL
, 0);
1529 itemSizer2
->Add(choice2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1531 styleSizer
->Add(itemSizer2
, 0, wxGROW
|wxALL
, 5);
1534 //// FONT SIZE SELECTION
1536 wxStaticBox
* staticBox1
= new wxStaticBox(panel
, wxID_ANY
, _("Tile font size:"));
1537 wxBoxSizer
* itemSizer5
= new wxStaticBoxSizer( staticBox1
, wxHORIZONTAL
);
1539 wxSpinCtrl
* spinCtrl
= new wxSpinCtrl(panel
, ID_FONT_SIZE
, wxEmptyString
, wxDefaultPosition
,
1540 wxSize(80, wxDefaultCoord
));
1541 itemSizer5
->Add(spinCtrl
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
1543 item0
->Add(itemSizer5
, 0, wxGROW
|wxLEFT
|wxRIGHT
, 5);
1546 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1547 topSizer
->AddSpacer(5);
1549 panel
->SetSizer(topSizer
);
1550 topSizer
->Fit(panel
);
1555 #endif // USE_SETTINGS_DIALOG