From 6bd9bd18ec819119674b5b7968f97d2c8c5c5bba Mon Sep 17 00:00:00 2001 From: Blake-Eryx Date: Mon, 27 Aug 2018 02:14:10 +0200 Subject: [PATCH] Remove wxT() and _() macros from dialogs sample Make the code more readable by removing the unnecessary macros. Closes https://github.com/wxWidgets/wxWidgets/pull/888 --- samples/dialogs/dialogs.cpp | 512 ++++++++++++++++++------------------ 1 file changed, 255 insertions(+), 257 deletions(-) diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 73277ab1f3..d035991787 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -383,16 +383,16 @@ bool MyApp::OnInit() #endif // Create the main frame window - MyFrame *frame = new MyFrame(wxT("wxWidgets dialogs example")); + MyFrame *frame = new MyFrame("wxWidgets dialogs example"); // Make a menubar wxMenu *menuDlg = new wxMenu; - menuDlg->Append(DIALOGS_MESSAGE_BOX, wxT("&Message box\tCtrl-M")); - menuDlg->Append(DIALOGS_MESSAGE_BOX_WINDOW_MODAL, wxT("Window-Modal Message box ")); - menuDlg->Append(DIALOGS_MESSAGE_DIALOG, wxT("Message dialog\tShift-Ctrl-M")); + menuDlg->Append(DIALOGS_MESSAGE_BOX, "&Message box\tCtrl-M"); + menuDlg->Append(DIALOGS_MESSAGE_BOX_WINDOW_MODAL, "Window-Modal Message box "); + menuDlg->Append(DIALOGS_MESSAGE_DIALOG, "Message dialog\tShift-Ctrl-M"); #if wxUSE_RICHMSGDLG - menuDlg->Append(DIALOGS_RICH_MESSAGE_DIALOG, wxT("Rich message dialog")); + menuDlg->Append(DIALOGS_RICH_MESSAGE_DIALOG, "Rich message dialog"); #endif // wxUSE_RICHMSGDLG @@ -402,23 +402,23 @@ bool MyApp::OnInit() #if wxUSE_COLOURDLG wxMenu *choices_bg_colour = new wxMenu; - choices_bg_colour->Append(DIALOGS_CHOOSE_COLOUR, wxT("&No opacity")); - choices_bg_colour->Append(DIALOGS_CHOOSE_COLOUR_ALPHA, wxT("&With opacity")); - choices_menu->Append(wxID_ANY, wxT("&Choose bg colour"), choices_bg_colour); - choices_menu->Append(DIALOGS_GET_COLOUR, wxT("&Choose fg colour")); + choices_bg_colour->Append(DIALOGS_CHOOSE_COLOUR, "&No opacity"); + choices_bg_colour->Append(DIALOGS_CHOOSE_COLOUR_ALPHA, "&With opacity"); + choices_menu->Append(wxID_ANY, "&Choose bg colour", choices_bg_colour); + choices_menu->Append(DIALOGS_GET_COLOUR, "&Choose fg colour"); #endif // wxUSE_COLOURDLG #if wxUSE_FONTDLG - choices_menu->Append(DIALOGS_CHOOSE_FONT, wxT("Choose &font")); + choices_menu->Append(DIALOGS_CHOOSE_FONT, "Choose &font"); #endif // wxUSE_FONTDLG #if wxUSE_CHOICEDLG - choices_menu->Append(DIALOGS_SINGLE_CHOICE, wxT("&Single choice\tCtrl-C")); - choices_menu->Append(DIALOGS_MULTI_CHOICE, wxT("M&ultiple choice\tCtrl-U")); + choices_menu->Append(DIALOGS_SINGLE_CHOICE, "&Single choice\tCtrl-C"); + choices_menu->Append(DIALOGS_MULTI_CHOICE, "M&ultiple choice\tCtrl-U"); #endif // wxUSE_CHOICEDLG #if wxUSE_REARRANGECTRL - choices_menu->Append(DIALOGS_REARRANGE, wxT("&Rearrange dialog\tCtrl-R")); + choices_menu->Append(DIALOGS_REARRANGE, "&Rearrange dialog\tCtrl-R"); #endif // wxUSE_REARRANGECTRL #if wxUSE_ADDREMOVECTRL @@ -431,16 +431,16 @@ bool MyApp::OnInit() #if USE_COLOURDLG_GENERIC wxMenu *colourGeneric_menu = new wxMenu; - colourGeneric_menu->Append(DIALOGS_CHOOSE_COLOUR_GENERIC, wxT("&No opacity")); - colourGeneric_menu->Append(DIALOGS_CHOOSE_COLOUR_GENERIC_ALPHA, wxT("&With opacity")); - choices_menu->Append(wxID_ANY, wxT("&Choose colour (generic)"), colourGeneric_menu); + colourGeneric_menu->Append(DIALOGS_CHOOSE_COLOUR_GENERIC, "&No opacity"); + colourGeneric_menu->Append(DIALOGS_CHOOSE_COLOUR_GENERIC_ALPHA, "&With opacity"); + choices_menu->Append(wxID_ANY, "&Choose colour (generic)", colourGeneric_menu); #endif // USE_COLOURDLG_GENERIC #if USE_FONTDLG_GENERIC - choices_menu->Append(DIALOGS_CHOOSE_FONT_GENERIC, wxT("Choose &font (generic)")); + choices_menu->Append(DIALOGS_CHOOSE_FONT_GENERIC, "Choose &font (generic)"); #endif // USE_FONTDLG_GENERIC - menuDlg->Append(wxID_ANY,wxT("&Choices and selectors"),choices_menu); + menuDlg->Append(wxID_ANY,"&Choices and selectors",choices_menu); #endif // wxUSE_COLOURDLG || wxUSE_FONTDLG || wxUSE_CHOICEDLG @@ -449,16 +449,16 @@ bool MyApp::OnInit() wxMenu *entry_menu = new wxMenu; #if wxUSE_TEXTDLG - entry_menu->Append(DIALOGS_LINE_ENTRY, wxT("Single line &entry\tCtrl-E")); - entry_menu->Append(DIALOGS_TEXT_ENTRY, wxT("Multi line text &entry\tShift-Ctrl-E")); - entry_menu->Append(DIALOGS_PASSWORD_ENTRY, wxT("&Password entry\tCtrl-P")); + entry_menu->Append(DIALOGS_LINE_ENTRY, "Single line &entry\tCtrl-E"); + entry_menu->Append(DIALOGS_TEXT_ENTRY, "Multi line text &entry\tShift-Ctrl-E"); + entry_menu->Append(DIALOGS_PASSWORD_ENTRY, "&Password entry\tCtrl-P"); #endif // wxUSE_TEXTDLG #if wxUSE_NUMBERDLG - entry_menu->Append(DIALOGS_NUM_ENTRY, wxT("&Numeric entry\tCtrl-N")); + entry_menu->Append(DIALOGS_NUM_ENTRY, "&Numeric entry\tCtrl-N"); #endif // wxUSE_NUMBERDLG - menuDlg->Append(wxID_ANY,wxT("&Entry dialogs"),entry_menu); + menuDlg->Append(wxID_ANY,"&Entry dialogs",entry_menu); #endif // wxUSE_TEXTDLG || wxUSE_NUMBERDLG @@ -466,32 +466,32 @@ bool MyApp::OnInit() #if wxUSE_FILEDLG wxMenu *filedlg_menu = new wxMenu; - filedlg_menu->Append(DIALOGS_FILE_OPEN, wxT("&Open file\tCtrl-O")); - filedlg_menu->Append(DIALOGS_FILE_OPEN2, wxT("&Second open file\tCtrl-2")); - filedlg_menu->Append(DIALOGS_FILES_OPEN, wxT("Open &files\tShift-Ctrl-O")); - filedlg_menu->Append(DIALOGS_FILE_SAVE, wxT("Sa&ve file\tCtrl-S")); + filedlg_menu->Append(DIALOGS_FILE_OPEN, "&Open file\tCtrl-O"); + filedlg_menu->Append(DIALOGS_FILE_OPEN2, "&Second open file\tCtrl-2"); + filedlg_menu->Append(DIALOGS_FILES_OPEN, "Open &files\tShift-Ctrl-O"); + filedlg_menu->Append(DIALOGS_FILE_SAVE, "Sa&ve file\tCtrl-S"); #if USE_FILEDLG_GENERIC filedlg_menu->AppendSeparator(); - filedlg_menu->Append(DIALOGS_FILE_OPEN_GENERIC, wxT("&Open file (generic)")); - filedlg_menu->Append(DIALOGS_FILES_OPEN_GENERIC, wxT("Open &files (generic)")); - filedlg_menu->Append(DIALOGS_FILE_SAVE_GENERIC, wxT("Sa&ve file (generic)")); + filedlg_menu->Append(DIALOGS_FILE_OPEN_GENERIC, "&Open file (generic)"); + filedlg_menu->Append(DIALOGS_FILES_OPEN_GENERIC, "Open &files (generic)"); + filedlg_menu->Append(DIALOGS_FILE_SAVE_GENERIC, "Sa&ve file (generic)"); #endif // USE_FILEDLG_GENERIC - menuDlg->Append(wxID_ANY,wxT("&File operations"),filedlg_menu); + menuDlg->Append(wxID_ANY,"&File operations",filedlg_menu); #endif // wxUSE_FILEDLG #if wxUSE_DIRDLG wxMenu *dir_menu = new wxMenu; - dir_menu->Append(DIALOGS_DIR_CHOOSE, wxT("&Choose a directory\tCtrl-D")); - dir_menu->Append(DIALOGS_DIRNEW_CHOOSE, wxT("Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D")); - menuDlg->Append(wxID_ANY,wxT("&Directory operations"),dir_menu); + dir_menu->Append(DIALOGS_DIR_CHOOSE, "&Choose a directory\tCtrl-D"); + dir_menu->Append(DIALOGS_DIRNEW_CHOOSE, "Choose a directory (with \"Ne&w\" button)\tShift-Ctrl-D"); + menuDlg->Append(wxID_ANY,"&Directory operations",dir_menu); #if USE_DIRDLG_GENERIC dir_menu->AppendSeparator(); - dir_menu->Append(DIALOGS_GENERIC_DIR_CHOOSE, wxT("&Choose a directory (generic)")); + dir_menu->Append(DIALOGS_GENERIC_DIR_CHOOSE, "&Choose a directory (generic)"); #endif // USE_DIRDLG_GENERIC #endif // wxUSE_DIRDLG @@ -506,26 +506,26 @@ bool MyApp::OnInit() wxMenu *info_menu = new wxMenu; #if wxUSE_STARTUP_TIPS - info_menu->Append(DIALOGS_TIP, wxT("&Tip of the day\tCtrl-T")); + info_menu->Append(DIALOGS_TIP, "&Tip of the day\tCtrl-T"); #endif // wxUSE_STARTUP_TIPS #if wxUSE_PROGRESSDLG - info_menu->Append(DIALOGS_PROGRESS, wxT("Pro&gress dialog\tCtrl-G")); + info_menu->Append(DIALOGS_PROGRESS, "Pro&gress dialog\tCtrl-G"); #ifdef wxHAS_NATIVE_PROGRESSDIALOG info_menu->Append(DIALOGS_PROGRESS_GENERIC, - wxT("Generic progress dialog\tCtrl-Alt-G")); + "Generic progress dialog\tCtrl-Alt-G"); #endif // wxHAS_NATIVE_PROGRESSDIALOG #endif // wxUSE_PROGRESSDLG - info_menu->Append(DIALOGS_APP_PROGRESS, wxT("&App progress\tShift-Ctrl-G")); + info_menu->Append(DIALOGS_APP_PROGRESS, "&App progress\tShift-Ctrl-G"); #if wxUSE_BUSYINFO - info_menu->Append(DIALOGS_BUSYINFO, wxT("&Busy info dialog\tCtrl-B")); - info_menu->Append(DIALOGS_BUSYINFO_RICH, wxT("&Rich busy info dialog\tShift-Ctrl-B")); + info_menu->Append(DIALOGS_BUSYINFO, "&Busy info dialog\tCtrl-B"); + info_menu->Append(DIALOGS_BUSYINFO_RICH, "&Rich busy info dialog\tShift-Ctrl-B"); #endif // wxUSE_BUSYINFO #if wxUSE_LOG_DIALOG - info_menu->Append(DIALOGS_LOG_DIALOG, wxT("&Log dialog\tCtrl-L")); + info_menu->Append(DIALOGS_LOG_DIALOG, "&Log dialog\tCtrl-L"); #endif // wxUSE_LOG_DIALOG #if wxUSE_INFOBAR @@ -535,51 +535,51 @@ bool MyApp::OnInit() #if wxUSE_MSGDLG info_menu->Append(DIALOGS_MESSAGE_BOX_WXINFO, - wxT("&wxWidgets information\tCtrl-W")); + "&wxWidgets information\tCtrl-W"); #endif // wxUSE_MSGDLG - menuDlg->Append(wxID_ANY,wxT("&Informative dialogs"),info_menu); + menuDlg->Append(wxID_ANY,"&Informative dialogs",info_menu); #endif // wxUSE_STARTUP_TIPS || wxUSE_PROGRESSDLG || wxUSE_BUSYINFO || wxUSE_LOG_DIALOG #if wxUSE_FINDREPLDLG wxMenu *find_menu = new wxMenu; - find_menu->AppendCheckItem(DIALOGS_FIND, wxT("&Find dialog\tCtrl-F")); - find_menu->AppendCheckItem(DIALOGS_REPLACE, wxT("Find and &replace dialog\tShift-Ctrl-F")); - menuDlg->Append(wxID_ANY,wxT("&Searching"),find_menu); + find_menu->AppendCheckItem(DIALOGS_FIND, "&Find dialog\tCtrl-F"); + find_menu->AppendCheckItem(DIALOGS_REPLACE, "Find and &replace dialog\tShift-Ctrl-F"); + menuDlg->Append(wxID_ANY,"&Searching",find_menu); #endif // wxUSE_FINDREPLDLG wxMenu *dialogs_menu = new wxMenu; #if USE_MODAL_PRESENTATION - dialogs_menu->Append(DIALOGS_MODAL, wxT("&Modal dialog\tShift-Ctrl-W")); + dialogs_menu->Append(DIALOGS_MODAL, "&Modal dialog\tShift-Ctrl-W"); #endif // USE_MODAL_PRESENTATION - dialogs_menu->AppendCheckItem(DIALOGS_MODELESS, wxT("Mode&less dialog\tShift-Ctrl-Z")); - dialogs_menu->Append(DIALOGS_CENTRE_SCREEN, wxT("Centered on &screen\tShift-Ctrl-1")); - dialogs_menu->Append(DIALOGS_CENTRE_PARENT, wxT("Centered on &parent\tShift-Ctrl-2")); + dialogs_menu->AppendCheckItem(DIALOGS_MODELESS, "Mode&less dialog\tShift-Ctrl-Z"); + dialogs_menu->Append(DIALOGS_CENTRE_SCREEN, "Centered on &screen\tShift-Ctrl-1"); + dialogs_menu->Append(DIALOGS_CENTRE_PARENT, "Centered on &parent\tShift-Ctrl-2"); #if wxUSE_MINIFRAME - dialogs_menu->Append(DIALOGS_MINIFRAME, wxT("&Mini frame")); + dialogs_menu->Append(DIALOGS_MINIFRAME, "&Mini frame"); #endif // wxUSE_MINIFRAME - dialogs_menu->Append(DIALOGS_ONTOP, wxT("Dialog staying on &top")); - menuDlg->Append(wxID_ANY, wxT("&Generic dialogs"), dialogs_menu); + dialogs_menu->Append(DIALOGS_ONTOP, "Dialog staying on &top"); + menuDlg->Append(wxID_ANY, "&Generic dialogs", dialogs_menu); #if USE_SETTINGS_DIALOG wxMenu *sheet_menu = new wxMenu; - sheet_menu->Append(DIALOGS_PROPERTY_SHEET, wxT("&Standard property sheet\tShift-Ctrl-P")); - sheet_menu->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK, wxT("&Toolbook sheet\tShift-Ctrl-T")); + sheet_menu->Append(DIALOGS_PROPERTY_SHEET, "&Standard property sheet\tShift-Ctrl-P"); + sheet_menu->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK, "&Toolbook sheet\tShift-Ctrl-T"); if (wxPlatformIs(wxPORT_MAC)) - sheet_menu->Append(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, wxT("Button &Toolbook sheet\tShift-Ctrl-U")); + sheet_menu->Append(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, "Button &Toolbook sheet\tShift-Ctrl-U"); /* #ifdef __WXMAC__ - sheet_menu->Append(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, wxT("Button &Toolbook sheet\tShift-Ctrl-U")); + sheet_menu->Append(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, "Button &Toolbook sheet\tShift-Ctrl-U"); #endif */ - menuDlg->Append(wxID_ANY, wxT("&Property sheets"), sheet_menu); + menuDlg->Append(wxID_ANY, "&Property sheets", sheet_menu); #endif // USE_SETTINGS_DIALOG wxMenu *menuNotif = new wxMenu; - menuNotif->Append(DIALOGS_REQUEST, wxT("&Request user attention\tCtrl-Shift-R")); + menuNotif->Append(DIALOGS_REQUEST, "&Request user attention\tCtrl-Shift-R"); #if wxUSE_NOTIFICATION_MESSAGE menuNotif->AppendSeparator(); menuNotif->Append(DIALOGS_NOTIFY_MSG, "User &Notification\tCtrl-Shift-N"); @@ -591,40 +591,40 @@ bool MyApp::OnInit() menuDlg->AppendSeparator(); #endif // wxUSE_RICHTOOLTIP - menuDlg->Append(DIALOGS_STANDARD_BUTTON_SIZER_DIALOG, wxT("&Standard Buttons Sizer Dialog")); - menuDlg->Append(DIALOGS_TEST_DEFAULT_ACTION, wxT("&Test dialog default action")); + menuDlg->Append(DIALOGS_STANDARD_BUTTON_SIZER_DIALOG, "&Standard Buttons Sizer Dialog"); + menuDlg->Append(DIALOGS_TEST_DEFAULT_ACTION, "&Test dialog default action"); menuDlg->AppendCheckItem(DIALOGS_MODAL_HOOK, "Enable modal dialog hook"); menuDlg->AppendSeparator(); - menuDlg->Append(wxID_EXIT, wxT("E&xit\tAlt-X")); + menuDlg->Append(wxID_EXIT, "E&xit\tAlt-X"); #if wxUSE_ABOUTDLG wxMenu *menuHelp = new wxMenu; - menuHelp->Append(DIALOGS_ABOUTDLG_SIMPLE, wxT("&About (simple)...\tF1")); - menuHelp->Append(DIALOGS_ABOUTDLG_FANCY, wxT("About (&fancy)...\tShift-F1")); - menuHelp->Append(DIALOGS_ABOUTDLG_FULL, wxT("About (f&ull)...\tCtrl-F1")); - menuHelp->Append(DIALOGS_ABOUTDLG_CUSTOM, wxT("About (&custom)...\tCtrl-Shift-F1")); + menuHelp->Append(DIALOGS_ABOUTDLG_SIMPLE, "&About (simple)...\tF1"); + menuHelp->Append(DIALOGS_ABOUTDLG_FANCY, "About (&fancy)...\tShift-F1"); + menuHelp->Append(DIALOGS_ABOUTDLG_FULL, "About (f&ull)...\tCtrl-F1"); + menuHelp->Append(DIALOGS_ABOUTDLG_CUSTOM, "About (&custom)...\tCtrl-Shift-F1"); #endif // wxUSE_ABOUTDLG wxMenu* editMenu = new wxMenu; - editMenu->Append(wxID_UNDO, _("&Undo\tCtrl+Z")); - editMenu->Append(wxID_REDO, _("&Redo\tCtrl+Y")); + editMenu->Append(wxID_UNDO, "&Undo\tCtrl+Z"); + editMenu->Append(wxID_REDO, "&Redo\tCtrl+Y"); editMenu->AppendSeparator(); - editMenu->Append(wxID_CUT, _("Cu&t\tCtrl+X")); - editMenu->Append(wxID_COPY, _("&Copy\tCtrl+C")); - editMenu->Append(wxID_PASTE, _("&Paste\tCtrl+V")); - editMenu->Append(wxID_CLEAR, _("&Delete")); + editMenu->Append(wxID_CUT, "Cu&t\tCtrl+X"); + editMenu->Append(wxID_COPY, "&Copy\tCtrl+C"); + editMenu->Append(wxID_PASTE, "&Paste\tCtrl+V"); + editMenu->Append(wxID_CLEAR, "&Delete"); editMenu->AppendSeparator(); - editMenu->Append(wxID_SELECTALL, _("Select All\tCtrl+A")); + editMenu->Append(wxID_SELECTALL, "Select All\tCtrl+A"); wxMenuBar *menubar = new wxMenuBar; - menubar->Append(menuDlg, wxT("&Dialogs")); + menubar->Append(menuDlg, "&Dialogs"); - menubar->Append(editMenu, wxT("&Edit")); + menubar->Append(editMenu, "&Edit"); #if wxUSE_ABOUTDLG - menubar->Append(menuHelp, wxT("&Help")); + menubar->Append(menuHelp, "&Help"); #endif // wxUSE_ABOUTDLG frame->SetMenuBar(menubar); @@ -740,7 +740,7 @@ void MyFrame::ChooseColour(wxCommandEvent& event) m_clrData.SetChooseAlpha(event.GetId() == DIALOGS_CHOOSE_COLOUR_ALPHA); wxColourDialog dialog(this, &m_clrData); - dialog.SetTitle(_("Please choose the background colour")); + dialog.SetTitle("Please choose the background colour"); if ( dialog.ShowModal() == wxID_OK ) { m_clrData = dialog.GetColourData(); @@ -847,20 +847,20 @@ void MyFrame::LogDialog(wxCommandEvent& WXUNUSED(event)) // being flushed -- test it { wxBusyCursor bc; - wxLogMessage(wxT("This is some message - everything is ok so far.")); - wxLogMessage(wxT("Another message...\n... this one is on multiple lines")); - wxLogWarning(wxT("And then something went wrong!")); + wxLogMessage("This is some message - everything is ok so far."); + wxLogMessage("Another message...\n... this one is on multiple lines"); + wxLogWarning("And then something went wrong!"); // and if ~wxBusyCursor doesn't do it, then call it manually wxYield(); } - wxLogError(wxT("Intermediary error handler decided to abort.")); - wxLogError(wxT("The top level caller detected an unrecoverable error.")); + wxLogError("Intermediary error handler decided to abort."); + wxLogError("The top level caller detected an unrecoverable error."); wxLog::FlushActive(); - wxLogMessage(wxT("And this is the same dialog but with only one message.")); + wxLogMessage("And this is the same dialog but with only one message."); } #endif // wxUSE_LOG_DIALOG @@ -921,19 +921,19 @@ void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event)) switch ( dialog.ShowModal() ) { case wxID_YES: - wxLogStatus(wxT("You pressed \"Yes\"")); + wxLogStatus("You pressed \"Yes\""); break; case wxID_NO: - wxLogStatus(wxT("You pressed \"No\"")); + wxLogStatus("You pressed \"No\""); break; case wxID_CANCEL: - wxLogStatus(wxT("You pressed \"Cancel\"")); + wxLogStatus("You pressed \"Cancel\""); break; default: - wxLogError(wxT("Unexpected wxMessageDialog return code!")); + wxLogError("Unexpected wxMessageDialog return code!"); } } @@ -976,19 +976,19 @@ void MyFrame::MessageBoxWindowModalClosed(wxWindowModalDialogEvent& event) switch ( dialog->GetReturnCode() ) { case wxID_YES: - wxLogStatus(wxT("You pressed \"Yes\"")); + wxLogStatus("You pressed \"Yes\""); break; case wxID_NO: - wxLogStatus(wxT("You pressed \"No\"")); + wxLogStatus("You pressed \"No\""); break; case wxID_CANCEL: - wxLogStatus(wxT("You pressed \"Cancel\"")); + wxLogStatus("You pressed \"Cancel\""); break; default: - wxLogError(wxT("Unexpected wxMessageDialog return code!")); + wxLogError("Unexpected wxMessageDialog return code!"); } delete dialog; } @@ -1018,54 +1018,54 @@ void MyFrame::RichMessageDialog(wxCommandEvent& WXUNUSED(event)) #if wxUSE_NUMBERDLG void MyFrame::NumericEntry(wxCommandEvent& WXUNUSED(event)) { - long res = wxGetNumberFromUser( wxT("This is some text, actually a lot of text.\n") - wxT("Even two rows of text."), - wxT("Enter a number:"), wxT("Numeric input test"), + long res = wxGetNumberFromUser( "This is some text, actually a lot of text.\n" + "Even two rows of text.", + "Enter a number:", "Numeric input test", 50, 0, 100, this ); wxString msg; int icon; if ( res == -1 ) { - msg = wxT("Invalid number entered or dialog cancelled."); + msg = "Invalid number entered or dialog cancelled."; icon = wxICON_HAND; } else { - msg.Printf(wxT("You've entered %lu"), res ); + msg.Printf("You've entered %lu", res ); icon = wxICON_INFORMATION; } - wxMessageBox(msg, wxT("Numeric test result"), wxOK | icon, this); + wxMessageBox(msg, "Numeric test result", wxOK | icon, this); } #endif // wxUSE_NUMBERDLG #if wxUSE_TEXTDLG void MyFrame::PasswordEntry(wxCommandEvent& WXUNUSED(event)) { - wxString pwd = wxGetPasswordFromUser(wxT("Enter password:"), - wxT("Password entry dialog"), + wxString pwd = wxGetPasswordFromUser("Enter password:", + "Password entry dialog", wxEmptyString, this); if ( !pwd.empty() ) { - wxMessageBox(wxString::Format(wxT("Your password is '%s'"), pwd.c_str()), - wxT("Got password"), wxOK | wxICON_INFORMATION, this); + wxMessageBox(wxString::Format("Your password is '%s'", pwd.c_str()), + "Got password", wxOK | wxICON_INFORMATION, this); } } void MyFrame::LineEntry(wxCommandEvent& WXUNUSED(event)) { wxTextEntryDialog dialog(this, - wxT("This is a small sample\n") - wxT("A long, long string to test out the text entrybox"), - wxT("Please enter a string"), - wxT("Default value"), + "This is a small sample\n" + "A long, long string to test out the text entrybox", + "Please enter a string", + "Default value", wxOK | wxCANCEL); if (dialog.ShowModal() == wxID_OK) { - wxMessageBox(dialog.GetValue(), wxT("Got string"), wxOK | wxICON_INFORMATION, this); + wxMessageBox(dialog.GetValue(), "Got string", wxOK | wxICON_INFORMATION, this); } } @@ -1078,7 +1078,7 @@ void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event)) if (dialog.ShowModal() == wxID_OK) { - wxMessageBox(dialog.GetValue(), wxT("Got text"), wxOK | wxICON_INFORMATION, this); + wxMessageBox(dialog.GetValue(), "Got text", wxOK | wxICON_INFORMATION, this); } } #endif // wxUSE_TEXTDLG @@ -1086,19 +1086,19 @@ void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event)) #if wxUSE_CHOICEDLG void MyFrame::SingleChoice(wxCommandEvent& WXUNUSED(event) ) { - const wxString choices[] = { wxT("One"), wxT("Two"), wxT("Three"), wxT("Four"), wxT("Five") } ; + const wxString choices[] = { "One", "Two", "Three", "Four", "Five" } ; wxSingleChoiceDialog dialog(this, - wxT("This is a small sample\n") - wxT("A single-choice convenience dialog"), - wxT("Please select a value"), + "This is a small sample\n" + "A single-choice convenience dialog", + "Please select a value", WXSIZEOF(choices), choices); dialog.SetSelection(2); if (dialog.ShowModal() == wxID_OK) { - wxMessageDialog dialog2(this, dialog.GetStringSelection(), wxT("Got string")); + wxMessageDialog dialog2(this, dialog.GetStringSelection(), "Got string"); dialog2.ShowModal(); } } @@ -1107,16 +1107,16 @@ void MyFrame::MultiChoice(wxCommandEvent& WXUNUSED(event) ) { const wxString choices[] = { - wxT("One"), wxT("Two"), wxT("Three"), wxT("Four"), wxT("Five"), - wxT("Six"), wxT("Seven"), wxT("Eight"), wxT("Nine"), wxT("Ten"), - wxT("Eleven"), wxT("Twelve"), wxT("Seventeen"), + "One", "Two", "Three", "Four", "Five", + "Six", "Seven", "Eight", "Nine", "Ten", + "Eleven", "Twelve", "Seventeen", }; wxArrayInt selections; const int count = wxGetSelectedChoices(selections, - wxT("This is a small sample\n") - wxT("A multi-choice convenience dialog"), - wxT("Please select a value"), + "This is a small sample\n" + "A multi-choice convenience dialog", + "Please select a value", WXSIZEOF(choices), choices, this); if ( count >= 0 ) @@ -1124,14 +1124,14 @@ void MyFrame::MultiChoice(wxCommandEvent& WXUNUSED(event) ) wxString msg; if ( count == 0 ) { - msg = wxT("You did not select any items"); + msg = "You did not select any items"; } else { - msg.Printf(wxT("You selected %u items:\n"), (unsigned)count); + msg.Printf("You selected %u items:\n", (unsigned)count); for ( int n = 0; n < count; n++ ) { - msg += wxString::Format(wxT("\t%u: %u (%s)\n"), + msg += wxString::Format("\t%u: %u (%s)\n", (unsigned)n, (unsigned)selections[n], choices[selections[n]].c_str()); } @@ -1510,9 +1510,9 @@ MyExtraPanel::MyExtraPanel(wxWindow *parent) m_str("extra text"), m_checked(false) { - m_btn = new wxButton(this, -1, wxT("Custom Button")); + m_btn = new wxButton(this, -1, "Custom Button"); m_btn->Enable(false); - m_cb = new wxCheckBox(this, -1, wxT("Enable Custom Button")); + m_cb = new wxCheckBox(this, -1, "Enable Custom Button"); m_cb->Bind(wxEVT_CHECKBOX, &MyExtraPanel::OnCheckBox, this); m_label = new wxStaticText(this, wxID_ANY, "Nothing selected"); m_label->Bind(wxEVT_UPDATE_UI, &MyExtraPanel::OnUpdateLabelUI, this); @@ -1546,13 +1546,13 @@ void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) ) wxFileDialog dialog ( this, - wxT("Testing open file dialog"), + "Testing open file dialog", wxEmptyString, wxEmptyString, #ifdef __WXMOTIF__ - wxT("C++ files (*.cpp)|*.cpp") + "C++ files (*.cpp)|*.cpp" #else - wxT("C++ files (*.cpp;*.h)|*.cpp;*.h") + "C++ files (*.cpp;*.h)|*.cpp;*.h" #endif ); @@ -1564,16 +1564,16 @@ void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) ) { wxString info; wxWindow * const extra = dialog.GetExtraControl(); - info.Printf(wxT("Full file name: %s\n") - wxT("Path: %s\n") - wxT("Name: %s\n") - wxT("Custom window: %s"), + info.Printf("Full file name: %s\n" + "Path: %s\n" + "Name: %s\n" + "Custom window: %s", dialog.GetPath().c_str(), dialog.GetDirectory().c_str(), dialog.GetFilename().c_str(), extra ? static_cast(extra)->GetInfo() : wxString("None")); - wxMessageDialog dialog2(this, info, wxT("Selected file")); + wxMessageDialog dialog2(this, info, "Selected file"); dialog2.ShowModal(); } } @@ -1585,12 +1585,12 @@ void MyFrame::FileOpen2(wxCommandEvent& WXUNUSED(event) ) { static wxString s_extDef; wxString path = wxFileSelector( - wxT("Select the file to load"), + "Select the file to load", wxEmptyString, wxEmptyString, s_extDef, wxString::Format ( - wxT("Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s"), + "Waveform (*.wav)|*.wav|Plain text (*.txt)|*.txt|All files (%s)|%s", wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr ), @@ -1602,9 +1602,9 @@ void MyFrame::FileOpen2(wxCommandEvent& WXUNUSED(event) ) return; // it is just a sample, would use wxSplitPath in real program - s_extDef = path.AfterLast(wxT('.')); + s_extDef = path.AfterLast('.'); - wxLogMessage(wxT("You selected the file '%s', remembered extension '%s'"), + wxLogMessage("You selected the file '%s', remembered extension '%s'", path, s_extDef); } @@ -1612,16 +1612,16 @@ void MyFrame::FilesOpen(wxCommandEvent& WXUNUSED(event) ) { wxString wildcards = #ifdef __WXMOTIF__ - wxT("C++ files (*.cpp)|*.cpp"); + "C++ files (*.cpp)|*.cpp"; #else wxString::Format ( - wxT("All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h"), + "All files (%s)|%s|C++ files (*.cpp;*.h)|*.cpp;*.h", wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr ); #endif - wxFileDialog dialog(this, wxT("Testing open multiple file dialog"), + wxFileDialog dialog(this, "Testing open multiple file dialog", wxEmptyString, wxEmptyString, wildcards, wxFD_OPEN|wxFD_MULTIPLE); @@ -1636,15 +1636,15 @@ void MyFrame::FilesOpen(wxCommandEvent& WXUNUSED(event) ) size_t count = paths.GetCount(); for ( size_t n = 0; n < count; n++ ) { - s.Printf(wxT("File %d: %s (%s)\n"), + s.Printf("File %d: %s (%s)\n", (int)n, paths[n].c_str(), filenames[n].c_str()); msg += s; } - s.Printf(wxT("Filter index: %d"), dialog.GetFilterIndex()); + s.Printf("Filter index: %d", dialog.GetFilterIndex()); msg += s; - wxMessageDialog dialog2(this, msg, wxT("Selected files")); + wxMessageDialog dialog2(this, msg, "Selected files"); dialog2.ShowModal(); } } @@ -1652,17 +1652,17 @@ void MyFrame::FilesOpen(wxCommandEvent& WXUNUSED(event) ) void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) ) { wxFileDialog dialog(this, - wxT("Testing save file dialog"), + "Testing save file dialog", wxEmptyString, - wxT("myletter.doc"), - wxT("Text files (*.txt)|*.txt|Document files (*.doc;*.ods)|*.doc;*.ods"), + "myletter.doc", + "Text files (*.txt)|*.txt|Document files (*.doc;*.ods)|*.doc;*.ods", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); dialog.SetFilterIndex(1); if (dialog.ShowModal() == wxID_OK) { - wxLogMessage(wxT("%s, filter %d"), + wxLogMessage("%s, filter %d", dialog.GetPath().c_str(), dialog.GetFilterIndex()); } } @@ -1674,10 +1674,10 @@ void MyFrame::FileOpenGeneric(wxCommandEvent& WXUNUSED(event) ) wxGenericFileDialog dialog ( this, - wxT("Testing open file dialog"), + "Testing open file dialog", wxEmptyString, wxEmptyString, - wxT("C++ files (*.cpp;*.h)|*.cpp;*.h") + "C++ files (*.cpp;*.h)|*.cpp;*.h" ); dialog.SetExtraControlCreator(&createMyExtraPanel); @@ -1686,21 +1686,21 @@ void MyFrame::FileOpenGeneric(wxCommandEvent& WXUNUSED(event) ) if (dialog.ShowModal() == wxID_OK) { wxString info; - info.Printf(wxT("Full file name: %s\n") - wxT("Path: %s\n") - wxT("Name: %s"), + info.Printf("Full file name: %s\n" + "Path: %s\n" + "Name: %s", dialog.GetPath().c_str(), dialog.GetDirectory().c_str(), dialog.GetFilename().c_str()); - wxMessageDialog dialog2(this, info, wxT("Selected file")); + wxMessageDialog dialog2(this, info, "Selected file"); dialog2.ShowModal(); } } void MyFrame::FilesOpenGeneric(wxCommandEvent& WXUNUSED(event) ) { - wxString wildcards = wxT("All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h"); - wxGenericFileDialog dialog(this, wxT("Testing open multiple file dialog"), + wxString wildcards = "All files (*.*)|*.*|C++ files (*.cpp;*.h)|*.cpp;*.h"; + wxGenericFileDialog dialog(this, "Testing open multiple file dialog", wxEmptyString, wxEmptyString, wildcards, wxFD_MULTIPLE); @@ -1715,15 +1715,15 @@ void MyFrame::FilesOpenGeneric(wxCommandEvent& WXUNUSED(event) ) size_t count = paths.GetCount(); for ( size_t n = 0; n < count; n++ ) { - s.Printf(wxT("File %d: %s (%s)\n"), + s.Printf("File %d: %s (%s)\n", (int)n, paths[n].c_str(), filenames[n].c_str()); msg += s; } - s.Printf(wxT("Filter index: %d"), dialog.GetFilterIndex()); + s.Printf("Filter index: %d", dialog.GetFilterIndex()); msg += s; - wxMessageDialog dialog2(this, msg, wxT("Selected files")); + wxMessageDialog dialog2(this, msg, "Selected files"); dialog2.ShowModal(); } } @@ -1731,17 +1731,17 @@ void MyFrame::FilesOpenGeneric(wxCommandEvent& WXUNUSED(event) ) void MyFrame::FileSaveGeneric(wxCommandEvent& WXUNUSED(event) ) { wxGenericFileDialog dialog(this, - wxT("Testing save file dialog"), + "Testing save file dialog", wxEmptyString, - wxT("myletter.doc"), - wxT("Text files (*.txt)|*.txt|Document files (*.doc;*.ods)|*.doc;*.ods"), + "myletter.doc", + "Text files (*.txt)|*.txt|Document files (*.doc;*.ods)|*.doc;*.ods", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); dialog.SetFilterIndex(1); if (dialog.ShowModal() == wxID_OK) { - wxLogMessage(wxT("%s, filter %d"), + wxLogMessage("%s, filter %d", dialog.GetPath().c_str(), dialog.GetFilterIndex()); } } @@ -1754,11 +1754,11 @@ void MyFrame::DoDirChoose(int style) wxString dirHome; wxGetHomeDir(&dirHome); - wxDirDialog dialog(this, wxT("Testing directory picker"), dirHome, style); + wxDirDialog dialog(this, "Testing directory picker", dirHome, style); if (dialog.ShowModal() == wxID_OK) { - wxLogMessage(wxT("Selected path: %s"), dialog.GetPath().c_str()); + wxLogMessage("Selected path: %s", dialog.GetPath().c_str()); } } @@ -1780,11 +1780,11 @@ void MyFrame::GenericDirChoose(wxCommandEvent& WXUNUSED(event) ) wxString dirHome; wxGetHomeDir(&dirHome); - wxGenericDirDialog dialog(this, wxT("Testing generic directory picker"), dirHome); + wxGenericDirDialog dialog(this, "Testing generic directory picker", dirHome); if (dialog.ShowModal() == wxID_OK) { - wxMessageDialog dialog2(this, dialog.GetPath(), wxT("Selected path")); + wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path"); dialog2.ShowModal(); } } @@ -1826,18 +1826,18 @@ void MyFrame::ModelessDlg(wxCommandEvent& event) void MyFrame::DlgCenteredScreen(wxCommandEvent& WXUNUSED(event)) { - wxDialog dlg(this, wxID_ANY, wxT("Dialog centered on screen"), + wxDialog dlg(this, wxID_ANY, "Dialog centered on screen", wxDefaultPosition, wxSize(200, 100)); - (new wxButton(&dlg, wxID_OK, wxT("Close")))->Centre(); + (new wxButton(&dlg, wxID_OK, "Close"))->Centre(); dlg.CentreOnScreen(); dlg.ShowModal(); } void MyFrame::DlgCenteredParent(wxCommandEvent& WXUNUSED(event)) { - wxDialog dlg(this, wxID_ANY, wxT("Dialog centered on parent"), + wxDialog dlg(this, wxID_ANY, "Dialog centered on parent", wxDefaultPosition, wxSize(200, 100)); - (new wxButton(&dlg, wxID_OK, wxT("Close")))->Centre(); + (new wxButton(&dlg, wxID_OK, "Close"))->Centre(); dlg.CentreOnParent(); dlg.ShowModal(); } @@ -1845,16 +1845,16 @@ void MyFrame::DlgCenteredParent(wxCommandEvent& WXUNUSED(event)) #if wxUSE_MINIFRAME void MyFrame::MiniFrame(wxCommandEvent& WXUNUSED(event)) { - wxFrame *frame = new wxMiniFrame(this, wxID_ANY, wxT("Mini frame"), + wxFrame *frame = new wxMiniFrame(this, wxID_ANY, "Mini frame", wxDefaultPosition, wxSize(300, 100), wxCAPTION | wxCLOSE_BOX); new wxStaticText(frame, wxID_ANY, - wxT("Mini frames have slightly different appearance"), + "Mini frames have slightly different appearance", wxPoint(5, 5)); new wxStaticText(frame, wxID_ANY, - wxT("from the normal frames but that's the only difference."), + "from the normal frames but that's the only difference.", wxPoint(5, 25)); frame->CentreOnParent(); @@ -1864,10 +1864,10 @@ void MyFrame::MiniFrame(wxCommandEvent& WXUNUSED(event)) void MyFrame::DlgOnTop(wxCommandEvent& WXUNUSED(event)) { - wxDialog dlg(this, wxID_ANY, wxT("Dialog staying on top of other windows"), + wxDialog dlg(this, wxID_ANY, "Dialog staying on top of other windows", wxDefaultPosition, wxSize(300, 100), wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP); - (new wxButton(&dlg, wxID_OK, wxT("Close")))->Centre(); + (new wxButton(&dlg, wxID_OK, "Close"))->Centre(); dlg.ShowModal(); } @@ -1885,13 +1885,13 @@ void MyFrame::ShowTip(wxCommandEvent& WXUNUSED(event)) s_index = rand() % 5; } - wxTipProvider *tipProvider = wxCreateFileTipProvider(wxT("tips.txt"), s_index); + wxTipProvider *tipProvider = wxCreateFileTipProvider("tips.txt", s_index); bool showAtStartup = wxShowTip(this, tipProvider); if ( showAtStartup ) { - wxMessageBox(wxT("Will show tips on startup"), wxT("Tips dialog"), + wxMessageBox("Will show tips on startup", "Tips dialog", wxOK | wxICON_INFORMATION, this); } @@ -1910,7 +1910,7 @@ void MyFrame::OnPropertySheet(wxCommandEvent& event) void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event)) { - wxLogStatus(wxT("Sleeping for 3 seconds to allow you to switch to another window")); + wxLogStatus("Sleeping for 3 seconds to allow you to switch to another window"); wxSleep(3); @@ -2760,8 +2760,8 @@ void MyFrame::DoShowProgress(wxGenericProgressDialog& dialog) if ( !cont ) { - if ( wxMessageBox(wxT("Do you really want to cancel?"), - wxT("Progress dialog question"), // caption + if ( wxMessageBox("Do you really want to cancel?", + "Progress dialog question", // caption wxYES_NO | wxICON_QUESTION) == wxYES ) break; @@ -2774,11 +2774,11 @@ void MyFrame::DoShowProgress(wxGenericProgressDialog& dialog) if ( !cont ) { - wxLogStatus(wxT("Progress dialog aborted!")); + wxLogStatus("Progress dialog aborted!"); } else { - wxLogStatus(wxT("Countdown from %d finished"), max_); + wxLogStatus("Countdown from %d finished", max_); } } @@ -2811,7 +2811,7 @@ void MyFrame::ShowAppProgress( wxCommandEvent& WXUNUSED(event) ) static void InitAboutInfoMinimal(wxAboutDialogInfo& info) { - info.SetName(wxT("Dialogs Sample")); + info.SetName("Dialogs Sample"); info.SetVersion(wxVERSION_NUM_DOT_STRING, wxString::Format ( @@ -2819,16 +2819,16 @@ static void InitAboutInfoMinimal(wxAboutDialogInfo& info) wxMINOR_VERSION % 2 ? "Development" : "Stable", wxVERSION_NUM_DOT_STRING )); - info.SetDescription(wxT("This sample shows different wxWidgets dialogs")); - info.SetCopyright(wxT("(C) 1998-2006 wxWidgets dev team")); - info.AddDeveloper(wxT("Vadim Zeitlin")); + info.SetDescription("This sample shows different wxWidgets dialogs"); + info.SetCopyright("(C) 1998-2006 wxWidgets dev team"); + info.AddDeveloper("Vadim Zeitlin"); } static void InitAboutInfoWebsite(wxAboutDialogInfo& info) { InitAboutInfoMinimal(info); - info.SetWebSite(wxT("http://www.wxwidgets.org/"), wxT("wxWidgets web site")); + info.SetWebSite("http://www.wxwidgets.org/", "wxWidgets web site"); } static void InitAboutInfoAll(wxAboutDialogInfo& info) @@ -2836,21 +2836,19 @@ static void InitAboutInfoAll(wxAboutDialogInfo& info) InitAboutInfoWebsite(info); // we can add a second developer - info.AddDeveloper(wxT("A.N. Other")); + info.AddDeveloper("A.N. Other"); // or we can add several persons at once like this - static const wxChar *docwriters[] = - { - wxT("First D. Writer"), - wxT("Second One"), - }; + wxArrayString docwriters; + docwriters.Add("First D. Writer"); + docwriters.Add("Second One"); - info.SetDocWriters(wxArrayString(WXSIZEOF(docwriters), docwriters)); + info.SetDocWriters(docwriters); info.SetLicence(wxString::FromAscii( " wxWindows Library Licence, Version 3.1\n" " ======================================\n" "\n" -" Copyright (c) 1998-2005 Julian Smart, Robert Roebling et al\n" +" Copyright (c) 1998-2018 Julian Smart, Robert Roebling et al\n" "\n" " Everyone is permitted to copy and distribute verbatim copies\n" " of this licence document, but changing it is not allowed.\n" @@ -2861,7 +2859,7 @@ static void InitAboutInfoAll(wxAboutDialogInfo& info) " ...and so on and so forth...\n" )); - info.AddTranslator(wxT("Wun Ngo Wen (Martian)")); + info.AddTranslator("Wun Ngo Wen (Martian)"); } void MyFrame::ShowSimpleAboutDialog(wxCommandEvent& WXUNUSED(event)) @@ -2901,7 +2899,7 @@ public: virtual void DoAddCustomControls() wxOVERRIDE { AddControl(new wxStaticLine(this), wxSizerFlags().Expand()); - AddText(wxT("Some custom text")); + AddText("Some custom text"); AddControl(new wxStaticLine(this), wxSizerFlags().Expand()); } }; @@ -2923,7 +2921,7 @@ void MyFrame::ShowBusyInfo(wxCommandEvent& WXUNUSED(event)) { wxWindowDisabler disableAll; - wxBusyInfo info(wxT("Working, please wait..."), this); + wxBusyInfo info("Working, please wait...", this); for ( int i = 0; i < 18; i++ ) { @@ -2972,7 +2970,7 @@ void MyFrame::ShowReplaceDialog( wxCommandEvent& WXUNUSED(event) ) ( this, &m_findData, - wxT("Find and replace dialog"), + "Find and replace dialog", wxFR_REPLACEDIALOG ); @@ -2992,7 +2990,7 @@ void MyFrame::ShowFindDialog( wxCommandEvent& WXUNUSED(event) ) ( this, &m_findData, - wxT("Find dialog"), + "Find dialog", // just for testing wxFR_NOWHOLEWORD ); @@ -3004,10 +3002,10 @@ void MyFrame::ShowFindDialog( wxCommandEvent& WXUNUSED(event) ) static wxString DecodeFindDialogEventFlags(int flags) { wxString str; - str << (flags & wxFR_DOWN ? wxT("down") : wxT("up")) << wxT(", ") - << (flags & wxFR_WHOLEWORD ? wxT("whole words only, ") : wxT("")) - << (flags & wxFR_MATCHCASE ? wxT("") : wxT("not ")) - << wxT("case sensitive"); + str << (flags & wxFR_DOWN ? "down" : "up") << ", " + << (flags & wxFR_WHOLEWORD ? "whole words only, " : "") + << (flags & wxFR_MATCHCASE ? "" : "not ") + << "case sensitive"; return str; } @@ -3018,16 +3016,16 @@ void MyFrame::OnFindDialog(wxFindDialogEvent& event) if ( type == wxEVT_FIND || type == wxEVT_FIND_NEXT ) { - wxLogMessage(wxT("Find %s'%s' (flags: %s)"), - type == wxEVT_FIND_NEXT ? wxT("next ") : wxT(""), + wxLogMessage("Find %s'%s' (flags: %s)", + type == wxEVT_FIND_NEXT ? "next " : "", event.GetFindString().c_str(), DecodeFindDialogEventFlags(event.GetFlags()).c_str()); } else if ( type == wxEVT_FIND_REPLACE || type == wxEVT_FIND_REPLACE_ALL ) { - wxLogMessage(wxT("Replace %s'%s' with '%s' (flags: %s)"), - type == wxEVT_FIND_REPLACE_ALL ? wxT("all ") : wxT(""), + wxLogMessage("Replace %s'%s' with '%s' (flags: %s)", + type == wxEVT_FIND_REPLACE_ALL ? "all " : "", event.GetFindString().c_str(), event.GetReplaceString().c_str(), DecodeFindDialogEventFlags(event.GetFlags()).c_str()); @@ -3037,28 +3035,28 @@ void MyFrame::OnFindDialog(wxFindDialogEvent& event) wxFindReplaceDialog *dlg = event.GetDialog(); int idMenu; - const wxChar *txt; + wxString txt; if ( dlg == m_dlgFind ) { - txt = wxT("Find"); + txt = "Find"; idMenu = DIALOGS_FIND; m_dlgFind = NULL; } else if ( dlg == m_dlgReplace ) { - txt = wxT("Replace"); + txt = "Replace"; idMenu = DIALOGS_REPLACE; m_dlgReplace = NULL; } else { - txt = wxT("Unknown"); + txt = "Unknown"; idMenu = wxID_ANY; - wxFAIL_MSG( wxT("unexpected event") ); + wxFAIL_MSG( "unexpected event" ); } - wxLogMessage(wxT("%s dialog is being closed."), txt); + wxLogMessage("%s dialog is being closed.", txt); if ( idMenu != wxID_ANY ) { @@ -3069,7 +3067,7 @@ void MyFrame::OnFindDialog(wxFindDialogEvent& event) } else { - wxLogError(wxT("Unknown find dialog event!")); + wxLogError("Unknown find dialog event!"); } } @@ -3084,8 +3082,8 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) ) wxPaintDC dc(this); dc.SetBackgroundMode(wxTRANSPARENT); dc.DrawText( - wxT("wxWidgets common dialogs") - wxT(" test application") + "wxWidgets common dialogs" + " test application" , 10, 10); } @@ -3096,12 +3094,12 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) ) // ---------------------------------------------------------------------------- MyModelessDialog::MyModelessDialog(wxWindow *parent) - : wxDialog(parent, wxID_ANY, wxString(wxT("Modeless dialog"))) + : wxDialog(parent, wxID_ANY, wxString("Modeless dialog")) { wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); - wxButton *btn = new wxButton(this, DIALOGS_MODELESS_BTN, wxT("Press me")); - wxCheckBox *check = new wxCheckBox(this, wxID_ANY, wxT("Should be disabled")); + wxButton *btn = new wxButton(this, DIALOGS_MODELESS_BTN, "Press me"); + wxCheckBox *check = new wxCheckBox(this, wxID_ANY, "Should be disabled"); check->Disable(); sizerTop->Add(btn, 1, wxEXPAND | wxALL, 5); @@ -3112,7 +3110,7 @@ MyModelessDialog::MyModelessDialog(wxWindow *parent) void MyModelessDialog::OnButton(wxCommandEvent& WXUNUSED(event)) { - wxMessageBox(wxT("Button pressed in modeless dialog"), wxT("Info"), + wxMessageBox("Button pressed in modeless dialog", "Info", wxOK | wxICON_INFORMATION, this); } @@ -3120,8 +3118,8 @@ void MyModelessDialog::OnClose(wxCloseEvent& event) { if ( event.CanVeto() ) { - wxMessageBox(wxT("Use the menu item to close this dialog"), - wxT("Modeless dialog"), + wxMessageBox("Use the menu item to close this dialog", + "Modeless dialog", wxOK | wxICON_INFORMATION, this); event.Veto(); @@ -3133,13 +3131,13 @@ void MyModelessDialog::OnClose(wxCloseEvent& event) // ---------------------------------------------------------------------------- MyModalDialog::MyModalDialog(wxWindow *parent) - : wxDialog(parent, wxID_ANY, wxString(wxT("Modal dialog"))) + : wxDialog(parent, wxID_ANY, wxString("Modal dialog")) { wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); - m_btnModal = new wxButton(this, wxID_ANY, wxT("&Modal dialog...")); - m_btnModeless = new wxButton(this, wxID_ANY, wxT("Mode&less dialog")); - m_btnDelete = new wxButton(this, wxID_ANY, wxT("&Delete button")); + m_btnModal = new wxButton(this, wxID_ANY, "&Modal dialog..."); + m_btnModeless = new wxButton(this, wxID_ANY, "Mode&less dialog"); + m_btnDelete = new wxButton(this, wxID_ANY, "&Delete button"); sizerTop->Add(m_btnModal, 0, wxALIGN_CENTER | wxALL, 5); sizerTop->Add(m_btnModeless, 0, wxALIGN_CENTER | wxALL, 5); @@ -3164,11 +3162,11 @@ void MyModalDialog::OnButton(wxCommandEvent& event) else if ( event.GetEventObject() == m_btnModal ) { #if wxUSE_TEXTDLG - wxGetTextFromUser(wxT("Dummy prompt"), - wxT("Modal dialog called from dialog"), + wxGetTextFromUser("Dummy prompt", + "Modal dialog called from dialog", wxEmptyString, this); #else - wxMessageBox(wxT("Modal dialog called from dialog")); + wxMessageBox("Modal dialog called from dialog"); #endif // wxUSE_TEXTDLG } else if ( event.GetEventObject() == m_btnModeless ) @@ -3188,7 +3186,7 @@ void MyModalDialog::OnButton(wxCommandEvent& event) // ---------------------------------------------------------------------------- StdButtonSizerDialog::StdButtonSizerDialog(wxWindow *parent) - : wxDialog(parent, wxID_ANY, wxString(wxT("StdButtonSizer dialog")), + : wxDialog(parent, wxID_ANY, wxString("StdButtonSizer dialog"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER), m_buttonsSizer(NULL) { @@ -3197,29 +3195,29 @@ StdButtonSizerDialog::StdButtonSizerDialog(wxWindow *parent) wxBoxSizer *const sizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *const sizerInside1 = new wxBoxSizer(wxVERTICAL); - m_chkboxAffirmativeButton = new wxCheckBox(this, wxID_ANY, _("Enable Affirmative Button")); + m_chkboxAffirmativeButton = new wxCheckBox(this, wxID_ANY, "Enable Affirmative Button"); - wxStaticBoxSizer *const sizer1 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Affirmative Button")); + wxStaticBoxSizer *const sizer1 = new wxStaticBoxSizer(wxVERTICAL, this, "Affirmative Button"); - m_radiobtnOk = new wxRadioButton(this, wxID_ANY, _("Ok"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); - m_radiobtnYes = new wxRadioButton(this, wxID_ANY, _("Yes")); + m_radiobtnOk = new wxRadioButton(this, wxID_ANY, "Ok", wxDefaultPosition, wxDefaultSize, wxRB_GROUP); + m_radiobtnYes = new wxRadioButton(this, wxID_ANY, "Yes"); wxBoxSizer *const sizerInside2 = new wxBoxSizer(wxVERTICAL); - m_chkboxDismissButton = new wxCheckBox(this, wxID_ANY, _("Enable Dismiss Button")); + m_chkboxDismissButton = new wxCheckBox(this, wxID_ANY, "Enable Dismiss Button"); - wxStaticBoxSizer *const sizer2 = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Dismiss Button")); + wxStaticBoxSizer *const sizer2 = new wxStaticBoxSizer(wxVERTICAL, this, "Dismiss Button"); - m_radiobtnCancel = new wxRadioButton(this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); - m_radiobtnClose = new wxRadioButton(this, wxID_ANY, _("Close")); + m_radiobtnCancel = new wxRadioButton(this, wxID_ANY, "Cancel", wxDefaultPosition, wxDefaultSize, wxRB_GROUP); + m_radiobtnClose = new wxRadioButton(this, wxID_ANY, "Close"); wxBoxSizer *const sizer3 = new wxBoxSizer(wxHORIZONTAL); - m_chkboxNo = new wxCheckBox(this, wxID_ANY, _("No")); - m_chkboxHelp = new wxCheckBox(this, wxID_ANY, _("Help")); - m_chkboxApply = new wxCheckBox(this, wxID_ANY, _("Apply")); + m_chkboxNo = new wxCheckBox(this, wxID_ANY, "No"); + m_chkboxHelp = new wxCheckBox(this, wxID_ANY, "Help"); + m_chkboxApply = new wxCheckBox(this, wxID_ANY, "Apply"); - m_chkboxNoDefault = new wxCheckBox(this, wxID_ANY, wxT("No Default")); + m_chkboxNoDefault = new wxCheckBox(this, wxID_ANY, "No Default"); sizer1->Add(m_radiobtnOk, 0, wxALL, 5); sizer1->Add(m_radiobtnYes, 0, wxALL, 5); @@ -3394,7 +3392,7 @@ SettingsDialog::SettingsDialog(wxWindow* win, SettingsData& settingsData, int di else m_imageList = NULL; - Create(win, wxID_ANY, _("Preferences"), wxDefaultPosition, wxDefaultSize, + Create(win, wxID_ANY, "Preferences", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE| (int)wxPlatform::IfNot(wxOS_WINDOWS_CE, resizeBorder) ); @@ -3410,8 +3408,8 @@ SettingsDialog::SettingsDialog(wxWindow* win, SettingsData& settingsData, int di wxPanel* generalSettings = CreateGeneralSettingsPage(notebook); wxPanel* aestheticSettings = CreateAestheticSettingsPage(notebook); - notebook->AddPage(generalSettings, _("General"), true, tabImage1); - notebook->AddPage(aestheticSettings, _("Aesthetics"), false, tabImage2); + notebook->AddPage(generalSettings, "General", true, tabImage1); + notebook->AddPage(aestheticSettings, "Aesthetics", false, tabImage2); LayoutDialog(); } @@ -3431,15 +3429,15 @@ wxPanel* SettingsDialog::CreateGeneralSettingsPage(wxWindow* parent) //// LOAD LAST FILE wxBoxSizer* itemSizer3 = new wxBoxSizer( wxHORIZONTAL ); - wxCheckBox* checkBox3 = new wxCheckBox(panel, ID_LOAD_LAST_PROJECT, _("&Load last project on startup"), wxDefaultPosition, wxDefaultSize); + wxCheckBox* checkBox3 = new wxCheckBox(panel, ID_LOAD_LAST_PROJECT, "&Load last project on startup", wxDefaultPosition, wxDefaultSize); checkBox3->SetValidator(wxGenericValidator(&m_settingsData.m_loadLastOnStartup)); itemSizer3->Add(checkBox3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); item0->Add(itemSizer3, 0, wxGROW|wxALL, 0); //// AUTOSAVE - wxString autoSaveLabel = _("&Auto-save every"); - wxString minsLabel = _("mins"); + wxString autoSaveLabel = "&Auto-save every"; + wxString minsLabel = "mins"; wxBoxSizer* itemSizer12 = new wxBoxSizer( wxHORIZONTAL ); wxCheckBox* checkBox12 = new wxCheckBox(panel, ID_AUTO_SAVE, autoSaveLabel, wxDefaultPosition, wxDefaultSize); @@ -3460,7 +3458,7 @@ wxPanel* SettingsDialog::CreateGeneralSettingsPage(wxWindow* parent) //// TOOLTIPS wxBoxSizer* itemSizer8 = new wxBoxSizer( wxHORIZONTAL ); - wxCheckBox* checkBox6 = new wxCheckBox(panel, ID_SHOW_TOOLTIPS, _("Show &tooltips"), wxDefaultPosition, wxDefaultSize); + wxCheckBox* checkBox6 = new wxCheckBox(panel, ID_SHOW_TOOLTIPS, "Show &tooltips", wxDefaultPosition, wxDefaultSize); checkBox6->SetValidator(wxGenericValidator(&m_settingsData.m_showToolTips)); itemSizer8->Add(checkBox6, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); item0->Add(itemSizer8, 0, wxGROW|wxALL, 0); @@ -3481,10 +3479,10 @@ wxPanel* SettingsDialog::CreateAestheticSettingsPage(wxWindow* parent) //// PROJECT OR GLOBAL wxString globalOrProjectChoices[2]; - globalOrProjectChoices[0] = _("&New projects"); - globalOrProjectChoices[1] = _("&This project"); + globalOrProjectChoices[0] = "&New projects"; + globalOrProjectChoices[1] = "&This project"; - wxRadioBox* projectOrGlobal = new wxRadioBox(panel, ID_APPLY_SETTINGS_TO, _("&Apply settings to:"), + wxRadioBox* projectOrGlobal = new wxRadioBox(panel, ID_APPLY_SETTINGS_TO, "&Apply settings to:", wxDefaultPosition, wxDefaultSize, 2, globalOrProjectChoices); projectOrGlobal->SetValidator(wxGenericValidator(&m_settingsData.m_applyTo)); item0->Add(projectOrGlobal, 0, wxGROW|wxALL, 5); @@ -3493,9 +3491,9 @@ wxPanel* SettingsDialog::CreateAestheticSettingsPage(wxWindow* parent) //// BACKGROUND STYLE wxArrayString backgroundStyleChoices; - backgroundStyleChoices.Add(wxT("Colour")); - backgroundStyleChoices.Add(wxT("Image")); - wxStaticBox* staticBox3 = new wxStaticBox(panel, wxID_ANY, _("Background style:")); + backgroundStyleChoices.Add("Colour"); + backgroundStyleChoices.Add("Image"); + wxStaticBox* staticBox3 = new wxStaticBox(panel, wxID_ANY, "Background style:"); wxBoxSizer* styleSizer = new wxStaticBoxSizer( staticBox3, wxVERTICAL ); item0->Add(styleSizer, 0, wxGROW|wxALL, 5); @@ -3505,7 +3503,7 @@ wxPanel* SettingsDialog::CreateAestheticSettingsPage(wxWindow* parent) wxChoice* choice2 = new wxChoice(panel, ID_BACKGROUND_STYLE, wxDefaultPosition, wxDefaultSize, backgroundStyleChoices); choice2->SetValidator(wxGenericValidator(&m_settingsData.m_bgStyle)); - itemSizer2->Add(new wxStaticText(panel, wxID_ANY, _("&Window:")), 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); + itemSizer2->Add(new wxStaticText(panel, wxID_ANY, "&Window:"), 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); itemSizer2->Add(5, 5, 1, wxALL, 0); itemSizer2->Add(choice2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); @@ -3514,7 +3512,7 @@ wxPanel* SettingsDialog::CreateAestheticSettingsPage(wxWindow* parent) #if wxUSE_SPINCTRL //// FONT SIZE SELECTION - wxStaticBox* staticBox1 = new wxStaticBox(panel, wxID_ANY, _("Tile font size:")); + wxStaticBox* staticBox1 = new wxStaticBox(panel, wxID_ANY, "Tile font size:"); wxBoxSizer* itemSizer5 = new wxStaticBoxSizer( staticBox1, wxHORIZONTAL ); wxSpinCtrl* spinCtrl = new wxSpinCtrl(panel, ID_FONT_SIZE, wxEmptyString, wxDefaultPosition,