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"
30 #include "wx/colordlg.h"
31 #endif // wxUSE_COLOURDLG
34 #include "wx/choicdlg.h"
35 #endif // wxUSE_CHOICEDLG
37 #if wxUSE_STARTUP_TIPS
38 #include "wx/tipdlg.h"
39 #endif // wxUSE_STARTUP_TIPS
42 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
43 #include <wx/datetime.h> // wxDateTime
46 #include "wx/progdlg.h"
47 #endif // wxUSE_PROGRESSDLG
50 #include "wx/busyinfo.h"
51 #endif // wxUSE_BUSYINFO
54 #include "wx/numdlg.h"
55 #endif // wxUSE_NUMBERDLG
58 #include "wx/filedlg.h"
59 #endif // wxUSE_FILEDLG
62 #include "wx/dirdlg.h"
63 #endif // wxUSE_DIRDLG
66 #include "wx/fontdlg.h"
67 #endif // wxUSE_FONTDLG
70 #include "wx/fdrepdlg.h"
71 #endif // wxUSE_FINDREPLDLG
74 #include "wx/spinctrl.h"
77 #include "wx/propdlg.h"
81 #if USE_COLOURDLG_GENERIC
82 #include "wx/generic/colrdlgg.h"
83 #endif // USE_COLOURDLG_GENERIC
85 #if USE_DIRDLG_GENERIC
86 #include "wx/generic/dirdlgg.h"
87 #endif // USE_DIRDLG_GENERIC
89 #if USE_FILEDLG_GENERIC
90 #include "wx/generic/filedlgg.h"
91 #endif // USE_FILEDLG_GENERIC
93 #if USE_FONTDLG_GENERIC
94 #include "wx/generic/fontdlgg.h"
95 #endif // USE_FONTDLG_GENERIC
99 BEGIN_EVENT_TABLE(MyCanvas
, wxScrolledWindow
)
100 EVT_PAINT(MyCanvas::OnPaint
)
105 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
106 EVT_MENU(DIALOGS_MESSAGE_BOX
, MyFrame::MessageBox
)
109 EVT_MENU(DIALOGS_CHOOSE_COLOUR
, MyFrame::ChooseColour
)
110 #endif // wxUSE_COLOURDLG
113 EVT_MENU(DIALOGS_CHOOSE_FONT
, MyFrame::ChooseFont
)
114 #endif // wxUSE_FONTDLG
117 EVT_MENU(DIALOGS_LOG_DIALOG
, MyFrame::LogDialog
)
118 #endif // wxUSE_LOG_DIALOG
121 EVT_MENU(DIALOGS_TEXT_ENTRY
, MyFrame::TextEntry
)
122 EVT_MENU(DIALOGS_PASSWORD_ENTRY
, MyFrame::PasswordEntry
)
123 #endif // wxUSE_TEXTDLG
126 EVT_MENU(DIALOGS_NUM_ENTRY
, MyFrame::NumericEntry
)
127 #endif // wxUSE_NUMBERDLG
130 EVT_MENU(DIALOGS_SINGLE_CHOICE
, MyFrame::SingleChoice
)
131 EVT_MENU(DIALOGS_MULTI_CHOICE
, MyFrame::MultiChoice
)
132 #endif // wxUSE_CHOICEDLG
135 EVT_MENU(DIALOGS_FILE_OPEN
, MyFrame::FileOpen
)
136 EVT_MENU(DIALOGS_FILE_OPEN2
, MyFrame::FileOpen2
)
137 EVT_MENU(DIALOGS_FILES_OPEN
, MyFrame::FilesOpen
)
138 EVT_MENU(DIALOGS_FILE_SAVE
, MyFrame::FileSave
)
139 #endif // wxUSE_FILEDLG
141 #if USE_FILEDLG_GENERIC
142 EVT_MENU(DIALOGS_FILE_OPEN_GENERIC
, MyFrame::FileOpenGeneric
)
143 EVT_MENU(DIALOGS_FILES_OPEN_GENERIC
, MyFrame::FilesOpenGeneric
)
144 EVT_MENU(DIALOGS_FILE_SAVE_GENERIC
, MyFrame::FileSaveGeneric
)
145 #endif // USE_FILEDLG_GENERIC
148 EVT_MENU(DIALOGS_DIR_CHOOSE
, MyFrame::DirChoose
)
149 EVT_MENU(DIALOGS_DIRNEW_CHOOSE
, MyFrame::DirChooseNew
)
150 #endif // wxUSE_DIRDLG
152 #if USE_MODAL_PRESENTATION
153 EVT_MENU(DIALOGS_MODAL
, MyFrame::ModalDlg
)
154 EVT_MENU(DIALOGS_MODELESS
, MyFrame::ModelessDlg
)
157 #if wxUSE_STARTUP_TIPS
158 EVT_MENU(DIALOGS_TIP
, MyFrame::ShowTip
)
159 #endif // wxUSE_STARTUP_TIPS
161 #if USE_FONTDLG_GENERIC
162 EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC
, MyFrame::ChooseFontGeneric
)
163 #endif // USE_FONTDLG_GENERIC
165 #if USE_DIRDLG_GENERIC
166 EVT_MENU(DIALOGS_GENERIC_DIR_CHOOSE
, MyFrame::GenericDirChoose
)
167 #endif // wxMSW || wxMAC
169 #if USE_COLOURDLG_GENERIC
170 EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC
, MyFrame::ChooseColourGeneric
)
171 #endif // USE_COLOURDLG_GENERIC
173 #if wxUSE_PROGRESSDLG
174 EVT_MENU(DIALOGS_PROGRESS
, MyFrame::ShowProgress
)
175 #endif // wxUSE_PROGRESSDLG
178 EVT_MENU(DIALOGS_BUSYINFO
, MyFrame::ShowBusyInfo
)
179 #endif // wxUSE_BUSYINFO
181 #if wxUSE_FINDREPLDLG
182 EVT_MENU(DIALOGS_FIND
, MyFrame::ShowFindDialog
)
183 EVT_MENU(DIALOGS_REPLACE
, MyFrame::ShowReplaceDialog
)
185 EVT_FIND(wxID_ANY
, MyFrame::OnFindDialog
)
186 EVT_FIND_NEXT(wxID_ANY
, MyFrame::OnFindDialog
)
187 EVT_FIND_REPLACE(wxID_ANY
, MyFrame::OnFindDialog
)
188 EVT_FIND_REPLACE_ALL(wxID_ANY
, MyFrame::OnFindDialog
)
189 EVT_FIND_CLOSE(wxID_ANY
, MyFrame::OnFindDialog
)
190 #endif // wxUSE_FINDREPLDLG
192 #if USE_SETTINGS_DIALOG
193 EVT_MENU(DIALOGS_PROPERTY_SHEET
, MyFrame::OnPropertySheet
)
196 EVT_MENU(DIALOGS_REQUEST
, MyFrame::OnRequestUserAttention
)
198 EVT_MENU(wxID_EXIT
, MyFrame::OnExit
)
201 #if USE_MODAL_PRESENTATION
203 BEGIN_EVENT_TABLE(MyModalDialog
, wxDialog
)
204 EVT_BUTTON(wxID_ANY
, MyModalDialog::OnButton
)
207 BEGIN_EVENT_TABLE(MyModelessDialog
, wxDialog
)
208 EVT_BUTTON(DIALOGS_MODELESS_BTN
, MyModelessDialog::OnButton
)
209 EVT_CLOSE(MyModelessDialog::OnClose
)
212 #endif // USE_MODAL_PRESENTATION
214 MyCanvas
*myCanvas
= (MyCanvas
*) NULL
;
216 // `Main program' equivalent, creating windows and returning main app frame
220 wxInitAllImageHandlers();
223 m_canvasTextColour
= wxColour(_T("BLACK"));
224 m_canvasFont
= *wxNORMAL_FONT
;
226 // Create the main frame window
227 MyFrame
*frame
= new MyFrame((wxFrame
*) NULL
, _T("wxWidgets dialogs example"));
230 wxMenu
*file_menu
= new wxMenu
;
232 file_menu
->Append(DIALOGS_MESSAGE_BOX
, _T("&Message box\tCtrl-M"));
235 #if wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
237 wxMenu
*choices_menu
= new wxMenu
;
240 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR
, _T("&Choose colour"));
241 #endif // wxUSE_COLOURDLG
244 choices_menu
->Append(DIALOGS_CHOOSE_FONT
, _T("Choose &font"));
245 #endif // wxUSE_FONTDLG
248 choices_menu
->Append(DIALOGS_SINGLE_CHOICE
, _T("&Single choice\tCtrl-C"));
249 choices_menu
->Append(DIALOGS_MULTI_CHOICE
, _T("M&ultiple choice\tCtrl-U"));
250 #endif // wxUSE_CHOICEDLG
252 #if USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
253 choices_menu
->AppendSeparator();
254 #endif // USE_COLOURDLG_GENERIC || USE_FONTDLG_GENERIC
256 #if USE_COLOURDLG_GENERIC
257 choices_menu
->Append(DIALOGS_CHOOSE_COLOUR_GENERIC
, _T("&Choose colour (generic)"));
258 #endif // USE_COLOURDLG_GENERIC
260 #if USE_FONTDLG_GENERIC
261 choices_menu
->Append(DIALOGS_CHOOSE_FONT_GENERIC
, _T("Choose &font (generic)"));
262 #endif // USE_FONTDLG_GENERIC
264 file_menu
->Append(wxID_ANY
,_T("&Choices and selectors"),choices_menu
);
265 #endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG
268 #if wxUSE_TEXTDLG || wxUSE_NUMBERDLG
270 wxMenu
*entry_menu
= new wxMenu
;
273 entry_menu
->Append(DIALOGS_TEXT_ENTRY
, _T("Text &entry\tCtrl-E"));
274 entry_menu
->Append(DIALOGS_PASSWORD_ENTRY
, _T("&Password entry\tCtrl-P"));
275 #endif // wxUSE_TEXTDLG
278 entry_menu
->Append(DIALOGS_NUM_ENTRY
, _T("&Numeric entry\tCtrl-N"));
279 #endif // wxUSE_NUMBERDLG
281 file_menu
->Append(wxID_ANY
,_T("&Entry dialogs"),entry_menu
);
283 #endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG
288 wxMenu
*filedlg_menu
= new wxMenu
;
289 filedlg_menu
->Append(DIALOGS_FILE_OPEN
, _T("&Open file\tCtrl-O"));
290 filedlg_menu
->Append(DIALOGS_FILE_OPEN2
, _T("&Second open file\tCtrl-2"));
291 filedlg_menu
->Append(DIALOGS_FILES_OPEN
, _T("Open &files\tCtrl-Q"));
292 filedlg_menu
->Append(DIALOGS_FILE_SAVE
, _T("Sa&ve file\tCtrl-S"));
294 #if USE_FILEDLG_GENERIC
295 filedlg_menu
->AppendSeparator();
296 filedlg_menu
->Append(DIALOGS_FILE_OPEN_GENERIC
, _T("&Open file (generic)"));
297 filedlg_menu
->Append(DIALOGS_FILES_OPEN_GENERIC
, _T("Open &files (generic)"));
298 filedlg_menu
->Append(DIALOGS_FILE_SAVE_GENERIC
, _T("Sa&ve file (generic)"));
299 #endif // USE_FILEDLG_GENERIC
301 file_menu
->Append(wxID_ANY
,_T("&File operations"),filedlg_menu
);
303 #endif // wxUSE_FILEDLG
306 wxMenu
*dir_menu
= new wxMenu
;
308 dir_menu
->Append(DIALOGS_DIR_CHOOSE
, _T("&Choose a directory\tCtrl-D"));
309 dir_menu
->Append(DIALOGS_DIRNEW_CHOOSE
, _T("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"));
310 file_menu
->Append(wxID_ANY
,_T("&Directory operations"),dir_menu
);
312 #if USE_DIRDLG_GENERIC
313 dir_menu
->AppendSeparator();
314 dir_menu
->Append(DIALOGS_GENERIC_DIR_CHOOSE
, _T("&Choose a directory (generic)"));
315 #endif // USE_DIRDLG_GENERIC
317 #endif // wxUSE_DIRDLG
320 #if wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
322 wxMenu
*info_menu
= new wxMenu
;
324 #if wxUSE_STARTUP_TIPS
325 info_menu
->Append(DIALOGS_TIP
, _T("&Tip of the day\tCtrl-T"));
326 #endif // wxUSE_STARTUP_TIPS
328 #if wxUSE_PROGRESSDLG
329 info_menu
->Append(DIALOGS_PROGRESS
, _T("Pro&gress dialog\tCtrl-G"));
330 #endif // wxUSE_PROGRESSDLG
333 info_menu
->Append(DIALOGS_BUSYINFO
, _T("&Busy info dialog\tCtrl-B"));
334 #endif // wxUSE_BUSYINFO
337 info_menu
->Append(DIALOGS_LOG_DIALOG
, _T("&Log dialog\tCtrl-L"));
338 #endif // wxUSE_LOG_DIALOG
340 file_menu
->Append(wxID_ANY
,_T("&Informative dialogs"),info_menu
);
342 #endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG
345 #if wxUSE_FINDREPLDLG
346 wxMenu
*find_menu
= new wxMenu
;
347 find_menu
->AppendCheckItem(DIALOGS_FIND
, _T("&Find dialog\tCtrl-F"));
348 find_menu
->AppendCheckItem(DIALOGS_REPLACE
, _T("Find and &replace dialog\tShift-Ctrl-F"));
349 file_menu
->Append(wxID_ANY
,_T("&Searching"),find_menu
);
350 #endif // wxUSE_FINDREPLDLG
352 #if USE_MODAL_PRESENTATION
353 wxMenu
*modal_menu
= new wxMenu
;
354 modal_menu
->Append(DIALOGS_MODAL
, _T("Mo&dal dialog\tCtrl-W"));
355 modal_menu
->AppendCheckItem(DIALOGS_MODELESS
, _T("Modeless &dialog\tCtrl-Z"));
356 file_menu
->Append(wxID_ANY
,_T("&Modal/Modeless"),modal_menu
);
357 #endif // USE_MODAL_PRESENTATION
359 #if USE_SETTINGS_DIALOG
360 file_menu
->Append(DIALOGS_PROPERTY_SHEET
, _T("&Property Sheet Dialog\tCtrl-P"));
363 file_menu
->Append(DIALOGS_REQUEST
, _T("&Request user attention\tCtrl-R"));
365 file_menu
->AppendSeparator();
366 file_menu
->Append(wxID_EXIT
, _T("E&xit\tAlt-X"));
368 wxMenuBar
*menu_bar
= new wxMenuBar
;
369 menu_bar
->Append(file_menu
, _T("&File"));
370 frame
->SetMenuBar(menu_bar
);
372 myCanvas
= new MyCanvas(frame
);
373 myCanvas
->SetBackgroundColour(*wxWHITE
);
375 frame
->Centre(wxBOTH
);
385 // My frame constructor
386 MyFrame::MyFrame(wxWindow
*parent
,
387 const wxString
& title
)
388 : wxFrame(parent
, wxID_ANY
, title
)
392 #if USE_MODAL_PRESENTATION
393 m_dialog
= (MyModelessDialog
*)NULL
;
394 #endif // USE_MODAL_PRESENTATION
396 #if wxUSE_FINDREPLDLG
402 m_clrData
.SetChooseFull(true);
403 for (int i
= 0; i
< 16; i
++)
405 m_clrData
.SetCustomColour(
408 (unsigned char)(i
*16),
409 (unsigned char)(i
*16),
410 (unsigned char)(i
*16)
414 #endif // wxUSE_COLOURDLG
418 void MyFrame::ChooseColour(wxCommandEvent
& WXUNUSED(event
) )
420 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
422 wxColourDialog
dialog(this, &m_clrData
);
423 dialog
.SetTitle(_T("Choose the background colour"));
424 if (dialog
.ShowModal() == wxID_OK
)
426 m_clrData
= dialog
.GetColourData();
427 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
428 myCanvas
->ClearBackground();
432 #endif // wxUSE_COLOURDLG
434 #if USE_COLOURDLG_GENERIC
435 void MyFrame::ChooseColourGeneric(wxCommandEvent
& WXUNUSED(event
))
437 m_clrData
.SetColour(myCanvas
->GetBackgroundColour());
439 //FIXME:TODO:This has no effect...
440 m_clrData
.SetChooseFull(true);
442 for (int i
= 0; i
< 16; i
++)
445 (unsigned char)(i
*16),
446 (unsigned char)(i
*16),
447 (unsigned char)(i
*16)
449 m_clrData
.SetCustomColour(i
, colour
);
452 wxGenericColourDialog
*dialog
= new wxGenericColourDialog(this, &m_clrData
);
453 if (dialog
->ShowModal() == wxID_OK
)
455 m_clrData
= dialog
->GetColourData();
456 myCanvas
->SetBackgroundColour(m_clrData
.GetColour());
457 myCanvas
->ClearBackground();
462 #endif // USE_COLOURDLG_GENERIC
465 void MyFrame::ChooseFont(wxCommandEvent
& WXUNUSED(event
) )
468 data
.SetInitialFont(wxGetApp().m_canvasFont
);
469 data
.SetColour(wxGetApp().m_canvasTextColour
);
471 // you might also do this:
473 // wxFontDialog dialog;
474 // if ( !dialog.Create(this, data) { ... error ... }
476 wxFontDialog
dialog(this, data
);
478 if (dialog
.ShowModal() == wxID_OK
)
480 wxFontData retData
= dialog
.GetFontData();
481 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
482 wxGetApp().m_canvasTextColour
= retData
.GetColour();
485 //else: cancelled by the user, don't change the font
487 #endif // wxUSE_FONTDLG
489 #if USE_FONTDLG_GENERIC
490 void MyFrame::ChooseFontGeneric(wxCommandEvent
& WXUNUSED(event
) )
493 data
.SetInitialFont(wxGetApp().m_canvasFont
);
494 data
.SetColour(wxGetApp().m_canvasTextColour
);
496 wxGenericFontDialog
*dialog
= new wxGenericFontDialog(this, &data
);
497 if (dialog
->ShowModal() == wxID_OK
)
499 wxFontData retData
= dialog
->GetFontData();
500 wxGetApp().m_canvasFont
= retData
.GetChosenFont();
501 wxGetApp().m_canvasTextColour
= retData
.GetColour();
506 #endif // USE_FONTDLG_GENERIC
509 void MyFrame::LogDialog(wxCommandEvent
& WXUNUSED(event
))
511 // calling wxYield() (as ~wxBusyCursor does) shouldn't result in messages
512 // being flushed -- test it
515 wxLogMessage(wxT("This is some message - everything is ok so far."));
516 wxLogMessage(wxT("Another message...\n... this one is on multiple lines"));
517 wxLogWarning(wxT("And then something went wrong!"));
519 // and if ~wxBusyCursor doesn't do it, then call it manually
523 wxLogError(wxT("Intermediary error handler decided to abort."));
524 wxLogError(wxT("The top level caller detected an unrecoverable error."));
526 wxLog::FlushActive();
528 wxLogMessage(wxT("And this is the same dialog but with only one message."));
530 #endif // wxUSE_LOG_DIALOG
532 void MyFrame::MessageBox(wxCommandEvent
& WXUNUSED(event
) )
534 wxMessageDialog
dialog( NULL
, _T("This is a message box\nA long, long string to test out the message box properly"),
535 _T("Message box text"), wxNO_DEFAULT
|wxYES_NO
|wxCANCEL
|wxICON_INFORMATION
);
537 switch ( dialog
.ShowModal() )
540 wxLogStatus(wxT("You pressed \"Yes\""));
544 wxLogStatus(wxT("You pressed \"No\""));
548 wxLogStatus(wxT("You pressed \"Cancel\""));
552 wxLogError(wxT("Unexpected wxMessageDialog return code!"));
557 void MyFrame::NumericEntry(wxCommandEvent
& WXUNUSED(event
) )
559 long res
= wxGetNumberFromUser( _T("This is some text, actually a lot of text.\n")
560 _T("Even two rows of text."),
561 _T("Enter a number:"), _T("Numeric input test"),
568 msg
= _T("Invalid number entered or dialog cancelled.");
573 msg
.Printf(_T("You've entered %lu"), res
);
574 icon
= wxICON_INFORMATION
;
577 wxMessageBox(msg
, _T("Numeric test result"), wxOK
| icon
, this);
579 #endif // wxUSE_NUMBERDLG
582 void MyFrame::PasswordEntry(wxCommandEvent
& WXUNUSED(event
))
584 wxString pwd
= wxGetPasswordFromUser(_T("Enter password:"),
585 _T("Password entry dialog"),
590 wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd
.c_str()),
591 _T("Got password"), wxOK
| wxICON_INFORMATION
, this);
595 void MyFrame::TextEntry(wxCommandEvent
& WXUNUSED(event
))
597 wxTextEntryDialog
dialog(this,
598 _T("This is a small sample\n")
599 _T("A long, long string to test out the text entrybox"),
600 _T("Please enter a string"),
604 if (dialog
.ShowModal() == wxID_OK
)
606 wxMessageBox(dialog
.GetValue(), _T("Got string"), wxOK
| wxICON_INFORMATION
, this);
609 #endif // wxUSE_TEXTDLG
612 void MyFrame::SingleChoice(wxCommandEvent
& WXUNUSED(event
) )
614 const wxString choices
[] = { _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five") } ;
616 wxSingleChoiceDialog
dialog(this,
617 _T("This is a small sample\n")
618 _T("A single-choice convenience dialog"),
619 _T("Please select a value"),
620 WXSIZEOF(choices
), choices
);
622 dialog
.SetSelection(2);
624 if (dialog
.ShowModal() == wxID_OK
)
626 wxMessageDialog
dialog2(this, dialog
.GetStringSelection(), _T("Got string"));
631 void MyFrame::MultiChoice(wxCommandEvent
& WXUNUSED(event
) )
633 const wxString choices
[] =
635 _T("One"), _T("Two"), _T("Three"), _T("Four"), _T("Five"),
636 _T("Six"), _T("Seven"), _T("Eight"), _T("Nine"), _T("Ten"),
637 _T("Eleven"), _T("Twelve"), _T("Seventeen"),
640 wxArrayInt selections
;
641 size_t count
= wxGetMultipleChoices(selections
,
642 _T("This is a small sample\n")
643 _T("A multi-choice convenience dialog"),
644 _T("Please select a value"),
645 WXSIZEOF(choices
), choices
,
650 msg
.Printf(wxT("You selected %u items:\n"), (unsigned)count
);
651 for ( size_t n
= 0; n
< count
; n
++ )
653 msg
+= wxString::Format(wxT("\t%u: %u (%s)\n"),
654 (unsigned)n
, (unsigned)selections
[n
],
655 choices
[selections
[n
]].c_str());
659 //else: cancelled or nothing selected
661 #endif // wxUSE_CHOICEDLG
664 void MyFrame::FileOpen(wxCommandEvent
& WXUNUSED(event
) )
669 _T("Testing open file dialog"),
673 _T("C++ files (*.cpp)|*.cpp")
675 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
679 dialog
.SetDirectory(wxGetHomeDir());
680 dialog
.CentreOnParent();
682 if (dialog
.ShowModal() == wxID_OK
)
685 info
.Printf(_T("Full file name: %s\n")
688 dialog
.GetPath().c_str(),
689 dialog
.GetDirectory().c_str(),
690 dialog
.GetFilename().c_str());
691 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
696 // this shows how to take advantage of specifying a default extension in the
697 // call to wxFileSelector: it is remembered after each new call and the next
698 // one will use it by default
699 void MyFrame::FileOpen2(wxCommandEvent
& WXUNUSED(event
) )
701 static wxString s_extDef
;
702 wxString path
= wxFileSelector(
703 _T("Select the file to load"),
704 wxEmptyString
, wxEmptyString
,
708 _T("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"),
709 wxFileSelectorDefaultWildcardStr
,
710 wxFileSelectorDefaultWildcardStr
719 // it is just a sample, would use wxSplitPath in real program
720 s_extDef
= path
.AfterLast(_T('.'));
722 wxLogMessage(_T("You selected the file '%s', remembered extension '%s'"),
723 (const wxChar
*) path
, (const wxChar
*) s_extDef
);
726 void MyFrame::FilesOpen(wxCommandEvent
& WXUNUSED(event
) )
730 _T("C++ files (*.cpp)|*.cpp");
734 _T("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"),
735 wxFileSelectorDefaultWildcardStr
,
736 wxFileSelectorDefaultWildcardStr
739 wxFileDialog
dialog(this, _T("Testing open multiple file dialog"),
740 wxEmptyString
, wxEmptyString
, wildcards
,
743 if (dialog
.ShowModal() == wxID_OK
)
745 wxArrayString paths
, filenames
;
747 dialog
.GetPaths(paths
);
748 dialog
.GetFilenames(filenames
);
751 size_t count
= paths
.GetCount();
752 for ( size_t n
= 0; n
< count
; n
++ )
754 s
.Printf(_T("File %d: %s (%s)\n"),
755 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
759 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
762 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
767 void MyFrame::FileSave(wxCommandEvent
& WXUNUSED(event
) )
769 wxFileDialog
dialog(this,
770 _T("Testing save file dialog"),
773 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
774 wxSAVE
|wxOVERWRITE_PROMPT
);
776 dialog
.SetFilterIndex(1);
778 if (dialog
.ShowModal() == wxID_OK
)
780 wxLogMessage(_T("%s, filter %d"),
781 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
784 #endif // wxUSE_FILEDLG
786 #if USE_FILEDLG_GENERIC
787 void MyFrame::FileOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
789 wxGenericFileDialog dialog
792 _T("Testing open file dialog"),
795 _T("C++ files (*.cpp;*.h)|*.cpp;*.h")
798 dialog
.SetDirectory(wxGetHomeDir());
800 if (dialog
.ShowModal() == wxID_OK
)
803 info
.Printf(_T("Full file name: %s\n")
806 dialog
.GetPath().c_str(),
807 dialog
.GetDirectory().c_str(),
808 dialog
.GetFilename().c_str());
809 wxMessageDialog
dialog2(this, info
, _T("Selected file"));
814 void MyFrame::FilesOpenGeneric(wxCommandEvent
& WXUNUSED(event
) )
816 wxString wildcards
= _T("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h");
817 wxGenericFileDialog
dialog(this, _T("Testing open multiple file dialog"),
818 wxEmptyString
, wxEmptyString
, wildcards
,
821 if (dialog
.ShowModal() == wxID_OK
)
823 wxArrayString paths
, filenames
;
825 dialog
.GetPaths(paths
);
826 dialog
.GetFilenames(filenames
);
829 size_t count
= paths
.GetCount();
830 for ( size_t n
= 0; n
< count
; n
++ )
832 s
.Printf(_T("File %d: %s (%s)\n"),
833 (int)n
, paths
[n
].c_str(), filenames
[n
].c_str());
837 s
.Printf(_T("Filter index: %d"), dialog
.GetFilterIndex());
840 wxMessageDialog
dialog2(this, msg
, _T("Selected files"));
845 void MyFrame::FileSaveGeneric(wxCommandEvent
& WXUNUSED(event
) )
847 wxGenericFileDialog
dialog(this,
848 _T("Testing save file dialog"),
851 _T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
852 wxSAVE
|wxOVERWRITE_PROMPT
);
854 dialog
.SetFilterIndex(1);
856 if (dialog
.ShowModal() == wxID_OK
)
858 wxLogMessage(_T("%s, filter %d"),
859 dialog
.GetPath().c_str(), dialog
.GetFilterIndex());
862 #endif // USE_FILEDLG_GENERIC
865 void MyFrame::DoDirChoose(int style
)
867 // pass some initial dir to wxDirDialog
869 wxGetHomeDir(&dirHome
);
871 wxDirDialog
dialog(this, _T("Testing directory picker"), dirHome
, style
);
873 if (dialog
.ShowModal() == wxID_OK
)
875 wxLogMessage(_T("Selected path: %s"), dialog
.GetPath().c_str());
879 void MyFrame::DirChoose(wxCommandEvent
& WXUNUSED(event
) )
881 DoDirChoose(wxDD_DEFAULT_STYLE
& ~wxDD_NEW_DIR_BUTTON
);
884 void MyFrame::DirChooseNew(wxCommandEvent
& WXUNUSED(event
) )
886 DoDirChoose(wxDD_DEFAULT_STYLE
| wxDD_NEW_DIR_BUTTON
);
888 #endif // wxUSE_DIRDLG
890 #if USE_DIRDLG_GENERIC
891 void MyFrame::GenericDirChoose(wxCommandEvent
& WXUNUSED(event
) )
893 // pass some initial dir to wxDirDialog
895 wxGetHomeDir(&dirHome
);
897 wxGenericDirDialog
dialog(this, _T("Testing generic directory picker"), dirHome
);
899 if (dialog
.ShowModal() == wxID_OK
)
901 wxMessageDialog
dialog2(this, dialog
.GetPath(), _T("Selected path"));
905 #endif // USE_DIRDLG_GENERIC
907 #if USE_MODAL_PRESENTATION
908 void MyFrame::ModalDlg(wxCommandEvent
& WXUNUSED(event
))
910 MyModalDialog
dlg(this);
914 void MyFrame::ModelessDlg(wxCommandEvent
& event
)
916 bool show
= GetMenuBar()->IsChecked(event
.GetId());
922 m_dialog
= new MyModelessDialog(this);
925 m_dialog
->Show(true);
929 // If m_dialog is NULL, then possibly the system
930 // didn't report the checked menu item status correctly.
931 // It should be true just after the menu item was selected,
932 // if there was no modeless dialog yet.
934 wxASSERT( m_dialog
!= NULL
);
939 #endif // USE_MODAL_PRESENTATION
941 #if wxUSE_STARTUP_TIPS
942 void MyFrame::ShowTip(wxCommandEvent
& WXUNUSED(event
))
944 static size_t s_index
= (size_t)-1;
946 if ( s_index
== (size_t)-1 )
950 // this is completely bogus, we don't know how many lines are there
951 // in the file, but who cares, it's a demo only...
952 s_index
= rand() % 5;
955 wxTipProvider
*tipProvider
= wxCreateFileTipProvider(_T("tips.txt"), s_index
);
957 bool showAtStartup
= wxShowTip(this, tipProvider
);
961 wxMessageBox(_T("Will show tips on startup"), _T("Tips dialog"),
962 wxOK
| wxICON_INFORMATION
, this);
965 s_index
= tipProvider
->GetCurrentTip();
968 #endif // wxUSE_STARTUP_TIPS
970 #if USE_SETTINGS_DIALOG
971 void MyFrame::OnPropertySheet(wxCommandEvent
& WXUNUSED(event
))
973 SettingsDialog
dialog(this);
976 #endif // USE_SETTINGS_DIALOG
978 void MyFrame::OnRequestUserAttention(wxCommandEvent
& WXUNUSED(event
))
980 wxLogStatus(_T("Sleeping for 3 seconds to allow you to switch to another window"));
984 RequestUserAttention(wxUSER_ATTENTION_ERROR
);
987 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
) )
992 #if wxUSE_PROGRESSDLG
994 void MyFrame::ShowProgress( wxCommandEvent
& WXUNUSED(event
) )
996 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
997 // check the performance
998 int countrandomnumbers
= 0, count
= 0;
999 wxTimeSpan
tsTest(0,0,0,250);
1000 wxDateTime DT2
, DT1
= wxDateTime::UNow();
1005 ++countrandomnumbers
;
1006 if ( countrandomnumbers
== 1000 )
1009 countrandomnumbers
= 0;
1011 DT2
= wxDateTime::UNow();
1012 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1013 if ( ts
.IsLongerThan( tsTest
) )
1019 const int max
= 40 * count
;
1021 static const int max
= 10;
1022 #endif // wxUSE_STOPWATCH && wxUSE_LONGLONG
1024 wxProgressDialog
dialog(_T("Progress dialog example"),
1025 _T("An informative message"),
1031 // wxPD_AUTO_HIDE | -- try this as well
1033 wxPD_ESTIMATED_TIME
|
1034 wxPD_REMAINING_TIME
|
1039 // each skip will move progress about quarter forward
1040 for ( int i
= 0; i
<= max
; i
= wxMin(i
+(skip
?int(max
/4):1), max
+1), skip
= false )
1042 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1043 // do (almost) the same operations as we did for the performance test
1045 for ( int j
= 0; j
< 1000; j
++ )
1050 DT2
= wxDateTime::UNow();
1051 wxTimeSpan ts
= DT2
.Subtract( DT1
);
1052 if ( ts
.IsLongerThan( tsTest
) )
1066 msg
= _T("That's all, folks!");
1068 else if ( i
> max
/ 2 )
1070 msg
= _T("Only a half left (very long message)!");
1073 #if wxUSE_STOPWATCH && wxUSE_LONGLONG
1074 if ( (i
% (max
/100)) == 0 ) // // only 100 updates, this makes it much faster
1076 cont
= dialog
.Update(i
, msg
, &skip
);
1079 cont
= dialog
.Update(i
, msg
, &skip
);
1084 if ( wxMessageBox(_T("Do you really want to cancel?"),
1085 _T("Progress dialog question"), // caption
1086 wxYES_NO
| wxICON_QUESTION
) == wxYES
)
1096 wxLogStatus(wxT("Progress dialog aborted!"));
1100 wxLogStatus(wxT("Countdown from %d finished"), max
);
1104 #endif // wxUSE_PROGRESSDLG
1108 void MyFrame::ShowBusyInfo(wxCommandEvent
& WXUNUSED(event
))
1110 wxWindowDisabler disableAll
;
1112 wxBusyInfo
info(_T("Working, please wait..."), this);
1114 for ( int i
= 0; i
< 18; i
++ )
1124 #endif // wxUSE_BUSYINFO
1126 #if wxUSE_FINDREPLDLG
1128 void MyFrame::ShowReplaceDialog( wxCommandEvent
& WXUNUSED(event
) )
1132 delete m_dlgReplace
;
1133 m_dlgReplace
= NULL
;
1137 m_dlgReplace
= new wxFindReplaceDialog
1141 _T("Find and replace dialog"),
1145 m_dlgReplace
->Show(true);
1149 void MyFrame::ShowFindDialog( wxCommandEvent
& WXUNUSED(event
) )
1158 m_dlgFind
= new wxFindReplaceDialog
1167 m_dlgFind
->Show(true);
1171 static wxString
DecodeFindDialogEventFlags(int flags
)
1174 str
<< (flags
& wxFR_DOWN
? _T("down") : _T("up")) << _T(", ")
1175 << (flags
& wxFR_WHOLEWORD
? _T("whole words only, ") : _T(""))
1176 << (flags
& wxFR_MATCHCASE
? _T("") : _T("not "))
1177 << _T("case sensitive");
1182 void MyFrame::OnFindDialog(wxFindDialogEvent
& event
)
1184 wxEventType type
= event
.GetEventType();
1186 if ( type
== wxEVT_COMMAND_FIND
|| type
== wxEVT_COMMAND_FIND_NEXT
)
1188 wxLogMessage(wxT("Find %s'%s' (flags: %s)"),
1189 type
== wxEVT_COMMAND_FIND_NEXT
? wxT("next ") : wxT(""),
1190 event
.GetFindString().c_str(),
1191 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1193 else if ( type
== wxEVT_COMMAND_FIND_REPLACE
||
1194 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
)
1196 wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"),
1197 type
== wxEVT_COMMAND_FIND_REPLACE_ALL
? _T("all ") : wxT(""),
1198 event
.GetFindString().c_str(),
1199 event
.GetReplaceString().c_str(),
1200 DecodeFindDialogEventFlags(event
.GetFlags()).c_str());
1202 else if ( type
== wxEVT_COMMAND_FIND_CLOSE
)
1204 wxFindReplaceDialog
*dlg
= event
.GetDialog();
1208 if ( dlg
== m_dlgFind
)
1211 idMenu
= DIALOGS_FIND
;
1214 else if ( dlg
== m_dlgReplace
)
1216 txt
= _T("Replace");
1217 idMenu
= DIALOGS_REPLACE
;
1218 m_dlgReplace
= NULL
;
1222 txt
= _T("Unknown");
1225 wxFAIL_MSG( _T("unexpected event") );
1228 wxLogMessage(wxT("%s dialog is being closed."), txt
);
1230 if ( idMenu
!= wxID_ANY
)
1232 GetMenuBar()->Check(idMenu
, false);
1239 wxLogError(wxT("Unknown find dialog event!"));
1243 #endif // wxUSE_FINDREPLDLG
1245 // ----------------------------------------------------------------------------
1247 // ----------------------------------------------------------------------------
1249 void MyCanvas::OnPaint(wxPaintEvent
& WXUNUSED(event
) )
1252 dc
.SetFont(wxGetApp().m_canvasFont
);
1253 dc
.SetTextForeground(wxGetApp().m_canvasTextColour
);
1254 dc
.SetBackgroundMode(wxTRANSPARENT
);
1256 _T("wxWidgets common dialogs")
1257 #if !defined(__SMARTPHONE__)
1258 _T(" test application")
1263 #if USE_MODAL_PRESENTATION
1265 // ----------------------------------------------------------------------------
1267 // ----------------------------------------------------------------------------
1269 MyModelessDialog::MyModelessDialog(wxWindow
*parent
)
1270 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modeless dialog")))
1272 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
1274 wxButton
*btn
= new wxButton(this, DIALOGS_MODELESS_BTN
, _T("Press me"));
1275 wxCheckBox
*check
= new wxCheckBox(this, wxID_ANY
, _T("Should be disabled"));
1278 sizerTop
->Add(btn
, 1, wxEXPAND
| wxALL
, 5);
1279 sizerTop
->Add(check
, 1, wxEXPAND
| wxALL
, 5);
1283 sizerTop
->SetSizeHints(this);
1284 sizerTop
->Fit(this);
1287 void MyModelessDialog::OnButton(wxCommandEvent
& WXUNUSED(event
))
1289 wxMessageBox(_T("Button pressed in modeless dialog"), _T("Info"),
1290 wxOK
| wxICON_INFORMATION
, this);
1293 void MyModelessDialog::OnClose(wxCloseEvent
& event
)
1295 if ( event
.CanVeto() )
1297 wxMessageBox(_T("Use the menu item to close this dialog"),
1298 _T("Modeless dialog"),
1299 wxOK
| wxICON_INFORMATION
, this);
1305 // ----------------------------------------------------------------------------
1307 // ----------------------------------------------------------------------------
1309 MyModalDialog::MyModalDialog(wxWindow
*parent
)
1310 : wxDialog(parent
, wxID_ANY
, wxString(_T("Modal dialog")))
1312 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
1314 m_btnModal
= new wxButton(this, wxID_ANY
, _T("&Modal dialog..."));
1315 m_btnModeless
= new wxButton(this, wxID_ANY
, _T("Mode&less dialog"));
1316 m_btnDelete
= new wxButton(this, wxID_ANY
, _T("&Delete button"));
1318 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _T("&Close"));
1319 sizerTop
->Add(m_btnModal
, 0, wxALIGN_CENTER
| wxALL
, 5);
1320 sizerTop
->Add(m_btnModeless
, 0, wxALIGN_CENTER
| wxALL
, 5);
1321 sizerTop
->Add(m_btnDelete
, 0, wxALIGN_CENTER
| wxALL
, 5);
1322 sizerTop
->Add(btnOk
, 0, wxALIGN_CENTER
| wxALL
, 5);
1326 sizerTop
->SetSizeHints(this);
1327 sizerTop
->Fit(this);
1329 m_btnModal
->SetFocus();
1330 m_btnModal
->SetDefault();
1333 void MyModalDialog::OnButton(wxCommandEvent
& event
)
1335 if ( event
.GetEventObject() == m_btnDelete
)
1340 m_btnDelete
->Disable();
1342 else if ( event
.GetEventObject() == m_btnModal
)
1345 wxGetTextFromUser(_T("Dummy prompt"),
1346 _T("Modal dialog called from dialog"),
1347 wxEmptyString
, this);
1349 wxMessageBox(_T("Modal dialog called from dialog"));
1350 #endif // wxUSE_TEXTDLG
1352 else if ( event
.GetEventObject() == m_btnModeless
)
1354 (new MyModelessDialog(this))->Show();
1362 #endif // USE_MODAL_PRESENTATION
1364 #if USE_SETTINGS_DIALOG
1365 // ----------------------------------------------------------------------------
1367 // ----------------------------------------------------------------------------
1369 IMPLEMENT_CLASS(SettingsDialog
, wxPropertySheetDialog
)
1371 BEGIN_EVENT_TABLE(SettingsDialog
, wxPropertySheetDialog
)
1374 SettingsDialog::SettingsDialog(wxWindow
* win
)
1376 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
|wxWS_EX_VALIDATE_RECURSIVELY
);
1378 Create(win
, wxID_ANY
, _("Preferences"), wxDefaultPosition
, wxDefaultSize
,
1379 wxDEFAULT_DIALOG_STYLE
1384 CreateButtons(wxOK
|wxCANCEL
|wxHELP
);
1386 wxBookCtrlBase
* notebook
= GetBookCtrl();
1388 wxPanel
* generalSettings
= CreateGeneralSettingsPage(notebook
);
1389 wxPanel
* aestheticSettings
= CreateAestheticSettingsPage(notebook
);
1391 notebook
->AddPage(generalSettings
, _("General"));
1392 notebook
->AddPage(aestheticSettings
, _("Aesthetics"));
1397 wxPanel
* SettingsDialog::CreateGeneralSettingsPage(wxWindow
* parent
)
1399 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1401 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1402 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1406 wxBoxSizer
* itemSizer3
= new wxBoxSizer( wxHORIZONTAL
);
1407 wxCheckBox
* checkBox3
= new wxCheckBox(panel
, ID_LOAD_LAST_PROJECT
, _("&Load last project on startup"), wxDefaultPosition
, wxDefaultSize
);
1408 itemSizer3
->Add(checkBox3
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1409 item0
->Add(itemSizer3
, 0, wxGROW
|wxALL
, 0);
1413 wxString autoSaveLabel
= _("&Auto-save every");
1414 wxString minsLabel
= _("mins");
1416 wxBoxSizer
* itemSizer12
= new wxBoxSizer( wxHORIZONTAL
);
1417 wxCheckBox
* checkBox12
= new wxCheckBox(panel
, ID_AUTO_SAVE
, autoSaveLabel
, wxDefaultPosition
, wxDefaultSize
);
1420 wxSpinCtrl
* spinCtrl12
= new wxSpinCtrl(panel
, ID_AUTO_SAVE_MINS
, wxEmptyString
,
1421 wxDefaultPosition
, wxSize(40, wxDefaultCoord
), wxSP_ARROW_KEYS
, 1, 60, 1);
1424 itemSizer12
->Add(checkBox12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1426 itemSizer12
->Add(spinCtrl12
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1428 itemSizer12
->Add(new wxStaticText(panel
, wxID_STATIC
, minsLabel
), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1429 item0
->Add(itemSizer12
, 0, wxGROW
|wxALL
, 0);
1433 wxBoxSizer
* itemSizer8
= new wxBoxSizer( wxHORIZONTAL
);
1434 wxCheckBox
* checkBox6
= new wxCheckBox(panel
, ID_SHOW_TOOLTIPS
, _("Show &tooltips"), wxDefaultPosition
, wxDefaultSize
);
1435 itemSizer8
->Add(checkBox6
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1436 item0
->Add(itemSizer8
, 0, wxGROW
|wxALL
, 0);
1438 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1440 panel
->SetSizer(topSizer
);
1441 topSizer
->Fit(panel
);
1446 wxPanel
* SettingsDialog::CreateAestheticSettingsPage(wxWindow
* parent
)
1448 wxPanel
* panel
= new wxPanel(parent
, wxID_ANY
);
1450 wxBoxSizer
*topSizer
= new wxBoxSizer( wxVERTICAL
);
1451 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
1453 //// PROJECT OR GLOBAL
1454 wxString globalOrProjectChoices
[2];
1455 globalOrProjectChoices
[0] = _("&New projects");
1456 globalOrProjectChoices
[1] = _("&This project");
1458 wxRadioBox
* projectOrGlobal
= new wxRadioBox(panel
, ID_APPLY_SETTINGS_TO
, _("&Apply settings to:"),
1459 wxDefaultPosition
, wxDefaultSize
, 2, globalOrProjectChoices
);
1460 item0
->Add(projectOrGlobal
, 0, wxGROW
|wxALL
, 5);
1462 projectOrGlobal
->SetSelection(0);
1464 //// BACKGROUND STYLE
1465 wxArrayString backgroundStyleChoices
;
1466 backgroundStyleChoices
.Add(wxT("Colour"));
1467 backgroundStyleChoices
.Add(wxT("Image"));
1468 wxStaticBox
* staticBox3
= new wxStaticBox(panel
, wxID_ANY
, _("Background style:"));
1470 wxBoxSizer
* styleSizer
= new wxStaticBoxSizer( staticBox3
, wxVERTICAL
);
1471 item0
->Add(styleSizer
, 0, wxGROW
|wxALL
, 5);
1473 wxBoxSizer
* itemSizer2
= new wxBoxSizer( wxHORIZONTAL
);
1475 wxChoice
* choice2
= new wxChoice(panel
, ID_BACKGROUND_STYLE
, wxDefaultPosition
, wxDefaultSize
, backgroundStyleChoices
);
1477 itemSizer2
->Add(new wxStaticText(panel
, wxID_ANY
, _("&Window:")), 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1478 itemSizer2
->Add(5, 5, 1, wxALL
, 0);
1479 itemSizer2
->Add(choice2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
, 5);
1481 styleSizer
->Add(itemSizer2
, 0, wxGROW
|wxALL
, 5);
1484 //// FONT SIZE SELECTION
1486 wxStaticBox
* staticBox1
= new wxStaticBox(panel
, wxID_ANY
, _("Tile font size:"));
1487 wxBoxSizer
* itemSizer5
= new wxStaticBoxSizer( staticBox1
, wxHORIZONTAL
);
1489 wxSpinCtrl
* spinCtrl
= new wxSpinCtrl(panel
, ID_FONT_SIZE
, wxEmptyString
, wxDefaultPosition
,
1490 wxSize(80, wxDefaultCoord
));
1491 itemSizer5
->Add(spinCtrl
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
1493 item0
->Add(itemSizer5
, 0, wxGROW
|wxLEFT
|wxRIGHT
, 5);
1496 topSizer
->Add( item0
, 1, wxGROW
|wxALIGN_CENTRE
|wxALL
, 5 );
1497 topSizer
->AddSpacer(5);
1499 panel
->SetSizer(topSizer
);
1500 topSizer
->Fit(panel
);
1505 #endif // USE_SETTINGS_DIALOG