Remove (most) occurrences of wxT() macro from the samples
Also replace wxChar* with wxString. Closes https://github.com/wxWidgets/wxWidgets/pull/945
This commit is contained in:
committed by
Vadim Zeitlin
parent
e768046774
commit
f58ea62596
@@ -43,13 +43,13 @@
|
||||
MyData g_data;
|
||||
|
||||
wxString g_listbox_choices[] =
|
||||
{wxT("one"), wxT("two"), wxT("three")};
|
||||
{"one", "two", "three"};
|
||||
|
||||
wxString g_combobox_choices[] =
|
||||
{wxT("yes"), wxT("no (doesn't validate)"), wxT("maybe (doesn't validate)")};
|
||||
{"yes", "no (doesn't validate)", "maybe (doesn't validate)"};
|
||||
|
||||
wxString g_radiobox_choices[] =
|
||||
{wxT("green"), wxT("yellow"), wxT("red")};
|
||||
{"green", "yellow", "red"};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MyData
|
||||
@@ -60,7 +60,7 @@ MyData::MyData()
|
||||
// This string will be passed to an alpha-only validator, which
|
||||
// will complain because spaces aren't alpha. Note that validation
|
||||
// is performed only when 'OK' is pressed.
|
||||
m_string = wxT("Spaces are invalid here");
|
||||
m_string = "Spaces are invalid here";
|
||||
m_string2 = "Valid text";
|
||||
m_listbox_choices.Add(0);
|
||||
m_intValue = 0;
|
||||
@@ -137,7 +137,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// Create and display the main frame window.
|
||||
MyFrame *frame = new MyFrame((wxFrame *) NULL, wxT("Validator Test"),
|
||||
MyFrame *frame = new MyFrame((wxFrame *) NULL, "Validator Test",
|
||||
50, 50, 300, 250);
|
||||
frame->Show(true);
|
||||
|
||||
@@ -162,17 +162,17 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, int x, int y, int w, int
|
||||
|
||||
// Create a listbox to display the validated data.
|
||||
m_listbox = new wxListBox(this, wxID_ANY);
|
||||
m_listbox->Append(wxString(wxT("Try 'File|Test' to see how validators work.")));
|
||||
m_listbox->Append(wxString("Try 'File|Test' to see how validators work."));
|
||||
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(VALIDATE_TEST_DIALOG, wxT("&Test dialog...\tCtrl-T"), wxT("Demonstrate validators"));
|
||||
file_menu->AppendCheckItem(VALIDATE_TOGGLE_BELL, wxT("&Bell on error"), wxT("Toggle bell on error"));
|
||||
file_menu->Append(VALIDATE_TEST_DIALOG, "&Test dialog...\tCtrl-T", "Demonstrate validators");
|
||||
file_menu->AppendCheckItem(VALIDATE_TOGGLE_BELL, "&Bell on error", "Toggle bell on error");
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(wxID_EXIT, wxT("E&xit"));
|
||||
file_menu->Append(wxID_EXIT, "E&xit");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
SetMenuBar(menu_bar);
|
||||
|
||||
// All validators share a common (static) flag that controls
|
||||
@@ -196,7 +196,7 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event))
|
||||
// and variables together. Values are transferred between them behind
|
||||
// the scenes, so here we don't have to query the controls for their
|
||||
// values.
|
||||
MyDialog dialog(this, wxT("Validator demonstration"));
|
||||
MyDialog dialog(this, "Validator demonstration");
|
||||
|
||||
// When the dialog is displayed, validators automatically transfer
|
||||
// data from variables to their corresponding controls.
|
||||
@@ -206,19 +206,19 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event))
|
||||
// automatically transferred to the variables we specified
|
||||
// when we created the validators.
|
||||
m_listbox->Clear();
|
||||
m_listbox->Append(wxString(wxT("string: ")) + g_data.m_string);
|
||||
m_listbox->Append(wxString(wxT("string #2: ")) + g_data.m_string2);
|
||||
m_listbox->Append(wxString("string: ") + g_data.m_string);
|
||||
m_listbox->Append(wxString("string #2: ") + g_data.m_string2);
|
||||
|
||||
for(unsigned int i = 0; i < g_data.m_listbox_choices.GetCount(); ++i)
|
||||
{
|
||||
int j = g_data.m_listbox_choices[i];
|
||||
m_listbox->Append(wxString(wxT("listbox choice(s): ")) + g_listbox_choices[j]);
|
||||
m_listbox->Append(wxString("listbox choice(s): ") + g_listbox_choices[j]);
|
||||
}
|
||||
|
||||
wxString checkbox_state(g_data.m_checkbox_state ? wxT("checked") : wxT("unchecked"));
|
||||
m_listbox->Append(wxString(wxT("checkbox: ")) + checkbox_state);
|
||||
m_listbox->Append(wxString(wxT("combobox: ")) + g_data.m_combobox_choice);
|
||||
m_listbox->Append(wxString(wxT("radiobox: ")) + g_radiobox_choices[g_data.m_radiobox_choice]);
|
||||
wxString checkbox_state(g_data.m_checkbox_state ? "checked" : "unchecked");
|
||||
m_listbox->Append(wxString("checkbox: ") + checkbox_state);
|
||||
m_listbox->Append(wxString("combobox: ") + g_data.m_combobox_choice);
|
||||
m_listbox->Append(wxString("radiobox: ") + g_radiobox_choices[g_data.m_radiobox_choice]);
|
||||
|
||||
m_listbox->Append(wxString::Format("integer value: %d", g_data.m_intValue));
|
||||
m_listbox->Append(wxString::Format("small int value: %u", g_data.m_smallIntValue));
|
||||
@@ -287,7 +287,7 @@ MyDialog::MyDialog( wxWindow *parent, const wxString& title,
|
||||
// because we don't use it elsewhere--it can be anonymous.
|
||||
// We don't need any such pointer to query its state, which
|
||||
// can be gotten directly from g_data.
|
||||
flexgridsizer->Add(new wxCheckBox(this, VALIDATE_CHECK, wxT("Sample checkbox"),
|
||||
flexgridsizer->Add(new wxCheckBox(this, VALIDATE_CHECK, "Sample checkbox",
|
||||
wxDefaultPosition, wxDefaultSize, 0,
|
||||
wxGenericValidator(&g_data.m_checkbox_state)),
|
||||
1, wxALIGN_CENTER|wxALL, 15);
|
||||
@@ -375,7 +375,7 @@ MyDialog::MyDialog( wxWindow *parent, const wxString& title,
|
||||
|
||||
mainsizer->Add(flexgridsizer, 1, wxGROW | wxALL, 10);
|
||||
|
||||
mainsizer->Add(new wxRadioBox((wxWindow*)this, VALIDATE_RADIO, wxT("Pick a color"),
|
||||
mainsizer->Add(new wxRadioBox((wxWindow*)this, VALIDATE_RADIO, "Pick a color",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
3, g_radiobox_choices, 1, wxRA_SPECIFY_ROWS,
|
||||
wxGenericValidator(&g_data.m_radiobox_choice)),
|
||||
|
Reference in New Issue
Block a user