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 #if defined(__GNUG__) && !defined(__APPLE__)
13 #pragma implementation
17 // For compilers that support precompilation, includes "wx/wx.h".
18 #include "wx/wxprec.h"
28 #include "../sample.xpm"
30 #include "wx/datetime.h"
32 #include "wx/bookctrl.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/busyinfo.h"
56 #endif // wxUSE_BUSYINFO
59 #include "wx/numdlg.h"
60 #endif // wxUSE_NUMBERDLG
63 #include "wx/filedlg.h"
64 #endif // wxUSE_FILEDLG
67 #include "wx/dirdlg.h"
68 #endif // wxUSE_DIRDLG
71 #include "wx/fontdlg.h"
72 #endif // wxUSE_FONTDLG
75 #include "wx/fdrepdlg.h"
76 #endif // wxUSE_FINDREPLDLG
79 #include "wx/spinctrl.h"
82 #include "wx/propdlg.h"
86 #if USE_COLOURDLG_GENERIC
87 #include "wx/generic/colrdlgg.h"
88 #endif // USE_COLOURDLG_GENERIC
90 #if USE_DIRDLG_GENERIC
91 #include "wx/generic/dirdlgg.h"
92 #endif // USE_DIRDLG_GENERIC
94 #if USE_FILEDLG_GENERIC
95 #include "wx/generic/filedlgg.h"
96 #endif // USE_FILEDLG_GENERIC
98 #if USE_FONTDLG_GENERIC
99 #include "wx/generic/fontdlgg.h"
100 #endif // USE_FONTDLG_GENERIC
104 BEGIN_EVENT_TABLE(MyCanvas
, wxScrolledWindow
)
105 EVT_PAINT(MyCanvas::OnPaint
)
110 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
111 EVT_MENU(DIALOGS_MESSAGE_BOX
, MyFrame::MessageBox
)
114 EVT_MENU(DIALOGS_CHOOSE_COLOUR
, MyFrame::ChooseColour
)
115 #endif // wxUSE_COLOURDLG
118 EVT_MENU(DIALOGS_CHOOSE_FONT
, MyFrame::ChooseFont
)
119 #endif // wxUSE_FONTDLG
122 EVT_MENU(DIALOGS_LOG_DIALOG
, MyFrame::LogDialog
)
123 #endif // wxUSE_LOG_DIALOG
126 EVT_MENU(DIALOGS_TEXT_ENTRY
, MyFrame::TextEntry
)
127 EVT_MENU(DIALOGS_PASSWORD_ENTRY
, MyFrame::PasswordEntry
)
128 #endif // wxUSE_TEXTDLG
131 EVT_MENU(DIALOGS_NUM_ENTRY
, MyFrame::NumericEntry
)
132 #endif // wxUSE_NUMBERDLG
135 EVT_MENU(DIALOGS_SINGLE_CHOICE
, MyFrame::SingleChoice
)
136 EVT_MENU(DIALOGS_MULTI_CHOICE
, MyFrame::MultiChoice
)
137 #endif // wxUSE_CHOICEDLG
140 EVT_MENU(DIALOGS_FILE_OPEN
, MyFrame::FileOpen
)
141 EVT_MENU(DIALOGS_FILE_OPEN2
, MyFrame::FileOpen2
)
142 EVT_MENU(DIALOGS_FILES_OPEN
, MyFrame::FilesOpen
)
143 EVT_MENU(DIALOGS_FILE_SAVE
, MyFrame::FileSave
)
144 #endif // wxUSE_FILEDLG
146 #if USE_FILEDLG_GENERIC
147 EVT_MENU(DIALOGS_FILE_OPEN_GENERIC
, MyFrame::FileOpenGeneric
)
148 EVT_MENU(DIALOGS_FILES_OPEN_GENERIC
, MyFrame::FilesOpenGeneric
)
149 EVT_MENU(DIALOGS_FILE_SAVE_GENERIC
, MyFrame::FileSaveGeneric
)
150 #endif // USE_FILEDLG_GENERIC
153 EVT_MENU(DIALOGS_DIR_CHOOSE
, MyFrame::DirChoose
)
154 EVT_MENU(DIALOGS_DIRNEW_CHOOSE
, MyFrame::DirChooseNew
)
155 #endif // wxUSE_DIRDLG
157 #if USE_MODAL_PRESENTATION
158 EVT_MENU(DIALOGS_MODAL
, MyFrame::ModalDlg
)
159 EVT_MENU(DIALOGS_MODELESS
, MyFrame::ModelessDlg
)
162 #if wxUSE_STARTUP_TIPS
163 EVT_MENU(DIALOGS_TIP
, MyFrame::ShowTip
)
164 #endif // wxUSE_STARTUP_TIPS
166 #if USE_FONTDLG_GENERIC
167 EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC
, MyFrame::ChooseFontGeneric
)
168 #endif // USE_FONTDLG_GENERIC
170 #if USE_DIRDLG_GENERIC
171 EVT_MENU(DIALOGS_GENERIC_DIR_CHOOSE
, MyFrame::GenericDirChoose
)
172 #endif // wxMSW || wxMAC
174 #if USE_COLOURDLG_GENERIC
175 EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC
, MyFrame::ChooseColourGeneric
)
176 #endif // USE_COLOURDLG_GENERIC
178 #if wxUSE_PROGRESSDLG
179 EVT_MENU(DIALOGS_PROGRESS
, MyFrame::ShowProgress
)
180 #endif // wxUSE_PROGRESSDLG
183 EVT_MENU(DIALOGS_BUSYINFO
, MyFrame::ShowBusyInfo
)
184 #endif // wxUSE_BUSYINFO
186 #if wxUSE_FINDREPLDLG
187 EVT_MENU(DIALOGS_FIND
, MyFrame::ShowFindDialog
)
188 EVT_MENU(DIALOGS_REPLACE
, MyFrame::ShowReplaceDialog
)
190 EVT_FIND(wxID_ANY
, MyFrame::OnFindDialog
)
191 EVT_FIND_NEXT(wxID_ANY
, MyFrame::OnFindDialog
)
192 EVT_FIND_REPLACE(wxID_ANY
, MyFrame::OnFindDialog
)
193 EVT_FIND_REPLACE_ALL(wxID_ANY
, MyFrame::OnFindDialog
)
194 EVT_FIND_CLOSE(wxID_ANY
, MyFrame::OnFindDialog
)
195 #endif // wxUSE_FINDREPLDLG
197 #if USE_SETTINGS_DIALOG
198 EVT_MENU(DIALOGS_PROPERTY_SHEET
, MyFrame::OnPropertySheet
)
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
*modal_menu
= new wxMenu
;
359 modal_menu
->Append(DIALOGS_MODAL
, _T("Mo&dal dialog\tCtrl-W"));
360 modal_menu
->AppendCheckItem(DIALOGS_MODELESS
, _T("Modeless &dialog\tCtrl-Z"));
361 file_menu
->Append(wxID_ANY
,_T("&Modal/Modeless"),modal_menu
);
362 #endif // USE_MODAL_PRESENTATION
364 #if USE_SETTINGS_DIALOG
365 file_menu
->Append(DIALOGS_PROPERTY_SHEET
, _T("&Property Sheet Dialog\tCtrl-P"));
368 file_menu
->Append(DIALOGS_REQUEST
, _T("&Request user attention\tCtrl-R"));
370 file_menu
->AppendSeparator();
371 file_menu
->Append(wxID_EXIT
, _T("E&xit\tAlt-X"));
373 wxMenuBar
*menu_bar
= new wxMenuBar
;
374 menu_bar
->Append(file_menu
, _T("&File"));
375 frame
->SetMenuBar(menu_bar
);
377 myCanvas
= new MyCanvas(frame
);
378 myCanvas
->SetBackgroundColour(*wxWHITE
);
380 frame
->Centre(wxBOTH
);
390 // My frame constructor
391 MyFrame::MyFrame(wxWindow
*parent
,
392 const wxString
& title
)
393 : wxFrame(parent
, wxID_ANY
, title
)
397 #if USE_MODAL_PRESENTATION
398 m_dialog
= (MyModelessDialog
*)NULL
;
399 #endif // USE_MODAL_PRESENTATION
401 #if wxUSE_FINDREPLDLG
407 m_clrData
.SetChooseFull(true);
408 for (int i
= 0; i
< 16; i
++)
410 m_clrData
.SetCustomColour(
413 (unsigned char)(i
*16),
414 (unsigned char)(i
*16),
415 (unsigned char)(i
*16)
419 #endif // wxUSE_COLOURDLG
423 void MyFrame::ChooseColour(wxCommandEvent
& WXUNUSED(event
) )
425 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
427 wxColourDialog
dialog(this, &m_clrData
);
428 dialog
.SetTitle(_T("Choose the background colour"));
429 if (dialog
.ShowModal() == wxID_OK
)
431 m_clrData
= dialog
.GetColourData();
432 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
433 myCanvas
->ClearBackground();
437 #endif // wxUSE_COLOURDLG
439 #if USE_COLOURDLG_GENERIC
440 void MyFrame::ChooseColourGeneric(wxCommandEvent
& WXUNUSED(event
))
442 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
444 //FIXME:TODO:This has no effect...
445 m_clrData
.SetChooseFull(true);
447 for (int i
= 0; i
< 16; i
++)
450 (unsigned char)(i
*16),
451 (unsigned char)(i
*16),
452 (unsigned char)(i
*16)
454 m_clrData
.SetCustomColour(i
, colour
);
457 wxGenericColourDialog
*dialog
= new wxGenericColourDialog(this, &m_clrData
);
458 if (dialog
->ShowModal() == wxID_OK
)
460 m_clrData
= dialog
->GetColourData();
461 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
462 myCanvas
->ClearBackground();
467 #endif // USE_COLOURDLG_GENERIC
470 void MyFrame::ChooseFont(wxCommandEvent
& WXUNUSED(event
) )
473 data
.SetInitialFont(wxGetApp().m_canvasFont
);
474 data
.SetColour(wxGetApp().m_canvasTextColour
);
476 // you might also do this:
478 // wxFontDialog dialog;
479 // if ( !dialog.Create(this, data) { ... error ... }
481 wxFontDialog
dialog(this, data
);
483 if (dialog
.ShowModal() == wxID_OK
)
485 wxFontData retData
= dialog
.GetFontData();
486 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
487 wxGetApp().m_canvasTextColour
= retData
.GetColour();
490 //else: cancelled by the user, don't change the font
492 #endif // wxUSE_FONTDLG
494 #if USE_FONTDLG_GENERIC
495 void MyFrame::ChooseFontGeneric(wxCommandEvent
& WXUNUSED(event
) )
498 data
.SetInitialFont(wxGetApp().m_canvasFont
);
499 data
.SetColour(wxGetApp().m_canvasTextColour
);
501 wxGenericFontDialog
*dialog
= new wxGenericFontDialog(this, &data
);
502 if (dialog
->ShowModal() == wxID_OK
)
504 wxFontData retData
= dialog
->GetFontData();
505 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
506 wxGetApp().m_canvasTextColour
= retData
.GetColour();
511 #endif // USE_FONTDLG_GENERIC
514 void MyFrame::LogDialog(wxCommandEvent
& WXUNUSED(event
))
516 // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
517 // being flushed -- test it
520 wxLogMessage(wxT("This is some message - everything is ok so far."));
521 wxLogMessage(wxT("Another message...\n... this one is on multiple lines"));
522 wxLogWarning(wxT("And then something went wrong!"));
524 // and if ~wxBusyCursor doesn't do it, then call it manually
528 wxLogError(wxT("Intermediary error handler decided to abort."));
529 wxLogError(wxT("The top level caller detected an unrecoverable error."));
531 wxLog::FlushActive();
533 wxLogMessage(wxT("And this is the same dialog but with only one message."));
535 #endif // wxUSE_LOG_DIALOG
537 void MyFrame::MessageBox(wxCommandEvent
& WXUNUSED(event
) )
539 wxMessageDialog
dialog( NULL
, _T("This is a message box\nA long, long string to test out the message box properly"),
540 _T("Message box text"), wxNO_DEFAULT
|wxYES_NO
|wxCANCEL
|wxICON_INFORMATION
);
542 switch ( dialog
.ShowModal() )
545 wxLogStatus(wxT("You pressed \"Yes\""));
549 wxLogStatus(wxT("You pressed \"No\""));
553 wxLogStatus(wxT("You pressed \"Cancel\""));
557 wxLogError(wxT("Unexpected wxMessageDialog return code!"));
562 void MyFrame::NumericEntry(wxCommandEvent
& WXUNUSED(event
) )
564 long res
= wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n")
565 _T("Even two rows of text."),
566 _T("Enter a number:"), _T("Numeric input test"),
573 msg
= _T("Invalid number entered or dialog cancelled.");
578 msg
.Printf(_T("You've entered %lu"), res
);
579 icon
= wxICON_INFORMATION
;
582 wxMessageBox(msg
, _T("Numeric test result"), wxOK
| icon
, this);
584 #endif // wxUSE_NUMBERDLG
587 void MyFrame::PasswordEntry(wxCommandEvent
& WXUNUSED(event
))
589 wxString pwd
= wxGetPasswordFromUser(_T("Enter password:"),
590 _T("Password entry dialog"),
595 wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd
.c_str()),
596 _T("Got password"), wxOK
| wxICON_INFORMATION
, this);
600 void MyFrame::TextEntry(wxCommandEvent
& WXUNUSED(event
))
602 wxTextEntryDialog
dialog(this,
603 _T("This is a small sample\n")
604 _T("A long, long string to test out the text entrybox"),
605 _T("Please enter a string"),
609 if (dialog
.ShowModal() == wxID_OK
)
611 wxMessageBox(dialog
.GetValue(), _T("Got string"), wxOK
| wxICON_INFORMATION
, this);
614 #endif // wxUSE_TEXTDLG
617 void MyFrame::SingleChoice(wxCommandEvent
& WXUNUSED(event
) )
619 const wxString choices
[] = { _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five") } ;
621 wxSingleChoiceDialog
dialog(this,
622 _T("This is a small sample\n")
623 _T("A single-choice convenience dialog"),
624 _T("Please select a value"),
625 WXSIZEOF(choices
), choices
);
627 dialog
.SetSelection(2);
629 if (dialog
.ShowModal() == wxID_OK
)
631 wxMessageDialog
dialog2(this, dialog
.GetStringSelection(), _T("Got string"));
636 void MyFrame::MultiChoice(wxCommandEvent
& WXUNUSED(event
) )
638 const wxString choices
[] =
640 _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five"),
641 _T("Six"), _T("Seven"), _T("Eight"), _T("Nine"), _T("Ten"),
642 _T("Eleven"), _T("Twelve"), _T("Seventeen"),
645 wxArrayInt selections
;
646 size_t count
= wxGetMultipleChoices(selections
,
647 _T("This is a small sample\n")
648 _T("A multi-choice convenience dialog"),
649 _T("Please select a value"),
650 WXSIZEOF(choices
), choices
,
655 msg
.Printf(wxT("You selected %u items:\n"), (unsigned)count
);
656 for ( size_t n
= 0; n
< count
; n
++ )
658 msg
+= wxString::Format(wxT("\t%u: %u (%s)\n"),
659 (unsigned)n
, (unsigned)selections
[n
],
660 choices
[selections
[n
]].c_str());
664 //else: cancelled or nothing selected
666 #endif // wxUSE_CHOICEDLG
669 void MyFrame::FileOpen(wxCommandEvent
& WXUNUSED(event
) )
674 _T("Testing open file dialog"),
678 _T("C++ files (*.cpp)|*.cpp")
680 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
684 dialog
.SetDirectory(wxGetHomeDir());
685 dialog
.CentreOnParent();
687 if (dialog
.ShowModal() == wxID_OK
)
690 info
.Printf(_T("Full file name: %s\n")
693 dialog
.GetPath().c_str(),
694 dialog
.GetDirectory().c_str(),
695 dialog
.GetFilename().c_str());
696 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
701 // this shows how to take advantage of specifying a default extension in the
702 // call to wxFileSelector: it is remembered after each new call and the next
703 // one will use it by default
704 void MyFrame::FileOpen2(wxCommandEvent
& WXUNUSED(event
) )
706 static wxString s_extDef
;
707 wxString path
= wxFileSelector(
708 _T("Select the file to load"),
709 wxEmptyString
, wxEmptyString
,
713 _T("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"),
714 wxFileSelectorDefaultWildcardStr
,
715 wxFileSelectorDefaultWildcardStr
724 // it is just a sample, would use wxSplitPath in real program
725 s_extDef
= path
.AfterLast(_T('.'));
727 wxLogMessage(_T("You selected the file '%s', remembered extension '%s'"),
728 (const wxChar
*) path
, (const wxChar
*) s_extDef
);
731 void MyFrame::FilesOpen(wxCommandEvent
& WXUNUSED(event
) )
735 _T("C++ files (*.cpp)|*.cpp");
739 _T("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"),
740 wxFileSelectorDefaultWildcardStr
,
741 wxFileSelectorDefaultWildcardStr
744 wxFileDialog
dialog(this, _T("Testing open multiple file dialog"),
745 wxEmptyString
, wxEmptyString
, wildcards
,
748 if (dialog
.ShowModal() == wxID_OK
)
750 wxArrayString paths
, filenames
;
752 dialog
.GetPaths(paths
);
753 dialog
.GetFilenames(filenames
);
756 size_t count
= paths
.GetCount();
757 for ( size_t n
= 0; n
< count
; n
++ )
759 s
.Printf(_T("File %d: %s (%s)\n"),
760 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
764 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
767 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
772 void MyFrame::FileSave(wxCommandEvent
& WXUNUSED(event
) )
774 wxFileDialog
dialog(this,
775 _T("Testing save file dialog"),
778 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
779 wxSAVE
|wxOVERWRITE_PROMPT
);
781 dialog
.SetFilterIndex(1);
783 if (dialog
.ShowModal() == wxID_OK
)
785 wxLogMessage(_T("%s, filter %d"),
786 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
789 #endif // wxUSE_FILEDLG
791 #if USE_FILEDLG_GENERIC
792 void MyFrame::FileOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
794 wxGenericFileDialog dialog
797 _T("Testing open file dialog"),
800 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
803 dialog
.SetDirectory(wxGetHomeDir());
805 if (dialog
.ShowModal() == wxID_OK
)
808 info
.Printf(_T("Full file name: %s\n")
811 dialog
.GetPath().c_str(),
812 dialog
.GetDirectory().c_str(),
813 dialog
.GetFilename().c_str());
814 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
819 void MyFrame::FilesOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
821 wxString wildcards
= _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
822 wxGenericFileDialog
dialog(this, _T("Testing open multiple file dialog"),
823 wxEmptyString
, wxEmptyString
, wildcards
,
826 if (dialog
.ShowModal() == wxID_OK
)
828 wxArrayString paths
, filenames
;
830 dialog
.GetPaths(paths
);
831 dialog
.GetFilenames(filenames
);
834 size_t count
= paths
.GetCount();
835 for ( size_t n
= 0; n
< count
; n
++ )
837 s
.Printf(_T("File %d: %s (%s)\n"),
838 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
842 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
845 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
850 void MyFrame::FileSaveGeneric(wxCommandEvent
& WXUNUSED(event
) )
852 wxGenericFileDialog
dialog(this,
853 _T("Testing save file dialog"),
856 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
857 wxSAVE
|wxOVERWRITE_PROMPT
);
859 dialog
.SetFilterIndex(1);
861 if (dialog
.ShowModal() == wxID_OK
)
863 wxLogMessage(_T("%s, filter %d"),
864 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
867 #endif // USE_FILEDLG_GENERIC
870 void MyFrame::DoDirChoose(int style
)
872 // pass some initial dir to wxDirDialog
874 wxGetHomeDir(&dirHome
);
876 wxDirDialog
dialog(this, _T("Testing directory picker"), dirHome
, style
);
878 if (dialog
.ShowModal() == wxID_OK
)
880 wxLogMessage(_T("Selected path: %s"), dialog
.GetPath().c_str());
884 void MyFrame::DirChoose(wxCommandEvent
& WXUNUSED(event
) )
886 DoDirChoose(wxDD_DEFAULT_STYLE
& ~wxDD_NEW_DIR_BUTTON
);
889 void MyFrame::DirChooseNew(wxCommandEvent
& WXUNUSED(event
) )
891 DoDirChoose(wxDD_DEFAULT_STYLE
| wxDD_NEW_DIR_BUTTON
);
893 #endif // wxUSE_DIRDLG
895 #if USE_DIRDLG_GENERIC
896 void MyFrame::GenericDirChoose(wxCommandEvent
& WXUNUSED(event
) )
898 // pass some initial dir to wxDirDialog
900 wxGetHomeDir(&dirHome
);
902 wxGenericDirDialog
dialog(this, _T("Testing generic directory picker"), dirHome
);
904 if (dialog
.ShowModal() == wxID_OK
)
906 wxMessageDialog
dialog2(this, dialog
.GetPath(), _T("Selected path"));
910 #endif // USE_DIRDLG_GENERIC
912 #if USE_MODAL_PRESENTATION
913 void MyFrame::ModalDlg(wxCommandEvent
& WXUNUSED(event
))
915 MyModalDialog
dlg(this);
919 void MyFrame::ModelessDlg(wxCommandEvent
& event
)
921 bool show
= GetMenuBar()->IsChecked(event
.GetId());
927 m_dialog
= new MyModelessDialog(this);
930 m_dialog
->Show(true);
934 // If m_dialog is NULL, then possibly the system
935 // didn't report the checked menu item status correctly.
936 // It should be true just after the menu item was selected,
937 // if there was no modeless dialog yet.
939 wxASSERT( m_dialog
!= NULL
);
944 #endif // USE_MODAL_PRESENTATION
946 #if wxUSE_STARTUP_TIPS
947 void MyFrame::ShowTip(wxCommandEvent
& WXUNUSED(event
))
949 static size_t s_index
= (size_t)-1;
951 if ( s_index
== (size_t)-1 )
955 // this is completely bogus, we don't know how many lines are there
956 // in the file, but who cares, it's a demo only...
957 s_index
= rand() % 5;
960 wxTipProvider
*tipProvider
= wxCreateFileTipProvider(_T("tips.txt"), s_index
);
962 bool showAtStartup
= wxShowTip(this, tipProvider
);
966 wxMessageBox(_T("Will show tips on startup"), _T("Tips dialog"),
967 wxOK
| wxICON_INFORMATION
, this);
970 s_index
= tipProvider
->GetCurrentTip();
973 #endif // wxUSE_STARTUP_TIPS
975 #if USE_SETTINGS_DIALOG
976 void MyFrame::OnPropertySheet(wxCommandEvent
& WXUNUSED(event
))
978 SettingsDialog
dialog(this);
981 #endif // USE_SETTINGS_DIALOG
983 void MyFrame::OnRequestUserAttention(wxCommandEvent
& WXUNUSED(event
))
985 wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window"));
989 RequestUserAttention(wxUSER_ATTENTION_ERROR
);
992 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
) )
997 #if wxUSE_PROGRESSDLG
999 void MyFrame::ShowProgress( wxCommandEvent
& WXUNUSED(event
) )
1001 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1002 // check the performance
1003 int countrandomnumbers
= 0, count
= 0;
1004 wxTimeSpan
tsTest(0,0,0,250);
1005 wxDateTime DT2
, DT1
= wxDateTime::UNow();
1010 ++countrandomnumbers
;
1011 if ( countrandomnumbers
== 1000 )
1014 countrandomnumbers
= 0;
1016 DT2
= wxDateTime::UNow();
1017 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1018 if ( ts
.IsLongerThan( tsTest
) )
1024 const int max
= 40 * count
;
1026 static const int max
= 10;
1027 #endif // wxUSE_STOPWATCH && wxUSE_LONGLONG
1029 wxProgressDialog
dialog(_T("Progress dialog example"),
1030 _T("An informative message"),
1036 // wxPD_AUTO_HIDE | -- try this as well
1038 wxPD_ESTIMATED_TIME
|
1039 wxPD_REMAINING_TIME
|
1044 // each skip will move progress about quarter forward
1045 for ( int i
= 0; i
<= max
; i
= wxMin(i
+(skip
?int(max
/4):1), max
+1), skip
= false )
1047 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1048 // do (almost) the same operations as we did for the performance test
1050 for ( int j
= 0; j
< 1000; j
++ )
1055 DT2
= wxDateTime::UNow();
1056 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1057 if ( ts
.IsLongerThan( tsTest
) )
1071 msg
= _T("That's all, folks!");
1073 else if ( i
> max
/ 2 )
1075 msg
= _T("Only a half left (very long message)!");
1078 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1079 if ( (i
% (max
/100)) == 0 ) // // only 100 updates, this makes it much faster
1081 cont
= dialog
.Update(i
, msg
, &skip
);
1084 cont
= dialog
.Update(i
, msg
, &skip
);
1089 if ( wxMessageBox(_T("Do you really want to cancel?"),
1090 _T("Progress dialog question"), // caption
1091 wxYES_NO
| wxICON_QUESTION
) == wxYES
)
1101 wxLogStatus(wxT("Progress dialog aborted!"));
1105 wxLogStatus(wxT("Countdown from %d finished"), max
);
1109 #endif // wxUSE_PROGRESSDLG
1113 void MyFrame::ShowBusyInfo(wxCommandEvent
& WXUNUSED(event
))
1115 wxWindowDisabler disableAll
;
1117 wxBusyInfo
info(_T("Working, please wait..."), this);
1119 for ( int i
= 0; i
< 18; i
++ )
1129 #endif // wxUSE_BUSYINFO
1131 #if wxUSE_FINDREPLDLG
1133 void MyFrame::ShowReplaceDialog( wxCommandEvent
& WXUNUSED(event
) )
1137 delete m_dlgReplace
;
1138 m_dlgReplace
= NULL
;
1142 m_dlgReplace
= new wxFindReplaceDialog
1146 _T("Find and replace dialog"),
1150 m_dlgReplace
->Show(true);
1154 void MyFrame::ShowFindDialog( wxCommandEvent
& WXUNUSED(event
) )
1163 m_dlgFind
= new wxFindReplaceDialog
1172 m_dlgFind
->Show(true);
1176 static wxString
DecodeFindDialogEventFlags(int flags
)
1179 str
<< (flags
& wxFR_DOWN
? _T("down") : _T("up")) << _T(", ")
1180 << (flags
& wxFR_WHOLEWORD
? _T("whole words only, ") : _T(""))
1181 << (flags
& wxFR_MATCHCASE
? _T("") : _T("not "))
1182 << _T("case sensitive");
1187 void MyFrame::OnFindDialog(wxFindDialogEvent
& event
)
1189 wxEventType type
= event
.GetEventType();
1191 if ( type
== wxEVT_COMMAND_FIND
|| type
== wxEVT_COMMAND_FIND_NEXT
)
1193 wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
1194 type
== wxEVT_COMMAND_FIND_NEXT
? wxT("next ") : wxT(""),
1195 event
.GetFindString().c_str(),
1196 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1198 else if ( type
== wxEVT_COMMAND_FIND_REPLACE
||
1199 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
)
1201 wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
1202 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
? _T("all ") : wxT(""),
1203 event
.GetFindString().c_str(),
1204 event
.GetReplaceString().c_str(),
1205 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1207 else if ( type
== wxEVT_COMMAND_FIND_CLOSE
)
1209 wxFindReplaceDialog
*dlg
= event
.GetDialog();
1213 if ( dlg
== m_dlgFind
)
1216 idMenu
= DIALOGS_FIND
;
1219 else if ( dlg
== m_dlgReplace
)
1221 txt
= _T("Replace");
1222 idMenu
= DIALOGS_REPLACE
;
1223 m_dlgReplace
= NULL
;
1227 txt
= _T("Unknown");
1230 wxFAIL_MSG( _T("unexpected event") );
1233 wxLogMessage(wxT("%s dialog is being closed."), txt
);
1235 if ( idMenu
!= wxID_ANY
)
1237 GetMenuBar()->Check(idMenu
, false);
1244 wxLogError(wxT("Unknown find dialog event!"));
1248 #endif // wxUSE_FINDREPLDLG
1250 // ----------------------------------------------------------------------------
1252 // ----------------------------------------------------------------------------
1254 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
1257 dc
.SetFont(wxGetApp().m_canvasFont
);
1258 dc
.SetTextForeground(wxGetApp().m_canvasTextColour
);
1259 dc
.SetBackgroundMode(wxTRANSPARENT
);
1261 _T("wxWidgets common dialogs")
1262 #if !defined(__SMARTPHONE__)
1263 _T(" test application")
1268 #if USE_MODAL_PRESENTATION
1270 // ----------------------------------------------------------------------------
1272 // ----------------------------------------------------------------------------
1274 MyModelessDialog::MyModelessDialog(wxWindow
*parent
)
1275 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modeless dialog")))
1277 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
1279 wxButton
*btn
= new wxButton(this, DIALOGS_MODELESS_BTN
, _T("Press me"));
1280 wxCheckBox
*check
= new wxCheckBox(this, wxID_ANY
, _T("Should be disabled"));
1283 sizerTop
->Add(btn
, 1, wxEXPAND
| wxALL
, 5);
1284 sizerTop
->Add(check
, 1, wxEXPAND
| wxALL
, 5);
1288 sizerTop
->SetSizeHints(this);
1289 sizerTop
->Fit(this);
1292 void MyModelessDialog::OnButton(wxCommandEvent
& WXUNUSED(event
))
1294 wxMessageBox(_T("Button pressed in modeless dialog"), _T("Info"),
1295 wxOK
| wxICON_INFORMATION
, this);
1298 void MyModelessDialog::OnClose(wxCloseEvent
& event
)
1300 if ( event
.CanVeto() )
1302 wxMessageBox(_T("Use the menu item to close this dialog"),
1303 _T("Modeless dialog"),
1304 wxOK
| wxICON_INFORMATION
, this);
1310 // ----------------------------------------------------------------------------
1312 // ----------------------------------------------------------------------------
1314 MyModalDialog::MyModalDialog(wxWindow
*parent
)
1315 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modal dialog")))
1317 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
1319 m_btnModal
= new wxButton(this, wxID_ANY
, _T("&Modal dialog..."));
1320 m_btnModeless
= new wxButton(this, wxID_ANY
, _T("Mode&less dialog"));
1321 m_btnDelete
= new wxButton(this, wxID_ANY
, _T("&Delete button"));
1323 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _T("&Close"));
1324 sizerTop
->Add(m_btnModal
, 0, wxALIGN_CENTER
| wxALL
, 5);
1325 sizerTop
->Add(m_btnModeless
, 0, wxALIGN_CENTER
| wxALL
, 5);
1326 sizerTop
->Add(m_btnDelete
, 0, wxALIGN_CENTER
| wxALL
, 5);
1327 sizerTop
->Add(btnOk
, 0, wxALIGN_CENTER
| wxALL
, 5);
1331 sizerTop
->SetSizeHints(this);
1332 sizerTop
->Fit(this);
1334 m_btnModal
->SetFocus();
1335 m_btnModal
->SetDefault();
1338 void MyModalDialog::OnButton(wxCommandEvent
& event
)
1340 if ( event
.GetEventObject() == m_btnDelete
)
1345 m_btnDelete
->Disable();
1347 else if ( event
.GetEventObject() == m_btnModal
)
1350 wxGetTextFromUser(_T("Dummy prompt"),
1351 _T("Modal dialog called from dialog"),
1352 wxEmptyString
, this);
1354 wxMessageBox(_T("Modal dialog called from dialog"));
1355 #endif // wxUSE_TEXTDLG
1357 else if ( event
.GetEventObject() == m_btnModeless
)
1359 (new MyModelessDialog(this))->Show();
1367 #endif // USE_MODAL_PRESENTATION
1369 #if USE_SETTINGS_DIALOG
1370 // ----------------------------------------------------------------------------
1372 // ----------------------------------------------------------------------------
1374 IMPLEMENT_CLASS(SettingsDialog
, wxPropertySheetDialog
)
1376 BEGIN_EVENT_TABLE(SettingsDialog
, wxPropertySheetDialog
)
1379 SettingsDialog::SettingsDialog(wxWindow
* win
)
1381 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
|wxWS_EX_VALIDATE_RECURSIVELY
);
1383 Create(win
, wxID_ANY
, _("Preferences"), wxDefaultPosition
, wxDefaultSize
,
1384 wxDEFAULT_DIALOG_STYLE
1389 CreateButtons(wxOK
|wxCANCEL
|wxHELP
);
1391 wxBookCtrlBase
* notebook
= GetBookCtrl();
1393 wxPanel
* generalSettings
= CreateGeneralSettingsPage(notebook
);
1394 wxPanel
* aestheticSettings
= CreateAestheticSettingsPage(notebook
);
1396 notebook
->AddPage(generalSettings
, _("General"));
1397 notebook
->AddPage(aestheticSettings
, _("Aesthetics"));
1402 wxPanel
* SettingsDialog::CreateGeneralSettingsPage(wxWindow
* parent
)
1404 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1406 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1407 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1411 wxBoxSizer
* itemSizer3
= new wxBoxSizer( wxHORIZONTAL
);
1412 wxCheckBox
* checkBox3
= new wxCheckBox(panel
, ID_LOAD_LAST_PROJECT
, _("&Load last project on startup"), wxDefaultPosition
, wxDefaultSize
);
1413 itemSizer3
->Add(checkBox3
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1414 item0
->Add(itemSizer3
, 0, wxGROW
|wxALL
, 0);
1418 wxString autoSaveLabel
= _("&Auto-save every");
1419 wxString minsLabel
= _("mins");
1421 wxBoxSizer
* itemSizer12
= new wxBoxSizer( wxHORIZONTAL
);
1422 wxCheckBox
* checkBox12
= new wxCheckBox(panel
, ID_AUTO_SAVE
, autoSaveLabel
, wxDefaultPosition
, wxDefaultSize
);
1425 wxSpinCtrl
* spinCtrl12
= new wxSpinCtrl(panel
, ID_AUTO_SAVE_MINS
, wxEmptyString
,
1426 wxDefaultPosition
, wxSize(40, wxDefaultCoord
), wxSP_ARROW_KEYS
, 1, 60, 1);
1429 itemSizer12
->Add(checkBox12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1431 itemSizer12
->Add(spinCtrl12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1433 itemSizer12
->Add(new wxStaticText(panel
, wxID_STATIC
, minsLabel
), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1434 item0
->Add(itemSizer12
, 0, wxGROW
|wxALL
, 0);
1438 wxBoxSizer
* itemSizer8
= new wxBoxSizer( wxHORIZONTAL
);
1439 wxCheckBox
* checkBox6
= new wxCheckBox(panel
, ID_SHOW_TOOLTIPS
, _("Show &tooltips"), wxDefaultPosition
, wxDefaultSize
);
1440 itemSizer8
->Add(checkBox6
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1441 item0
->Add(itemSizer8
, 0, wxGROW
|wxALL
, 0);
1443 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1445 panel
->SetSizer(topSizer
);
1446 topSizer
->Fit(panel
);
1451 wxPanel
* SettingsDialog::CreateAestheticSettingsPage(wxWindow
* parent
)
1453 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1455 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1456 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1458 //// PROJECT OR GLOBAL
1459 wxString globalOrProjectChoices
[2];
1460 globalOrProjectChoices
[0] = _("&New projects");
1461 globalOrProjectChoices
[1] = _("&This project");
1463 wxRadioBox
* projectOrGlobal
= new wxRadioBox(panel
, ID_APPLY_SETTINGS_TO
, _("&Apply settings to:"),
1464 wxDefaultPosition
, wxDefaultSize
, 2, globalOrProjectChoices
);
1465 item0
->Add(projectOrGlobal
, 0, wxGROW
|wxALL
, 5);
1467 projectOrGlobal
->SetSelection(0);
1469 //// BACKGROUND STYLE
1470 wxArrayString backgroundStyleChoices
;
1471 backgroundStyleChoices
.Add(wxT("Colour"));
1472 backgroundStyleChoices
.Add(wxT("Image"));
1473 wxStaticBox
* staticBox3
= new wxStaticBox(panel
, wxID_ANY
, _("Background style:"));
1475 wxBoxSizer
* styleSizer
= new wxStaticBoxSizer( staticBox3
, wxVERTICAL
);
1476 item0
->Add(styleSizer
, 0, wxGROW
|wxALL
, 5);
1478 wxBoxSizer
* itemSizer2
= new wxBoxSizer( wxHORIZONTAL
);
1480 wxChoice
* choice2
= new wxChoice(panel
, ID_BACKGROUND_STYLE
, wxDefaultPosition
, wxDefaultSize
, backgroundStyleChoices
);
1482 itemSizer2
->Add(new wxStaticText(panel
, wxID_ANY
, _("&Window:")), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1483 itemSizer2
->Add(5, 5, 1, wxALL
, 0);
1484 itemSizer2
->Add(choice2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1486 styleSizer
->Add(itemSizer2
, 0, wxGROW
|wxALL
, 5);
1489 //// FONT SIZE SELECTION
1491 wxStaticBox
* staticBox1
= new wxStaticBox(panel
, wxID_ANY
, _("Tile font size:"));
1492 wxBoxSizer
* itemSizer5
= new wxStaticBoxSizer( staticBox1
, wxHORIZONTAL
);
1494 wxSpinCtrl
* spinCtrl
= new wxSpinCtrl(panel
, ID_FONT_SIZE
, wxEmptyString
, wxDefaultPosition
,
1495 wxSize(80, wxDefaultCoord
));
1496 itemSizer5
->Add(spinCtrl
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
1498 item0
->Add(itemSizer5
, 0, wxGROW
|wxLEFT
|wxRIGHT
, 5);
1501 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1502 topSizer
->AddSpacer(5);
1504 panel
->SetSizer(topSizer
);
1505 topSizer
->Fit(panel
);
1510 #endif // USE_SETTINGS_DIALOG