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:
Blake-Eryx
2018-09-23 01:15:08 +02:00
committed by Vadim Zeitlin
parent e768046774
commit f58ea62596
93 changed files with 4362 additions and 4358 deletions

View File

@@ -98,8 +98,8 @@ bool MyApp::OnInit()
// of the config file/registry key and must be set before the first call
// to Get() if you want to override the default values (the application
// name is the name of the executable and the vendor name is the same)
SetVendorName(wxT("wxWidgets"));
SetAppName(wxT("conftest")); // not needed, it's the default value
SetVendorName("wxWidgets");
SetAppName("conftest"); // not needed, it's the default value
wxConfigBase *pConfig = wxConfigBase::Get();
@@ -120,11 +120,11 @@ bool MyApp::OnInit()
frame->Show(true);
// use our config object...
if ( pConfig->Read(wxT("/Controls/Check"), 1l) != 0 ) {
wxMessageBox(wxT("You can disable this message box by unchecking\n")
wxT("the checkbox in the main window (of course, a real\n")
wxT("program would have a checkbox right here but we\n")
wxT("keep it simple)"), wxT("Welcome to wxConfig demo"),
if ( pConfig->Read("/Controls/Check", 1l) != 0 ) {
wxMessageBox("You can disable this message box by unchecking\n"
"the checkbox in the main window (of course, a real\n"
"program would have a checkbox right here but we\n"
"keep it simple)", "Welcome to wxConfig demo",
wxICON_INFORMATION | wxOK);
}
@@ -147,20 +147,20 @@ int MyApp::OnExit()
// main frame ctor
MyFrame::MyFrame()
: wxFrame((wxFrame *) NULL, wxID_ANY, wxT("wxConfig Demo"))
: wxFrame((wxFrame *) NULL, wxID_ANY, "wxConfig Demo")
{
SetIcon(wxICON(sample));
// menu
wxMenu *file_menu = new wxMenu;
file_menu->Append(wxID_DELETE, wxT("&Delete"), wxT("Delete config file"));
file_menu->Append(wxID_DELETE, "&Delete", "Delete config file");
file_menu->AppendSeparator();
file_menu->Append(wxID_ABOUT, wxT("&About\tF1"), wxT("About this sample"));
file_menu->Append(wxID_ABOUT, "&About\tF1", "About this sample");
file_menu->AppendSeparator();
file_menu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"), wxT("Exit the program"));
file_menu->Append(wxID_EXIT, "E&xit\tAlt-X", "Exit the program");
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File"));
menu_bar->Append(file_menu, "&File");
SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
@@ -169,9 +169,9 @@ MyFrame::MyFrame()
// child controls
wxPanel *panel = new wxPanel(this);
wxStaticText* st = new wxStaticText(panel, wxID_ANY, wxT("These controls remember their values!"));
wxStaticText* st = new wxStaticText(panel, wxID_ANY, "These controls remember their values!");
m_text = new wxTextCtrl(panel, wxID_ANY);
m_check = new wxCheckBox(panel, wxID_ANY, wxT("show welcome message box at startup"));
m_check = new wxCheckBox(panel, wxID_ANY, "show welcome message box at startup");
// put everything in a sizer
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
@@ -190,31 +190,31 @@ MyFrame::MyFrame()
wxConfigBase *pConfig = wxConfigBase::Get();
// we could write Read("/Controls/Text") as well, it's just to show SetPath()
pConfig->SetPath(wxT("/Controls"));
pConfig->SetPath("/Controls");
m_text->SetValue(pConfig->Read(wxT("Text"), wxT("")));
m_check->SetValue(pConfig->Read(wxT("Check"), 1l) != 0);
m_text->SetValue(pConfig->Read("Text", ""));
m_check->SetValue(pConfig->Read("Check", 1l) != 0);
// SetPath() understands ".."
pConfig->SetPath(wxT("../MainFrame"));
pConfig->SetPath("../MainFrame");
// restore frame position and size
int x = pConfig->Read(wxT("x"), 50),
y = pConfig->Read(wxT("y"), 50),
w = pConfig->Read(wxT("w"), 350),
h = pConfig->Read(wxT("h"), 200);
int x = pConfig->Read("x", 50),
y = pConfig->Read("y", 50),
w = pConfig->Read("w", 350),
h = pConfig->Read("h", 200);
Move(x, y);
SetClientSize(w, h);
pConfig->SetPath(wxT("/"));
pConfig->SetPath("/");
wxString s;
if ( pConfig->Read(wxT("TestValue"), &s) )
if ( pConfig->Read("TestValue", &s) )
{
wxLogStatus(this, wxT("TestValue from config is '%s'"), s.c_str());
wxLogStatus(this, "TestValue from config is '%s'", s.c_str());
}
else
{
wxLogStatus(this, wxT("TestValue not found in the config"));
wxLogStatus(this, "TestValue not found in the config");
}
}
@@ -225,7 +225,7 @@ void MyFrame::OnQuit(wxCommandEvent&)
void MyFrame::OnAbout(wxCommandEvent&)
{
wxMessageBox(wxT("wxConfig demo\n(c) 1998-2001 Vadim Zeitlin"), wxT("About"),
wxMessageBox("wxConfig demo\n(c) 1998-2001 Vadim Zeitlin", "About",
wxICON_INFORMATION | wxOK);
}
@@ -234,20 +234,20 @@ void MyFrame::OnDelete(wxCommandEvent&)
wxConfigBase *pConfig = wxConfigBase::Get();
if ( pConfig == NULL )
{
wxLogError(wxT("No config to delete!"));
wxLogError("No config to delete!");
return;
}
if ( pConfig->DeleteAll() )
{
wxLogMessage(wxT("Config file/registry key successfully deleted."));
wxLogMessage("Config file/registry key successfully deleted.");
delete wxConfigBase::Set(NULL);
wxConfigBase::DontCreateOnDemand();
}
else
{
wxLogError(wxT("Deleting config file/registry key failed."));
wxLogError("Deleting config file/registry key failed.");
}
}
@@ -258,18 +258,18 @@ MyFrame::~MyFrame()
return;
// save the control's values to the config
pConfig->Write(wxT("/Controls/Text"), m_text->GetValue());
pConfig->Write(wxT("/Controls/Check"), m_check->GetValue());
pConfig->Write("/Controls/Text", m_text->GetValue());
pConfig->Write("/Controls/Check", m_check->GetValue());
// save the frame position
int x, y, w, h;
GetClientSize(&w, &h);
GetPosition(&x, &y);
pConfig->Write(wxT("/MainFrame/x"), (long) x);
pConfig->Write(wxT("/MainFrame/y"), (long) y);
pConfig->Write(wxT("/MainFrame/w"), (long) w);
pConfig->Write(wxT("/MainFrame/h"), (long) h);
pConfig->Write("/MainFrame/x", (long) x);
pConfig->Write("/MainFrame/y", (long) y);
pConfig->Write("/MainFrame/w", (long) w);
pConfig->Write("/MainFrame/h", (long) h);
pConfig->Write(wxT("/TestValue"), wxT("A test value"));
pConfig->Write("/TestValue", "A test value");
}