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

@@ -79,7 +79,7 @@ bool MyApp::OnInit()
return false;
// Create the main frame window
m_frame = new MyFrame(NULL, wxT("Client"));
m_frame = new MyFrame(NULL, "Client");
m_frame->Show(true);
return true;
@@ -101,11 +101,11 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(wxID_EXIT, wxT("&Quit\tCtrl-Q"));
file_menu->Append(wxID_EXIT, "&Quit\tCtrl-Q");
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File"));
menu_bar->Append(file_menu, "&File");
// Associate the menu bar with the frame
SetMenuBar(menu_bar);
@@ -116,15 +116,15 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
// add the controls to the frame
wxString strs4[] =
{
IPC_SERVICE, wxT("...")
IPC_SERVICE, "..."
};
wxString strs5[] =
{
IPC_HOST, wxT("...")
IPC_HOST, "..."
};
wxString strs6[] =
{
IPC_TOPIC, wxT("...")
IPC_TOPIC, "..."
};
wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
@@ -133,7 +133,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
wxGridSizer *item2 = new wxGridSizer( 4, 0, 0 );
wxButton *item3 = new wxButton( this, ID_START, wxT("Connect to server"), wxDefaultPosition, wxDefaultSize, 0 );
wxButton *item3 = new wxButton( this, ID_START, "Connect to server", wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxChoice *item5 = new wxChoice( this, ID_HOSTNAME, wxDefaultPosition, wxSize(100,-1), 2, strs5, 0 );
@@ -145,7 +145,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
wxChoice *item6 = new wxChoice( this, ID_TOPIC, wxDefaultPosition, wxSize(100,-1), 2, strs6, 0 );
item2->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item7 = new wxButton( this, ID_DISCONNECT, wxT("Disconnect "), wxDefaultPosition, wxDefaultSize, 0 );
wxButton *item7 = new wxButton( this, ID_DISCONNECT, "Disconnect ", wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
@@ -154,17 +154,17 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item8 = new wxButton( this, ID_STARTADVISE, wxT("StartAdvise"), wxDefaultPosition, wxDefaultSize, 0 );
wxButton *item8 = new wxButton( this, ID_STARTADVISE, "StartAdvise", wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxButton *item9 = new wxButton( this, ID_STOPADVISE, wxT("StopAdvise"), wxDefaultPosition, wxDefaultSize, 0 );
wxButton *item9 = new wxButton( this, ID_STOPADVISE, "StopAdvise", wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item10 = new wxButton( this, ID_EXECUTE, wxT("Execute"), wxDefaultPosition, wxDefaultSize, 0 );
wxButton *item10 = new wxButton( this, ID_EXECUTE, "Execute", wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
@@ -173,7 +173,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item11 = new wxButton( this, ID_POKE, wxT("Poke"), wxDefaultPosition, wxDefaultSize, 0 );
wxButton *item11 = new wxButton( this, ID_POKE, "Poke", wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
@@ -182,7 +182,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
wxButton *item12 = new wxButton( this, ID_REQUEST, wxT("Request"), wxDefaultPosition, wxDefaultSize, 0 );
wxButton *item12 = new wxButton( this, ID_REQUEST, "Request", wxDefaultPosition, wxDefaultSize, 0 );
item2->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
@@ -191,7 +191,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
item0->Add( item1, wxSizerFlags().Expand().Border(wxALL, 5) );
wxStaticBox *item14 = new wxStaticBox( this, -1, wxT("Client log") );
wxStaticBox *item14 = new wxStaticBox( this, -1, "Client log" );
wxStaticBoxSizer *item13 = new wxStaticBoxSizer( item14, wxVERTICAL );
wxTextCtrl *item15 = new wxTextCtrl( this, ID_LOG, wxEmptyString, wxDefaultPosition, wxSize(500,140), wxTE_MULTILINE );
@@ -209,7 +209,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
GetTopic()->SetSelection(0);
wxLogTextCtrl *logWindow = new wxLogTextCtrl(GetLog());
delete wxLog::SetActiveTarget(logWindow);
wxLogMessage(wxT("Click on Connect to connect to the server"));
wxLogMessage("Click on Connect to connect to the server");
EnableControls();
}
@@ -253,7 +253,7 @@ void MyFrame::OnStart(wxCommandEvent& WXUNUSED(event))
wxLogMessage(wxT("Client host=\"%s\" port=\"%s\" topic=\"%s\" %s"),
hostname.c_str(), servername.c_str(), topic.c_str(),
retval ? wxT("connected") : wxT("failed to connect"));
retval ? "connected" : "failed to connect");
if (!retval)
{
@@ -264,10 +264,10 @@ void MyFrame::OnStart(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnServername( wxCommandEvent& WXUNUSED(event) )
{
if (GetServername()->GetStringSelection() == wxT("..."))
if (GetServername()->GetStringSelection() == "...")
{
wxString s = wxGetTextFromUser(wxT("Specify the name of the server"),
wxT("Server Name"), wxEmptyString, this);
wxString s = wxGetTextFromUser("Specify the name of the server",
"Server Name", wxEmptyString, this);
if (!s.IsEmpty() && s != IPC_SERVICE)
{
GetServername()->Insert(s, 0);
@@ -278,10 +278,10 @@ void MyFrame::OnServername( wxCommandEvent& WXUNUSED(event) )
void MyFrame::OnHostname( wxCommandEvent& WXUNUSED(event) )
{
if (GetHostname()->GetStringSelection() == wxT("..."))
if (GetHostname()->GetStringSelection() == "...")
{
wxString s = wxGetTextFromUser(wxT("Specify the name of the host (ignored under DDE)"),
wxT("Host Name"), wxEmptyString, this);
wxString s = wxGetTextFromUser("Specify the name of the host (ignored under DDE)",
"Host Name", wxEmptyString, this);
if (!s.IsEmpty() && s != IPC_HOST)
{
GetHostname()->Insert(s, 0);
@@ -292,10 +292,10 @@ void MyFrame::OnHostname( wxCommandEvent& WXUNUSED(event) )
void MyFrame::OnTopic( wxCommandEvent& WXUNUSED(event) )
{
if (GetTopic()->GetStringSelection() == wxT("..."))
if (GetTopic()->GetStringSelection() == "...")
{
wxString s = wxGetTextFromUser(wxT("Specify the name of the topic"),
wxT("Topic Name"), wxEmptyString, this);
wxString s = wxGetTextFromUser("Specify the name of the topic",
"Topic Name", wxEmptyString, this);
if (!s.IsEmpty() && s != IPC_TOPIC)
{
GetTopic()->Insert(s, 0);
@@ -317,19 +317,19 @@ void MyFrame::Disconnect()
void MyFrame::OnStartAdvise(wxCommandEvent& WXUNUSED(event))
{
m_client->GetConnection()->StartAdvise(wxT("something"));
m_client->GetConnection()->StartAdvise("something");
}
void MyFrame::OnStopAdvise(wxCommandEvent& WXUNUSED(event))
{
m_client->GetConnection()->StopAdvise(wxT("something"));
m_client->GetConnection()->StopAdvise("something");
}
void MyFrame::OnExecute(wxCommandEvent& WXUNUSED(event))
{
if (m_client->IsConnected())
{
wxString s = wxT("Date");
wxString s = "Date";
m_client->GetConnection()->Execute(s);
m_client->GetConnection()->Execute((const char *)s.c_str(), s.length() + 1);
@@ -346,12 +346,12 @@ void MyFrame::OnPoke(wxCommandEvent& WXUNUSED(event))
if (m_client->IsConnected())
{
wxString s = wxDateTime::Now().Format();
m_client->GetConnection()->Poke(wxT("Date"), s);
s = wxDateTime::Now().FormatTime() + wxT(" ") + wxDateTime::Now().FormatDate();
m_client->GetConnection()->Poke(wxT("Date"), (const char *)s.c_str(), s.length() + 1);
m_client->GetConnection()->Poke("Date", s);
s = wxDateTime::Now().FormatTime() + " " + wxDateTime::Now().FormatDate();
m_client->GetConnection()->Poke("Date", (const char *)s.c_str(), s.length() + 1);
char bytes[3];
bytes[0] = '1'; bytes[1] = '2'; bytes[2] = '3';
m_client->GetConnection()->Poke(wxT("bytes[3]"), bytes, 3, wxIPC_PRIVATE);
m_client->GetConnection()->Poke("bytes[3]", bytes, 3, wxIPC_PRIVATE);
}
}
@@ -360,9 +360,9 @@ void MyFrame::OnRequest(wxCommandEvent& WXUNUSED(event))
if (m_client->IsConnected())
{
size_t size;
m_client->GetConnection()->Request(wxT("Date"));
m_client->GetConnection()->Request(wxT("Date+len"), &size);
m_client->GetConnection()->Request(wxT("bytes[3]"), &size, wxIPC_PRIVATE);
m_client->GetConnection()->Request("Date");
m_client->GetConnection()->Request("Date+len", &size);
m_client->GetConnection()->Request("bytes[3]", &size, wxIPC_PRIVATE);
}
}
@@ -395,7 +395,7 @@ void MyClient::Disconnect()
m_connection->Disconnect();
wxDELETE(m_connection);
wxGetApp().GetFrame()->EnableControls();
wxLogMessage(wxT("Client disconnected from server"));
wxLogMessage("Client disconnected from server");
}
}
@@ -411,24 +411,24 @@ MyClient::~MyClient()
bool MyConnection::OnAdvise(const wxString& topic, const wxString& item, const void *data,
size_t size, wxIPCFormat format)
{
Log(wxT("OnAdvise"), topic, item, data, size, format);
Log("OnAdvise", topic, item, data, size, format);
return true;
}
bool MyConnection::OnDisconnect()
{
wxLogMessage(wxT("OnDisconnect()"));
wxLogMessage("OnDisconnect()");
wxGetApp().GetFrame()->Disconnect();
return true;
}
bool MyConnection::DoExecute(const void *data, size_t size, wxIPCFormat format)
{
Log(wxT("Execute"), wxEmptyString, wxEmptyString, data, size, format);
Log("Execute", wxEmptyString, wxEmptyString, data, size, format);
bool retval = wxConnection::DoExecute(data, size, format);
if (!retval)
{
wxLogMessage(wxT("Execute failed!"));
wxLogMessage("Execute failed!");
}
return retval;
}
@@ -436,12 +436,12 @@ bool MyConnection::DoExecute(const void *data, size_t size, wxIPCFormat format)
const void *MyConnection::Request(const wxString& item, size_t *size, wxIPCFormat format)
{
const void *data = wxConnection::Request(item, size, format);
Log(wxT("Request"), wxEmptyString, item, data, size ? *size : wxNO_LEN, format);
Log("Request", wxEmptyString, item, data, size ? *size : wxNO_LEN, format);
return data;
}
bool MyConnection::DoPoke(const wxString& item, const void *data, size_t size, wxIPCFormat format)
{
Log(wxT("Poke"), wxEmptyString, item, data, size, format);
Log("Poke", wxEmptyString, item, data, size, format);
return wxConnection::DoPoke(item, data, size, format);
}