Remove more wxT() macros from samples

Also use wxString instead of wxChar* strings.

Closes https://github.com/wxWidgets/wxWidgets/pull/950
This commit is contained in:
Blake Eryx
2018-09-28 21:45:15 -04:00
committed by Vadim Zeitlin
parent 480047ee9a
commit b70ed2d8c8
67 changed files with 1926 additions and 1932 deletions

View File

@@ -28,7 +28,7 @@
#include "artbrows.h" #include "artbrows.h"
#define ART_CLIENT(id) \ #define ART_CLIENT(id) \
choice->Append(wxT(#id), (void*)id); choice->Append(#id, (void*)id);
#define ART_ICON(id) \ #define ART_ICON(id) \
{ \ { \
int ind; \ int ind; \
@@ -37,7 +37,7 @@
ind = images->Add(icon); \ ind = images->Add(icon); \
else \ else \
ind = 0; \ ind = 0; \
list->InsertItem(index, wxT(#id), ind); \ list->InsertItem(index, #id, ind); \
list->SetItemPtrData(index, wxPtrToUInt(id)); \ list->SetItemPtrData(index, wxPtrToUInt(id)); \
index++; \ index++; \
} }

View File

@@ -944,7 +944,7 @@ void MyFrame::OnComboBoxUpdate( wxCommandEvent& event )
} }
else if ( event.GetEventType() == wxEVT_TEXT ) else if ( event.GetEventType() == wxEVT_TEXT )
{ {
wxLogDebug(wxT("EVT_TEXT(id=%i,string=\"%s\")"),event.GetId(),event.GetString().c_str()); wxLogDebug("EVT_TEXT(id=%i,string=\"%s\")",event.GetId(),event.GetString().c_str());
} }
else if ( event.GetEventType() == wxEVT_TEXT_ENTER ) else if ( event.GetEventType() == wxEVT_TEXT_ENTER )
{ {

View File

@@ -226,7 +226,7 @@ public:
virtual wxString GetColumnType( unsigned int col ) const wxOVERRIDE virtual wxString GetColumnType( unsigned int col ) const wxOVERRIDE
{ {
if (col == Col_Toggle) if (col == Col_Toggle)
return wxT( "bool" ); return "bool";
if (col == Col_IconText) if (col == Col_IconText)
return "wxDataViewIconText"; return "wxDataViewIconText";

View File

@@ -466,7 +466,7 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx)
} }
else else
{ {
wxLogMessage(wxT("Report generated in \"%s\"."), wxLogMessage("Report generated in \"%s\".",
report->GetCompressedFileName().c_str()); report->GetCompressedFileName().c_str());
report->Reset(); report->Reset();
} }

View File

@@ -631,7 +631,7 @@ public:
size_t WXUNUSED(len), const void *buf) wxOVERRIDE size_t WXUNUSED(len), const void *buf) wxOVERRIDE
{ {
wxCHECK_MSG( format == m_formatShape, false, wxCHECK_MSG( format == m_formatShape, false,
wxT( "unsupported format") ); "unsupported format");
delete m_shape; delete m_shape;
m_shape = DnDShape::New(buf); m_shape = DnDShape::New(buf);
@@ -1150,7 +1150,7 @@ void DnDFrame::OnDragMoveAllow(wxCommandEvent& event)
void DnDFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void DnDFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox("Drag-&-Drop Demo\n" wxMessageBox("Drag-&-Drop Demo\n"
wxT("Please see \"Help|Help...\" for details\n") "Please see \"Help|Help...\" for details\n"
"Copyright (c) 1998 Vadim Zeitlin", "Copyright (c) 1998 Vadim Zeitlin",
"About wxDnD", "About wxDnD",
wxICON_INFORMATION | wxOK, wxICON_INFORMATION | wxOK,
@@ -1175,11 +1175,11 @@ void DnDFrame::OnHelp(wxCommandEvent& /* event */)
"it to wordpad or any other droptarget accepting text (and of course you can just drag it\n" "it to wordpad or any other droptarget accepting text (and of course you can just drag it\n"
"to the right pane). Due to a lot of trace messages, the cursor might take some time to \n" "to the right pane). Due to a lot of trace messages, the cursor might take some time to \n"
"change, don't release the mouse button until it does. You can change the string being\n" "change, don't release the mouse button until it does. You can change the string being\n"
wxT("dragged in \"File|Test drag...\" dialog.\n") "dragged in \"File|Test drag...\" dialog.\n"
"\n" "\n"
"\n" "\n"
"Please send all questions/bug reports/suggestions &c to \n" "Please send all questions/bug reports/suggestions &c to \n"
wxT("Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>"), "Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>",
"wxDnD Help"); "wxDnD Help");
dialog.ShowModal(); dialog.ShowModal();
@@ -1199,18 +1199,18 @@ void DnDFrame::OnLogClear(wxCommandEvent& /* event */ )
void DnDFrame::LogDragResult(wxDragResult result) void DnDFrame::LogDragResult(wxDragResult result)
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
wxString pc; wxString msg;
switch ( result ) switch ( result )
{ {
case wxDragError: pc = "Error!"; break; case wxDragError: msg = "Error!"; break;
case wxDragNone: pc = "Nothing"; break; case wxDragNone: msg = "Nothing"; break;
case wxDragCopy: pc = "Copied"; break; case wxDragCopy: msg = "Copied"; break;
case wxDragMove: pc = "Moved"; break; case wxDragMove: msg = "Moved"; break;
case wxDragCancel: pc = "Cancelled"; break; case wxDragCancel: msg = "Cancelled"; break;
default: pc = "Huh?"; break; default: msg = "Huh?"; break;
} }
SetStatusText(wxString("Drag result: ") + pc); SetStatusText(wxString("Drag result: ") + msg);
#else #else
wxUnusedVar(result); wxUnusedVar(result);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -1294,9 +1294,9 @@ void DnDFrame::OnCopyBitmap(wxCommandEvent& WXUNUSED(event))
{ {
// PNG support is not always compiled in under Windows, so use BMP there // PNG support is not always compiled in under Windows, so use BMP there
#if wxUSE_LIBPNG #if wxUSE_LIBPNG
wxFileDialog dialog(this, "Open a PNG file", wxEmptyString, wxEmptyString, wxT("PNG files (*.png)|*.png"), 0); wxFileDialog dialog(this, "Open a PNG file", wxEmptyString, wxEmptyString, "PNG files (*.png)|*.png", 0);
#else #else
wxFileDialog dialog(this, "Open a BMP file", wxEmptyString, wxEmptyString, wxT("BMP files (*.bmp)|*.bmp"), 0); wxFileDialog dialog(this, "Open a BMP file", wxEmptyString, wxEmptyString, "BMP files (*.bmp)|*.bmp", 0);
#endif #endif
if (dialog.ShowModal() != wxID_OK) if (dialog.ShowModal() != wxID_OK)
@@ -1439,7 +1439,7 @@ void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event))
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
wxFileDialog dialog(this, "Select a file to copy", wxEmptyString, wxEmptyString, wxFileDialog dialog(this, "Select a file to copy", wxEmptyString, wxEmptyString,
wxT("All files (*.*)|*.*"), 0); "All files (*.*)|*.*", 0);
wxArrayString filenames; wxArrayString filenames;
while ( dialog.ShowModal() == wxID_OK ) while ( dialog.ShowModal() == wxID_OK )
@@ -1802,7 +1802,7 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event)
DnDShapeDataObject shapeData(m_shape); DnDShapeDataObject shapeData(m_shape);
wxDropSource source(shapeData, this); wxDropSource source(shapeData, this);
wxString pc; wxString msg;
switch ( source.DoDragDrop(true) ) switch ( source.DoDragDrop(true) )
{ {
default: default:
@@ -1817,11 +1817,11 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event)
break; break;
case wxDragCopy: case wxDragCopy:
pc = "copied"; msg = "copied";
break; break;
case wxDragMove: case wxDragMove:
pc = "moved"; msg = "moved";
if ( ms_lastDropTarget != this ) if ( ms_lastDropTarget != this )
{ {
// don't delete the shape if we dropped it on ourselves! // don't delete the shape if we dropped it on ourselves!
@@ -1836,10 +1836,10 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event)
break; break;
} }
if ( pc.length() ) if (msg.length() )
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxString("Shape successfully ") + pc); SetStatusText(wxString("Shape successfully ") + msg);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
//else: status text already set //else: status text already set

View File

@@ -464,7 +464,7 @@ bool MyFrame::ProcessEvent(wxEvent& event)
} }
catch ( const wxChar *msg ) catch ( const wxChar *msg )
{ {
wxLogMessage(wxT("Caught a string \"%s\" in MyFrame"), msg); wxLogMessage("Caught a string \"%s\" in MyFrame", msg);
return true; return true;
} }

View File

@@ -343,7 +343,7 @@ enum
Exec_Btn_Close Exec_Btn_Close
}; };
static wxString DIALOG_TITLE() static wxString GetDialogTitle()
{ {
return "Exec sample"; return "Exec sample";
} }
@@ -675,12 +675,11 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
wxArrayString errorText; const wxString errorText[] = { "", // no error
errorText.push_back(""); // no error "signal not supported",
errorText.push_back("signal not supported"); "permission denied",
errorText.push_back("permission denied"); "no such process",
errorText.push_back("no such process"); "unspecified error" };
errorText.push_back("unspecified error");
wxLogStatus("Failed to kill process %ld with signal %d: %s", wxLogStatus("Failed to kill process %ld with signal %d: %s",
pid, sig, errorText[rc]); pid, sig, errorText[rc]);
@@ -742,7 +741,7 @@ wxBEGIN_EVENT_TABLE(ExecQueryDialog, wxDialog)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
ExecQueryDialog::ExecQueryDialog(const wxString& cmd) ExecQueryDialog::ExecQueryDialog(const wxString& cmd)
: wxDialog(NULL, wxID_ANY, DIALOG_TITLE(), : wxDialog(NULL, wxID_ANY, GetDialogTitle(),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{ {
@@ -891,7 +890,7 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event))
{ {
wxString cmd = wxGetTextFromUser("Enter the command: ", wxString cmd = wxGetTextFromUser("Enter the command: ",
DIALOG_TITLE(), GetDialogTitle(),
m_cmdLast); m_cmdLast);
if ( !cmd ) if ( !cmd )
@@ -903,7 +902,7 @@ void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnShell(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnShell(wxCommandEvent& WXUNUSED(event))
{ {
wxString cmd = wxGetTextFromUser("Enter the command: ", wxString cmd = wxGetTextFromUser("Enter the command: ",
DIALOG_TITLE(), GetDialogTitle(),
m_cmdLast); m_cmdLast);
if ( !cmd ) if ( !cmd )
@@ -927,7 +926,7 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event))
} }
wxString cmd = wxGetTextFromUser("Enter the command: ", wxString cmd = wxGetTextFromUser("Enter the command: ",
DIALOG_TITLE(), GetDialogTitle(),
m_cmdLast); m_cmdLast);
if ( !cmd ) if ( !cmd )
@@ -989,14 +988,14 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
m_cmdLast = "tr [a-z] [A-Z]"; m_cmdLast = "tr [a-z] [A-Z]";
wxString cmd = wxGetTextFromUser("Enter the command: ", wxString cmd = wxGetTextFromUser("Enter the command: ",
DIALOG_TITLE(), GetDialogTitle(),
m_cmdLast); m_cmdLast);
if ( !cmd ) if ( !cmd )
return; return;
wxString input = wxGetTextFromUser("Enter the string to send to it: ", wxString input = wxGetTextFromUser("Enter the string to send to it: ",
DIALOG_TITLE()); GetDialogTitle());
if ( !input ) if ( !input )
return; return;
@@ -1022,7 +1021,7 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnPOpen(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPOpen(wxCommandEvent& WXUNUSED(event))
{ {
wxString cmd = wxGetTextFromUser("Enter the command to launch: ", wxString cmd = wxGetTextFromUser("Enter the command to launch: ",
DIALOG_TITLE(), GetDialogTitle(),
m_cmdLast); m_cmdLast);
if ( cmd.empty() ) if ( cmd.empty() )
return; return;
@@ -1174,7 +1173,7 @@ void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event))
if ( !wxLaunchDefaultBrowser(s_url) ) if ( !wxLaunchDefaultBrowser(s_url) )
{ {
wxLogError(wxT("Failed to open URL \"%s\""), s_url.c_str()); wxLogError("Failed to open URL \"%s\"", s_url.c_str());
} }
} }
@@ -1187,19 +1186,19 @@ void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event))
bool MyFrame::GetDDEServer() bool MyFrame::GetDDEServer()
{ {
wxString server = wxGetTextFromUser("Server to connect to:", wxString server = wxGetTextFromUser("Server to connect to:",
DIALOG_TITLE(), m_server); GetDialogTitle(), m_server);
if ( !server ) if ( !server )
return false; return false;
m_server = server; m_server = server;
wxString topic = wxGetTextFromUser("DDE topic:", DIALOG_TITLE(), m_topic); wxString topic = wxGetTextFromUser("DDE topic:", GetDialogTitle(), m_topic);
if ( !topic ) if ( !topic )
return false; return false;
m_topic = topic; m_topic = topic;
wxString cmd = wxGetTextFromUser("DDE command:", DIALOG_TITLE(), m_cmdDde); wxString cmd = wxGetTextFromUser("DDE command:", GetDialogTitle(), m_cmdDde);
if ( !cmd ) if ( !cmd )
return false; return false;

View File

@@ -45,7 +45,7 @@
#endif #endif
// used as title for several dialog boxes // used as title for several dialog boxes
static wxString SAMPLE_TITLE() static wxString GetSampleTitle()
{ {
return "wxWidgets Font Sample"; return "wxWidgets Font Sample";
} }
@@ -659,7 +659,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
n = wxGetSingleChoiceIndex n = wxGetSingleChoiceIndex
( (
"Choose a facename", "Choose a facename",
SAMPLE_TITLE(), GetSampleTitle(),
nFacenames, nFacenames,
facenames, facenames,
this this
@@ -713,7 +713,7 @@ void MyFrame::OnSetNativeDesc(wxCommandEvent& WXUNUSED(event))
font.SetNativeFontInfo(fontInfo); font.SetNativeFontInfo(fontInfo);
if ( !font.IsOk() ) if ( !font.IsOk() )
{ {
wxLogError(wxT("Font info string \"%s\" is invalid."), wxLogError("Font info string \"%s\" is invalid.",
fontInfo.c_str()); fontInfo.c_str());
return; return;
} }
@@ -807,7 +807,7 @@ wxFontEncoding MyFrame::GetEncodingFromUser()
int i = wxGetSingleChoiceIndex int i = wxGetSingleChoiceIndex
( (
"Choose the encoding", "Choose the encoding",
SAMPLE_TITLE(), GetSampleTitle(),
names, names,
this this
); );
@@ -837,7 +837,7 @@ wxFontFamily MyFrame::GetFamilyFromUser()
int i = wxGetSingleChoiceIndex int i = wxGetSingleChoiceIndex
( (
"Choose the family", "Choose the family",
SAMPLE_TITLE(), GetSampleTitle(),
names, names,
this this
); );
@@ -1088,10 +1088,10 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
{ {
// found! // found!
const wxChar *pc = line.c_str() + len; const wxChar *pc = line.c_str() + len;
if ( *pc == wxT('"') ) if ( *pc == '"')
pc++; pc++;
while ( *pc && *pc != wxT('"') ) while ( *pc && *pc != '"')
{ {
charset += *pc++; charset += *pc++;
} }
@@ -1165,7 +1165,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox("wxWidgets font sample\n" wxMessageBox("wxWidgets font sample\n"
"(c) 1999-2006 Vadim Zeitlin", "(c) 1999-2006 Vadim Zeitlin",
wxString("About ") + SAMPLE_TITLE(), wxString("About ") + GetSampleTitle(),
wxOK | wxICON_INFORMATION, this); wxOK | wxICON_INFORMATION, this);
} }

View File

@@ -1850,13 +1850,12 @@ void BugsGridTable::SetValueAsBool( int row, int col, bool value )
wxString BugsGridTable::GetColLabelValue( int col ) wxString BugsGridTable::GetColLabelValue( int col )
{ {
static wxArrayString headers; static const wxString headers[] = { "Id",
headers.push_back("Id"); "Summary",
headers.push_back("Summary"); "Severity",
headers.push_back("Severity"); "Priority",
headers.push_back("Priority"); "Platform",
headers.push_back("Platform"); "Opened?" };
headers.push_back("Opened?");
return headers[col]; return headers[col];
} }

View File

@@ -153,7 +153,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
#if wxUSE_GIF #if wxUSE_GIF
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.gif" )) ) if ( !image.LoadFile( dir + "horse.gif" ) )
{ {
wxLogError("Can't load GIF image"); wxLogError("Can't load GIF image");
} }

View File

@@ -397,8 +397,8 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
} }
else if ( num == 9 ) else if ( num == 9 )
{ {
// this message is not translated (not in catalog) because we used wxT() // this message is not translated (not in catalog) because we
// and not _() around it // did not put _() around it
str = "You've found a bug in this program!"; str = "You've found a bug in this program!";
} }
else if ( num == 17 ) else if ( num == 17 )

View File

@@ -251,7 +251,7 @@ void MyFrame::OnStart(wxCommandEvent& WXUNUSED(event))
m_client = new MyClient; m_client = new MyClient;
bool retval = m_client->Connect(hostname, servername, topic); bool retval = m_client->Connect(hostname, servername, topic);
wxLogMessage(wxT("Client host=\"%s\" port=\"%s\" topic=\"%s\" %s"), wxLogMessage("Client host=\"%s\" port=\"%s\" topic=\"%s\" %s",
hostname.c_str(), servername.c_str(), topic.c_str(), hostname.c_str(), servername.c_str(), topic.c_str(),
retval ? "connected" : "failed to connect"); retval ? "connected" : "failed to connect");

View File

@@ -368,7 +368,7 @@ MyFlexSizerFrame::MyFlexSizerFrame(wxFrame* parent)
sizerFlex->SetFlexibleDirection(wxHORIZONTAL); sizerFlex->SetFlexibleDirection(wxHORIZONTAL);
sizerCol2->Add(sizerFlex, 1, wxALL | wxEXPAND, 10); sizerCol2->Add(sizerFlex, 1, wxALL | wxEXPAND, 10);
sizerCol2->Add(new wxStaticText(p, wxID_ANY, wxT("Same with grow mode == \"none\"")), 0, wxCENTER | wxTOP, 20); sizerCol2->Add(new wxStaticText(p, wxID_ANY, "Same with grow mode == \"none\""), 0, wxCENTER | wxTOP, 20);
sizerFlex = new wxFlexGridSizer(3, 3, wxSize(5, 5)); sizerFlex = new wxFlexGridSizer(3, 3, wxSize(5, 5));
InitFlexSizer(sizerFlex, p); InitFlexSizer(sizerFlex, p);
sizerFlex->AddGrowableCol(1); sizerFlex->AddGrowableCol(1);
@@ -377,7 +377,7 @@ MyFlexSizerFrame::MyFlexSizerFrame(wxFrame* parent)
sizerFlex->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_NONE); sizerFlex->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_NONE);
sizerCol2->Add(sizerFlex, 1, wxALL | wxEXPAND, 10); sizerCol2->Add(sizerFlex, 1, wxALL | wxEXPAND, 10);
sizerCol2->Add(new wxStaticText(p, wxID_ANY, wxT("Same with grow mode == \"all\"")), 0, wxCENTER | wxTOP, 20); sizerCol2->Add(new wxStaticText(p, wxID_ANY, "Same with grow mode == \"all\""), 0, wxCENTER | wxTOP, 20);
sizerFlex = new wxFlexGridSizer(3, 3, wxSize(5, 5)); sizerFlex = new wxFlexGridSizer(3, 3, wxSize(5, 5));
InitFlexSizer(sizerFlex, p); InitFlexSizer(sizerFlex, p);
sizerFlex->AddGrowableCol(1); sizerFlex->AddGrowableCol(1);
@@ -441,15 +441,18 @@ MySizerDialog::MySizerDialog(wxWindow *parent, const wxString &title)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// some simple macros to help make the sample code below more clear // some simple macros to help make the sample code below more clear
#define TEXTCTRL(text) new wxTextCtrl(p, wxID_ANY, wxT(text)) #define TEXTCTRL(text) new wxTextCtrl(p, wxID_ANY, text)
#define MLTEXTCTRL(text) new wxTextCtrl(p, wxID_ANY, wxT(text), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE) #define MLTEXTCTRL(text) new wxTextCtrl(p, wxID_ANY, text, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE)
#define POS(r, c) wxGBPosition(r,c) #define POS(r, c) wxGBPosition(r,c)
#define SPAN(r, c) wxGBSpan(r,c) #define SPAN(r, c) wxGBSpan(r,c)
const wxChar gbsDescription[] =wxT("\ wxString GetGbsDescription()
The wxGridBagSizer is similar to the wxFlexGridSizer except the items are explicitly positioned\n\ {
in a virtual cell of the layout grid, and column or row spanning is allowed. For example, this\n\ return "\
static text is positioned at (0,0) and it spans 7 columns."); The wxGridBagSizer is similar to the wxFlexGridSizer except the items are explicitly positioned\n\
in a virtual cell of the layout grid, and column or row spanning is allowed. For example, this\n\
static text is positioned at (0,0) and it spans 7 columns.";
}
// Some IDs // Some IDs
@@ -479,7 +482,7 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(wxFrame* parent)
m_gbs = new wxGridBagSizer(); m_gbs = new wxGridBagSizer();
m_gbs->Add( new wxStaticText(p, wxID_ANY, gbsDescription), m_gbs->Add( new wxStaticText(p, wxID_ANY, GetGbsDescription()),
POS(0,0), SPAN(1, 7), POS(0,0), SPAN(1, 7),
wxALIGN_CENTER | wxALL, 5); wxALIGN_CENTER | wxALL, 5);
@@ -557,9 +560,9 @@ void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent& event)
{ {
if ( m_gbs->CheckForIntersection(wxGBPosition(3,6), wxGBSpan(1,1)) ) if ( m_gbs->CheckForIntersection(wxGBPosition(3,6), wxGBSpan(1,1)) )
wxMessageBox( wxMessageBox(
wxT("wxGridBagSizer will not allow items to be in the same cell as\n\ "wxGridBagSizer will not allow items to be in the same cell as\n\
another item, so this operation will fail. You will also get an assert\n\ another item, so this operation will fail. You will also get an assert\n\
when compiled in debug mode."), "Warning", wxOK | wxICON_INFORMATION); when compiled in debug mode.", "Warning", wxOK | wxICON_INFORMATION);
if ( m_gbs->SetItemPosition(btn, wxGBPosition(3,6)) ) if ( m_gbs->SetItemPosition(btn, wxGBPosition(3,6)) )
{ {

View File

@@ -95,7 +95,7 @@ bool MyApp::OnInit()
return false; return false;
// Create the main frame window // Create the main frame window
MyFrame *frame = new MyFrame(wxT("wxListCtrl Test")); MyFrame *frame = new MyFrame("wxListCtrl Test");
// Show the frame // Show the frame
frame->Show(true); frame->Show(true);
@@ -169,7 +169,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
// My frame constructor // My frame constructor
MyFrame::MyFrame(const wxChar *title) MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500)) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500))
{ {
m_listCtrl = NULL; m_listCtrl = NULL;
@@ -185,17 +185,17 @@ MyFrame::MyFrame(const wxChar *title)
m_imageListSmall = new wxImageList(16, 16, true); m_imageListSmall = new wxImageList(16, 16, true);
#ifdef wxHAS_IMAGES_IN_RESOURCES #ifdef wxHAS_IMAGES_IN_RESOURCES
m_imageListNormal->Add( wxIcon(wxT("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon("icon1", wxBITMAP_TYPE_ICO_RESOURCE) );
m_imageListNormal->Add( wxIcon(wxT("icon2"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon("icon2", wxBITMAP_TYPE_ICO_RESOURCE) );
m_imageListNormal->Add( wxIcon(wxT("icon3"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon("icon3", wxBITMAP_TYPE_ICO_RESOURCE) );
m_imageListNormal->Add( wxIcon(wxT("icon4"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon("icon4", wxBITMAP_TYPE_ICO_RESOURCE) );
m_imageListNormal->Add( wxIcon(wxT("icon5"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon("icon5", wxBITMAP_TYPE_ICO_RESOURCE) );
m_imageListNormal->Add( wxIcon(wxT("icon6"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon("icon6", wxBITMAP_TYPE_ICO_RESOURCE) );
m_imageListNormal->Add( wxIcon(wxT("icon7"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon("icon7", wxBITMAP_TYPE_ICO_RESOURCE) );
m_imageListNormal->Add( wxIcon(wxT("icon8"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon("icon8", wxBITMAP_TYPE_ICO_RESOURCE) );
m_imageListNormal->Add( wxIcon(wxT("icon9"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon("icon9", wxBITMAP_TYPE_ICO_RESOURCE) );
m_imageListSmall->Add( wxIcon(wxT("iconsmall"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListSmall->Add( wxIcon("iconsmall", wxBITMAP_TYPE_ICO_RESOURCE) );
#else #else
m_imageListNormal->Add( wxIcon( toolbrai_xpm ) ); m_imageListNormal->Add( wxIcon( toolbrai_xpm ) );
@@ -213,77 +213,77 @@ MyFrame::MyFrame(const wxChar *title)
// Make a menubar // Make a menubar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(LIST_ABOUT, wxT("&About")); menuFile->Append(LIST_ABOUT, "&About");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(LIST_QUIT, wxT("E&xit\tAlt-X")); menuFile->Append(LIST_QUIT, "E&xit\tAlt-X");
wxMenu *menuView = new wxMenu; wxMenu *menuView = new wxMenu;
menuView->Append(LIST_LIST_VIEW, wxT("&List view\tF1")); menuView->Append(LIST_LIST_VIEW, "&List view\tF1");
menuView->Append(LIST_REPORT_VIEW, wxT("&Report view\tF2")); menuView->Append(LIST_REPORT_VIEW, "&Report view\tF2");
menuView->Append(LIST_ICON_VIEW, wxT("&Icon view\tF3")); menuView->Append(LIST_ICON_VIEW, "&Icon view\tF3");
menuView->Append(LIST_ICON_TEXT_VIEW, wxT("Icon view with &text\tF4")); menuView->Append(LIST_ICON_TEXT_VIEW, "Icon view with &text\tF4");
menuView->Append(LIST_SMALL_ICON_VIEW, wxT("&Small icon view\tF5")); menuView->Append(LIST_SMALL_ICON_VIEW, "&Small icon view\tF5");
menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, wxT("Small icon &view with text\tF6")); menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, "Small icon &view with text\tF6");
menuView->Append(LIST_VIRTUAL_VIEW, wxT("&Virtual view\tF7")); menuView->Append(LIST_VIRTUAL_VIEW, "&Virtual view\tF7");
menuView->Append(LIST_SMALL_VIRTUAL_VIEW, wxT("Small virtual vie&w\tF8")); menuView->Append(LIST_SMALL_VIRTUAL_VIEW, "Small virtual vie&w\tF8");
menuView->AppendSeparator(); menuView->AppendSeparator();
menuView->Append(LIST_SET_ITEMS_COUNT, "Set &number of items"); menuView->Append(LIST_SET_ITEMS_COUNT, "Set &number of items");
#ifdef __WXOSX__ #ifdef __WXOSX__
menuView->AppendSeparator(); menuView->AppendSeparator();
menuView->AppendCheckItem(LIST_MAC_USE_GENERIC, wxT("Mac: Use Generic Control")); menuView->AppendCheckItem(LIST_MAC_USE_GENERIC, "Mac: Use Generic Control");
#endif #endif
wxMenu *menuList = new wxMenu; wxMenu *menuList = new wxMenu;
menuList->Append(LIST_GOTO, wxT("&Go to item #3\tCtrl-3")); menuList->Append(LIST_GOTO, "&Go to item #3\tCtrl-3");
menuList->Append(LIST_FOCUS_LAST, wxT("&Make last item current\tCtrl-L")); menuList->Append(LIST_FOCUS_LAST, "&Make last item current\tCtrl-L");
menuList->Append(LIST_TOGGLE_FIRST, wxT("To&ggle first item\tCtrl-G")); menuList->Append(LIST_TOGGLE_FIRST, "To&ggle first item\tCtrl-G");
menuList->Append(LIST_DESELECT_ALL, wxT("&Deselect All\tCtrl-D")); menuList->Append(LIST_DESELECT_ALL, "&Deselect All\tCtrl-D");
menuList->Append(LIST_SELECT_ALL, wxT("S&elect All\tCtrl-A")); menuList->Append(LIST_SELECT_ALL, "S&elect All\tCtrl-A");
menuList->AppendSeparator(); menuList->AppendSeparator();
menuList->Append(LIST_SHOW_COL_INFO, wxT("Show &column info\tCtrl-C")); menuList->Append(LIST_SHOW_COL_INFO, "Show &column info\tCtrl-C");
menuList->Append(LIST_SHOW_SEL_INFO, wxT("Show &selected items\tCtrl-S")); menuList->Append(LIST_SHOW_SEL_INFO, "Show &selected items\tCtrl-S");
menuList->Append(LIST_SHOW_VIEW_RECT, wxT("Show &view rect")); menuList->Append(LIST_SHOW_VIEW_RECT, "Show &view rect");
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER #ifdef wxHAS_LISTCTRL_COLUMN_ORDER
menuList->Append(LIST_SET_COL_ORDER, wxT("Se&t columns order\tShift-Ctrl-O")); menuList->Append(LIST_SET_COL_ORDER, "Se&t columns order\tShift-Ctrl-O");
menuList->Append(LIST_GET_COL_ORDER, wxT("Sho&w columns order\tCtrl-O")); menuList->Append(LIST_GET_COL_ORDER, "Sho&w columns order\tCtrl-O");
#endif // wxHAS_LISTCTRL_COLUMN_ORDER #endif // wxHAS_LISTCTRL_COLUMN_ORDER
menuList->AppendSeparator(); menuList->AppendSeparator();
menuList->Append(LIST_SORT, wxT("Sor&t\tCtrl-T")); menuList->Append(LIST_SORT, "Sor&t\tCtrl-T");
menuList->Append(LIST_FIND, "Test Find() performance"); menuList->Append(LIST_FIND, "Test Find() performance");
menuList->AppendSeparator(); menuList->AppendSeparator();
menuList->Append(LIST_ADD, wxT("&Append an item\tCtrl-P")); menuList->Append(LIST_ADD, "&Append an item\tCtrl-P");
menuList->Append(LIST_EDIT, wxT("&Edit the item\tCtrl-E")); menuList->Append(LIST_EDIT, "&Edit the item\tCtrl-E");
menuList->Append(LIST_DELETE, wxT("&Delete first item\tCtrl-X")); menuList->Append(LIST_DELETE, "&Delete first item\tCtrl-X");
menuList->Append(LIST_DELETE_ALL, wxT("Delete &all items")); menuList->Append(LIST_DELETE_ALL, "Delete &all items");
menuList->AppendSeparator(); menuList->AppendSeparator();
menuList->Append(LIST_FREEZE, wxT("Free&ze\tCtrl-Z")); menuList->Append(LIST_FREEZE, "Free&ze\tCtrl-Z");
menuList->Append(LIST_THAW, wxT("Tha&w\tCtrl-W")); menuList->Append(LIST_THAW, "Tha&w\tCtrl-W");
menuList->AppendSeparator(); menuList->AppendSeparator();
menuList->AppendCheckItem(LIST_TOGGLE_LINES, wxT("Toggle &lines\tCtrl-I")); menuList->AppendCheckItem(LIST_TOGGLE_LINES, "Toggle &lines\tCtrl-I");
menuList->AppendCheckItem(LIST_TOGGLE_MULTI_SEL, menuList->AppendCheckItem(LIST_TOGGLE_MULTI_SEL,
wxT("&Multiple selection\tCtrl-M")); "&Multiple selection\tCtrl-M");
menuList->Check(LIST_TOGGLE_MULTI_SEL, true); menuList->Check(LIST_TOGGLE_MULTI_SEL, true);
menuList->AppendCheckItem(LIST_TOGGLE_HEADER, "Toggle &header\tCtrl-H"); menuList->AppendCheckItem(LIST_TOGGLE_HEADER, "Toggle &header\tCtrl-H");
menuList->Check(LIST_TOGGLE_HEADER, true); menuList->Check(LIST_TOGGLE_HEADER, true);
menuList->AppendCheckItem(LIST_TOGGLE_BELL, "Toggle &bell on no match"); menuList->AppendCheckItem(LIST_TOGGLE_BELL, "Toggle &bell on no match");
menuList->AppendSeparator(); menuList->AppendSeparator();
menuList->AppendCheckItem(LIST_TOGGLE_CHECKBOXES, menuList->AppendCheckItem(LIST_TOGGLE_CHECKBOXES,
wxT("&Enable Checkboxes")); "&Enable Checkboxes");
menuList->Check(LIST_TOGGLE_CHECKBOXES, true); menuList->Check(LIST_TOGGLE_CHECKBOXES, true);
menuList->Append(LIST_TOGGLE_CHECKBOX, wxT("Toggle the item checkbox state")); menuList->Append(LIST_TOGGLE_CHECKBOX, "Toggle the item checkbox state");
menuList->Append(LIST_GET_CHECKBOX, wxT("Get the item checkbox state")); menuList->Append(LIST_GET_CHECKBOX, "Get the item checkbox state");
wxMenu *menuCol = new wxMenu; wxMenu *menuCol = new wxMenu;
menuCol->Append(LIST_SET_FG_COL, wxT("&Foreground colour...")); menuCol->Append(LIST_SET_FG_COL, "&Foreground colour...");
menuCol->Append(LIST_SET_BG_COL, wxT("&Background colour...")); menuCol->Append(LIST_SET_BG_COL, "&Background colour...");
menuCol->AppendCheckItem(LIST_ROW_LINES, wxT("Alternating colours")); menuCol->AppendCheckItem(LIST_ROW_LINES, "Alternating colours");
menuCol->AppendCheckItem(LIST_CUSTOM_HEADER_ATTR, "&Custom header attributes"); menuCol->AppendCheckItem(LIST_CUSTOM_HEADER_ATTR, "&Custom header attributes");
wxMenuBar *menubar = new wxMenuBar; wxMenuBar *menubar = new wxMenuBar;
menubar->Append(menuFile, wxT("&File")); menubar->Append(menuFile, "&File");
menubar->Append(menuView, wxT("&View")); menubar->Append(menuView, "&View");
menubar->Append(menuList, wxT("&List")); menubar->Append(menuList, "&List");
menubar->Append(menuCol, wxT("&Colour")); menubar->Append(menuCol, "&Colour");
SetMenuBar(menubar); SetMenuBar(menubar);
m_panel = new wxPanel(this, wxID_ANY); m_panel = new wxPanel(this, wxID_ANY);
@@ -327,7 +327,7 @@ bool MyFrame::CheckNonVirtual() const
return true; return true;
// "this" == whatever // "this" == whatever
wxLogWarning(wxT("Can't do this in virtual view, sorry.")); wxLogWarning("Can't do this in virtual view, sorry.");
return false; return false;
} }
@@ -339,22 +339,22 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageDialog dialog(this, wxT("List test sample\nJulian Smart (c) 1997"), wxMessageDialog dialog(this, "List test sample\nJulian Smart (c) 1997",
wxT("About list test")); "About list test");
dialog.ShowModal(); dialog.ShowModal();
} }
void MyFrame::OnFreeze(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnFreeze(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Freezing the control")); wxLogMessage("Freezing the control");
m_listCtrl->Freeze(); m_listCtrl->Freeze();
} }
void MyFrame::OnThaw(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnThaw(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Thawing the control")); wxLogMessage("Thawing the control");
m_listCtrl->Thaw(); m_listCtrl->Thaw();
} }
@@ -380,7 +380,7 @@ void MyFrame::OnToggleBell(wxCommandEvent& event)
void MyFrame::OnToggleMacUseGeneric(wxCommandEvent& event) void MyFrame::OnToggleMacUseGeneric(wxCommandEvent& event)
{ {
wxSystemOptions::SetOption(wxT("mac.listctrl.always_use_generic"), event.IsChecked()); wxSystemOptions::SetOption("mac.listctrl.always_use_generic", event.IsChecked());
} }
#endif // __WXOSX__ #endif // __WXOSX__
@@ -486,7 +486,7 @@ void MyFrame::RecreateList(long flags, bool withText)
break; break;
default: default:
wxFAIL_MSG( wxT("unknown listctrl mode") ); wxFAIL_MSG( "unknown listctrl mode" );
} }
wxMenuBar* const mb = GetMenuBar(); wxMenuBar* const mb = GetMenuBar();
@@ -508,7 +508,7 @@ void MyFrame::InitWithListItems()
{ {
for ( int i = 0; i < m_numListItems; i++ ) for ( int i = 0; i < m_numListItems; i++ )
{ {
m_listCtrl->InsertItem(i, wxString::Format(wxT("Item %d"), i)); m_listCtrl->InsertItem(i, wxString::Format("Item %d", i));
} }
} }
@@ -524,15 +524,15 @@ void MyFrame::InitWithReportItems()
// note that under MSW for SetColumnWidth() to work we need to create the // note that under MSW for SetColumnWidth() to work we need to create the
// items with images initially even if we specify dummy image id // items with images initially even if we specify dummy image id
wxListItem itemCol; wxListItem itemCol;
itemCol.SetText(wxT("Column 1")); itemCol.SetText("Column 1");
itemCol.SetImage(-1); itemCol.SetImage(-1);
m_listCtrl->InsertColumn(0, itemCol); m_listCtrl->InsertColumn(0, itemCol);
itemCol.SetText(wxT("Column 2 (auto size excluding header)")); itemCol.SetText("Column 2 (auto size excluding header)");
itemCol.SetAlign(wxLIST_FORMAT_CENTRE); itemCol.SetAlign(wxLIST_FORMAT_CENTRE);
m_listCtrl->InsertColumn(1, itemCol); m_listCtrl->InsertColumn(1, itemCol);
itemCol.SetText(wxT("Column 3 (auto size including header)")); itemCol.SetText("Column 3 (auto size including header)");
itemCol.SetAlign(wxLIST_FORMAT_RIGHT); itemCol.SetAlign(wxLIST_FORMAT_RIGHT);
m_listCtrl->InsertColumn(2, itemCol); m_listCtrl->InsertColumn(2, itemCol);
@@ -546,7 +546,7 @@ void MyFrame::InitWithReportItems()
m_listCtrl->InsertItemInReportView(i); m_listCtrl->InsertItemInReportView(i);
} }
m_logWindow->WriteText(wxString::Format(wxT("%d items inserted in %ldms\n"), m_logWindow->WriteText(wxString::Format("%d items inserted in %ldms\n",
m_numListItems, sw.Time())); m_numListItems, sw.Time()));
m_listCtrl->Show(); m_listCtrl->Show();
@@ -674,14 +674,14 @@ void MyFrame::InitWithVirtualItems()
if ( m_smallVirtual ) if ( m_smallVirtual )
{ {
m_listCtrl->AppendColumn(wxT("Animal")); m_listCtrl->AppendColumn("Animal");
m_listCtrl->AppendColumn(wxT("Sound")); m_listCtrl->AppendColumn("Sound");
m_listCtrl->SetItemCount(WXSIZEOF(SMALL_VIRTUAL_VIEW_ITEMS)); m_listCtrl->SetItemCount(WXSIZEOF(SMALL_VIRTUAL_VIEW_ITEMS));
} }
else else
{ {
m_listCtrl->AppendColumn(wxT("First Column (size auto)")); m_listCtrl->AppendColumn("First Column (size auto)");
m_listCtrl->AppendColumn(wxT("Second Column (150px)")); m_listCtrl->AppendColumn("Second Column (150px)");
m_listCtrl->SetItemCount(1000000); m_listCtrl->SetItemCount(1000000);
m_listCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER); m_listCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER);
m_listCtrl->SetColumnWidth(1, 150); m_listCtrl->SetColumnWidth(1, 150);
@@ -694,7 +694,7 @@ void MyFrame::OnSort(wxCommandEvent& WXUNUSED(event))
m_listCtrl->SortItems(MyCompareFunction, 0); m_listCtrl->SortItems(MyCompareFunction, 0);
m_logWindow->WriteText(wxString::Format(wxT("Sorting %d items took %ld ms\n"), m_logWindow->WriteText(wxString::Format("Sorting %d items took %ld ms\n",
m_listCtrl->GetItemCount(), m_listCtrl->GetItemCount(),
sw.Time())); sw.Time()));
} }
@@ -714,7 +714,7 @@ void MyFrame::OnFind(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnShowSelInfo(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnShowSelInfo(wxCommandEvent& WXUNUSED(event))
{ {
int selCount = m_listCtrl->GetSelectedItemCount(); int selCount = m_listCtrl->GetSelectedItemCount();
wxLogMessage(wxT("%d items selected:"), selCount); wxLogMessage("%d items selected:", selCount);
// don't show too many items // don't show too many items
size_t shownCount = 0; size_t shownCount = 0;
@@ -723,12 +723,12 @@ void MyFrame::OnShowSelInfo(wxCommandEvent& WXUNUSED(event))
wxLIST_STATE_SELECTED); wxLIST_STATE_SELECTED);
while ( item != -1 ) while ( item != -1 )
{ {
wxLogMessage(wxT("\t%ld (%s)"), wxLogMessage("\t%ld (%s)",
item, m_listCtrl->GetItemText(item).c_str()); item, m_listCtrl->GetItemText(item).c_str());
if ( ++shownCount > 10 ) if ( ++shownCount > 10 )
{ {
wxLogMessage(wxT("\t... more selected items snipped...")); wxLogMessage("\t... more selected items snipped...");
break; break;
} }
@@ -812,10 +812,10 @@ void MyFrame::OnGetColOrder(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnShowColInfo(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnShowColInfo(wxCommandEvent& WXUNUSED(event))
{ {
int count = m_listCtrl->GetColumnCount(); int count = m_listCtrl->GetColumnCount();
wxLogMessage(wxT("%d columns:"), count); wxLogMessage("%d columns:", count);
for ( int c = 0; c < count; c++ ) for ( int c = 0; c < count; c++ )
{ {
wxLogMessage(wxT("\tcolumn %d has width %d"), c, wxLogMessage("\tcolumn %d has width %d", c,
m_listCtrl->GetColumnWidth(c)); m_listCtrl->GetColumnWidth(c));
} }
} }
@@ -833,8 +833,8 @@ void MyFrame::OnToggleMultiSel(wxCommandEvent& WXUNUSED(event))
else else
flags |= wxLC_SINGLE_SEL; flags |= wxLC_SINGLE_SEL;
m_logWindow->WriteText(wxString::Format(wxT("Current selection mode: %sle\n"), m_logWindow->WriteText(wxString::Format("Current selection mode: %sle\n",
(flags & wxLC_SINGLE_SEL) ? wxT("sing") : wxT("multip"))); (flags & wxLC_SINGLE_SEL) ? "sing" : "multip"));
RecreateList(flags); RecreateList(flags);
} }
@@ -909,7 +909,7 @@ void MyFrame::OnCustomHeaderAttr(wxCommandEvent& event)
void MyFrame::OnAdd(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAdd(wxCommandEvent& WXUNUSED(event))
{ {
m_listCtrl->InsertItem(m_listCtrl->GetItemCount(), wxT("Appended item")); m_listCtrl->InsertItem(m_listCtrl->GetItemCount(), "Appended item");
} }
void MyFrame::OnEdit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnEdit(wxCommandEvent& WXUNUSED(event))
@@ -932,7 +932,7 @@ void MyFrame::OnEdit(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
m_logWindow->WriteText(wxT("No item to edit")); m_logWindow->WriteText("No item to edit");
} }
} }
} }
@@ -957,7 +957,7 @@ void MyFrame::OnGetItemCheckBox(wxCommandEvent& WXUNUSED(event))
{ {
bool checked = m_listCtrl->IsItemChecked(item); bool checked = m_listCtrl->IsItemChecked(item);
wxLogMessage(wxT("Item %ld is %s"), item, checked ? wxT("checked") : wxT("unchecked")); wxLogMessage("Item %ld is %s", item, checked ? "checked" : "unchecked");
item = m_listCtrl->GetNextItem(item, wxLIST_NEXT_ALL, item = m_listCtrl->GetNextItem(item, wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED); wxLIST_STATE_SELECTED);
@@ -972,7 +972,7 @@ void MyFrame::OnDelete(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
m_logWindow->WriteText(wxT("Nothing to delete")); m_logWindow->WriteText("Nothing to delete");
} }
} }
@@ -984,7 +984,7 @@ void MyFrame::OnDeleteAll(wxCommandEvent& WXUNUSED(event))
m_listCtrl->DeleteAllItems(); m_listCtrl->DeleteAllItems();
m_logWindow->WriteText(wxString::Format(wxT("Deleting %d items took %ld ms\n"), m_logWindow->WriteText(wxString::Format("Deleting %d items took %ld ms\n",
itemCount, itemCount,
sw.Time())); sw.Time()));
} }
@@ -1029,7 +1029,7 @@ wxEND_EVENT_TABLE()
void MyListCtrl::OnCacheHint(wxListEvent& event) void MyListCtrl::OnCacheHint(wxListEvent& event)
{ {
wxLogMessage( wxT("OnCacheHint: cache items %ld..%ld"), wxLogMessage( "OnCacheHint: cache items %ld..%ld",
event.GetCacheFrom(), event.GetCacheTo() ); event.GetCacheFrom(), event.GetCacheTo() );
} }
@@ -1050,7 +1050,7 @@ void MyListCtrl::OnColClick(wxListEvent& event)
x = !x; x = !x;
SetColumnImage(col, x ? 0 : -1); SetColumnImage(col, x ? 0 : -1);
wxLogMessage( wxT("OnColumnClick at %d."), col ); wxLogMessage( "OnColumnClick at %d.", col );
} }
void MyListCtrl::OnColRightClick(wxListEvent& event) void MyListCtrl::OnColRightClick(wxListEvent& event)
@@ -1062,18 +1062,18 @@ void MyListCtrl::OnColRightClick(wxListEvent& event)
} }
// Show popupmenu at position // Show popupmenu at position
wxMenu menu(wxT("Test")); wxMenu menu("Test");
menu.Append(LIST_ABOUT, wxT("&About")); menu.Append(LIST_ABOUT, "&About");
PopupMenu(&menu, event.GetPoint()); PopupMenu(&menu, event.GetPoint());
wxLogMessage( wxT("OnColumnRightClick at %d."), event.GetColumn() ); wxLogMessage( "OnColumnRightClick at %d.", event.GetColumn() );
} }
void MyListCtrl::LogColEvent(const wxListEvent& event, const wxChar *name) void MyListCtrl::LogColEvent(const wxListEvent& event, const wxString& name)
{ {
const int col = event.GetColumn(); const int col = event.GetColumn();
wxLogMessage(wxT("%s: column %d (width = %d or %d)."), wxLogMessage("%s: column %d (width = %d or %d).",
name, name,
col, col,
event.GetItem().GetWidth(), event.GetItem().GetWidth(),
@@ -1082,11 +1082,11 @@ void MyListCtrl::LogColEvent(const wxListEvent& event, const wxChar *name)
void MyListCtrl::OnColBeginDrag(wxListEvent& event) void MyListCtrl::OnColBeginDrag(wxListEvent& event)
{ {
LogColEvent( event, wxT("OnColBeginDrag") ); LogColEvent( event, "OnColBeginDrag" );
if ( event.GetColumn() == 0 ) if ( event.GetColumn() == 0 )
{ {
wxLogMessage(wxT("Resizing this column shouldn't work.")); wxLogMessage("Resizing this column shouldn't work.");
event.Veto(); event.Veto();
} }
@@ -1094,12 +1094,12 @@ void MyListCtrl::OnColBeginDrag(wxListEvent& event)
void MyListCtrl::OnColDragging(wxListEvent& event) void MyListCtrl::OnColDragging(wxListEvent& event)
{ {
LogColEvent( event, wxT("OnColDragging") ); LogColEvent( event, "OnColDragging" );
} }
void MyListCtrl::OnColEndDrag(wxListEvent& event) void MyListCtrl::OnColEndDrag(wxListEvent& event)
{ {
LogColEvent( event, wxT("OnColEndDrag") ); LogColEvent( event, "OnColEndDrag" );
} }
void MyListCtrl::OnBeginDrag(wxListEvent& event) void MyListCtrl::OnBeginDrag(wxListEvent& event)
@@ -1107,19 +1107,19 @@ void MyListCtrl::OnBeginDrag(wxListEvent& event)
const wxPoint& pt = event.m_pointDrag; const wxPoint& pt = event.m_pointDrag;
int flags; int flags;
wxLogMessage( wxT("OnBeginDrag at (%d, %d), item %ld."), wxLogMessage( "OnBeginDrag at (%d, %d), item %ld.",
pt.x, pt.y, HitTest(pt, flags) ); pt.x, pt.y, HitTest(pt, flags) );
} }
void MyListCtrl::OnBeginRDrag(wxListEvent& event) void MyListCtrl::OnBeginRDrag(wxListEvent& event)
{ {
wxLogMessage( wxT("OnBeginRDrag at %d,%d."), wxLogMessage( "OnBeginRDrag at %d,%d.",
event.m_pointDrag.x, event.m_pointDrag.y ); event.m_pointDrag.x, event.m_pointDrag.y );
} }
void MyListCtrl::OnBeginLabelEdit(wxListEvent& event) void MyListCtrl::OnBeginLabelEdit(wxListEvent& event)
{ {
wxLogMessage( wxT("OnBeginLabelEdit: %s"), event.m_item.m_text.c_str()); wxLogMessage( "OnBeginLabelEdit: %s", event.m_item.m_text.c_str());
wxTextCtrl * const text = GetEditControl(); wxTextCtrl * const text = GetEditControl();
if ( !text ) if ( !text )
@@ -1134,7 +1134,7 @@ void MyListCtrl::OnBeginLabelEdit(wxListEvent& event)
void MyListCtrl::OnEndLabelEdit(wxListEvent& event) void MyListCtrl::OnEndLabelEdit(wxListEvent& event)
{ {
wxLogMessage( wxT("OnEndLabelEdit: %s"), wxLogMessage( "OnEndLabelEdit: %s",
( (
event.IsEditCancelled() ? event.IsEditCancelled() ?
wxString("[cancelled]") : wxString("[cancelled]") :
@@ -1145,18 +1145,18 @@ void MyListCtrl::OnEndLabelEdit(wxListEvent& event)
void MyListCtrl::OnDeleteItem(wxListEvent& event) void MyListCtrl::OnDeleteItem(wxListEvent& event)
{ {
LogEvent(event, wxT("OnDeleteItem")); LogEvent(event, "OnDeleteItem");
wxLogMessage( wxT("Number of items when delete event is sent: %d"), GetItemCount() ); wxLogMessage( "Number of items when delete event is sent: %d", GetItemCount() );
} }
void MyListCtrl::OnDeleteAllItems(wxListEvent& event) void MyListCtrl::OnDeleteAllItems(wxListEvent& event)
{ {
LogEvent(event, wxT("OnDeleteAllItems")); LogEvent(event, "OnDeleteAllItems");
} }
void MyListCtrl::OnSelected(wxListEvent& event) void MyListCtrl::OnSelected(wxListEvent& event)
{ {
LogEvent(event, wxT("OnSelected")); LogEvent(event, "OnSelected");
if ( GetWindowStyle() & wxLC_REPORT ) if ( GetWindowStyle() & wxLC_REPORT )
{ {
@@ -1166,50 +1166,50 @@ void MyListCtrl::OnSelected(wxListEvent& event)
info.m_mask = wxLIST_MASK_TEXT; info.m_mask = wxLIST_MASK_TEXT;
if ( GetItem(info) ) if ( GetItem(info) )
{ {
wxLogMessage(wxT("Value of the 2nd field of the selected item: %s"), wxLogMessage("Value of the 2nd field of the selected item: %s",
info.m_text.c_str()); info.m_text.c_str());
} }
else else
{ {
wxFAIL_MSG(wxT("wxListCtrl::GetItem() failed")); wxFAIL_MSG("wxListCtrl::GetItem() failed");
} }
} }
} }
void MyListCtrl::OnDeselected(wxListEvent& event) void MyListCtrl::OnDeselected(wxListEvent& event)
{ {
LogEvent(event, wxT("OnDeselected")); LogEvent(event, "OnDeselected");
} }
void MyListCtrl::OnActivated(wxListEvent& event) void MyListCtrl::OnActivated(wxListEvent& event)
{ {
LogEvent(event, wxT("OnActivated")); LogEvent(event, "OnActivated");
} }
void MyListCtrl::OnFocused(wxListEvent& event) void MyListCtrl::OnFocused(wxListEvent& event)
{ {
LogEvent(event, wxT("OnFocused")); LogEvent(event, "OnFocused");
event.Skip(); event.Skip();
} }
void MyListCtrl::OnItemRightClick(wxListEvent& event) void MyListCtrl::OnItemRightClick(wxListEvent& event)
{ {
LogEvent(event, wxT("OnItemRightClick")); LogEvent(event, "OnItemRightClick");
event.Skip(); event.Skip();
} }
void MyListCtrl::OnChecked(wxListEvent& event) void MyListCtrl::OnChecked(wxListEvent& event)
{ {
LogEvent(event, wxT("OnChecked")); LogEvent(event, "OnChecked");
event.Skip(); event.Skip();
} }
void MyListCtrl::OnUnChecked(wxListEvent& event) void MyListCtrl::OnUnChecked(wxListEvent& event)
{ {
LogEvent(event, wxT("OnUnChecked")); LogEvent(event, "OnUnChecked");
event.Skip(); event.Skip();
} }
@@ -1220,7 +1220,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
if ( !wxGetKeyState(WXK_SHIFT) ) if ( !wxGetKeyState(WXK_SHIFT) )
{ {
LogEvent(event, wxT("OnListKeyDown")); LogEvent(event, "OnListKeyDown");
event.Skip(); event.Skip();
return; return;
} }
@@ -1258,7 +1258,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
item = 0; item = 0;
} }
wxLogMessage(wxT("Focusing item %ld"), item); wxLogMessage("Focusing item %ld", item);
SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
EnsureVisible(item); EnsureVisible(item);
@@ -1270,11 +1270,11 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
wxRect r; wxRect r;
if ( !GetItemRect(item, r) ) if ( !GetItemRect(item, r) )
{ {
wxLogError(wxT("Failed to retrieve rect of item %ld"), item); wxLogError("Failed to retrieve rect of item %ld", item);
break; break;
} }
wxLogMessage(wxT("Bounding rect of item %ld is (%d, %d)-(%d, %d)"), wxLogMessage("Bounding rect of item %ld is (%d, %d)-(%d, %d)",
item, r.x, r.y, r.x + r.width, r.y + r.height); item, r.x, r.y, r.x + r.width, r.y + r.height);
} }
break; break;
@@ -1297,11 +1297,11 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
if ( !GetSubItemRect(item, subItem, r, code) ) if ( !GetSubItemRect(item, subItem, r, code) )
{ {
wxLogError(wxT("Failed to retrieve rect of item %ld column %d"), item, subItem + 1); wxLogError("Failed to retrieve rect of item %ld column %d", item, subItem + 1);
break; break;
} }
wxLogMessage(wxT("Bounding rect of item %ld column %d is (%d, %d)-(%d, %d)"), wxLogMessage("Bounding rect of item %ld column %d is (%d, %d)-(%d, %d)",
item, subItem + 1, item, subItem + 1,
r.x, r.y, r.x + r.width, r.y + r.height); r.x, r.y, r.x + r.width, r.y + r.height);
} }
@@ -1333,7 +1333,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
{ {
DeleteItem(item); DeleteItem(item);
wxLogMessage(wxT("Item %ld deleted"), item); wxLogMessage("Item %ld deleted", item);
// -1 because the indices were shifted by DeleteItem() // -1 because the indices were shifted by DeleteItem()
item = GetNextItem(item - 1, item = GetNextItem(item - 1,
@@ -1357,7 +1357,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
wxFALLTHROUGH; wxFALLTHROUGH;
default: default:
LogEvent(event, wxT("OnListKeyDown")); LogEvent(event, "OnListKeyDown");
event.Skip(); event.Skip();
} }
@@ -1365,7 +1365,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
void MyListCtrl::OnChar(wxKeyEvent& event) void MyListCtrl::OnChar(wxKeyEvent& event)
{ {
wxLogMessage(wxT("Got char event.")); wxLogMessage("Got char event.");
event.Skip(); event.Skip();
} }
@@ -1385,24 +1385,24 @@ void MyListCtrl::OnRightClick(wxMouseEvent& event)
wxString where; wxString where;
switch ( flags ) switch ( flags )
{ {
case wxLIST_HITTEST_ABOVE: where = wxT("above"); break; case wxLIST_HITTEST_ABOVE: where = "above"; break;
case wxLIST_HITTEST_BELOW: where = wxT("below"); break; case wxLIST_HITTEST_BELOW: where = "below"; break;
case wxLIST_HITTEST_NOWHERE: where = wxT("nowhere near"); break; case wxLIST_HITTEST_NOWHERE: where = "nowhere near"; break;
case wxLIST_HITTEST_ONITEMICON: where = wxT("on icon of"); break; case wxLIST_HITTEST_ONITEMICON: where = "on icon of"; break;
case wxLIST_HITTEST_ONITEMLABEL: where = wxT("on label of"); break; case wxLIST_HITTEST_ONITEMLABEL: where = "on label of"; break;
case wxLIST_HITTEST_ONITEMRIGHT: where = wxT("right on"); break; case wxLIST_HITTEST_ONITEMRIGHT: where = "right on"; break;
case wxLIST_HITTEST_TOLEFT: where = wxT("to the left of"); break; case wxLIST_HITTEST_TOLEFT: where = "to the left of"; break;
case wxLIST_HITTEST_TORIGHT: where = wxT("to the right of"); break; case wxLIST_HITTEST_TORIGHT: where = "to the right of"; break;
default: where = wxT("not clear exactly where on"); break; default: where = "not clear exactly where on"; break;
} }
wxLogMessage(wxT("Right double click %s item %ld, subitem %ld"), wxLogMessage("Right double click %s item %ld, subitem %ld",
where.c_str(), item, subitem); where.c_str(), item, subitem);
} }
void MyListCtrl::LogEvent(const wxListEvent& event, const wxChar *eventName) void MyListCtrl::LogEvent(const wxListEvent& event, const wxString& eventName)
{ {
wxLogMessage(wxT("Item %ld: %s (item text = %s, data = %ld)"), wxLogMessage("Item %ld: %s (item text = %s, data = %ld)",
event.GetIndex(), eventName, event.GetIndex(), eventName,
event.GetText(), static_cast<long>(event.GetData())); event.GetText(), static_cast<long>(event.GetData()));
} }
@@ -1415,7 +1415,7 @@ wxString MyListCtrl::OnGetItemText(long item, long column) const
} }
else // "big" virtual control else // "big" virtual control
{ {
return wxString::Format(wxT("Column %ld of item %ld"), column, item); return wxString::Format("Column %ld of item %ld", column, item);
} }
} }
@@ -1446,14 +1446,14 @@ wxItemAttr *MyListCtrl::OnGetItemAttr(long item) const
void MyListCtrl::InsertItemInReportView(int i) void MyListCtrl::InsertItemInReportView(int i)
{ {
wxString buf; wxString buf;
buf.Printf(wxT("This is item %d"), i); buf.Printf("This is item %d", i);
long tmp = InsertItem(i, buf, 0); long tmp = InsertItem(i, buf, 0);
SetItemData(tmp, i); SetItemData(tmp, i);
buf.Printf(wxT("Col 1, item %d"), i); buf.Printf("Col 1, item %d", i);
SetItem(tmp, 1, buf); SetItem(tmp, 1, buf);
buf.Printf(wxT("Item %d in column 2"), i); buf.Printf("Item %d in column 2", i);
SetItem(tmp, 2, buf); SetItem(tmp, 2, buf);
} }
@@ -1490,9 +1490,9 @@ void MyListCtrl::ShowContextMenu(const wxPoint& pos)
{ {
wxMenu menu; wxMenu menu;
menu.Append(wxID_ABOUT, wxT("&About")); menu.Append(wxID_ABOUT, "&About");
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append(wxID_EXIT, wxT("E&xit")); menu.Append(wxID_EXIT, "E&xit");
PopupMenu(&menu, pos.x, pos.y); PopupMenu(&menu, pos.x, pos.y);
} }

View File

@@ -79,8 +79,8 @@ private:
wxLog *m_logOld; wxLog *m_logOld;
void SetColumnImage(int col, int image); void SetColumnImage(int col, int image);
void LogEvent(const wxListEvent& event, const wxChar *eventName); void LogEvent(const wxListEvent& event, const wxString& eventName);
void LogColEvent(const wxListEvent& event, const wxChar *eventName); void LogColEvent(const wxListEvent& event, const wxString& eventName);
virtual wxString OnGetItemText(long item, long column) const wxOVERRIDE; virtual wxString OnGetItemText(long item, long column) const wxOVERRIDE;
virtual int OnGetItemColumnImage(long item, long column) const wxOVERRIDE; virtual int OnGetItemColumnImage(long item, long column) const wxOVERRIDE;
@@ -97,7 +97,7 @@ private:
class MyFrame: public wxFrame class MyFrame: public wxFrame
{ {
public: public:
MyFrame(const wxChar *title); MyFrame(const wxString& title);
virtual ~MyFrame(); virtual ~MyFrame();
protected: protected:

View File

@@ -674,9 +674,9 @@ MyFrame::MyFrame()
wxLog::DisableTimestamp(); wxLog::DisableTimestamp();
m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_textctrl)); m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_textctrl));
wxLogMessage(wxT("Brief explanations: the commands in the \"Menu\" menu ") wxLogMessage("Brief explanations: the commands in the \"Menu\" menu "
wxT("append/insert/delete items to/from the \"Test\" menu.\n") "append/insert/delete items to/from the \"Test\" menu.\n"
wxT("The commands in the \"Menubar\" menu work with the ") "The commands in the \"Menubar\" menu work with the "
"menubar itself.\n\n" "menubar itself.\n\n"
"Right click the band below to test popup menus.\n"); "Right click the band below to test popup menus.\n");
#endif #endif

View File

@@ -70,7 +70,7 @@ wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent)
wxPanel *panel = new wxPanel(parent); wxPanel *panel = new wxPanel(parent);
#if wxUSE_HELP #if wxUSE_HELP
panel->SetHelpText( wxT( "Panel with a Button" ) ); panel->SetHelpText("Panel with a Button");
#endif #endif
(void) new wxButton( panel, wxID_ANY, "Button", (void) new wxButton( panel, wxID_ANY, "Button",
@@ -84,7 +84,7 @@ wxPanel *CreateRadioButtonsPage(wxBookCtrlBase *parent)
wxPanel *panel = new wxPanel(parent); wxPanel *panel = new wxPanel(parent);
#if wxUSE_HELP #if wxUSE_HELP
panel->SetHelpText( wxT( "Panel with some Radio Buttons" ) ); panel->SetHelpText("Panel with some Radio Buttons");
#endif #endif
wxString animals[] = wxString animals[] =
@@ -115,7 +115,7 @@ wxPanel *CreateVetoPage(wxBookCtrlBase *parent)
wxPanel *panel = new wxPanel(parent); wxPanel *panel = new wxPanel(parent);
#if wxUSE_HELP #if wxUSE_HELP
panel->SetHelpText( wxT( "An empty panel" ) ); panel->SetHelpText("An empty panel");
#endif #endif
(void) new wxStaticText( panel, wxID_ANY, (void) new wxStaticText( panel, wxID_ANY,
@@ -130,7 +130,7 @@ wxPanel *CreateBigButtonPage(wxBookCtrlBase *parent)
wxPanel *panel = new wxPanel(parent); wxPanel *panel = new wxPanel(parent);
#if wxUSE_HELP #if wxUSE_HELP
panel->SetHelpText( wxT( "Panel with a maximized button" ) ); panel->SetHelpText("Panel with a maximized button");
#endif #endif
wxButton *buttonBig = new wxButton(panel, wxID_ANY, "Maximized button"); wxButton *buttonBig = new wxButton(panel, wxID_ANY, "Maximized button");
@@ -147,7 +147,7 @@ wxPanel *CreateInsertPage(wxBookCtrlBase *parent)
wxPanel *panel = new wxPanel(parent); wxPanel *panel = new wxPanel(parent);
#if wxUSE_HELP #if wxUSE_HELP
panel->SetHelpText( wxT( "Maroon panel" ) ); panel->SetHelpText("Maroon panel");
#endif #endif
panel->SetBackgroundColour( wxColour( "MAROON" ) ); panel->SetBackgroundColour( wxColour( "MAROON" ) );
@@ -642,7 +642,7 @@ wxPanel *MyFrame::CreateNewPage() const
wxPanel *panel = new wxPanel(m_bookCtrl, wxID_ANY ); wxPanel *panel = new wxPanel(m_bookCtrl, wxID_ANY );
#if wxUSE_HELP #if wxUSE_HELP
panel->SetHelpText( wxT( "Panel with \"First\" and \"Second\" buttons" ) ); panel->SetHelpText("Panel with \"First\" and \"Second\" buttons");
#endif #endif
(void) new wxButton(panel, wxID_ANY, "First button", wxPoint(10, 30)); (void) new wxButton(panel, wxID_ANY, "First button", wxPoint(10, 30));

File diff suppressed because it is too large Load Diff

View File

@@ -38,12 +38,12 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyFrame::MyFrame(wxWindow* parent) MyFrame::MyFrame(wxWindow* parent)
: wxFrame(parent, wxID_ANY, wxT("PropertyGrid Test")) : wxFrame(parent, wxID_ANY, "PropertyGrid Test")
{ {
wxMenu *Menu = new wxMenu; wxMenu *Menu = new wxMenu;
Menu->Append(ID_ACTION, wxT("Action")); Menu->Append(ID_ACTION, "Action");
wxMenuBar *MenuBar = new wxMenuBar(); wxMenuBar *MenuBar = new wxMenuBar();
MenuBar->Append(Menu, wxT("Action")); MenuBar->Append(Menu, "Action");
SetMenuBar(MenuBar); SetMenuBar(MenuBar);
wxPropertyGrid *pg = new wxPropertyGrid(this,wxID_ANY,wxDefaultPosition,wxSize(400,400), wxPropertyGrid *pg = new wxPropertyGrid(this,wxID_ANY,wxDefaultPosition,wxSize(400,400),
@@ -51,9 +51,9 @@ MyFrame::MyFrame(wxWindow* parent)
wxPG_BOLD_MODIFIED ); wxPG_BOLD_MODIFIED );
m_pg = pg; m_pg = pg;
pg->Append( new wxStringProperty(wxT("String Property"), wxPG_LABEL) ); pg->Append( new wxStringProperty("String Property", wxPG_LABEL) );
pg->Append( new wxIntProperty(wxT("Int Property"), wxPG_LABEL) ); pg->Append( new wxIntProperty("Int Property", wxPG_LABEL) );
pg->Append( new wxBoolProperty(wxT("Bool Property"), wxPG_LABEL) ); pg->Append( new wxBoolProperty("Bool Property", wxPG_LABEL) );
SetSize(400, 600); SetSize(400, 600);
} }
@@ -64,12 +64,12 @@ void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event)
if ( p ) if ( p )
{ {
wxLogVerbose(wxT("OnPropertyGridChange(%s, value=%s)"), wxLogVerbose("OnPropertyGridChange(%s, value=%s)",
p->GetName().c_str(), p->GetValueAsString().c_str()); p->GetName().c_str(), p->GetValueAsString().c_str());
} }
else else
{ {
wxLogVerbose(wxT("OnPropertyGridChange(NULL)")); wxLogVerbose("OnPropertyGridChange(NULL)");
} }
} }
@@ -77,7 +77,7 @@ void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent &event)
{ {
wxPGProperty* p = event.GetProperty(); wxPGProperty* p = event.GetProperty();
wxLogVerbose(wxT("OnPropertyGridChanging(%s)"), p->GetName().c_str()); wxLogVerbose("OnPropertyGridChanging(%s)", p->GetName().c_str());
} }
void MyFrame::OnAction(wxCommandEvent &) void MyFrame::OnAction(wxCommandEvent &)

View File

@@ -69,7 +69,7 @@ wxFontDataProperty::wxFontDataProperty( const wxString& label, const wxString& n
m_value_wxFontData << fontData; m_value_wxFontData << fontData;
// Add extra children. // Add extra children.
AddPrivateChild( new wxColourProperty(wxT("Colour"), wxPG_LABEL, AddPrivateChild( new wxColourProperty("Colour", wxPG_LABEL,
fontData.GetColour() ) ); fontData.GetColour() ) );
} }
@@ -77,9 +77,9 @@ wxFontDataProperty::~wxFontDataProperty () { }
void wxFontDataProperty::OnSetValue() void wxFontDataProperty::OnSetValue()
{ {
if ( !m_value.IsType(wxT("wxFontData")) ) if ( !m_value.IsType("wxFontData") )
{ {
if ( m_value.IsType(wxT("wxFont")) ) if ( m_value.IsType("wxFont") )
{ {
wxFont font; wxFont font;
font << m_value; font << m_value;
@@ -101,7 +101,7 @@ void wxFontDataProperty::OnSetValue()
} }
else else
{ {
wxFAIL_MSG(wxT("Value to wxFontDataProperty must be either wxFontData or wxFont")); wxFAIL_MSG("Value to wxFontDataProperty must be either wxFontData or wxFont");
} }
} }
else else
@@ -201,8 +201,8 @@ wxSizeProperty::wxSizeProperty( const wxString& label, const wxString& name,
const wxSize& value) : wxPGProperty(label,name) const wxSize& value) : wxPGProperty(label,name)
{ {
SetValueI(value); SetValueI(value);
AddPrivateChild( new wxIntProperty(wxT("Width"),wxPG_LABEL,value.x) ); AddPrivateChild( new wxIntProperty("Width",wxPG_LABEL,value.x) );
AddPrivateChild( new wxIntProperty(wxT("Height"),wxPG_LABEL,value.y) ); AddPrivateChild( new wxIntProperty("Height",wxPG_LABEL,value.y) );
} }
wxSizeProperty::~wxSizeProperty() { } wxSizeProperty::~wxSizeProperty() { }
@@ -241,8 +241,8 @@ wxPointProperty::wxPointProperty( const wxString& label, const wxString& name,
const wxPoint& value) : wxPGProperty(label,name) const wxPoint& value) : wxPGProperty(label,name)
{ {
SetValueI(value); SetValueI(value);
AddPrivateChild( new wxIntProperty(wxT("X"),wxPG_LABEL,value.x) ); AddPrivateChild( new wxIntProperty("X",wxPG_LABEL,value.x) );
AddPrivateChild( new wxIntProperty(wxT("Y"),wxPG_LABEL,value.y) ); AddPrivateChild( new wxIntProperty("Y",wxPG_LABEL,value.y) );
} }
wxPointProperty::~wxPointProperty() { } wxPointProperty::~wxPointProperty() { }
@@ -277,7 +277,7 @@ wxVariant wxPointProperty::ChildChanged( wxVariant& thisValue,
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(wxDirsProperty, ',', WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(wxDirsProperty, ',',
wxT("Browse")) "Browse")
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
@@ -292,7 +292,7 @@ wxValidator* wxDirsProperty::DoGetValidator() const
bool wxDirsProperty::OnCustomStringEdit( wxWindow* parent, wxString& value ) bool wxDirsProperty::OnCustomStringEdit( wxWindow* parent, wxString& value )
{ {
wxDirDialog dlg(parent, wxDirDialog dlg(parent,
wxT("Select a directory to be added to the list:"), "Select a directory to be added to the list:",
value, value,
0); 0);
@@ -474,7 +474,7 @@ bool operator == (const wxArrayDouble& a, const wxArrayDouble& b)
// Can't do direct equality comparison with floating point numbers. // Can't do direct equality comparison with floating point numbers.
if ( fabs(a[i] - b[i]) > 0.0000000001 ) if ( fabs(a[i] - b[i]) > 0.0000000001 )
{ {
//wxLogDebug(wxT("%f != %f"),a[i],b[i]); //wxLogDebug("%f != %f",a[i],b[i]);
return false; return false;
} }
} }
@@ -498,10 +498,10 @@ wxArrayDoubleProperty::wxArrayDoubleProperty (const wxString& label,
// //
// Need to figure out delimiter needed for this locale // Need to figure out delimiter needed for this locale
// (i.e. can't use comma when comma acts as decimal point in float). // (i.e. can't use comma when comma acts as decimal point in float).
wxChar use_delimiter = wxT(','); wxChar use_delimiter = ',';
if (wxString::Format(wxT("%.2f"),12.34).Find(use_delimiter) >= 0) if (wxString::Format("%.2f",12.34).Find(use_delimiter) >= 0)
use_delimiter = wxT(';'); use_delimiter = ';';
m_delimiter = use_delimiter; m_delimiter = use_delimiter;
@@ -540,7 +540,7 @@ wxString wxArrayDoubleProperty::ValueToString( wxVariant& value,
void wxArrayDoubleProperty::GenerateValueAsString( wxString& target, int prec, bool removeZeroes ) const void wxArrayDoubleProperty::GenerateValueAsString( wxString& target, int prec, bool removeZeroes ) const
{ {
wxChar between[3] = wxT(", "); wxString between = ", ";
size_t i; size_t i;
between[0] = m_delimiter; between[0] = m_delimiter;
@@ -657,7 +657,7 @@ wxValidator* wxArrayDoubleProperty::DoGetValidator() const
wxArrayString incChars(numValidator.GetIncludes()); wxArrayString incChars(numValidator.GetIncludes());
// Accept also a delimiter and space character // Accept also a delimiter and space character
incChars.Add(m_delimiter); incChars.Add(m_delimiter);
incChars.Add(wxT(" ")); incChars.Add(" ");
validator->SetIncludes(incChars); validator->SetIncludes(incChars);
@@ -670,9 +670,9 @@ wxValidator* wxArrayDoubleProperty::DoGetValidator() const
bool wxArrayDoubleProperty::ValidateValue(wxVariant& value, bool wxArrayDoubleProperty::ValidateValue(wxVariant& value,
wxPGValidationInfo& validationInfo) const wxPGValidationInfo& validationInfo) const
{ {
if (!value.IsType(wxT("wxArrayDouble"))) if (!value.IsType("wxArrayDouble"))
{ {
validationInfo.SetFailureMessage(wxT("At least one element is not a valid floating-point number.")); validationInfo.SetFailureMessage("At least one element is not a valid floating-point number.");
return false; return false;
} }

View File

@@ -45,13 +45,13 @@ public:
: wxColourProperty(label, name, value) : wxColourProperty(label, name, value)
{ {
wxPGChoices colours; wxPGChoices colours;
colours.Add(wxT("White")); colours.Add("White");
colours.Add(wxT("Black")); colours.Add("Black");
colours.Add(wxT("Red")); colours.Add("Red");
colours.Add(wxT("Green")); colours.Add("Green");
colours.Add(wxT("Blue")); colours.Add("Blue");
colours.Add(wxT("Custom")); colours.Add("Custom");
colours.Add(wxT("None")); colours.Add("None");
m_choices = colours; m_choices = colours;
SetIndex(0); SetIndex(0);
wxVariant variant; wxVariant variant;
@@ -106,24 +106,24 @@ public:
void FormMain::AddTestProperties( wxPropertyGridPage* pg ) void FormMain::AddTestProperties( wxPropertyGridPage* pg )
{ {
pg->Append( new MyColourProperty(wxT("CustomColourProperty"), wxPG_LABEL, *wxGREEN) ); pg->Append( new MyColourProperty("CustomColourProperty", wxPG_LABEL, *wxGREEN) );
pg->GetProperty(wxT("CustomColourProperty"))->SetAutoUnspecified(true); pg->GetProperty("CustomColourProperty")->SetAutoUnspecified(true);
pg->SetPropertyEditor( wxT("CustomColourProperty"), wxPGEditor_ComboBox ); pg->SetPropertyEditor( "CustomColourProperty", wxPGEditor_ComboBox );
pg->SetPropertyHelpString(wxT("CustomColourProperty"), pg->SetPropertyHelpString("CustomColourProperty",
wxT("This is a MyColourProperty from the sample app. ") "This is a MyColourProperty from the sample app. "
wxT("It is built by subclassing wxColourProperty.")); "It is built by subclassing wxColourProperty.");
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) ) void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) )
{ {
wxVariant values = m_pPropGridManager->GetPropertyValues(wxT("list"), wxNullProperty, wxPG_INC_ATTRIBUTES); wxVariant values = m_pPropGridManager->GetPropertyValues("list", wxNullProperty, wxPG_INC_ATTRIBUTES);
wxString text = wxT("This only tests that wxVariant related routines do not crash."); wxString text = "This only tests that wxVariant related routines do not crash.";
wxString t; wxString t;
wxDialog* dlg = new wxDialog(this,wxID_ANY,wxT("wxVariant Test"), wxDialog* dlg = new wxDialog(this,wxID_ANY,"wxVariant Test",
wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
unsigned int i; unsigned int i;
@@ -134,26 +134,26 @@ void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) )
wxString strValue = v.GetString(); wxString strValue = v.GetString();
#if wxCHECK_VERSION(2,8,0) #if wxCHECK_VERSION(2,8,0)
if ( v.GetName().EndsWith(wxT("@attr")) ) if ( v.GetName().EndsWith("@attr") )
#else #else
if ( v.GetName().Right(5) == wxT("@attr") ) if ( v.GetName().Right(5) == "@attr" )
#endif #endif
{ {
text += wxString::Format(wxT("Attributes:\n")); text += wxString::Format("Attributes:\n");
unsigned int n; unsigned int n;
for ( n = 0; n < (unsigned int)v.GetCount(); n++ ) for ( n = 0; n < (unsigned int)v.GetCount(); n++ )
{ {
wxVariant& a = v[n]; wxVariant& a = v[n];
t.Printf(wxT(" attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n"),(int)n, t.Printf(" attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n",(int)n,
a.GetName().c_str(),a.GetType().c_str(),a.GetString().c_str()); a.GetName().c_str(),a.GetType().c_str(),a.GetString().c_str());
text += t; text += t;
} }
} }
else else
{ {
t.Printf(wxT("%i: name=\"%s\" type=\"%s\" value=\"%s\"\n"),(int)i, t.Printf("%i: name=\"%s\" type=\"%s\" value=\"%s\"\n",(int)i,
v.GetName().c_str(),v.GetType().c_str(),strValue.c_str()); v.GetName().c_str(),v.GetType().c_str(),strValue.c_str());
text += t; text += t;
} }
@@ -169,7 +169,7 @@ void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) )
rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing)); rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing));
topsizer->Add( rowsizer, wxSizerFlags(1).Expand()); topsizer->Add( rowsizer, wxSizerFlags(1).Expand());
rowsizer = new wxBoxSizer( wxHORIZONTAL ); rowsizer = new wxBoxSizer( wxHORIZONTAL );
rowsizer->Add( new wxButton(dlg,wxID_OK,wxT("Ok")), rowsizer->Add( new wxButton(dlg,wxID_OK,"Ok"),
wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing)); wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing));
topsizer->Add( rowsizer, wxSizerFlags().Right() ); topsizer->Add( rowsizer, wxSizerFlags().Right() );
@@ -197,8 +197,8 @@ public:
m_preWarnings = wxPGGlobalVars->m_warnings; m_preWarnings = wxPGGlobalVars->m_warnings;
#endif #endif
if ( name != wxT("none") ) if ( name != "none" )
Msg(name+wxT("\n")); Msg(name+"\n");
} }
~TestRunner() ~TestRunner()
@@ -207,7 +207,7 @@ public:
int warningsOccurred = wxPGGlobalVars->m_warnings - m_preWarnings; int warningsOccurred = wxPGGlobalVars->m_warnings - m_preWarnings;
if ( warningsOccurred ) if ( warningsOccurred )
{ {
wxString s = wxString::Format(wxT("%i warnings occurred during test '%s'"), warningsOccurred, m_name.c_str()); wxString s = wxString::Format("%i warnings occurred during test '%s'", warningsOccurred, m_name.c_str());
m_errorMessages->push_back(s); m_errorMessages->push_back(s);
Msg(s); Msg(s);
} }
@@ -219,7 +219,7 @@ public:
if ( m_ed ) if ( m_ed )
{ {
m_ed->AppendText(text); m_ed->AppendText(text);
m_ed->AppendText(wxT("\n")); m_ed->AppendText("\n");
} }
wxLogDebug(text); wxLogDebug(text);
} }
@@ -236,14 +236,14 @@ protected:
#define RT_START_TEST(TESTNAME) \ #define RT_START_TEST(TESTNAME) \
TestRunner tr(wxT(#TESTNAME), pgman, ed, &errorMessages); TestRunner tr(#TESTNAME, pgman, ed, &errorMessages);
#define RT_MSG(S) \ #define RT_MSG(S) \
tr.Msg(S); tr.Msg(S);
#define RT_FAILURE() \ #define RT_FAILURE() \
{ \ { \
wxString s1 = wxString::Format(wxT("Test failure in tests.cpp, line %i."),__LINE__-1); \ wxString s1 = wxString::Format("Test failure in tests.cpp, line %i.",__LINE__-1); \
errorMessages.push_back(s1); \ errorMessages.push_back(s1); \
wxLogDebug(s1); \ wxLogDebug(s1); \
failures++; \ failures++; \
@@ -255,10 +255,10 @@ protected:
#define RT_FAILURE_MSG(MSG) \ #define RT_FAILURE_MSG(MSG) \
{ \ { \
wxString s1 = wxString::Format(wxT("Test failure in tests.cpp, line %i."),__LINE__-1); \ wxString s1 = wxString::Format("Test failure in tests.cpp, line %i.",__LINE__-1); \
errorMessages.push_back(s1); \ errorMessages.push_back(s1); \
wxLogDebug(s1); \ wxLogDebug(s1); \
wxString s2 = wxString::Format(wxT("Message: %s"),MSG.c_str()); \ wxString s2 = wxString::Format("Message: %s",MSG.c_str()); \
errorMessages.push_back(s2); \ errorMessages.push_back(s2); \
wxLogDebug(s2); \ wxLogDebug(s2); \
failures++; \ failures++; \
@@ -270,7 +270,7 @@ protected:
unsigned int h2_ = PROPS->GetActualVirtualHeight(); \ unsigned int h2_ = PROPS->GetActualVirtualHeight(); \
if ( h1_ != h2_ ) \ if ( h1_ != h2_ ) \
{ \ { \
wxString s_ = wxString::Format(wxT("VirtualHeight = %i, should be %i (%s)"), h1_, h2_, EXTRATEXT.c_str()); \ wxString s_ = wxString::Format("VirtualHeight = %i, should be %i (%s)", h1_, h2_, EXTRATEXT.c_str()); \
RT_FAILURE_MSG(s_); \ RT_FAILURE_MSG(s_); \
_failed_ = true; \ _failed_ = true; \
} \ } \
@@ -342,7 +342,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxArrayString errorMessages; wxArrayString errorMessages;
wxDialog* dlg = NULL; wxDialog* dlg = NULL;
dlg = new wxDialog(this,wxID_ANY,wxT("wxPropertyGrid Regression Tests"), dlg = new wxDialog(this,wxID_ANY,"wxPropertyGrid Regression Tests",
wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
// multi-line text editor dialog // multi-line text editor dialog
@@ -355,7 +355,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing)); rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing));
topsizer->Add( rowsizer, wxSizerFlags(1).Expand()); topsizer->Add( rowsizer, wxSizerFlags(1).Expand());
rowsizer = new wxBoxSizer( wxHORIZONTAL ); rowsizer = new wxBoxSizer( wxHORIZONTAL );
rowsizer->Add( new wxButton(dlg,wxID_OK,wxT("Ok")), rowsizer->Add( new wxButton(dlg,wxID_OK,"Ok"),
wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing)); wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing));
topsizer->Add( rowsizer, wxSizerFlags().Right() ); topsizer->Add( rowsizer, wxSizerFlags().Right() );
@@ -382,13 +382,13 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{ {
wxPGProperty* p = it.GetProperty(); wxPGProperty* p = it.GetProperty();
if ( p->IsCategory() ) if ( p->IsCategory() )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' is a category (non-private child property expected)"),p->GetLabel().c_str())) RT_FAILURE_MSG(wxString::Format("'%s' is a category (non-private child property expected)",p->GetLabel().c_str()))
else if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) else if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' is a private child (non-private child property expected)"),p->GetLabel().c_str())) RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property expected)",p->GetLabel().c_str()))
count++; count++;
} }
RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_PROPERTIES) -> %i entries"), count)); RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES) -> %i entries", count));
count = 0; count = 0;
for ( it = pgman->GetVIterator(wxPG_ITERATE_CATEGORIES); for ( it = pgman->GetVIterator(wxPG_ITERATE_CATEGORIES);
@@ -397,11 +397,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{ {
wxPGProperty* p = it.GetProperty(); wxPGProperty* p = it.GetProperty();
if ( !p->IsCategory() ) if ( !p->IsCategory() )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' is not a category (only category was expected)"),p->GetLabel().c_str())) RT_FAILURE_MSG(wxString::Format("'%s' is not a category (only category was expected)",p->GetLabel().c_str()))
count++; count++;
} }
RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_CATEGORIES) -> %i entries"), count)); RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_CATEGORIES) -> %i entries", count));
count = 0; count = 0;
for ( it = pgman->GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES); for ( it = pgman->GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES);
@@ -410,11 +410,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{ {
wxPGProperty* p = it.GetProperty(); wxPGProperty* p = it.GetProperty();
if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' is a private child (non-private child property or category expected)"),p->GetLabel().c_str())) RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property or category expected)",p->GetLabel().c_str()))
count++; count++;
} }
RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES) -> %i entries"), count)); RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES) -> %i entries", count));
count = 0; count = 0;
for ( it = pgman->GetVIterator(wxPG_ITERATE_VISIBLE); for ( it = pgman->GetVIterator(wxPG_ITERATE_VISIBLE);
@@ -423,13 +423,13 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{ {
wxPGProperty* p = it.GetProperty(); wxPGProperty* p = it.GetProperty();
if ( (p->GetParent() != p->GetParentState()->DoGetRoot() && !p->GetParent()->IsExpanded()) ) if ( (p->GetParent() != p->GetParentState()->DoGetRoot() && !p->GetParent()->IsExpanded()) )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' had collapsed parent (only visible properties expected)"),p->GetLabel().c_str())) RT_FAILURE_MSG(wxString::Format("'%s' had collapsed parent (only visible properties expected)",p->GetLabel().c_str()))
else if ( p->HasFlag(wxPG_PROP_HIDDEN) ) else if ( p->HasFlag(wxPG_PROP_HIDDEN) )
RT_FAILURE_MSG(wxString::Format(wxT("'%s' was hidden (only visible properties expected)"),p->GetLabel().c_str())) RT_FAILURE_MSG(wxString::Format("'%s' was hidden (only visible properties expected)",p->GetLabel().c_str()))
count++; count++;
} }
RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_VISIBLE) -> %i entries"), count)); RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_VISIBLE) -> %i entries", count));
} }
if ( fullTest ) if ( fullTest )
@@ -476,7 +476,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
for ( it2 = array.rbegin(); it2 != array.rend(); ++it2 ) for ( it2 = array.rbegin(); it2 != array.rend(); ++it2 )
{ {
wxPGProperty* p = (wxPGProperty*)*it2; wxPGProperty* p = (wxPGProperty*)*it2;
RT_MSG(wxString::Format(wxT("Deleting '%s' ('%s')"),p->GetLabel().c_str(),p->GetName().c_str())); RT_MSG(wxString::Format("Deleting '%s' ('%s')",p->GetLabel().c_str(),p->GetName().c_str()));
pgman->DeleteProperty(p); pgman->DeleteProperty(p);
} }
@@ -521,7 +521,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxAny any; wxAny any;
#if wxUSE_DATETIME #if wxUSE_DATETIME
prop = pgman->GetProperty(wxT("DateProperty")); prop = pgman->GetProperty("DateProperty");
wxDateTime testTime = wxDateTime::Now(); wxDateTime testTime = wxDateTime::Now();
any = testTime; any = testTime;
prop->SetValue(any); prop->SetValue(any);
@@ -529,7 +529,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_FAILURE(); RT_FAILURE();
#endif #endif
prop = pgman->GetProperty(wxT("IntProperty")); prop = pgman->GetProperty("IntProperty");
int testInt = 25537983; int testInt = 25537983;
any = testInt; any = testInt;
prop->SetValue(any); prop->SetValue(any);
@@ -540,15 +540,15 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_FAILURE(); RT_FAILURE();
#endif #endif
prop = pgman->GetProperty(wxT("StringProperty")); prop = pgman->GetProperty("StringProperty");
wxString testString = wxT("asd934jfyn3"); wxString testString = "asd934jfyn3";
any = testString; any = testString;
prop->SetValue(any); prop->SetValue(any);
if ( prop->GetValue().GetAny().As<wxString>() != testString ) if ( prop->GetValue().GetAny().As<wxString>() != testString )
RT_FAILURE(); RT_FAILURE();
// Test with a type generated with IMPLEMENT_VARIANT_OBJECT() // Test with a type generated with IMPLEMENT_VARIANT_OBJECT()
prop = pgman->GetProperty(wxT("ColourProperty")); prop = pgman->GetProperty("ColourProperty");
wxColour testCol = *wxCYAN; wxColour testCol = *wxCYAN;
any = testCol; any = testCol;
prop->SetValue(any); prop->SetValue(any);
@@ -557,7 +557,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
// Test with a type with custom wxVariantData defined by // Test with a type with custom wxVariantData defined by
// wxPG headers. // wxPG headers.
prop = pgman->GetProperty(wxT("Position")); prop = pgman->GetProperty("Position");
wxPoint testPoint(199, 199); wxPoint testPoint(199, 199);
any = testPoint; any = testPoint;
prop->SetValue(any); prop->SetValue(any);
@@ -580,7 +580,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{ {
wxVariant& v = values[j]; wxVariant& v = values[j];
t.Printf(wxT("%i: name=\"%s\" type=\"%s\"\n"),(int)j, t.Printf("%i: name=\"%s\" type=\"%s\"\n",(int)j,
v.GetName().c_str(),v.GetType().c_str()); v.GetName().c_str(),v.GetType().c_str());
text += t; text += t;
@@ -592,21 +592,21 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{ {
RT_START_TEST(SetPropertyValue_and_GetPropertyValue) RT_START_TEST(SetPropertyValue_and_GetPropertyValue)
// In this section, mixed up usage of wxT("propname") and "propname" // In this section, mixed up usage of "propname" and "propname"
// in wxPropertyGridInterface functions is intentional. // in wxPropertyGridInterface functions is intentional.
// Purpose is to test wxPGPropArgCls ctors. // Purpose is to test wxPGPropArgCls ctors.
//pg = (wxPropertyGrid*) NULL; //pg = (wxPropertyGrid*) NULL;
wxArrayString test_arrstr_1; wxArrayString test_arrstr_1;
test_arrstr_1.Add(wxT("Apple")); test_arrstr_1.Add("Apple");
test_arrstr_1.Add(wxT("Orange")); test_arrstr_1.Add("Orange");
test_arrstr_1.Add(wxT("Lemon")); test_arrstr_1.Add("Lemon");
wxArrayString test_arrstr_2; wxArrayString test_arrstr_2;
test_arrstr_2.Add(wxT("Potato")); test_arrstr_2.Add("Potato");
test_arrstr_2.Add(wxT("Cabbage")); test_arrstr_2.Add("Cabbage");
test_arrstr_2.Add(wxT("Cucumber")); test_arrstr_2.Add("Cucumber");
wxArrayInt test_arrint_1; wxArrayInt test_arrint_1;
test_arrint_1.Add(1); test_arrint_1.Add(1);
@@ -632,117 +632,117 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
#define FLAG_TEST_SET1 (wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER) #define FLAG_TEST_SET1 (wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER)
#define FLAG_TEST_SET2 (wxSTAY_ON_TOP|wxCAPTION|wxICONIZE|wxSYSTEM_MENU) #define FLAG_TEST_SET2 (wxSTAY_ON_TOP|wxCAPTION|wxICONIZE|wxSYSTEM_MENU)
pgman->SetPropertyValue(wxT("StringProperty"),wxT("Text1")); pgman->SetPropertyValue("StringProperty","Text1");
pgman->SetPropertyValue(wxT("IntProperty"),1024); pgman->SetPropertyValue("IntProperty",1024);
pgman->SetPropertyValue(wxT("FloatProperty"),1024.0000000001); pgman->SetPropertyValue("FloatProperty",1024.0000000001);
pgman->SetPropertyValue(wxT("BoolProperty"),false); pgman->SetPropertyValue("BoolProperty",false);
pgman->SetPropertyValue(wxT("EnumProperty"),120); pgman->SetPropertyValue("EnumProperty",120);
pgman->SetPropertyValue(wxT("ArrayStringProperty"),test_arrstr_1); pgman->SetPropertyValue("ArrayStringProperty",test_arrstr_1);
wxColour emptyCol; wxColour emptyCol;
pgman->SetPropertyValue(wxT("ColourProperty"),emptyCol); pgman->SetPropertyValue("ColourProperty",emptyCol);
pgman->SetPropertyValue(wxT("ColourProperty"),(wxObject*)wxBLACK); pgman->SetPropertyValue("ColourProperty",(wxObject*)wxBLACK);
pgman->SetPropertyValue(wxT("Size"),WXVARIANT(wxSize(150,150))); pgman->SetPropertyValue("Size",WXVARIANT(wxSize(150,150)));
pgman->SetPropertyValue(wxT("Position"),WXVARIANT(wxPoint(150,150))); pgman->SetPropertyValue("Position",WXVARIANT(wxPoint(150,150)));
pgman->SetPropertyValue(wxT("MultiChoiceProperty"),test_arrint_1); pgman->SetPropertyValue("MultiChoiceProperty",test_arrint_1);
#if wxUSE_DATETIME #if wxUSE_DATETIME
pgman->SetPropertyValue(wxT("DateProperty"),dt1); pgman->SetPropertyValue("DateProperty",dt1);
#endif #endif
pgman->SelectPage(2); pgman->SelectPage(2);
pg = pgman->GetGrid(); pg = pgman->GetGrid();
if ( pg->GetPropertyValueAsString(wxT("StringProperty")) != wxT("Text1") ) if ( pg->GetPropertyValueAsString("StringProperty") != "Text1" )
RT_FAILURE(); RT_FAILURE();
if ( pg->GetPropertyValueAsInt(wxT("IntProperty")) != 1024 ) if ( pg->GetPropertyValueAsInt("IntProperty") != 1024 )
RT_FAILURE(); RT_FAILURE();
if ( pg->GetPropertyValueAsDouble(wxT("FloatProperty")) != 1024.0000000001 ) if ( pg->GetPropertyValueAsDouble("FloatProperty") != 1024.0000000001 )
RT_FAILURE(); RT_FAILURE();
if ( pg->GetPropertyValueAsBool(wxT("BoolProperty")) != false ) if ( pg->GetPropertyValueAsBool("BoolProperty") != false )
RT_FAILURE(); RT_FAILURE();
if ( pg->GetPropertyValueAsLong(wxT("EnumProperty")) != 120 ) if ( pg->GetPropertyValueAsLong("EnumProperty") != 120 )
RT_FAILURE(); RT_FAILURE();
if ( pg->GetPropertyValueAsArrayString(wxT("ArrayStringProperty")) != test_arrstr_1 ) if ( pg->GetPropertyValueAsArrayString("ArrayStringProperty") != test_arrstr_1 )
RT_FAILURE(); RT_FAILURE();
wxColour col; wxColour col;
col << pgman->GetPropertyValue(wxT("ColourProperty")); col << pgman->GetPropertyValue("ColourProperty");
if ( col != *wxBLACK ) if ( col != *wxBLACK )
RT_FAILURE(); RT_FAILURE();
wxVariant varSize(pg->GetPropertyValue(wxT("Size"))); wxVariant varSize(pg->GetPropertyValue("Size"));
if ( wxSizeRefFromVariant(varSize) != wxSize(150,150) ) if ( wxSizeRefFromVariant(varSize) != wxSize(150,150) )
RT_FAILURE(); RT_FAILURE();
wxVariant varPos(pg->GetPropertyValue(wxT("Position"))); wxVariant varPos(pg->GetPropertyValue("Position"));
if ( wxPointRefFromVariant(varPos) != wxPoint(150,150) ) if ( wxPointRefFromVariant(varPos) != wxPoint(150,150) )
RT_FAILURE(); RT_FAILURE();
if ( !(pg->GetPropertyValueAsArrayInt(wxT("MultiChoiceProperty")) == test_arrint_1) ) if ( !(pg->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_1) )
RT_FAILURE(); RT_FAILURE();
#if wxUSE_DATETIME #if wxUSE_DATETIME
if ( !(pg->GetPropertyValueAsDateTime(wxT("DateProperty")) == dt1) ) if ( !(pg->GetPropertyValueAsDateTime("DateProperty") == dt1) )
RT_FAILURE(); RT_FAILURE();
#endif #endif
#if wxUSE_LONGLONG && defined(wxLongLong_t) #if wxUSE_LONGLONG && defined(wxLongLong_t)
pgman->SetPropertyValue(wxT("IntProperty"),wxLL(10000000000)); pgman->SetPropertyValue("IntProperty",wxLL(10000000000));
if ( pg->GetPropertyValueAsLongLong(wxT("IntProperty")) != wxLL(10000000000) ) if ( pg->GetPropertyValueAsLongLong("IntProperty") != wxLL(10000000000) )
RT_FAILURE(); RT_FAILURE();
#else #else
pgman->SetPropertyValue(wxT("IntProperty"),1000000000); pgman->SetPropertyValue("IntProperty",1000000000);
if ( pg->GetPropertyValueAsLong(wxT("IntProperty")) != 1000000000 ) if ( pg->GetPropertyValueAsLong("IntProperty") != 1000000000 )
RT_FAILURE(); RT_FAILURE();
#endif #endif
pg->SetPropertyValue(wxT("StringProperty"),wxT("Text2")); pg->SetPropertyValue("StringProperty","Text2");
pg->SetPropertyValue(wxT("IntProperty"),512); pg->SetPropertyValue("IntProperty",512);
pg->SetPropertyValue(wxT("FloatProperty"),512.0); pg->SetPropertyValue("FloatProperty",512.0);
pg->SetPropertyValue(wxT("BoolProperty"),true); pg->SetPropertyValue("BoolProperty",true);
pg->SetPropertyValue(wxT("EnumProperty"),80); pg->SetPropertyValue("EnumProperty",80);
pg->SetPropertyValue(wxT("ArrayStringProperty"),test_arrstr_2); pg->SetPropertyValue("ArrayStringProperty",test_arrstr_2);
pg->SetPropertyValue(wxT("ColourProperty"),(wxObject*)wxWHITE); pg->SetPropertyValue("ColourProperty",(wxObject*)wxWHITE);
pg->SetPropertyValue(wxT("Size"),WXVARIANT(wxSize(300,300))); pg->SetPropertyValue("Size",WXVARIANT(wxSize(300,300)));
pg->SetPropertyValue(wxT("Position"),WXVARIANT(wxPoint(300,300))); pg->SetPropertyValue("Position",WXVARIANT(wxPoint(300,300)));
pg->SetPropertyValue(wxT("MultiChoiceProperty"),test_arrint_2); pg->SetPropertyValue("MultiChoiceProperty",test_arrint_2);
#if wxUSE_DATETIME #if wxUSE_DATETIME
pg->SetPropertyValue(wxT("DateProperty"),dt2); pg->SetPropertyValue("DateProperty",dt2);
#endif #endif
//pg = (wxPropertyGrid*) NULL; //pg = (wxPropertyGrid*) NULL;
pgman->SelectPage(0); pgman->SelectPage(0);
if ( pgman->GetPropertyValueAsString(wxT("StringProperty")) != wxT("Text2") ) if ( pgman->GetPropertyValueAsString("StringProperty") != "Text2" )
RT_FAILURE(); RT_FAILURE();
if ( pgman->GetPropertyValueAsInt(wxT("IntProperty")) != 512 ) if ( pgman->GetPropertyValueAsInt("IntProperty") != 512 )
RT_FAILURE(); RT_FAILURE();
if ( pgman->GetPropertyValueAsDouble(wxT("FloatProperty")) != 512.0 ) if ( pgman->GetPropertyValueAsDouble("FloatProperty") != 512.0 )
RT_FAILURE(); RT_FAILURE();
if ( pgman->GetPropertyValueAsBool(wxT("BoolProperty")) != true ) if ( pgman->GetPropertyValueAsBool("BoolProperty") != true )
RT_FAILURE(); RT_FAILURE();
if ( pgman->GetPropertyValueAsLong(wxT("EnumProperty")) != 80 ) if ( pgman->GetPropertyValueAsLong("EnumProperty") != 80 )
RT_FAILURE(); RT_FAILURE();
if ( pgman->GetPropertyValueAsArrayString(wxT("ArrayStringProperty")) != test_arrstr_2 ) if ( pgman->GetPropertyValueAsArrayString("ArrayStringProperty") != test_arrstr_2 )
RT_FAILURE(); RT_FAILURE();
col << pgman->GetPropertyValue(wxT("ColourProperty")); col << pgman->GetPropertyValue("ColourProperty");
if ( col != *wxWHITE ) if ( col != *wxWHITE )
RT_FAILURE(); RT_FAILURE();
varSize = pgman->GetPropertyValue(wxT("Size")); varSize = pgman->GetPropertyValue("Size");
if ( wxSizeRefFromVariant(varSize) != wxSize(300,300) ) if ( wxSizeRefFromVariant(varSize) != wxSize(300,300) )
RT_FAILURE(); RT_FAILURE();
varPos = pgman->GetPropertyValue(wxT("Position")); varPos = pgman->GetPropertyValue("Position");
if ( wxPointRefFromVariant(varPos) != wxPoint(300,300) ) if ( wxPointRefFromVariant(varPos) != wxPoint(300,300) )
RT_FAILURE(); RT_FAILURE();
if ( !(pgman->GetPropertyValueAsArrayInt(wxT("MultiChoiceProperty")) == test_arrint_2) ) if ( !(pgman->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_2) )
RT_FAILURE(); RT_FAILURE();
#if wxUSE_DATETIME #if wxUSE_DATETIME
if ( !(pgman->GetPropertyValueAsDateTime(wxT("DateProperty")) == dt2) ) if ( !(pgman->GetPropertyValueAsDateTime("DateProperty") == dt2) )
RT_FAILURE(); RT_FAILURE();
#endif #endif
#if wxUSE_LONGLONG && defined(wxLongLong_t) #if wxUSE_LONGLONG && defined(wxLongLong_t)
pgman->SetPropertyValue(wxT("IntProperty"),wxLL(-80000000000)); pgman->SetPropertyValue("IntProperty",wxLL(-80000000000));
if ( pgman->GetPropertyValueAsLongLong(wxT("IntProperty")) != wxLL(-80000000000) ) if ( pgman->GetPropertyValueAsLongLong("IntProperty") != wxLL(-80000000000) )
RT_FAILURE(); RT_FAILURE();
#else #else
pgman->SetPropertyValue(wxT("IntProperty"),-1000000000); pgman->SetPropertyValue("IntProperty",-1000000000);
if ( pgman->GetPropertyValueAsLong(wxT("IntProperty")) != -1000000000 ) if ( pgman->GetPropertyValueAsLong("IntProperty") != -1000000000 )
RT_FAILURE(); RT_FAILURE();
#endif #endif
@@ -751,46 +751,46 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
// //
// This updates children as well // This updates children as well
wxString nvs = wxT("Lamborghini Diablo XYZ; 5707; [100; 3.9; 8.6] 3000002; Convertible"); wxString nvs = "Lamborghini Diablo XYZ; 5707; [100; 3.9; 8.6] 3000002; Convertible";
pgman->SetPropertyValue("Car", nvs); pgman->SetPropertyValue("Car", nvs);
if ( pgman->GetPropertyValueAsString(wxT("Car.Model")) != wxT("Lamborghini Diablo XYZ") ) if ( pgman->GetPropertyValueAsString("Car.Model") != "Lamborghini Diablo XYZ" )
{ {
RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Model=%s"), pgman->GetPropertyValueAsString(wxS("Car.Model")).c_str())); RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Model=%s"), pgman->GetPropertyValueAsString(wxS("Car.Model")).c_str()));
} }
if ( pgman->GetPropertyValueAsInt(wxT("Car.Speeds.Max. Speed (mph)")) != 100 ) if ( pgman->GetPropertyValueAsInt("Car.Speeds.Max. Speed (mph)") != 100 )
{ {
RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Speeds.Max. Speed (mph)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Speeds.Max. Speed (mph)")).c_str())); RT_FAILURE_MSG(wxString::Format("Did not match: Car.Speeds.Max. Speed (mph)=%s", pgman->GetPropertyValueAsString(wxS("Car.Speeds.Max. Speed (mph)")).c_str()));
} }
if ( pgman->GetPropertyValueAsInt(wxT("Car.Price ($)")) != 3000002 ) if ( pgman->GetPropertyValueAsInt("Car.Price ($)") != 3000002 )
{ {
RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Price ($)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Price ($)")).c_str())); RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Price ($)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Price ($)")).c_str()));
} }
if ( !pgman->GetPropertyValueAsBool(wxT("Car.Convertible")) ) if ( !pgman->GetPropertyValueAsBool("Car.Convertible") )
{ {
RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Convertible=%s"), pgman->GetPropertyValueAsString(wxS("Car.Convertible")).c_str())); RT_FAILURE_MSG(wxString::Format("Did not match: Car.Convertible=%s", pgman->GetPropertyValueAsString(wxS("Car.Convertible")).c_str()));
} }
// SetPropertyValueString for special cases such as wxColour // SetPropertyValueString for special cases such as wxColour
pgman->SetPropertyValueString(wxT("ColourProperty"), wxT("(123,4,255)")); pgman->SetPropertyValueString("ColourProperty", "(123,4,255)");
col << pgman->GetPropertyValue(wxT("ColourProperty")); col << pgman->GetPropertyValue("ColourProperty");
if ( col != wxColour(123, 4, 255) ) if ( col != wxColour(123, 4, 255) )
RT_FAILURE(); RT_FAILURE();
pgman->SetPropertyValueString(wxT("ColourProperty"), wxT("#FE860B")); pgman->SetPropertyValueString("ColourProperty", "#FE860B");
col << pgman->GetPropertyValue(wxT("ColourProperty")); col << pgman->GetPropertyValue("ColourProperty");
if ( col != wxColour(254, 134, 11) ) if ( col != wxColour(254, 134, 11) )
RT_FAILURE(); RT_FAILURE();
pgman->SetPropertyValueString(wxT("ColourPropertyWithAlpha"), pgman->SetPropertyValueString("ColourPropertyWithAlpha",
wxT("(10, 20, 30, 128)")); "(10, 20, 30, 128)");
col << pgman->GetPropertyValue(wxT("ColourPropertyWithAlpha")); col << pgman->GetPropertyValue("ColourPropertyWithAlpha");
if ( col != wxColour(10, 20, 30, 128) ) if ( col != wxColour(10, 20, 30, 128) )
RT_FAILURE(); RT_FAILURE();
if ( pgman->GetPropertyValueAsString(wxT("ColourPropertyWithAlpha")) if ( pgman->GetPropertyValueAsString("ColourPropertyWithAlpha")
!= wxT("(10,20,30,128)") ) != "(10,20,30,128)" )
RT_FAILURE(); RT_FAILURE();
} }
@@ -798,18 +798,18 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(SetPropertyValueUnspecified) RT_START_TEST(SetPropertyValueUnspecified)
// Null variant setter tests // Null variant setter tests
pgman->SetPropertyValueUnspecified(wxT("StringProperty")); pgman->SetPropertyValueUnspecified("StringProperty");
pgman->SetPropertyValueUnspecified(wxT("IntProperty")); pgman->SetPropertyValueUnspecified("IntProperty");
pgman->SetPropertyValueUnspecified(wxT("FloatProperty")); pgman->SetPropertyValueUnspecified("FloatProperty");
pgman->SetPropertyValueUnspecified(wxT("BoolProperty")); pgman->SetPropertyValueUnspecified("BoolProperty");
pgman->SetPropertyValueUnspecified(wxT("EnumProperty")); pgman->SetPropertyValueUnspecified("EnumProperty");
pgman->SetPropertyValueUnspecified(wxT("ArrayStringProperty")); pgman->SetPropertyValueUnspecified("ArrayStringProperty");
pgman->SetPropertyValueUnspecified(wxT("ColourProperty")); pgman->SetPropertyValueUnspecified("ColourProperty");
pgman->SetPropertyValueUnspecified(wxT("Size")); pgman->SetPropertyValueUnspecified("Size");
pgman->SetPropertyValueUnspecified(wxT("Position")); pgman->SetPropertyValueUnspecified("Position");
pgman->SetPropertyValueUnspecified(wxT("MultiChoiceProperty")); pgman->SetPropertyValueUnspecified("MultiChoiceProperty");
#if wxUSE_DATETIME #if wxUSE_DATETIME
pgman->SetPropertyValueUnspecified(wxT("DateProperty")); pgman->SetPropertyValueUnspecified("DateProperty");
#endif #endif
} }
@@ -823,10 +823,10 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pg = pgman->GetGrid(); pg = pgman->GetGrid();
wxPGProperty* prop1 = pg->GetProperty(wxT("Label")); wxPGProperty* prop1 = pg->GetProperty("Label");
wxPGProperty* prop2 = pg->GetProperty(wxT("Cell Text Colour")); wxPGProperty* prop2 = pg->GetProperty("Cell Text Colour");
wxPGProperty* prop3 = pg->GetProperty(wxT("Height")); wxPGProperty* prop3 = pg->GetProperty("Height");
wxPGProperty* catProp = pg->GetProperty(wxT("Appearance")); wxPGProperty* catProp = pg->GetProperty("Appearance");
RT_ASSERT( prop1 && prop2 && prop3 ); RT_ASSERT( prop1 && prop2 && prop3 );
@@ -882,7 +882,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pg->MakeColumnEditable(2, true); pg->MakeColumnEditable(2, true);
pg->MakeColumnEditable(0, false); pg->MakeColumnEditable(0, false);
pg->MakeColumnEditable(2, false); pg->MakeColumnEditable(2, false);
pg->SelectProperty(wxT("Height")); pg->SelectProperty("Height");
pg->BeginLabelEdit(0); pg->BeginLabelEdit(0);
pg->BeginLabelEdit(0); pg->BeginLabelEdit(0);
pg->EndLabelEdit(0); pg->EndLabelEdit(0);
@@ -896,15 +896,15 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{ {
RT_START_TEST(Attributes) RT_START_TEST(Attributes)
wxPGProperty* prop = pgman->GetProperty(wxT("StringProperty")); wxPGProperty* prop = pgman->GetProperty("StringProperty");
prop->SetAttribute(wxT("Dummy Attribute"), (long)15); prop->SetAttribute("Dummy Attribute", (long)15);
if ( prop->GetAttribute(wxT("Dummy Attribute")).GetLong() != 15 ) if ( prop->GetAttribute("Dummy Attribute").GetLong() != 15 )
RT_FAILURE(); RT_FAILURE();
prop->SetAttribute(wxT("Dummy Attribute"), wxVariant()); prop->SetAttribute("Dummy Attribute", wxVariant());
if ( !prop->GetAttribute(wxT("Dummy Attribute")).IsNull() ) if ( !prop->GetAttribute("Dummy Attribute").IsNull() )
RT_FAILURE(); RT_FAILURE();
} }
@@ -913,20 +913,20 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(DoubleToString) RT_START_TEST(DoubleToString)
// Locale-specific decimal separator // Locale-specific decimal separator
wxString sep = wxString::Format(wxT("%g"), 1.1)[1]; wxString sep = wxString::Format("%g", 1.1)[1];
wxString s; wxString s;
if ( wxPropertyGrid::DoubleToString(s, 123.123, 2, true) != if ( wxPropertyGrid::DoubleToString(s, 123.123, 2, true) !=
wxString::Format(wxT("123%s12"), sep.c_str()) ) wxString::Format("123%s12", sep.c_str()) )
RT_FAILURE(); RT_FAILURE();
if ( wxPropertyGrid::DoubleToString(s, -123.123, 4, false) != if ( wxPropertyGrid::DoubleToString(s, -123.123, 4, false) !=
wxString::Format(wxT("-123%s1230"), sep.c_str()) ) wxString::Format("-123%s1230", sep.c_str()) )
RT_FAILURE(); RT_FAILURE();
if ( wxPropertyGrid::DoubleToString(s, -0.02, 1, false) != if ( wxPropertyGrid::DoubleToString(s, -0.02, 1, false) !=
wxString::Format(wxT("0%s0"), sep) ) wxString::Format("0%s0", sep) )
RT_FAILURE(); RT_FAILURE();
if ( wxPropertyGrid::DoubleToString(s, -0.000123, 3, true) != wxT("0") ) if ( wxPropertyGrid::DoubleToString(s, -0.000123, 3, true) != "0" )
RT_FAILURE(); RT_FAILURE();
} }
#endif #endif
@@ -943,11 +943,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(GetPropertyValues) RT_START_TEST(GetPropertyValues)
page1 = pgman->GetPage(0); page1 = pgman->GetPage(0);
pg1_values = page1->GetPropertyValues(wxT("Page1"),NULL,wxPG_KEEP_STRUCTURE); pg1_values = page1->GetPropertyValues("Page1",NULL,wxPG_KEEP_STRUCTURE);
page2 = pgman->GetPage(1); page2 = pgman->GetPage(1);
pg2_values = page2->GetPropertyValues(wxT("Page2"),NULL,wxPG_KEEP_STRUCTURE); pg2_values = page2->GetPropertyValues("Page2",NULL,wxPG_KEEP_STRUCTURE);
page3 = pgman->GetPage(2); page3 = pgman->GetPage(2);
pg3_values = page3->GetPropertyValues(wxT("Page3"),NULL,wxPG_KEEP_STRUCTURE); pg3_values = page3->GetPropertyValues("Page3",NULL,wxPG_KEEP_STRUCTURE);
} }
{ {
@@ -980,7 +980,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
page->Collapse( p ); page->Collapse( p );
t.Printf(wxT("Collapsing: %s\n"),page->GetPropertyLabel(p).c_str()); t.Printf("Collapsing: %s\n",page->GetPropertyLabel(p).c_str());
ed->AppendText(t); ed->AppendText(t);
} }
} }
@@ -1021,7 +1021,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
page->Expand( p ); page->Expand( p );
t.Printf(wxT("Expand: %s\n"),page->GetPropertyLabel(p).c_str()); t.Printf("Expand: %s\n",page->GetPropertyLabel(p).c_str());
ed->AppendText(t); ed->AppendText(t);
} }
} }
@@ -1030,14 +1030,14 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{ {
RT_START_TEST(Choice_Manipulation) RT_START_TEST(Choice_Manipulation)
wxPGProperty* enumProp = pgman->GetProperty(wxT("EnumProperty")); wxPGProperty* enumProp = pgman->GetProperty("EnumProperty");
pgman->SelectPage(2); pgman->SelectPage(2);
pgman->SelectProperty(enumProp); pgman->SelectProperty(enumProp);
wxASSERT(pgman->GetGrid()->GetSelection() == enumProp); wxASSERT(pgman->GetGrid()->GetSelection() == enumProp);
const wxPGChoices& choices = enumProp->GetChoices(); const wxPGChoices& choices = enumProp->GetChoices();
int ind = enumProp->InsertChoice(wxT("New Choice"), choices.GetCount()/2); int ind = enumProp->InsertChoice("New Choice", choices.GetCount()/2);
enumProp->DeleteChoice(ind); enumProp->DeleteChoice(ind);
// Recreate the original grid // Recreate the original grid
@@ -1084,7 +1084,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
{ {
RT_START_TEST(EnsureVisible) RT_START_TEST(EnsureVisible)
pgman->EnsureVisible(wxT("Cell Colour")); pgman->EnsureVisible("Cell Colour");
} }
{ {
@@ -1093,17 +1093,17 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p; wxPGProperty* p;
wxPGProperty* origParent = wxPGProperty* origParent =
pgman->GetProperty(wxT("Window Styles"))->GetParent(); pgman->GetProperty("Window Styles")->GetParent();
// For testing purposes, let's set some custom cell colours // For testing purposes, let's set some custom cell colours
p = pgman->GetProperty(wxT("Window Styles")); p = pgman->GetProperty("Window Styles");
p->SetCell(2, wxPGCell("style")); p->SetCell(2, wxPGCell("style"));
p = pgman->RemoveProperty(wxT("Window Styles")); p = pgman->RemoveProperty("Window Styles");
pgman->Refresh(); pgman->Refresh();
pgman->Update(); pgman->Update();
pgman->AppendIn(origParent, p); pgman->AppendIn(origParent, p);
wxASSERT( p->GetCell(2).GetText() == wxT("style")); wxASSERT( p->GetCell(2).GetText() == "style");
pgman->Refresh(); pgman->Refresh();
pgman->Update(); pgman->Update();
} }
@@ -1115,40 +1115,40 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
// Make sure indexes are as supposed // Make sure indexes are as supposed
p = pgman->GetProperty(wxT("User Name")); p = pgman->GetProperty("User Name");
if ( p->GetIndexInParent() != 3 ) if ( p->GetIndexInParent() != 3 )
RT_FAILURE(); RT_FAILURE();
p = pgman->GetProperty(wxT("User Id")); p = pgman->GetProperty("User Id");
if ( p->GetIndexInParent() != 2 ) if ( p->GetIndexInParent() != 2 )
RT_FAILURE(); RT_FAILURE();
p = pgman->GetProperty(wxT("User Home")); p = pgman->GetProperty("User Home");
if ( p->GetIndexInParent() != 1 ) if ( p->GetIndexInParent() != 1 )
RT_FAILURE(); RT_FAILURE();
p = pgman->GetProperty(wxT("Operating System")); p = pgman->GetProperty("Operating System");
if ( p->GetIndexInParent() != 0 ) if ( p->GetIndexInParent() != 0 )
RT_FAILURE(); RT_FAILURE();
pgman->GetGrid()->SetSortFunction(MyPropertySortFunction); pgman->GetGrid()->SetSortFunction(MyPropertySortFunction);
pgman->GetGrid()->SortChildren(wxT("Environment")); pgman->GetGrid()->SortChildren("Environment");
// Make sure indexes have been reversed // Make sure indexes have been reversed
p = pgman->GetProperty(wxT("User Name")); p = pgman->GetProperty("User Name");
if ( p->GetIndexInParent() != 0 ) if ( p->GetIndexInParent() != 0 )
RT_FAILURE(); RT_FAILURE();
p = pgman->GetProperty(wxT("User Id")); p = pgman->GetProperty("User Id");
if ( p->GetIndexInParent() != 1 ) if ( p->GetIndexInParent() != 1 )
RT_FAILURE(); RT_FAILURE();
p = pgman->GetProperty(wxT("User Home")); p = pgman->GetProperty("User Home");
if ( p->GetIndexInParent() != 2 ) if ( p->GetIndexInParent() != 2 )
RT_FAILURE(); RT_FAILURE();
p = pgman->GetProperty(wxT("Operating System")); p = pgman->GetProperty("Operating System");
if ( p->GetIndexInParent() != 3 ) if ( p->GetIndexInParent() != 3 )
RT_FAILURE(); RT_FAILURE();
} }
@@ -1166,7 +1166,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
RT_START_TEST(Clear) RT_START_TEST(Clear)
// Manager clear // Manager clear
pgman->SelectProperty(wxT("Label")); pgman->SelectProperty("Label");
pgman->Clear(); pgman->Clear();
if ( pgman->GetPageCount() ) if ( pgman->GetPageCount() )
@@ -1180,7 +1180,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pgman = m_pPropGridManager; pgman = m_pPropGridManager;
// Grid clear // Grid clear
pgman->SelectProperty(wxT("Label")); pgman->SelectProperty("Label");
pgman->GetGrid()->Clear(); pgman->GetGrid()->Clear();
if ( pgman->GetGrid()->GetRoot()->GetChildCount() ) if ( pgman->GetGrid()->GetRoot()->GetChildCount() )
@@ -1209,7 +1209,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pgman->SetSplitterPosition(trySplitterPos); pgman->SetSplitterPosition(trySplitterPos);
if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos ) if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos )
RT_FAILURE_MSG(wxString::Format(wxT("Splitter position was %i (should have been %i)"),(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos)); RT_FAILURE_MSG(wxString::Format("Splitter position was %i (should have been %i)",(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos));
m_topSizer->Add( m_pPropGridManager, wxSizerFlags(1).Expand()); m_topSizer->Add( m_pPropGridManager, wxSizerFlags(1).Expand());
FinalizePanel(); FinalizePanel();
@@ -1221,7 +1221,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
SetSize(sz); SetSize(sz);
if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos ) if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos )
RT_FAILURE_MSG(wxString::Format(wxT("Splitter position was %i (should have been %i)"),(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos)); RT_FAILURE_MSG(wxString::Format("Splitter position was %i (should have been %i)",(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos));
SetSize(origSz); SetSize(origSz);
@@ -1246,7 +1246,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr1[i]; wxPGProperty* p = arr1[i];
page->HideProperty(p, true); page->HideProperty(p, true);
wxString s = wxString::Format(wxT("HideProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s) RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ ) if ( _failed_ )
break; break;
@@ -1262,7 +1262,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr2[i]; wxPGProperty* p = arr2[i];
page->HideProperty(p, false); page->HideProperty(p, false);
wxString s = wxString::Format(wxT("ShowProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s) RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ ) if ( _failed_ )
break; break;
@@ -1280,7 +1280,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr1[i]; wxPGProperty* p = arr1[i];
page->HideProperty(p, true); page->HideProperty(p, true);
wxString s = wxString::Format(wxT("HideProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s) RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ ) if ( _failed_ )
break; break;
@@ -1296,7 +1296,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr2[i]; wxPGProperty* p = arr2[i];
page->HideProperty(p, false); page->HideProperty(p, false);
wxString s = wxString::Format(wxT("ShowProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s) RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ ) if ( _failed_ )
break; break;
@@ -1315,7 +1315,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr1[i]; wxPGProperty* p = arr1[i];
page->HideProperty(p, true); page->HideProperty(p, true);
wxString s = wxString::Format(wxT("HideProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s) RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ ) if ( _failed_ )
break; break;
@@ -1331,7 +1331,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
wxPGProperty* p = arr2[i]; wxPGProperty* p = arr2[i];
page->HideProperty(p, false); page->HideProperty(p, false);
wxString s = wxString::Format(wxT("ShowProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str());
RT_VALIDATE_VIRTUAL_HEIGHT(page, s) RT_VALIDATE_VIRTUAL_HEIGHT(page, s)
if ( _failed_ ) if ( _failed_ )
break; break;
@@ -1592,7 +1592,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pgman = m_pPropGridManager; pgman = m_pPropGridManager;
for ( i=3; i<12; i+=2 ) for ( i=3; i<12; i+=2 )
{ {
RT_MSG(wxString::Format(wxT("%i columns"),(int)i)); RT_MSG(wxString::Format("%i columns",(int)i));
pgman->SetColumnCount(i); pgman->SetColumnCount(i);
Refresh(); Refresh();
Update(); Update();
@@ -1610,7 +1610,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
for ( i=4; i<16; i++ ) for ( i=4; i<16; i++ )
{ {
int flag = 1<<i; int flag = 1<<i;
RT_MSG(wxString::Format(wxT("Style: 0x%X"),flag)); RT_MSG(wxString::Format("Style: 0x%X",flag));
CreateGrid( flag, -1 ); CreateGrid( flag, -1 );
pgman = m_pPropGridManager; pgman = m_pPropGridManager;
Update(); Update();
@@ -1622,7 +1622,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
for ( i=12; i<27; i++ ) for ( i=12; i<27; i++ )
{ {
int flag = 1<<i; int flag = 1<<i;
RT_MSG(wxString::Format(wxT("ExStyle: 0x%X"),flag)); RT_MSG(wxString::Format("ExStyle: 0x%X",flag));
CreateGrid( -1, flag ); CreateGrid( -1, flag );
pgman = m_pPropGridManager; pgman = m_pPropGridManager;
Update(); Update();
@@ -1649,19 +1649,19 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
if ( failures ) if ( failures )
#endif #endif
s = wxString::Format(wxT("%i tests failed!!!"), failures); s = wxString::Format("%i tests failed!!!", failures);
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
else else
s = wxString::Format(wxT("All tests were successful, but there were %i warnings!"), wxPGGlobalVars->m_warnings); s = wxString::Format("All tests were successful, but there were %i warnings!", wxPGGlobalVars->m_warnings);
#endif #endif
RT_MSG(s) RT_MSG(s)
for ( i=0; i<errorMessages.size(); i++ ) for ( i=0; i<errorMessages.size(); i++ )
RT_MSG(errorMessages[i]) RT_MSG(errorMessages[i])
wxMessageBox(s, wxT("Some Tests Failed")); wxMessageBox(s, "Some Tests Failed");
} }
else else
{ {
RT_MSG(wxT("All tests successful")) RT_MSG("All tests successful")
retVal = true; retVal = true;
if ( !interactive ) if ( !interactive )

View File

@@ -571,7 +571,7 @@ void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event))
wxRendererNative *renderer = wxRendererNative::Load(name); wxRendererNative *renderer = wxRendererNative::Load(name);
if ( !renderer ) if ( !renderer )
{ {
wxLogError(wxT("Failed to load renderer \"%s\"."), name.c_str()); wxLogError("Failed to load renderer \"%s\".", name.c_str());
} }
else // loaded ok else // loaded ok
{ {
@@ -579,7 +579,7 @@ void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event))
m_panel->Refresh(); m_panel->Refresh();
wxLogStatus(this, wxT("Successfully loaded the renderer \"%s\"."), wxLogStatus(this, "Successfully loaded the renderer \"%s\".",
name.c_str()); name.c_str());
} }
} }

View File

@@ -651,7 +651,7 @@ void MyFrame::OnPrimaryColourSelect(wxRibbonGalleryEvent& evt)
{ {
wxString name; wxString name;
wxColour colour = GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), &name); wxColour colour = GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), &name);
AddText(wxT("Colour \"") + name + wxT("\" selected as primary.")); AddText("Colour \"" + name + "\" selected as primary.");
wxColour secondary, tertiary; wxColour secondary, tertiary;
m_ribbon->GetArtProvider()->GetColourScheme(NULL, &secondary, &tertiary); m_ribbon->GetArtProvider()->GetColourScheme(NULL, &secondary, &tertiary);
m_ribbon->GetArtProvider()->SetColourScheme(colour, secondary, tertiary); m_ribbon->GetArtProvider()->SetColourScheme(colour, secondary, tertiary);
@@ -663,7 +663,7 @@ void MyFrame::OnSecondaryColourSelect(wxRibbonGalleryEvent& evt)
{ {
wxString name; wxString name;
wxColour colour = GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), &name); wxColour colour = GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), &name);
AddText(wxT("Colour \"") + name + wxT("\" selected as secondary.")); AddText("Colour \"" + name + "\" selected as secondary.");
wxColour primary, tertiary; wxColour primary, tertiary;
m_ribbon->GetArtProvider()->GetColourScheme(&primary, NULL, &tertiary); m_ribbon->GetArtProvider()->GetColourScheme(&primary, NULL, &tertiary);
m_ribbon->GetArtProvider()->SetColourScheme(primary, colour, tertiary); m_ribbon->GetArtProvider()->SetColourScheme(primary, colour, tertiary);

View File

@@ -149,9 +149,9 @@ Edit::Edit (wxWindow *parent, wxWindowID id,
StyleSetFont (wxSTC_STYLE_DEFAULT, font); StyleSetFont (wxSTC_STYLE_DEFAULT, font);
StyleSetForeground (wxSTC_STYLE_DEFAULT, *wxBLACK); StyleSetForeground (wxSTC_STYLE_DEFAULT, *wxBLACK);
StyleSetBackground (wxSTC_STYLE_DEFAULT, *wxWHITE); StyleSetBackground (wxSTC_STYLE_DEFAULT, *wxWHITE);
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY"))); StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY"));
StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE); StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE);
StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY"))); StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY"));
InitializePrefs (DEFAULT_LANGUAGE); InitializePrefs (DEFAULT_LANGUAGE);
// set visibility // set visibility
@@ -160,19 +160,19 @@ Edit::Edit (wxWindow *parent, wxWindowID id,
SetYCaretPolicy (wxSTC_CARET_EVEN|wxSTC_VISIBLE_STRICT|wxSTC_CARET_SLOP, 1); SetYCaretPolicy (wxSTC_CARET_EVEN|wxSTC_VISIBLE_STRICT|wxSTC_CARET_SLOP, 1);
// markers // markers
MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_DOTDOTDOT, wxT("BLACK"), wxT("BLACK")); MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_DOTDOTDOT, "BLACK", "BLACK");
MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, wxT("BLACK"), wxT("BLACK")); MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, "BLACK", "BLACK");
MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK")); MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_DOTDOTDOT, wxT("BLACK"), wxT("WHITE")); MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_DOTDOTDOT, "BLACK", "WHITE");
MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, wxT("BLACK"), wxT("WHITE")); MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, "BLACK", "WHITE");
MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK")); MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK")); MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK");
// annotations // annotations
AnnotationSetVisible(wxSTC_ANNOTATION_BOXED); AnnotationSetVisible(wxSTC_ANNOTATION_BOXED);
// miscellaneous // miscellaneous
m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, wxT("_999999")); m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, "_999999");
m_FoldingMargin = 16; m_FoldingMargin = 16;
CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key
SetLayoutCache (wxSTC_CACHE_PAGE); SetLayoutCache (wxSTC_CACHE_PAGE);
@@ -501,8 +501,8 @@ wxString Edit::DeterminePrefs (const wxString &filename) {
while (!filepattern.empty()) { while (!filepattern.empty()) {
wxString cur = filepattern.BeforeFirst (';'); wxString cur = filepattern.BeforeFirst (';');
if ((cur == filename) || if ((cur == filename) ||
(cur == (filename.BeforeLast ('.') + wxT(".*"))) || (cur == (filename.BeforeLast ('.') + ".*")) ||
(cur == (wxT("*.") + filename.AfterLast ('.')))) { (cur == ("*." + filename.AfterLast ('.')))) {
return curInfo->name; return curInfo->name;
} }
filepattern = filepattern.AfterFirst (';'); filepattern = filepattern.AfterFirst (';');
@@ -536,7 +536,7 @@ bool Edit::InitializePrefs (const wxString &name) {
// set margin for line numbers // set margin for line numbers
SetMarginType (m_LineNrID, wxSTC_MARGIN_NUMBER); SetMarginType (m_LineNrID, wxSTC_MARGIN_NUMBER);
StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY"))); StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY"));
StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE); StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE);
SetMarginWidth (m_LineNrID, 0); // start out not visible SetMarginWidth (m_LineNrID, 0); // start out not visible
@@ -554,8 +554,8 @@ bool Edit::InitializePrefs (const wxString &name) {
} }
// set common styles // set common styles
StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour (wxT("DARK GREY"))); StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour ("DARK GREY"));
StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY"))); StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY"));
// initialize settings // initialize settings
if (g_CommonPrefs.syntaxEnable) { if (g_CommonPrefs.syntaxEnable) {
@@ -567,10 +567,10 @@ bool Edit::InitializePrefs (const wxString &name) {
.Family(wxFONTFAMILY_MODERN) .Family(wxFONTFAMILY_MODERN)
.FaceName(curType.fontname)); .FaceName(curType.fontname));
StyleSetFont (Nr, font); StyleSetFont (Nr, font);
if (curType.foreground) { if (curType.foreground.length()) {
StyleSetForeground (Nr, wxColour (curType.foreground)); StyleSetForeground (Nr, wxColour (curType.foreground));
} }
if (curType.background) { if (curType.background.length()) {
StyleSetBackground (Nr, wxColour (curType.background)); StyleSetBackground (Nr, wxColour (curType.background));
} }
StyleSetBold (Nr, (curType.fontstyle & mySTC_STYLE_BOLD) > 0); StyleSetBold (Nr, (curType.fontstyle & mySTC_STYLE_BOLD) > 0);
@@ -600,21 +600,21 @@ bool Edit::InitializePrefs (const wxString &name) {
if (g_CommonPrefs.foldEnable) { if (g_CommonPrefs.foldEnable) {
SetMarginWidth (m_FoldingID, curInfo->folds != 0? m_FoldingMargin: 0); SetMarginWidth (m_FoldingID, curInfo->folds != 0? m_FoldingMargin: 0);
SetMarginSensitive (m_FoldingID, curInfo->folds != 0); SetMarginSensitive (m_FoldingID, curInfo->folds != 0);
SetProperty (wxT("fold"), curInfo->folds != 0? wxT("1"): wxT("0")); SetProperty ("fold", curInfo->folds != 0? "1": "0");
SetProperty (wxT("fold.comment"), SetProperty ("fold.comment",
(curInfo->folds & mySTC_FOLD_COMMENT) > 0? wxT("1"): wxT("0")); (curInfo->folds & mySTC_FOLD_COMMENT) > 0? "1": "0");
SetProperty (wxT("fold.compact"), SetProperty ("fold.compact",
(curInfo->folds & mySTC_FOLD_COMPACT) > 0? wxT("1"): wxT("0")); (curInfo->folds & mySTC_FOLD_COMPACT) > 0? "1": "0");
SetProperty (wxT("fold.preprocessor"), SetProperty ("fold.preprocessor",
(curInfo->folds & mySTC_FOLD_PREPROC) > 0? wxT("1"): wxT("0")); (curInfo->folds & mySTC_FOLD_PREPROC) > 0? "1": "0");
SetProperty (wxT("fold.html"), SetProperty ("fold.html",
(curInfo->folds & mySTC_FOLD_HTML) > 0? wxT("1"): wxT("0")); (curInfo->folds & mySTC_FOLD_HTML) > 0? "1": "0");
SetProperty (wxT("fold.html.preprocessor"), SetProperty ("fold.html.preprocessor",
(curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? wxT("1"): wxT("0")); (curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? "1": "0");
SetProperty (wxT("fold.comment.python"), SetProperty ("fold.comment.python",
(curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? wxT("1"): wxT("0")); (curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? "1": "0");
SetProperty (wxT("fold.quotes.python"), SetProperty ("fold.quotes.python",
(curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? wxT("1"): wxT("0")); (curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? "1": "0");
} }
SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED | SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED |
wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED); wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);
@@ -646,8 +646,8 @@ bool Edit::LoadFile ()
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
// get filename // get filename
if (!m_filename) { if (!m_filename) {
wxFileDialog dlg (this, wxT("Open file"), wxEmptyString, wxEmptyString, wxFileDialog dlg (this, "Open file", wxEmptyString, wxEmptyString,
wxT("Any file (*)|*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR); "Any file (*)|*", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
if (dlg.ShowModal() != wxID_OK) return false; if (dlg.ShowModal() != wxID_OK) return false;
m_filename = dlg.GetPath(); m_filename = dlg.GetPath();
} }
@@ -683,7 +683,7 @@ bool Edit::SaveFile ()
// get filename // get filename
if (!m_filename) { if (!m_filename) {
wxFileDialog dlg (this, wxT("Save file"), wxEmptyString, wxEmptyString, wxT("Any file (*)|*"), wxFileDialog dlg (this, "Save file", wxEmptyString, wxEmptyString, "Any file (*)|*",
wxFD_SAVE | wxFD_OVERWRITE_PROMPT); wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return false; if (dlg.ShowModal() != wxID_OK) return false;
m_filename = dlg.GetPath(); m_filename = dlg.GetPath();
@@ -757,14 +757,14 @@ EditProperties::EditProperties (Edit *edit,
textinfo->Add (new wxStaticText (this, wxID_ANY, _("Lexer-ID: "), textinfo->Add (new wxStaticText (this, wxID_ANY, _("Lexer-ID: "),
wxDefaultPosition, wxSize(80, wxDefaultCoord)), wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetLexer()); text = wxString::Format ("%d", edit->GetLexer());
textinfo->Add (new wxStaticText (this, wxID_ANY, text), textinfo->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
wxString EOLtype = wxEmptyString; wxString EOLtype = wxEmptyString;
switch (edit->GetEOLMode()) { switch (edit->GetEOLMode()) {
case wxSTC_EOL_CR: {EOLtype = wxT("CR (Unix)"); break; } case wxSTC_EOL_CR: {EOLtype = "CR (Unix)"; break; }
case wxSTC_EOL_CRLF: {EOLtype = wxT("CRLF (Windows)"); break; } case wxSTC_EOL_CRLF: {EOLtype = "CRLF (Windows)"; break; }
case wxSTC_EOL_LF: {EOLtype = wxT("CR (Macintosh)"); break; } case wxSTC_EOL_LF: {EOLtype = "CR (Macintosh)"; break; }
} }
textinfo->Add (new wxStaticText (this, wxID_ANY, _("Line endings"), textinfo->Add (new wxStaticText (this, wxID_ANY, _("Line endings"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)), wxDefaultPosition, wxSize(80, wxDefaultCoord)),
@@ -774,7 +774,7 @@ EditProperties::EditProperties (Edit *edit,
// text info box // text info box
wxStaticBoxSizer *textinfos = new wxStaticBoxSizer ( wxStaticBoxSizer *textinfos = new wxStaticBoxSizer (
new wxStaticBox (this, wxID_ANY, _("Informations")), new wxStaticBox (this, wxID_ANY, _("Information")),
wxVERTICAL); wxVERTICAL);
textinfos->Add (textinfo, 0, wxEXPAND); textinfos->Add (textinfo, 0, wxEXPAND);
textinfos->Add (0, 6); textinfos->Add (0, 6);
@@ -784,25 +784,25 @@ EditProperties::EditProperties (Edit *edit,
statistic->Add (new wxStaticText (this, wxID_ANY, _("Total lines"), statistic->Add (new wxStaticText (this, wxID_ANY, _("Total lines"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)), wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetLineCount()); text = wxString::Format ("%d", edit->GetLineCount());
statistic->Add (new wxStaticText (this, wxID_ANY, text), statistic->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
statistic->Add (new wxStaticText (this, wxID_ANY, _("Total chars"), statistic->Add (new wxStaticText (this, wxID_ANY, _("Total chars"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)), wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetTextLength()); text = wxString::Format ("%d", edit->GetTextLength());
statistic->Add (new wxStaticText (this, wxID_ANY, text), statistic->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
statistic->Add (new wxStaticText (this, wxID_ANY, _("Current line"), statistic->Add (new wxStaticText (this, wxID_ANY, _("Current line"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)), wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetCurrentLine()); text = wxString::Format ("%d", edit->GetCurrentLine());
statistic->Add (new wxStaticText (this, wxID_ANY, text), statistic->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
statistic->Add (new wxStaticText (this, wxID_ANY, _("Current pos"), statistic->Add (new wxStaticText (this, wxID_ANY, _("Current pos"),
wxDefaultPosition, wxSize(80, wxDefaultCoord)), wxDefaultPosition, wxSize(80, wxDefaultCoord)),
0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4);
text = wxString::Format (wxT("%d"), edit->GetCurrentPos()); text = wxString::Format ("%d", edit->GetCurrentPos());
statistic->Add (new wxStaticText (this, wxID_ANY, text), statistic->Add (new wxStaticText (this, wxID_ANY, text),
0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4);
@@ -836,7 +836,7 @@ EditProperties::EditProperties (Edit *edit,
// EditPrint // EditPrint
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
EditPrint::EditPrint (Edit *edit, const wxChar *title) EditPrint::EditPrint (Edit *edit, const wxString& title)
: wxPrintout(title) : wxPrintout(title)
, m_edit(edit) , m_edit(edit)
{ {

View File

@@ -162,7 +162,7 @@ class EditPrint: public wxPrintout {
public: public:
//! constructor //! constructor
EditPrint (Edit *edit, const wxChar *title = wxT("")); EditPrint (Edit *edit, const wxString& title = "");
//! event handlers //! event handlers
bool OnPrintPage (int page) wxOVERRIDE; bool OnPrintPage (int page) wxOVERRIDE;

View File

@@ -218,159 +218,159 @@ const int g_LanguagePrefsSize = WXSIZEOF(g_LanguagePrefs);
//! style types //! style types
const StyleInfo g_StylePrefs [] = { const StyleInfo g_StylePrefs [] = {
// mySTC_TYPE_DEFAULT // mySTC_TYPE_DEFAULT
{wxT("Default"), {"Default",
wxT("BLACK"), wxT("WHITE"), "BLACK", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_WORD1 // mySTC_TYPE_WORD1
{wxT("Keyword1"), {"Keyword1",
wxT("BLUE"), wxT("WHITE"), "BLUE", "WHITE",
wxT(""), 10, mySTC_STYLE_BOLD, 0}, "", 10, mySTC_STYLE_BOLD, 0},
// mySTC_TYPE_WORD2 // mySTC_TYPE_WORD2
{wxT("Keyword2"), {"Keyword2",
wxT("MIDNIGHT BLUE"), wxT("WHITE"), "MIDNIGHT BLUE", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_WORD3 // mySTC_TYPE_WORD3
{wxT("Keyword3"), {"Keyword3",
wxT("CORNFLOWER BLUE"), wxT("WHITE"), "CORNFLOWER BLUE", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_WORD4 // mySTC_TYPE_WORD4
{wxT("Keyword4"), {"Keyword4",
wxT("CYAN"), wxT("WHITE"), "CYAN", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_WORD5 // mySTC_TYPE_WORD5
{wxT("Keyword5"), {"Keyword5",
wxT("DARK GREY"), wxT("WHITE"), "DARK GREY", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_WORD6 // mySTC_TYPE_WORD6
{wxT("Keyword6"), {"Keyword6",
wxT("GREY"), wxT("WHITE"), "GREY", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_COMMENT // mySTC_TYPE_COMMENT
{wxT("Comment"), {"Comment",
wxT("FOREST GREEN"), wxT("WHITE"), "FOREST GREEN", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_COMMENT_DOC // mySTC_TYPE_COMMENT_DOC
{wxT("Comment (Doc)"), {"Comment (Doc)",
wxT("FOREST GREEN"), wxT("WHITE"), "FOREST GREEN", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_COMMENT_LINE // mySTC_TYPE_COMMENT_LINE
{wxT("Comment line"), {"Comment line",
wxT("FOREST GREEN"), wxT("WHITE"), "FOREST GREEN", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_COMMENT_SPECIAL // mySTC_TYPE_COMMENT_SPECIAL
{wxT("Special comment"), {"Special comment",
wxT("FOREST GREEN"), wxT("WHITE"), "FOREST GREEN", "WHITE",
wxT(""), 10, mySTC_STYLE_ITALIC, 0}, "", 10, mySTC_STYLE_ITALIC, 0},
// mySTC_TYPE_CHARACTER // mySTC_TYPE_CHARACTER
{wxT("Character"), {"Character",
wxT("KHAKI"), wxT("WHITE"), "KHAKI", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_CHARACTER_EOL // mySTC_TYPE_CHARACTER_EOL
{wxT("Character (EOL)"), {"Character (EOL)",
wxT("KHAKI"), wxT("WHITE"), "KHAKI", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_STRING // mySTC_TYPE_STRING
{wxT("String"), {"String",
wxT("BROWN"), wxT("WHITE"), "BROWN", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_STRING_EOL // mySTC_TYPE_STRING_EOL
{wxT("String (EOL)"), {"String (EOL)",
wxT("BROWN"), wxT("WHITE"), "BROWN", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_DELIMITER // mySTC_TYPE_DELIMITER
{wxT("Delimiter"), {"Delimiter",
wxT("ORANGE"), wxT("WHITE"), "ORANGE", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_PUNCTUATION // mySTC_TYPE_PUNCTUATION
{wxT("Punctuation"), {"Punctuation",
wxT("ORANGE"), wxT("WHITE"), "ORANGE", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_OPERATOR // mySTC_TYPE_OPERATOR
{wxT("Operator"), {"Operator",
wxT("BLACK"), wxT("WHITE"), "BLACK", "WHITE",
wxT(""), 10, mySTC_STYLE_BOLD, 0}, "", 10, mySTC_STYLE_BOLD, 0},
// mySTC_TYPE_BRACE // mySTC_TYPE_BRACE
{wxT("Label"), {"Label",
wxT("VIOLET"), wxT("WHITE"), "VIOLET", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_COMMAND // mySTC_TYPE_COMMAND
{wxT("Command"), {"Command",
wxT("BLUE"), wxT("WHITE"), "BLUE", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_IDENTIFIER // mySTC_TYPE_IDENTIFIER
{wxT("Identifier"), {"Identifier",
wxT("BLACK"), wxT("WHITE"), "BLACK", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_LABEL // mySTC_TYPE_LABEL
{wxT("Label"), {"Label",
wxT("VIOLET"), wxT("WHITE"), "VIOLET", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_NUMBER // mySTC_TYPE_NUMBER
{wxT("Number"), {"Number",
wxT("SIENNA"), wxT("WHITE"), "SIENNA", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_PARAMETER // mySTC_TYPE_PARAMETER
{wxT("Parameter"), {"Parameter",
wxT("VIOLET"), wxT("WHITE"), "VIOLET", "WHITE",
wxT(""), 10, mySTC_STYLE_ITALIC, 0}, "", 10, mySTC_STYLE_ITALIC, 0},
// mySTC_TYPE_REGEX // mySTC_TYPE_REGEX
{wxT("Regular expression"), {"Regular expression",
wxT("ORCHID"), wxT("WHITE"), "ORCHID", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_UUID // mySTC_TYPE_UUID
{wxT("UUID"), {"UUID",
wxT("ORCHID"), wxT("WHITE"), "ORCHID", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_VALUE // mySTC_TYPE_VALUE
{wxT("Value"), {"Value",
wxT("ORCHID"), wxT("WHITE"), "ORCHID", "WHITE",
wxT(""), 10, mySTC_STYLE_ITALIC, 0}, "", 10, mySTC_STYLE_ITALIC, 0},
// mySTC_TYPE_PREPROCESSOR // mySTC_TYPE_PREPROCESSOR
{wxT("Preprocessor"), {"Preprocessor",
wxT("GREY"), wxT("WHITE"), "GREY", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_SCRIPT // mySTC_TYPE_SCRIPT
{wxT("Script"), {"Script",
wxT("DARK GREY"), wxT("WHITE"), "DARK GREY", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_ERROR // mySTC_TYPE_ERROR
{wxT("Error"), {"Error",
wxT("RED"), wxT("WHITE"), "RED", "WHITE",
wxT(""), 10, 0, 0}, "", 10, 0, 0},
// mySTC_TYPE_UNDEFINED // mySTC_TYPE_UNDEFINED
{wxT("Undefined"), {"Undefined",
wxT("ORANGE"), wxT("WHITE"), "ORANGE", "WHITE",
wxT(""), 10, 0, 0} "", 10, 0, 0}
}; };

View File

@@ -136,10 +136,10 @@ extern const int g_LanguagePrefsSize;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// StyleInfo // StyleInfo
struct StyleInfo { struct StyleInfo {
const wxChar *name; const wxString name;
const wxChar *foreground; const wxString foreground;
const wxChar *background; const wxString background;
const wxChar *fontname; const wxString fontname;
int fontsize; int fontsize;
int fontstyle; int fontstyle;
int lettercase; int lettercase;

View File

@@ -54,19 +54,19 @@
// declarations // declarations
//============================================================================ //============================================================================
#define APP_NAME wxT("STC-Test") #define APP_NAME "STC-Test"
#define APP_DESCR _("See http://wxguide.sourceforge.net/") #define APP_DESCR "See http://wxguide.sourceforge.net/"
#define APP_MAINT wxT("Otto Wyss") #define APP_MAINT "Otto Wyss"
#define APP_VENDOR wxT("wxWidgets") #define APP_VENDOR "wxWidgets"
#define APP_COPYRIGTH wxT("(C) 2003 Otto Wyss") #define APP_COPYRIGTH "(C) 2003 Otto Wyss"
#define APP_LICENCE wxT("wxWidgets") #define APP_LICENCE "wxWidgets"
#define APP_VERSION wxT("0.1.alpha") #define APP_VERSION "0.1.alpha"
#define APP_BUILD __DATE__ #define APP_BUILD __DATE__
#define APP_WEBSITE wxT("http://www.wxWidgets.org") #define APP_WEBSITE "http://www.wxWidgets.org"
#define APP_MAIL wxT("mailto://???") #define APP_MAIL "mailto://???"
#define NONAME _("<untitled>") #define NONAME _("<untitled>")
@@ -214,7 +214,7 @@ bool App::OnInit () {
SetVendorName (APP_VENDOR); SetVendorName (APP_VENDOR);
g_appname = new wxString (); g_appname = new wxString ();
g_appname->Append (APP_VENDOR); g_appname->Append (APP_VENDOR);
g_appname->Append (wxT("-")); g_appname->Append ("-");
g_appname->Append (APP_NAME); g_appname->Append (APP_NAME);
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
@@ -301,7 +301,7 @@ AppFrame::AppFrame (const wxString &title)
// set icon and background // set icon and background
SetTitle (*g_appname); SetTitle (*g_appname);
SetBackgroundColour (wxT("WHITE")); SetBackgroundColour ("WHITE");
// create menu // create menu
m_menuBar = new wxMenuBar; m_menuBar = new wxMenuBar;
@@ -311,7 +311,7 @@ AppFrame::AppFrame (const wxString &title)
m_edit = new Edit (this, wxID_ANY); m_edit = new Edit (this, wxID_ANY);
m_edit->SetFocus(); m_edit->SetFocus();
FileOpen (wxT("stctest.cpp")); FileOpen ("stctest.cpp");
} }
AppFrame::~AppFrame () { AppFrame::~AppFrame () {
@@ -341,7 +341,7 @@ void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) {
if (!m_edit) return; if (!m_edit) return;
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
wxString fname; wxString fname;
wxFileDialog dlg (this, wxT("Open file"), wxEmptyString, wxEmptyString, wxT("Any file (*)|*"), wxFileDialog dlg (this, "Open file", wxEmptyString, wxEmptyString, "Any file (*)|*",
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR); wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
if (dlg.ShowModal() != wxID_OK) return; if (dlg.ShowModal() != wxID_OK) return;
fname = dlg.GetPath (); fname = dlg.GetPath ();
@@ -363,7 +363,7 @@ void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) {
if (!m_edit) return; if (!m_edit) return;
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
wxString filename = wxEmptyString; wxString filename = wxEmptyString;
wxFileDialog dlg (this, wxT("Save file"), wxEmptyString, wxEmptyString, wxT("Any file (*)|*"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); wxFileDialog dlg (this, "Save file", wxEmptyString, wxEmptyString, "Any file (*)|*", wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return; if (dlg.ShowModal() != wxID_OK) return;
filename = dlg.GetPath(); filename = dlg.GetPath();
m_edit->SaveFile (filename); m_edit->SaveFile (filename);
@@ -466,8 +466,8 @@ void AppFrame::OnContextMenu(wxContextMenuEvent& evt)
} }
wxMenu menu; wxMenu menu;
menu.Append(wxID_ABOUT, wxT("&About")); menu.Append(wxID_ABOUT, "&About");
menu.Append(wxID_EXIT, wxT("E&xit")); menu.Append(wxID_EXIT, "E&xit");
PopupMenu(&menu, point); PopupMenu(&menu, point);
} }
@@ -733,23 +733,23 @@ public:
{ {
SetLexerXml(); SetLexerXml();
SetProperty(wxT("fold"), wxT("1")); SetProperty("fold", "1");
SetProperty(wxT("fold.comment"), wxT("1")); SetProperty("fold.comment", "1");
SetProperty(wxT("fold.compact"), wxT("1")); SetProperty("fold.compact", "1");
SetProperty(wxT("fold.preprocessor"), wxT("1")); SetProperty("fold.preprocessor", "1");
SetProperty(wxT("fold.html"), wxT("1")); SetProperty("fold.html", "1");
SetProperty(wxT("fold.html.preprocessor"), wxT("1")); SetProperty("fold.html.preprocessor", "1");
SetMarginType(margin_id_lineno, wxSTC_MARGIN_NUMBER); SetMarginType(margin_id_lineno, wxSTC_MARGIN_NUMBER);
SetMarginWidth(margin_id_lineno, 32); SetMarginWidth(margin_id_lineno, 32);
MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, wxT("WHITE"), wxT("BLACK")); MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, "WHITE", "BLACK");
MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, wxT("WHITE"), wxT("BLACK")); MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, "WHITE", "BLACK");
MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, wxT("WHITE"), wxT("BLACK")); MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, "WHITE", "BLACK");
MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, wxT("WHITE"), wxT("BLACK")); MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, "WHITE", "BLACK");
MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, wxT("WHITE"), wxT("BLACK")); MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, "WHITE", "BLACK");
MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, wxT("WHITE"), wxT("BLACK")); MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, "WHITE", "BLACK");
MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, wxT("WHITE"), wxT("BLACK")); MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, "WHITE", "BLACK");
SetMarginMask(margin_id_fold, wxSTC_MASK_FOLDERS); SetMarginMask(margin_id_fold, wxSTC_MASK_FOLDERS);
SetMarginWidth(margin_id_fold, 32); SetMarginWidth(margin_id_fold, 32);
@@ -780,7 +780,7 @@ public:
StyleSetForeground(wxSTC_H_DOUBLESTRING, *wxBLACK); StyleSetForeground(wxSTC_H_DOUBLESTRING, *wxBLACK);
StyleSetForeground(wxSTC_H_SINGLESTRING, *wxBLACK); StyleSetForeground(wxSTC_H_SINGLESTRING, *wxBLACK);
StyleSetForeground(wxSTC_H_OTHER, *wxBLUE); StyleSetForeground(wxSTC_H_OTHER, *wxBLUE);
StyleSetForeground(wxSTC_H_COMMENT, wxTheColourDatabase->Find(wxT("GREY"))); StyleSetForeground(wxSTC_H_COMMENT, wxTheColourDatabase->Find("GREY"));
StyleSetForeground(wxSTC_H_ENTITY, *wxRED); StyleSetForeground(wxSTC_H_ENTITY, *wxRED);
StyleSetBold(wxSTC_H_ENTITY, true); StyleSetBold(wxSTC_H_ENTITY, true);
StyleSetForeground(wxSTC_H_TAGEND, *wxBLUE); StyleSetForeground(wxSTC_H_TAGEND, *wxBLUE);
@@ -814,7 +814,7 @@ void MinimalEditor::OnMarginClick(wxStyledTextEvent &event)
void MinimalEditor::OnText(wxStyledTextEvent& event) void MinimalEditor::OnText(wxStyledTextEvent& event)
{ {
wxLogDebug(wxT("Modified")); wxLogDebug("Modified");
event.Skip(); event.Skip();
} }

View File

@@ -898,7 +898,7 @@ void MyTextCtrl::OnText(wxCommandEvent& event)
const wxChar *data = (const wxChar *)(win->GetClientData()); const wxChar *data = (const wxChar *)(win->GetClientData());
if ( data ) if ( data )
{ {
wxLogMessage(wxT("Text %s in control \"%s\""), changeVerb, data); wxLogMessage("Text %s in control \"%s\"", changeVerb, data);
} }
else else
{ {
@@ -1022,7 +1022,7 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event)
(unsigned int) sel.length()); (unsigned int) sel.length());
const wxString text = GetLineText(line); const wxString text = GetLineText(line);
wxLogMessage(wxT("Current line: \"%s\"; length = %lu"), wxLogMessage("Current line: \"%s\"; length = %lu",
text.c_str(), text.length()); text.c_str(), text.length());
} }
break; break;
@@ -1212,7 +1212,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
"very very very long line to test " "very very very long line to test "
"wxHSCROLL style\n" "wxHSCROLL style\n"
"\nAnd here is a link in quotation marks to " "\nAnd here is a link in quotation marks to "
wxT("test wxTE_AUTO_URL: \"http://www.wxwidgets.org\""), "test wxTE_AUTO_URL: \"http://www.wxwidgets.org\"",
wxPoint(450, 10), wxSize(200, 230), wxPoint(450, 10), wxSize(200, 230),
wxTE_RICH | wxTE_MULTILINE | wxTE_AUTO_URL); wxTE_RICH | wxTE_MULTILINE | wxTE_AUTO_URL);
m_textrich->SetStyle(0, 10, *wxRED); m_textrich->SetStyle(0, 10, *wxRED);

View File

@@ -605,7 +605,7 @@ MyFrame::MyFrame(wxFrame* parent,
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN2, "Toggle &2nd radio button\tCtrl-2"); toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN2, "Toggle &2nd radio button\tCtrl-2");
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN3, "Toggle &3rd radio button\tCtrl-3"); toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN3, "Toggle &3rd radio button\tCtrl-3");
toolMenu->AppendSeparator(); toolMenu->AppendSeparator();
toolMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, wxT("Change tooltip of \"New\"")); toolMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, "Change tooltip of \"New\"");
toolMenu->AppendSeparator(); toolMenu->AppendSeparator();
toolMenu->Append(IDM_TOOLBAR_INC_TOOL_SPACING, "Increase spacing\tCtrl-+"); toolMenu->Append(IDM_TOOLBAR_INC_TOOL_SPACING, "Increase spacing\tCtrl-+");
toolMenu->Append(IDM_TOOLBAR_DEC_TOOL_SPACING, "Decrease spacing\tCtrl--"); toolMenu->Append(IDM_TOOLBAR_DEC_TOOL_SPACING, "Decrease spacing\tCtrl--");

View File

@@ -1298,12 +1298,12 @@ void MyTreeCtrl::DoResetBrokenStateImages(const wxTreeItemId& idParent,
DoResetBrokenStateImages(idParent, cookie, state); DoResetBrokenStateImages(idParent, cookie, state);
} }
void MyTreeCtrl::LogEvent(const wxChar *name, const wxTreeEvent& event) void MyTreeCtrl::LogEvent(const wxString& name, const wxTreeEvent& event)
{ {
wxTreeItemId item = event.GetItem(); wxTreeItemId item = event.GetItem();
wxString text; wxString text;
if ( item.IsOk() ) if ( item.IsOk() )
text << wxT('"') << GetItemText(item).c_str() << wxT('"'); text << '"' << GetItemText(item).c_str() << '"';
else else
text = "invalid item"; text = "invalid item";
wxLogMessage("%s(%s)", name, text.c_str()); wxLogMessage("%s(%s)", name, text.c_str());
@@ -1313,7 +1313,7 @@ void MyTreeCtrl::LogEvent(const wxChar *name, const wxTreeEvent& event)
#define TREE_EVENT_HANDLER(name) \ #define TREE_EVENT_HANDLER(name) \
void MyTreeCtrl::name(wxTreeEvent& event) \ void MyTreeCtrl::name(wxTreeEvent& event) \
{ \ { \
LogEvent(wxT(#name), event); \ LogEvent(#name, event); \
event.Skip(); \ event.Skip(); \
} }
@@ -1606,7 +1606,7 @@ void MyTreeCtrl::OnItemStateClick(wxTreeEvent& event)
wxTreeItemId itemId = event.GetItem(); wxTreeItemId itemId = event.GetItem();
DoToggleState(itemId); DoToggleState(itemId);
wxLogMessage(wxT("Item \"%s\" state changed to %d"), wxLogMessage("Item \"%s\" state changed to %d",
GetItemText(itemId), GetItemState(itemId)); GetItemText(itemId), GetItemState(itemId));
} }
@@ -1619,8 +1619,8 @@ void MyTreeCtrl::OnItemMenu(wxTreeEvent& event)
wxPoint clientpt = event.GetPoint(); wxPoint clientpt = event.GetPoint();
wxPoint screenpt = ClientToScreen(clientpt); wxPoint screenpt = ClientToScreen(clientpt);
wxLogMessage(wxT("OnItemMenu for item \"%s\" at screen coords (%i, %i)"), wxLogMessage("OnItemMenu for item \"%s\" at screen coords (%i, %i)",
item ? item->GetDesc() : wxString(wxS("unknown")), screenpt.x, screenpt.y); item ? item->GetDesc() : wxString("unknown"), screenpt.x, screenpt.y);
ShowMenu(itemId, clientpt); ShowMenu(itemId, clientpt);
event.Skip(); event.Skip();
@@ -1665,7 +1665,7 @@ void MyTreeCtrl::OnItemRClick(wxTreeEvent& event)
MyTreeItemData *item = (MyTreeItemData *)GetItemData(itemId); MyTreeItemData *item = (MyTreeItemData *)GetItemData(itemId);
wxLogMessage(wxT("Item \"%s\" right clicked"), item ? item->GetDesc() : wxString(wxS("unknown"))); wxLogMessage("Item \"%s\" right clicked", item ? item->GetDesc() : wxString("unknown"));
event.Skip(); event.Skip();
} }

View File

@@ -147,7 +147,7 @@ private:
void DoResetBrokenStateImages(const wxTreeItemId& idParent, void DoResetBrokenStateImages(const wxTreeItemId& idParent,
wxTreeItemIdValue cookie, int state); wxTreeItemIdValue cookie, int state);
void LogEvent(const wxChar *name, const wxTreeEvent& event); void LogEvent(const wxString& name, const wxTreeEvent& event);
int m_imageSize; // current size of images int m_imageSize; // current size of images
bool m_reverseSort; // flag for OnCompareItems bool m_reverseSort; // flag for OnCompareItems

View File

@@ -1051,15 +1051,15 @@ void MyApp::DoVariantDemo(wxCommandEvent& WXUNUSED(event) )
wxFont* sysFont = new wxFont(wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT)); wxFont* sysFont = new wxFont(wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT));
var1 = wxVariant(sysFont); var1 = wxVariant(sysFont);
textCtrl << wxT("var1 = (wxfont)\""); textCtrl << "var1 = (wxfont)\"";
wxFont* font = wxGetVariantCast(var1,wxFont); wxFont* font = wxGetVariantCast(var1,wxFont);
if (font) if (font)
{ {
textCtrl << font->GetNativeFontInfoDesc() << wxT("\"\n"); textCtrl << font->GetNativeFontInfoDesc() << "\"\n";
} }
else else
{ {
textCtrl << wxT("(null)\"\n"); textCtrl << "(null)\"\n";
} }
delete sysFont; delete sysFont;

View File

@@ -109,7 +109,7 @@ wxEND_EVENT_TABLE()
// ============================================================================ // ============================================================================
IMPLEMENT_WIDGETS_PAGE(ActivityIndicatorWidgetsPage, IMPLEMENT_WIDGETS_PAGE(ActivityIndicatorWidgetsPage,
wxT("ActivityIndicator"), NATIVE_CTRLS); "ActivityIndicator", NATIVE_CTRLS);
void ActivityIndicatorWidgetsPage::CreateContent() void ActivityIndicatorWidgetsPage::CreateContent()
{ {

View File

@@ -242,7 +242,7 @@ wxEND_EVENT_TABLE()
#define NATIVE_OR_GENERIC_CTRLS GENERIC_CTRLS #define NATIVE_OR_GENERIC_CTRLS GENERIC_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(BitmapComboBoxWidgetsPage, wxT("BitmapCombobox"), IMPLEMENT_WIDGETS_PAGE(BitmapComboBoxWidgetsPage, "BitmapCombobox",
NATIVE_OR_GENERIC_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS NATIVE_OR_GENERIC_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
); );
@@ -298,39 +298,39 @@ void BitmapComboBoxWidgetsPage::CreateContent()
wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL); wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL);
// left pane - style box // left pane - style box
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style");
// should be in sync with ComboKind_XXX values // should be in sync with ComboKind_XXX values
static const wxString kinds[] = static const wxString kinds[] =
{ {
wxT("default"), "default",
wxT("simple"), "simple",
wxT("drop down"), "drop down",
}; };
m_radioKind = new wxRadioBox(this, wxID_ANY, wxT("Combobox &kind:"), m_radioKind = new wxRadioBox(this, wxID_ANY, "Combobox &kind:",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(kinds), kinds, WXSIZEOF(kinds), kinds,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
wxSizer *sizerStyle = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerStyle = new wxStaticBoxSizer(box, wxVERTICAL);
m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Sort items")); m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, "&Sort items");
m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Read only")); m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, "&Read only");
wxButton *btn = new wxButton(this, BitmapComboBoxPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, BitmapComboBoxPage_Reset, "&Reset");
sizerStyle->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 3); sizerStyle->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 3);
sizerLeft->Add(sizerStyle, wxSizerFlags().Expand()); sizerLeft->Add(sizerStyle, wxSizerFlags().Expand());
sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5); sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5);
// left pane - other options box // left pane - other options box
box = new wxStaticBox(this, wxID_ANY, wxT("Demo options")); box = new wxStaticBox(this, wxID_ANY, "Demo options");
wxSizer *sizerOptions = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerOptions = new wxStaticBoxSizer(box, wxVERTICAL);
sizerRow = CreateSizerWithSmallTextAndLabel(wxT("Control &height:"), sizerRow = CreateSizerWithSmallTextAndLabel("Control &height:",
BitmapComboBoxPage_ChangeHeight, BitmapComboBoxPage_ChangeHeight,
&m_textChangeHeight); &m_textChangeHeight);
m_textChangeHeight->SetSize(20, wxDefaultCoord); m_textChangeHeight->SetSize(20, wxDefaultCoord);
@@ -340,42 +340,42 @@ void BitmapComboBoxWidgetsPage::CreateContent()
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
wxT("&Change wxBitmapComboBox contents")); "&Change wxBitmapComboBox contents");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
btn = new wxButton(this, BitmapComboBoxPage_ContainerTests, wxT("Run &tests")); btn = new wxButton(this, BitmapComboBoxPage_ContainerTests, "Run &tests");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
#if wxUSE_IMAGE #if wxUSE_IMAGE
btn = new wxButton(this, BitmapComboBoxPage_AddWidgetIcons, wxT("Add &widget icons")); btn = new wxButton(this, BitmapComboBoxPage_AddWidgetIcons, "Add &widget icons");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, BitmapComboBoxPage_LoadFromFile, wxT("Insert image from &file")); btn = new wxButton(this, BitmapComboBoxPage_LoadFromFile, "Insert image from &file");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, BitmapComboBoxPage_SetFromFile, wxT("&Set image from file")); btn = new wxButton(this, BitmapComboBoxPage_SetFromFile, "&Set image from file");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
#endif #endif
btn = new wxButton(this, BitmapComboBoxPage_AddSeveralWithImages, wxT("A&ppend a few strings with images")); btn = new wxButton(this, BitmapComboBoxPage_AddSeveralWithImages, "A&ppend a few strings with images");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, BitmapComboBoxPage_AddSeveral, wxT("Append a &few strings")); btn = new wxButton(this, BitmapComboBoxPage_AddSeveral, "Append a &few strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, BitmapComboBoxPage_AddMany, wxT("Append &many strings")); btn = new wxButton(this, BitmapComboBoxPage_AddMany, "Append &many strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(BitmapComboBoxPage_Delete, sizerRow = CreateSizerWithTextAndButton(BitmapComboBoxPage_Delete,
wxT("&Delete this item"), "&Delete this item",
BitmapComboBoxPage_DeleteText, BitmapComboBoxPage_DeleteText,
&m_textDelete); &m_textDelete);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, BitmapComboBoxPage_DeleteSel, wxT("Delete &selection")); btn = new wxButton(this, BitmapComboBoxPage_DeleteSel, "Delete &selection");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, BitmapComboBoxPage_Clear, wxT("&Clear")); btn = new wxButton(this, BitmapComboBoxPage_Clear, "&Clear");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
#if wxUSE_IMAGE #if wxUSE_IMAGE
@@ -432,7 +432,7 @@ void BitmapComboBoxWidgetsPage::CreateCombo()
switch ( m_radioKind->GetSelection() ) switch ( m_radioKind->GetSelection() )
{ {
default: default:
wxFAIL_MSG( wxT("unknown combo kind") ); wxFAIL_MSG( "unknown combo kind" );
// fall through // fall through
case ComboKind_Default: case ComboKind_Default:
@@ -512,7 +512,7 @@ void BitmapComboBoxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
#ifndef __WXGTK__ #ifndef __WXGTK__
m_combobox->SetString(sel, m_textChange->GetValue()); m_combobox->SetString(sel, m_textChange->GetValue());
#else #else
wxLogMessage(wxT("Not implemented in wxGTK")); wxLogMessage("Not implemented in wxGTK");
#endif #endif
} }
} }
@@ -551,7 +551,7 @@ void BitmapComboBoxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event))
if ( !m_textInsert->IsModified() ) if ( !m_textInsert->IsModified() )
{ {
// update the default string // update the default string
m_textInsert->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); m_textInsert->SetValue(wxString::Format("test item %u", ++s_item));
} }
int sel = m_combobox->GetSelection(); int sel = m_combobox->GetSelection();
@@ -595,15 +595,15 @@ void BitmapComboBoxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
// "many" means 1000 here // "many" means 1000 here
for ( unsigned int n = 0; n < 1000; n++ ) for ( unsigned int n = 0; n < 1000; n++ )
{ {
m_combobox->Append(wxString::Format(wxT("item #%u"), n)); m_combobox->Append(wxString::Format("item #%u", n));
} }
} }
void BitmapComboBoxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) void BitmapComboBoxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
{ {
m_combobox->Append(wxT("First")); m_combobox->Append("First");
m_combobox->Append(wxT("another one")); m_combobox->Append("another one");
m_combobox->Append(wxT("and the last (very very very very very very very very very very long) one")); m_combobox->Append("and the last (very very very very very very very very very very long) one");
} }
void BitmapComboBoxWidgetsPage::OnButtonAddSeveralWithImages(wxCommandEvent& WXUNUSED(event)) void BitmapComboBoxWidgetsPage::OnButtonAddSeveralWithImages(wxCommandEvent& WXUNUSED(event))
@@ -640,10 +640,10 @@ void BitmapComboBoxWidgetsPage::RescaleImage(wxImage& image, int w, int h)
if ( isFirstScale && m_combobox->GetCount() > 0 ) if ( isFirstScale && m_combobox->GetCount() > 0 )
{ {
wxMessageBox( wxT("wxBitmapComboBox normally only supports images of one size. ") wxMessageBox( "wxBitmapComboBox normally only supports images of one size. "
wxT("However, for demonstration purposes, loaded bitmaps are scaled to fit ") "However, for demonstration purposes, loaded bitmaps are scaled to fit "
wxT("using wxImage::Rescale."), "using wxImage::Rescale.",
wxT("Notice"), "Notice",
wxOK, wxOK,
this ); this );
@@ -658,32 +658,32 @@ void BitmapComboBoxWidgetsPage::LoadWidgetImages( wxArrayString* strings, wxImag
{ {
wxFileName fn; wxFileName fn;
fn.AssignCwd(); fn.AssignCwd();
fn.AppendDir(wxT("icons")); fn.AppendDir("icons");
wxSetCursor(*wxHOURGLASS_CURSOR); wxSetCursor(*wxHOURGLASS_CURSOR);
if ( !wxDir::Exists(fn.GetFullPath()) || if ( !wxDir::Exists(fn.GetFullPath()) ||
!wxDir::GetAllFiles(fn.GetFullPath(),strings,wxT("*.xpm")) ) !wxDir::GetAllFiles(fn.GetFullPath(),strings,"*.xpm") )
{ {
// Try ../../samples/widgets/icons // Try ../../samples/widgets/icons
fn.RemoveLastDir(); fn.RemoveLastDir();
fn.RemoveLastDir(); fn.RemoveLastDir();
fn.AppendDir(wxT("icons")); fn.AppendDir("icons");
if ( !wxDir::Exists(fn.GetFullPath()) || if ( !wxDir::Exists(fn.GetFullPath()) ||
!wxDir::GetAllFiles(fn.GetFullPath(),strings,wxT("*.xpm")) ) !wxDir::GetAllFiles(fn.GetFullPath(),strings,"*.xpm") )
{ {
// Try ../../../samples/widgets/icons // Try ../../../samples/widgets/icons
fn.AssignCwd(); fn.AssignCwd();
fn.RemoveLastDir(); fn.RemoveLastDir();
fn.RemoveLastDir(); fn.RemoveLastDir();
fn.RemoveLastDir(); fn.RemoveLastDir();
fn.AppendDir(wxT("samples")); fn.AppendDir("samples");
fn.AppendDir(wxT("widgets")); fn.AppendDir("widgets");
fn.AppendDir(wxT("icons")); fn.AppendDir("icons");
if ( !wxDir::Exists(fn.GetFullPath()) || if ( !wxDir::Exists(fn.GetFullPath()) ||
!wxDir::GetAllFiles(fn.GetFullPath(),strings,wxT("*.xpm")) ) !wxDir::GetAllFiles(fn.GetFullPath(),strings,"*.xpm") )
{ {
wxLogWarning(wxT("Could not load widget icons.")); wxLogWarning("Could not load widget icons.");
wxSetCursor(*wxSTANDARD_CURSOR); wxSetCursor(*wxSTANDARD_CURSOR);
return; return;
} }
@@ -703,7 +703,7 @@ void BitmapComboBoxWidgetsPage::LoadWidgetImages( wxArrayString* strings, wxImag
wxString name = fn.GetName(); wxString name = fn.GetName();
// Handle few exceptions // Handle few exceptions
if ( name == wxT("bmpbtn") ) if ( name == "bmpbtn" )
{ {
strings->RemoveAt(i); strings->RemoveAt(i);
i--; i--;
@@ -802,26 +802,26 @@ void BitmapComboBoxWidgetsPage::OnComboText(wxCommandEvent& event)
wxString s = event.GetString(); wxString s = event.GetString();
wxASSERT_MSG( s == m_combobox->GetValue(), wxASSERT_MSG( s == m_combobox->GetValue(),
wxT("event and combobox values should be the same") ); "event and combobox values should be the same" );
if (event.GetEventType() == wxEVT_TEXT_ENTER) if (event.GetEventType() == wxEVT_TEXT_ENTER)
{ {
wxLogMessage(wxT("BitmapCombobox enter pressed (now '%s')"), s.c_str()); wxLogMessage("BitmapCombobox enter pressed (now '%s')", s.c_str());
} }
else else
{ {
wxLogMessage(wxT("BitmapCombobox text changed (now '%s')"), s.c_str()); wxLogMessage("BitmapCombobox text changed (now '%s')", s.c_str());
} }
} }
void BitmapComboBoxWidgetsPage::OnComboBox(wxCommandEvent& event) void BitmapComboBoxWidgetsPage::OnComboBox(wxCommandEvent& event)
{ {
long sel = event.GetInt(); long sel = event.GetInt();
m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel)); m_textDelete->SetValue(wxString::Format("%ld", sel));
wxLogMessage(wxT("BitmapCombobox item %ld selected"), sel); wxLogMessage("BitmapCombobox item %ld selected", sel);
wxLogMessage(wxT("BitmapCombobox GetValue(): %s"), m_combobox->GetValue().c_str() ); wxLogMessage("BitmapCombobox GetValue(): %s", m_combobox->GetValue().c_str() );
} }
void BitmapComboBoxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) void BitmapComboBoxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
@@ -876,7 +876,7 @@ wxBitmap BitmapComboBoxWidgetsPage::LoadBitmap(const wxString& WXUNUSED(filepath
wxBitmap BitmapComboBoxWidgetsPage::QueryBitmap(wxString* pStr) wxBitmap BitmapComboBoxWidgetsPage::QueryBitmap(wxString* pStr)
{ {
wxString filepath = wxLoadFileSelector(wxT("image"), wxString filepath = wxLoadFileSelector("image",
wxEmptyString, wxEmptyString,
wxEmptyString, wxEmptyString,
this); this);
@@ -897,7 +897,7 @@ wxBitmap BitmapComboBoxWidgetsPage::QueryBitmap(wxString* pStr)
if (bitmap.IsOk()) if (bitmap.IsOk())
{ {
wxLogDebug(wxT("%i, %i"),bitmap.GetWidth(), bitmap.GetHeight()); wxLogDebug("%i, %i",bitmap.GetWidth(), bitmap.GetHeight());
} }
::wxSetCursor( *wxSTANDARD_CURSOR ); ::wxSetCursor( *wxSTANDARD_CURSOR );
@@ -936,12 +936,12 @@ wxBitmap BitmapComboBoxWidgetsPage::CreateBitmap(const wxColour& colour)
void BitmapComboBoxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event)) void BitmapComboBoxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Combobox dropped down")); wxLogMessage("Combobox dropped down");
} }
void BitmapComboBoxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event)) void BitmapComboBoxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Combobox closed up")); wxLogMessage("Combobox closed up");
} }
#endif // wxUSE_BITMAPCOMBOBOX #endif // wxUSE_BITMAPCOMBOBOX

View File

@@ -197,7 +197,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, wxT("Button"), FAMILY_CTRLS ); IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, "Button", FAMILY_CTRLS );
ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book, ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist) wxImageList *imaglist)
@@ -236,21 +236,21 @@ void ButtonWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
m_chkBitmapOnly = CreateCheckBoxAndAddToSizer(sizerLeft, "&Bitmap only"); m_chkBitmapOnly = CreateCheckBoxAndAddToSizer(sizerLeft, "&Bitmap only");
m_chkTextAndBitmap = CreateCheckBoxAndAddToSizer(sizerLeft, "Text &and bitmap"); m_chkTextAndBitmap = CreateCheckBoxAndAddToSizer(sizerLeft, "Text &and bitmap");
m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Fit exactly")); m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit exactly");
m_chkAuthNeeded = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Require a&uth")); m_chkAuthNeeded = CreateCheckBoxAndAddToSizer(sizerLeft, "Require a&uth");
#if wxUSE_COMMANDLINKBUTTON #if wxUSE_COMMANDLINKBUTTON
m_chkCommandLink = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Use command &link button")); m_chkCommandLink = CreateCheckBoxAndAddToSizer(sizerLeft, "Use command &link button");
#endif #endif
#if wxUSE_MARKUP #if wxUSE_MARKUP
m_chkUseMarkup = CreateCheckBoxAndAddToSizer(sizerLeft, "Interpret &markup"); m_chkUseMarkup = CreateCheckBoxAndAddToSizer(sizerLeft, "Interpret &markup");
#endif // wxUSE_MARKUP #endif // wxUSE_MARKUP
m_chkDefault = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Default")); m_chkDefault = CreateCheckBoxAndAddToSizer(sizerLeft, "&Default");
m_chkUseBitmapClass = CreateCheckBoxAndAddToSizer(sizerLeft, m_chkUseBitmapClass = CreateCheckBoxAndAddToSizer(sizerLeft,
"Use wxBitmapButton"); "Use wxBitmapButton");
@@ -286,22 +286,22 @@ void ButtonWidgetsPage::CreateContent()
// should be in sync with enums Button[HV]Align! // should be in sync with enums Button[HV]Align!
static const wxString halign[] = static const wxString halign[] =
{ {
wxT("left"), "left",
wxT("centre"), "centre",
wxT("right"), "right",
}; };
static const wxString valign[] = static const wxString valign[] =
{ {
wxT("top"), "top",
wxT("centre"), "centre",
wxT("bottom"), "bottom",
}; };
m_radioHAlign = new wxRadioBox(this, wxID_ANY, wxT("&Horz alignment"), m_radioHAlign = new wxRadioBox(this, wxID_ANY, "&Horz alignment",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(halign), halign); WXSIZEOF(halign), halign);
m_radioVAlign = new wxRadioBox(this, wxID_ANY, wxT("&Vert alignment"), m_radioVAlign = new wxRadioBox(this, wxID_ANY, "&Vert alignment",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(valign), valign); WXSIZEOF(valign), valign);
@@ -310,26 +310,26 @@ void ButtonWidgetsPage::CreateContent()
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
wxButton *btn = new wxButton(this, ButtonPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, ButtonPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Operations")); wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Operations");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow = CreateSizerWithTextAndButton(ButtonPage_ChangeLabel, wxSizer *sizerRow = CreateSizerWithTextAndButton(ButtonPage_ChangeLabel,
wxT("Change label"), "Change label",
wxID_ANY, wxID_ANY,
&m_textLabel); &m_textLabel);
m_textLabel->SetValue(wxT("&Press me!")); m_textLabel->SetValue("&Press me!");
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
#if wxUSE_COMMANDLINKBUTTON #if wxUSE_COMMANDLINKBUTTON
m_sizerNote = CreateSizerWithTextAndButton(ButtonPage_ChangeNote, m_sizerNote = CreateSizerWithTextAndButton(ButtonPage_ChangeNote,
wxT("Change note"), "Change note",
wxID_ANY, wxID_ANY,
&m_textNote); &m_textNote);
m_textNote->SetValue(wxT("Writes down button clicks in the log.")); m_textNote->SetValue("Writes down button clicks in the log.");
sizerMiddle->Add(m_sizerNote, 0, wxALL | wxGROW, 5); sizerMiddle->Add(m_sizerNote, 0, wxALL | wxGROW, 5);
#endif #endif
@@ -415,7 +415,7 @@ void ButtonWidgetsPage::CreateButton()
break; break;
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
case ButtonHAlign_Centre: case ButtonHAlign_Centre:
@@ -433,7 +433,7 @@ void ButtonWidgetsPage::CreateButton()
break; break;
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
case ButtonVAlign_Centre: case ButtonVAlign_Centre:
@@ -456,22 +456,22 @@ void ButtonWidgetsPage::CreateButton()
if ( m_chkUseBitmapClass->GetValue() ) if ( m_chkUseBitmapClass->GetValue() )
{ {
bbtn = new wxBitmapButton(this, ButtonPage_Button, bbtn = new wxBitmapButton(this, ButtonPage_Button,
CreateBitmap(wxT("normal")), CreateBitmap("normal"),
wxDefaultPosition, wxDefaultSize, flags); wxDefaultPosition, wxDefaultSize, flags);
} }
else else
{ {
bbtn = new wxButton(this, ButtonPage_Button); bbtn = new wxButton(this, ButtonPage_Button);
bbtn->SetBitmapLabel(CreateBitmap(wxT("normal"))); bbtn->SetBitmapLabel(CreateBitmap("normal"));
} }
if ( m_chkUsePressed->GetValue() ) if ( m_chkUsePressed->GetValue() )
bbtn->SetBitmapPressed(CreateBitmap(wxT("pushed"))); bbtn->SetBitmapPressed(CreateBitmap("pushed"));
if ( m_chkUseFocused->GetValue() ) if ( m_chkUseFocused->GetValue() )
bbtn->SetBitmapFocus(CreateBitmap(wxT("focused"))); bbtn->SetBitmapFocus(CreateBitmap("focused"));
if ( m_chkUseCurrent->GetValue() ) if ( m_chkUseCurrent->GetValue() )
bbtn->SetBitmapCurrent(CreateBitmap(wxT("hover"))); bbtn->SetBitmapCurrent(CreateBitmap("hover"));
if ( m_chkUseDisabled->GetValue() ) if ( m_chkUseDisabled->GetValue() )
bbtn->SetBitmapDisabled(CreateBitmap(wxT("disabled"))); bbtn->SetBitmapDisabled(CreateBitmap("disabled"));
m_button = bbtn; m_button = bbtn;
#if wxUSE_COMMANDLINKBUTTON #if wxUSE_COMMANDLINKBUTTON
m_cmdLnkButton = NULL; m_cmdLnkButton = NULL;
@@ -611,7 +611,7 @@ void ButtonWidgetsPage::OnButtonChangeNote(wxCommandEvent& WXUNUSED(event))
void ButtonWidgetsPage::OnButton(wxCommandEvent& WXUNUSED(event)) void ButtonWidgetsPage::OnButton(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Test button clicked.")); wxLogMessage("Test button clicked.");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -626,8 +626,8 @@ wxBitmap ButtonWidgetsPage::CreateBitmap(const wxString& label)
dc.SetBackground(*wxCYAN_BRUSH); dc.SetBackground(*wxCYAN_BRUSH);
dc.Clear(); dc.Clear();
dc.SetTextForeground(*wxBLACK); dc.SetTextForeground(*wxBLACK);
dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n") dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + "\n"
wxT("(") + label + wxT(" state)"), "(" + label + " state)",
wxArtProvider::GetBitmap(wxART_INFORMATION), wxArtProvider::GetBitmap(wxART_INFORMATION),
wxRect(10, 10, bmp.GetWidth() - 20, bmp.GetHeight() - 20), wxRect(10, 10, bmp.GetWidth() - 20, bmp.GetHeight() - 20),
wxALIGN_CENTRE); wxALIGN_CENTRE);

View File

@@ -155,7 +155,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"), FAMILY_CTRLS ); IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, "CheckBox", FAMILY_CTRLS );
CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book, CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist) wxImageList *imaglist)
@@ -168,14 +168,14 @@ void CheckBoxWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
m_chkRight = CreateCheckBoxAndAddToSizer m_chkRight = CreateCheckBoxAndAddToSizer
( (
sizerLeft, sizerLeft,
wxT("&Right aligned"), "&Right aligned",
CheckboxPage_ChkRight CheckboxPage_ChkRight
); );
@@ -183,39 +183,39 @@ void CheckBoxWidgetsPage::CreateContent()
static const wxString kinds[] = static const wxString kinds[] =
{ {
wxT("usual &2-state checkbox"), "usual &2-state checkbox",
wxT("&3rd state settable by program"), "&3rd state settable by program",
wxT("&user-settable 3rd state"), "&user-settable 3rd state",
}; };
m_radioKind = new wxRadioBox(this, wxID_ANY, wxT("&Kind"), m_radioKind = new wxRadioBox(this, wxID_ANY, "&Kind",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(kinds), kinds, WXSIZEOF(kinds), kinds,
1); 1);
sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5); sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5);
wxButton *btn = new wxButton(this, CheckboxPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, CheckboxPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Operations")); wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Operations");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
sizerMiddle->Add(CreateSizerWithTextAndButton(CheckboxPage_ChangeLabel, sizerMiddle->Add(CreateSizerWithTextAndButton(CheckboxPage_ChangeLabel,
wxT("Change label"), "Change label",
wxID_ANY, wxID_ANY,
&m_textLabel), &m_textLabel),
0, wxALL | wxGROW, 5); 0, wxALL | wxGROW, 5);
sizerMiddle->Add(new wxButton(this, CheckboxPage_Check, wxT("&Check it")), sizerMiddle->Add(new wxButton(this, CheckboxPage_Check, "&Check it"),
0, wxALL | wxGROW, 5); 0, wxALL | wxGROW, 5);
sizerMiddle->Add(new wxButton(this, CheckboxPage_Uncheck, wxT("&Uncheck it")), sizerMiddle->Add(new wxButton(this, CheckboxPage_Uncheck, "&Uncheck it"),
0, wxALL | wxGROW, 5); 0, wxALL | wxGROW, 5);
sizerMiddle->Add(new wxButton(this, CheckboxPage_PartCheck, sizerMiddle->Add(new wxButton(this, CheckboxPage_PartCheck,
wxT("Put in &3rd state")), "Put in &3rd state"),
0, wxALL | wxGROW, 5); 0, wxALL | wxGROW, 5);
// right pane // right pane
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
m_checkbox = new wxCheckBox(this, CheckboxPage_Checkbox, wxT("&Check me!")); m_checkbox = new wxCheckBox(this, CheckboxPage_Checkbox, "&Check me!");
sizerRight->Add(0, 0, 1, wxCENTRE); sizerRight->Add(0, 0, 1, wxCENTRE);
sizerRight->Add(m_checkbox, 1, wxCENTRE); sizerRight->Add(m_checkbox, 1, wxCENTRE);
sizerRight->Add(0, 0, 1, wxCENTRE); sizerRight->Add(0, 0, 1, wxCENTRE);
@@ -258,7 +258,7 @@ void CheckBoxWidgetsPage::CreateCheckbox()
switch ( m_radioKind->GetSelection() ) switch ( m_radioKind->GetSelection() )
{ {
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
case CheckboxKind_2State: case CheckboxKind_2State:
@@ -307,8 +307,8 @@ void CheckBoxWidgetsPage::OnButtonChangeLabel(wxCommandEvent& WXUNUSED(event))
void CheckBoxWidgetsPage::OnCheckBox(wxCommandEvent& event) void CheckBoxWidgetsPage::OnCheckBox(wxCommandEvent& event)
{ {
wxLogMessage(wxT("Test checkbox %schecked (value = %d)."), wxLogMessage("Test checkbox %schecked (value = %d).",
event.IsChecked() ? wxT("") : wxT("un"), event.IsChecked() ? "" : "un",
(int)m_checkbox->Get3StateValue()); (int)m_checkbox->Get3StateValue());
} }

View File

@@ -178,7 +178,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(ChoiceWidgetsPage, wxT("Choice"), IMPLEMENT_WIDGETS_PAGE(ChoiceWidgetsPage, "Choice",
FAMILY_CTRLS | WITH_ITEMS_CTRLS FAMILY_CTRLS | WITH_ITEMS_CTRLS
); );
@@ -207,53 +207,53 @@ void ChoiceWidgetsPage::CreateContent()
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxStaticBox *box = new wxStaticBox(this, wxID_ANY,
wxT("&Set choice parameters")); "&Set choice parameters");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Sort items")); m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, "&Sort items");
wxButton *btn = new wxButton(this, ChoicePage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, ChoicePage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
wxT("&Change choice contents")); "&Change choice contents");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(this, ChoicePage_Add, wxT("&Add this string")); btn = new wxButton(this, ChoicePage_Add, "&Add this string");
m_textAdd = new wxTextCtrl(this, ChoicePage_AddText, wxT("test item 0")); m_textAdd = new wxTextCtrl(this, ChoicePage_AddText, "test item 0");
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textAdd, 1, wxLEFT, 5); sizerRow->Add(m_textAdd, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ChoicePage_AddSeveral, wxT("&Insert a few strings")); btn = new wxButton(this, ChoicePage_AddSeveral, "&Insert a few strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ChoicePage_AddMany, wxT("Add &many strings")); btn = new wxButton(this, ChoicePage_AddMany, "Add &many strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = new wxBoxSizer(wxHORIZONTAL); sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(this, ChoicePage_Change, wxT("C&hange current")); btn = new wxButton(this, ChoicePage_Change, "C&hange current");
m_textChange = new wxTextCtrl(this, ChoicePage_ChangeText, wxEmptyString); m_textChange = new wxTextCtrl(this, ChoicePage_ChangeText, wxEmptyString);
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textChange, 1, wxLEFT, 5); sizerRow->Add(m_textChange, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = new wxBoxSizer(wxHORIZONTAL); sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(this, ChoicePage_Delete, wxT("&Delete this item")); btn = new wxButton(this, ChoicePage_Delete, "&Delete this item");
m_textDelete = new wxTextCtrl(this, ChoicePage_DeleteText, wxEmptyString); m_textDelete = new wxTextCtrl(this, ChoicePage_DeleteText, wxEmptyString);
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textDelete, 1, wxLEFT, 5); sizerRow->Add(m_textDelete, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ChoicePage_DeleteSel, wxT("Delete &selection")); btn = new wxButton(this, ChoicePage_DeleteSel, "Delete &selection");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ChoicePage_Clear, wxT("&Clear")); btn = new wxButton(this, ChoicePage_Clear, "&Clear");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ChoicePage_ContainerTests, wxT("Run &tests")); btn = new wxButton(this, ChoicePage_ContainerTests, "Run &tests");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
// right pane // right pane
@@ -367,7 +367,7 @@ void ChoiceWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
if ( !m_textAdd->IsModified() ) if ( !m_textAdd->IsModified() )
{ {
// update the default string // update the default string
m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); m_textAdd->SetValue(wxString::Format("test item %u", ++s_item));
} }
m_choice->Append(s); m_choice->Append(s);
@@ -379,7 +379,7 @@ void ChoiceWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
wxArrayString strings; wxArrayString strings;
for ( unsigned int n = 0; n < 1000; n++ ) for ( unsigned int n = 0; n < 1000; n++ )
{ {
strings.Add(wxString::Format(wxT("item #%u"), n)); strings.Add(wxString::Format("item #%u", n));
} }
m_choice->Append(strings); m_choice->Append(strings);
} }
@@ -387,9 +387,9 @@ void ChoiceWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
void ChoiceWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) void ChoiceWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
{ {
wxArrayString items; wxArrayString items;
items.Add(wxT("First")); items.Add("First");
items.Add(wxT("another one")); items.Add("another one");
items.Add(wxT("and the last (very very very very very very very very very very long) one")); items.Add("and the last (very very very very very very very very very very long) one");
m_choice->Insert(items, 0); m_choice->Insert(items, 0);
} }
@@ -424,9 +424,9 @@ void ChoiceWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event)
void ChoiceWidgetsPage::OnChoice(wxCommandEvent& event) void ChoiceWidgetsPage::OnChoice(wxCommandEvent& event)
{ {
long sel = event.GetSelection(); long sel = event.GetSelection();
m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel)); m_textDelete->SetValue(wxString::Format("%ld", sel));
wxLogMessage(wxT("Choice item %ld selected"), sel); wxLogMessage("Choice item %ld selected", sel);
} }
void ChoiceWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) void ChoiceWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))

View File

@@ -125,7 +125,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS GENERIC_CTRLS #define FAMILY_CTRLS GENERIC_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(ColourPickerWidgetsPage, wxT("ColourPicker"), IMPLEMENT_WIDGETS_PAGE(ColourPickerWidgetsPage, "ColourPicker",
PICKER_CTRLS | FAMILY_CTRLS); PICKER_CTRLS | FAMILY_CTRLS);
ColourPickerWidgetsPage::ColourPickerWidgetsPage(WidgetsBookCtrl *book, ColourPickerWidgetsPage::ColourPickerWidgetsPage(WidgetsBookCtrl *book,
@@ -139,13 +139,13 @@ void ColourPickerWidgetsPage::CreateContent()
// left pane // left pane
wxSizer *boxleft = new wxBoxSizer(wxVERTICAL); wxSizer *boxleft = new wxBoxSizer(wxVERTICAL);
wxStaticBoxSizer *clrbox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&ColourPicker style")); wxStaticBoxSizer *clrbox = new wxStaticBoxSizer(wxVERTICAL, this, "&ColourPicker style");
m_chkColourTextCtrl = CreateCheckBoxAndAddToSizer(clrbox, wxT("With textctrl")); m_chkColourTextCtrl = CreateCheckBoxAndAddToSizer(clrbox, "With textctrl");
m_chkColourShowLabel = CreateCheckBoxAndAddToSizer(clrbox, wxT("With label")); m_chkColourShowLabel = CreateCheckBoxAndAddToSizer(clrbox, "With label");
m_chkColourShowAlpha = CreateCheckBoxAndAddToSizer(clrbox, wxT("With opacity")); m_chkColourShowAlpha = CreateCheckBoxAndAddToSizer(clrbox, "With opacity");
boxleft->Add(clrbox, 0, wxALL|wxGROW, 5); boxleft->Add(clrbox, 0, wxALL|wxGROW, 5);
boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")), boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
Reset(); // set checkboxes state Reset(); // set checkboxes state
@@ -217,7 +217,7 @@ void ColourPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
void ColourPickerWidgetsPage::OnColourChange(wxColourPickerEvent& event) void ColourPickerWidgetsPage::OnColourChange(wxColourPickerEvent& event)
{ {
wxLogMessage(wxT("The colour changed to '%s' !"), wxLogMessage("The colour changed to '%s' !",
event.GetColour().GetAsString(wxC2S_CSS_SYNTAX).c_str()); event.GetColour().GetAsString(wxC2S_CSS_SYNTAX).c_str());
} }

View File

@@ -234,7 +234,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, wxT("Combobox"), IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, "Combobox",
FAMILY_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS FAMILY_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
); );
@@ -266,26 +266,26 @@ void ComboboxWidgetsPage::CreateContent()
// should be in sync with ComboKind_XXX values // should be in sync with ComboKind_XXX values
static const wxString kinds[] = static const wxString kinds[] =
{ {
wxT("default"), "default",
wxT("simple"), "simple",
wxT("drop down"), "drop down",
}; };
m_radioKind = new wxRadioBox(this, wxID_ANY, wxT("Combobox &kind:"), m_radioKind = new wxRadioBox(this, wxID_ANY, "Combobox &kind:",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(kinds), kinds, WXSIZEOF(kinds), kinds,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
wxSizer *sizerLeftTop = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style"); wxSizer *sizerLeftTop = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeftTop, wxT("&Sort items")); m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeftTop, "&Sort items");
m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeftTop, wxT("&Read only")); m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeftTop, "&Read only");
m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeftTop, wxT("Process &Enter")); m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeftTop, "Process &Enter");
sizerLeftTop->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeftTop->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
sizerLeftTop->Add(m_radioKind, 0, wxGROW | wxALL, 5); sizerLeftTop->Add(m_radioKind, 0, wxGROW | wxALL, 5);
wxButton *btn = new wxButton(this, ComboPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, ComboPage_Reset, "&Reset");
sizerLeftTop->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeftTop->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// lower left pane // lower left pane
@@ -303,20 +303,20 @@ void ComboboxWidgetsPage::CreateContent()
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
wxT("&Change combobox contents")); "&Change combobox contents");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow; wxSizer *sizerRow;
sizerRow = CreateSizerWithTextAndButton(ComboPage_SetCurrent, sizerRow = CreateSizerWithTextAndButton(ComboPage_SetCurrent,
wxT("Current &selection"), "Current &selection",
ComboPage_CurText, ComboPage_CurText,
&m_textCur); &m_textCur);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
wxTextCtrl *text; wxTextCtrl *text;
sizerRow = CreateSizerWithTextAndLabel(wxT("Insertion Point"), sizerRow = CreateSizerWithTextAndLabel("Insertion Point",
ComboPage_InsertionPointText, ComboPage_InsertionPointText,
&text); &text);
text->SetEditable(false); text->SetEditable(false);
@@ -324,54 +324,54 @@ void ComboboxWidgetsPage::CreateContent()
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ComboPage_Insert, sizerRow = CreateSizerWithTextAndButton(ComboPage_Insert,
wxT("&Insert this string"), "&Insert this string",
ComboPage_InsertText, ComboPage_InsertText,
&m_textInsert); &m_textInsert);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ComboPage_Add, sizerRow = CreateSizerWithTextAndButton(ComboPage_Add,
wxT("&Add this string"), "&Add this string",
ComboPage_AddText, ComboPage_AddText,
&m_textAdd); &m_textAdd);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ComboPage_SetFirst, sizerRow = CreateSizerWithTextAndButton(ComboPage_SetFirst,
wxT("Change &1st string"), "Change &1st string",
ComboPage_SetFirstText, ComboPage_SetFirstText,
&m_textSetFirst); &m_textSetFirst);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ComboPage_AddSeveral, wxT("&Append a few strings")); btn = new wxButton(this, ComboPage_AddSeveral, "&Append a few strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ComboPage_AddMany, wxT("Append &many strings")); btn = new wxButton(this, ComboPage_AddMany, "Append &many strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ComboPage_Change, sizerRow = CreateSizerWithTextAndButton(ComboPage_Change,
wxT("C&hange current"), "C&hange current",
ComboPage_ChangeText, ComboPage_ChangeText,
&m_textChange); &m_textChange);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ComboPage_Delete, sizerRow = CreateSizerWithTextAndButton(ComboPage_Delete,
wxT("&Delete this item"), "&Delete this item",
ComboPage_DeleteText, ComboPage_DeleteText,
&m_textDelete); &m_textDelete);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ComboPage_DeleteSel, wxT("Delete &selection")); btn = new wxButton(this, ComboPage_DeleteSel, "Delete &selection");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ComboPage_Clear, wxT("&Clear")); btn = new wxButton(this, ComboPage_Clear, "&Clear");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ComboPage_SetValue, sizerRow = CreateSizerWithTextAndButton(ComboPage_SetValue,
wxT("SetValue"), "SetValue",
ComboPage_SetValueText, ComboPage_SetValueText,
&m_textSetValue); &m_textSetValue);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ComboPage_ContainerTests, wxT("Run &tests")); btn = new wxButton(this, ComboPage_ContainerTests, "Run &tests");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
@@ -430,7 +430,7 @@ void ComboboxWidgetsPage::CreateCombo()
switch ( m_radioKind->GetSelection() ) switch ( m_radioKind->GetSelection() )
{ {
default: default:
wxFAIL_MSG( wxT("unknown combo kind") ); wxFAIL_MSG( "unknown combo kind" );
// fall through // fall through
case ComboKind_Default: case ComboKind_Default:
@@ -533,7 +533,7 @@ void ComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event))
if ( !m_textInsert->IsModified() ) if ( !m_textInsert->IsModified() )
{ {
// update the default string // update the default string
m_textInsert->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); m_textInsert->SetValue(wxString::Format("test item %u", ++s_item));
} }
if (m_combobox->GetSelection() >= 0) if (m_combobox->GetSelection() >= 0)
@@ -548,7 +548,7 @@ void ComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
if ( !m_textAdd->IsModified() ) if ( !m_textAdd->IsModified() )
{ {
// update the default string // update the default string
m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); m_textAdd->SetValue(wxString::Format("test item %u", ++s_item));
} }
m_combobox->Append(s); m_combobox->Append(s);
@@ -570,7 +570,7 @@ void ComboboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
// "many" means 1000 here // "many" means 1000 here
for ( unsigned int n = 0; n < 1000; n++ ) for ( unsigned int n = 0; n < 1000; n++ )
{ {
m_combobox->Append(wxString::Format(wxT("item #%u"), n)); m_combobox->Append(wxString::Format("item #%u", n));
} }
} }
@@ -585,15 +585,15 @@ void ComboboxWidgetsPage::OnButtonSetCurrent(wxCommandEvent& WXUNUSED(event))
void ComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) void ComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
{ {
m_combobox->Append(wxT("First")); m_combobox->Append("First");
m_combobox->Append(wxT("another one")); m_combobox->Append("another one");
m_combobox->Append(wxT("and the last (very very very very very very very very very very long) one")); m_combobox->Append("and the last (very very very very very very very very very very long) one");
} }
void ComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event) void ComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event)
{ {
if (m_combobox) if (m_combobox)
event.SetText( wxString::Format(wxT("%ld"), m_combobox->GetInsertionPoint()) ); event.SetText( wxString::Format("%ld", m_combobox->GetInsertionPoint()) );
} }
void ComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event) void ComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
@@ -658,15 +658,15 @@ void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
wxString s = event.GetString(); wxString s = event.GetString();
wxASSERT_MSG( s == m_combobox->GetValue(), wxASSERT_MSG( s == m_combobox->GetValue(),
wxT("event and combobox values should be the same") ); "event and combobox values should be the same" );
if (event.GetEventType() == wxEVT_TEXT_ENTER) if (event.GetEventType() == wxEVT_TEXT_ENTER)
{ {
wxLogMessage(wxT("Combobox enter pressed (now '%s')"), s.c_str()); wxLogMessage("Combobox enter pressed (now '%s')", s.c_str());
} }
else else
{ {
wxLogMessage(wxT("Combobox text changed (now '%s')"), s.c_str()); wxLogMessage("Combobox text changed (now '%s')", s.c_str());
} }
} }
@@ -679,13 +679,13 @@ void ComboboxWidgetsPage::OnComboTextPasted(wxClipboardTextEvent& event)
void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event) void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
{ {
long sel = event.GetInt(); long sel = event.GetInt();
const wxString selstr = wxString::Format(wxT("%ld"), sel); const wxString selstr = wxString::Format("%ld", sel);
m_textDelete->SetValue(selstr); m_textDelete->SetValue(selstr);
m_textCur->SetValue(selstr); m_textCur->SetValue(selstr);
wxLogMessage(wxT("Combobox item %ld selected"), sel); wxLogMessage("Combobox item %ld selected", sel);
wxLogMessage(wxT("Combobox GetValue(): %s"), m_combobox->GetValue().c_str() ); wxLogMessage("Combobox GetValue(): %s", m_combobox->GetValue().c_str() );
if ( event.GetString() != m_combobox->GetValue() ) if ( event.GetString() != m_combobox->GetValue() )
{ {
@@ -701,12 +701,12 @@ void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
void ComboboxWidgetsPage::OnDropdown(wxCommandEvent& WXUNUSED(event)) void ComboboxWidgetsPage::OnDropdown(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Combobox dropped down")); wxLogMessage("Combobox dropped down");
} }
void ComboboxWidgetsPage::OnCloseup(wxCommandEvent& WXUNUSED(event)) void ComboboxWidgetsPage::OnCloseup(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Combobox closed up")); wxLogMessage("Combobox closed up");
} }
void ComboboxWidgetsPage::OnPopup(wxCommandEvent &WXUNUSED(event)) void ComboboxWidgetsPage::OnPopup(wxCommandEvent &WXUNUSED(event))

View File

@@ -134,7 +134,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS GENERIC_CTRLS #define FAMILY_CTRLS GENERIC_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, wxT("DatePicker"), IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, "DatePicker",
FAMILY_CTRLS | PICKER_CTRLS FAMILY_CTRLS | PICKER_CTRLS
); );

View File

@@ -61,16 +61,16 @@ enum
static const wxString stdPaths[] = static const wxString stdPaths[] =
{ {
wxT("&none"), "&none",
wxT("&config"), "&config",
wxT("&data"), "&data",
wxT("&documents"), "&documents",
wxT("&local data"), "&local data",
wxT("&plugins"), "&plugins",
wxT("&resources"), "&resources",
wxT("&user config"), "&user config",
wxT("&user data"), "&user data",
wxT("&user local data") "&user local data"
}; };
enum enum
@@ -164,7 +164,7 @@ wxEND_EVENT_TABLE()
// implementation // implementation
// ============================================================================ // ============================================================================
IMPLEMENT_WIDGETS_PAGE(DirCtrlWidgetsPage, wxT("DirCtrl"), IMPLEMENT_WIDGETS_PAGE(DirCtrlWidgetsPage, "DirCtrl",
GENERIC_CTRLS GENERIC_CTRLS
); );
@@ -180,39 +180,39 @@ void DirCtrlWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("Dir control details")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "Dir control details");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
sizerLeft->Add( CreateSizerWithTextAndButton( DirCtrlPage_SetPath , wxT("Set &path"), wxID_ANY, &m_path ), sizerLeft->Add( CreateSizerWithTextAndButton( DirCtrlPage_SetPath , "Set &path", wxID_ANY, &m_path ),
0, wxALL | wxALIGN_RIGHT , 5 ); 0, wxALL | wxALIGN_RIGHT , 5 );
wxSizer *sizerUseFlags = wxSizer *sizerUseFlags =
new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Flags")); new wxStaticBoxSizer(wxVERTICAL, this, "&Flags");
m_chkDirOnly = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_DIR_ONLY")); m_chkDirOnly = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_DIR_ONLY");
m_chk3D = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_3D_INTERNAL")); m_chk3D = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_3D_INTERNAL");
m_chkFirst = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_SELECT_FIRST")); m_chkFirst = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_SELECT_FIRST");
m_chkFilters = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_SHOW_FILTERS")); m_chkFilters = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_SHOW_FILTERS");
m_chkLabels = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_EDIT_LABELS")); m_chkLabels = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_EDIT_LABELS");
m_chkMulti = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_MULTIPLE")); m_chkMulti = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_MULTIPLE");
sizerLeft->Add(sizerUseFlags, wxSizerFlags().Expand().Border()); sizerLeft->Add(sizerUseFlags, wxSizerFlags().Expand().Border());
wxSizer *sizerFilters = wxSizer *sizerFilters =
new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Filters")); new wxStaticBoxSizer(wxVERTICAL, this, "&Filters");
m_fltr[0] = CreateCheckBoxAndAddToSizer(sizerFilters, wxString::Format(wxT("all files (%s)|%s"), m_fltr[0] = CreateCheckBoxAndAddToSizer(sizerFilters, wxString::Format("all files (%s)|%s",
wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr)); wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr));
m_fltr[1] = CreateCheckBoxAndAddToSizer(sizerFilters, wxT("C++ files (*.cpp; *.h)|*.cpp;*.h")); m_fltr[1] = CreateCheckBoxAndAddToSizer(sizerFilters, "C++ files (*.cpp; *.h)|*.cpp;*.h");
m_fltr[2] = CreateCheckBoxAndAddToSizer(sizerFilters, wxT("PNG images (*.png)|*.png")); m_fltr[2] = CreateCheckBoxAndAddToSizer(sizerFilters, "PNG images (*.png)|*.png");
sizerLeft->Add(sizerFilters, wxSizerFlags().Expand().Border()); sizerLeft->Add(sizerFilters, wxSizerFlags().Expand().Border());
wxButton *btn = new wxButton(this, DirCtrlPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, DirCtrlPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// keep consistency between enum and labels of radiobox // keep consistency between enum and labels of radiobox
wxCOMPILE_TIME_ASSERT( stdPathMax == WXSIZEOF(stdPaths), EnumForRadioBoxMismatch); wxCOMPILE_TIME_ASSERT( stdPathMax == WXSIZEOF(stdPaths), EnumForRadioBoxMismatch);
// middle pane // middle pane
m_radioStdPath = new wxRadioBox(this, wxID_ANY, wxT("Standard path"), m_radioStdPath = new wxRadioBox(this, wxID_ANY, "Standard path",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(stdPaths), stdPaths, 1); WXSIZEOF(stdPaths), stdPaths, 1);
@@ -275,7 +275,7 @@ void DirCtrlWidgetsPage::CreateDirCtrl()
if (m_fltr[i]->IsChecked()) if (m_fltr[i]->IsChecked())
{ {
if (!filter.IsEmpty()) if (!filter.IsEmpty())
filter += wxT("|"); filter += "|";
filter += m_fltr[i]->GetLabel(); filter += m_fltr[i]->GetLabel();
} }
} }
@@ -317,7 +317,7 @@ void DirCtrlWidgetsPage::OnRadioBox(wxCommandEvent& WXUNUSED(event))
{ {
wxString path; wxString path;
wxTheApp->SetAppName(wxT("widgets")); wxTheApp->SetAppName("widgets");
wxStandardPathsBase& stdp = wxStandardPaths::Get(); wxStandardPathsBase& stdp = wxStandardPaths::Get();
switch ( m_radioStdPath->GetSelection() ) switch ( m_radioStdPath->GetSelection() )

View File

@@ -133,7 +133,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS GENERIC_CTRLS #define FAMILY_CTRLS GENERIC_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(DirPickerWidgetsPage, wxT("DirPicker"), IMPLEMENT_WIDGETS_PAGE(DirPickerWidgetsPage, "DirPicker",
PICKER_CTRLS | FAMILY_CTRLS); PICKER_CTRLS | FAMILY_CTRLS);
DirPickerWidgetsPage::DirPickerWidgetsPage(WidgetsBookCtrl *book, DirPickerWidgetsPage::DirPickerWidgetsPage(WidgetsBookCtrl *book,
@@ -147,10 +147,10 @@ void DirPickerWidgetsPage::CreateContent()
// left pane // left pane
wxSizer *boxleft = new wxBoxSizer(wxVERTICAL); wxSizer *boxleft = new wxBoxSizer(wxVERTICAL);
wxStaticBoxSizer *dirbox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&DirPicker style")); wxStaticBoxSizer *dirbox = new wxStaticBoxSizer(wxVERTICAL, this, "&DirPicker style");
m_chkDirTextCtrl = CreateCheckBoxAndAddToSizer(dirbox, wxT("With textctrl")); m_chkDirTextCtrl = CreateCheckBoxAndAddToSizer(dirbox, "With textctrl");
m_chkDirMustExist = CreateCheckBoxAndAddToSizer(dirbox, wxT("Dir must exist")); m_chkDirMustExist = CreateCheckBoxAndAddToSizer(dirbox, "Dir must exist");
m_chkDirChangeDir = CreateCheckBoxAndAddToSizer(dirbox, wxT("Change working dir")); m_chkDirChangeDir = CreateCheckBoxAndAddToSizer(dirbox, "Change working dir");
m_chkSmall = CreateCheckBoxAndAddToSizer(dirbox, "&Small version"); m_chkSmall = CreateCheckBoxAndAddToSizer(dirbox, "&Small version");
boxleft->Add(dirbox, 0, wxALL|wxGROW, 5); boxleft->Add(dirbox, 0, wxALL|wxGROW, 5);
@@ -164,7 +164,7 @@ void DirPickerWidgetsPage::CreateContent()
boxleft->AddSpacer(10); boxleft->AddSpacer(10);
boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")), boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
Reset(); // set checkboxes state Reset(); // set checkboxes state
@@ -206,7 +206,7 @@ void DirPickerWidgetsPage::CreatePicker()
style |= wxDIRP_SMALL; style |= wxDIRP_SMALL;
m_dirPicker = new wxDirPickerCtrl(this, PickerPage_Dir, m_dirPicker = new wxDirPickerCtrl(this, PickerPage_Dir,
wxGetHomeDir(), wxT("Hello!"), wxGetHomeDir(), "Hello!",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
style); style);
} }
@@ -246,7 +246,7 @@ void DirPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
void DirPickerWidgetsPage::OnDirChange(wxFileDirPickerEvent& event) void DirPickerWidgetsPage::OnDirChange(wxFileDirPickerEvent& event)
{ {
wxLogMessage(wxT("The directory changed to '%s' ! The current working directory is '%s'"), wxLogMessage("The directory changed to '%s' ! The current working directory is '%s'",
event.GetPath().c_str(), wxGetCwd().c_str()); event.GetPath().c_str(), wxGetCwd().c_str());
} }

View File

@@ -115,7 +115,7 @@ wxEND_EVENT_TABLE()
// implementation // implementation
// ============================================================================ // ============================================================================
IMPLEMENT_WIDGETS_PAGE(EditableListboxWidgetsPage, wxT("EditableListbox"), GENERIC_CTRLS); IMPLEMENT_WIDGETS_PAGE(EditableListboxWidgetsPage, "EditableListbox", GENERIC_CTRLS);
EditableListboxWidgetsPage::EditableListboxWidgetsPage(WidgetsBookCtrl *book, EditableListboxWidgetsPage::EditableListboxWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist) wxImageList *imaglist)
@@ -134,15 +134,15 @@ void EditableListboxWidgetsPage::CreateContent()
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxStaticBox *box = new wxStaticBox(this, wxID_ANY,
wxT("&Set listbox parameters")); "&Set listbox parameters");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
m_chkAllowNew = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Allow new items")); m_chkAllowNew = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow new items");
m_chkAllowEdit = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Allow editing items")); m_chkAllowEdit = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow editing items");
m_chkAllowDelete = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Allow deleting items")); m_chkAllowDelete = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow deleting items");
m_chkAllowNoReorder = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Block user reordering")); m_chkAllowNoReorder = CreateCheckBoxAndAddToSizer(sizerLeft, "Block user reordering");
wxButton *btn = new wxButton(this, EditableListboxPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, EditableListboxPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// right pane // right pane

View File

@@ -145,7 +145,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS GENERIC_CTRLS #define FAMILY_CTRLS GENERIC_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE( FileCtrlWidgetsPage, wxT( "FileCtrl" ), IMPLEMENT_WIDGETS_PAGE( FileCtrlWidgetsPage, "FileCtrl",
FAMILY_CTRLS ); FAMILY_CTRLS );
FileCtrlWidgetsPage::FileCtrlWidgetsPage( WidgetsBookCtrl *book, FileCtrlWidgetsPage::FileCtrlWidgetsPage( WidgetsBookCtrl *book,
@@ -161,37 +161,37 @@ void FileCtrlWidgetsPage::CreateContent()
// left pane // left pane
wxSizer *sizerLeft = new wxBoxSizer( wxVERTICAL ); wxSizer *sizerLeft = new wxBoxSizer( wxVERTICAL );
static const wxString mode[] = { wxT( "open" ), wxT( "save" ) }; static const wxString mode[] = { "open", "save" };
m_radioFileCtrlMode = new wxRadioBox( this, wxID_ANY, wxT( "wxFileCtrl mode" ), m_radioFileCtrlMode = new wxRadioBox( this, wxID_ANY, "wxFileCtrl mode",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF( mode ), mode ); WXSIZEOF( mode ), mode );
sizerLeft->Add( m_radioFileCtrlMode, sizerLeft->Add( m_radioFileCtrlMode,
0, wxALL | wxEXPAND , 5 ); 0, wxALL | wxEXPAND , 5 );
sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetDirectory , wxT( "Set &directory" ), wxID_ANY, &m_dir ), sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetDirectory , "Set &directory", wxID_ANY, &m_dir ),
0, wxALL | wxEXPAND , 5 ); 0, wxALL | wxEXPAND , 5 );
sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetPath , wxT( "Set &path" ), wxID_ANY, &m_path ), sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetPath , "Set &path", wxID_ANY, &m_path ),
0, wxALL | wxEXPAND , 5 ); 0, wxALL | wxEXPAND , 5 );
sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetFilename , wxT( "Set &filename" ), wxID_ANY, &m_filename ), sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetFilename , "Set &filename", wxID_ANY, &m_filename ),
0, wxALL | wxEXPAND , 5 ); 0, wxALL | wxEXPAND , 5 );
wxSizer *sizerUseFlags = wxSizer *sizerUseFlags =
new wxStaticBoxSizer( wxVERTICAL, this, wxT( "&Flags" ) ); new wxStaticBoxSizer( wxVERTICAL, this, "&Flags");
m_chkMultiple = CreateCheckBoxAndAddToSizer( sizerUseFlags, wxT( "wxFC_MULTIPLE" ) ); m_chkMultiple = CreateCheckBoxAndAddToSizer( sizerUseFlags, "wxFC_MULTIPLE");
m_chkNoShowHidden = CreateCheckBoxAndAddToSizer( sizerUseFlags, wxT( "wxFC_NOSHOWHIDDEN" ) ); m_chkNoShowHidden = CreateCheckBoxAndAddToSizer( sizerUseFlags, "wxFC_NOSHOWHIDDEN");
sizerLeft->Add( sizerUseFlags, wxSizerFlags().Expand().Border() ); sizerLeft->Add( sizerUseFlags, wxSizerFlags().Expand().Border() );
wxSizer *sizerFilters = wxSizer *sizerFilters =
new wxStaticBoxSizer( wxVERTICAL, this, wxT( "&Filters" ) ); new wxStaticBoxSizer( wxVERTICAL, this, "&Filters");
m_fltr[0] = CreateCheckBoxAndAddToSizer( sizerFilters, wxString::Format( wxT( "all files (%s)|%s" ), m_fltr[0] = CreateCheckBoxAndAddToSizer( sizerFilters, wxString::Format("all files (%s)|%s",
wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr ) ); wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr ) );
m_fltr[1] = CreateCheckBoxAndAddToSizer( sizerFilters, wxT( "C++ files (*.cpp; *.h)|*.cpp;*.h" ) ); m_fltr[1] = CreateCheckBoxAndAddToSizer( sizerFilters, "C++ files (*.cpp; *.h)|*.cpp;*.h" );
m_fltr[2] = CreateCheckBoxAndAddToSizer( sizerFilters, wxT( "PNG images (*.png)|*.png" ) ); m_fltr[2] = CreateCheckBoxAndAddToSizer( sizerFilters, "PNG images (*.png)|*.png");
sizerLeft->Add( sizerFilters, wxSizerFlags().Expand().Border() ); sizerLeft->Add( sizerFilters, wxSizerFlags().Expand().Border() );
wxButton *btn = new wxButton( this, FileCtrlPage_Reset, wxT( "&Reset" ) ); wxButton *btn = new wxButton( this, FileCtrlPage_Reset, "&Reset" );
sizerLeft->Add( btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15 ); sizerLeft->Add( btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15 );
// right pane // right pane
@@ -253,7 +253,7 @@ void FileCtrlWidgetsPage::CreateFileCtrl()
if ( m_fltr[i]->IsChecked() ) if ( m_fltr[i]->IsChecked() )
{ {
if ( !wildcard.IsEmpty() ) if ( !wildcard.IsEmpty() )
wildcard += wxT( "|" ); wildcard += "|";
wildcard += m_fltr[i]->GetLabel(); wildcard += m_fltr[i]->GetLabel();
} }
} }

View File

@@ -150,7 +150,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS GENERIC_CTRLS #define FAMILY_CTRLS GENERIC_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(FilePickerWidgetsPage, wxT("FilePicker"), IMPLEMENT_WIDGETS_PAGE(FilePickerWidgetsPage, "FilePicker",
PICKER_CTRLS | FAMILY_CTRLS); PICKER_CTRLS | FAMILY_CTRLS);
FilePickerWidgetsPage::FilePickerWidgetsPage(WidgetsBookCtrl *book, FilePickerWidgetsPage::FilePickerWidgetsPage(WidgetsBookCtrl *book,
@@ -164,17 +164,17 @@ void FilePickerWidgetsPage::CreateContent()
// left pane // left pane
wxSizer *boxleft = new wxBoxSizer(wxVERTICAL); wxSizer *boxleft = new wxBoxSizer(wxVERTICAL);
static const wxString mode[] = { wxT("open"), wxT("save") }; static const wxString mode[] = { "open", "save" };
m_radioFilePickerMode = new wxRadioBox(this, wxID_ANY, wxT("wxFilePicker mode"), m_radioFilePickerMode = new wxRadioBox(this, wxID_ANY, "wxFilePicker mode",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(mode), mode); WXSIZEOF(mode), mode);
boxleft->Add(m_radioFilePickerMode, 0, wxALL|wxGROW, 5); boxleft->Add(m_radioFilePickerMode, 0, wxALL|wxGROW, 5);
wxStaticBoxSizer *filebox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&FilePicker style")); wxStaticBoxSizer *filebox = new wxStaticBoxSizer(wxVERTICAL, this, "&FilePicker style");
m_chkFileTextCtrl = CreateCheckBoxAndAddToSizer(filebox, wxT("With textctrl")); m_chkFileTextCtrl = CreateCheckBoxAndAddToSizer(filebox, "With textctrl");
m_chkFileOverwritePrompt = CreateCheckBoxAndAddToSizer(filebox, wxT("Overwrite prompt")); m_chkFileOverwritePrompt = CreateCheckBoxAndAddToSizer(filebox, "Overwrite prompt");
m_chkFileMustExist = CreateCheckBoxAndAddToSizer(filebox, wxT("File must exist")); m_chkFileMustExist = CreateCheckBoxAndAddToSizer(filebox, "File must exist");
m_chkFileChangeDir = CreateCheckBoxAndAddToSizer(filebox, wxT("Change working dir")); m_chkFileChangeDir = CreateCheckBoxAndAddToSizer(filebox, "Change working dir");
m_chkSmall = CreateCheckBoxAndAddToSizer(filebox, "&Small version"); m_chkSmall = CreateCheckBoxAndAddToSizer(filebox, "&Small version");
boxleft->Add(filebox, 0, wxALL|wxGROW, 5); boxleft->Add(filebox, 0, wxALL|wxGROW, 5);
@@ -189,7 +189,7 @@ void FilePickerWidgetsPage::CreateContent()
boxleft->AddSpacer(10); boxleft->AddSpacer(10);
boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")), boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
Reset(); // set checkboxes state Reset(); // set checkboxes state
@@ -245,7 +245,7 @@ void FilePickerWidgetsPage::CreatePicker()
// pass an empty string as initial file // pass an empty string as initial file
m_filePicker = new wxFilePickerCtrl(this, PickerPage_File, m_filePicker = new wxFilePickerCtrl(this, PickerPage_File,
wxEmptyString, wxEmptyString,
wxT("Hello!"), wxT("*"), "Hello!", "*",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
style); style);
} }
@@ -310,7 +310,7 @@ void FilePickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
void FilePickerWidgetsPage::OnFileChange(wxFileDirPickerEvent& event) void FilePickerWidgetsPage::OnFileChange(wxFileDirPickerEvent& event)
{ {
wxLogMessage(wxT("The file changed to '%s' ! The current working directory is '%s'"), wxLogMessage("The file changed to '%s' ! The current working directory is '%s'",
event.GetPath().c_str(), wxGetCwd().c_str()); event.GetPath().c_str(), wxGetCwd().c_str());
} }

View File

@@ -125,7 +125,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS GENERIC_CTRLS #define FAMILY_CTRLS GENERIC_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(FontPickerWidgetsPage, wxT("FontPicker"), IMPLEMENT_WIDGETS_PAGE(FontPickerWidgetsPage, "FontPicker",
PICKER_CTRLS | FAMILY_CTRLS); PICKER_CTRLS | FAMILY_CTRLS);
FontPickerWidgetsPage::FontPickerWidgetsPage(WidgetsBookCtrl *book, FontPickerWidgetsPage::FontPickerWidgetsPage(WidgetsBookCtrl *book,
@@ -139,13 +139,13 @@ void FontPickerWidgetsPage::CreateContent()
// left pane // left pane
wxSizer *boxleft = new wxBoxSizer(wxVERTICAL); wxSizer *boxleft = new wxBoxSizer(wxVERTICAL);
wxStaticBoxSizer *fontbox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&FontPicker style")); wxStaticBoxSizer *fontbox = new wxStaticBoxSizer(wxVERTICAL, this, "&FontPicker style");
m_chkFontTextCtrl = CreateCheckBoxAndAddToSizer(fontbox, wxT("With textctrl")); m_chkFontTextCtrl = CreateCheckBoxAndAddToSizer(fontbox, "With textctrl");
m_chkFontDescAsLabel = CreateCheckBoxAndAddToSizer(fontbox, wxT("Font desc as btn label")); m_chkFontDescAsLabel = CreateCheckBoxAndAddToSizer(fontbox, "Font desc as btn label");
m_chkFontUseFontForLabel = CreateCheckBoxAndAddToSizer(fontbox, wxT("Use font for label")); m_chkFontUseFontForLabel = CreateCheckBoxAndAddToSizer(fontbox, "Use font for label");
boxleft->Add(fontbox, 0, wxALL|wxGROW, 5); boxleft->Add(fontbox, 0, wxALL|wxGROW, 5);
boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")), boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
Reset(); // set checkboxes state Reset(); // set checkboxes state
@@ -218,7 +218,7 @@ void FontPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
void FontPickerWidgetsPage::OnFontChange(wxFontPickerEvent& event) void FontPickerWidgetsPage::OnFontChange(wxFontPickerEvent& event)
{ {
wxLogMessage(wxT("The font changed to '%s' with size %d !"), wxLogMessage("The font changed to '%s' with size %d !",
event.GetFont().GetFaceName().c_str(), event.GetFont().GetPointSize()); event.GetFont().GetFaceName().c_str(), event.GetFont().GetPointSize());
} }

View File

@@ -175,7 +175,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, wxT("Gauge"), FAMILY_CTRLS ); IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, "Gauge", FAMILY_CTRLS );
GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book, GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist) wxImageList *imaglist)
@@ -199,25 +199,25 @@ void GaugeWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Vertical")); m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical");
m_chkSmooth = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Smooth")); m_chkSmooth = CreateCheckBoxAndAddToSizer(sizerLeft, "&Smooth");
m_chkProgress = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Progress")); m_chkProgress = CreateCheckBoxAndAddToSizer(sizerLeft, "&Progress");
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
wxButton *btn = new wxButton(this, GaugePage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, GaugePage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Change gauge value")); wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Change gauge value");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxTextCtrl *text; wxTextCtrl *text;
wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Current value"), wxSizer *sizerRow = CreateSizerWithTextAndLabel("Current value",
GaugePage_CurValueText, GaugePage_CurValueText,
&text); &text);
text->SetEditable(false); text->SetEditable(false);
@@ -225,26 +225,26 @@ void GaugeWidgetsPage::CreateContent()
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(GaugePage_SetValue, sizerRow = CreateSizerWithTextAndButton(GaugePage_SetValue,
wxT("Set &value"), "Set &value",
GaugePage_ValueText, GaugePage_ValueText,
&m_textValue); &m_textValue);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(GaugePage_SetRange, sizerRow = CreateSizerWithTextAndButton(GaugePage_SetRange,
wxT("Set &range"), "Set &range",
GaugePage_RangeText, GaugePage_RangeText,
&m_textRange); &m_textRange);
m_textRange->SetValue( wxString::Format(wxT("%lu"), m_range) ); m_textRange->SetValue( wxString::Format("%lu", m_range) );
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, GaugePage_Progress, wxT("Simulate &progress")); btn = new wxButton(this, GaugePage_Progress, "Simulate &progress");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, GaugePage_IndeterminateProgress, btn = new wxButton(this, GaugePage_IndeterminateProgress,
wxT("Simulate &indeterminate job")); "Simulate &indeterminate job");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, GaugePage_Clear, wxT("&Clear")); btn = new wxButton(this, GaugePage_Clear, "&Clear");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
// right pane // right pane
@@ -322,13 +322,13 @@ void GaugeWidgetsPage::StartTimer(wxButton *clicked)
{ {
static const int INTERVAL = 300; static const int INTERVAL = 300;
wxLogMessage(wxT("Launched progress timer (interval = %d ms)"), INTERVAL); wxLogMessage("Launched progress timer (interval = %d ms)", INTERVAL);
m_timer = new wxTimer(this, m_timer = new wxTimer(this,
clicked->GetId() == GaugePage_Progress ? GaugePage_Timer : GaugePage_IndeterminateTimer); clicked->GetId() == GaugePage_Progress ? GaugePage_Timer : GaugePage_IndeterminateTimer);
m_timer->Start(INTERVAL); m_timer->Start(INTERVAL);
clicked->SetLabel(wxT("&Stop timer")); clicked->SetLabel("&Stop timer");
if (clicked->GetId() == GaugePage_Progress) if (clicked->GetId() == GaugePage_Progress)
FindWindow(GaugePage_IndeterminateProgress)->Disable(); FindWindow(GaugePage_IndeterminateProgress)->Disable();
@@ -338,23 +338,23 @@ void GaugeWidgetsPage::StartTimer(wxButton *clicked)
void GaugeWidgetsPage::StopTimer(wxButton *clicked) void GaugeWidgetsPage::StopTimer(wxButton *clicked)
{ {
wxCHECK_RET( m_timer, wxT("shouldn't be called") ); wxCHECK_RET( m_timer, "shouldn't be called" );
m_timer->Stop(); m_timer->Stop();
wxDELETE(m_timer); wxDELETE(m_timer);
if (clicked->GetId() == GaugePage_Progress) if (clicked->GetId() == GaugePage_Progress)
{ {
clicked->SetLabel(wxT("Simulate &progress")); clicked->SetLabel("Simulate &progress");
FindWindow(GaugePage_IndeterminateProgress)->Enable(); FindWindow(GaugePage_IndeterminateProgress)->Enable();
} }
else else
{ {
clicked->SetLabel(wxT("Simulate indeterminate job")); clicked->SetLabel("Simulate indeterminate job");
FindWindow(GaugePage_Progress)->Enable(); FindWindow(GaugePage_Progress)->Enable();
} }
wxLogMessage(wxT("Progress finished.")); wxLogMessage("Progress finished.");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -379,7 +379,7 @@ void GaugeWidgetsPage::OnButtonProgress(wxCommandEvent& event)
{ {
StopTimer(b); StopTimer(b);
wxLogMessage(wxT("Stopped the timer.")); wxLogMessage("Stopped the timer.");
} }
} }
@@ -396,7 +396,7 @@ void GaugeWidgetsPage::OnButtonIndeterminateProgress(wxCommandEvent& event)
m_gauge->SetValue(0); m_gauge->SetValue(0);
wxLogMessage(wxT("Stopped the timer.")); wxLogMessage("Stopped the timer.");
} }
} }
@@ -457,7 +457,7 @@ void GaugeWidgetsPage::OnProgressTimer(wxTimerEvent& WXUNUSED(event))
else // reached the end else // reached the end
{ {
wxButton *btn = (wxButton *)FindWindow(GaugePage_Progress); wxButton *btn = (wxButton *)FindWindow(GaugePage_Progress);
wxCHECK_RET( btn, wxT("no progress button?") ); wxCHECK_RET( btn, "no progress button?" );
StopTimer(btn); StopTimer(btn);
} }
@@ -470,7 +470,7 @@ void GaugeWidgetsPage::OnIndeterminateProgressTimer(wxTimerEvent& WXUNUSED(event
void GaugeWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event) void GaugeWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
{ {
event.SetText( wxString::Format(wxT("%d"), m_gauge->GetValue())); event.SetText( wxString::Format("%d", m_gauge->GetValue()));
} }
#endif #endif

View File

@@ -78,7 +78,7 @@ private:
#endif #endif
IMPLEMENT_WIDGETS_PAGE(HeaderCtrlWidgetsPage, IMPLEMENT_WIDGETS_PAGE(HeaderCtrlWidgetsPage,
wxT("Header"), HEADER_CTRL_FAMILY); "Header", HEADER_CTRL_FAMILY);
void HeaderCtrlWidgetsPage::CreateContent() void HeaderCtrlWidgetsPage::CreateContent()
{ {

View File

@@ -142,7 +142,7 @@ wxEND_EVENT_TABLE()
// implementation // implementation
// ============================================================================ // ============================================================================
IMPLEMENT_WIDGETS_PAGE(HyperlinkWidgetsPage, wxT("Hyperlink"), IMPLEMENT_WIDGETS_PAGE(HyperlinkWidgetsPage, "Hyperlink",
GENERIC_CTRLS GENERIC_CTRLS
); );
@@ -157,33 +157,33 @@ void HyperlinkWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("Hyperlink details")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "Hyperlink details");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetLabel , wxT("Set &Label"), wxID_ANY, &m_label ), sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetLabel , "Set &Label", wxID_ANY, &m_label ),
0, wxALL | wxALIGN_RIGHT , 5 ); 0, wxALL | wxALIGN_RIGHT , 5 );
sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetURL , wxT("Set &URL"), wxID_ANY, &m_url ), sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetURL , "Set &URL", wxID_ANY, &m_url ),
0, wxALL | wxALIGN_RIGHT , 5 ); 0, wxALL | wxALIGN_RIGHT , 5 );
static const wxString alignments[] = static const wxString alignments[] =
{ {
wxT("&left"), "&left",
wxT("&centre"), "&centre",
wxT("&right") "&right"
}; };
wxCOMPILE_TIME_ASSERT( WXSIZEOF(alignments) == Align_Max, wxCOMPILE_TIME_ASSERT( WXSIZEOF(alignments) == Align_Max,
AlignMismatch ); AlignMismatch );
m_radioAlignMode = new wxRadioBox(this, wxID_ANY, wxT("alignment"), m_radioAlignMode = new wxRadioBox(this, wxID_ANY, "alignment",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(alignments), alignments); WXSIZEOF(alignments), alignments);
m_radioAlignMode->SetSelection(1); // start with "centre" selected since m_radioAlignMode->SetSelection(1); // start with "centre" selected since
// wxHL_DEFAULT_STYLE contains wxHL_ALIGN_CENTRE // wxHL_DEFAULT_STYLE contains wxHL_ALIGN_CENTRE
sizerLeft->Add(m_radioAlignMode, 0, wxALL|wxGROW, 5); sizerLeft->Add(m_radioAlignMode, 0, wxALL|wxGROW, 5);
m_checkGeneric = new wxCheckBox(this, wxID_ANY, wxT("Use generic version"), m_checkGeneric = new wxCheckBox(this, wxID_ANY, "Use generic version",
wxDefaultPosition, wxDefaultSize); wxDefaultPosition, wxDefaultSize);
sizerLeft->Add(m_checkGeneric, 0, wxALL|wxGROW, 5); sizerLeft->Add(m_checkGeneric, 0, wxALL|wxGROW, 5);
@@ -191,24 +191,24 @@ void HyperlinkWidgetsPage::CreateContent()
wxSizer *szHyperlinkLong = new wxBoxSizer(wxVERTICAL); wxSizer *szHyperlinkLong = new wxBoxSizer(wxVERTICAL);
wxSizer *szHyperlink = new wxBoxSizer(wxHORIZONTAL); wxSizer *szHyperlink = new wxBoxSizer(wxHORIZONTAL);
m_visit = new wxStaticText(this, wxID_ANY, wxT("Visit ")); m_visit = new wxStaticText(this, wxID_ANY, "Visit ");
if (m_checkGeneric->IsChecked()) if (m_checkGeneric->IsChecked())
{ {
m_hyperlink = new wxGenericHyperlinkCtrl(this, m_hyperlink = new wxGenericHyperlinkCtrl(this,
HyperlinkPage_Ctrl, HyperlinkPage_Ctrl,
wxT("wxWidgets website"), "wxWidgets website",
wxT("www.wxwidgets.org")); "www.wxwidgets.org");
} }
else else
{ {
m_hyperlink = new wxHyperlinkCtrl(this, m_hyperlink = new wxHyperlinkCtrl(this,
HyperlinkPage_Ctrl, HyperlinkPage_Ctrl,
wxT("wxWidgets website"), "wxWidgets website",
wxT("www.wxwidgets.org")); "www.wxwidgets.org");
} }
m_fun = new wxStaticText(this, wxID_ANY, wxT(" for fun!")); m_fun = new wxStaticText(this, wxID_ANY, " for fun!");
szHyperlink->Add(0, 0, 1, wxCENTRE); szHyperlink->Add(0, 0, 1, wxCENTRE);
szHyperlink->Add(m_visit, 0, wxCENTRE); szHyperlink->Add(m_visit, 0, wxCENTRE);
@@ -221,15 +221,15 @@ void HyperlinkWidgetsPage::CreateContent()
{ {
m_hyperlinkLong = new wxGenericHyperlinkCtrl(this, m_hyperlinkLong = new wxGenericHyperlinkCtrl(this,
wxID_ANY, wxID_ANY,
wxT("This is a long hyperlink"), "This is a long hyperlink",
wxT("www.wxwidgets.org")); "www.wxwidgets.org");
} }
else else
{ {
m_hyperlinkLong = new wxHyperlinkCtrl(this, m_hyperlinkLong = new wxHyperlinkCtrl(this,
wxID_ANY, wxID_ANY,
wxT("This is a long hyperlink"), "This is a long hyperlink",
wxT("www.wxwidgets.org")); "www.wxwidgets.org");
} }
szHyperlinkLong->Add(0, 0, 1, wxCENTRE); szHyperlinkLong->Add(0, 0, 1, wxCENTRE);
@@ -307,8 +307,8 @@ void HyperlinkWidgetsPage::CreateHyperlinkLong(long align)
{ {
hyp = new wxGenericHyperlinkCtrl(this, hyp = new wxGenericHyperlinkCtrl(this,
wxID_ANY, wxID_ANY,
wxT("This is a long hyperlink"), "This is a long hyperlink",
wxT("www.wxwidgets.org"), "www.wxwidgets.org",
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
style); style);
@@ -317,8 +317,8 @@ void HyperlinkWidgetsPage::CreateHyperlinkLong(long align)
{ {
hyp = new wxHyperlinkCtrl(this, hyp = new wxHyperlinkCtrl(this,
wxID_ANY, wxID_ANY,
wxT("This is a long hyperlink"), "This is a long hyperlink",
wxT("www.wxwidgets.org"), "www.wxwidgets.org",
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
style); style);
@@ -365,7 +365,7 @@ void HyperlinkWidgetsPage::OnAlignment(wxCommandEvent& WXUNUSED(event))
{ {
default: default:
case Align_Max: case Align_Max:
wxFAIL_MSG( wxT("unknown alignment") ); wxFAIL_MSG( "unknown alignment" );
// fall through // fall through
case Align_Left: case Align_Left:

View File

@@ -76,12 +76,12 @@ ItemContainerWidgetsPage::ItemContainerWidgetsPage(WidgetsBookCtrl *book,
#endif // __WXMSW__ || __WXGTK__ #endif // __WXMSW__ || __WXGTK__
, m_trackedDataObjects(0) , m_trackedDataObjects(0)
{ {
m_items.Add(wxT("This")); m_items.Add("This");
m_items.Add(wxT("is")); m_items.Add("is");
m_items.Add(wxT("a")); m_items.Add("a");
m_items.Add(wxT("List")); m_items.Add("List");
m_items.Add(wxT("of")); m_items.Add("of");
m_items.Add(wxT("strings")); m_items.Add("strings");
m_itemsSorted = m_items; m_itemsSorted = m_items;
} }
@@ -108,11 +108,11 @@ bool ItemContainerWidgetsPage::VerifyAllClientDataDestroyed()
{ {
if ( m_trackedDataObjects ) if ( m_trackedDataObjects )
{ {
wxString message = wxT("Bug in managing wxClientData: "); wxString message = "Bug in managing wxClientData: ";
if ( m_trackedDataObjects > 0 ) if ( m_trackedDataObjects > 0 )
message << m_trackedDataObjects << wxT(" lost objects"); message << m_trackedDataObjects << " lost objects";
else else
message << (-m_trackedDataObjects) << wxT(" extra deletes"); message << (-m_trackedDataObjects) << " extra deletes";
wxFAIL_MSG(message); wxFAIL_MSG(message);
return false; return false;
} }
@@ -123,7 +123,7 @@ bool ItemContainerWidgetsPage::VerifyAllClientDataDestroyed()
void ItemContainerWidgetsPage::StartTest(const wxString& label) void ItemContainerWidgetsPage::StartTest(const wxString& label)
{ {
m_container->Clear(); m_container->Clear();
wxLogMessage(wxT("Test - %s:"), label.c_str()); wxLogMessage("Test - %s:", label.c_str());
} }
void ItemContainerWidgetsPage::EndTest(const wxArrayString& items) void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
@@ -133,7 +133,7 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
bool ok = count == items.GetCount(); bool ok = count == items.GetCount();
if ( !ok ) if ( !ok )
{ {
wxFAIL_MSG(wxT("Item count does not match.")); wxFAIL_MSG("Item count does not match.");
} }
else else
{ {
@@ -143,7 +143,7 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
if ( str != items[i] ) if ( str != items[i] )
{ {
wxFAIL_MSG(wxString::Format( wxFAIL_MSG(wxString::Format(
wxT("Wrong string \"%s\" at position %d (expected \"%s\")"), "Wrong string \"%s\" at position %d (expected \"%s\")",
str.c_str(), i, items[i].c_str())); str.c_str(), i, items[i].c_str()));
ok = false; ok = false;
break; break;
@@ -178,19 +178,19 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items)
m_container->Clear(); m_container->Clear();
ok &= VerifyAllClientDataDestroyed(); ok &= VerifyAllClientDataDestroyed();
wxLogMessage(wxT("...%s"), ok ? wxT("passed") : wxT("failed")); wxLogMessage("...%s", ok ? "passed" : "failed");
} }
wxString wxString
ItemContainerWidgetsPage::DumpContainerData(const wxArrayString& expected) const ItemContainerWidgetsPage::DumpContainerData(const wxArrayString& expected) const
{ {
wxString str; wxString str;
str << wxT("Current content:\n"); str << "Current content:\n";
unsigned i; unsigned i;
for ( i = 0; i < m_container->GetCount(); ++i ) for ( i = 0; i < m_container->GetCount(); ++i )
{ {
str << wxT(" - ") << m_container->GetString(i) << wxT(" ["); str << " - " << m_container->GetString(i) << " [";
if ( m_container->HasClientObjectData() ) if ( m_container->HasClientObjectData() )
{ {
TrackedClientData * TrackedClientData *
@@ -204,20 +204,20 @@ ItemContainerWidgetsPage::DumpContainerData(const wxArrayString& expected) const
if ( data ) if ( data )
str << (wxUIntPtr)data; str << (wxUIntPtr)data;
} }
str << wxT("]\n"); str << "]\n";
} }
str << wxT("Expected content:\n"); str << "Expected content:\n";
for ( i = 0; i < expected.GetCount(); ++i ) for ( i = 0; i < expected.GetCount(); ++i )
{ {
const wxString& item = expected[i]; const wxString& item = expected[i];
str << wxT(" - ") << item << wxT("["); str << " - " << item << "[";
for( unsigned j = 0; j < m_items.GetCount(); ++j ) for( unsigned j = 0; j < m_items.GetCount(); ++j )
{ {
if ( m_items[j] == item ) if ( m_items[j] == item )
str << j; str << j;
} }
str << wxT("]\n"); str << "]\n";
} }
return str; return str;
@@ -227,7 +227,7 @@ bool ItemContainerWidgetsPage::VerifyClientData(wxUIntPtr i, const wxString& str
{ {
if ( i > m_items.GetCount() || m_items[i] != str ) if ( i > m_items.GetCount() || m_items[i] != str )
{ {
wxLogMessage(wxT("Client data for '%s' does not match."), str.c_str()); wxLogMessage("Client data for '%s' does not match.", str.c_str());
return false; return false;
} }
@@ -251,9 +251,9 @@ ItemContainerWidgetsPage::MakeArray(const wxSortedArrayString& sorted)
void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&) void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
{ {
m_container = GetContainer(); m_container = GetContainer();
wxASSERT_MSG(m_container, wxT("Widget must have a test widget")); wxASSERT_MSG(m_container, "Widget must have a test widget");
wxLogMessage(wxT("wxItemContainer test for %s, %s:"), wxLogMessage("wxItemContainer test for %s, %s:",
GetWidget()->GetClassInfo()->GetClassName(), GetWidget()->GetClassInfo()->GetClassName(),
(m_container->IsSorted() ? "Sorted" : "Unsorted")); (m_container->IsSorted() ? "Sorted" : "Unsorted"));
@@ -261,16 +261,16 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
expected_result = m_container->IsSorted() ? MakeArray(m_itemsSorted) expected_result = m_container->IsSorted() ? MakeArray(m_itemsSorted)
: m_items; : m_items;
StartTest(wxT("Append one item")); StartTest("Append one item");
wxString item = m_items[0]; wxString item = m_items[0];
m_container->Append(item); m_container->Append(item);
EndTest(wxArrayString(1, &item)); EndTest(wxArrayString(1, &item));
StartTest(wxT("Append some items")); StartTest("Append some items");
m_container->Append(m_items); m_container->Append(m_items);
EndTest(expected_result); EndTest(expected_result);
StartTest(wxT("Append some items with data objects")); StartTest("Append some items with data objects");
wxClientData **objects = new wxClientData *[m_items.GetCount()]; wxClientData **objects = new wxClientData *[m_items.GetCount()];
for ( unsigned i = 0; i < m_items.GetCount(); ++i ) for ( unsigned i = 0; i < m_items.GetCount(); ++i )
objects[i] = CreateClientData(i); objects[i] = CreateClientData(i);
@@ -278,7 +278,7 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
EndTest(expected_result); EndTest(expected_result);
delete[] objects; delete[] objects;
StartTest(wxT("Append some items with data")); StartTest("Append some items with data");
void **data = new void *[m_items.GetCount()]; void **data = new void *[m_items.GetCount()];
for ( unsigned i = 0; i < m_items.GetCount(); ++i ) for ( unsigned i = 0; i < m_items.GetCount(); ++i )
data[i] = wxUIntToPtr(i); data[i] = wxUIntToPtr(i);
@@ -286,19 +286,19 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&)
EndTest(expected_result); EndTest(expected_result);
delete[] data; delete[] data;
StartTest(wxT("Append some items with data, one by one")); StartTest("Append some items with data, one by one");
for ( unsigned i = 0; i < m_items.GetCount(); ++i ) for ( unsigned i = 0; i < m_items.GetCount(); ++i )
m_container->Append(m_items[i], wxUIntToPtr(i)); m_container->Append(m_items[i], wxUIntToPtr(i));
EndTest(expected_result); EndTest(expected_result);
StartTest(wxT("Append some items with data objects, one by one")); StartTest("Append some items with data objects, one by one");
for ( unsigned i = 0; i < m_items.GetCount(); ++i ) for ( unsigned i = 0; i < m_items.GetCount(); ++i )
m_container->Append(m_items[i], CreateClientData(i)); m_container->Append(m_items[i], CreateClientData(i));
EndTest(expected_result); EndTest(expected_result);
if ( !m_container->IsSorted() ) if ( !m_container->IsSorted() )
{ {
StartTest(wxT("Insert in reverse order with data, one by one")); StartTest("Insert in reverse order with data, one by one");
for ( unsigned i = m_items.GetCount(); i; --i ) for ( unsigned i = m_items.GetCount(); i; --i )
m_container->Insert(m_items[i - 1], 0, wxUIntToPtr(i - 1)); m_container->Insert(m_items[i - 1], 0, wxUIntToPtr(i - 1));
EndTest(expected_result); EndTest(expected_result);

View File

@@ -244,7 +244,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, wxT("Listbox"), IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, "Listbox",
FAMILY_CTRLS | WITH_ITEMS_CTRLS FAMILY_CTRLS | WITH_ITEMS_CTRLS
); );
@@ -278,17 +278,17 @@ void ListboxWidgetsPage::CreateContent()
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxStaticBox *box = new wxStaticBox(this, wxID_ANY,
wxT("&Set listbox parameters")); "&Set listbox parameters");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
static const wxString modes[] = static const wxString modes[] =
{ {
wxT("single"), "single",
wxT("extended"), "extended",
wxT("multiple"), "multiple",
}; };
m_radioSelMode = new wxRadioBox(this, wxID_ANY, wxT("Selection &mode:"), m_radioSelMode = new wxRadioBox(this, wxID_ANY, "Selection &mode:",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(modes), modes, WXSIZEOF(modes), modes,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
@@ -311,15 +311,15 @@ void ListboxWidgetsPage::CreateContent()
m_chkVScroll = CreateCheckBoxAndAddToSizer m_chkVScroll = CreateCheckBoxAndAddToSizer
( (
sizerLeft, sizerLeft,
wxT("Always show &vertical scrollbar") "Always show &vertical scrollbar"
); );
m_chkHScroll = CreateCheckBoxAndAddToSizer m_chkHScroll = CreateCheckBoxAndAddToSizer
( (
sizerLeft, sizerLeft,
wxT("Show &horizontal scrollbar") "Show &horizontal scrollbar"
); );
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Sort items")); m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, "&Sort items");
m_chkOwnerDraw = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Owner drawn")); m_chkOwnerDraw = CreateCheckBoxAndAddToSizer(sizerLeft, "&Owner drawn");
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
sizerLeft->Add(m_radioSelMode, 0, wxGROW | wxALL, 5); sizerLeft->Add(m_radioSelMode, 0, wxGROW | wxALL, 5);
@@ -327,67 +327,67 @@ void ListboxWidgetsPage::CreateContent()
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
sizerLeft->Add(m_radioListType, 0, wxGROW | wxALL, 5); sizerLeft->Add(m_radioListType, 0, wxGROW | wxALL, 5);
wxButton *btn = new wxButton(this, ListboxPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, ListboxPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
wxT("&Change listbox contents")); "&Change listbox contents");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(this, ListboxPage_Add, wxT("&Add this string")); btn = new wxButton(this, ListboxPage_Add, "&Add this string");
m_textAdd = new wxTextCtrl(this, ListboxPage_AddText, wxT("test item 0")); m_textAdd = new wxTextCtrl(this, ListboxPage_AddText, "test item 0");
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textAdd, 1, wxLEFT, 5); sizerRow->Add(m_textAdd, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ListboxPage_AddSeveral, wxT("&Insert a few strings")); btn = new wxButton(this, ListboxPage_AddSeveral, "&Insert a few strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ListboxPage_AddMany, wxT("Add &many strings")); btn = new wxButton(this, ListboxPage_AddMany, "Add &many strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = new wxBoxSizer(wxHORIZONTAL); sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(this, ListboxPage_Change, wxT("C&hange current")); btn = new wxButton(this, ListboxPage_Change, "C&hange current");
m_textChange = new wxTextCtrl(this, ListboxPage_ChangeText, wxEmptyString); m_textChange = new wxTextCtrl(this, ListboxPage_ChangeText, wxEmptyString);
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textChange, 1, wxLEFT, 5); sizerRow->Add(m_textChange, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = new wxBoxSizer(wxHORIZONTAL); sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(this, ListboxPage_EnsureVisible, wxT("Make item &visible")); btn = new wxButton(this, ListboxPage_EnsureVisible, "Make item &visible");
m_textEnsureVisible = new wxTextCtrl(this, ListboxPage_EnsureVisibleText, wxEmptyString); m_textEnsureVisible = new wxTextCtrl(this, ListboxPage_EnsureVisibleText, wxEmptyString);
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textEnsureVisible, 1, wxLEFT, 5); sizerRow->Add(m_textEnsureVisible, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = new wxBoxSizer(wxHORIZONTAL); sizerRow = new wxBoxSizer(wxHORIZONTAL);
btn = new wxButton(this, ListboxPage_Delete, wxT("&Delete this item")); btn = new wxButton(this, ListboxPage_Delete, "&Delete this item");
m_textDelete = new wxTextCtrl(this, ListboxPage_DeleteText, wxEmptyString); m_textDelete = new wxTextCtrl(this, ListboxPage_DeleteText, wxEmptyString);
sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(btn, 0, wxRIGHT, 5);
sizerRow->Add(m_textDelete, 1, wxLEFT, 5); sizerRow->Add(m_textDelete, 1, wxLEFT, 5);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ListboxPage_DeleteSel, wxT("Delete &selection")); btn = new wxButton(this, ListboxPage_DeleteSel, "Delete &selection");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ListboxPage_Clear, wxT("&Clear")); btn = new wxButton(this, ListboxPage_Clear, "&Clear");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ListboxPage_MoveUp, wxT("Move item &up")); btn = new wxButton(this, ListboxPage_MoveUp, "Move item &up");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ListboxPage_MoveDown, wxT("Move item &down")); btn = new wxButton(this, ListboxPage_MoveDown, "Move item &down");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ListboxPage_GetTopItem, wxT("Get top item")); btn = new wxButton(this, ListboxPage_GetTopItem, "Get top item");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ListboxPage_GetCountPerPage, wxT("Get count per page")); btn = new wxButton(this, ListboxPage_GetCountPerPage, "Get count per page");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ListboxPage_ContainerTests, wxT("Run &tests")); btn = new wxButton(this, ListboxPage_ContainerTests, "Run &tests");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
// right pane // right pane
@@ -431,7 +431,7 @@ void ListboxWidgetsPage::CreateLbox()
switch ( m_radioSelMode->GetSelection() ) switch ( m_radioSelMode->GetSelection() )
{ {
default: default:
wxFAIL_MSG( wxT("unexpected radio box selection") ); wxFAIL_MSG( "unexpected radio box selection" );
wxFALLTHROUGH; wxFALLTHROUGH;
case LboxSel_Single: flags |= wxLB_SINGLE; break; case LboxSel_Single: flags |= wxLB_SINGLE; break;
@@ -617,7 +617,7 @@ void ListboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
if ( !m_textAdd->IsModified() ) if ( !m_textAdd->IsModified() )
{ {
// update the default string // update the default string
m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); m_textAdd->SetValue(wxString::Format("test item %u", ++s_item));
} }
m_lbox->Append(s); m_lbox->Append(s);
@@ -628,16 +628,16 @@ void ListboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
// "many" means 1000 here // "many" means 1000 here
for ( unsigned int n = 0; n < 1000; n++ ) for ( unsigned int n = 0; n < 1000; n++ )
{ {
m_lbox->Append(wxString::Format(wxT("item #%u"), n)); m_lbox->Append(wxString::Format("item #%u", n));
} }
} }
void ListboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) void ListboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
{ {
wxArrayString items; wxArrayString items;
items.Add(wxT("First")); items.Add("First");
items.Add(wxT("another one")); items.Add("another one");
items.Add(wxT("and the last (very very very very very very very very very very long) one")); items.Add("and the last (very very very very very very very very very very long) one");
m_lbox->InsertItems(items, 0); m_lbox->InsertItems(items, 0);
} }
@@ -700,26 +700,26 @@ void ListboxWidgetsPage::OnUpdateUIMoveButtons(wxUpdateUIEvent& evt)
void ListboxWidgetsPage::OnListbox(wxCommandEvent& event) void ListboxWidgetsPage::OnListbox(wxCommandEvent& event)
{ {
long sel = event.GetSelection(); long sel = event.GetSelection();
m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel)); m_textDelete->SetValue(wxString::Format("%ld", sel));
if (event.IsSelection()) if (event.IsSelection())
{ {
wxLogMessage(wxT("Listbox item %ld selected"), sel); wxLogMessage("Listbox item %ld selected", sel);
} }
else else
{ {
wxLogMessage(wxT("Listbox item %ld deselected"), sel); wxLogMessage("Listbox item %ld deselected", sel);
} }
} }
void ListboxWidgetsPage::OnListboxDClick(wxCommandEvent& event) void ListboxWidgetsPage::OnListboxDClick(wxCommandEvent& event)
{ {
wxLogMessage( wxT("Listbox item %d double clicked"), event.GetInt() ); wxLogMessage( "Listbox item %d double clicked", event.GetInt() );
} }
void ListboxWidgetsPage::OnCheckListbox(wxCommandEvent& event) void ListboxWidgetsPage::OnCheckListbox(wxCommandEvent& event)
{ {
wxLogMessage( wxT("Listbox item %d toggled"), event.GetInt() ); wxLogMessage( "Listbox item %d toggled", event.GetInt() );
} }
void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))

View File

@@ -272,7 +272,7 @@ private:
// implementation // implementation
// ============================================================================ // ============================================================================
IMPLEMENT_WIDGETS_PAGE(NativeWidgetsPage, wxT("Native"), NATIVE_CTRLS); IMPLEMENT_WIDGETS_PAGE(NativeWidgetsPage, "Native", NATIVE_CTRLS);
NativeWidgetsPage::NativeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) NativeWidgetsPage::NativeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
: WidgetsPage(book, imaglist, native_xpm) : WidgetsPage(book, imaglist, native_xpm)

View File

@@ -204,20 +204,20 @@ void BookWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style");
// must be in sync with Orient enum // must be in sync with Orient enum
wxArrayString orientations; wxArrayString orientations;
orientations.Add(wxT("&top")); orientations.Add("&top");
orientations.Add(wxT("&bottom")); orientations.Add("&bottom");
orientations.Add(wxT("&left")); orientations.Add("&left");
orientations.Add(wxT("&right")); orientations.Add("&right");
wxASSERT_MSG( orientations.GetCount() == Orient_Max, wxASSERT_MSG( orientations.GetCount() == Orient_Max,
wxT("forgot to update something") ); "forgot to update something" );
m_chkImages = new wxCheckBox(this, wxID_ANY, wxT("Show &images")); m_chkImages = new wxCheckBox(this, wxID_ANY, "Show &images");
m_radioOrient = new wxRadioBox(this, wxID_ANY, wxT("&Tab orientation"), m_radioOrient = new wxRadioBox(this, wxID_ANY, "&Tab orientation",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
orientations, 1, wxRA_SPECIFY_COLS); orientations, 1, wxRA_SPECIFY_COLS);
@@ -227,48 +227,48 @@ void BookWidgetsPage::CreateContent()
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
sizerLeft->Add(m_radioOrient, 0, wxALL, 5); sizerLeft->Add(m_radioOrient, 0, wxALL, 5);
wxButton *btn = new wxButton(this, BookPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, BookPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Contents")); wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Contents");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxTextCtrl *text; wxTextCtrl *text;
wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Number of pages: "), wxSizer *sizerRow = CreateSizerWithTextAndLabel("Number of pages: ",
BookPage_NumPagesText, BookPage_NumPagesText,
&text); &text);
text->SetEditable(false); text->SetEditable(false);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndLabel(wxT("Current selection: "), sizerRow = CreateSizerWithTextAndLabel("Current selection: ",
BookPage_CurSelectText, BookPage_CurSelectText,
&text); &text);
text->SetEditable(false); text->SetEditable(false);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(BookPage_SelectPage, sizerRow = CreateSizerWithTextAndButton(BookPage_SelectPage,
wxT("&Select page"), "&Select page",
BookPage_SelectText, BookPage_SelectText,
&m_textSelect); &m_textSelect);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, BookPage_AddPage, wxT("&Add page")); btn = new wxButton(this, BookPage_AddPage, "&Add page");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(BookPage_InsertPage, sizerRow = CreateSizerWithTextAndButton(BookPage_InsertPage,
wxT("&Insert page at"), "&Insert page at",
BookPage_InsertText, BookPage_InsertText,
&m_textInsert); &m_textInsert);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(BookPage_RemovePage, sizerRow = CreateSizerWithTextAndButton(BookPage_RemovePage,
wxT("&Remove page"), "&Remove page",
BookPage_RemoveText, BookPage_RemoveText,
&m_textRemove); &m_textRemove);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, BookPage_DeleteAll, wxT("&Delete All")); btn = new wxButton(this, BookPage_DeleteAll, "&Delete All");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
// right pane // right pane
@@ -342,7 +342,7 @@ void BookWidgetsPage::RecreateBook()
switch ( m_radioOrient->GetSelection() ) switch ( m_radioOrient->GetSelection() )
{ {
default: default:
wxFAIL_MSG( wxT("unknown orientation") ); wxFAIL_MSG( "unknown orientation" );
// fall through // fall through
case Orient_Top: case Orient_Top:
@@ -429,7 +429,7 @@ int BookWidgetsPage::GetIconIndex() const
wxWindow *BookWidgetsPage::CreateNewPage() wxWindow *BookWidgetsPage::CreateNewPage()
{ {
return new wxTextCtrl(m_book, wxID_ANY, wxT("I'm a book page")); return new wxTextCtrl(m_book, wxID_ANY, "I'm a book page");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -451,30 +451,30 @@ void BookWidgetsPage::OnButtonDeleteAll(wxCommandEvent& WXUNUSED(event))
void BookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event)) void BookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event))
{ {
int pos = GetTextValue(m_textSelect); int pos = GetTextValue(m_textSelect);
wxCHECK_RET( IsValidValue(pos), wxT("button should be disabled") ); wxCHECK_RET( IsValidValue(pos), "button should be disabled" );
m_book->SetSelection(pos); m_book->SetSelection(pos);
} }
void BookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event)) void BookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event))
{ {
m_book->AddPage(CreateNewPage(), wxT("Added page"), false, m_book->AddPage(CreateNewPage(), "Added page", false,
GetIconIndex()); GetIconIndex());
} }
void BookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event)) void BookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event))
{ {
int pos = GetTextValue(m_textInsert); int pos = GetTextValue(m_textInsert);
wxCHECK_RET( IsValidValue(pos), wxT("button should be disabled") ); wxCHECK_RET( IsValidValue(pos), "button should be disabled" );
m_book->InsertPage(pos, CreateNewPage(), wxT("Inserted page"), false, m_book->InsertPage(pos, CreateNewPage(), "Inserted page", false,
GetIconIndex()); GetIconIndex());
} }
void BookWidgetsPage::OnButtonRemovePage(wxCommandEvent& WXUNUSED(event)) void BookWidgetsPage::OnButtonRemovePage(wxCommandEvent& WXUNUSED(event))
{ {
int pos = GetTextValue(m_textRemove); int pos = GetTextValue(m_textRemove);
wxCHECK_RET( IsValidValue(pos), wxT("button should be disabled") ); wxCHECK_RET( IsValidValue(pos), "button should be disabled" );
m_book->DeletePage(pos); m_book->DeletePage(pos);
} }
@@ -504,13 +504,13 @@ void BookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
void BookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event) void BookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event)
{ {
if(m_book) if(m_book)
event.SetText( wxString::Format(wxT("%u"), unsigned(m_book->GetPageCount())) ); event.SetText( wxString::Format("%u", unsigned(m_book->GetPageCount())) );
} }
void BookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event) void BookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event)
{ {
if(m_book) if(m_book)
event.SetText( wxString::Format(wxT("%d"), m_book->GetSelection()) ); event.SetText( wxString::Format("%d", m_book->GetSelection()) );
} }
void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
@@ -573,13 +573,13 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, wxT("Notebook"), IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, "Notebook",
FAMILY_CTRLS | BOOK_CTRLS FAMILY_CTRLS | BOOK_CTRLS
); );
void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event) void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
{ {
wxLogMessage(wxT("Notebook page changing from %d to %d (currently %d)."), wxLogMessage("Notebook page changing from %d to %d (currently %d).",
event.GetOldSelection(), event.GetOldSelection(),
event.GetSelection(), event.GetSelection(),
m_book->GetSelection()); m_book->GetSelection());
@@ -589,7 +589,7 @@ void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event) void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
{ {
wxLogMessage(wxT("Notebook page changed from %d to %d (currently %d)."), wxLogMessage("Notebook page changed from %d to %d (currently %d).",
event.GetOldSelection(), event.GetOldSelection(),
event.GetSelection(), event.GetSelection(),
m_book->GetSelection()); m_book->GetSelection());
@@ -646,13 +646,13 @@ wxBEGIN_EVENT_TABLE(ListbookWidgetsPage, BookWidgetsPage)
EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, ListbookWidgetsPage::OnPageChanged) EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, ListbookWidgetsPage::OnPageChanged)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, wxT("Listbook"), IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, "Listbook",
GENERIC_CTRLS | BOOK_CTRLS GENERIC_CTRLS | BOOK_CTRLS
); );
void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event) void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event)
{ {
wxLogMessage(wxT("Listbook page changing from %d to %d (currently %d)."), wxLogMessage("Listbook page changing from %d to %d (currently %d).",
event.GetOldSelection(), event.GetOldSelection(),
event.GetSelection(), event.GetSelection(),
m_book->GetSelection()); m_book->GetSelection());
@@ -662,7 +662,7 @@ void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event)
void ListbookWidgetsPage::OnPageChanged(wxListbookEvent& event) void ListbookWidgetsPage::OnPageChanged(wxListbookEvent& event)
{ {
wxLogMessage(wxT("Listbook page changed from %d to %d (currently %d)."), wxLogMessage("Listbook page changed from %d to %d (currently %d).",
event.GetOldSelection(), event.GetOldSelection(),
event.GetSelection(), event.GetSelection(),
m_book->GetSelection()); m_book->GetSelection());
@@ -719,13 +719,13 @@ wxBEGIN_EVENT_TABLE(ChoicebookWidgetsPage, BookWidgetsPage)
EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, ChoicebookWidgetsPage::OnPageChanged) EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, ChoicebookWidgetsPage::OnPageChanged)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, wxT("Choicebook"), IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, "Choicebook",
GENERIC_CTRLS | BOOK_CTRLS GENERIC_CTRLS | BOOK_CTRLS
); );
void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event) void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event)
{ {
wxLogMessage(wxT("Choicebook page changing from %d to %d (currently %d)."), wxLogMessage("Choicebook page changing from %d to %d (currently %d).",
event.GetOldSelection(), event.GetOldSelection(),
event.GetSelection(), event.GetSelection(),
m_book->GetSelection()); m_book->GetSelection());
@@ -735,7 +735,7 @@ void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event)
void ChoicebookWidgetsPage::OnPageChanged(wxChoicebookEvent& event) void ChoicebookWidgetsPage::OnPageChanged(wxChoicebookEvent& event)
{ {
wxLogMessage(wxT("Choicebook page changed from %d to %d (currently %d)."), wxLogMessage("Choicebook page changed from %d to %d (currently %d).",
event.GetOldSelection(), event.GetOldSelection(),
event.GetSelection(), event.GetSelection(),
m_book->GetSelection()); m_book->GetSelection());

View File

@@ -299,7 +299,7 @@ public:
}; };
IMPLEMENT_WIDGETS_PAGE(ODComboboxWidgetsPage, wxT("OwnerDrawnCombobox"), IMPLEMENT_WIDGETS_PAGE(ODComboboxWidgetsPage, "OwnerDrawnCombobox",
GENERIC_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS GENERIC_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
); );
@@ -332,88 +332,88 @@ void ODComboboxWidgetsPage::CreateContent()
wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL); wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL);
// left pane - style box // left pane - style box
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style");
wxSizer *sizerStyle = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerStyle = new wxStaticBoxSizer(box, wxVERTICAL);
m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Sort items")); m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, "&Sort items");
m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Read only")); m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, "&Read only");
m_chkDclickcycles = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Double-click Cycles")); m_chkDclickcycles = CreateCheckBoxAndAddToSizer(sizerStyle, "&Double-click Cycles");
sizerStyle->AddSpacer(4); sizerStyle->AddSpacer(4);
m_chkBitmapbutton = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Bitmap button")); m_chkBitmapbutton = CreateCheckBoxAndAddToSizer(sizerStyle, "&Bitmap button");
m_chkStdbutton = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("B&lank button background")); m_chkStdbutton = CreateCheckBoxAndAddToSizer(sizerStyle, "B&lank button background");
wxButton *btn = new wxButton(this, ODComboPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, ODComboPage_Reset, "&Reset");
sizerStyle->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 3); sizerStyle->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 3);
sizerLeft->Add(sizerStyle, wxSizerFlags().Expand()); sizerLeft->Add(sizerStyle, wxSizerFlags().Expand());
// left pane - popup adjustment box // left pane - popup adjustment box
box = new wxStaticBox(this, wxID_ANY, wxT("Adjust &popup")); box = new wxStaticBox(this, wxID_ANY, "Adjust &popup");
wxSizer *sizerPopupPos = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerPopupPos = new wxStaticBoxSizer(box, wxVERTICAL);
sizerRow = CreateSizerWithTextAndLabel(wxT("Min. Width:"), sizerRow = CreateSizerWithTextAndLabel("Min. Width:",
ODComboPage_PopupMinWidth, ODComboPage_PopupMinWidth,
&m_textPopupMinWidth); &m_textPopupMinWidth);
m_textPopupMinWidth->SetValue(wxT("-1")); m_textPopupMinWidth->SetValue("-1");
sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndLabel(wxT("Max. Height:"), sizerRow = CreateSizerWithTextAndLabel("Max. Height:",
ODComboPage_PopupHeight, ODComboPage_PopupHeight,
&m_textPopupHeight); &m_textPopupHeight);
m_textPopupHeight->SetValue(wxT("-1")); m_textPopupHeight->SetValue("-1");
sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
m_chkAlignpopupright = CreateCheckBoxAndAddToSizer(sizerPopupPos, wxT("Align Right")); m_chkAlignpopupright = CreateCheckBoxAndAddToSizer(sizerPopupPos, "Align Right");
sizerLeft->Add(sizerPopupPos, wxSizerFlags().Expand().Border(wxTOP, 2)); sizerLeft->Add(sizerPopupPos, wxSizerFlags().Expand().Border(wxTOP, 2));
// left pane - button adjustment box // left pane - button adjustment box
box = new wxStaticBox(this, wxID_ANY, wxT("Adjust &button")); box = new wxStaticBox(this, wxID_ANY, "Adjust &button");
wxSizer *sizerButtonPos = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerButtonPos = new wxStaticBoxSizer(box, wxVERTICAL);
sizerRow = CreateSizerWithTextAndLabel(wxT("Width:"), sizerRow = CreateSizerWithTextAndLabel("Width:",
ODComboPage_ButtonWidth, ODComboPage_ButtonWidth,
&m_textButtonWidth); &m_textButtonWidth);
m_textButtonWidth->SetValue(wxT("-1")); m_textButtonWidth->SetValue("-1");
sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndLabel(wxT("VSpacing:"), sizerRow = CreateSizerWithTextAndLabel("VSpacing:",
ODComboPage_ButtonSpacing, ODComboPage_ButtonSpacing,
&m_textButtonSpacing); &m_textButtonSpacing);
m_textButtonSpacing->SetValue(wxT("0")); m_textButtonSpacing->SetValue("0");
sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndLabel(wxT("Height:"), sizerRow = CreateSizerWithTextAndLabel("Height:",
ODComboPage_ButtonHeight, ODComboPage_ButtonHeight,
&m_textButtonHeight); &m_textButtonHeight);
m_textButtonHeight->SetValue(wxT("-1")); m_textButtonHeight->SetValue("-1");
sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5);
m_chkAlignbutleft = CreateCheckBoxAndAddToSizer(sizerButtonPos, wxT("Align Left")); m_chkAlignbutleft = CreateCheckBoxAndAddToSizer(sizerButtonPos, "Align Left");
sizerLeft->Add(sizerButtonPos, wxSizerFlags().Expand().Border(wxTOP, 2)); sizerLeft->Add(sizerButtonPos, wxSizerFlags().Expand().Border(wxTOP, 2));
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
wxT("&Change combobox contents")); "&Change combobox contents");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
btn = new wxButton(this, ODComboPage_ContainerTests, wxT("Run &tests")); btn = new wxButton(this, ODComboPage_ContainerTests, "Run &tests");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndLabel(wxT("Current selection"), sizerRow = CreateSizerWithTextAndLabel("Current selection",
ODComboPage_CurText, ODComboPage_CurText,
&text); &text);
text->SetEditable(false); text->SetEditable(false);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndLabel(wxT("Insertion Point"), sizerRow = CreateSizerWithTextAndLabel("Insertion Point",
ODComboPage_InsertionPointText, ODComboPage_InsertionPointText,
&text); &text);
text->SetEditable(false); text->SetEditable(false);
@@ -421,39 +421,39 @@ void ODComboboxWidgetsPage::CreateContent()
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Insert, sizerRow = CreateSizerWithTextAndButton(ODComboPage_Insert,
wxT("&Insert this string"), "&Insert this string",
ODComboPage_InsertText, ODComboPage_InsertText,
&m_textInsert); &m_textInsert);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Add, sizerRow = CreateSizerWithTextAndButton(ODComboPage_Add,
wxT("&Add this string"), "&Add this string",
ODComboPage_AddText, ODComboPage_AddText,
&m_textAdd); &m_textAdd);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ODComboPage_AddSeveral, wxT("&Append a few strings")); btn = new wxButton(this, ODComboPage_AddSeveral, "&Append a few strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ODComboPage_AddMany, wxT("Append &many strings")); btn = new wxButton(this, ODComboPage_AddMany, "Append &many strings");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Change, sizerRow = CreateSizerWithTextAndButton(ODComboPage_Change,
wxT("C&hange current"), "C&hange current",
ODComboPage_ChangeText, ODComboPage_ChangeText,
&m_textChange); &m_textChange);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(ODComboPage_Delete, sizerRow = CreateSizerWithTextAndButton(ODComboPage_Delete,
wxT("&Delete this item"), "&Delete this item",
ODComboPage_DeleteText, ODComboPage_DeleteText,
&m_textDelete); &m_textDelete);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ODComboPage_DeleteSel, wxT("Delete &selection")); btn = new wxButton(this, ODComboPage_DeleteSel, "Delete &selection");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, ODComboPage_Clear, wxT("&Clear")); btn = new wxButton(this, ODComboPage_Clear, "&Clear");
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
// right pane // right pane
@@ -569,7 +569,7 @@ void ODComboboxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event))
#ifndef __WXGTK__ #ifndef __WXGTK__
m_combobox->SetString(sel, m_textChange->GetValue()); m_combobox->SetString(sel, m_textChange->GetValue());
#else #else
wxLogMessage(wxT("Not implemented in wxGTK")); wxLogMessage("Not implemented in wxGTK");
#endif #endif
} }
} }
@@ -608,7 +608,7 @@ void ODComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event))
if ( !m_textInsert->IsModified() ) if ( !m_textInsert->IsModified() )
{ {
// update the default string // update the default string
m_textInsert->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); m_textInsert->SetValue(wxString::Format("test item %u", ++s_item));
} }
if (m_combobox->GetSelection() >= 0) if (m_combobox->GetSelection() >= 0)
@@ -623,7 +623,7 @@ void ODComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
if ( !m_textAdd->IsModified() ) if ( !m_textAdd->IsModified() )
{ {
// update the default string // update the default string
m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); m_textAdd->SetValue(wxString::Format("test item %u", ++s_item));
} }
m_combobox->Append(s); m_combobox->Append(s);
@@ -634,15 +634,15 @@ void ODComboboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event))
// "many" means 1000 here // "many" means 1000 here
for ( unsigned int n = 0; n < 1000; n++ ) for ( unsigned int n = 0; n < 1000; n++ )
{ {
m_combobox->Append(wxString::Format(wxT("item #%u"), n)); m_combobox->Append(wxString::Format("item #%u", n));
} }
} }
void ODComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) void ODComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event))
{ {
m_combobox->Append(wxT("First")); m_combobox->Append("First");
m_combobox->Append(wxT("another one")); m_combobox->Append("another one");
m_combobox->Append(wxT("and the last (very very very very very very very very very very long) one")); m_combobox->Append("and the last (very very very very very very very very very very long) one");
} }
void ODComboboxWidgetsPage::OnTextPopupWidth(wxCommandEvent& WXUNUSED(event)) void ODComboboxWidgetsPage::OnTextPopupWidth(wxCommandEvent& WXUNUSED(event))
@@ -698,13 +698,13 @@ void ODComboboxWidgetsPage::OnTextButtonAll(wxCommandEvent& WXUNUSED(event))
void ODComboboxWidgetsPage::OnUpdateUICurText(wxUpdateUIEvent& event) void ODComboboxWidgetsPage::OnUpdateUICurText(wxUpdateUIEvent& event)
{ {
if (m_combobox) if (m_combobox)
event.SetText( wxString::Format(wxT("%d"), m_combobox->GetSelection()) ); event.SetText( wxString::Format("%d", m_combobox->GetSelection()) );
} }
void ODComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event) void ODComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event)
{ {
if (m_combobox) if (m_combobox)
event.SetText( wxString::Format(wxT("%ld"), m_combobox->GetInsertionPoint()) ); event.SetText( wxString::Format("%ld", m_combobox->GetInsertionPoint()) );
} }
void ODComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event) void ODComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
@@ -761,26 +761,26 @@ void ODComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
wxString s = event.GetString(); wxString s = event.GetString();
wxASSERT_MSG( s == m_combobox->GetValue(), wxASSERT_MSG( s == m_combobox->GetValue(),
wxT("event and combobox values should be the same") ); "event and combobox values should be the same" );
if (event.GetEventType() == wxEVT_TEXT_ENTER) if (event.GetEventType() == wxEVT_TEXT_ENTER)
{ {
wxLogMessage(wxT("OwnerDrawnCombobox enter pressed (now '%s')"), s.c_str()); wxLogMessage("OwnerDrawnCombobox enter pressed (now '%s')", s.c_str());
} }
else else
{ {
wxLogMessage(wxT("OwnerDrawnCombobox text changed (now '%s')"), s.c_str()); wxLogMessage("OwnerDrawnCombobox text changed (now '%s')", s.c_str());
} }
} }
void ODComboboxWidgetsPage::OnComboBox(wxCommandEvent& event) void ODComboboxWidgetsPage::OnComboBox(wxCommandEvent& event)
{ {
long sel = event.GetInt(); long sel = event.GetInt();
m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel)); m_textDelete->SetValue(wxString::Format("%ld", sel));
wxLogMessage(wxT("OwnerDrawnCombobox item %ld selected"), sel); wxLogMessage("OwnerDrawnCombobox item %ld selected", sel);
wxLogMessage(wxT("OwnerDrawnCombobox GetValue(): %s"), m_combobox->GetValue().c_str() ); wxLogMessage("OwnerDrawnCombobox GetValue(): %s", m_combobox->GetValue().c_str() );
} }
void ODComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event) void ODComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event)
@@ -849,12 +849,12 @@ wxBitmap ODComboboxWidgetsPage::CreateBitmap(const wxColour& colour)
void ODComboboxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event)) void ODComboboxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Combobox dropped down")); wxLogMessage("Combobox dropped down");
} }
void ODComboboxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event)) void ODComboboxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Combobox closed up")); wxLogMessage("Combobox closed up");
} }
#endif //wxUSE_ODCOMBOBOX #endif //wxUSE_ODCOMBOBOX

View File

@@ -180,7 +180,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, wxT("Radio"), IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, "Radio",
FAMILY_CTRLS | WITH_ITEMS_CTRLS FAMILY_CTRLS | WITH_ITEMS_CTRLS
); );
@@ -207,7 +207,7 @@ void RadioWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
@@ -219,12 +219,12 @@ void RadioWidgetsPage::CreateContent()
static const wxString layoutDir[] = static const wxString layoutDir[] =
{ {
wxT("default"), "default",
wxT("left to right"), "left to right",
wxT("top to bottom") "top to bottom"
}; };
m_radioDir = new wxRadioBox(this, wxID_ANY, wxT("Numbering:"), m_radioDir = new wxRadioBox(this, wxID_ANY, "Numbering:",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(layoutDir), layoutDir, WXSIZEOF(layoutDir), layoutDir,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
@@ -236,57 +236,57 @@ void RadioWidgetsPage::CreateContent()
#endif // wxRA_LEFTTORIGHT #endif // wxRA_LEFTTORIGHT
wxSizer *sizerRow; wxSizer *sizerRow;
sizerRow = CreateSizerWithTextAndLabel(wxT("&Major dimension:"), sizerRow = CreateSizerWithTextAndLabel("&Major dimension:",
wxID_ANY, wxID_ANY,
&m_textMajorDim); &m_textMajorDim);
sizerLeft->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerLeft->Add(sizerRow, 0, wxGROW | wxALL, 5);
sizerRow = CreateSizerWithTextAndLabel(wxT("&Number of buttons:"), sizerRow = CreateSizerWithTextAndLabel("&Number of buttons:",
wxID_ANY, wxID_ANY,
&m_textNumBtns); &m_textNumBtns);
sizerLeft->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerLeft->Add(sizerRow, 0, wxGROW | wxALL, 5);
wxButton *btn; wxButton *btn;
btn = new wxButton(this, RadioPage_Update, wxT("&Update")); btn = new wxButton(this, RadioPage_Update, "&Update");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5);
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
btn = new wxButton(this, RadioPage_Reset, wxT("&Reset")); btn = new wxButton(this, RadioPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Change parameters")); wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Change parameters");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
sizerRow = CreateSizerWithTextAndLabel(wxT("Current selection:"), sizerRow = CreateSizerWithTextAndLabel("Current selection:",
wxID_ANY, wxID_ANY,
&m_textCurSel); &m_textCurSel);
sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5);
sizerRow = CreateSizerWithTextAndButton(RadioPage_Selection, sizerRow = CreateSizerWithTextAndButton(RadioPage_Selection,
wxT("&Change selection:"), "&Change selection:",
wxID_ANY, wxID_ANY,
&m_textSel); &m_textSel);
sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5);
sizerRow = CreateSizerWithTextAndButton(RadioPage_Label, sizerRow = CreateSizerWithTextAndButton(RadioPage_Label,
wxT("&Label for box:"), "&Label for box:",
wxID_ANY, wxID_ANY,
&m_textLabel); &m_textLabel);
sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5);
sizerRow = CreateSizerWithTextAndButton(RadioPage_LabelBtn, sizerRow = CreateSizerWithTextAndButton(RadioPage_LabelBtn,
wxT("&Label for buttons:"), "&Label for buttons:",
wxID_ANY, wxID_ANY,
&m_textLabelBtns); &m_textLabelBtns);
sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5);
m_chkEnableItem = CreateCheckBoxAndAddToSizer(sizerMiddle, m_chkEnableItem = CreateCheckBoxAndAddToSizer(sizerMiddle,
wxT("Disable &2nd item"), "Disable &2nd item",
RadioPage_EnableItem); RadioPage_EnableItem);
m_chkShowItem = CreateCheckBoxAndAddToSizer(sizerMiddle, m_chkShowItem = CreateCheckBoxAndAddToSizer(sizerMiddle,
wxT("Hide 2nd &item"), "Hide 2nd &item",
RadioPage_ShowItem); RadioPage_ShowItem);
// right pane // right pane
@@ -312,10 +312,10 @@ void RadioWidgetsPage::CreateContent()
void RadioWidgetsPage::Reset() void RadioWidgetsPage::Reset()
{ {
m_textMajorDim->SetValue(wxString::Format(wxT("%u"), DEFAULT_MAJOR_DIM)); m_textMajorDim->SetValue(wxString::Format("%u", DEFAULT_MAJOR_DIM));
m_textNumBtns->SetValue(wxString::Format(wxT("%u"), DEFAULT_NUM_ENTRIES)); m_textNumBtns->SetValue(wxString::Format("%u", DEFAULT_NUM_ENTRIES));
m_textLabel->SetValue(wxT("I'm a radiobox")); m_textLabel->SetValue("I'm a radiobox");
m_textLabelBtns->SetValue(wxT("item")); m_textLabelBtns->SetValue("item");
m_chkSpecifyRows->SetValue(false); m_chkSpecifyRows->SetValue(false);
m_chkEnableItem->SetValue(true); m_chkEnableItem->SetValue(true);
@@ -342,7 +342,7 @@ void RadioWidgetsPage::CreateRadio()
unsigned long count; unsigned long count;
if ( !m_textNumBtns->GetValue().ToULong(&count) ) if ( !m_textNumBtns->GetValue().ToULong(&count) )
{ {
wxLogWarning(wxT("Should have a valid number for number of items.")); wxLogWarning("Should have a valid number for number of items.");
// fall back to default // fall back to default
count = DEFAULT_NUM_ENTRIES; count = DEFAULT_NUM_ENTRIES;
@@ -351,7 +351,7 @@ void RadioWidgetsPage::CreateRadio()
unsigned long majorDim; unsigned long majorDim;
if ( !m_textMajorDim->GetValue().ToULong(&majorDim) ) if ( !m_textMajorDim->GetValue().ToULong(&majorDim) )
{ {
wxLogWarning(wxT("Should have a valid major dimension number.")); wxLogWarning("Should have a valid major dimension number.");
// fall back to default // fall back to default
majorDim = DEFAULT_MAJOR_DIM; majorDim = DEFAULT_MAJOR_DIM;
@@ -362,7 +362,7 @@ void RadioWidgetsPage::CreateRadio()
wxString labelBtn = m_textLabelBtns->GetValue(); wxString labelBtn = m_textLabelBtns->GetValue();
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
{ {
items[n] = wxString::Format(wxT("%s %lu"), items[n] = wxString::Format("%s %lu",
labelBtn.c_str(), (unsigned long)n + 1); labelBtn.c_str(), (unsigned long)n + 1);
} }
@@ -375,7 +375,7 @@ void RadioWidgetsPage::CreateRadio()
switch ( m_radioDir->GetSelection() ) switch ( m_radioDir->GetSelection() )
{ {
default: default:
wxFAIL_MSG( wxT("unexpected wxRadioBox layout direction") ); wxFAIL_MSG( "unexpected wxRadioBox layout direction" );
// fall through // fall through
case RadioDir_Default: case RadioDir_Default:
@@ -434,12 +434,12 @@ void RadioWidgetsPage::OnRadioBox(wxCommandEvent& event)
int event_sel = event.GetSelection(); int event_sel = event.GetSelection();
wxUnusedVar(event_sel); wxUnusedVar(event_sel);
wxLogMessage(wxT("Radiobox selection changed, now %d"), sel); wxLogMessage("Radiobox selection changed, now %d", sel);
wxASSERT_MSG( sel == event_sel, wxASSERT_MSG( sel == event_sel,
wxT("selection should be the same in event and radiobox") ); "selection should be the same in event and radiobox" );
m_textCurSel->SetValue(wxString::Format(wxT("%d"), sel)); m_textCurSel->SetValue(wxString::Format("%d", sel));
} }
void RadioWidgetsPage::OnButtonRecreate(wxCommandEvent& WXUNUSED(event)) void RadioWidgetsPage::OnButtonRecreate(wxCommandEvent& WXUNUSED(event))
@@ -458,7 +458,7 @@ void RadioWidgetsPage::OnButtonSelection(wxCommandEvent& WXUNUSED(event))
if ( !m_textSel->GetValue().ToULong(&sel) || if ( !m_textSel->GetValue().ToULong(&sel) ||
(sel >= (size_t)m_radio->GetCount()) ) (sel >= (size_t)m_radio->GetCount()) )
{ {
wxLogWarning(wxT("Invalid number specified as new selection.")); wxLogWarning("Invalid number specified as new selection.");
} }
else else
{ {
@@ -516,14 +516,14 @@ void RadioWidgetsPage::OnUpdateUIReset(wxUpdateUIEvent& event)
void RadioWidgetsPage::OnUpdateUIEnableItem(wxUpdateUIEvent& event) void RadioWidgetsPage::OnUpdateUIEnableItem(wxUpdateUIEvent& event)
{ {
event.SetText(m_radio->IsItemEnabled(TEST_BUTTON) ? wxT("Disable &2nd item") event.SetText(m_radio->IsItemEnabled(TEST_BUTTON) ? "Disable &2nd item"
: wxT("Enable &2nd item")); : "Enable &2nd item");
} }
void RadioWidgetsPage::OnUpdateUIShowItem(wxUpdateUIEvent& event) void RadioWidgetsPage::OnUpdateUIShowItem(wxUpdateUIEvent& event)
{ {
event.SetText(m_radio->IsItemShown(TEST_BUTTON) ? wxT("Hide 2nd &item") event.SetText(m_radio->IsItemShown(TEST_BUTTON) ? "Hide 2nd &item"
: wxT("Show 2nd &item")); : "Show 2nd &item");
} }
#endif // wxUSE_RADIOBOX #endif // wxUSE_RADIOBOX

View File

@@ -130,7 +130,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS GENERIC_CTRLS #define FAMILY_CTRLS GENERIC_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(SearchCtrlWidgetsPage, wxT("SearchCtrl"), IMPLEMENT_WIDGETS_PAGE(SearchCtrlWidgetsPage, "SearchCtrl",
FAMILY_CTRLS | EDITABLE_CTRLS | ALL_CTRLS); FAMILY_CTRLS | EDITABLE_CTRLS | ALL_CTRLS);
SearchCtrlWidgetsPage::SearchCtrlWidgetsPage(WidgetsBookCtrl *book, SearchCtrlWidgetsPage::SearchCtrlWidgetsPage(WidgetsBookCtrl *book,
@@ -147,12 +147,12 @@ void SearchCtrlWidgetsPage::CreateContent()
wxSizer* box = new wxStaticBoxSizer( wxSizer* box = new wxStaticBoxSizer(
new wxStaticBox(this, -1, wxT("Options")), new wxStaticBox(this, -1, "Options"),
wxVERTICAL); wxVERTICAL);
m_searchBtnCheck = new wxCheckBox(this, ID_SEARCH_CB, wxT("Search button")); m_searchBtnCheck = new wxCheckBox(this, ID_SEARCH_CB, "Search button");
m_cancelBtnCheck = new wxCheckBox(this, ID_CANCEL_CB, wxT("Cancel button")); m_cancelBtnCheck = new wxCheckBox(this, ID_CANCEL_CB, "Cancel button");
m_menuBtnCheck = new wxCheckBox(this, ID_MENU_CB, wxT("Search menu")); m_menuBtnCheck = new wxCheckBox(this, ID_MENU_CB, "Search menu");
m_searchBtnCheck->SetValue(true); m_searchBtnCheck->SetValue(true);
@@ -191,12 +191,12 @@ wxMenu* SearchCtrlWidgetsPage::CreateTestMenu()
{ {
wxMenu* menu = new wxMenu; wxMenu* menu = new wxMenu;
const int SEARCH_MENU_SIZE = 5; const int SEARCH_MENU_SIZE = 5;
wxMenuItem* menuItem = menu->Append(wxID_ANY, wxT("Recent Searches"), wxT(""), wxITEM_NORMAL); wxMenuItem* menuItem = menu->Append(wxID_ANY, "Recent Searches", "", wxITEM_NORMAL);
menuItem->Enable(false); menuItem->Enable(false);
for ( int i = 0; i < SEARCH_MENU_SIZE; i++ ) for ( int i = 0; i < SEARCH_MENU_SIZE; i++ )
{ {
wxString itemText = wxString::Format(wxT("item %i"),i); wxString itemText = wxString::Format("item %i",i);
wxString tipText = wxString::Format(wxT("tip %i"),i); wxString tipText = wxString::Format("tip %i",i);
menu->Append(ID_SEARCHMENU+i, itemText, tipText, wxITEM_NORMAL); menu->Append(ID_SEARCHMENU+i, itemText, tipText, wxITEM_NORMAL);
} }
return menu; return menu;

View File

@@ -226,7 +226,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, wxT("Slider"), FAMILY_CTRLS ); IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, "Slider", FAMILY_CTRLS );
SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book, SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist) wxImageList *imaglist)
@@ -253,43 +253,43 @@ void SliderWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
m_chkInverse = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Inverse")); m_chkInverse = CreateCheckBoxAndAddToSizer(sizerLeft, "&Inverse");
m_chkTicks = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show &ticks")); m_chkTicks = CreateCheckBoxAndAddToSizer(sizerLeft, "Show &ticks");
m_chkMinMaxLabels = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show min/max &labels")); m_chkMinMaxLabels = CreateCheckBoxAndAddToSizer(sizerLeft, "Show min/max &labels");
m_chkValueLabel = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show &value label")); m_chkValueLabel = CreateCheckBoxAndAddToSizer(sizerLeft, "Show &value label");
static const wxString sides[] = static const wxString sides[] =
{ {
wxT("default"), "default",
wxT("top"), "top",
wxT("bottom"), "bottom",
wxT("left"), "left",
wxT("right"), "right",
}; };
m_radioSides = new wxRadioBox(this, SliderPage_RadioSides, wxT("&Label position"), m_radioSides = new wxRadioBox(this, SliderPage_RadioSides, "&Label position",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(sides), sides, WXSIZEOF(sides), sides,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
sizerLeft->Add(m_radioSides, 0, wxGROW | wxALL, 5); sizerLeft->Add(m_radioSides, 0, wxGROW | wxALL, 5);
m_chkBothSides = CreateCheckBoxAndAddToSizer m_chkBothSides = CreateCheckBoxAndAddToSizer
(sizerLeft, wxT("&Both sides"), SliderPage_BothSides); (sizerLeft, "&Both sides", SliderPage_BothSides);
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
m_chkBothSides->SetToolTip( wxT("\"Both sides\" is only supported \nin Universal") ); m_chkBothSides->SetToolTip("\"Both sides\" is only supported \nin Universal");
#endif // wxUSE_TOOLTIPS #endif // wxUSE_TOOLTIPS
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
wxButton *btn = new wxButton(this, SliderPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, SliderPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Change slider value")); wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Change slider value");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxTextCtrl *text; wxTextCtrl *text;
wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Current value"), wxSizer *sizerRow = CreateSizerWithTextAndLabel("Current value",
SliderPage_CurValueText, SliderPage_CurValueText,
&text); &text);
text->SetEditable(false); text->SetEditable(false);
@@ -297,49 +297,49 @@ void SliderWidgetsPage::CreateContent()
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetValue, sizerRow = CreateSizerWithTextAndButton(SliderPage_SetValue,
wxT("Set &value"), "Set &value",
SliderPage_ValueText, SliderPage_ValueText,
&m_textValue); &m_textValue);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetMinAndMax, sizerRow = CreateSizerWithTextAndButton(SliderPage_SetMinAndMax,
wxT("&Min and max"), "&Min and max",
SliderPage_MinText, SliderPage_MinText,
&m_textMin); &m_textMin);
m_textMax = new wxTextCtrl(this, SliderPage_MaxText, wxEmptyString); m_textMax = new wxTextCtrl(this, SliderPage_MaxText, wxEmptyString);
sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5); sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
m_textMin->SetValue( wxString::Format(wxT("%d"), m_min) ); m_textMin->SetValue( wxString::Format("%d", m_min) );
m_textMax->SetValue( wxString::Format(wxT("%d"), m_max) ); m_textMax->SetValue( wxString::Format("%d", m_max) );
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetLineSize, sizerRow = CreateSizerWithTextAndButton(SliderPage_SetLineSize,
wxT("Li&ne size"), "Li&ne size",
SliderPage_LineSizeText, SliderPage_LineSizeText,
&m_textLineSize); &m_textLineSize);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetPageSize, sizerRow = CreateSizerWithTextAndButton(SliderPage_SetPageSize,
wxT("P&age size"), "P&age size",
SliderPage_PageSizeText, SliderPage_PageSizeText,
&m_textPageSize); &m_textPageSize);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetTickFreq, sizerRow = CreateSizerWithTextAndButton(SliderPage_SetTickFreq,
wxT("Tick &frequency"), "Tick &frequency",
SliderPage_TickFreqText, SliderPage_TickFreqText,
&m_textTickFreq); &m_textTickFreq);
m_textTickFreq->SetValue(wxT("10")); m_textTickFreq->SetValue("10");
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetThumbLen, sizerRow = CreateSizerWithTextAndButton(SliderPage_SetThumbLen,
wxT("Thumb &length"), "Thumb &length",
SliderPage_ThumbLenText, SliderPage_ThumbLenText,
&m_textThumbLen); &m_textThumbLen);
@@ -353,8 +353,8 @@ void SliderWidgetsPage::CreateContent()
Reset(); Reset();
CreateSlider(); CreateSlider();
m_textLineSize->SetValue(wxString::Format(wxT("%d"), m_slider->GetLineSize())); m_textLineSize->SetValue(wxString::Format("%d", m_slider->GetLineSize()));
m_textPageSize->SetValue(wxString::Format(wxT("%d"), m_slider->GetPageSize())); m_textPageSize->SetValue(wxString::Format("%d", m_slider->GetPageSize()));
// the 3 panes panes compose the window // the 3 panes panes compose the window
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10); sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
@@ -429,7 +429,7 @@ void SliderWidgetsPage::CreateSlider()
break; break;
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
} }
@@ -488,7 +488,7 @@ void SliderWidgetsPage::DoSetLineSize()
long lineSize; long lineSize;
if ( !m_textLineSize->GetValue().ToLong(&lineSize) ) if ( !m_textLineSize->GetValue().ToLong(&lineSize) )
{ {
wxLogWarning(wxT("Invalid slider line size")); wxLogWarning("Invalid slider line size");
return; return;
} }
@@ -497,7 +497,7 @@ void SliderWidgetsPage::DoSetLineSize()
if ( m_slider->GetLineSize() != lineSize ) if ( m_slider->GetLineSize() != lineSize )
{ {
wxLogWarning(wxT("Invalid line size in slider.")); wxLogWarning("Invalid line size in slider.");
} }
} }
@@ -506,7 +506,7 @@ void SliderWidgetsPage::DoSetPageSize()
long pageSize; long pageSize;
if ( !m_textPageSize->GetValue().ToLong(&pageSize) ) if ( !m_textPageSize->GetValue().ToLong(&pageSize) )
{ {
wxLogWarning(wxT("Invalid slider page size")); wxLogWarning("Invalid slider page size");
return; return;
} }
@@ -515,7 +515,7 @@ void SliderWidgetsPage::DoSetPageSize()
if ( m_slider->GetPageSize() != pageSize ) if ( m_slider->GetPageSize() != pageSize )
{ {
wxLogWarning(wxT("Invalid page size in slider.")); wxLogWarning("Invalid page size in slider.");
} }
} }
@@ -524,7 +524,7 @@ void SliderWidgetsPage::DoSetTickFreq()
long freq; long freq;
if ( !m_textTickFreq->GetValue().ToLong(&freq) ) if ( !m_textTickFreq->GetValue().ToLong(&freq) )
{ {
wxLogWarning(wxT("Invalid slider tick frequency")); wxLogWarning("Invalid slider tick frequency");
return; return;
} }
@@ -537,7 +537,7 @@ void SliderWidgetsPage::DoSetThumbLen()
long len; long len;
if ( !m_textThumbLen->GetValue().ToLong(&len) ) if ( !m_textThumbLen->GetValue().ToLong(&len) )
{ {
wxLogWarning(wxT("Invalid slider thumb length")); wxLogWarning("Invalid slider thumb length");
return; return;
} }
@@ -584,7 +584,7 @@ void SliderWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event))
!m_textMax->GetValue().ToLong(&maxNew) || !m_textMax->GetValue().ToLong(&maxNew) ||
minNew >= maxNew ) minNew >= maxNew )
{ {
wxLogWarning(wxT("Invalid min/max values for the slider.")); wxLogWarning("Invalid min/max values for the slider.");
return; return;
} }
@@ -597,7 +597,7 @@ void SliderWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event))
if ( m_slider->GetMin() != m_min || if ( m_slider->GetMin() != m_min ||
m_slider->GetMax() != m_max ) m_slider->GetMax() != m_max )
{ {
wxLogWarning(wxT("Invalid range in slider.")); wxLogWarning("Invalid range in slider.");
} }
} }
@@ -606,7 +606,7 @@ void SliderWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
long val; long val;
if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) ) if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) )
{ {
wxLogWarning(wxT("Invalid slider value.")); wxLogWarning("Invalid slider value.");
return; return;
} }
@@ -673,7 +673,7 @@ void SliderWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
void SliderWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event) void SliderWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
{ {
event.SetText( wxString::Format(wxT("%d"), m_slider->GetValue()) ); event.SetText( wxString::Format("%d", m_slider->GetValue()) );
} }
void SliderWidgetsPage::OnUpdateUIRadioSides(wxUpdateUIEvent& event) void SliderWidgetsPage::OnUpdateUIRadioSides(wxUpdateUIEvent& event)
@@ -693,7 +693,7 @@ void SliderWidgetsPage::OnUpdateUIBothSides(wxUpdateUIEvent& event)
void SliderWidgetsPage::OnSlider(wxScrollEvent& event) void SliderWidgetsPage::OnSlider(wxScrollEvent& event)
{ {
wxASSERT_MSG( event.GetInt() == m_slider->GetValue(), wxASSERT_MSG( event.GetInt() == m_slider->GetValue(),
wxT("slider value should be the same") ); "slider value should be the same" );
wxEventType eventType = event.GetEventType(); wxEventType eventType = event.GetEventType();
@@ -702,17 +702,17 @@ void SliderWidgetsPage::OnSlider(wxScrollEvent& event)
include/wx/event.h include/wx/event.h
(section "wxScrollBar and wxSlider event identifiers") (section "wxScrollBar and wxSlider event identifiers")
*/ */
static const wxChar *eventNames[] = static const wxString eventNames[] =
{ {
wxT("wxEVT_SCROLL_TOP"), "wxEVT_SCROLL_TOP",
wxT("wxEVT_SCROLL_BOTTOM"), "wxEVT_SCROLL_BOTTOM",
wxT("wxEVT_SCROLL_LINEUP"), "wxEVT_SCROLL_LINEUP",
wxT("wxEVT_SCROLL_LINEDOWN"), "wxEVT_SCROLL_LINEDOWN",
wxT("wxEVT_SCROLL_PAGEUP"), "wxEVT_SCROLL_PAGEUP",
wxT("wxEVT_SCROLL_PAGEDOWN"), "wxEVT_SCROLL_PAGEDOWN",
wxT("wxEVT_SCROLL_THUMBTRACK"), "wxEVT_SCROLL_THUMBTRACK",
wxT("wxEVT_SCROLL_THUMBRELEASE"), "wxEVT_SCROLL_THUMBRELEASE",
wxT("wxEVT_SCROLL_CHANGED") "wxEVT_SCROLL_CHANGED"
}; };
int index = eventType - wxEVT_SCROLL_TOP; int index = eventType - wxEVT_SCROLL_TOP;
@@ -722,12 +722,12 @@ void SliderWidgetsPage::OnSlider(wxScrollEvent& event)
should be added to the above eventNames array. should be added to the above eventNames array.
*/ */
wxASSERT_MSG(index >= 0 && (size_t)index < WXSIZEOF(eventNames), wxASSERT_MSG(index >= 0 && (size_t)index < WXSIZEOF(eventNames),
wxT("Unknown slider event") ); "Unknown slider event" );
static int s_numSliderEvents = 0; static int s_numSliderEvents = 0;
wxLogMessage(wxT("Slider event #%d: %s (pos = %d, int value = %d)"), wxLogMessage("Slider event #%d: %s (pos = %d, int value = %d)",
s_numSliderEvents++, s_numSliderEvents++,
eventNames[index], eventNames[index],
event.GetPosition(), event.GetPosition(),

View File

@@ -211,7 +211,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, wxT("Spin"), IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, "Spin",
FAMILY_CTRLS | EDITABLE_CTRLS FAMILY_CTRLS | EDITABLE_CTRLS
); );
@@ -245,25 +245,25 @@ void SpinBtnWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Vertical")); m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical");
m_chkArrowKeys = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Arrow Keys")); m_chkArrowKeys = CreateCheckBoxAndAddToSizer(sizerLeft, "&Arrow Keys");
m_chkWrap = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Wrap")); m_chkWrap = CreateCheckBoxAndAddToSizer(sizerLeft, "&Wrap");
m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeft, m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeft,
wxT("Process &Enter")); "Process &Enter");
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
static const wxString halign[] = static const wxString halign[] =
{ {
wxT("left"), "left",
wxT("centre"), "centre",
wxT("right"), "right",
}; };
m_radioAlign = new wxRadioBox(this, wxID_ANY, wxT("&Text alignment"), m_radioAlign = new wxRadioBox(this, wxID_ANY, "&Text alignment",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(halign), halign, 1); WXSIZEOF(halign), halign, 1);
@@ -271,17 +271,17 @@ void SpinBtnWidgetsPage::CreateContent()
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
wxButton *btn = new wxButton(this, SpinBtnPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, SpinBtnPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
wxT("&Change spinbtn value")); "&Change spinbtn value");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxTextCtrl *text; wxTextCtrl *text;
wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Current value"), wxSizer *sizerRow = CreateSizerWithTextAndLabel("Current value",
SpinBtnPage_CurValueText, SpinBtnPage_CurValueText,
&text); &text);
text->SetEditable(false); text->SetEditable(false);
@@ -289,21 +289,21 @@ void SpinBtnWidgetsPage::CreateContent()
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetValue, sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetValue,
wxT("Set &value"), "Set &value",
SpinBtnPage_ValueText, SpinBtnPage_ValueText,
&m_textValue); &m_textValue);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetMinAndMax, sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetMinAndMax,
wxT("&Min and max"), "&Min and max",
SpinBtnPage_MinText, SpinBtnPage_MinText,
&m_textMin); &m_textMin);
m_textMax = new wxTextCtrl(this, SpinBtnPage_MaxText, wxEmptyString); m_textMax = new wxTextCtrl(this, SpinBtnPage_MaxText, wxEmptyString);
sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5); sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
m_textMin->SetValue( wxString::Format(wxT("%d"), m_min) ); m_textMin->SetValue( wxString::Format("%d", m_min) );
m_textMax->SetValue( wxString::Format(wxT("%d"), m_max) ); m_textMax->SetValue( wxString::Format("%d", m_max) );
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
@@ -367,7 +367,7 @@ void SpinBtnWidgetsPage::CreateSpin()
switch ( m_radioAlign->GetSelection() ) switch ( m_radioAlign->GetSelection() )
{ {
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
case Align_Left: case Align_Left:
@@ -403,28 +403,28 @@ void SpinBtnWidgetsPage::CreateSpin()
m_spinbtn->SetRange(m_min, m_max); m_spinbtn->SetRange(m_min, m_max);
m_spinctrl = new wxSpinCtrl(this, SpinBtnPage_SpinCtrl, m_spinctrl = new wxSpinCtrl(this, SpinBtnPage_SpinCtrl,
wxString::Format(wxT("%d"), val), wxString::Format("%d", val),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
flags | textFlags, flags | textFlags,
m_min, m_max, val); m_min, m_max, val);
m_spinctrldbl = new wxSpinCtrlDouble(this, SpinBtnPage_SpinCtrlDouble, m_spinctrldbl = new wxSpinCtrlDouble(this, SpinBtnPage_SpinCtrlDouble,
wxString::Format(wxT("%d"), val), wxString::Format("%d", val),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
flags | textFlags, flags | textFlags,
m_min, m_max, val, 0.1); m_min, m_max, val, 0.1);
// Add spacers, labels and spin controls to the sizer. // Add spacers, labels and spin controls to the sizer.
m_sizerSpin->Add(0, 0, 1); m_sizerSpin->Add(0, 0, 1);
m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, wxT("wxSpinButton")), m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, "wxSpinButton"),
0, wxALIGN_CENTRE | wxALL, 5); 0, wxALIGN_CENTRE | wxALL, 5);
m_sizerSpin->Add(m_spinbtn, 0, wxALIGN_CENTRE | wxALL, 5); m_sizerSpin->Add(m_spinbtn, 0, wxALIGN_CENTRE | wxALL, 5);
m_sizerSpin->Add(0, 0, 1); m_sizerSpin->Add(0, 0, 1);
m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, wxT("wxSpinCtrl")), m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, "wxSpinCtrl"),
0, wxALIGN_CENTRE | wxALL, 5); 0, wxALIGN_CENTRE | wxALL, 5);
m_sizerSpin->Add(m_spinctrl, 0, wxALIGN_CENTRE | wxALL, 5); m_sizerSpin->Add(m_spinctrl, 0, wxALIGN_CENTRE | wxALL, 5);
m_sizerSpin->Add(0, 0, 1); m_sizerSpin->Add(0, 0, 1);
m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, wxT("wxSpinCtrlDouble")), m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, "wxSpinCtrlDouble"),
0, wxALIGN_CENTRE | wxALL, 5); 0, wxALIGN_CENTRE | wxALL, 5);
m_sizerSpin->Add(m_spinctrldbl, 0, wxALIGN_CENTRE | wxALL, 5); m_sizerSpin->Add(m_spinctrldbl, 0, wxALIGN_CENTRE | wxALL, 5);
m_sizerSpin->Add(0, 0, 1); m_sizerSpin->Add(0, 0, 1);
@@ -451,7 +451,7 @@ void SpinBtnWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event))
!m_textMax->GetValue().ToLong(&maxNew) || !m_textMax->GetValue().ToLong(&maxNew) ||
minNew > maxNew ) minNew > maxNew )
{ {
wxLogWarning(wxT("Invalid min/max values for the spinbtn.")); wxLogWarning("Invalid min/max values for the spinbtn.");
return; return;
} }
@@ -498,7 +498,7 @@ void SpinBtnWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
long val; long val;
if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) ) if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) )
{ {
wxLogWarning(wxT("Invalid spinbtn value.")); wxLogWarning("Invalid spinbtn value.");
return; return;
} }
@@ -542,7 +542,7 @@ void SpinBtnWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
void SpinBtnWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event) void SpinBtnWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
{ {
event.SetText( wxString::Format(wxT("%d"), m_spinbtn->GetValue())); event.SetText( wxString::Format("%d", m_spinbtn->GetValue()));
} }
void SpinBtnWidgetsPage::OnSpinBtn(wxSpinEvent& event) void SpinBtnWidgetsPage::OnSpinBtn(wxSpinEvent& event)
@@ -550,20 +550,20 @@ void SpinBtnWidgetsPage::OnSpinBtn(wxSpinEvent& event)
int value = event.GetInt(); int value = event.GetInt();
wxASSERT_MSG( value == m_spinbtn->GetValue(), wxASSERT_MSG( value == m_spinbtn->GetValue(),
wxT("spinbtn value should be the same") ); "spinbtn value should be the same" );
wxLogMessage(wxT("Spin button value changed, now %d"), value); wxLogMessage("Spin button value changed, now %d", value);
} }
void SpinBtnWidgetsPage::OnSpinBtnUp(wxSpinEvent& event) void SpinBtnWidgetsPage::OnSpinBtnUp(wxSpinEvent& event)
{ {
wxLogMessage( wxT("Spin button value incremented, will be %d (was %d)"), wxLogMessage( "Spin button value incremented, will be %d (was %d)",
event.GetInt(), m_spinbtn->GetValue() ); event.GetInt(), m_spinbtn->GetValue() );
} }
void SpinBtnWidgetsPage::OnSpinBtnDown(wxSpinEvent& event) void SpinBtnWidgetsPage::OnSpinBtnDown(wxSpinEvent& event)
{ {
wxLogMessage( wxT("Spin button value decremented, will be %d (was %d)"), wxLogMessage( "Spin button value decremented, will be %d (was %d)",
event.GetInt(), m_spinbtn->GetValue() ); event.GetInt(), m_spinbtn->GetValue() );
} }
@@ -572,21 +572,21 @@ void SpinBtnWidgetsPage::OnSpinCtrl(wxSpinEvent& event)
int value = event.GetInt(); int value = event.GetInt();
wxASSERT_MSG( value == m_spinctrl->GetValue(), wxASSERT_MSG( value == m_spinctrl->GetValue(),
wxT("spinctrl value should be the same") ); "spinctrl value should be the same" );
wxLogMessage(wxT("Spin control value changed, now %d"), value); wxLogMessage("Spin control value changed, now %d", value);
} }
void SpinBtnWidgetsPage::OnSpinCtrlDouble(wxSpinDoubleEvent& event) void SpinBtnWidgetsPage::OnSpinCtrlDouble(wxSpinDoubleEvent& event)
{ {
double value = event.GetValue(); double value = event.GetValue();
wxLogMessage(wxT("Spin control value changed, now %g"), value); wxLogMessage("Spin control value changed, now %g", value);
} }
void SpinBtnWidgetsPage::OnSpinText(wxCommandEvent& event) void SpinBtnWidgetsPage::OnSpinText(wxCommandEvent& event)
{ {
wxLogMessage(wxT("Text changed in spin control, now \"%s\""), wxLogMessage("Text changed in spin control, now \"%s\"",
event.GetString().c_str()); event.GetString().c_str());
} }

View File

@@ -62,7 +62,7 @@ private:
void OnMouseEvent(wxMouseEvent& WXUNUSED(event)) void OnMouseEvent(wxMouseEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("wxStaticBitmap clicked.")); wxLogMessage("wxStaticBitmap clicked.");
} }
wxStaticBitmapBase *m_statbmp; wxStaticBitmapBase *m_statbmp;
@@ -74,7 +74,7 @@ private:
DECLARE_WIDGETS_PAGE(StatBmpWidgetsPage) DECLARE_WIDGETS_PAGE(StatBmpWidgetsPage)
}; };
IMPLEMENT_WIDGETS_PAGE(StatBmpWidgetsPage, wxT("StaticBitmap"), IMPLEMENT_WIDGETS_PAGE(StatBmpWidgetsPage, "StaticBitmap",
ALL_CTRLS); ALL_CTRLS);
void StatBmpWidgetsPage::CreateContent() void StatBmpWidgetsPage::CreateContent()
@@ -92,12 +92,12 @@ void StatBmpWidgetsPage::CreateContent()
wxString testImage; wxString testImage;
#if wxUSE_LIBPNG #if wxUSE_LIBPNG
wxPathList pathlist; wxPathList pathlist;
pathlist.Add(wxT(".")); pathlist.Add(".");
pathlist.Add(wxT("..")); pathlist.Add("..");
pathlist.Add(wxT("../image")); pathlist.Add("../image");
pathlist.Add(wxT("../../../samples/image")); pathlist.Add("../../../samples/image");
wxFileName fn(pathlist.FindValidPath(wxT("toucan.png"))); wxFileName fn(pathlist.FindValidPath("toucan.png"));
if ( fn.FileExists() ) if ( fn.FileExists() )
testImage = fn.GetFullPath(); testImage = fn.GetFullPath();
#endif // wxUSE_LIBPNG #endif // wxUSE_LIBPNG

View File

@@ -200,7 +200,7 @@ wxEND_EVENT_TABLE()
// implementation // implementation
// ============================================================================ // ============================================================================
IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, wxT("Static"), IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, "Static",
(int)wxPlatform(GENERIC_CTRLS).If(wxOS_WINDOWS,NATIVE_CTRLS) (int)wxPlatform(GENERIC_CTRLS).If(wxOS_WINDOWS,NATIVE_CTRLS)
); );
@@ -260,22 +260,22 @@ void StaticWidgetsPage::CreateContent()
static const wxString halign[] = static const wxString halign[] =
{ {
wxT("left"), "left",
wxT("centre"), "centre",
wxT("right"), "right",
}; };
static const wxString valign[] = static const wxString valign[] =
{ {
wxT("top"), "top",
wxT("centre"), "centre",
wxT("bottom"), "bottom",
}; };
m_radioHAlign = new wxRadioBox(this, wxID_ANY, wxT("&Horz alignment"), m_radioHAlign = new wxRadioBox(this, wxID_ANY, "&Horz alignment",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(halign), halign, 3); WXSIZEOF(halign), halign, 3);
m_radioVAlign = new wxRadioBox(this, wxID_ANY, wxT("&Vert alignment"), m_radioVAlign = new wxRadioBox(this, wxID_ANY, "&Vert alignment",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(valign), valign, 3); WXSIZEOF(valign), valign, 3);
@@ -285,23 +285,23 @@ void StaticWidgetsPage::CreateContent()
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
m_chkEllipsize = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Ellipsize")); m_chkEllipsize = CreateCheckBoxAndAddToSizer(sizerLeft, "&Ellipsize");
static const wxString ellipsizeMode[] = static const wxString ellipsizeMode[] =
{ {
wxT("&start"), "&start",
wxT("&middle"), "&middle",
wxT("&end"), "&end",
}; };
m_radioEllipsize = new wxRadioBox(this, wxID_ANY, wxT("&Ellipsize mode"), m_radioEllipsize = new wxRadioBox(this, wxID_ANY, "&Ellipsize mode",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(ellipsizeMode), ellipsizeMode, WXSIZEOF(ellipsizeMode), ellipsizeMode,
3); 3);
sizerLeft->Add(m_radioEllipsize, 0, wxGROW | wxALL, 5); sizerLeft->Add(m_radioEllipsize, 0, wxGROW | wxALL, 5);
wxButton *btn = new wxButton(this, StaticPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, StaticPage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
@@ -340,14 +340,14 @@ void StaticWidgetsPage::CreateContent()
// NB: must be done _before_ calling CreateStatic() // NB: must be done _before_ calling CreateStatic()
Reset(); Reset();
m_textBox->SetValue(wxT("This is a &box")); m_textBox->SetValue("This is a &box");
m_textLabel->SetValue(wxT("And this is a\n\tlabel inside the box with a &mnemonic.\n") m_textLabel->SetValue("And this is a\n\tlabel inside the box with a &mnemonic.\n"
wxT("Only this text is affected by the ellipsize settings.")); "Only this text is affected by the ellipsize settings.");
#if wxUSE_MARKUP #if wxUSE_MARKUP
m_textLabelWithMarkup->SetValue(wxT("Another label, this time <b>decorated</b> ") m_textLabelWithMarkup->SetValue("Another label, this time <b>decorated</b> "
wxT("with <u>markup</u>; here you need entities ") "with <u>markup</u>; here you need entities "
wxT("for the symbols: &lt; &gt; &amp; &apos; &quot; ") "for the symbols: &lt; &gt; &amp; &apos; &quot; "
wxT(" but you can still place &mnemonics...")); " but you can still place &mnemonics...");
#endif // wxUSE_MARKUP #endif // wxUSE_MARKUP
// right pane // right pane
@@ -416,7 +416,7 @@ void StaticWidgetsPage::CreateStatic()
switch ( m_radioHAlign->GetSelection() ) switch ( m_radioHAlign->GetSelection() )
{ {
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
case StaticHAlign_Left: case StaticHAlign_Left:
@@ -435,7 +435,7 @@ void StaticWidgetsPage::CreateStatic()
switch ( m_radioVAlign->GetSelection() ) switch ( m_radioVAlign->GetSelection() )
{ {
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
case StaticVAlign_Top: case StaticVAlign_Top:
@@ -456,7 +456,7 @@ void StaticWidgetsPage::CreateStatic()
switch ( m_radioEllipsize->GetSelection() ) switch ( m_radioEllipsize->GetSelection() )
{ {
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
case StaticEllipsize_Start: case StaticEllipsize_Start:
@@ -603,9 +603,9 @@ void StaticWidgetsPage::OnButtonLabelText(wxCommandEvent& WXUNUSED(event))
// test GetLabel() and GetLabelText(); the first should return the // test GetLabel() and GetLabelText(); the first should return the
// label as it is written in the relative text control; the second should // label as it is written in the relative text control; the second should
// return the label as it's shown in the wxStaticText // return the label as it's shown in the wxStaticText
wxLogMessage(wxT("The original label should be '%s'"), wxLogMessage("The original label should be '%s'",
m_statText->GetLabel()); m_statText->GetLabel());
wxLogMessage(wxT("The label text is '%s'"), wxLogMessage("The label text is '%s'",
m_statText->GetLabelText()); m_statText->GetLabelText());
} }
@@ -617,9 +617,9 @@ void StaticWidgetsPage::OnButtonLabelWithMarkupText(wxCommandEvent& WXUNUSED(eve
// test GetLabel() and GetLabelText(); the first should return the // test GetLabel() and GetLabelText(); the first should return the
// label as it is written in the relative text control; the second should // label as it is written in the relative text control; the second should
// return the label as it's shown in the wxStaticText // return the label as it's shown in the wxStaticText
wxLogMessage(wxT("The original label should be '%s'"), wxLogMessage("The original label should be '%s'",
m_statMarkup->GetLabel()); m_statMarkup->GetLabel());
wxLogMessage(wxT("The label text is '%s'"), wxLogMessage("The label text is '%s'",
m_statMarkup->GetLabelText()); m_statMarkup->GetLabelText());
} }
#endif // wxUSE_MARKUP #endif // wxUSE_MARKUP

View File

@@ -292,32 +292,32 @@ private:
switch ( HitTest(event.GetPosition(), &x, &y) ) switch ( HitTest(event.GetPosition(), &x, &y) )
{ {
default: default:
wxFAIL_MSG( wxT("unexpected HitTest() result") ); wxFAIL_MSG( "unexpected HitTest() result" );
// fall through // fall through
case wxTE_HT_UNKNOWN: case wxTE_HT_UNKNOWN:
x = y = -1; x = y = -1;
where = wxT("nowhere near"); where = "nowhere near";
break; break;
case wxTE_HT_BEFORE: case wxTE_HT_BEFORE:
where = wxT("before"); where = "before";
break; break;
case wxTE_HT_BELOW: case wxTE_HT_BELOW:
where = wxT("below"); where = "below";
break; break;
case wxTE_HT_BEYOND: case wxTE_HT_BEYOND:
where = wxT("beyond"); where = "beyond";
break; break;
case wxTE_HT_ON_TEXT: case wxTE_HT_ON_TEXT:
where = wxT("at"); where = "at";
break; break;
} }
wxLogMessage(wxT("Mouse is %s (%ld, %ld)"), where.c_str(), x, y); wxLogMessage("Mouse is %s (%ld, %ld)", where.c_str(), x, y);
} }
}; };
@@ -366,7 +366,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, wxT("Text"), IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, "Text",
FAMILY_CTRLS | EDITABLE_CTRLS FAMILY_CTRLS | EDITABLE_CTRLS
); );
@@ -415,12 +415,12 @@ void TextWidgetsPage::CreateContent()
// left pane // left pane
static const wxString modes[] = static const wxString modes[] =
{ {
wxT("single line"), "single line",
wxT("multi line"), "multi line",
}; };
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set textctrl parameters")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set textctrl parameters");
m_radioTextLines = new wxRadioBox(this, wxID_ANY, wxT("&Number of lines:"), m_radioTextLines = new wxRadioBox(this, wxID_ANY, "&Number of lines:",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(modes), modes, WXSIZEOF(modes), modes,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
@@ -431,22 +431,22 @@ void TextWidgetsPage::CreateContent()
sizerLeft->AddSpacer(5); sizerLeft->AddSpacer(5);
m_chkPassword = CreateCheckBoxAndAddToSizer( m_chkPassword = CreateCheckBoxAndAddToSizer(
sizerLeft, wxT("&Password control"), TextPage_Password sizerLeft, "&Password control", TextPage_Password
); );
m_chkReadonly = CreateCheckBoxAndAddToSizer( m_chkReadonly = CreateCheckBoxAndAddToSizer(
sizerLeft, wxT("&Read-only mode") sizerLeft, "&Read-only mode"
); );
m_chkProcessEnter = CreateCheckBoxAndAddToSizer( m_chkProcessEnter = CreateCheckBoxAndAddToSizer(
sizerLeft, wxT("Process &Enter") sizerLeft, "Process &Enter"
); );
m_chkProcessTab = CreateCheckBoxAndAddToSizer( m_chkProcessTab = CreateCheckBoxAndAddToSizer(
sizerLeft, wxT("Process &Tab") sizerLeft, "Process &Tab"
); );
m_chkFilename = CreateCheckBoxAndAddToSizer( m_chkFilename = CreateCheckBoxAndAddToSizer(
sizerLeft, wxT("&Filename control") sizerLeft, "&Filename control"
); );
m_chkNoVertScrollbar = CreateCheckBoxAndAddToSizer( m_chkNoVertScrollbar = CreateCheckBoxAndAddToSizer(
sizerLeft, wxT("No &vertical scrollbar"), sizerLeft, "No &vertical scrollbar",
TextPage_NoVertScrollbar TextPage_NoVertScrollbar
); );
m_chkFilename->Disable(); // not implemented yet m_chkFilename->Disable(); // not implemented yet
@@ -454,13 +454,13 @@ void TextWidgetsPage::CreateContent()
static const wxString wrap[] = static const wxString wrap[] =
{ {
wxT("no wrap"), "no wrap",
wxT("word wrap"), "word wrap",
wxT("char wrap"), "char wrap",
wxT("best wrap"), "best wrap",
}; };
m_radioWrap = new wxRadioBox(this, TextPage_WrapLines, wxT("&Wrap style:"), m_radioWrap = new wxRadioBox(this, TextPage_WrapLines, "&Wrap style:",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(wrap), wrap, WXSIZEOF(wrap), wrap,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
@@ -481,12 +481,12 @@ void TextWidgetsPage::CreateContent()
#ifdef __WXMSW__ #ifdef __WXMSW__
static const wxString kinds[] = static const wxString kinds[] =
{ {
wxT("plain edit"), "plain edit",
wxT("rich edit"), "rich edit",
wxT("rich edit 2.0"), "rich edit 2.0",
}; };
m_radioKind = new wxRadioBox(this, wxID_ANY, wxT("Control &kind"), m_radioKind = new wxRadioBox(this, wxID_ANY, "Control &kind",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(kinds), kinds, WXSIZEOF(kinds), kinds,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
@@ -495,33 +495,33 @@ void TextWidgetsPage::CreateContent()
sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5); sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5);
#endif // __WXMSW__ #endif // __WXMSW__
wxButton *btn = new wxButton(this, TextPage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, TextPage_Reset, "&Reset");
sizerLeft->Add(2, 2, 0, wxGROW | wxALL, 1); // spacer sizerLeft->Add(2, 2, 0, wxGROW | wxALL, 1); // spacer
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Change contents:")); wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Change contents:");
wxSizer *sizerMiddleUp = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddleUp = new wxStaticBoxSizer(box2, wxVERTICAL);
btn = new wxButton(this, TextPage_Set, wxT("&Set text value")); btn = new wxButton(this, TextPage_Set, "&Set text value");
sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1);
btn = new wxButton(this, TextPage_Add, wxT("&Append text")); btn = new wxButton(this, TextPage_Add, "&Append text");
sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1);
btn = new wxButton(this, TextPage_Insert, wxT("&Insert text")); btn = new wxButton(this, TextPage_Insert, "&Insert text");
sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1);
btn = new wxButton(this, TextPage_Load, wxT("&Load file")); btn = new wxButton(this, TextPage_Load, "&Load file");
sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1);
btn = new wxButton(this, TextPage_Clear, wxT("&Clear")); btn = new wxButton(this, TextPage_Clear, "&Clear");
sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1);
btn = new wxButton(this, TextPage_StreamRedirector, wxT("St&ream redirection")); btn = new wxButton(this, TextPage_StreamRedirector, "St&ream redirection");
sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1);
wxStaticBox *box4 = new wxStaticBox(this, wxID_ANY, wxT("&Info:")); wxStaticBox *box4 = new wxStaticBox(this, wxID_ANY, "&Info:");
wxSizer *sizerMiddleDown = new wxStaticBoxSizer(box4, wxVERTICAL); wxSizer *sizerMiddleDown = new wxStaticBoxSizer(box4, wxVERTICAL);
m_textPosCur = CreateInfoText(); m_textPosCur = CreateInfoText();
@@ -531,19 +531,19 @@ void TextWidgetsPage::CreateContent()
wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
sizerRow->Add(CreateTextWithLabelSizer sizerRow->Add(CreateTextWithLabelSizer
( (
wxT("Current pos:"), "Current pos:",
m_textPosCur m_textPosCur
), ),
0, wxRIGHT, 5); 0, wxRIGHT, 5);
sizerRow->Add(CreateTextWithLabelSizer sizerRow->Add(CreateTextWithLabelSizer
( (
wxT("Col:"), "Col:",
m_textColCur m_textColCur
), ),
0, wxLEFT | wxRIGHT, 5); 0, wxLEFT | wxRIGHT, 5);
sizerRow->Add(CreateTextWithLabelSizer sizerRow->Add(CreateTextWithLabelSizer
( (
wxT("Row:"), "Row:",
m_textRowCur m_textRowCur
), ),
0, wxLEFT, 5); 0, wxLEFT, 5);
@@ -555,9 +555,9 @@ void TextWidgetsPage::CreateContent()
( (
CreateTextWithLabelSizer CreateTextWithLabelSizer
( (
wxT("Number of lines:"), "Number of lines:",
m_textLineLast, m_textLineLast,
wxT("Last position:"), "Last position:",
m_textPosLast m_textPosLast
), ),
0, wxALL, 5 0, wxALL, 5
@@ -569,9 +569,9 @@ void TextWidgetsPage::CreateContent()
( (
CreateTextWithLabelSizer CreateTextWithLabelSizer
( (
wxT("Selection: from"), "Selection: from",
m_textSelFrom, m_textSelFrom,
wxT("to"), "to",
m_textSelTo m_textSelTo
), ),
0, wxALL, 5 0, wxALL, 5
@@ -584,7 +584,7 @@ void TextWidgetsPage::CreateContent()
( (
CreateTextWithLabelSizer CreateTextWithLabelSizer
( (
wxT("Range 10..20:"), "Range 10..20:",
m_textRange m_textRange
), ),
0, wxALL, 5 0, wxALL, 5
@@ -606,7 +606,7 @@ void TextWidgetsPage::CreateContent()
sizerMiddle->Add(sizerMiddleDown, 1, wxGROW | wxTOP, 5); sizerMiddle->Add(sizerMiddleDown, 1, wxGROW | wxTOP, 5);
// right pane // right pane
wxStaticBox *box3 = new wxStaticBox(this, wxID_ANY, wxT("&Text:")); wxStaticBox *box3 = new wxStaticBox(this, wxID_ANY, "&Text:");
m_sizerText = new wxStaticBoxSizer(box3, wxHORIZONTAL); m_sizerText = new wxStaticBoxSizer(box3, wxHORIZONTAL);
Reset(); Reset();
CreateText(); CreateText();
@@ -631,7 +631,7 @@ wxTextCtrl *TextWidgetsPage::CreateInfoText()
if ( !s_maxWidth ) if ( !s_maxWidth )
{ {
// calc it once only // calc it once only
GetTextExtent(wxT("9999999"), &s_maxWidth, NULL); GetTextExtent("9999999", &s_maxWidth, NULL);
} }
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
@@ -689,7 +689,7 @@ void TextWidgetsPage::CreateText()
switch ( m_radioTextLines->GetSelection() ) switch ( m_radioTextLines->GetSelection() )
{ {
default: default:
wxFAIL_MSG( wxT("unexpected lines radio box selection") ); wxFAIL_MSG( "unexpected lines radio box selection" );
case TextLines_Single: case TextLines_Single:
break; break;
@@ -714,7 +714,7 @@ void TextWidgetsPage::CreateText()
switch ( m_radioWrap->GetSelection() ) switch ( m_radioWrap->GetSelection() )
{ {
default: default:
wxFAIL_MSG( wxT("unexpected wrap style radio box selection") ); wxFAIL_MSG( "unexpected wrap style radio box selection" );
wxFALLTHROUGH; wxFALLTHROUGH;
case WrapStyle_None: case WrapStyle_None:
@@ -754,7 +754,7 @@ void TextWidgetsPage::CreateText()
switch ( m_radioKind->GetSelection() ) switch ( m_radioKind->GetSelection() )
{ {
default: default:
wxFAIL_MSG( wxT("unexpected kind radio box selection") ); wxFAIL_MSG( "unexpected kind radio box selection" );
case TextKind_Plain: case TextKind_Plain:
break; break;
@@ -779,7 +779,7 @@ void TextWidgetsPage::CreateText()
} }
else else
{ {
valueOld = wxT("Hello, Universe!"); valueOld = "Hello, Universe!";
} }
m_text = new WidgetsTextCtrl(this, TextPage_Textctrl, valueOld, flags); m_text = new WidgetsTextCtrl(this, TextPage_Textctrl, valueOld, flags);
@@ -839,7 +839,7 @@ void TextWidgetsPage::OnIdle(wxIdleEvent& WXUNUSED(event))
if ( m_textLineLast ) if ( m_textLineLast )
{ {
m_textLineLast->SetValue( m_textLineLast->SetValue(
wxString::Format(wxT("%d"), m_text->GetNumberOfLines()) ); wxString::Format("%d", m_text->GetNumberOfLines()) );
} }
if ( m_textSelFrom && m_textSelTo ) if ( m_textSelFrom && m_textSelTo )
@@ -884,8 +884,8 @@ void TextWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
void TextWidgetsPage::OnButtonSet(wxCommandEvent& WXUNUSED(event)) void TextWidgetsPage::OnButtonSet(wxCommandEvent& WXUNUSED(event))
{ {
m_text->SetValue(m_text->GetWindowStyle() & wxTE_MULTILINE m_text->SetValue(m_text->GetWindowStyle() & wxTE_MULTILINE
? wxT("Here,\nthere and\neverywhere") ? "Here,\nthere and\neverywhere"
: wxT("Yellow submarine")); : "Yellow submarine");
m_text->SetFocus(); m_text->SetFocus();
} }
@@ -894,18 +894,18 @@ void TextWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event))
{ {
if ( m_text->GetWindowStyle() & wxTE_MULTILINE ) if ( m_text->GetWindowStyle() & wxTE_MULTILINE )
{ {
m_text->AppendText(wxT("We all live in a\n")); m_text->AppendText("We all live in a\n");
} }
m_text->AppendText(wxT("Yellow submarine")); m_text->AppendText("Yellow submarine");
} }
void TextWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event)) void TextWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event))
{ {
m_text->WriteText(wxT("Is there anybody going to listen to my story")); m_text->WriteText("Is there anybody going to listen to my story");
if ( m_text->GetWindowStyle() & wxTE_MULTILINE ) if ( m_text->GetWindowStyle() & wxTE_MULTILINE )
{ {
m_text->WriteText(wxT("\nall about the girl who came to stay")); m_text->WriteText("\nall about the girl who came to stay");
} }
} }
@@ -919,15 +919,15 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event))
{ {
// search for the file in several dirs where it's likely to be // search for the file in several dirs where it's likely to be
wxPathList pathlist; wxPathList pathlist;
pathlist.Add(wxT(".")); pathlist.Add(".");
pathlist.Add(wxT("..")); pathlist.Add("..");
pathlist.Add(wxT("../widgets")); pathlist.Add("../widgets");
pathlist.Add(wxT("../../../samples/widgets")); pathlist.Add("../../../samples/widgets");
wxString filename = pathlist.FindValidPath(wxT("textctrl.cpp")); wxString filename = pathlist.FindValidPath("textctrl.cpp");
if ( !filename ) if ( !filename )
{ {
wxLogError(wxT("File textctrl.cpp not found.")); wxLogError("File textctrl.cpp not found.");
} }
else // load it else // load it
{ {
@@ -935,12 +935,12 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event))
if ( !m_text->LoadFile(filename) ) if ( !m_text->LoadFile(filename) )
{ {
// this is not supposed to happen ... // this is not supposed to happen ...
wxLogError(wxT("Error loading file.")); wxLogError("Error loading file.");
} }
else else
{ {
long elapsed = sw.Time(); long elapsed = sw.Time();
wxLogMessage(wxT("Loaded file '%s' in %lu.%us"), wxLogMessage("Loaded file '%s' in %lu.%us",
filename.c_str(), elapsed / 1000, filename.c_str(), elapsed / 1000,
(unsigned int) elapsed % 1000); (unsigned int) elapsed % 1000);
} }
@@ -996,12 +996,12 @@ void TextWidgetsPage::OnText(wxCommandEvent& WXUNUSED(event))
return; return;
} }
wxLogMessage(wxT("Text ctrl value changed")); wxLogMessage("Text ctrl value changed");
} }
void TextWidgetsPage::OnTextEnter(wxCommandEvent& event) void TextWidgetsPage::OnTextEnter(wxCommandEvent& event)
{ {
wxLogMessage(wxT("Text entered: '%s'"), event.GetString().c_str()); wxLogMessage("Text entered: '%s'", event.GetString().c_str());
event.Skip(); event.Skip();
} }
@@ -1058,9 +1058,9 @@ void TextWidgetsPage::OnStreamRedirector(wxCommandEvent& WXUNUSED(event))
{ {
#if wxHAS_TEXT_WINDOW_STREAM #if wxHAS_TEXT_WINDOW_STREAM
wxStreamToTextRedirector redirect(m_text); wxStreamToTextRedirector redirect(m_text);
wxString str( wxT("Outputed to cout, appears in wxTextCtrl!") ); wxString str( "Outputed to cout, appears in wxTextCtrl!" );
wxSTD cout << str << wxSTD endl; wxSTD cout << str << wxSTD endl;
#else #else
wxMessageBox(wxT("This wxWidgets build does not support wxStreamToTextRedirector")); wxMessageBox("This wxWidgets build does not support wxStreamToTextRedirector");
#endif #endif
} }

View File

@@ -119,7 +119,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS GENERIC_CTRLS #define FAMILY_CTRLS GENERIC_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(TimePickerWidgetsPage, wxT("TimePicker"), IMPLEMENT_WIDGETS_PAGE(TimePickerWidgetsPage, "TimePicker",
FAMILY_CTRLS | PICKER_CTRLS FAMILY_CTRLS | PICKER_CTRLS
); );

View File

@@ -175,7 +175,7 @@ wxEND_EVENT_TABLE()
#define FAMILY_CTRLS NATIVE_CTRLS #define FAMILY_CTRLS NATIVE_CTRLS
#endif #endif
IMPLEMENT_WIDGETS_PAGE(ToggleWidgetsPage, wxT("ToggleButton"), IMPLEMENT_WIDGETS_PAGE(ToggleWidgetsPage, "ToggleButton",
FAMILY_CTRLS FAMILY_CTRLS
); );
@@ -213,14 +213,14 @@ void ToggleWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane // left pane
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("Styles")); wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "Styles");
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
#ifdef wxHAS_BITMAPTOGGLEBUTTON #ifdef wxHAS_BITMAPTOGGLEBUTTON
m_chkBitmapOnly = CreateCheckBoxAndAddToSizer(sizerLeft, "&Bitmap only"); m_chkBitmapOnly = CreateCheckBoxAndAddToSizer(sizerLeft, "&Bitmap only");
m_chkTextAndBitmap = CreateCheckBoxAndAddToSizer(sizerLeft, "Text &and bitmap"); m_chkTextAndBitmap = CreateCheckBoxAndAddToSizer(sizerLeft, "Text &and bitmap");
m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Fit exactly")); m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit exactly");
#endif // wxHAS_BITMAPTOGGLEBUTTON #endif // wxHAS_BITMAPTOGGLEBUTTON
#if wxUSE_MARKUP #if wxUSE_MARKUP
m_chkUseMarkup = CreateCheckBoxAndAddToSizer(sizerLeft, "Interpret &markup"); m_chkUseMarkup = CreateCheckBoxAndAddToSizer(sizerLeft, "Interpret &markup");
@@ -261,22 +261,22 @@ void ToggleWidgetsPage::CreateContent()
// should be in sync with enums Toggle[HV]Align! // should be in sync with enums Toggle[HV]Align!
static const wxString halign[] = static const wxString halign[] =
{ {
wxT("left"), "left",
wxT("centre"), "centre",
wxT("right"), "right",
}; };
static const wxString valign[] = static const wxString valign[] =
{ {
wxT("top"), "top",
wxT("centre"), "centre",
wxT("bottom"), "bottom",
}; };
m_radioHAlign = new wxRadioBox(this, wxID_ANY, wxT("&Horz alignment"), m_radioHAlign = new wxRadioBox(this, wxID_ANY, "&Horz alignment",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(halign), halign); WXSIZEOF(halign), halign);
m_radioVAlign = new wxRadioBox(this, wxID_ANY, wxT("&Vert alignment"), m_radioVAlign = new wxRadioBox(this, wxID_ANY, "&Vert alignment",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(valign), valign); WXSIZEOF(valign), valign);
@@ -286,18 +286,18 @@ void ToggleWidgetsPage::CreateContent()
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
wxButton *btn = new wxButton(this, TogglePage_Reset, wxT("&Reset")); wxButton *btn = new wxButton(this, TogglePage_Reset, "&Reset");
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane // middle pane
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Operations")); wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Operations");
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow = CreateSizerWithTextAndButton(TogglePage_ChangeLabel, wxSizer *sizerRow = CreateSizerWithTextAndButton(TogglePage_ChangeLabel,
wxT("Change label"), "Change label",
wxID_ANY, wxID_ANY,
&m_textLabel); &m_textLabel);
m_textLabel->SetValue(wxT("&Toggle me!")); m_textLabel->SetValue("&Toggle me!");
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
@@ -378,7 +378,7 @@ void ToggleWidgetsPage::CreateToggle()
break; break;
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
case ToggleHAlign_Centre: case ToggleHAlign_Centre:
@@ -396,7 +396,7 @@ void ToggleWidgetsPage::CreateToggle()
break; break;
default: default:
wxFAIL_MSG(wxT("unexpected radiobox selection")); wxFAIL_MSG("unexpected radiobox selection");
// fall through // fall through
case ToggleVAlign_Centre: case ToggleVAlign_Centre:
@@ -419,22 +419,22 @@ void ToggleWidgetsPage::CreateToggle()
if ( m_chkUseBitmapClass->GetValue() ) if ( m_chkUseBitmapClass->GetValue() )
{ {
btgl = new wxBitmapToggleButton(this, TogglePage_Picker, btgl = new wxBitmapToggleButton(this, TogglePage_Picker,
CreateBitmap(wxT("normal"))); CreateBitmap("normal"));
} }
else else
{ {
btgl = new wxToggleButton(this, TogglePage_Picker, wxT("")); btgl = new wxToggleButton(this, TogglePage_Picker, "");
btgl->SetBitmapLabel(CreateBitmap(wxT("normal"))); btgl->SetBitmapLabel(CreateBitmap("normal"));
} }
#ifdef wxHAS_ANY_BUTTON #ifdef wxHAS_ANY_BUTTON
if ( m_chkUsePressed->GetValue() ) if ( m_chkUsePressed->GetValue() )
btgl->SetBitmapPressed(CreateBitmap(wxT("pushed"))); btgl->SetBitmapPressed(CreateBitmap("pushed"));
if ( m_chkUseFocused->GetValue() ) if ( m_chkUseFocused->GetValue() )
btgl->SetBitmapFocus(CreateBitmap(wxT("focused"))); btgl->SetBitmapFocus(CreateBitmap("focused"));
if ( m_chkUseCurrent->GetValue() ) if ( m_chkUseCurrent->GetValue() )
btgl->SetBitmapCurrent(CreateBitmap(wxT("hover"))); btgl->SetBitmapCurrent(CreateBitmap("hover"));
if ( m_chkUseDisabled->GetValue() ) if ( m_chkUseDisabled->GetValue() )
btgl->SetBitmapDisabled(CreateBitmap(wxT("disabled"))); btgl->SetBitmapDisabled(CreateBitmap("disabled"));
#endif // wxHAS_ANY_BUTTON #endif // wxHAS_ANY_BUTTON
m_toggle = btgl; m_toggle = btgl;
} }
@@ -527,8 +527,8 @@ wxBitmap ToggleWidgetsPage::CreateBitmap(const wxString& label)
dc.SetBackground(*wxCYAN_BRUSH); dc.SetBackground(*wxCYAN_BRUSH);
dc.Clear(); dc.Clear();
dc.SetTextForeground(*wxBLACK); dc.SetTextForeground(*wxBLACK);
dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n") dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + "\n"
wxT("(") + label + wxT(" state)"), "(" + label + " state)",
wxArtProvider::GetBitmap(wxART_INFORMATION), wxArtProvider::GetBitmap(wxART_INFORMATION),
wxRect(10, 10, bmp.GetWidth() - 20, bmp.GetHeight() - 20), wxRect(10, 10, bmp.GetWidth() - 20, bmp.GetHeight() - 20),
wxALIGN_CENTRE); wxALIGN_CENTRE);

View File

@@ -357,22 +357,22 @@ bool WidgetsApp::OnInit()
// this sample side by side and it is useful to see which one is which // this sample side by side and it is useful to see which one is which
wxString title; wxString title;
#if defined(__WXUNIVERSAL__) #if defined(__WXUNIVERSAL__)
title = wxT("wxUniv/"); title = "wxUniv/";
#endif #endif
#if defined(__WXMSW__) #if defined(__WXMSW__)
title += wxT("wxMSW"); title += "wxMSW";
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
title += wxT("wxGTK"); title += "wxGTK";
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
title += wxT("wxMAC"); title += "wxMAC";
#elif defined(__WXMOTIF__) #elif defined(__WXMOTIF__)
title += wxT("wxMOTIF"); title += "wxMOTIF";
#else #else
title += wxT("wxWidgets"); title += "wxWidgets";
#endif #endif
wxFrame *frame = new WidgetsFrame(title + wxT(" widgets demo")); wxFrame *frame = new WidgetsFrame(title + " widgets demo");
frame->Show(); frame->Show();
return true; return true;
@@ -400,25 +400,25 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
wxMenuBar *mbar = new wxMenuBar; wxMenuBar *mbar = new wxMenuBar;
wxMenu *menuWidget = new wxMenu; wxMenu *menuWidget = new wxMenu;
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
menuWidget->Append(Widgets_SetTooltip, wxT("Set &tooltip...\tCtrl-T")); menuWidget->Append(Widgets_SetTooltip, "Set &tooltip...\tCtrl-T");
menuWidget->AppendSeparator(); menuWidget->AppendSeparator();
#endif // wxUSE_TOOLTIPS #endif // wxUSE_TOOLTIPS
menuWidget->Append(Widgets_SetFgColour, wxT("Set &foreground...\tCtrl-F")); menuWidget->Append(Widgets_SetFgColour, "Set &foreground...\tCtrl-F");
menuWidget->Append(Widgets_SetBgColour, wxT("Set &background...\tCtrl-B")); menuWidget->Append(Widgets_SetBgColour, "Set &background...\tCtrl-B");
menuWidget->Append(Widgets_SetPageBg, wxT("Set &page background...\tShift-Ctrl-B")); menuWidget->Append(Widgets_SetPageBg, "Set &page background...\tShift-Ctrl-B");
menuWidget->Append(Widgets_SetFont, wxT("Set f&ont...\tCtrl-O")); menuWidget->Append(Widgets_SetFont, "Set f&ont...\tCtrl-O");
menuWidget->AppendCheckItem(Widgets_Enable, wxT("&Enable/disable\tCtrl-E")); menuWidget->AppendCheckItem(Widgets_Enable, "&Enable/disable\tCtrl-E");
menuWidget->AppendCheckItem(Widgets_Show, wxT("Show/Hide")); menuWidget->AppendCheckItem(Widgets_Show, "Show/Hide");
wxMenu *menuBorders = new wxMenu; wxMenu *menuBorders = new wxMenu;
menuBorders->AppendRadioItem(Widgets_BorderDefault, wxT("De&fault\tCtrl-Shift-9")); menuBorders->AppendRadioItem(Widgets_BorderDefault, "De&fault\tCtrl-Shift-9");
menuBorders->AppendRadioItem(Widgets_BorderNone, wxT("&None\tCtrl-Shift-0")); menuBorders->AppendRadioItem(Widgets_BorderNone, "&None\tCtrl-Shift-0");
menuBorders->AppendRadioItem(Widgets_BorderSimple, wxT("&Simple\tCtrl-Shift-1")); menuBorders->AppendRadioItem(Widgets_BorderSimple, "&Simple\tCtrl-Shift-1");
menuBorders->AppendRadioItem(Widgets_BorderDouble, wxT("&Double\tCtrl-Shift-2")); menuBorders->AppendRadioItem(Widgets_BorderDouble, "&Double\tCtrl-Shift-2");
menuBorders->AppendRadioItem(Widgets_BorderStatic, wxT("Stati&c\tCtrl-Shift-3")); menuBorders->AppendRadioItem(Widgets_BorderStatic, "Stati&c\tCtrl-Shift-3");
menuBorders->AppendRadioItem(Widgets_BorderRaised, wxT("&Raised\tCtrl-Shift-4")); menuBorders->AppendRadioItem(Widgets_BorderRaised, "&Raised\tCtrl-Shift-4");
menuBorders->AppendRadioItem(Widgets_BorderSunken, wxT("S&unken\tCtrl-Shift-5")); menuBorders->AppendRadioItem(Widgets_BorderSunken, "S&unken\tCtrl-Shift-5");
menuWidget->AppendSubMenu(menuBorders, wxT("Set &border")); menuWidget->AppendSubMenu(menuBorders, "Set &border");
wxMenu* const menuVariants = new wxMenu; wxMenu* const menuVariants = new wxMenu;
menuVariants->AppendRadioItem(Widgets_VariantMini, "&Mini\tCtrl-Shift-6"); menuVariants->AppendRadioItem(Widgets_VariantMini, "&Mini\tCtrl-Shift-6");
@@ -433,31 +433,31 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
menuWidget->AppendSeparator(); menuWidget->AppendSeparator();
menuWidget->AppendCheckItem(Widgets_GlobalBusyCursor, menuWidget->AppendCheckItem(Widgets_GlobalBusyCursor,
wxT("Toggle &global busy cursor\tCtrl-Shift-U")); "Toggle &global busy cursor\tCtrl-Shift-U");
menuWidget->AppendCheckItem(Widgets_BusyCursor, menuWidget->AppendCheckItem(Widgets_BusyCursor,
wxT("Toggle b&usy cursor\tCtrl-U")); "Toggle b&usy cursor\tCtrl-U");
menuWidget->AppendSeparator(); menuWidget->AppendSeparator();
menuWidget->Append(wxID_EXIT, wxT("&Quit\tCtrl-Q")); menuWidget->Append(wxID_EXIT, "&Quit\tCtrl-Q");
mbar->Append(menuWidget, wxT("&Widget")); mbar->Append(menuWidget, "&Widget");
wxMenu *menuTextEntry = new wxMenu; wxMenu *menuTextEntry = new wxMenu;
menuTextEntry->AppendRadioItem(TextEntry_DisableAutoComplete, menuTextEntry->AppendRadioItem(TextEntry_DisableAutoComplete,
wxT("&Disable auto-completion")); "&Disable auto-completion");
menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteFixed, menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteFixed,
wxT("Fixed-&list auto-completion")); "Fixed-&list auto-completion");
menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteFilenames, menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteFilenames,
wxT("&Files names auto-completion")); "&Files names auto-completion");
menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteDirectories, menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteDirectories,
wxT("&Directories names auto-completion")); "&Directories names auto-completion");
menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteCustom, menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteCustom,
wxT("&Custom auto-completion")); "&Custom auto-completion");
menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteKeyLength, menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteKeyLength,
wxT("Custom with &min length")); "Custom with &min length");
menuTextEntry->AppendSeparator(); menuTextEntry->AppendSeparator();
menuTextEntry->Append(TextEntry_SetHint, "Set help &hint"); menuTextEntry->Append(TextEntry_SetHint, "Set help &hint");
mbar->Append(menuTextEntry, wxT("&Text")); mbar->Append(menuTextEntry, "&Text");
SetMenuBar(mbar); SetMenuBar(mbar);
@@ -488,7 +488,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
// the lower one only has the log listbox and a button to clear it // the lower one only has the log listbox and a button to clear it
#if USE_LOG #if USE_LOG
wxSizer *sizerDown = new wxStaticBoxSizer( wxSizer *sizerDown = new wxStaticBoxSizer(
new wxStaticBox( m_panel, wxID_ANY, wxT("&Log window") ), new wxStaticBox( m_panel, wxID_ANY, "&Log window" ),
wxVERTICAL); wxVERTICAL);
m_lboxLog = new wxListBox(m_panel, wxID_ANY); m_lboxLog = new wxListBox(m_panel, wxID_ANY);
@@ -501,11 +501,11 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
wxBoxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL);
wxButton *btn; wxButton *btn;
#if USE_LOG #if USE_LOG
btn = new wxButton(m_panel, Widgets_ClearLog, wxT("Clear &log")); btn = new wxButton(m_panel, Widgets_ClearLog, "Clear &log");
sizerBtns->Add(btn); sizerBtns->Add(btn);
sizerBtns->Add(10, 0); // spacer sizerBtns->Add(10, 0); // spacer
#endif // USE_LOG #endif // USE_LOG
btn = new wxButton(m_panel, Widgets_Quit, wxT("E&xit")); btn = new wxButton(m_panel, Widgets_Quit, "E&xit");
sizerBtns->Add(btn); sizerBtns->Add(btn);
sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5); sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5);
@@ -601,7 +601,7 @@ void WidgetsFrame::InitBook()
} }
} }
GetMenuBar()->Append(menuPages, wxT("&Page")); GetMenuBar()->Append(menuPages, "&Page");
m_book->AssignImageList(imageList); m_book->AssignImageList(imageList);
@@ -664,7 +664,7 @@ WidgetsPage *WidgetsFrame::CurrentPage()
#if !USE_TREEBOOK #if !USE_TREEBOOK
WidgetsBookCtrl *subBook = wxStaticCast(page, WidgetsBookCtrl); WidgetsBookCtrl *subBook = wxStaticCast(page, WidgetsBookCtrl);
wxCHECK_MSG( subBook, NULL, wxT("no WidgetsBookCtrl?") ); wxCHECK_MSG( subBook, NULL, "no WidgetsBookCtrl?" );
page = subBook->GetCurrentPage(); page = subBook->GetCurrentPage();
#endif // !USE_TREEBOOK #endif // !USE_TREEBOOK
@@ -771,8 +771,8 @@ void WidgetsFrame::OnSetTooltip(wxCommandEvent& WXUNUSED(event))
wxTextEntryDialog dialog wxTextEntryDialog dialog
( (
this, this,
wxT("Tooltip text (may use \\n, leave empty to remove): "), "Tooltip text (may use \\n, leave empty to remove): ",
wxT("Widgets sample"), "Widgets sample",
WidgetsPage::GetAttrs().m_tooltip WidgetsPage::GetAttrs().m_tooltip
); );
@@ -780,7 +780,7 @@ void WidgetsFrame::OnSetTooltip(wxCommandEvent& WXUNUSED(event))
return; return;
WidgetsPage::GetAttrs().m_tooltip = dialog.GetValue(); WidgetsPage::GetAttrs().m_tooltip = dialog.GetValue();
WidgetsPage::GetAttrs().m_tooltip.Replace(wxT("\\n"), wxT("\n")); WidgetsPage::GetAttrs().m_tooltip.Replace("\\n", "\n");
CurrentPage()->SetUpWidget(); CurrentPage()->SetUpWidget();
} }
@@ -870,7 +870,7 @@ void WidgetsFrame::OnSetFont(wxCommandEvent& WXUNUSED(event))
// so re-layout to show it correctly. // so re-layout to show it correctly.
page->Layout(); page->Layout();
#else #else
wxLogMessage(wxT("Font selection dialog not available in current build.")); wxLogMessage("Font selection dialog not available in current build.");
#endif #endif
} }
@@ -901,7 +901,7 @@ void WidgetsFrame::OnSetBorder(wxCommandEvent& event)
case Widgets_BorderDouble: border = wxBORDER_DOUBLE; break; case Widgets_BorderDouble: border = wxBORDER_DOUBLE; break;
default: default:
wxFAIL_MSG( wxT("unknown border style") ); wxFAIL_MSG( "unknown border style" );
// fall through // fall through
case Widgets_BorderDefault: border = wxBORDER_DEFAULT; break; case Widgets_BorderDefault: border = wxBORDER_DEFAULT; break;
@@ -1210,7 +1210,7 @@ void WidgetsFrame::OnWidgetFocus(wxFocusEvent& event)
// WidgetsPageInfo // WidgetsPageInfo
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxChar *label, int categories) WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxString& label, int categories)
: m_label(label) : m_label(label)
, m_categories(categories) , m_categories(categories)
{ {

View File

@@ -197,7 +197,7 @@ public:
wxImageList *imaglist); wxImageList *imaglist);
// our ctor // our ctor
WidgetsPageInfo(Constructor ctor, const wxChar *label, int categories); WidgetsPageInfo(Constructor ctor, const wxString& label, int categories);
// accessors // accessors
const wxString& GetLabel() const { return m_label; } const wxString& GetLabel() const { return m_label; }

View File

@@ -90,7 +90,7 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class
{ {
// add corresponding header if not already included // add corresponding header if not already included
wxString include; wxString include;
include.Printf(wxT("#include \"%s\"\n"),classInfo->GetIncludeName()); include.Printf("#include \"%s\"\n",classInfo->GetIncludeName());
if ( m_headerincludes.Find(include) == wxNOT_FOUND) if ( m_headerincludes.Find(include) == wxNOT_FOUND)
m_headerincludes += include; m_headerincludes += include;
} }
@@ -155,12 +155,12 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny &param )
} }
else else
{ {
wxLogError ( _("Internal error, illegal wxCustomTypeInfo") ); wxLogError ( "Internal error, illegal wxCustomTypeInfo" );
} }
} }
else if ( type->GetKind() == wxT_STRING ) else if ( type->GetKind() == wxT_STRING )
{ {
value.Printf( wxT("\"%s\""), wxAnyGetAsString(param).c_str() ); value.Printf( "\"%s\"", wxAnyGetAsString(param).c_str() );
} }
else if ( type->GetKind() == wxT_OBJECT ) else if ( type->GetKind() == wxT_OBJECT )
{ {