Remove (most) occurrences of wxT() macro from the samples

Also replace wxChar* with wxString.

Closes https://github.com/wxWidgets/wxWidgets/pull/945
This commit is contained in:
Blake-Eryx
2018-09-23 01:15:08 +02:00
committed by Vadim Zeitlin
parent e768046774
commit f58ea62596
93 changed files with 4362 additions and 4358 deletions

View File

@@ -174,7 +174,7 @@ bool MyApp::OnInit()
wxHelpProvider::Set(new wxSimpleHelpProvider()); wxHelpProvider::Set(new wxSimpleHelpProvider());
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(wxT("AccessTest wxWidgets App"), MyFrame *frame = new MyFrame("AccessTest wxWidgets App",
wxPoint(50, 50), wxSize(450, 340)); wxPoint(50, 50), wxSize(450, 340));
// and show it (the frames, unlike simple controls, are not shown when // and show it (the frames, unlike simple controls, are not shown when
@@ -186,7 +186,7 @@ bool MyApp::OnInit()
// application would exit immediately. // application would exit immediately.
return true; return true;
#else #else
wxMessageBox( wxT("This sample has to be compiled with wxUSE_ACCESSIBILITY"), wxT("Building error"), wxOK); wxMessageBox( "This sample has to be compiled with wxUSE_ACCESSIBILITY", "Building error", wxOK);
return false; return false;
#endif // wxUSE_ACCESSIBILITY #endif // wxUSE_ACCESSIBILITY
} }
@@ -203,7 +203,7 @@ public:
{ {
if (childId == wxACC_SELF) if (childId == wxACC_SELF)
{ {
* name = wxT("Julian's Frame"); * name = "Julian's Frame";
return wxACC_OK; return wxACC_OK;
} }
else else
@@ -221,7 +221,7 @@ public:
{ {
if (childId == wxACC_SELF) if (childId == wxACC_SELF)
{ {
* name = wxT("My scrolled window"); * name = "My scrolled window";
return wxACC_OK; return wxACC_OK;
} }
else else
@@ -307,9 +307,9 @@ public:
// of this object. // of this object.
// Acceptable values: // Acceptable values:
// - a null variant (IsNull() returns true) // - a null variant (IsNull() returns true)
// - a list variant (GetType() == wxT("list")) // - a list variant (GetType() == "list")
// - an integer representing the selected child element, // - an integer representing the selected child element,
// or 0 if this object is selected (GetType() == wxT("long")) // or 0 if this object is selected (GetType() == "long")
// - a "void*" pointer to a wxAccessible child object // - a "void*" pointer to a wxAccessible child object
virtual wxAccStatus GetSelections(wxVariant* selections) wxOVERRIDE; virtual wxAccStatus GetSelections(wxVariant* selections) wxOVERRIDE;
@@ -336,16 +336,16 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(AccessTest_About, wxT("&About"), wxT("Show about dialog")); helpMenu->Append(AccessTest_About, "&About", "Show about dialog");
menuFile->Append(AccessTest_Query, wxT("Query"), wxT("Query the window hierarchy")); menuFile->Append(AccessTest_Query, "Query", "Query the window hierarchy");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(AccessTest_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(AccessTest_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -354,7 +354,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
#if 0 // wxUSE_STATUSBAR #if 0 // wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -362,17 +362,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
splitter->SetAccessible(new SplitterWindowAccessible(splitter)); splitter->SetAccessible(new SplitterWindowAccessible(splitter));
wxListBox* listBox = new wxListBox(splitter, wxID_ANY); wxListBox* listBox = new wxListBox(splitter, wxID_ANY);
listBox->Append(wxT("Cabbages")); listBox->Append("Cabbages");
listBox->Append(wxT("Kings")); listBox->Append("Kings");
listBox->Append(wxT("Sealing wax")); listBox->Append("Sealing wax");
listBox->Append(wxT("Strings")); listBox->Append("Strings");
listBox->CreateAccessible(); listBox->CreateAccessible();
listBox->SetHelpText(wxT("This is a sample wxWidgets listbox, with a number of items in it.")); listBox->SetHelpText("This is a sample wxWidgets listbox, with a number of items in it.");
m_textCtrl = new wxTextCtrl(splitter, wxID_ANY, wxT(""), wxDefaultPosition, m_textCtrl = new wxTextCtrl(splitter, wxID_ANY, "", wxDefaultPosition,
wxDefaultSize, wxTE_MULTILINE); wxDefaultSize, wxTE_MULTILINE);
m_textCtrl->CreateAccessible(); m_textCtrl->CreateAccessible();
m_textCtrl->SetHelpText(wxT("This is a sample wxWidgets multiline text control.")); m_textCtrl->SetHelpText("This is a sample wxWidgets multiline text control.");
splitter->SplitHorizontally(listBox, m_textCtrl, 150); splitter->SplitHorizontally(listBox, m_textCtrl, 150);
@@ -394,10 +394,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is the About dialog of the AccessTest sample.\n") msg.Printf( "This is the About dialog of the AccessTest sample.\n"
wxT("Welcome to %s"), wxVERSION_STRING); "Welcome to %s", wxVERSION_STRING);
wxMessageBox(msg, wxT("About AccessTest"), wxOK | wxICON_INFORMATION, this); wxMessageBox(msg, "About AccessTest", wxOK | wxICON_INFORMATION, this);
} }
void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event))
@@ -407,26 +407,26 @@ void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event))
if (S_OK != AccessibleObjectFromWindow((HWND) GetHWND(), (DWORD)OBJID_CLIENT, if (S_OK != AccessibleObjectFromWindow((HWND) GetHWND(), (DWORD)OBJID_CLIENT,
IID_IAccessible, (void**) & accessibleFrame)) IID_IAccessible, (void**) & accessibleFrame))
{ {
Log(wxT("Could not get object.")); Log("Could not get object.");
return; return;
} }
if (accessibleFrame) if (accessibleFrame)
{ {
//Log(wxT("Got an IAccessible for the frame.")); //Log("Got an IAccessible for the frame.");
LogObject(0, accessibleFrame); LogObject(0, accessibleFrame);
Log(wxT("Checking children using AccessibleChildren()...")); Log("Checking children using AccessibleChildren()...");
// Now check the AccessibleChildren function works OK // Now check the AccessibleChildren function works OK
long childCount = 0; long childCount = 0;
if (S_OK != accessibleFrame->get_accChildCount(& childCount)) if (S_OK != accessibleFrame->get_accChildCount(& childCount))
{ {
Log(wxT("Could not get number of children.")); Log("Could not get number of children.");
accessibleFrame->Release(); accessibleFrame->Release();
return; return;
} }
else if (childCount == 0) else if (childCount == 0)
{ {
Log(wxT("No children.")); Log("No children.");
accessibleFrame->Release(); accessibleFrame->Release();
return; return;
} }
@@ -455,7 +455,7 @@ void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event))
wxString name, role; wxString name, role;
GetInfo(childAccessible, 0, name, role); GetInfo(childAccessible, 0, name, role);
wxString str; wxString str;
str.Printf(wxT("Found child %s/%s"), name.c_str(), role.c_str()); str.Printf("Found child %s/%s", name.c_str(), role.c_str());
Log(str); Log(str);
childAccessible->Release(); childAccessible->Release();
} }
@@ -468,7 +468,7 @@ void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
Log(wxT("AccessibleChildren failed.")); Log("AccessibleChildren failed.");
} }
delete[] var; delete[] var;
@@ -483,10 +483,10 @@ void MyFrame::Log(const wxString& text)
if (m_textCtrl) if (m_textCtrl)
{ {
wxString text2(text); wxString text2(text);
text2.Replace(wxT("\n"), wxT(" ")); text2.Replace("\n", " ");
text2.Replace(wxT("\r"), wxT(" ")); text2.Replace("\r", " ");
m_textCtrl->SetInsertionPointEnd(); m_textCtrl->SetInsertionPointEnd();
m_textCtrl->WriteText(text2 + wxT("\n")); m_textCtrl->WriteText(text2 + "\n");
} }
} }
@@ -499,8 +499,8 @@ void MyFrame::LogObject(int indent, IAccessible* obj)
GetInfo(obj, 0, name, role); GetInfo(obj, 0, name, role);
wxString str; wxString str;
str.Printf(wxT("Name = %s; Role = %s"), name.c_str(), role.c_str()); str.Printf("Name = %s; Role = %s", name.c_str(), role.c_str());
str.Pad(indent, wxT(' '), false); str.Pad(indent, ' ', false);
Log(str); Log(str);
} }
@@ -508,10 +508,10 @@ void MyFrame::LogObject(int indent, IAccessible* obj)
if (S_OK == obj->get_accChildCount(& childCount)) if (S_OK == obj->get_accChildCount(& childCount))
{ {
wxString str; wxString str;
str.Printf(wxT("There are %d children."), (int) childCount); str.Printf("There are %d children.", (int) childCount);
str.Pad(indent, wxT(' '), false); str.Pad(indent, ' ', false);
Log(str); Log(str);
Log(wxT("")); Log("");
} }
int i; int i;
@@ -520,8 +520,8 @@ void MyFrame::LogObject(int indent, IAccessible* obj)
GetInfo(obj, i, name, role); GetInfo(obj, i, name, role);
wxString str; wxString str;
str.Printf(wxT("%d) Name = %s; Role = %s"), i, name.c_str(), role.c_str()); str.Printf("%d) Name = %s; Role = %s", i, name.c_str(), role.c_str());
str.Pad(indent, wxT(' '), false); str.Pad(indent, ' ', false);
Log(str); Log(str);
VARIANT var; VARIANT var;
@@ -533,8 +533,8 @@ void MyFrame::LogObject(int indent, IAccessible* obj)
if (S_OK == obj->get_accChild(var, & pDisp) && pDisp) if (S_OK == obj->get_accChild(var, & pDisp) && pDisp)
{ {
str.Printf(wxT("This is a real object.")); str.Printf("This is a real object.");
str.Pad(indent+4, wxT(' '), false); str.Pad(indent+4, ' ', false);
Log(str); Log(str);
if (pDisp->QueryInterface(IID_IAccessible, (LPVOID*) & childObject) == S_OK) if (pDisp->QueryInterface(IID_IAccessible, (LPVOID*) & childObject) == S_OK)
@@ -546,11 +546,11 @@ void MyFrame::LogObject(int indent, IAccessible* obj)
} }
else else
{ {
str.Printf(wxT("This is an element.")); str.Printf("This is an element.");
str.Pad(indent+4, wxT(' '), false); str.Pad(indent+4, ' ', false);
Log(str); Log(str);
} }
// Log(wxT("")); // Log("");
} }
} }
@@ -573,7 +573,7 @@ void MyFrame::GetInfo(IAccessible* accessible, int id, wxString& name, wxString&
} }
else else
{ {
name = wxT("NO NAME"); name = "NO NAME";
} }
VARIANT varRole; VARIANT varRole;
@@ -590,7 +590,7 @@ void MyFrame::GetInfo(IAccessible* accessible, int id, wxString& name, wxString&
} }
else else
{ {
role = wxT("NO ROLE"); role = "NO ROLE";
} }
} }
@@ -603,7 +603,7 @@ wxAccStatus SplitterWindowAccessible::GetName(int childId, wxString* name)
{ {
if (childId == wxACC_SELF) if (childId == wxACC_SELF)
{ {
* name = wxT("Splitter window"); * name = "Splitter window";
return wxACC_OK; return wxACC_OK;
} }
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow); wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
@@ -616,7 +616,7 @@ wxAccStatus SplitterWindowAccessible::GetName(int childId, wxString* name)
return wxACC_NOT_IMPLEMENTED; return wxACC_NOT_IMPLEMENTED;
else if (childId == 2) else if (childId == 2)
{ {
*name = wxT("Sash"); *name = "Sash";
return wxACC_OK; return wxACC_OK;
} }
} }
@@ -1101,9 +1101,9 @@ wxAccStatus SplitterWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessi
// of this object. // of this object.
// Acceptable values: // Acceptable values:
// - a null variant (IsNull() returns true) // - a null variant (IsNull() returns true)
// - a list variant (GetType() == wxT("list")) // - a list variant (GetType() == "list")
// - an integer representing the selected child element, // - an integer representing the selected child element,
// or 0 if this object is selected (GetType() == wxT("long")) // or 0 if this object is selected (GetType() == "long")
// - a "void*" pointer to a wxAccessible child object // - a "void*" pointer to a wxAccessible child object
wxAccStatus SplitterWindowAccessible::GetSelections(wxVariant* WXUNUSED(selections)) wxAccStatus SplitterWindowAccessible::GetSelections(wxVariant* WXUNUSED(selections))
{ {

View File

@@ -96,7 +96,7 @@ bool MyApp::OnInit()
// Create the main frame window // Create the main frame window
MyFrame* frame = new MyFrame((wxFrame *)NULL, wxID_ANY, wxT("Animation Demo"), MyFrame* frame = new MyFrame((wxFrame *)NULL, wxID_ANY, "Animation Demo",
wxDefaultPosition, wxSize(500, 400), wxDefaultPosition, wxSize(500, 400),
wxDEFAULT_FRAME_STYLE); wxDEFAULT_FRAME_STYLE);
frame->Show(true); frame->Show(true);
@@ -124,31 +124,31 @@ MyFrame::MyFrame(wxWindow *parent,
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
file_menu->Append(wxID_OPEN, wxT("&Open Animation...\tCtrl+O"), wxT("Loads an animation")); file_menu->Append(wxID_OPEN, "&Open Animation...\tCtrl+O", "Loads an animation");
#endif // wxUSE_FILEDLG #endif // wxUSE_FILEDLG
file_menu->Append(wxID_EXIT); file_menu->Append(wxID_EXIT);
wxMenu *play_menu = new wxMenu; wxMenu *play_menu = new wxMenu;
play_menu->Append(ID_PLAY, wxT("Play\tCtrl+P"), wxT("Play the animation")); play_menu->Append(ID_PLAY, "Play\tCtrl+P", "Play the animation");
play_menu->Append(wxID_STOP, wxT("Stop\tCtrl+S"), wxT("Stop the animation")); play_menu->Append(wxID_STOP, "Stop\tCtrl+S", "Stop the animation");
play_menu->AppendSeparator(); play_menu->AppendSeparator();
play_menu->Append(ID_SET_NULL_ANIMATION, wxT("Set null animation"), play_menu->Append(ID_SET_NULL_ANIMATION, "Set null animation",
wxT("Sets the empty animation in the control")); "Sets the empty animation in the control");
play_menu->AppendCheckItem(ID_SET_INACTIVE_BITMAP, wxT("Set inactive bitmap"), play_menu->AppendCheckItem(ID_SET_INACTIVE_BITMAP, "Set inactive bitmap",
wxT("Sets an inactive bitmap for the control")); "Sets an inactive bitmap for the control");
play_menu->AppendCheckItem(ID_SET_NO_AUTO_RESIZE, wxT("Set no autoresize"), play_menu->AppendCheckItem(ID_SET_NO_AUTO_RESIZE, "Set no autoresize",
wxT("Tells the control not to resize automatically")); "Tells the control not to resize automatically");
play_menu->Append(ID_SET_BGCOLOR, wxT("Set background colour..."), play_menu->Append(ID_SET_BGCOLOR, "Set background colour...",
wxT("Sets the background colour of the control")); "Sets the background colour of the control");
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append(wxID_ABOUT); help_menu->Append(wxID_ABOUT);
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
menu_bar->Append(play_menu, wxT("&Animation")); menu_bar->Append(play_menu, "&Animation");
menu_bar->Append(help_menu, wxT("&Help")); menu_bar->Append(help_menu, "&Help");
// Associate the menu bar with this frame // Associate the menu bar with this frame
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
@@ -161,11 +161,11 @@ MyFrame::MyFrame(wxWindow *parent,
// resize the m_animationCtrl to fill its client area on // resize the m_animationCtrl to fill its client area on
// user resizes // user resizes
wxSizer *sz = new wxBoxSizer(wxVERTICAL); wxSizer *sz = new wxBoxSizer(wxVERTICAL);
sz->Add(new wxStaticText(this, wxID_ANY, wxT("wxAnimationCtrl:")), sz->Add(new wxStaticText(this, wxID_ANY, "wxAnimationCtrl:"),
wxSizerFlags().Centre().Border()); wxSizerFlags().Centre().Border());
m_animationCtrl = new wxAnimationCtrl(this, wxID_ANY); m_animationCtrl = new wxAnimationCtrl(this, wxID_ANY);
if (m_animationCtrl->LoadFile(wxT("throbber.gif"))) if (m_animationCtrl->LoadFile("throbber.gif"))
m_animationCtrl->Play(); m_animationCtrl->Play();
sz->Add(m_animationCtrl, wxSizerFlags().Centre().Border()); sz->Add(m_animationCtrl, wxSizerFlags().Centre().Border());
@@ -180,7 +180,7 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
{ {
if (!m_animationCtrl->Play()) if (!m_animationCtrl->Play())
{ {
wxLogError(wxT("Invalid animation")); wxLogError("Invalid animation");
} }
} }
@@ -239,7 +239,7 @@ void MyFrame::OnSetNoAutoResize(wxCommandEvent& event)
void MyFrame::OnSetBgColor(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSetBgColor(wxCommandEvent& WXUNUSED(event))
{ {
wxColour clr = wxGetColourFromUser(this, m_animationCtrl->GetBackgroundColour(), wxColour clr = wxGetColourFromUser(this, m_animationCtrl->GetBackgroundColour(),
wxT("Choose the background colour")); "Choose the background colour");
if (clr.IsOk()) if (clr.IsOk())
m_animationCtrl->SetBackgroundColour(clr); m_animationCtrl->SetBackgroundColour(clr);
@@ -255,11 +255,11 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
wxAboutDialogInfo info; wxAboutDialogInfo info;
info.SetName(_("wxAnimationCtrl and wxAnimation sample")); info.SetName(_("wxAnimationCtrl and wxAnimation sample"));
info.SetDescription(_("This sample program demonstrates the usage of wxAnimationCtrl")); info.SetDescription(_("This sample program demonstrates the usage of wxAnimationCtrl"));
info.SetCopyright(wxT("(C) 2006 Julian Smart")); info.SetCopyright("(C) 2006 Julian Smart");
info.AddDeveloper(wxT("Julian Smart")); info.AddDeveloper("Julian Smart");
info.AddDeveloper(wxT("Guillermo Rodriguez Garcia")); info.AddDeveloper("Guillermo Rodriguez Garcia");
info.AddDeveloper(wxT("Francesco Montorsi")); info.AddDeveloper("Francesco Montorsi");
wxAboutBox(info, this); wxAboutBox(info, this);
} }
@@ -267,8 +267,8 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
{ {
wxFileDialog dialog(this, wxT("Please choose an animation"), wxFileDialog dialog(this, "Please choose an animation",
wxEmptyString, wxEmptyString, wxT("*.gif;*.ani"), wxFD_OPEN); wxEmptyString, wxEmptyString, "*.gif;*.ani", wxFD_OPEN);
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
{ {
wxString filename(dialog.GetPath()); wxString filename(dialog.GetPath());
@@ -278,13 +278,13 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
if (m_animationCtrl->LoadFile(filename)) if (m_animationCtrl->LoadFile(filename))
m_animationCtrl->Play(); m_animationCtrl->Play();
else else
wxMessageBox(wxT("Sorry, this animation is not a valid format for wxAnimation.")); wxMessageBox("Sorry, this animation is not a valid format for wxAnimation.");
#else #else
#if 0 #if 0
wxAnimation temp; wxAnimation temp;
if (!temp.LoadFile(filename)) if (!temp.LoadFile(filename))
{ {
wxLogError(wxT("Sorry, this animation is not a valid format for wxAnimation.")); wxLogError("Sorry, this animation is not a valid format for wxAnimation.");
return; return;
} }
@@ -294,14 +294,14 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
wxFileInputStream stream(filename); wxFileInputStream stream(filename);
if (!stream.IsOk()) if (!stream.IsOk())
{ {
wxLogError(wxT("Sorry, this animation is not a valid format for wxAnimation.")); wxLogError("Sorry, this animation is not a valid format for wxAnimation.");
return; return;
} }
wxAnimation temp; wxAnimation temp;
if (!temp.Load(stream)) if (!temp.Load(stream))
{ {
wxLogError(wxT("Sorry, this animation is not a valid format for wxAnimation.")); wxLogError("Sorry, this animation is not a valid format for wxAnimation.");
return; return;
} }

View File

@@ -132,7 +132,7 @@ wxBEGIN_EVENT_TABLE(wxArtBrowserDialog, wxDialog)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent) wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent)
: wxDialog(parent, wxID_ANY, wxT("Art resources browser"), : wxDialog(parent, wxID_ANY, "Art resources browser",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
{ {
@@ -143,7 +143,7 @@ wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent)
FillClients(choice); FillClients(choice);
subsizer = new wxBoxSizer(wxHORIZONTAL); subsizer = new wxBoxSizer(wxHORIZONTAL);
subsizer->Add(new wxStaticText(this, wxID_ANY, wxT("Client:")), 0, wxALIGN_CENTER_VERTICAL); subsizer->Add(new wxStaticText(this, wxID_ANY, "Client:"), 0, wxALIGN_CENTER_VERTICAL);
subsizer->Add(choice, 1, wxLEFT, 5); subsizer->Add(choice, 1, wxLEFT, 5);
sizer->Add(subsizer, 0, wxALL | wxEXPAND, 10); sizer->Add(subsizer, 0, wxALL | wxEXPAND, 10);
@@ -151,11 +151,11 @@ wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent)
m_list = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(250, 300), m_list = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(250, 300),
wxLC_REPORT | wxSUNKEN_BORDER); wxLC_REPORT | wxSUNKEN_BORDER);
m_list->AppendColumn(wxT("wxArtID")); m_list->AppendColumn("wxArtID");
subsizer->Add(m_list, 1, wxEXPAND | wxRIGHT, 10); subsizer->Add(m_list, 1, wxEXPAND | wxRIGHT, 10);
wxSizer *subsub = new wxBoxSizer(wxVERTICAL); wxSizer *subsub = new wxBoxSizer(wxVERTICAL);
m_text = new wxStaticText(this, wxID_ANY, wxT("Size: 333x333")); m_text = new wxStaticText(this, wxID_ANY, "Size: 333x333");
subsub->Add(m_text); subsub->Add(m_text);
m_canvas = new wxStaticBitmap(this, wxID_ANY, wxBitmap(null_xpm)); m_canvas = new wxStaticBitmap(this, wxID_ANY, wxBitmap(null_xpm));
@@ -165,7 +165,7 @@ wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent)
sizer->Add(subsizer, 1, wxEXPAND | wxLEFT|wxRIGHT, 10); sizer->Add(subsizer, 1, wxEXPAND | wxLEFT|wxRIGHT, 10);
wxButton *ok = new wxButton(this, wxID_OK, wxT("Close")); wxButton *ok = new wxButton(this, wxID_OK, "Close");
ok->SetDefault(); ok->SetDefault();
sizer->Add(ok, 0, wxALIGN_RIGHT | wxALL, 10); sizer->Add(ok, 0, wxALIGN_RIGHT | wxALL, 10);
@@ -215,6 +215,6 @@ void wxArtBrowserDialog::SetArtBitmap(const wxArtID& id, const wxArtClient& clie
wxBitmap bmp = wxArtProvider::GetBitmap(id, client, size); wxBitmap bmp = wxArtProvider::GetBitmap(id, client, size);
m_canvas->SetSize(bmp.GetWidth(), bmp.GetHeight()); m_canvas->SetSize(bmp.GetWidth(), bmp.GetHeight());
m_canvas->SetBitmap(bmp); m_canvas->SetBitmap(bmp);
m_text->SetLabel(wxString::Format(wxT("Size: %d x %d"), bmp.GetWidth(), bmp.GetHeight())); m_text->SetLabel(wxString::Format("Size: %d x %d", bmp.GetWidth(), bmp.GetHeight()));
Refresh(); Refresh();
} }

View File

@@ -99,7 +99,7 @@ bool MyApp::OnInit()
return false; return false;
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(wxT("wxArtProvider sample"), MyFrame *frame = new MyFrame("wxArtProvider sample",
wxPoint(50, 50), wxSize(450, 340)); wxPoint(50, 50), wxSize(450, 340));
frame->Show(true); frame->Show(true);
return true; return true;
@@ -156,23 +156,23 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(wxID_ABOUT, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(wxID_ABOUT, "&About\tF1", "Show about dialog");
menuFile->AppendCheckItem(ID_PlugProvider, wxT("&Plug-in art provider"), wxT("Enable custom art provider")); menuFile->AppendCheckItem(ID_PlugProvider, "&Plug-in art provider", "Enable custom art provider");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
#if wxUSE_LOG #if wxUSE_LOG
menuFile->Append(ID_Logs, wxT("&Logging test"), wxT("Show some logging output")); menuFile->Append(ID_Logs, "&Logging test", "Show some logging output");
#endif // wxUSE_LOG #endif // wxUSE_LOG
menuFile->Append(ID_Browser, wxT("&Resources browser"), wxT("Browse all available icons")); menuFile->Append(ID_Browser, "&Resources browser", "Browse all available icons");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(ID_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(ID_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -190,22 +190,22 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
#if wxUSE_LOG #if wxUSE_LOG
void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Some information.")); wxLogMessage("Some information.");
wxLogError(wxT("This is an error.")); wxLogError("This is an error.");
wxLogWarning(wxT("A warning.")); wxLogWarning("A warning.");
wxLogError(wxT("Yet another error.")); wxLogError("Yet another error.");
wxLog::GetActiveTarget()->Flush(); wxLog::GetActiveTarget()->Flush();
wxLogMessage(wxT("Check/uncheck 'File/Plug-in art provider' and try again.")); wxLogMessage("Check/uncheck 'File/Plug-in art provider' and try again.");
} }
#endif // wxUSE_LOG #endif // wxUSE_LOG
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is the about dialog of wxArtProvider sample.\n") msg.Printf( "This is the about dialog of wxArtProvider sample.\n"
wxT("Welcome to %s"), wxVERSION_STRING); "Welcome to %s", wxVERSION_STRING);
wxMessageBox(msg, wxT("About wxArtProvider sample"), wxMessageBox(msg, "About wxArtProvider sample",
wxOK | wxICON_INFORMATION, this); wxOK | wxICON_INFORMATION, this);
} }

View File

@@ -202,7 +202,7 @@ private:
wxString s; wxString s;
int h, w, height; int h, w, height;
s.Printf(wxT("Size: %d x %d"), size.x, size.y); s.Printf("Size: %d x %d", size.x, size.y);
dc.SetFont(*wxNORMAL_FONT); dc.SetFont(*wxNORMAL_FONT);
dc.GetTextExtent(s, &w, &height); dc.GetTextExtent(s, &w, &height);
@@ -219,19 +219,19 @@ private:
{ {
wxAuiPaneInfo pi = m_mgr->GetPane(this); wxAuiPaneInfo pi = m_mgr->GetPane(this);
s.Printf(wxT("Layer: %d"), pi.dock_layer); s.Printf("Layer: %d", pi.dock_layer);
dc.GetTextExtent(s, &w, &h); dc.GetTextExtent(s, &w, &h);
dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*1)); dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*1));
s.Printf(wxT("Dock: %d Row: %d"), pi.dock_direction, pi.dock_row); s.Printf("Dock: %d Row: %d", pi.dock_direction, pi.dock_row);
dc.GetTextExtent(s, &w, &h); dc.GetTextExtent(s, &w, &h);
dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*2)); dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*2));
s.Printf(wxT("Position: %d"), pi.dock_pos); s.Printf("Position: %d", pi.dock_pos);
dc.GetTextExtent(s, &w, &h); dc.GetTextExtent(s, &w, &h);
dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*3)); dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*3));
s.Printf(wxT("Proportion: %d"), pi.dock_proportion); s.Printf("Proportion: %d", pi.dock_proportion);
dc.GetTextExtent(s, &w, &h); dc.GetTextExtent(s, &w, &h);
dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*4)); dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*4));
} }
@@ -290,27 +290,27 @@ public:
//vert->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); //vert->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
wxBoxSizer* s1 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s1 = new wxBoxSizer(wxHORIZONTAL);
m_border_size = new wxSpinCtrl(this, ID_PaneBorderSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, FromDIP(100), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)); m_border_size = new wxSpinCtrl(this, ID_PaneBorderSize, wxString::Format("%d", frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, FromDIP(100), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE));
s1->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s1->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s1->Add(new wxStaticText(this, wxID_ANY, wxT("Pane Border Size:"))); s1->Add(new wxStaticText(this, wxID_ANY, "Pane Border Size:"));
s1->Add(m_border_size); s1->Add(m_border_size);
s1->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s1->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s1->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s1->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
//vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(5)); //vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(5));
wxBoxSizer* s2 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s2 = new wxBoxSizer(wxHORIZONTAL);
m_sash_size = new wxSpinCtrl(this, ID_SashSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, FromDIP(100), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE)); m_sash_size = new wxSpinCtrl(this, ID_SashSize, wxString::Format("%d", frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, FromDIP(100), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE));
s2->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s2->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s2->Add(new wxStaticText(this, wxID_ANY, wxT("Sash Size:"))); s2->Add(new wxStaticText(this, wxID_ANY, "Sash Size:"));
s2->Add(m_sash_size); s2->Add(m_sash_size);
s2->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s2->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s2->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s2->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
//vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(5)); //vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(5));
wxBoxSizer* s3 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
m_caption_size = new wxSpinCtrl(this, ID_CaptionSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, FromDIP(100), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)); m_caption_size = new wxSpinCtrl(this, ID_CaptionSize, wxString::Format("%d", frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, FromDIP(100), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE));
s3->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s3->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s3->Add(new wxStaticText(this, wxID_ANY, wxT("Caption Size:"))); s3->Add(new wxStaticText(this, wxID_ANY, "Caption Size:"));
s3->Add(m_caption_size); s3->Add(m_caption_size);
s3->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s3->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s3->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s3->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -324,7 +324,7 @@ public:
wxBoxSizer* s4 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s4 = new wxBoxSizer(wxHORIZONTAL);
m_background_color = new wxBitmapButton(this, ID_BackgroundColor, b, wxDefaultPosition, FromDIP(wxSize(50,25))); m_background_color = new wxBitmapButton(this, ID_BackgroundColor, b, wxDefaultPosition, FromDIP(wxSize(50,25)));
s4->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s4->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s4->Add(new wxStaticText(this, wxID_ANY, wxT("Background Color:"))); s4->Add(new wxStaticText(this, wxID_ANY, "Background Color:"));
s4->Add(m_background_color); s4->Add(m_background_color);
s4->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s4->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s4->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s4->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -332,7 +332,7 @@ public:
wxBoxSizer* s5 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s5 = new wxBoxSizer(wxHORIZONTAL);
m_sash_color = new wxBitmapButton(this, ID_SashColor, b, wxDefaultPosition, wxSize(50,25)); m_sash_color = new wxBitmapButton(this, ID_SashColor, b, wxDefaultPosition, wxSize(50,25));
s5->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s5->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s5->Add(new wxStaticText(this, wxID_ANY, wxT("Sash Color:"))); s5->Add(new wxStaticText(this, wxID_ANY, "Sash Color:"));
s5->Add(m_sash_color); s5->Add(m_sash_color);
s5->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s5->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s5->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s5->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -340,7 +340,7 @@ public:
wxBoxSizer* s6 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s6 = new wxBoxSizer(wxHORIZONTAL);
m_inactive_caption_color = new wxBitmapButton(this, ID_InactiveCaptionColor, b, wxDefaultPosition, wxSize(50,25)); m_inactive_caption_color = new wxBitmapButton(this, ID_InactiveCaptionColor, b, wxDefaultPosition, wxSize(50,25));
s6->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s6->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s6->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption:"))); s6->Add(new wxStaticText(this, wxID_ANY, "Normal Caption:"));
s6->Add(m_inactive_caption_color); s6->Add(m_inactive_caption_color);
s6->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s6->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s6->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s6->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -348,7 +348,7 @@ public:
wxBoxSizer* s7 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s7 = new wxBoxSizer(wxHORIZONTAL);
m_inactive_caption_gradient_color = new wxBitmapButton(this, ID_InactiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25)); m_inactive_caption_gradient_color = new wxBitmapButton(this, ID_InactiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25));
s7->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s7->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s7->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption Gradient:"))); s7->Add(new wxStaticText(this, wxID_ANY, "Normal Caption Gradient:"));
s7->Add(m_inactive_caption_gradient_color); s7->Add(m_inactive_caption_gradient_color);
s7->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s7->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s7->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s7->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -356,7 +356,7 @@ public:
wxBoxSizer* s8 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s8 = new wxBoxSizer(wxHORIZONTAL);
m_inactive_caption_text_color = new wxBitmapButton(this, ID_InactiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25)); m_inactive_caption_text_color = new wxBitmapButton(this, ID_InactiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25));
s8->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s8->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s8->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption Text:"))); s8->Add(new wxStaticText(this, wxID_ANY, "Normal Caption Text:"));
s8->Add(m_inactive_caption_text_color); s8->Add(m_inactive_caption_text_color);
s8->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s8->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s8->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s8->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -364,7 +364,7 @@ public:
wxBoxSizer* s9 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s9 = new wxBoxSizer(wxHORIZONTAL);
m_active_caption_color = new wxBitmapButton(this, ID_ActiveCaptionColor, b, wxDefaultPosition, wxSize(50,25)); m_active_caption_color = new wxBitmapButton(this, ID_ActiveCaptionColor, b, wxDefaultPosition, wxSize(50,25));
s9->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s9->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s9->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption:"))); s9->Add(new wxStaticText(this, wxID_ANY, "Active Caption:"));
s9->Add(m_active_caption_color); s9->Add(m_active_caption_color);
s9->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s9->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s9->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s9->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -372,7 +372,7 @@ public:
wxBoxSizer* s10 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s10 = new wxBoxSizer(wxHORIZONTAL);
m_active_caption_gradient_color = new wxBitmapButton(this, ID_ActiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25)); m_active_caption_gradient_color = new wxBitmapButton(this, ID_ActiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25));
s10->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s10->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s10->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption Gradient:"))); s10->Add(new wxStaticText(this, wxID_ANY, "Active Caption Gradient:"));
s10->Add(m_active_caption_gradient_color); s10->Add(m_active_caption_gradient_color);
s10->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s10->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s10->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s10->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -380,7 +380,7 @@ public:
wxBoxSizer* s11 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s11 = new wxBoxSizer(wxHORIZONTAL);
m_active_caption_text_color = new wxBitmapButton(this, ID_ActiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25)); m_active_caption_text_color = new wxBitmapButton(this, ID_ActiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25));
s11->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s11->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s11->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption Text:"))); s11->Add(new wxStaticText(this, wxID_ANY, "Active Caption Text:"));
s11->Add(m_active_caption_text_color); s11->Add(m_active_caption_text_color);
s11->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s11->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s11->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s11->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -388,7 +388,7 @@ public:
wxBoxSizer* s12 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s12 = new wxBoxSizer(wxHORIZONTAL);
m_border_color = new wxBitmapButton(this, ID_BorderColor, b, wxDefaultPosition, wxSize(50,25)); m_border_color = new wxBitmapButton(this, ID_BorderColor, b, wxDefaultPosition, wxSize(50,25));
s12->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s12->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s12->Add(new wxStaticText(this, wxID_ANY, wxT("Border Color:"))); s12->Add(new wxStaticText(this, wxID_ANY, "Border Color:"));
s12->Add(m_border_color); s12->Add(m_border_color);
s12->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s12->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s12->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s12->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -396,7 +396,7 @@ public:
wxBoxSizer* s13 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s13 = new wxBoxSizer(wxHORIZONTAL);
m_gripper_color = new wxBitmapButton(this, ID_GripperColor, b, wxDefaultPosition, wxSize(50,25)); m_gripper_color = new wxBitmapButton(this, ID_GripperColor, b, wxDefaultPosition, wxSize(50,25));
s13->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s13->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s13->Add(new wxStaticText(this, wxID_ANY, wxT("Gripper Color:"))); s13->Add(new wxStaticText(this, wxID_ANY, "Gripper Color:"));
s13->Add(m_gripper_color); s13->Add(m_gripper_color);
s13->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND); s13->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
s13->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20))); s13->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
@@ -567,7 +567,7 @@ bool MyApp::OnInit()
wxFrame* frame = new MyFrame(NULL, wxFrame* frame = new MyFrame(NULL,
wxID_ANY, wxID_ANY,
wxT("wxAUI Sample Application"), "wxAUI Sample Application",
wxDefaultPosition, wxDefaultPosition,
wxWindow::FromDIP(wxSize(800, 600), NULL)); wxWindow::FromDIP(wxSize(800, 600), NULL));
frame->Show(); frame->Show();
@@ -783,12 +783,12 @@ MyFrame::MyFrame(wxWindow* parent,
wxAuiToolBar* tb1 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAuiToolBar* tb1 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW); wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW);
tb1->SetToolBitmapSize(FromDIP(wxSize(48,48))); tb1->SetToolBitmapSize(FromDIP(wxSize(48,48)));
tb1->AddTool(ID_SampleItem+1, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR)); tb1->AddTool(ID_SampleItem+1, "Test", wxArtProvider::GetBitmap(wxART_ERROR));
tb1->AddSeparator(); tb1->AddSeparator();
tb1->AddTool(ID_SampleItem+2, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION)); tb1->AddTool(ID_SampleItem+2, "Test", wxArtProvider::GetBitmap(wxART_QUESTION));
tb1->AddTool(ID_SampleItem+3, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION)); tb1->AddTool(ID_SampleItem+3, "Test", wxArtProvider::GetBitmap(wxART_INFORMATION));
tb1->AddTool(ID_SampleItem+4, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING)); tb1->AddTool(ID_SampleItem+4, "Test", wxArtProvider::GetBitmap(wxART_WARNING));
tb1->AddTool(ID_SampleItem+5, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE)); tb1->AddTool(ID_SampleItem+5, "Test", wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
tb1->SetCustomOverflowItems(prepend_items, append_items); tb1->SetCustomOverflowItems(prepend_items, append_items);
tb1->Realize(); tb1->Realize();
@@ -798,18 +798,18 @@ MyFrame::MyFrame(wxWindow* parent,
tb2->SetToolBitmapSize(FromDIP(wxSize(16,16))); tb2->SetToolBitmapSize(FromDIP(wxSize(16,16)));
wxBitmap tb2_bmp1 = wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, FromDIP(wxSize(16,16))); wxBitmap tb2_bmp1 = wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, FromDIP(wxSize(16,16)));
tb2->AddTool(ID_SampleItem+6, wxT("Disabled"), tb2_bmp1); tb2->AddTool(ID_SampleItem+6, "Disabled", tb2_bmp1);
tb2->AddTool(ID_SampleItem+7, wxT("Test"), tb2_bmp1); tb2->AddTool(ID_SampleItem+7, "Test", tb2_bmp1);
tb2->AddTool(ID_SampleItem+8, wxT("Test"), tb2_bmp1); tb2->AddTool(ID_SampleItem+8, "Test", tb2_bmp1);
tb2->AddTool(ID_SampleItem+9, wxT("Test"), tb2_bmp1); tb2->AddTool(ID_SampleItem+9, "Test", tb2_bmp1);
tb2->AddSeparator(); tb2->AddSeparator();
tb2->AddTool(ID_SampleItem+10, wxT("Test"), tb2_bmp1); tb2->AddTool(ID_SampleItem+10, "Test", tb2_bmp1);
tb2->AddTool(ID_SampleItem+11, wxT("Test"), tb2_bmp1); tb2->AddTool(ID_SampleItem+11, "Test", tb2_bmp1);
tb2->AddSeparator(); tb2->AddSeparator();
tb2->AddTool(ID_SampleItem+12, wxT("Test"), tb2_bmp1); tb2->AddTool(ID_SampleItem+12, "Test", tb2_bmp1);
tb2->AddTool(ID_SampleItem+13, wxT("Test"), tb2_bmp1); tb2->AddTool(ID_SampleItem+13, "Test", tb2_bmp1);
tb2->AddTool(ID_SampleItem+14, wxT("Test"), tb2_bmp1); tb2->AddTool(ID_SampleItem+14, "Test", tb2_bmp1);
tb2->AddTool(ID_SampleItem+15, wxT("Test"), tb2_bmp1); tb2->AddTool(ID_SampleItem+15, "Test", tb2_bmp1);
tb2->SetCustomOverflowItems(prepend_items, append_items); tb2->SetCustomOverflowItems(prepend_items, append_items);
tb2->EnableTool(ID_SampleItem+6, false); tb2->EnableTool(ID_SampleItem+6, false);
tb2->Realize(); tb2->Realize();
@@ -819,18 +819,18 @@ MyFrame::MyFrame(wxWindow* parent,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW); wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW);
tb3->SetToolBitmapSize(FromDIP(wxSize(16,16))); tb3->SetToolBitmapSize(FromDIP(wxSize(16,16)));
wxBitmap tb3_bmp1 = wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, FromDIP(wxSize(16,16))); wxBitmap tb3_bmp1 = wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, FromDIP(wxSize(16,16)));
tb3->AddTool(ID_SampleItem+16, wxT("Check 1"), tb3_bmp1, wxT("Check 1"), wxITEM_CHECK); tb3->AddTool(ID_SampleItem+16, "Check 1", tb3_bmp1, "Check 1", wxITEM_CHECK);
tb3->AddTool(ID_SampleItem+17, wxT("Check 2"), tb3_bmp1, wxT("Check 2"), wxITEM_CHECK); tb3->AddTool(ID_SampleItem+17, "Check 2", tb3_bmp1, "Check 2", wxITEM_CHECK);
tb3->AddTool(ID_SampleItem+18, wxT("Check 3"), tb3_bmp1, wxT("Check 3"), wxITEM_CHECK); tb3->AddTool(ID_SampleItem+18, "Check 3", tb3_bmp1, "Check 3", wxITEM_CHECK);
tb3->AddTool(ID_SampleItem+19, wxT("Check 4"), tb3_bmp1, wxT("Check 4"), wxITEM_CHECK); tb3->AddTool(ID_SampleItem+19, "Check 4", tb3_bmp1, "Check 4", wxITEM_CHECK);
tb3->AddSeparator(); tb3->AddSeparator();
tb3->AddTool(ID_SampleItem+20, wxT("Radio 1"), tb3_bmp1, wxT("Radio 1"), wxITEM_RADIO); tb3->AddTool(ID_SampleItem+20, "Radio 1", tb3_bmp1, "Radio 1", wxITEM_RADIO);
tb3->AddTool(ID_SampleItem+21, wxT("Radio 2"), tb3_bmp1, wxT("Radio 2"), wxITEM_RADIO); tb3->AddTool(ID_SampleItem+21, "Radio 2", tb3_bmp1, "Radio 2", wxITEM_RADIO);
tb3->AddTool(ID_SampleItem+22, wxT("Radio 3"), tb3_bmp1, wxT("Radio 3"), wxITEM_RADIO); tb3->AddTool(ID_SampleItem+22, "Radio 3", tb3_bmp1, "Radio 3", wxITEM_RADIO);
tb3->AddSeparator(); tb3->AddSeparator();
tb3->AddTool(ID_SampleItem+23, wxT("Radio 1 (Group 2)"), tb3_bmp1, wxT("Radio 1 (Group 2)"), wxITEM_RADIO); tb3->AddTool(ID_SampleItem+23, "Radio 1 (Group 2)", tb3_bmp1, "Radio 1 (Group 2)", wxITEM_RADIO);
tb3->AddTool(ID_SampleItem+24, wxT("Radio 2 (Group 2)"), tb3_bmp1, wxT("Radio 2 (Group 2)"), wxITEM_RADIO); tb3->AddTool(ID_SampleItem+24, "Radio 2 (Group 2)", tb3_bmp1, "Radio 2 (Group 2)", wxITEM_RADIO);
tb3->AddTool(ID_SampleItem+25, wxT("Radio 3 (Group 2)"), tb3_bmp1, wxT("Radio 3 (Group 2)"), wxITEM_RADIO); tb3->AddTool(ID_SampleItem+25, "Radio 3 (Group 2)", tb3_bmp1, "Radio 3 (Group 2)", wxITEM_RADIO);
tb3->SetCustomOverflowItems(prepend_items, append_items); tb3->SetCustomOverflowItems(prepend_items, append_items);
tb3->Realize(); tb3->Realize();
@@ -842,20 +842,20 @@ MyFrame::MyFrame(wxWindow* parent,
wxAUI_TB_HORZ_TEXT); wxAUI_TB_HORZ_TEXT);
tb4->SetToolBitmapSize(FromDIP(wxSize(16,16))); tb4->SetToolBitmapSize(FromDIP(wxSize(16,16)));
wxBitmap tb4_bmp1 = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, FromDIP(wxSize(16,16))); wxBitmap tb4_bmp1 = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, FromDIP(wxSize(16,16)));
tb4->AddTool(ID_DropDownToolbarItem, wxT("Item 1"), tb4_bmp1); tb4->AddTool(ID_DropDownToolbarItem, "Item 1", tb4_bmp1);
tb4->AddTool(ID_SampleItem+23, wxT("Item 2"), tb4_bmp1); tb4->AddTool(ID_SampleItem+23, "Item 2", tb4_bmp1);
tb4->AddTool(ID_SampleItem+24, wxT("Item 3"), tb4_bmp1); tb4->AddTool(ID_SampleItem+24, "Item 3", tb4_bmp1);
tb4->AddTool(ID_SampleItem+25, wxT("Item 4"), tb4_bmp1); tb4->AddTool(ID_SampleItem+25, "Item 4", tb4_bmp1);
tb4->AddSeparator(); tb4->AddSeparator();
tb4->AddTool(ID_SampleItem+26, wxT("Item 5"), tb4_bmp1); tb4->AddTool(ID_SampleItem+26, "Item 5", tb4_bmp1);
tb4->AddTool(ID_SampleItem+27, wxT("Item 6"), tb4_bmp1); tb4->AddTool(ID_SampleItem+27, "Item 6", tb4_bmp1);
tb4->AddTool(ID_SampleItem+28, wxT("Item 7"), tb4_bmp1); tb4->AddTool(ID_SampleItem+28, "Item 7", tb4_bmp1);
tb4->AddTool(ID_SampleItem+29, wxT("Item 8"), tb4_bmp1); tb4->AddTool(ID_SampleItem+29, "Item 8", tb4_bmp1);
tb4->SetToolDropDown(ID_DropDownToolbarItem, true); tb4->SetToolDropDown(ID_DropDownToolbarItem, true);
tb4->SetCustomOverflowItems(prepend_items, append_items); tb4->SetCustomOverflowItems(prepend_items, append_items);
wxChoice* choice = new wxChoice(tb4, ID_SampleItem+35); wxChoice* choice = new wxChoice(tb4, ID_SampleItem+35);
choice->AppendString(wxT("One choice")); choice->AppendString("One choice");
choice->AppendString(wxT("Another choice")); choice->AppendString("Another choice");
tb4->AddControl(choice); tb4->AddControl(choice);
tb4->Realize(); tb4->Realize();
@@ -863,60 +863,60 @@ MyFrame::MyFrame(wxWindow* parent,
wxAuiToolBar* tb5 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAuiToolBar* tb5 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_VERTICAL); wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_VERTICAL);
tb5->SetToolBitmapSize(FromDIP(wxSize(48,48))); tb5->SetToolBitmapSize(FromDIP(wxSize(48,48)));
tb5->AddTool(ID_SampleItem+30, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR)); tb5->AddTool(ID_SampleItem+30, "Test", wxArtProvider::GetBitmap(wxART_ERROR));
tb5->AddSeparator(); tb5->AddSeparator();
tb5->AddTool(ID_SampleItem+31, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION)); tb5->AddTool(ID_SampleItem+31, "Test", wxArtProvider::GetBitmap(wxART_QUESTION));
tb5->AddTool(ID_SampleItem+32, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION)); tb5->AddTool(ID_SampleItem+32, "Test", wxArtProvider::GetBitmap(wxART_INFORMATION));
tb5->AddTool(ID_SampleItem+33, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING)); tb5->AddTool(ID_SampleItem+33, "Test", wxArtProvider::GetBitmap(wxART_WARNING));
tb5->AddTool(ID_SampleItem+34, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE)); tb5->AddTool(ID_SampleItem+34, "Test", wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
tb5->SetCustomOverflowItems(prepend_items, append_items); tb5->SetCustomOverflowItems(prepend_items, append_items);
tb5->Realize(); tb5->Realize();
// add a bunch of panes // add a bunch of panes
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test1")).Caption(wxT("Pane Caption")). Name("test1").Caption("Pane Caption").
Top()); Top());
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test2")).Caption(wxT("Client Size Reporter")). Name("test2").Caption("Client Size Reporter").
Bottom().Position(1). Bottom().Position(1).
CloseButton(true).MaximizeButton(true)); CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test3")).Caption(wxT("Client Size Reporter")). Name("test3").Caption("Client Size Reporter").
Bottom(). Bottom().
CloseButton(true).MaximizeButton(true)); CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test4")).Caption(wxT("Pane Caption")). Name("test4").Caption("Pane Caption").
Left()); Left());
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test5")).Caption(wxT("No Close Button")). Name("test5").Caption("No Close Button").
Right().CloseButton(false)); Right().CloseButton(false));
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test6")).Caption(wxT("Client Size Reporter")). Name("test6").Caption("Client Size Reporter").
Right().Row(1). Right().Row(1).
CloseButton(true).MaximizeButton(true)); CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test7")).Caption(wxT("Client Size Reporter")). Name("test7").Caption("Client Size Reporter").
Left().Layer(1). Left().Layer(1).
CloseButton(true).MaximizeButton(true)); CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
Name(wxT("test8")).Caption(wxT("Tree Pane")). Name("test8").Caption("Tree Pane").
Left().Layer(1).Position(1). Left().Layer(1).Position(1).
CloseButton(true).MaximizeButton(true)); CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test9")).Caption(wxT("Min Size 200x100")). Name("test9").Caption("Min Size 200x100").
BestSize(FromDIP(wxSize(200,100))).MinSize(FromDIP(wxSize(200,100))). BestSize(FromDIP(wxSize(200,100))).MinSize(FromDIP(wxSize(200,100))).
Bottom().Layer(1). Bottom().Layer(1).
CloseButton(true).MaximizeButton(true)); CloseButton(true).MaximizeButton(true));
wxWindow* wnd10 = CreateTextCtrl(wxT("This pane will prompt the user before hiding.")); wxWindow* wnd10 = CreateTextCtrl("This pane will prompt the user before hiding.");
// Give this pane an icon, too, just for testing. // Give this pane an icon, too, just for testing.
int iconSize = m_mgr.GetArtProvider()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE); int iconSize = m_mgr.GetArtProvider()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE);
@@ -925,65 +925,65 @@ MyFrame::MyFrame(wxWindow* parent,
iconSize &= ~1; iconSize &= ~1;
m_mgr.AddPane(wnd10, wxAuiPaneInfo(). m_mgr.AddPane(wnd10, wxAuiPaneInfo().
Name(wxT("test10")).Caption(wxT("Text Pane with Hide Prompt")). Name("test10").Caption("Text Pane with Hide Prompt").
Bottom().Layer(1).Position(1). Bottom().Layer(1).Position(1).
Icon(wxArtProvider::GetBitmap(wxART_WARNING, Icon(wxArtProvider::GetBitmap(wxART_WARNING,
wxART_OTHER, wxART_OTHER,
wxSize(iconSize, iconSize)))); wxSize(iconSize, iconSize))));
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test11")).Caption(wxT("Fixed Pane")). Name("test11").Caption("Fixed Pane").
Bottom().Layer(1).Position(2).Fixed()); Bottom().Layer(1).Position(2).Fixed());
m_mgr.AddPane(new SettingsPanel(this,this), wxAuiPaneInfo(). m_mgr.AddPane(new SettingsPanel(this,this), wxAuiPaneInfo().
Name(wxT("settings")).Caption(wxT("Dock Manager Settings")). Name("settings").Caption("Dock Manager Settings").
Dockable(false).Float().Hide()); Dockable(false).Float().Hide());
// create some center panes // create some center panes
m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().Name(wxT("grid_content")). m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().Name("grid_content").
CenterPane().Hide()); CenterPane().Hide());
m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().Name(wxT("tree_content")). m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().Name("tree_content").
CenterPane().Hide()); CenterPane().Hide());
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().Name(wxT("sizereport_content")). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().Name("sizereport_content").
CenterPane().Hide()); CenterPane().Hide());
m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().Name(wxT("text_content")). m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().Name("text_content").
CenterPane().Hide()); CenterPane().Hide());
m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().Name(wxT("html_content")). m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().Name("html_content").
CenterPane().Hide()); CenterPane().Hide());
m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().Name(wxT("notebook_content")). m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().Name("notebook_content").
CenterPane().PaneBorder(false)); CenterPane().PaneBorder(false));
// add the toolbars to the manager // add the toolbars to the manager
m_mgr.AddPane(tb1, wxAuiPaneInfo(). m_mgr.AddPane(tb1, wxAuiPaneInfo().
Name(wxT("tb1")).Caption(wxT("Big Toolbar")). Name("tb1").Caption("Big Toolbar").
ToolbarPane().Top()); ToolbarPane().Top());
m_mgr.AddPane(tb2, wxAuiPaneInfo(). m_mgr.AddPane(tb2, wxAuiPaneInfo().
Name(wxT("tb2")).Caption(wxT("Toolbar 2 (Horizontal)")). Name("tb2").Caption("Toolbar 2 (Horizontal)").
ToolbarPane().Top().Row(1)); ToolbarPane().Top().Row(1));
m_mgr.AddPane(tb3, wxAuiPaneInfo(). m_mgr.AddPane(tb3, wxAuiPaneInfo().
Name(wxT("tb3")).Caption(wxT("Toolbar 3")). Name("tb3").Caption("Toolbar 3").
ToolbarPane().Top().Row(1).Position(1)); ToolbarPane().Top().Row(1).Position(1));
m_mgr.AddPane(tb4, wxAuiPaneInfo(). m_mgr.AddPane(tb4, wxAuiPaneInfo().
Name(wxT("tb4")).Caption(wxT("Sample Bookmark Toolbar")). Name("tb4").Caption("Sample Bookmark Toolbar").
ToolbarPane().Top().Row(2)); ToolbarPane().Top().Row(2));
m_mgr.AddPane(tb5, wxAuiPaneInfo(). m_mgr.AddPane(tb5, wxAuiPaneInfo().
Name(wxT("tb5")).Caption(wxT("Sample Vertical Toolbar")). Name("tb5").Caption("Sample Vertical Toolbar").
ToolbarPane().Left(). ToolbarPane().Left().
GripperTop()); GripperTop());
m_mgr.AddPane(new wxButton(this, wxID_ANY, _("Test Button")), m_mgr.AddPane(new wxButton(this, wxID_ANY, _("Test Button")),
wxAuiPaneInfo().Name(wxT("tb6")). wxAuiPaneInfo().Name("tb6").
ToolbarPane().Top().Row(2).Position(1). ToolbarPane().Top().Row(2).Position(1).
LeftDockable(false).RightDockable(false)); LeftDockable(false).RightDockable(false));
@@ -996,11 +996,11 @@ MyFrame::MyFrame(wxWindow* parent,
for (i = 0, count = all_panes.GetCount(); i < count; ++i) for (i = 0, count = all_panes.GetCount(); i < count; ++i)
if (!all_panes.Item(i).IsToolbar()) if (!all_panes.Item(i).IsToolbar())
all_panes.Item(i).Hide(); all_panes.Item(i).Hide();
m_mgr.GetPane(wxT("tb1")).Hide(); m_mgr.GetPane("tb1").Hide();
m_mgr.GetPane(wxT("tb6")).Hide(); m_mgr.GetPane("tb6").Hide();
m_mgr.GetPane(wxT("test8")).Show().Left().Layer(0).Row(0).Position(0); m_mgr.GetPane("test8").Show().Left().Layer(0).Row(0).Position(0);
m_mgr.GetPane(wxT("test10")).Show().Bottom().Layer(0).Row(0).Position(0); m_mgr.GetPane("test10").Show().Bottom().Layer(0).Row(0).Position(0);
m_mgr.GetPane(wxT("notebook_content")).Show(); m_mgr.GetPane("notebook_content").Show();
wxString perspective_default = m_mgr.SavePerspective(); wxString perspective_default = m_mgr.SavePerspective();
m_perspectives.Add(perspective_default); m_perspectives.Add(perspective_default);
@@ -1038,7 +1038,7 @@ void MyFrame::OnSize(wxSizeEvent& event)
void MyFrame::OnSettings(wxCommandEvent& WXUNUSED(evt)) void MyFrame::OnSettings(wxCommandEvent& WXUNUSED(evt))
{ {
// show the settings pane, and float it // show the settings pane, and float it
wxAuiPaneInfo& floating_pane = m_mgr.GetPane(wxT("settings")).Float().Show(); wxAuiPaneInfo& floating_pane = m_mgr.GetPane("settings").Float().Show();
if (floating_pane.floating_pos == wxDefaultPosition) if (floating_pane.floating_pos == wxDefaultPosition)
floating_pane.FloatingPosition(GetStartPosition()); floating_pane.FloatingPosition(GetStartPosition());
@@ -1091,7 +1091,7 @@ void MyFrame::OnManagerFlag(wxCommandEvent& event)
event.GetId() == ID_TransparentHint || event.GetId() == ID_TransparentHint ||
event.GetId() == ID_HintFade) event.GetId() == ID_HintFade)
{ {
wxMessageBox(wxT("This option is presently only available on wxGTK, wxMSW and wxMac")); wxMessageBox("This option is presently only available on wxGTK, wxMSW and wxMac");
return; return;
} }
#endif #endif
@@ -1312,10 +1312,10 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
void MyFrame::OnPaneClose(wxAuiManagerEvent& evt) void MyFrame::OnPaneClose(wxAuiManagerEvent& evt)
{ {
if (evt.pane->name == wxT("test10")) if (evt.pane->name == "test10")
{ {
int res = wxMessageBox(wxT("Are you sure you want to close/hide this pane?"), int res = wxMessageBox("Are you sure you want to close/hide this pane?",
wxT("wxAUI"), "wxAUI",
wxYES_NO, wxYES_NO,
this); this);
if (res != wxYES) if (res != wxYES)
@@ -1325,10 +1325,10 @@ void MyFrame::OnPaneClose(wxAuiManagerEvent& evt)
void MyFrame::OnCreatePerspective(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCreatePerspective(wxCommandEvent& WXUNUSED(event))
{ {
wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"), wxTextEntryDialog dlg(this, "Enter a name for the new perspective:",
wxT("wxAUI Test")); "wxAUI Test");
dlg.SetValue(wxString::Format(wxT("Perspective %u"), unsigned(m_perspectives.GetCount() + 1))); dlg.SetValue(wxString::Format("Perspective %u", unsigned(m_perspectives.GetCount() + 1)));
if (dlg.ShowModal() != wxID_OK) if (dlg.ShowModal() != wxID_OK)
return; return;
@@ -1364,8 +1364,8 @@ void MyFrame::OnNotebookPageClose(wxAuiNotebookEvent& evt)
wxAuiNotebook* ctrl = (wxAuiNotebook*)evt.GetEventObject(); wxAuiNotebook* ctrl = (wxAuiNotebook*)evt.GetEventObject();
if (ctrl->GetPage(evt.GetSelection())->IsKindOf(CLASSINFO(wxHtmlWindow))) if (ctrl->GetPage(evt.GetSelection())->IsKindOf(CLASSINFO(wxHtmlWindow)))
{ {
int res = wxMessageBox(wxT("Are you sure you want to close/hide this notebook page?"), int res = wxMessageBox("Are you sure you want to close/hide this notebook page?",
wxT("wxAUI"), "wxAUI",
wxYES_NO, wxYES_NO,
this); this);
if (res != wxYES) if (res != wxYES)
@@ -1405,7 +1405,7 @@ wxPoint MyFrame::GetStartPosition()
void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event))
{ {
m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
Caption(wxT("Tree Control")). Caption("Tree Control").
Float().FloatingPosition(GetStartPosition()). Float().FloatingPosition(GetStartPosition()).
FloatingSize(FromDIP(wxSize(150,300)))); FloatingSize(FromDIP(wxSize(150,300))));
m_mgr.Update(); m_mgr.Update();
@@ -1414,7 +1414,7 @@ void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event))
{ {
m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo(). m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().
Caption(wxT("Grid")). Caption("Grid").
Float().FloatingPosition(GetStartPosition()). Float().FloatingPosition(GetStartPosition()).
FloatingSize(FromDIP(wxSize(300,200)))); FloatingSize(FromDIP(wxSize(300,200))));
m_mgr.Update(); m_mgr.Update();
@@ -1423,7 +1423,7 @@ void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event))
{ {
m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().
Caption(wxT("HTML Control")). Caption("HTML Control").
Float().FloatingPosition(GetStartPosition()). Float().FloatingPosition(GetStartPosition()).
FloatingSize(FromDIP(wxSize(300,200)))); FloatingSize(FromDIP(wxSize(300,200))));
m_mgr.Update(); m_mgr.Update();
@@ -1432,7 +1432,7 @@ void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event))
{ {
m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo(). m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().
Caption(wxT("Notebook")). Caption("Notebook").
Float().FloatingPosition(GetStartPosition()). Float().FloatingPosition(GetStartPosition()).
//FloatingSize(FromDIP(wxSize(300,200))). //FloatingSize(FromDIP(wxSize(300,200))).
CloseButton(true).MaximizeButton(true)); CloseButton(true).MaximizeButton(true));
@@ -1442,7 +1442,7 @@ void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnCreateText(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCreateText(wxCommandEvent& WXUNUSED(event))
{ {
m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().
Caption(wxT("Text Control")). Caption("Text Control").
Float().FloatingPosition(GetStartPosition())); Float().FloatingPosition(GetStartPosition()));
m_mgr.Update(); m_mgr.Update();
} }
@@ -1450,7 +1450,7 @@ void MyFrame::OnCreateText(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnCreateSizeReport(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCreateSizeReport(wxCommandEvent& WXUNUSED(event))
{ {
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Caption(wxT("Client Size Reporter")). Caption("Client Size Reporter").
Float().FloatingPosition(GetStartPosition()). Float().FloatingPosition(GetStartPosition()).
CloseButton(true).MaximizeButton(true)); CloseButton(true).MaximizeButton(true));
m_mgr.Update(); m_mgr.Update();
@@ -1458,12 +1458,12 @@ void MyFrame::OnCreateSizeReport(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnChangeContentPane(wxCommandEvent& evt) void MyFrame::OnChangeContentPane(wxCommandEvent& evt)
{ {
m_mgr.GetPane(wxT("grid_content")).Show(evt.GetId() == ID_GridContent); m_mgr.GetPane("grid_content").Show(evt.GetId() == ID_GridContent);
m_mgr.GetPane(wxT("text_content")).Show(evt.GetId() == ID_TextContent); m_mgr.GetPane("text_content").Show(evt.GetId() == ID_TextContent);
m_mgr.GetPane(wxT("tree_content")).Show(evt.GetId() == ID_TreeContent); m_mgr.GetPane("tree_content").Show(evt.GetId() == ID_TreeContent);
m_mgr.GetPane(wxT("sizereport_content")).Show(evt.GetId() == ID_SizeReportContent); m_mgr.GetPane("sizereport_content").Show(evt.GetId() == ID_SizeReportContent);
m_mgr.GetPane(wxT("html_content")).Show(evt.GetId() == ID_HTMLContent); m_mgr.GetPane("html_content").Show(evt.GetId() == ID_HTMLContent);
m_mgr.GetPane(wxT("notebook_content")).Show(evt.GetId() == ID_NotebookContent); m_mgr.GetPane("notebook_content").Show(evt.GetId() == ID_NotebookContent);
m_mgr.Update(); m_mgr.Update();
} }
@@ -1553,7 +1553,7 @@ wxTextCtrl* MyFrame::CreateTextCtrl(const wxString& ctrl_text)
if ( !ctrl_text.empty() ) if ( !ctrl_text.empty() )
text = ctrl_text; text = ctrl_text;
else else
text.Printf(wxT("This is text box %d"), ++n); text.Printf("This is text box %d", ++n);
return new wxTextCtrl(this,wxID_ANY, text, return new wxTextCtrl(this,wxID_ANY, text,
wxPoint(0,0), FromDIP(wxSize(150,90)), wxPoint(0,0), FromDIP(wxSize(150,90)),
@@ -1584,27 +1584,27 @@ wxTreeCtrl* MyFrame::CreateTreeCtrl()
imglist->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, size)); imglist->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, size));
tree->AssignImageList(imglist); tree->AssignImageList(imglist);
wxTreeItemId root = tree->AddRoot(wxT("wxAUI Project"), 0); wxTreeItemId root = tree->AddRoot("wxAUI Project", 0);
wxArrayTreeItemIds items; wxArrayTreeItemIds items;
items.Add(tree->AppendItem(root, wxT("Item 1"), 0)); items.Add(tree->AppendItem(root, "Item 1", 0));
items.Add(tree->AppendItem(root, wxT("Item 2"), 0)); items.Add(tree->AppendItem(root, "Item 2", 0));
items.Add(tree->AppendItem(root, wxT("Item 3"), 0)); items.Add(tree->AppendItem(root, "Item 3", 0));
items.Add(tree->AppendItem(root, wxT("Item 4"), 0)); items.Add(tree->AppendItem(root, "Item 4", 0));
items.Add(tree->AppendItem(root, wxT("Item 5"), 0)); items.Add(tree->AppendItem(root, "Item 5", 0));
int i, count; int i, count;
for (i = 0, count = items.Count(); i < count; ++i) for (i = 0, count = items.Count(); i < count; ++i)
{ {
wxTreeItemId id = items.Item(i); wxTreeItemId id = items.Item(i);
tree->AppendItem(id, wxT("Subitem 1"), 1); tree->AppendItem(id, "Subitem 1", 1);
tree->AppendItem(id, wxT("Subitem 2"), 1); tree->AppendItem(id, "Subitem 2", 1);
tree->AppendItem(id, wxT("Subitem 3"), 1); tree->AppendItem(id, "Subitem 3", 1);
tree->AppendItem(id, wxT("Subitem 4"), 1); tree->AppendItem(id, "Subitem 4", 1);
tree->AppendItem(id, wxT("Subitem 5"), 1); tree->AppendItem(id, "Subitem 5", 1);
} }
@@ -1646,7 +1646,7 @@ wxAuiNotebook* MyFrame::CreateNotebook()
wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, FromDIP(wxSize(16,16))); wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, FromDIP(wxSize(16,16)));
ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI") , false, page_bmp); ctrl->AddPage(CreateHTMLCtrl(ctrl), "Welcome to wxAUI" , false, page_bmp);
ctrl->SetPageToolTip(0, "Welcome to wxAUI (this is a page tooltip)"); ctrl->SetPageToolTip(0, "Welcome to wxAUI (this is a page tooltip)");
wxPanel *panel = new wxPanel( ctrl, wxID_ANY ); wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
@@ -1655,42 +1655,42 @@ wxAuiNotebook* MyFrame::CreateNotebook()
flex->AddGrowableRow( 3 ); flex->AddGrowableRow( 3 );
flex->AddGrowableCol( 1 ); flex->AddGrowableCol( 1 );
flex->Add( FromDIP(5), FromDIP(5) ); flex->Add( FromDIP(5), FromDIP(5) ); flex->Add( FromDIP(5), FromDIP(5) ); flex->Add( FromDIP(5), FromDIP(5) );
flex->Add( new wxStaticText( panel, -1, wxT("wxTextCtrl:") ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) ); flex->Add( new wxStaticText( panel, -1, "wxTextCtrl:" ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
flex->Add( new wxTextCtrl( panel, -1, wxT(""), wxDefaultPosition, FromDIP(wxSize(100,-1))), flex->Add( new wxTextCtrl( panel, -1, "", wxDefaultPosition, FromDIP(wxSize(100,-1))),
1, wxALL|wxALIGN_CENTRE, FromDIP(5) ); 1, wxALL|wxALIGN_CENTRE, FromDIP(5) );
flex->Add( new wxStaticText( panel, -1, wxT("wxSpinCtrl:") ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) ); flex->Add( new wxStaticText( panel, -1, "wxSpinCtrl:" ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
flex->Add( new wxSpinCtrl( panel, -1, wxT("5"), wxDefaultPosition, wxDefaultSize, flex->Add( new wxSpinCtrl( panel, -1, "5", wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) ); wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
flex->Add( FromDIP(5), FromDIP(5) ); flex->Add( FromDIP(5), FromDIP(5) ); flex->Add( FromDIP(5), FromDIP(5) ); flex->Add( FromDIP(5), FromDIP(5) );
panel->SetSizer( flex ); panel->SetSizer( flex );
ctrl->AddPage( panel, wxT("wxPanel"), false, page_bmp ); ctrl->AddPage( panel, "wxPanel", false, page_bmp );
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some text"), ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some text",
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1"), false, page_bmp ); wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 1", false, page_bmp );
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 2") ); wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 2" );
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 3") ); wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 3" );
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 4") ); wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 4" );
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 5") ); wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 5" );
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 6") ); wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 6" );
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 7 (longer title)") ); wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 7 (longer title)" );
ctrl->SetPageToolTip(ctrl->GetPageCount()-1, ctrl->SetPageToolTip(ctrl->GetPageCount()-1,
"wxTextCtrl 7: and the tooltip message can be even longer!"); "wxTextCtrl 7: and the tooltip message can be even longer!");
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 8") ); wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 8" );
ctrl->Thaw(); ctrl->Thaw();
return ctrl; return ctrl;

View File

@@ -375,7 +375,7 @@ bool MyApp::OnInit()
return false; return false;
// Create the main application window // Create the main application window
MyFrame *frame = new MyFrame(wxT("Calendar wxWidgets sample") MyFrame *frame = new MyFrame("Calendar wxWidgets sample"
,wxPoint(50, 50), wxSize(450, 340) ,wxPoint(50, 50), wxSize(450, 340)
); );
@@ -402,12 +402,12 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(Calendar_File_About, wxT("&About\tCtrl-A"), wxT("Show about dialog")); menuFile->Append(Calendar_File_About, "&About\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Calendar_File_ClearLog, wxT("&Clear log\tCtrl-L")); menuFile->Append(Calendar_File_ClearLog, "&Clear log\tCtrl-L");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Calendar_File_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(Calendar_File_Quit, "E&xit\tAlt-X", "Quit this program");
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
wxMenu *menuCal = new wxMenu; wxMenu *menuCal = new wxMenu;
#ifdef wxHAS_NATIVE_CALENDARCTRL #ifdef wxHAS_NATIVE_CALENDARCTRL
@@ -416,71 +416,71 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
menuCal->AppendSeparator(); menuCal->AppendSeparator();
#endif // wxHAS_NATIVE_CALENDARCTRL #endif // wxHAS_NATIVE_CALENDARCTRL
menuCal->AppendRadioItem(Calendar_Cal_AutoWeekday, menuCal->AppendRadioItem(Calendar_Cal_AutoWeekday,
wxT("Automatic &first weekday\tCtrl-V")); "Automatic &first weekday\tCtrl-V");
menuCal->AppendRadioItem(Calendar_Cal_Sunday, menuCal->AppendRadioItem(Calendar_Cal_Sunday,
wxT("Sunday &first weekday\tCtrl-Z")); "Sunday &first weekday\tCtrl-Z");
menuCal->AppendRadioItem(Calendar_Cal_Monday, menuCal->AppendRadioItem(Calendar_Cal_Monday,
wxT("Monday &first weekday\tCtrl-F")); "Monday &first weekday\tCtrl-F");
menuCal->Append(Calendar_Cal_Holidays, wxT("Show &holidays\tCtrl-H"), menuCal->Append(Calendar_Cal_Holidays, "Show &holidays\tCtrl-H",
wxT("Toggle highlighting the holidays"), "Toggle highlighting the holidays",
true); true);
menuCal->Append(Calendar_Cal_Special, wxT("Highlight &special dates\tCtrl-S"), menuCal->Append(Calendar_Cal_Special, "Highlight &special dates\tCtrl-S",
wxT("Test custom highlighting"), "Test custom highlighting",
true); true);
menuCal->Append(Calendar_Cal_SurroundWeeks, menuCal->Append(Calendar_Cal_SurroundWeeks,
wxT("Show s&urrounding weeks\tCtrl-W"), "Show s&urrounding weeks\tCtrl-W",
wxT("Show the neighbouring weeks in the prev/next month"), "Show the neighbouring weeks in the prev/next month",
true); true);
menuCal->Append(Calendar_Cal_WeekNumbers, menuCal->Append(Calendar_Cal_WeekNumbers,
wxT("Show &week numbers"), "Show &week numbers",
wxT("Toggle week numbers"), "Toggle week numbers",
true); true);
menuCal->AppendSeparator(); menuCal->AppendSeparator();
menuCal->Append(Calendar_Cal_SeqMonth, menuCal->Append(Calendar_Cal_SeqMonth,
wxT("Toggle month selector st&yle\tCtrl-Y"), "Toggle month selector st&yle\tCtrl-Y",
wxT("Use another style for the calendar controls"), "Use another style for the calendar controls",
true); true);
menuCal->Append(Calendar_Cal_Month, wxT("&Month can be changed\tCtrl-M"), menuCal->Append(Calendar_Cal_Month, "&Month can be changed\tCtrl-M",
wxT("Allow changing the month in the calendar"), "Allow changing the month in the calendar",
true); true);
menuCal->AppendCheckItem(Calendar_Cal_LimitDates, wxT("Toggle date ra&nge\tCtrl-N"), menuCal->AppendCheckItem(Calendar_Cal_LimitDates, "Toggle date ra&nge\tCtrl-N",
wxT("Limit the valid dates")); "Limit the valid dates");
menuCal->AppendSeparator(); menuCal->AppendSeparator();
menuCal->Append(Calendar_Cal_SetDate, wxT("Call &SetDate(2005-12-24)"), wxT("Set date to 2005-12-24.")); menuCal->Append(Calendar_Cal_SetDate, "Call &SetDate(2005-12-24)", "Set date to 2005-12-24.");
menuCal->Append(Calendar_Cal_Today, wxT("Call &Today()"), wxT("Set to the current date.")); menuCal->Append(Calendar_Cal_Today, "Call &Today()", "Set to the current date.");
menuCal->Append(Calendar_Cal_BeginDST, "Call SetDate(GetBeginDST())"); menuCal->Append(Calendar_Cal_BeginDST, "Call SetDate(GetBeginDST())");
menuCal->AppendSeparator(); menuCal->AppendSeparator();
menuCal->AppendCheckItem(Calendar_Cal_Resizable, wxT("Make &resizable\tCtrl-R")); menuCal->AppendCheckItem(Calendar_Cal_Resizable, "Make &resizable\tCtrl-R");
menuBar->Append(menuCal, wxT("&Calendar")); menuBar->Append(menuCal, "&Calendar");
#if wxUSE_DATEPICKCTRL #if wxUSE_DATEPICKCTRL
wxMenu *menuDate = new wxMenu; wxMenu *menuDate = new wxMenu;
menuDate->AppendCheckItem(Calendar_DatePicker_ShowCentury, menuDate->AppendCheckItem(Calendar_DatePicker_ShowCentury,
wxT("Al&ways show century")); "Al&ways show century");
menuDate->AppendCheckItem(Calendar_DatePicker_DropDown, menuDate->AppendCheckItem(Calendar_DatePicker_DropDown,
wxT("Use &drop down control")); "Use &drop down control");
menuDate->AppendCheckItem(Calendar_DatePicker_AllowNone, menuDate->AppendCheckItem(Calendar_DatePicker_AllowNone,
wxT("Allow &no date")); "Allow &no date");
menuDate->AppendCheckItem(Calendar_DatePicker_StartWithNone, menuDate->AppendCheckItem(Calendar_DatePicker_StartWithNone,
wxT("Start &with no date")); "Start &with no date");
#if wxUSE_DATEPICKCTRL_GENERIC #if wxUSE_DATEPICKCTRL_GENERIC
menuDate->AppendCheckItem(Calendar_DatePicker_Generic, menuDate->AppendCheckItem(Calendar_DatePicker_Generic,
wxT("Use &generic version of the control")); "Use &generic version of the control");
#endif // wxUSE_DATEPICKCTRL_GENERIC #endif // wxUSE_DATEPICKCTRL_GENERIC
menuDate->AppendSeparator(); menuDate->AppendSeparator();
menuDate->Append(Calendar_DatePicker_AskDate, wxT("&Choose date...\tCtrl-D"), wxT("Show dialog with wxDatePickerCtrl")); menuDate->Append(Calendar_DatePicker_AskDate, "&Choose date...\tCtrl-D", "Show dialog with wxDatePickerCtrl");
menuBar->Append(menuDate, wxT("&Date picker")); menuBar->Append(menuDate, "&Date picker");
#endif // wxUSE_DATEPICKCTRL #endif // wxUSE_DATEPICKCTRL
#if wxUSE_TIMEPICKCTRL #if wxUSE_TIMEPICKCTRL
wxMenu *menuTime = new wxMenu; wxMenu *menuTime = new wxMenu;
#if wxUSE_TIMEPICKCTRL_GENERIC #if wxUSE_TIMEPICKCTRL_GENERIC
menuTime->AppendCheckItem(Calendar_TimePicker_Generic, menuTime->AppendCheckItem(Calendar_TimePicker_Generic,
wxT("Use &generic version of the control")); "Use &generic version of the control");
menuTime->AppendSeparator(); menuTime->AppendSeparator();
#endif // wxUSE_TIMEPICKCTRL_GENERIC #endif // wxUSE_TIMEPICKCTRL_GENERIC
menuTime->Append(Calendar_TimePicker_AskTime, wxT("&Choose time...\tCtrl-T"), wxT("Show dialog with wxTimePickerCtrl")); menuTime->Append(Calendar_TimePicker_AskTime, "&Choose time...\tCtrl-T", "Show dialog with wxTimePickerCtrl");
menuBar->Append(menuTime, wxT("&Time picker")); menuBar->Append(menuTime, "&Time picker");
#endif // wxUSE_TIMEPICKCTRL #endif // wxUSE_TIMEPICKCTRL
menuBar->Check(Calendar_Cal_AutoWeekday, true); menuBar->Check(Calendar_Cal_AutoWeekday, true);
@@ -517,8 +517,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("wxCalendarCtrl sample\n(c) 2000--2008 Vadim Zeitlin"), wxMessageBox("wxCalendarCtrl sample\n(c) 2000--2008 Vadim Zeitlin",
wxT("About Calendar"), wxOK | wxICON_INFORMATION, this); "About Calendar", wxOK | wxICON_INFORMATION, this);
} }
void MyFrame::OnClearLog(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnClearLog(wxCommandEvent& WXUNUSED(event))
@@ -691,16 +691,16 @@ void MyFrame::OnAskDate(wxCommandEvent& WXUNUSED(event))
if ( dt.GetDay() == today.GetDay() && if ( dt.GetDay() == today.GetDay() &&
dt.GetMonth() == today.GetMonth() ) dt.GetMonth() == today.GetMonth() )
{ {
wxMessageBox(wxT("Happy birthday!"), wxT("Calendar Sample")); wxMessageBox("Happy birthday!", "Calendar Sample");
} }
m_panel->SetDate(dt); m_panel->SetDate(dt);
wxLogStatus(wxT("Changed the date to your input")); wxLogStatus("Changed the date to your input");
} }
else else
{ {
wxLogStatus(wxT("No date entered")); wxLogStatus("No date entered");
} }
} }
} }
@@ -734,7 +734,7 @@ MyPanel::MyPanel(wxWindow *parent)
#endif #endif
wxString date; wxString date;
date.Printf(wxT("Selected date: %s"), date.Printf("Selected date: %s",
wxDateTime::Today().FormatISODate().c_str()); wxDateTime::Today().FormatISODate().c_str());
m_date = new wxStaticText(this, wxID_ANY, date); m_date = new wxStaticText(this, wxID_ANY, date);
m_calendar = DoCreateCalendar(wxDefaultDateTime, m_calendar = DoCreateCalendar(wxDefaultDateTime,
@@ -760,14 +760,14 @@ void MyPanel::OnCalendar(wxCalendarEvent& event)
s_dateLast = event.GetDate(); s_dateLast = event.GetDate();
m_calendar->Mark(event.GetDate().GetDay(), mark); m_calendar->Mark(event.GetDate().GetDay(), mark);
wxLogMessage(wxT("Selected (and %smarked) %s from calendar."), wxLogMessage("Selected (and %smarked) %s from calendar.",
mark ? "" : "un", s_dateLast.FormatISODate().c_str()); mark ? "" : "un", s_dateLast.FormatISODate().c_str());
} }
void MyPanel::OnCalendarChange(wxCalendarEvent& event) void MyPanel::OnCalendarChange(wxCalendarEvent& event)
{ {
wxString s; wxString s;
s.Printf(wxT("Selected date: %s"), event.GetDate().FormatISODate().c_str()); s.Printf("Selected date: %s", event.GetDate().FormatISODate().c_str());
m_date->SetLabel(s); m_date->SetLabel(s);
wxLogStatus(s); wxLogStatus(s);
@@ -775,20 +775,20 @@ void MyPanel::OnCalendarChange(wxCalendarEvent& event)
void MyPanel::OnCalMonthChange(wxCalendarEvent& event) void MyPanel::OnCalMonthChange(wxCalendarEvent& event)
{ {
wxLogStatus(wxT("Calendar month changed to %s %d"), wxLogStatus("Calendar month changed to %s %d",
wxDateTime::GetMonthName(event.GetDate().GetMonth()), wxDateTime::GetMonthName(event.GetDate().GetMonth()),
event.GetDate().GetYear()); event.GetDate().GetYear());
} }
void MyPanel::OnCalendarWeekDayClick(wxCalendarEvent& event) void MyPanel::OnCalendarWeekDayClick(wxCalendarEvent& event)
{ {
wxLogMessage(wxT("Clicked on %s"), wxLogMessage("Clicked on %s",
wxDateTime::GetWeekDayName(event.GetWeekDay()).c_str()); wxDateTime::GetWeekDayName(event.GetWeekDay()).c_str());
} }
void MyPanel::OnCalendarWeekClick(wxCalendarEvent& event) void MyPanel::OnCalendarWeekClick(wxCalendarEvent& event)
{ {
wxLogMessage(wxT("Clicked on week %d"), event.GetDate().GetWeekOfYear()); wxLogMessage("Clicked on week %d", event.GetDate().GetWeekOfYear());
} }
wxCalendarCtrlBase *MyPanel::DoCreateCalendar(const wxDateTime& dt, long style) wxCalendarCtrlBase *MyPanel::DoCreateCalendar(const wxDateTime& dt, long style)
@@ -930,7 +930,7 @@ wxBEGIN_EVENT_TABLE(MyDateDialog, wxDialog)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyDateDialog::MyDateDialog(wxWindow *parent, const wxDateTime& dt, int dtpStyle) MyDateDialog::MyDateDialog(wxWindow *parent, const wxDateTime& dt, int dtpStyle)
: wxDialog(parent, wxID_ANY, wxString(wxT("Calendar: Choose a date"))) : wxDialog(parent, wxID_ANY, wxString("Calendar: Choose a date"))
{ {
#if wxUSE_DATEPICKCTRL_GENERIC #if wxUSE_DATEPICKCTRL_GENERIC
wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent); wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent);
@@ -988,7 +988,7 @@ wxBEGIN_EVENT_TABLE(MyTimeDialog, wxDialog)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyTimeDialog::MyTimeDialog(wxWindow *parent) MyTimeDialog::MyTimeDialog(wxWindow *parent)
: wxDialog(parent, wxID_ANY, wxString(wxT("Calendar: Choose time"))) : wxDialog(parent, wxID_ANY, wxString("Calendar: Choose time"))
{ {
#if wxUSE_TIMEPICKCTRL_GENERIC #if wxUSE_TIMEPICKCTRL_GENERIC
wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent); wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent);

View File

@@ -186,7 +186,7 @@ bool MyApp::OnInit()
return false; return false;
// create and show the main application window // create and show the main application window
MyFrame *frame = new MyFrame(wxT("Caret wxWidgets sample"), MyFrame *frame = new MyFrame("Caret wxWidgets sample",
wxPoint(50, 50), wxSize(450, 340)); wxPoint(50, 50), wxSize(450, 340));
frame->Show(true); frame->Show(true);
@@ -211,17 +211,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(Caret_SetBlinkTime, wxT("&Blink time...\tCtrl-B")); menuFile->Append(Caret_SetBlinkTime, "&Blink time...\tCtrl-B");
menuFile->Append(Caret_SetFontSize, wxT("&Font size...\tCtrl-S")); menuFile->Append(Caret_SetFontSize, "&Font size...\tCtrl-S");
menuFile->Append(Caret_Move, wxT("&Move caret\tCtrl-C")); menuFile->Append(Caret_Move, "&Move caret\tCtrl-C");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Caret_About, wxT("&About\tCtrl-A"), wxT("Show about dialog")); menuFile->Append(Caret_About, "&About\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Caret_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(Caret_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -231,7 +231,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -246,8 +246,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("The caret wxWidgets sample.\n(c) 1999 Vadim Zeitlin"), wxMessageBox("The caret wxWidgets sample.\n(c) 1999 Vadim Zeitlin",
wxT("About Caret"), wxOK | wxICON_INFORMATION, this); "About Caret", wxOK | wxICON_INFORMATION, this);
} }
void MyFrame::OnCaretMove(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCaretMove(wxCommandEvent& WXUNUSED(event))
@@ -259,9 +259,9 @@ void MyFrame::OnSetBlinkTime(wxCommandEvent& WXUNUSED(event))
{ {
long blinkTime = wxGetNumberFromUser long blinkTime = wxGetNumberFromUser
( (
wxT("The caret blink time is the time between two blinks"), "The caret blink time is the time between two blinks",
wxT("Time in milliseconds:"), "Time in milliseconds:",
wxT("wxCaret sample"), "wxCaret sample",
wxCaret::GetBlinkTime(), 0, 10000, wxCaret::GetBlinkTime(), 0, 10000,
this this
); );
@@ -269,7 +269,7 @@ void MyFrame::OnSetBlinkTime(wxCommandEvent& WXUNUSED(event))
{ {
wxCaret::SetBlinkTime((int)blinkTime); wxCaret::SetBlinkTime((int)blinkTime);
m_canvas->CreateCaret(); m_canvas->CreateCaret();
wxLogStatus(this, wxT("Blink time set to %ld milliseconds."), blinkTime); wxLogStatus(this, "Blink time set to %ld milliseconds.", blinkTime);
} }
} }
@@ -277,9 +277,9 @@ void MyFrame::OnSetFontSize(wxCommandEvent& WXUNUSED(event))
{ {
long fontSize = wxGetNumberFromUser long fontSize = wxGetNumberFromUser
( (
wxT("The font size also determines the caret size so\nthis demonstrates resizing the caret."), "The font size also determines the caret size so\nthis demonstrates resizing the caret.",
wxT("Font size (in points):"), "Font size (in points):",
wxT("wxCaret sample"), "wxCaret sample",
12, 1, 100, 12, 1, 100,
this this
); );
@@ -363,7 +363,7 @@ void MyCanvas::MoveCaret(int x, int y)
void MyCanvas::DoMoveCaret() void MyCanvas::DoMoveCaret()
{ {
wxLogStatus(wxT("Caret is at (%d, %d)"), m_xCaret, m_yCaret); wxLogStatus("Caret is at (%d, %d)", m_xCaret, m_yCaret);
GetCaret()->Move(m_xMargin + m_xCaret * m_widthChar, GetCaret()->Move(m_xMargin + m_xCaret * m_widthChar,
m_yMargin + m_yCaret * m_heightChar); m_yMargin + m_yCaret * m_heightChar);
@@ -395,7 +395,7 @@ void MyCanvas::ChangeSize()
if ( frame && frame->GetStatusBar() ) if ( frame && frame->GetStatusBar() )
{ {
wxString msg; wxString msg;
msg.Printf(wxT("Panel size is (%d, %d)"), m_xChars, m_yChars); msg.Printf("Panel size is (%d, %d)", m_xChars, m_yChars);
frame->SetStatusText(msg, 1); frame->SetStatusText(msg, 1);
} }
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -422,7 +422,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
wxChar ch = CharAt(x, y); wxChar ch = CharAt(x, y);
if ( !ch ) if ( !ch )
ch = wxT(' '); ch = ' ';
#ifdef __WXOSX__ #ifdef __WXOSX__
dc.DrawText(ch, m_xMargin + x * m_widthChar, dc.DrawText(ch, m_xMargin + x * m_widthChar,
m_yMargin + y * m_heightChar ); m_yMargin + y * m_heightChar );

View File

@@ -171,7 +171,7 @@ wxEND_EVENT_TABLE()
// My frame constructor // My frame constructor
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, wxT("wxCollapsiblePane sample"), : wxFrame(NULL, wxID_ANY, "wxCollapsiblePane sample",
wxDefaultPosition, wxSize(420, 300), wxDefaultPosition, wxSize(420, 300),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{ {
@@ -183,12 +183,12 @@ MyFrame::MyFrame()
// Make a menubar // Make a menubar
wxMenu *paneMenu = new wxMenu; wxMenu *paneMenu = new wxMenu;
paneMenu->Append(PANE_COLLAPSE, wxT("Collapse\tCtrl-C")); paneMenu->Append(PANE_COLLAPSE, "Collapse\tCtrl-C");
paneMenu->Append(PANE_EXPAND, wxT("Expand\tCtrl-E")); paneMenu->Append(PANE_EXPAND, "Expand\tCtrl-E");
paneMenu->AppendSeparator(); paneMenu->AppendSeparator();
paneMenu->Append(PANE_SETLABEL, wxT("Set label...\tCtrl-L")); paneMenu->Append(PANE_SETLABEL, "Set label...\tCtrl-L");
paneMenu->AppendSeparator(); paneMenu->AppendSeparator();
paneMenu->Append(PANE_SHOWDLG, wxT("Show dialog...\tCtrl-S")); paneMenu->Append(PANE_SHOWDLG, "Show dialog...\tCtrl-S");
paneMenu->AppendSeparator(); paneMenu->AppendSeparator();
paneMenu->Append(PANE_QUIT); paneMenu->Append(PANE_QUIT);
@@ -196,8 +196,8 @@ MyFrame::MyFrame()
helpMenu->Append(PANE_ABOUT); helpMenu->Append(PANE_ABOUT);
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(paneMenu, wxT("&Pane")); menuBar->Append(paneMenu, "&Pane");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
SetMenuBar(menuBar); SetMenuBar(menuBar);
m_collPane = new wxCollapsiblePane(this, -1, "This is a wxCollapsiblePane"); m_collPane = new wxCollapsiblePane(this, -1, "This is a wxCollapsiblePane");
@@ -208,10 +208,10 @@ MyFrame::MyFrame()
m_paneSizer->AddSpacer( 20 ); m_paneSizer->AddSpacer( 20 );
m_paneSizer->Add( paneSubSizer, 1 ); m_paneSizer->Add( paneSubSizer, 1 );
paneSubSizer->Add( new wxStaticText(win, -1, wxT("Static text") ), 0, wxALIGN_LEFT | wxALL, 3 ); paneSubSizer->Add( new wxStaticText(win, -1, "Static text" ), 0, wxALIGN_LEFT | wxALL, 3 );
paneSubSizer->Add( new wxStaticText(win, -1, wxT("Yet another one!") ), 0, wxALIGN_LEFT | wxALL, 3 ); paneSubSizer->Add( new wxStaticText(win, -1, "Yet another one!" ), 0, wxALIGN_LEFT | wxALL, 3 );
paneSubSizer->Add( new wxTextCtrl(win, PANE_TEXTCTRL, wxT("Text control"), wxDefaultPosition, wxSize(80,-1) ), 0, wxALIGN_LEFT | wxALL, 3 ); paneSubSizer->Add( new wxTextCtrl(win, PANE_TEXTCTRL, "Text control", wxDefaultPosition, wxSize(80,-1) ), 0, wxALIGN_LEFT | wxALL, 3 );
paneSubSizer->Add( new wxButton(win, PANE_BUTTON, wxT("Press to align right") ), 0, wxALIGN_LEFT | wxALL, 3 ); paneSubSizer->Add( new wxButton(win, PANE_BUTTON, "Press to align right" ), 0, wxALIGN_LEFT | wxALL, 3 );
win->SetSizer( m_paneSizer ); win->SetSizer( m_paneSizer );
@@ -248,7 +248,7 @@ void MyFrame::OnSetLabel(wxCommandEvent& WXUNUSED(event) )
{ {
wxString text = wxGetTextFromUser wxString text = wxGetTextFromUser
( (
wxT("Enter new label"), "Enter new label",
wxGetTextFromUserPromptStr, wxGetTextFromUserPromptStr,
m_collPane->GetLabel() m_collPane->GetLabel()
); );
@@ -266,7 +266,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
wxAboutDialogInfo info; wxAboutDialogInfo info;
info.SetName(_("wxCollapsiblePane sample")); info.SetName(_("wxCollapsiblePane sample"));
info.SetDescription(_("This sample program demonstrates usage of wxCollapsiblePane")); info.SetDescription(_("This sample program demonstrates usage of wxCollapsiblePane"));
info.SetCopyright(wxT("(C) 2006 Francesco Montorsi <frm@users.sourceforge.net>")); info.SetCopyright("(C) 2006 Francesco Montorsi <frm@users.sourceforge.net>");
wxAboutBox(info, this); wxAboutBox(info, this);
} }
@@ -309,20 +309,20 @@ wxBEGIN_EVENT_TABLE(MyDialog, wxDialog)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyDialog::MyDialog(wxFrame *parent) MyDialog::MyDialog(wxFrame *parent)
: wxDialog(parent, wxID_ANY, wxT("Test dialog"), : wxDialog(parent, wxID_ANY, "Test dialog",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE ) wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE )
{ {
wxSizer *sz = new wxBoxSizer(wxVERTICAL); wxSizer *sz = new wxBoxSizer(wxVERTICAL);
sz->Add(new wxStaticText(this, -1, sz->Add(new wxStaticText(this, -1,
wxT("This dialog allows you to test the wxCollapsiblePane control")), "This dialog allows you to test the wxCollapsiblePane control"),
0, wxALL, 5); 0, wxALL, 5);
sz->Add(new wxButton(this, PANEDLG_TOGGLESTATUS_BTN, wxT("Change status")), sz->Add(new wxButton(this, PANEDLG_TOGGLESTATUS_BTN, "Change status"),
1, wxGROW|wxALL, 5); 1, wxGROW|wxALL, 5);
m_collPane = new wxCollapsiblePane(this, -1, wxT("Click here for a surprise")); m_collPane = new wxCollapsiblePane(this, -1, "Click here for a surprise");
sz->Add(m_collPane, 0, wxGROW|wxALL, 5); sz->Add(m_collPane, 0, wxGROW|wxALL, 5);
sz->Add(new wxTextCtrl(this, -1, wxT("just a test")), 0, wxGROW|wxALL, 5); sz->Add(new wxTextCtrl(this, -1, "just a test"), 0, wxGROW|wxALL, 5);
sz->AddSpacer(10); sz->AddSpacer(10);
sz->Add(new wxButton(this, wxID_OK), 0, wxALIGN_RIGHT|wxALL, 5); sz->Add(new wxButton(this, wxID_OK), 0, wxALIGN_RIGHT|wxALL, 5);
@@ -330,10 +330,10 @@ MyDialog::MyDialog(wxFrame *parent)
wxWindow *win = m_collPane->GetPane(); wxWindow *win = m_collPane->GetPane();
m_paneSizer = new wxGridSizer(4, 1, 5, 5); m_paneSizer = new wxGridSizer(4, 1, 5, 5);
m_paneSizer->Add( new wxStaticText(win, -1, wxT("Static text") ), 0, wxALIGN_LEFT ); m_paneSizer->Add( new wxStaticText(win, -1, "Static text" ), 0, wxALIGN_LEFT );
m_paneSizer->Add( new wxStaticText(win, -1, wxT("Yet another one!") ), 0, wxALIGN_LEFT ); m_paneSizer->Add( new wxStaticText(win, -1, "Yet another one!" ), 0, wxALIGN_LEFT );
m_paneSizer->Add( new wxTextCtrl(win, PANE_TEXTCTRL, wxT("Text control"), wxDefaultPosition, wxSize(80,-1) ), 0, wxALIGN_LEFT ); m_paneSizer->Add( new wxTextCtrl(win, PANE_TEXTCTRL, "Text control", wxDefaultPosition, wxSize(80,-1) ), 0, wxALIGN_LEFT );
m_paneSizer->Add( new wxButton(win, PANE_BUTTON, wxT("Press to align right") ), 0, wxALIGN_LEFT ); m_paneSizer->Add( new wxButton(win, PANE_BUTTON, "Press to align right" ), 0, wxALIGN_LEFT );
win->SetSizer( m_paneSizer ); win->SetSizer( m_paneSizer );
win->SetSizer( m_paneSizer ); win->SetSizer( m_paneSizer );
@@ -358,7 +358,7 @@ void MyDialog::OnAlignButton(wxCommandEvent& WXUNUSED(ev))
void MyDialog::OnPaneChanged(wxCollapsiblePaneEvent& event) void MyDialog::OnPaneChanged(wxCollapsiblePaneEvent& event)
{ {
wxLogMessage(wxT("The pane has just been %s by the user"), wxLogMessage("The pane has just been %s by the user",
event.GetCollapsed() ? wxT("collapsed") : wxT("expanded")); event.GetCollapsed() ? "collapsed" : "expanded");
} }

View File

@@ -156,7 +156,7 @@ bool MyApp::OnInit()
return false; return false;
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(wxT("wxComboCtrl and wxOwnerDrawnComboBox Sample")); MyFrame *frame = new MyFrame("wxComboCtrl and wxOwnerDrawnComboBox Sample");
// and show it (the frames, unlike simple controls, are not shown when // and show it (the frames, unlike simple controls, are not shown when
// created initially) // created initially)
@@ -558,7 +558,7 @@ public:
dc.DrawRectangle(0,0,bmp.GetWidth(),bmp.GetHeight()); dc.DrawRectangle(0,0,bmp.GetWidth(),bmp.GetHeight());
// Draw text // Draw text
wxString str = wxT("..."); wxString str = "...";
int w,h; int w,h;
dc.GetTextExtent(str, &w, &h, 0, 0); dc.GetTextExtent(str, &w, &h, 0, 0);
dc.DrawText(str, (bmp.GetWidth()-w)/2, (bmp.GetHeight()-h)/2); dc.DrawText(str, (bmp.GetWidth()-w)/2, (bmp.GetHeight()-h)/2);
@@ -577,10 +577,10 @@ public:
// Show standard wxFileDialog on button click // Show standard wxFileDialog on button click
wxFileDialog dlg(this, wxFileDialog dlg(this,
wxT("Choose File"), "Choose File",
wxEmptyString, wxEmptyString,
GetValue(), GetValue(),
wxT("All files (*.*)|*.*"), "All files (*.*)|*.*",
wxFD_OPEN); wxFD_OPEN);
if ( dlg.ShowModal() == wxID_OK ) if ( dlg.ShowModal() == wxID_OK )
@@ -623,17 +623,17 @@ MyFrame::MyFrame(const wxString& title)
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(ComboCtrl_About, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(ComboCtrl_About, "&About\tF1", "Show about dialog");
fileMenu->Append(ComboCtrl_Compare, wxT("&Compare against wxComboBox..."), fileMenu->Append(ComboCtrl_Compare, "&Compare against wxComboBox...",
wxT("Show some wxOwnerDrawnComboBoxes side-by-side with native wxComboBoxes.")); "Show some wxOwnerDrawnComboBoxes side-by-side with native wxComboBoxes.");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(ComboCtrl_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); fileMenu->Append(ComboCtrl_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(fileMenu, "&File");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -663,18 +663,18 @@ MyFrame::MyFrame(const wxString& title)
wxOwnerDrawnComboBox* odc; wxOwnerDrawnComboBox* odc;
// Create common strings array // Create common strings array
m_arrItems.Add( wxT("Solid") ); m_arrItems.Add( "Solid" );
m_arrItems.Add( wxT("Transparent") ); m_arrItems.Add( "Transparent" );
m_arrItems.Add( wxT("Dot") ); m_arrItems.Add( "Dot" );
m_arrItems.Add( wxT("Long Dash") ); m_arrItems.Add( "Long Dash" );
m_arrItems.Add( wxT("Short Dash") ); m_arrItems.Add( "Short Dash" );
m_arrItems.Add( wxT("Dot Dash") ); m_arrItems.Add( "Dot Dash" );
m_arrItems.Add( wxT("Backward Diagonal Hatch") ); m_arrItems.Add( "Backward Diagonal Hatch" );
m_arrItems.Add( wxT("Cross-diagonal Hatch") ); m_arrItems.Add( "Cross-diagonal Hatch" );
m_arrItems.Add( wxT("Forward Diagonal Hatch") ); m_arrItems.Add( "Forward Diagonal Hatch" );
m_arrItems.Add( wxT("Cross Hatch") ); m_arrItems.Add( "Cross Hatch" );
m_arrItems.Add( wxT("Horizontal Hatch") ); m_arrItems.Add( "Horizontal Hatch" );
m_arrItems.Add( wxT("Vertical Hatch") ); m_arrItems.Add( "Vertical Hatch" );
// //
@@ -682,7 +682,7 @@ MyFrame::MyFrame(const wxString& title)
// //
rowSizer = new wxBoxSizer( wxHORIZONTAL ); rowSizer = new wxBoxSizer( wxHORIZONTAL );
rowSizer->Add( new wxStaticText(panel,wxID_ANY, rowSizer->Add( new wxStaticText(panel,wxID_ANY,
wxT("OwnerDrawnComboBox with owner-drawn items:")), 1, "OwnerDrawnComboBox with owner-drawn items:"), 1,
wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
@@ -713,7 +713,7 @@ MyFrame::MyFrame(const wxString& title)
// //
rowSizer = new wxBoxSizer( wxHORIZONTAL ); rowSizer = new wxBoxSizer( wxHORIZONTAL );
rowSizer->Add( new wxStaticText(panel,wxID_ANY, rowSizer->Add( new wxStaticText(panel,wxID_ANY,
wxT("OwnerDrawnComboBox with owner-drawn items and button on the left:")), 1, "OwnerDrawnComboBox with owner-drawn items and button on the left:"), 1,
wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
@@ -755,7 +755,7 @@ MyFrame::MyFrame(const wxString& title)
wxID_ANY, wxID_ANY,
"List View wxComboCtrl (custom animation):"), "List View wxComboCtrl (custom animation):"),
1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
rowSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Tree Ctrl wxComboCtrl:")), 1, rowSizer->Add( new wxStaticText(panel,wxID_ANY,"Tree Ctrl wxComboCtrl:"), 1,
wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
@@ -778,7 +778,7 @@ MyFrame::MyFrame(const wxString& title)
int i; int i;
for ( i=0; i<100; i++ ) for ( i=0; i<100; i++ )
iface->AddSelection( wxString::Format(wxT("Item %02i"),i)); iface->AddSelection( wxString::Format("Item %02i",i));
rowSizer->Add( cc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); rowSizer->Add( cc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
@@ -800,22 +800,22 @@ MyFrame::MyFrame(const wxString& title)
gcc->SetPopupControl(tcPopup); gcc->SetPopupControl(tcPopup);
// Add items using wxTreeCtrl methods directly // Add items using wxTreeCtrl methods directly
wxTreeItemId rootId = tcPopup->AddRoot(wxT("<hidden_root>")); wxTreeItemId rootId = tcPopup->AddRoot("<hidden_root>");
wxTreeItemId groupId; wxTreeItemId groupId;
for ( i=0; i<4; i++ ) for ( i=0; i<4; i++ )
{ {
groupId = tcPopup->AppendItem(rootId, groupId = tcPopup->AppendItem(rootId,
wxString::Format(wxT("Branch %02i"),i)); wxString::Format("Branch %02i",i));
int n; int n;
for ( n=0; n<25; n++ ) for ( n=0; n<25; n++ )
tcPopup->AppendItem(groupId, tcPopup->AppendItem(groupId,
wxString::Format(wxT("Subitem %02i"),(i*25)+n)); wxString::Format("Subitem %02i",(i*25)+n));
} }
gcc->SetValue(wxT("Subitem 05")); gcc->SetValue("Subitem 05");
// Move button to left - it makes more sense for a tree ctrl // Move button to left - it makes more sense for a tree ctrl
gcc->SetButtonPosition(-1, // button width gcc->SetButtonPosition(-1, // button width
@@ -837,7 +837,7 @@ MyFrame::MyFrame(const wxString& title)
// //
rowSizer = new wxBoxSizer( wxHORIZONTAL ); rowSizer = new wxBoxSizer( wxHORIZONTAL );
rowSizer->Add( new wxStaticText(panel,wxID_ANY, rowSizer->Add( new wxStaticText(panel,wxID_ANY,
wxT("OwnerDrawnComboBox with simple dropbutton graphics:")), 1, "OwnerDrawnComboBox with simple dropbutton graphics:"), 1,
wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
@@ -858,9 +858,9 @@ MyFrame::MyFrame(const wxString& title)
); );
// Load images from disk // Load images from disk
wxImage imgNormal(wxT("dropbutn.png")); wxImage imgNormal("dropbutn.png");
wxImage imgPressed(wxT("dropbutp.png")); wxImage imgPressed("dropbutp.png");
wxImage imgHover(wxT("dropbuth.png")); wxImage imgHover("dropbuth.png");
if ( imgNormal.IsOk() && imgPressed.IsOk() && imgHover.IsOk() ) if ( imgNormal.IsOk() && imgPressed.IsOk() && imgHover.IsOk() )
{ {
@@ -871,7 +871,7 @@ MyFrame::MyFrame(const wxString& title)
odc2->SetButtonBitmaps(bmpNormal,true,bmpPressed,bmpHover); odc2->SetButtonBitmaps(bmpNormal,true,bmpPressed,bmpHover);
} }
else else
wxLogError(wxT("Dropbutton images not found")); wxLogError("Dropbutton images not found");
//odc2->SetButtonPosition(0, // width adjustment //odc2->SetButtonPosition(0, // width adjustment
// 0, // height adjustment // 0, // height adjustment
@@ -890,7 +890,7 @@ MyFrame::MyFrame(const wxString& title)
// //
rowSizer = new wxBoxSizer( wxHORIZONTAL ); rowSizer = new wxBoxSizer( wxHORIZONTAL );
rowSizer->Add( new wxStaticText(panel,wxID_ANY, rowSizer->Add( new wxStaticText(panel,wxID_ANY,
wxT("wxComboCtrl with custom button action:")), 1, "wxComboCtrl with custom button action:"), 1,
wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
@@ -917,7 +917,7 @@ MyFrame::MyFrame(const wxString& title)
colSizer = new wxBoxSizer( wxVERTICAL ); colSizer = new wxBoxSizer( wxVERTICAL );
colSizer->AddSpacer(8); colSizer->AddSpacer(8);
colSizer->Add( new wxStaticText(panel, wxID_ANY, wxT("Log Messages:")), 0, wxTOP|wxLEFT, 3 ); colSizer->Add( new wxStaticText(panel, wxID_ANY, "Log Messages:"), 0, wxTOP|wxLEFT, 3 );
colSizer->Add( m_logWin, 1, wxEXPAND|wxALL, 3 ); colSizer->Add( m_logWin, 1, wxEXPAND|wxALL, 3 );
topRowSizer->Add( colSizer, 1, wxEXPAND|wxALL, 2 ); topRowSizer->Add( colSizer, 1, wxEXPAND|wxALL, 2 );
@@ -940,7 +940,7 @@ void MyFrame::OnComboBoxUpdate( wxCommandEvent& event )
if ( event.GetEventType() == wxEVT_COMBOBOX ) if ( event.GetEventType() == wxEVT_COMBOBOX )
{ {
wxLogDebug(wxT("EVT_COMBOBOX(id=%i,selection=%i)"),event.GetId(),event.GetSelection()); wxLogDebug("EVT_COMBOBOX(id=%i,selection=%i)",event.GetId(),event.GetSelection());
} }
else if ( event.GetEventType() == wxEVT_TEXT ) else if ( event.GetEventType() == wxEVT_TEXT )
{ {
@@ -969,7 +969,7 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
const int border = 4; const int border = 4;
wxDialog* dlg = new wxDialog(this,wxID_ANY, wxDialog* dlg = new wxDialog(this,wxID_ANY,
wxT("Compare against wxComboBox"), "Compare against wxComboBox",
wxDefaultPosition,wxDefaultSize, wxDefaultPosition,wxDefaultSize,
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
@@ -977,11 +977,11 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
rowSizer = new wxBoxSizer(wxHORIZONTAL); rowSizer = new wxBoxSizer(wxHORIZONTAL);
groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY,wxT(" wxOwnerDrawnComboBox ")), groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY," wxOwnerDrawnComboBox "),
wxVERTICAL); wxVERTICAL);
groupSizer->Add( new wxStaticText(dlg, wxID_ANY, groupSizer->Add( new wxStaticText(dlg, wxID_ANY,
wxT("Writable, with margins, sorted:")), "Writable, with margins, sorted:"),
wxSizerFlags().Expand().Border(wxRIGHT, border) ); wxSizerFlags().Expand().Border(wxRIGHT, border) );
odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString, odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString,
@@ -990,9 +990,9 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
wxCB_SORT // wxNO_BORDER|wxCB_READONLY wxCB_SORT // wxNO_BORDER|wxCB_READONLY
); );
odc->Append(wxT("H - Appended Item")); // test sorting in append odc->Append("H - Appended Item"); // test sorting in append
odc->SetValue(wxT("Dot Dash")); odc->SetValue("Dot Dash");
odc->SetMargins(15, 10); odc->SetMargins(15, 10);
groupSizer->Add( odc, wxSizerFlags().Border(wxALL, border) ); groupSizer->Add( odc, wxSizerFlags().Border(wxALL, border) );
groupSizer->AddStretchSpacer(); groupSizer->AddStretchSpacer();
@@ -1000,7 +1000,7 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
// //
// Readonly ODComboBox // Readonly ODComboBox
groupSizer->Add( new wxStaticText(dlg, wxID_ANY, groupSizer->Add( new wxStaticText(dlg, wxID_ANY,
wxT("Read-only, big font:")), "Read-only, big font:"),
wxSizerFlags().Border(wxRIGHT, border) ); wxSizerFlags().Border(wxRIGHT, border) );
odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString, odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString,
@@ -1010,15 +1010,15 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
); );
odc->SetFont(odc->GetFont().Scale(1.5)); odc->SetFont(odc->GetFont().Scale(1.5));
odc->SetValue(wxT("Dot Dash")); odc->SetValue("Dot Dash");
odc->SetText(wxT("Dot Dash (Testing SetText)")); odc->SetText("Dot Dash (Testing SetText)");
groupSizer->Add( odc, 0, wxALL, border ); groupSizer->Add( odc, 0, wxALL, border );
groupSizer->AddStretchSpacer(); groupSizer->AddStretchSpacer();
// //
// Disabled ODComboBox // Disabled ODComboBox
groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Disabled:")), groupSizer->Add( new wxStaticText(dlg,wxID_ANY,"Disabled:"),
wxSizerFlags().Border(wxRIGHT, border) ); wxSizerFlags().Border(wxRIGHT, border) );
odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString, odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString,
@@ -1027,7 +1027,7 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY
); );
odc->SetValue(wxT("Dot Dash")); odc->SetValue("Dot Dash");
odc->Enable(false); odc->Enable(false);
groupSizer->Add( odc, wxSizerFlags(3).Expand().Border(wxALL, border) ); groupSizer->Add( odc, wxSizerFlags(3).Expand().Border(wxALL, border) );
@@ -1035,14 +1035,14 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
rowSizer->Add( groupSizer, 1, wxEXPAND|wxALL, border ); rowSizer->Add( groupSizer, 1, wxEXPAND|wxALL, border );
groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY,wxT(" wxComboBox ")), groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY," wxComboBox "),
wxVERTICAL); wxVERTICAL);
// //
// wxComboBox // wxComboBox
// //
groupSizer->Add( new wxStaticText(dlg,wxID_ANY, groupSizer->Add( new wxStaticText(dlg,wxID_ANY,
wxT("Writable, with margins, sorted:")), "Writable, with margins, sorted:"),
wxSizerFlags().Expand().Border(wxRIGHT, border) ); wxSizerFlags().Expand().Border(wxRIGHT, border) );
cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString, cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,
@@ -1051,9 +1051,9 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
wxCB_SORT // wxNO_BORDER|wxCB_READONLY wxCB_SORT // wxNO_BORDER|wxCB_READONLY
); );
cb->Append(wxT("H - Appended Item")); // test sorting in append cb->Append("H - Appended Item"); // test sorting in append
cb->SetValue(wxT("Dot Dash")); cb->SetValue("Dot Dash");
cb->SetMargins(15, 10); cb->SetMargins(15, 10);
groupSizer->Add( cb, wxSizerFlags().Border(wxALL, border) ); groupSizer->Add( cb, wxSizerFlags().Border(wxALL, border) );
groupSizer->AddStretchSpacer(); groupSizer->AddStretchSpacer();
@@ -1061,7 +1061,7 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
// //
// Readonly wxComboBox // Readonly wxComboBox
groupSizer->Add( new wxStaticText(dlg, wxID_ANY, groupSizer->Add( new wxStaticText(dlg, wxID_ANY,
wxT("Read-only, big font:")), "Read-only, big font:"),
wxSizerFlags().Border(wxRIGHT, border) ); wxSizerFlags().Border(wxRIGHT, border) );
cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString, cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,
@@ -1071,14 +1071,14 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
); );
cb->SetFont(cb->GetFont().Scale(1.5)); cb->SetFont(cb->GetFont().Scale(1.5));
cb->SetValue(wxT("Dot Dash")); cb->SetValue("Dot Dash");
groupSizer->Add( cb, 0, wxALL, border ); groupSizer->Add( cb, 0, wxALL, border );
groupSizer->AddStretchSpacer(); groupSizer->AddStretchSpacer();
// //
// Disabled wxComboBox // Disabled wxComboBox
groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Disabled:")), groupSizer->Add( new wxStaticText(dlg,wxID_ANY,"Disabled:"),
wxSizerFlags().Border(wxRIGHT, border) ); wxSizerFlags().Border(wxRIGHT, border) );
cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString, cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,
@@ -1087,7 +1087,7 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY
); );
cb->SetValue(wxT("Dot Dash")); cb->SetValue("Dot Dash");
cb->Enable(false); cb->Enable(false);
groupSizer->Add( cb, wxSizerFlags(3).Expand().Border(wxALL, border) ); groupSizer->Add( cb, wxSizerFlags(3).Expand().Border(wxALL, border) );
@@ -1118,14 +1118,14 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxString::Format( wxMessageBox(wxString::Format(
wxT("Welcome to %s!\n") "Welcome to %s!\n"
wxT("\n") "\n"
wxT("This is the wxWidgets wxComboCtrl and wxOwnerDrawnComboBox sample\n") "This is the wxWidgets wxComboCtrl and wxOwnerDrawnComboBox sample\n"
wxT("running under %s."), "running under %s.",
wxVERSION_STRING, wxVERSION_STRING,
wxGetOsDescription().c_str() wxGetOsDescription().c_str()
), ),
wxT("About wxComboCtrl sample"), "About wxComboCtrl sample",
wxOK | wxICON_INFORMATION, wxOK | wxICON_INFORMATION,
this); this);
} }
@@ -1141,11 +1141,11 @@ void MyFrame::OnIdle(wxIdleEvent& event)
if ( curFocus != lastFocus ) if ( curFocus != lastFocus )
{ {
const wxChar* className = wxT("<none>"); const wxChar* className = "<none>";
if ( curFocus ) if ( curFocus )
className = curFocus->GetClassInfo()->GetClassName(); className = curFocus->GetClassInfo()->GetClassName();
lastFocus = curFocus; lastFocus = curFocus;
wxLogDebug( wxT("FOCUSED: %s %X"), wxLogDebug( "FOCUSED: %s %X",
className, className,
(unsigned int)curFocus); (unsigned int)curFocus);
} }

View File

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

View File

@@ -1031,7 +1031,7 @@ void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
wxAboutDialogInfo info; wxAboutDialogInfo info;
info.SetName(_("DataView sample")); info.SetName(_("DataView sample"));
info.SetDescription(_("This sample demonstrates wxDataViewCtrl")); info.SetDescription(_("This sample demonstrates wxDataViewCtrl"));
info.SetCopyright(wxT("(C) 2007-2009 Robert Roebling")); info.SetCopyright("(C) 2007-2009 Robert Roebling");
info.AddDeveloper("Robert Roebling"); info.AddDeveloper("Robert Roebling");
info.AddDeveloper("Francesco Montorsi"); info.AddDeveloper("Francesco Montorsi");

View File

@@ -157,9 +157,9 @@ public:
virtual wxString GetColumnType( unsigned int col ) const wxOVERRIDE virtual wxString GetColumnType( unsigned int col ) const wxOVERRIDE
{ {
if (col == 2) if (col == 2)
return wxT("long"); return "long";
return wxT("string"); return "string";
} }
virtual void GetValue( wxVariant &variant, virtual void GetValue( wxVariant &variant,
@@ -229,9 +229,9 @@ public:
return wxT( "bool" ); return wxT( "bool" );
if (col == Col_IconText) if (col == Col_IconText)
return wxT("wxDataViewIconText"); return "wxDataViewIconText";
return wxT("string"); return "string";
} }
virtual void GetValueByRow( wxVariant &variant, virtual void GetValueByRow( wxVariant &variant,

View File

@@ -53,9 +53,9 @@ class MyDebugReport : public wxDebugReportUpload
public: public:
MyDebugReport() : wxDebugReportUpload MyDebugReport() : wxDebugReportUpload
( (
wxT("http://your.url.here/"), "http://your.url.here/",
wxT("report:file"), "report:file",
wxT("action") "action"
) )
{ {
} }
@@ -68,19 +68,19 @@ protected:
{ {
if ( reply.IsEmpty() ) if ( reply.IsEmpty() )
{ {
wxLogError(wxT("Didn't receive the expected server reply.")); wxLogError("Didn't receive the expected server reply.");
return false; return false;
} }
wxString s(wxT("Server replied:\n")); wxString s("Server replied:\n");
const size_t count = reply.GetCount(); const size_t count = reply.GetCount();
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
{ {
s << wxT('\t') << reply[n] << wxT('\n'); s << '\t' << reply[n] << '\n';
} }
wxLogMessage(wxT("%s"), s.c_str()); wxLogMessage("%s", s.c_str());
return true; return true;
} }
@@ -99,12 +99,12 @@ public:
{ {
if ( !wxDebugReportCompress::DoProcess() ) if ( !wxDebugReportCompress::DoProcess() )
return false; return false;
wxMailMessage msg(GetReportName() + wxT(" crash report"), wxMailMessage msg(GetReportName() + " crash report",
wxT("vadim@wxwindows.org"), "vadim@wxwindows.org",
wxEmptyString, // mail body wxEmptyString, // mail body
wxEmptyString, // from address wxEmptyString, // from address
GetCompressedFileName(), GetCompressedFileName(),
wxT("crashreport.zip")); "crashreport.zip");
return wxEmail::Send(msg); return wxEmail::Send(msg);
} }
@@ -248,7 +248,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, wxT("wxWidgets Debug Report Sample"), : wxFrame(NULL, wxID_ANY, "wxWidgets Debug Report Sample",
wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxDEFAULT_FRAME_STYLE) wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxDEFAULT_FRAME_STYLE)
{ {
m_numLines = 10; m_numLines = 10;
@@ -256,30 +256,30 @@ MyFrame::MyFrame()
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(DebugRpt_ListLoadedDLLs, wxT("&List loaded DLLs...\tCtrl-L")); menuFile->Append(DebugRpt_ListLoadedDLLs, "&List loaded DLLs...\tCtrl-L");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(DebugRpt_Quit, wxT("E&xit\tAlt-X")); menuFile->Append(DebugRpt_Quit, "E&xit\tAlt-X");
wxMenu *menuReport = new wxMenu; wxMenu *menuReport = new wxMenu;
menuReport->Append(DebugRpt_Crash, wxT("Report for &crash\tCtrl-C"), menuReport->Append(DebugRpt_Crash, "Report for &crash\tCtrl-C",
wxT("Provoke a crash inside the program and create report for it")); "Provoke a crash inside the program and create report for it");
menuReport->Append(DebugRpt_Current, wxT("Report for c&urrent context\tCtrl-U"), menuReport->Append(DebugRpt_Current, "Report for c&urrent context\tCtrl-U",
wxT("Create report for the current program context")); "Create report for the current program context");
menuReport->Append(DebugRpt_Paint, wxT("Report for &paint handler\tCtrl-P"), menuReport->Append(DebugRpt_Paint, "Report for &paint handler\tCtrl-P",
wxT("Provoke a repeatable crash in wxEVT_PAINT handler")); "Provoke a repeatable crash in wxEVT_PAINT handler");
menuReport->Append(DebugRpt_Timer, wxT("Report for &timer handler\tCtrl-T"), menuReport->Append(DebugRpt_Timer, "Report for &timer handler\tCtrl-T",
wxT("Provoke a crash in wxEVT_TIMER handler")); "Provoke a crash in wxEVT_TIMER handler");
menuReport->AppendSeparator(); menuReport->AppendSeparator();
menuReport->AppendCheckItem(DebugRpt_Upload, wxT("Up&load debug report"), menuReport->AppendCheckItem(DebugRpt_Upload, "Up&load debug report",
wxT("You need to configure a web server accepting debug report uploads to use this function")); "You need to configure a web server accepting debug report uploads to use this function");
wxMenu *menuHelp = new wxMenu; wxMenu *menuHelp = new wxMenu;
menuHelp->Append(DebugRpt_About, wxT("&About\tF1")); menuHelp->Append(DebugRpt_About, "&About\tF1");
wxMenuBar *mbar = new wxMenuBar(); wxMenuBar *mbar = new wxMenuBar();
mbar->Append(menuFile, wxT("&File")); mbar->Append(menuFile, "&File");
mbar->Append(menuReport, wxT("&Report")); mbar->Append(menuReport, "&Report");
mbar->Append(menuHelp, wxT("&Help")); mbar->Append(menuHelp, "&Help");
SetMenuBar(mbar); SetMenuBar(mbar);
CreateStatusBar(); CreateStatusBar();
@@ -371,8 +371,8 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox wxMessageBox
( (
wxT("wxDebugReport sample\n(c) 2005 Vadim Zeitlin <vadim@wxwindows.org>"), "wxDebugReport sample\n(c) 2005 Vadim Zeitlin <vadim@wxwindows.org>",
wxT("wxWidgets Debug Report Sample"), "wxWidgets Debug Report Sample",
wxOK | wxICON_INFORMATION, wxOK | wxICON_INFORMATION,
this this
); );
@@ -426,16 +426,16 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx)
// you can also call report->AddFile(...) with your own log files, files // you can also call report->AddFile(...) with your own log files, files
// created using wxRegKey::Export() and so on, here we just add a test // created using wxRegKey::Export() and so on, here we just add a test
// file containing the date of the crash // file containing the date of the crash
wxFileName fn(report->GetDirectory(), wxT("timestamp.my")); wxFileName fn(report->GetDirectory(), "timestamp.my");
wxFFile file(fn.GetFullPath(), wxT("w")); wxFFile file(fn.GetFullPath(), "w");
if ( file.IsOpened() ) if ( file.IsOpened() )
{ {
wxDateTime dt = wxDateTime::Now(); wxDateTime dt = wxDateTime::Now();
file.Write(dt.FormatISODate() + wxT(' ') + dt.FormatISOTime()); file.Write(dt.FormatISODate() + ' ' + dt.FormatISOTime());
file.Close(); file.Close();
} }
report->AddFile(fn.GetFullName(), wxT("timestamp of this report")); report->AddFile(fn.GetFullName(), "timestamp of this report");
// can also add an existing file directly, it will be copied // can also add an existing file directly, it will be copied
// automatically // automatically
@@ -462,7 +462,7 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx)
{ {
if ( m_uploadReport ) if ( m_uploadReport )
{ {
wxLogMessage(wxT("Report successfully uploaded.")); wxLogMessage("Report successfully uploaded.");
} }
else else
{ {

View File

@@ -157,7 +157,7 @@ bool MyApp::OnInit()
return false; return false;
// Create the main application window // Create the main application window
MyFrame *frame = new MyFrame(wxT("Dial-up wxWidgets demo"), MyFrame *frame = new MyFrame("Dial-up wxWidgets demo",
wxPoint(50, 50), wxSize(450, 340)); wxPoint(50, 50), wxSize(450, 340));
// Show it // Show it
@@ -168,7 +168,7 @@ bool MyApp::OnInit()
if ( !m_dial->IsOk() ) if ( !m_dial->IsOk() )
{ {
wxLogError(wxT("The sample can't run on this system.")); wxLogError("The sample can't run on this system.");
#if wxUSE_LOG #if wxUSE_LOG
wxLog::GetActiveTarget()->Flush(); wxLog::GetActiveTarget()->Flush();
@@ -181,7 +181,7 @@ bool MyApp::OnInit()
} }
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? wxT("LAN") : wxT("No LAN"), 2); frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? "LAN" : "No LAN", 2);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
return true; return true;
@@ -197,18 +197,18 @@ int MyApp::OnExit()
void MyApp::OnConnected(wxDialUpEvent& event) void MyApp::OnConnected(wxDialUpEvent& event)
{ {
const wxChar *msg; wxString msg;
if ( event.IsOwnEvent() ) if ( event.IsOwnEvent() )
{ {
msg = event.IsConnectedEvent() ? wxT("Successfully connected") msg = event.IsConnectedEvent() ? "Successfully connected"
: wxT("Dialing failed"); : "Dialing failed";
wxLogStatus(wxEmptyString); wxLogStatus(wxEmptyString);
} }
else else
{ {
msg = event.IsConnectedEvent() ? wxT("Just connected!") msg = event.IsConnectedEvent() ? "Just connected!"
: wxT("Disconnected"); : "Disconnected";
} }
wxLogMessage(msg); wxLogMessage(msg);
@@ -227,19 +227,19 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(NetTest_Dial, wxT("&Dial\tCtrl-D"), wxT("Dial default ISP")); menuFile->Append(NetTest_Dial, "&Dial\tCtrl-D", "Dial default ISP");
menuFile->Append(NetTest_HangUp, wxT("&HangUp\tCtrl-H"), wxT("Hang up modem")); menuFile->Append(NetTest_HangUp, "&HangUp\tCtrl-H", "Hang up modem");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(NetTest_EnumISP, wxT("&Enumerate ISPs...\tCtrl-E")); menuFile->Append(NetTest_EnumISP, "&Enumerate ISPs...\tCtrl-E");
menuFile->Append(NetTest_Check, wxT("&Check connection status...\tCtrl-C")); menuFile->Append(NetTest_Check, "&Check connection status...\tCtrl-C");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(NetTest_About, wxT("&About\tCtrl-A"), wxT("Show about dialog")); menuFile->Append(NetTest_About, "&About\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(NetTest_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(NetTest_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -264,37 +264,37 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is the network functions test sample.\n") msg.Printf( "This is the network functions test sample.\n"
wxT("(c) 1999 Vadim Zeitlin") ); "(c) 1999 Vadim Zeitlin" );
wxMessageBox(msg, wxT("About NetTest"), wxOK | wxICON_INFORMATION, this); wxMessageBox(msg, "About NetTest", wxOK | wxICON_INFORMATION, this);
} }
void MyFrame::OnHangUp(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnHangUp(wxCommandEvent& WXUNUSED(event))
{ {
if ( wxGetApp().GetDialer()->HangUp() ) if ( wxGetApp().GetDialer()->HangUp() )
{ {
wxLogStatus(this, wxT("Connection was successfully terminated.")); wxLogStatus(this, "Connection was successfully terminated.");
} }
else else
{ {
wxLogStatus(this, wxT("Failed to hang up.")); wxLogStatus(this, "Failed to hang up.");
} }
} }
void MyFrame::OnDial(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnDial(wxCommandEvent& WXUNUSED(event))
{ {
wxLogStatus(this, wxT("Preparing to dial...")); wxLogStatus(this, "Preparing to dial...");
wxYield(); wxYield();
wxBeginBusyCursor(); wxBeginBusyCursor();
if ( wxGetApp().GetDialer()->Dial() ) if ( wxGetApp().GetDialer()->Dial() )
{ {
wxLogStatus(this, wxT("Dialing...")); wxLogStatus(this, "Dialing...");
} }
else else
{ {
wxLogStatus(this, wxT("Dialing attempt failed.")); wxLogStatus(this, "Dialing attempt failed.");
} }
wxEndBusyCursor(); wxEndBusyCursor();
@@ -304,11 +304,11 @@ void MyFrame::OnCheck(wxCommandEvent& WXUNUSED(event))
{ {
if(wxGetApp().GetDialer()->IsOnline()) if(wxGetApp().GetDialer()->IsOnline())
{ {
wxLogMessage(wxT("Network is online.")); wxLogMessage("Network is online.");
} }
else else
{ {
wxLogMessage(wxT("Network is offline.")); wxLogMessage("Network is offline.");
} }
} }
@@ -318,11 +318,11 @@ void MyFrame::OnEnumISPs(wxCommandEvent& WXUNUSED(event))
size_t nCount = wxGetApp().GetDialer()->GetISPNames(names); size_t nCount = wxGetApp().GetDialer()->GetISPNames(names);
if ( nCount == 0 ) if ( nCount == 0 )
{ {
wxLogWarning(wxT("No ISPs found.")); wxLogWarning("No ISPs found.");
} }
else else
{ {
wxString msg = wxT("Known ISPs:\n"); wxString msg = "Known ISPs:\n";
for ( size_t n = 0; n < nCount; n++ ) for ( size_t n = 0; n < nCount; n++ )
{ {
msg << names[n] << '\n'; msg << names[n] << '\n';
@@ -348,7 +348,7 @@ void MyFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
s_isOnline = isOnline; s_isOnline = isOnline;
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(isOnline ? wxT("Online") : wxT("Offline"), 1); SetStatusText(isOnline ? "Online" : "Offline", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
} }

View File

@@ -171,9 +171,9 @@ bool MyApp::OnInit()
return false; return false;
#ifdef __WXMSW__ #ifdef __WXMSW__
if ( argc == 2 && !wxStricmp(argv[1], wxT("/dx")) ) if ( argc == 2 && !wxStricmp(argv[1], "/dx") )
{ {
wxSystemOptions::SetOption(wxT("msw.display.directdraw"), 1); wxSystemOptions::SetOption("msw.display.directdraw", 1);
} }
#endif // __WXMSW__ #endif // __WXMSW__
@@ -254,35 +254,35 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
sizer->AddGrowableCol(1); sizer->AddGrowableCol(1);
const wxRect r(display.GetGeometry()); const wxRect r(display.GetGeometry());
sizer->Add(new wxStaticText(page, wxID_ANY, wxT("Origin: "))); sizer->Add(new wxStaticText(page, wxID_ANY, "Origin: "));
sizer->Add(new wxStaticText sizer->Add(new wxStaticText
( (
page, page,
wxID_ANY, wxID_ANY,
wxString::Format(wxT("(%d, %d)"), wxString::Format("(%d, %d)",
r.x, r.y) r.x, r.y)
)); ));
sizer->Add(new wxStaticText(page, wxID_ANY, wxT("Size: "))); sizer->Add(new wxStaticText(page, wxID_ANY, "Size: "));
sizer->Add(new wxStaticText sizer->Add(new wxStaticText
( (
page, page,
wxID_ANY, wxID_ANY,
wxString::Format(wxT("(%d, %d)"), wxString::Format("(%d, %d)",
r.width, r.height) r.width, r.height)
)); ));
const wxRect rc(display.GetClientArea()); const wxRect rc(display.GetClientArea());
sizer->Add(new wxStaticText(page, wxID_ANY, wxT("Client area: "))); sizer->Add(new wxStaticText(page, wxID_ANY, "Client area: "));
sizer->Add(new wxStaticText sizer->Add(new wxStaticText
( (
page, page,
wxID_ANY, wxID_ANY,
wxString::Format(wxT("(%d, %d)-(%d, %d)"), wxString::Format("(%d, %d)-(%d, %d)",
rc.x, rc.y, rc.width, rc.height) rc.x, rc.y, rc.width, rc.height)
)); ));
sizer->Add(new wxStaticText(page, wxID_ANY, wxT("Name: "))); sizer->Add(new wxStaticText(page, wxID_ANY, "Name: "));
sizer->Add(new wxStaticText(page, wxID_ANY, display.GetName())); sizer->Add(new wxStaticText(page, wxID_ANY, display.GetName()));
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
@@ -300,22 +300,22 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
new MyVideoModeClientData(mode)); new MyVideoModeClientData(mode));
} }
sizer->Add(new wxStaticText(page, wxID_ANY, wxT("&Modes: "))); sizer->Add(new wxStaticText(page, wxID_ANY, "&Modes: "));
sizer->Add(choiceModes, 0, wxEXPAND); sizer->Add(choiceModes, 0, wxEXPAND);
sizer->Add(new wxStaticText(page, wxID_ANY, wxT("Current: "))); sizer->Add(new wxStaticText(page, wxID_ANY, "Current: "));
sizer->Add(new wxStaticText(page, Display_CurrentMode, sizer->Add(new wxStaticText(page, Display_CurrentMode,
VideoModeToText(display.GetCurrentMode()))); VideoModeToText(display.GetCurrentMode())));
// add it to another sizer to have borders around it and button below // add it to another sizer to have borders around it and button below
sizerTop->Add(new wxButton(page, Display_ResetMode, wxT("&Reset mode")), sizerTop->Add(new wxButton(page, Display_ResetMode, "&Reset mode"),
0, wxALL | wxCENTRE, 5); 0, wxALL | wxCENTRE, 5);
#endif // wxUSE_DISPLAY #endif // wxUSE_DISPLAY
page->SetSizer(sizerTop); page->SetSizer(sizerTop);
m_book->AddPage(page, m_book->AddPage(page,
wxString::Format(wxT("Display %lu"), wxString::Format("Display %lu",
(unsigned long)nDpy)); (unsigned long)nDpy));
} }
@@ -330,16 +330,16 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
wxString MyFrame::VideoModeToText(const wxVideoMode& mode) wxString MyFrame::VideoModeToText(const wxVideoMode& mode)
{ {
wxString s; wxString s;
s.Printf(wxT("%dx%d"), mode.w, mode.h); s.Printf("%dx%d", mode.w, mode.h);
if ( mode.bpp ) if ( mode.bpp )
{ {
s += wxString::Format(wxT(", %dbpp"), mode.bpp); s += wxString::Format(", %dbpp", mode.bpp);
} }
if ( mode.refresh ) if ( mode.refresh )
{ {
s += wxString::Format(wxT(", %dHz"), mode.refresh); s += wxString::Format(", %dHz", mode.refresh);
} }
return s; return s;
@@ -357,8 +357,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("Demo program for wxDisplay class.\n\n(c) 2003-2006 Vadim Zeitlin"), wxMessageBox("Demo program for wxDisplay class.\n\n(c) 2003-2006 Vadim Zeitlin",
wxT("About Display Sample"), "About Display Sample",
wxOK | wxICON_INFORMATION, wxOK | wxICON_INFORMATION,
this); this);
} }
@@ -366,7 +366,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnFromPoint(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnFromPoint(wxCommandEvent& WXUNUSED(event))
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Press the mouse anywhere...")); SetStatusText("Press the mouse anywhere...");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
CaptureMouse(); CaptureMouse();
@@ -388,7 +388,7 @@ void MyFrame::OnChangeMode(wxCommandEvent& event)
wxDynamicCast(event.GetEventObject(), wxChoice)-> wxDynamicCast(event.GetEventObject(), wxChoice)->
GetClientObject(event.GetInt()))->mode) ) GetClientObject(event.GetInt()))->mode) )
{ {
wxLogError(wxT("Changing video mode failed!")); wxLogError("Changing video mode failed!");
} }
} }
@@ -410,10 +410,10 @@ void MyFrame::OnLeftClick(wxMouseEvent& event)
int dpy = wxDisplay::GetFromPoint(ptScreen); int dpy = wxDisplay::GetFromPoint(ptScreen);
if ( dpy == wxNOT_FOUND ) if ( dpy == wxNOT_FOUND )
{ {
wxLogError(wxT("Mouse clicked outside of display!?")); wxLogError("Mouse clicked outside of display!?");
} }
wxLogStatus(this, wxT("Mouse clicked in display %d (at (%d, %d))"), wxLogStatus(this, "Mouse clicked in display %d (at (%d, %d))",
dpy, ptScreen.x, ptScreen.y); dpy, ptScreen.x, ptScreen.y);
ReleaseMouse(); ReleaseMouse();
@@ -435,7 +435,7 @@ void MyFrame::OnDisplayChanged(wxDisplayChangedEvent& event)
} }
wxLogStatus(this, wxT("Display resolution was changed.")); wxLogStatus(this, "Display resolution was changed.");
event.Skip(); event.Skip();
} }

View File

@@ -77,7 +77,7 @@ public:
void OnDropURL(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxString& text) void OnDropURL(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxString& text)
{ {
// of course, a real program would do something more useful here... // of course, a real program would do something more useful here...
wxMessageBox(text, wxT("wxDnD sample: got URL"), wxMessageBox(text, "wxDnD sample: got URL",
wxICON_INFORMATION | wxOK); wxICON_INFORMATION | wxOK);
} }
@@ -370,12 +370,12 @@ public:
const wxColour& col) const wxColour& col)
: DnDShape(pos, size, col) : DnDShape(pos, size, col)
{ {
wxLogMessage(wxT("DnDTriangularShape is being created")); wxLogMessage("DnDTriangularShape is being created");
} }
virtual ~DnDTriangularShape() virtual ~DnDTriangularShape()
{ {
wxLogMessage(wxT("DnDTriangularShape is being deleted")); wxLogMessage("DnDTriangularShape is being deleted");
} }
virtual Kind GetKind() const wxOVERRIDE { return Triangle; } virtual Kind GetKind() const wxOVERRIDE { return Triangle; }
@@ -407,12 +407,12 @@ public:
const wxColour& col) const wxColour& col)
: DnDShape(pos, size, col) : DnDShape(pos, size, col)
{ {
wxLogMessage(wxT("DnDRectangularShape is being created")); wxLogMessage("DnDRectangularShape is being created");
} }
virtual ~DnDRectangularShape() virtual ~DnDRectangularShape()
{ {
wxLogMessage(wxT("DnDRectangularShape is being deleted")); wxLogMessage("DnDRectangularShape is being deleted");
} }
virtual Kind GetKind() const wxOVERRIDE { return Rectangle; } virtual Kind GetKind() const wxOVERRIDE { return Rectangle; }
@@ -443,12 +443,12 @@ public:
const wxColour& col) const wxColour& col)
: DnDShape(pos, size, col) : DnDShape(pos, size, col)
{ {
wxLogMessage(wxT("DnDEllipticShape is being created")); wxLogMessage("DnDEllipticShape is being created");
} }
virtual ~DnDEllipticShape() virtual ~DnDEllipticShape()
{ {
wxLogMessage(wxT("DnDEllipticShape is being deleted")); wxLogMessage("DnDEllipticShape is being deleted");
} }
virtual Kind GetKind() const wxOVERRIDE { return Ellipse; } virtual Kind GetKind() const wxOVERRIDE { return Ellipse; }
@@ -467,7 +467,10 @@ public:
// A wxDataObject specialisation for the application-specific data // A wxDataObject specialisation for the application-specific data
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
static const wxChar *shapeFormatId = wxT("wxShape"); static wxString ShapeFormatId()
{
return "wxShape";
}
class DnDShapeDataObject : public wxDataObject class DnDShapeDataObject : public wxDataObject
{ {
@@ -495,7 +498,7 @@ public:
// this string should uniquely identify our format, but is otherwise // this string should uniquely identify our format, but is otherwise
// arbitrary // arbitrary
m_formatShape.SetId(shapeFormatId); m_formatShape.SetId(ShapeFormatId());
// we don't draw the shape to a bitmap until it's really needed (i.e. // we don't draw the shape to a bitmap until it's really needed (i.e.
// we're asked to do so) // we're asked to do so)
@@ -586,7 +589,7 @@ public:
else else
{ {
wxASSERT_MSG( m_dobjBitmap.IsSupported(format), wxASSERT_MSG( m_dobjBitmap.IsSupported(format),
wxT("unexpected format") ); "unexpected format" );
if ( !m_hasBitmap ) if ( !m_hasBitmap )
CreateBitmap(); CreateBitmap();
@@ -615,7 +618,7 @@ public:
else else
{ {
wxASSERT_MSG( m_dobjBitmap.IsSupported(format), wxASSERT_MSG( m_dobjBitmap.IsSupported(format),
wxT("unexpected format") ); "unexpected format" );
if ( !m_hasBitmap ) if ( !m_hasBitmap )
CreateBitmap(); CreateBitmap();
@@ -755,21 +758,21 @@ public:
virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
m_frame->SetStatusText(wxT("Mouse entered the frame")); m_frame->SetStatusText("Mouse entered the frame");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
return OnDragOver(x, y, def); return OnDragOver(x, y, def);
} }
virtual void OnLeave() wxOVERRIDE virtual void OnLeave() wxOVERRIDE
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
m_frame->SetStatusText(wxT("Mouse left the frame")); m_frame->SetStatusText("Mouse left the frame");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE
{ {
if ( !GetData() ) if ( !GetData() )
{ {
wxLogError(wxT("Failed to get drag and drop data")); wxLogError("Failed to get drag and drop data");
return wxDragNone; return wxDragNone;
} }
@@ -909,7 +912,7 @@ bool DnDApp::OnInit()
// switch on trace messages // switch on trace messages
#if wxUSE_LOG #if wxUSE_LOG
#if defined(__WXGTK__) #if defined(__WXGTK__)
wxLog::AddTraceMask(wxT("clipboard")); wxLog::AddTraceMask("clipboard");
#elif defined(__WXMSW__) #elif defined(__WXMSW__)
wxLog::AddTraceMask(wxTRACE_OleCalls); wxLog::AddTraceMask(wxTRACE_OleCalls);
#endif #endif
@@ -924,7 +927,7 @@ bool DnDApp::OnInit()
return true; return true;
#else #else
wxMessageBox( wxT("This sample has to be compiled with wxUSE_DRAG_AND_DROP"), wxT("Building error"), wxOK); wxMessageBox( "This sample has to be compiled with wxUSE_DRAG_AND_DROP", "Building error", wxOK);
return false; return false;
#endif // wxUSE_DRAG_AND_DROP #endif // wxUSE_DRAG_AND_DROP
} }
@@ -932,9 +935,9 @@ bool DnDApp::OnInit()
#if wxUSE_DRAG_AND_DROP || wxUSE_CLIPBOARD #if wxUSE_DRAG_AND_DROP || wxUSE_CLIPBOARD
DnDFrame::DnDFrame() DnDFrame::DnDFrame()
: wxFrame(NULL, wxID_ANY, wxT("Drag-and-Drop/Clipboard wxWidgets Sample"), : wxFrame(NULL, wxID_ANY, "Drag-and-Drop/Clipboard wxWidgets Sample",
wxPoint(10, 100)), wxPoint(10, 100)),
m_strText(wxT("wxWidgets drag & drop works :-)")) m_strText("wxWidgets drag & drop works :-)")
{ {
// frame icon and status bar // frame icon and status bar
@@ -946,54 +949,54 @@ DnDFrame::DnDFrame()
// construct menu // construct menu
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(Menu_Drag, wxT("&Test drag...")); file_menu->Append(Menu_Drag, "&Test drag...");
file_menu->AppendCheckItem(Menu_DragMoveDef, wxT("&Move by default")); file_menu->AppendCheckItem(Menu_DragMoveDef, "&Move by default");
file_menu->AppendCheckItem(Menu_DragMoveAllow, wxT("&Allow moving")); file_menu->AppendCheckItem(Menu_DragMoveAllow, "&Allow moving");
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(Menu_NewFrame, wxT("&New frame\tCtrl-N")); file_menu->Append(Menu_NewFrame, "&New frame\tCtrl-N");
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(Menu_Quit, wxT("E&xit\tCtrl-Q")); file_menu->Append(Menu_Quit, "E&xit\tCtrl-Q");
#if wxUSE_LOG #if wxUSE_LOG
wxMenu *log_menu = new wxMenu; wxMenu *log_menu = new wxMenu;
log_menu->Append(Menu_Clear, wxT("Clear\tCtrl-L")); log_menu->Append(Menu_Clear, "Clear\tCtrl-L");
#endif // wxUSE_LOG #endif // wxUSE_LOG
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append(Menu_Help, wxT("&Help...")); help_menu->Append(Menu_Help, "&Help...");
help_menu->AppendSeparator(); help_menu->AppendSeparator();
help_menu->Append(Menu_About, wxT("&About")); help_menu->Append(Menu_About, "&About");
wxMenu *clip_menu = new wxMenu; wxMenu *clip_menu = new wxMenu;
clip_menu->Append(Menu_Copy, wxT("&Copy text\tCtrl-C")); clip_menu->Append(Menu_Copy, "&Copy text\tCtrl-C");
clip_menu->Append(Menu_Paste, wxT("&Paste text\tCtrl-V")); clip_menu->Append(Menu_Paste, "&Paste text\tCtrl-V");
clip_menu->AppendSeparator(); clip_menu->AppendSeparator();
clip_menu->Append(Menu_CopyBitmap, wxT("Copy &bitmap\tCtrl-Shift-C")); clip_menu->Append(Menu_CopyBitmap, "Copy &bitmap\tCtrl-Shift-C");
clip_menu->Append(Menu_PasteBitmap, wxT("Paste b&itmap\tCtrl-Shift-V")); clip_menu->Append(Menu_PasteBitmap, "Paste b&itmap\tCtrl-Shift-V");
#if wxUSE_METAFILE #if wxUSE_METAFILE
clip_menu->AppendSeparator(); clip_menu->AppendSeparator();
clip_menu->Append(Menu_PasteMFile, wxT("Paste &metafile\tCtrl-M")); clip_menu->Append(Menu_PasteMFile, "Paste &metafile\tCtrl-M");
#endif // wxUSE_METAFILE #endif // wxUSE_METAFILE
clip_menu->AppendSeparator(); clip_menu->AppendSeparator();
clip_menu->Append(Menu_CopyFiles, wxT("Copy &files\tCtrl-F")); clip_menu->Append(Menu_CopyFiles, "Copy &files\tCtrl-F");
clip_menu->Append(Menu_CopyURL, wxT("Copy &URL\tCtrl-U")); clip_menu->Append(Menu_CopyURL, "Copy &URL\tCtrl-U");
clip_menu->AppendSeparator(); clip_menu->AppendSeparator();
clip_menu->AppendCheckItem(Menu_UsePrimary, wxT("Use &primary selection\tCtrl-P")); clip_menu->AppendCheckItem(Menu_UsePrimary, "Use &primary selection\tCtrl-P");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
#if wxUSE_LOG #if wxUSE_LOG
menu_bar->Append(log_menu, wxT("&Log")); menu_bar->Append(log_menu, "&Log");
#endif // wxUSE_LOG #endif // wxUSE_LOG
menu_bar->Append(clip_menu, wxT("&Clipboard")); menu_bar->Append(clip_menu, "&Clipboard");
menu_bar->Append(help_menu, wxT("&Help")); menu_bar->Append(help_menu, "&Help");
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
// create the child controls // create the child controls
SetBackgroundColour(*wxWHITE); // labels read better on this background SetBackgroundColour(*wxWHITE); // labels read better on this background
wxString strFile(wxT("Drop files here!")), strText(wxT("Drop text on me")); wxString strFile("Drop files here!"), strText("Drop text on me");
m_ctrlFile = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 1, &strFile, m_ctrlFile = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 1, &strFile,
wxLB_HSCROLL | wxLB_ALWAYS_SB ); wxLB_HSCROLL | wxLB_ALWAYS_SB );
@@ -1078,7 +1081,7 @@ void DnDFrame::OnPaint(wxPaintEvent& WXUNUSED(event))
wxPaintDC dc(this); wxPaintDC dc(this);
dc.SetFont( wxFontInfo(24).Family(wxFONTFAMILY_DECORATIVE).FaceName("charter") ); dc.SetFont( wxFontInfo(24).Family(wxFONTFAMILY_DECORATIVE).FaceName("charter") );
dc.DrawText( wxT("Drag text from here!"), 100, h-50 ); dc.DrawText( "Drag text from here!", 100, h-50 );
} }
void DnDFrame::OnUpdateUIMoveByDefault(wxUpdateUIEvent& event) void DnDFrame::OnUpdateUIMoveByDefault(wxUpdateUIEvent& event)
@@ -1114,7 +1117,7 @@ void DnDFrame::OnNewFrame(wxCommandEvent& WXUNUSED(event))
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
(new DnDShapeFrame(this))->Show(true); (new DnDShapeFrame(this))->Show(true);
wxLogStatus(this, wxT("Double click the new frame to select a shape for it")); wxLogStatus(this, "Double click the new frame to select a shape for it");
#endif // wxUSE_DRAG_AND_DROP #endif // wxUSE_DRAG_AND_DROP
} }
@@ -1123,11 +1126,11 @@ void DnDFrame::OnDrag(wxCommandEvent& WXUNUSED(event))
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
wxString strText = wxGetTextFromUser wxString strText = wxGetTextFromUser
( (
wxT("After you enter text in this dialog, press any mouse\n") "After you enter text in this dialog, press any mouse\n"
wxT("button in the bottom (empty) part of the frame and \n") "button in the bottom (empty) part of the frame and \n"
wxT("drag it anywhere - you will be in fact dragging the\n") "drag it anywhere - you will be in fact dragging the\n"
wxT("text object containing this text"), "text object containing this text",
wxT("Please enter some text"), m_strText, this "Please enter some text", m_strText, this
); );
m_strText = strText; m_strText = strText;
@@ -1146,10 +1149,10 @@ void DnDFrame::OnDragMoveAllow(wxCommandEvent& event)
void DnDFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void DnDFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("Drag-&-Drop Demo\n") wxMessageBox("Drag-&-Drop Demo\n"
wxT("Please see \"Help|Help...\" for details\n") wxT("Please see \"Help|Help...\" for details\n")
wxT("Copyright (c) 1998 Vadim Zeitlin"), "Copyright (c) 1998 Vadim Zeitlin",
wxT("About wxDnD"), "About wxDnD",
wxICON_INFORMATION | wxOK, wxICON_INFORMATION | wxOK,
this); this);
} }
@@ -1157,27 +1160,27 @@ void DnDFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
void DnDFrame::OnHelp(wxCommandEvent& /* event */) void DnDFrame::OnHelp(wxCommandEvent& /* event */)
{ {
wxMessageDialog dialog(this, wxMessageDialog dialog(this,
wxT("This small program demonstrates drag & drop support in wxWidgets. The program window\n") "This small program demonstrates drag & drop support in wxWidgets. The program window\n"
wxT("consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n") "consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n"
wxT("going on inside. The top part is split into 2 listboxes, the left one accepts files\n") "going on inside. The top part is split into 2 listboxes, the left one accepts files\n"
wxT("and the right one accepts text.\n") "and the right one accepts text.\n"
wxT("\n") "\n"
wxT("To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n") "To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n"
wxT("the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n") "the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n"
wxT("Also, try dragging some files (you can select several at once) from Windows Explorer (or \n") "Also, try dragging some files (you can select several at once) from Windows Explorer (or \n"
wxT("File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n") "File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n"
wxT("work with files) and see what changes.\n") "work with files) and see what changes.\n"
wxT("\n") "\n"
wxT("To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n") "To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n"
wxT("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"
wxT("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"
wxT("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") wxT("dragged in \"File|Test drag...\" dialog.\n")
wxT("\n") "\n"
wxT("\n") "\n"
wxT("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>"), wxT("Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>"),
wxT("wxDnD Help")); "wxDnD Help");
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -1196,18 +1199,18 @@ void DnDFrame::OnLogClear(wxCommandEvent& /* event */ )
void DnDFrame::LogDragResult(wxDragResult result) void DnDFrame::LogDragResult(wxDragResult result)
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
const wxChar *pc; wxString pc;
switch ( result ) switch ( result )
{ {
case wxDragError: pc = wxT("Error!"); break; case wxDragError: pc = "Error!"; break;
case wxDragNone: pc = wxT("Nothing"); break; case wxDragNone: pc = "Nothing"; break;
case wxDragCopy: pc = wxT("Copied"); break; case wxDragCopy: pc = "Copied"; break;
case wxDragMove: pc = wxT("Moved"); break; case wxDragMove: pc = "Moved"; break;
case wxDragCancel: pc = wxT("Cancelled"); break; case wxDragCancel: pc = "Cancelled"; break;
default: pc = wxT("Huh?"); break; default: pc = "Huh?"; break;
} }
SetStatusText(wxString(wxT("Drag result: ")) + pc); SetStatusText(wxString("Drag result: ") + pc);
#else #else
wxUnusedVar(result); wxUnusedVar(result);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -1240,11 +1243,11 @@ void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
void DnDFrame::OnRightDown(wxMouseEvent &event ) void DnDFrame::OnRightDown(wxMouseEvent &event )
{ {
wxMenu menu(wxT("Dnd sample menu")); wxMenu menu("Dnd sample menu");
menu.Append(Menu_Drag, wxT("&Test drag...")); menu.Append(Menu_Drag, "&Test drag...");
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append(Menu_About, wxT("&About")); menu.Append(Menu_About, "&About");
PopupMenu( &menu, event.GetX(), event.GetY() ); PopupMenu( &menu, event.GetX(), event.GetY() );
} }
@@ -1264,8 +1267,8 @@ void DnDFrame::OnUsePrimary(wxCommandEvent& event)
const bool usePrimary = event.IsChecked(); const bool usePrimary = event.IsChecked();
wxTheClipboard->UsePrimarySelection(usePrimary); wxTheClipboard->UsePrimarySelection(usePrimary);
wxLogStatus(wxT("Now using %s selection"), usePrimary ? wxT("primary") wxLogStatus("Now using %s selection", usePrimary ? "primary"
: wxT("clipboard")); : "clipboard");
} }
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
@@ -1291,26 +1294,26 @@ 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, wxT("Open a PNG file"), wxEmptyString, wxEmptyString, wxT("PNG files (*.png)|*.png"), 0); wxFileDialog dialog(this, "Open a PNG file", wxEmptyString, wxEmptyString, wxT("PNG files (*.png)|*.png"), 0);
#else #else
wxFileDialog dialog(this, wxT("Open a BMP file"), wxEmptyString, wxEmptyString, wxT("BMP files (*.bmp)|*.bmp"), 0); wxFileDialog dialog(this, "Open a BMP file", wxEmptyString, wxEmptyString, wxT("BMP files (*.bmp)|*.bmp"), 0);
#endif #endif
if (dialog.ShowModal() != wxID_OK) if (dialog.ShowModal() != wxID_OK)
{ {
wxLogMessage( wxT("Aborted file open") ); wxLogMessage( "Aborted file open" );
return; return;
} }
if (dialog.GetPath().empty()) if (dialog.GetPath().empty())
{ {
wxLogMessage( wxT("Returned empty string.") ); wxLogMessage( "Returned empty string." );
return; return;
} }
if (!wxFileExists(dialog.GetPath())) if (!wxFileExists(dialog.GetPath()))
{ {
wxLogMessage( wxT("File doesn't exist.") ); wxLogMessage( "File doesn't exist." );
return; return;
} }
@@ -1324,33 +1327,33 @@ void DnDFrame::OnCopyBitmap(wxCommandEvent& WXUNUSED(event))
); );
if (!image.IsOk()) if (!image.IsOk())
{ {
wxLogError( wxT("Invalid image file...") ); wxLogError( "Invalid image file..." );
return; return;
} }
wxLogStatus( wxT("Decoding image file...") ); wxLogStatus( "Decoding image file..." );
wxYield(); wxYield();
wxBitmap bitmap( image ); wxBitmap bitmap( image );
if ( !wxTheClipboard->Open() ) if ( !wxTheClipboard->Open() )
{ {
wxLogError(wxT("Can't open clipboard.")); wxLogError("Can't open clipboard.");
return; return;
} }
wxLogMessage( wxT("Creating wxBitmapDataObject...") ); wxLogMessage( "Creating wxBitmapDataObject..." );
wxYield(); wxYield();
if ( !wxTheClipboard->AddData(new wxBitmapDataObject(bitmap)) ) if ( !wxTheClipboard->AddData(new wxBitmapDataObject(bitmap)) )
{ {
wxLogError(wxT("Can't copy image to the clipboard.")); wxLogError("Can't copy image to the clipboard.");
} }
else else
{ {
wxLogMessage(wxT("Image has been put on the clipboard.") ); wxLogMessage("Image has been put on the clipboard." );
wxLogMessage(wxT("You can paste it now and look at it.") ); wxLogMessage("You can paste it now and look at it." );
} }
wxTheClipboard->Close(); wxTheClipboard->Close();
@@ -1360,14 +1363,14 @@ void DnDFrame::OnPasteBitmap(wxCommandEvent& WXUNUSED(event))
{ {
if ( !wxTheClipboard->Open() ) if ( !wxTheClipboard->Open() )
{ {
wxLogError(wxT("Can't open clipboard.")); wxLogError("Can't open clipboard.");
return; return;
} }
if ( !wxTheClipboard->IsSupported(wxDF_BITMAP) ) if ( !wxTheClipboard->IsSupported(wxDF_BITMAP) )
{ {
wxLogWarning(wxT("No bitmap on clipboard")); wxLogWarning("No bitmap on clipboard");
wxTheClipboard->Close(); wxTheClipboard->Close();
return; return;
@@ -1376,13 +1379,13 @@ void DnDFrame::OnPasteBitmap(wxCommandEvent& WXUNUSED(event))
wxBitmapDataObject data; wxBitmapDataObject data;
if ( !wxTheClipboard->GetData(data) ) if ( !wxTheClipboard->GetData(data) )
{ {
wxLogError(wxT("Can't paste bitmap from the clipboard")); wxLogError("Can't paste bitmap from the clipboard");
} }
else else
{ {
const wxBitmap& bmp = data.GetBitmap(); const wxBitmap& bmp = data.GetBitmap();
wxLogMessage(wxT("Bitmap %dx%d pasted from the clipboard"), wxLogMessage("Bitmap %dx%d pasted from the clipboard",
bmp.GetWidth(), bmp.GetHeight()); bmp.GetWidth(), bmp.GetHeight());
ShowBitmap(bmp); ShowBitmap(bmp);
} }
@@ -1396,27 +1399,27 @@ void DnDFrame::OnPasteMetafile(wxCommandEvent& WXUNUSED(event))
{ {
if ( !wxTheClipboard->Open() ) if ( !wxTheClipboard->Open() )
{ {
wxLogError(wxT("Can't open clipboard.")); wxLogError("Can't open clipboard.");
return; return;
} }
if ( !wxTheClipboard->IsSupported(wxDF_METAFILE) ) if ( !wxTheClipboard->IsSupported(wxDF_METAFILE) )
{ {
wxLogWarning(wxT("No metafile on clipboard")); wxLogWarning("No metafile on clipboard");
} }
else else
{ {
wxMetaFileDataObject data; wxMetaFileDataObject data;
if ( !wxTheClipboard->GetData(data) ) if ( !wxTheClipboard->GetData(data) )
{ {
wxLogError(wxT("Can't paste metafile from the clipboard")); wxLogError("Can't paste metafile from the clipboard");
} }
else else
{ {
const wxMetaFile& mf = data.GetMetafile(); const wxMetaFile& mf = data.GetMetafile();
wxLogMessage(wxT("Metafile %dx%d pasted from the clipboard"), wxLogMessage("Metafile %dx%d pasted from the clipboard",
mf.GetWidth(), mf.GetHeight()); mf.GetWidth(), mf.GetHeight());
ShowMetaFile(mf); ShowMetaFile(mf);
@@ -1435,7 +1438,7 @@ void DnDFrame::OnPasteMetafile(wxCommandEvent& WXUNUSED(event))
void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event)) void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event))
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
wxFileDialog dialog(this, wxT("Select a file to copy"), wxEmptyString, wxEmptyString, wxFileDialog dialog(this, "Select a file to copy", wxEmptyString, wxEmptyString,
wxT("All files (*.*)|*.*"), 0); wxT("All files (*.*)|*.*"), 0);
wxArrayString filenames; wxArrayString filenames;
@@ -1456,27 +1459,27 @@ void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event))
wxClipboardLocker locker; wxClipboardLocker locker;
if ( !locker ) if ( !locker )
{ {
wxLogError(wxT("Can't open clipboard")); wxLogError("Can't open clipboard");
} }
else else
{ {
if ( !wxTheClipboard->AddData(dobj) ) if ( !wxTheClipboard->AddData(dobj) )
{ {
wxLogError(wxT("Can't copy file(s) to the clipboard")); wxLogError("Can't copy file(s) to the clipboard");
} }
else else
{ {
wxLogStatus(this, wxT("%d file%s copied to the clipboard"), wxLogStatus(this, "%d file%s copied to the clipboard",
count, count == 1 ? wxEmptyString : wxEmptyString); count, count == 1 ? wxEmptyString : wxEmptyString);
} }
} }
} }
else else
{ {
wxLogStatus(this, wxT("Aborted")); wxLogStatus(this, "Aborted");
} }
#else // !MSW #else // !MSW
wxLogError(wxT("Sorry, not implemented")); wxLogError("Sorry, not implemented");
#endif // MSW/!MSW #endif // MSW/!MSW
} }
@@ -1509,18 +1512,18 @@ void DnDFrame::OnCopy(wxCommandEvent& WXUNUSED(event))
{ {
if ( !wxTheClipboard->Open() ) if ( !wxTheClipboard->Open() )
{ {
wxLogError(wxT("Can't open clipboard.")); wxLogError("Can't open clipboard.");
return; return;
} }
if ( !wxTheClipboard->AddData(new wxTextDataObject(m_strText)) ) if ( !wxTheClipboard->AddData(new wxTextDataObject(m_strText)) )
{ {
wxLogError(wxT("Can't copy data to the clipboard")); wxLogError("Can't copy data to the clipboard");
} }
else else
{ {
wxLogMessage(wxT("Text '%s' put on the clipboard"), m_strText.c_str()); wxLogMessage("Text '%s' put on the clipboard", m_strText.c_str());
} }
wxTheClipboard->Close(); wxTheClipboard->Close();
@@ -1530,14 +1533,14 @@ void DnDFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
{ {
if ( !wxTheClipboard->Open() ) if ( !wxTheClipboard->Open() )
{ {
wxLogError(wxT("Can't open clipboard.")); wxLogError("Can't open clipboard.");
return; return;
} }
if ( !wxTheClipboard->IsSupported(wxDF_TEXT) ) if ( !wxTheClipboard->IsSupported(wxDF_TEXT) )
{ {
wxLogWarning(wxT("No text data on clipboard")); wxLogWarning("No text data on clipboard");
wxTheClipboard->Close(); wxTheClipboard->Close();
return; return;
@@ -1546,11 +1549,11 @@ void DnDFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
wxTextDataObject text; wxTextDataObject text;
if ( !wxTheClipboard->GetData(text) ) if ( !wxTheClipboard->GetData(text) )
{ {
wxLogError(wxT("Can't paste data from the clipboard")); wxLogError("Can't paste data from the clipboard");
} }
else else
{ {
wxLogMessage(wxT("Text '%s' pasted from the clipboard"), wxLogMessage("Text '%s' pasted from the clipboard",
text.GetText().c_str()); text.GetText().c_str());
} }
@@ -1574,7 +1577,7 @@ bool DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames)
{ {
size_t nFiles = filenames.GetCount(); size_t nFiles = filenames.GetCount();
wxString str; wxString str;
str.Printf( wxT("%d files dropped"), (int)nFiles); str.Printf( "%d files dropped", (int)nFiles);
if (m_pOwner != NULL) if (m_pOwner != NULL)
{ {
@@ -1591,7 +1594,7 @@ bool DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape) DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape)
:wxDialog( parent, 6001, wxT("Choose Shape"), wxPoint( 10, 10 ), :wxDialog( parent, 6001, "Choose Shape", wxPoint( 10, 10 ),
wxSize( 40, 40 ), wxSize( 40, 40 ),
wxDEFAULT_DIALOG_STYLE | wxRAISED_BORDER | wxRESIZE_BORDER ) wxDEFAULT_DIALOG_STYLE | wxRAISED_BORDER | wxRESIZE_BORDER )
{ {
@@ -1600,47 +1603,47 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape)
// radio box // radio box
wxBoxSizer* shapesSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* shapesSizer = new wxBoxSizer( wxHORIZONTAL );
const wxString choices[] = { wxT("None"), wxT("Triangle"), const wxString choices[] = { "None", "Triangle",
wxT("Rectangle"), wxT("Ellipse") }; "Rectangle", "Ellipse" };
m_radio = new wxRadioBox( this, wxID_ANY, wxT("&Shape"), m_radio = new wxRadioBox( this, wxID_ANY, "&Shape",
wxDefaultPosition, wxDefaultSize, 4, choices, 4, wxDefaultPosition, wxDefaultSize, 4, choices, 4,
wxRA_SPECIFY_COLS ); wxRA_SPECIFY_COLS );
shapesSizer->Add( m_radio, 0, wxGROW|wxALL, 5 ); shapesSizer->Add( m_radio, 0, wxGROW|wxALL, 5 );
topSizer->Add( shapesSizer, 0, wxALL, 2 ); topSizer->Add( shapesSizer, 0, wxALL, 2 );
// attributes // attributes
wxStaticBox* box = new wxStaticBox( this, wxID_ANY, wxT("&Attributes") ); wxStaticBox* box = new wxStaticBox( this, wxID_ANY, "&Attributes" );
wxStaticBoxSizer* attrSizer = new wxStaticBoxSizer( box, wxHORIZONTAL ); wxStaticBoxSizer* attrSizer = new wxStaticBoxSizer( box, wxHORIZONTAL );
wxFlexGridSizer* xywhSizer = new wxFlexGridSizer( 2 ); wxFlexGridSizer* xywhSizer = new wxFlexGridSizer( 2 );
wxStaticText* st; wxStaticText* st;
st = new wxStaticText( this, wxID_ANY, wxT("Position &X:") ); st = new wxStaticText( this, wxID_ANY, "Position &X:" );
m_textX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, m_textX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize( 30, 20 ) ); wxSize( 30, 20 ) );
xywhSizer->Add( st, 1, wxGROW|wxALL, 2 ); xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
xywhSizer->Add( m_textX, 1, wxGROW|wxALL, 2 ); xywhSizer->Add( m_textX, 1, wxGROW|wxALL, 2 );
st = new wxStaticText( this, wxID_ANY, wxT("Size &width:") ); st = new wxStaticText( this, wxID_ANY, "Size &width:" );
m_textW = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, m_textW = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize( 30, 20 ) ); wxSize( 30, 20 ) );
xywhSizer->Add( st, 1, wxGROW|wxALL, 2 ); xywhSizer->Add( st, 1, wxGROW|wxALL, 2 );
xywhSizer->Add( m_textW, 1, wxGROW|wxALL, 2 ); xywhSizer->Add( m_textW, 1, wxGROW|wxALL, 2 );
st = new wxStaticText( this, wxID_ANY, wxT("&Y:") ); st = new wxStaticText( this, wxID_ANY, "&Y:" );
m_textY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, m_textY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize( 30, 20 ) ); wxSize( 30, 20 ) );
xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 ); xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
xywhSizer->Add( m_textY, 1, wxGROW|wxALL, 2 ); xywhSizer->Add( m_textY, 1, wxGROW|wxALL, 2 );
st = new wxStaticText( this, wxID_ANY, wxT("&height:") ); st = new wxStaticText( this, wxID_ANY, "&height:" );
m_textH = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, m_textH = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize( 30, 20 ) ); wxSize( 30, 20 ) );
xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 ); xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 2 );
xywhSizer->Add( m_textH, 1, wxGROW|wxALL, 2 ); xywhSizer->Add( m_textH, 1, wxGROW|wxALL, 2 );
wxButton* col = new wxButton( this, Button_Colour, wxT("&Colour...") ); wxButton* col = new wxButton( this, Button_Colour, "&Colour..." );
attrSizer->Add( xywhSizer, 1, wxGROW ); attrSizer->Add( xywhSizer, 1, wxGROW );
attrSizer->Add( col, 0, wxALL|wxALIGN_CENTRE_VERTICAL, 2 ); attrSizer->Add( col, 0, wxALL|wxALIGN_CENTRE_VERTICAL, 2 );
topSizer->Add( attrSizer, 0, wxGROW|wxALL, 5 ); topSizer->Add( attrSizer, 0, wxGROW|wxALL, 5 );
@@ -1648,9 +1651,9 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape)
// buttons // buttons
wxBoxSizer* buttonSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* buttonSizer = new wxBoxSizer( wxHORIZONTAL );
wxButton* bt; wxButton* bt;
bt = new wxButton( this, wxID_OK, wxT("Ok") ); bt = new wxButton( this, wxID_OK, "Ok" );
buttonSizer->Add( bt, 0, wxALL, 2 ); buttonSizer->Add( bt, 0, wxALL, 2 );
bt = new wxButton( this, wxID_CANCEL, wxT("Cancel") ); bt = new wxButton( this, wxID_CANCEL, "Cancel" );
buttonSizer->Add( bt, 0, wxALL, 2 ); buttonSizer->Add( bt, 0, wxALL, 2 );
topSizer->Add( buttonSizer, 0, wxALL|wxALIGN_RIGHT, 2 ); topSizer->Add( buttonSizer, 0, wxALL|wxALIGN_RIGHT, 2 );
@@ -1705,8 +1708,8 @@ bool DnDShapeDialog::TransferDataFromWindow()
if ( !m_pos.x || !m_pos.y || !m_size.x || !m_size.y ) if ( !m_pos.x || !m_pos.y || !m_size.x || !m_size.y )
{ {
wxMessageBox(wxT("All sizes and positions should be non null!"), wxMessageBox("All sizes and positions should be non null!",
wxT("Invalid shape"), wxICON_HAND | wxOK, this); "Invalid shape", wxICON_HAND | wxOK, this);
return false; return false;
} }
@@ -1738,30 +1741,30 @@ void DnDShapeDialog::OnColour(wxCommandEvent& WXUNUSED(event))
DnDShapeFrame *DnDShapeFrame::ms_lastDropTarget = NULL; DnDShapeFrame *DnDShapeFrame::ms_lastDropTarget = NULL;
DnDShapeFrame::DnDShapeFrame(wxFrame *parent) DnDShapeFrame::DnDShapeFrame(wxFrame *parent)
: wxFrame(parent, wxID_ANY, wxT("Shape Frame")) : wxFrame(parent, wxID_ANY, "Shape Frame")
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
CreateStatusBar(); CreateStatusBar();
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
wxMenu *menuShape = new wxMenu; wxMenu *menuShape = new wxMenu;
menuShape->Append(Menu_Shape_New, wxT("&New default shape\tCtrl-S")); menuShape->Append(Menu_Shape_New, "&New default shape\tCtrl-S");
menuShape->Append(Menu_Shape_Edit, wxT("&Edit shape\tCtrl-E")); menuShape->Append(Menu_Shape_Edit, "&Edit shape\tCtrl-E");
menuShape->AppendSeparator(); menuShape->AppendSeparator();
menuShape->Append(Menu_Shape_Clear, wxT("&Clear shape\tCtrl-L")); menuShape->Append(Menu_Shape_Clear, "&Clear shape\tCtrl-L");
wxMenu *menuClipboard = new wxMenu; wxMenu *menuClipboard = new wxMenu;
menuClipboard->Append(Menu_ShapeClipboard_Copy, wxT("&Copy\tCtrl-C")); menuClipboard->Append(Menu_ShapeClipboard_Copy, "&Copy\tCtrl-C");
menuClipboard->Append(Menu_ShapeClipboard_Paste, wxT("&Paste\tCtrl-V")); menuClipboard->Append(Menu_ShapeClipboard_Paste, "&Paste\tCtrl-V");
wxMenuBar *menubar = new wxMenuBar; wxMenuBar *menubar = new wxMenuBar;
menubar->Append(menuShape, wxT("&Shape")); menubar->Append(menuShape, "&Shape");
menubar->Append(menuClipboard, wxT("&Clipboard")); menubar->Append(menuClipboard, "&Clipboard");
SetMenuBar(menubar); SetMenuBar(menubar);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Press Ctrl-S to create a new shape")); SetStatusText("Press Ctrl-S to create a new shape");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
SetDropTarget(new DnDShapeDropTarget(this)); SetDropTarget(new DnDShapeDropTarget(this));
@@ -1799,26 +1802,26 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event)
DnDShapeDataObject shapeData(m_shape); DnDShapeDataObject shapeData(m_shape);
wxDropSource source(shapeData, this); wxDropSource source(shapeData, this);
const wxChar *pc = NULL; wxString pc;
switch ( source.DoDragDrop(true) ) switch ( source.DoDragDrop(true) )
{ {
default: default:
case wxDragError: case wxDragError:
wxLogError(wxT("An error occurred during drag and drop operation")); wxLogError("An error occurred during drag and drop operation");
break; break;
case wxDragNone: case wxDragNone:
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Nothing happened")); SetStatusText("Nothing happened");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
break; break;
case wxDragCopy: case wxDragCopy:
pc = wxT("copied"); pc = "copied";
break; break;
case wxDragMove: case wxDragMove:
pc = wxT("moved"); pc = "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!
@@ -1828,15 +1831,15 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event)
case wxDragCancel: case wxDragCancel:
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Drag and drop operation cancelled")); SetStatusText("Drag and drop operation cancelled");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
break; break;
} }
if ( pc ) if ( pc.length() )
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxString(wxT("Shape successfully ")) + pc); SetStatusText(wxString("Shape successfully ") + pc);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
//else: status text already set //else: status text already set
@@ -1850,7 +1853,7 @@ void DnDShapeFrame::OnDrop(wxCoord x, wxCoord y, DnDShape *shape)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
wxString s; wxString s;
s.Printf(wxT("Shape dropped at (%d, %d)"), pt.x, pt.y); s.Printf("Shape dropped at (%d, %d)", pt.x, pt.y);
SetStatusText(s); SetStatusText(s);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -1868,7 +1871,7 @@ void DnDShapeFrame::OnEditShape(wxCommandEvent& WXUNUSED(event))
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
if ( m_shape ) if ( m_shape )
{ {
SetStatusText(wxT("You can now drag the shape to another frame")); SetStatusText("You can now drag the shape to another frame");
} }
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -1879,7 +1882,7 @@ void DnDShapeFrame::OnNewShape(wxCommandEvent& WXUNUSED(event))
SetShape(new DnDEllipticShape(wxPoint(10, 10), wxSize(80, 60), *wxRED)); SetShape(new DnDEllipticShape(wxPoint(10, 10), wxSize(80, 60), *wxRED));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("You can now drag the shape to another frame")); SetStatusText("You can now drag the shape to another frame");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -1895,7 +1898,7 @@ void DnDShapeFrame::OnCopyShape(wxCommandEvent& WXUNUSED(event))
wxClipboardLocker clipLocker; wxClipboardLocker clipLocker;
if ( !clipLocker ) if ( !clipLocker )
{ {
wxLogError(wxT("Can't open the clipboard")); wxLogError("Can't open the clipboard");
return; return;
} }
@@ -1909,7 +1912,7 @@ void DnDShapeFrame::OnPasteShape(wxCommandEvent& WXUNUSED(event))
wxClipboardLocker clipLocker; wxClipboardLocker clipLocker;
if ( !clipLocker ) if ( !clipLocker )
{ {
wxLogError(wxT("Can't open the clipboard")); wxLogError("Can't open the clipboard");
return; return;
} }
@@ -1921,7 +1924,7 @@ void DnDShapeFrame::OnPasteShape(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
wxLogStatus(wxT("No shape on the clipboard")); wxLogStatus("No shape on the clipboard");
} }
} }
@@ -1932,7 +1935,7 @@ void DnDShapeFrame::OnUpdateUICopy(wxUpdateUIEvent& event)
void DnDShapeFrame::OnUpdateUIPaste(wxUpdateUIEvent& event) void DnDShapeFrame::OnUpdateUIPaste(wxUpdateUIEvent& event)
{ {
event.Enable( wxTheClipboard->IsSupported(wxDataFormat(shapeFormatId)) ); event.Enable( wxTheClipboard->IsSupported(wxDataFormat(ShapeFormatId())) );
} }
void DnDShapeFrame::OnPaint(wxPaintEvent& event) void DnDShapeFrame::OnPaint(wxPaintEvent& event)
@@ -1974,7 +1977,7 @@ DnDShape *DnDShape::New(const void *buf)
wxColour(dump.r, dump.g, dump.b)); wxColour(dump.r, dump.g, dump.b));
default: default:
wxFAIL_MSG(wxT("invalid shape!")); wxFAIL_MSG("invalid shape!");
return NULL; return NULL;
} }
} }
@@ -2032,7 +2035,7 @@ void DnDShapeDataObject::CreateBitmap() const
static void ShowBitmap(const wxBitmap& bitmap) static void ShowBitmap(const wxBitmap& bitmap)
{ {
wxFrame *frame = new wxFrame(NULL, wxID_ANY, wxT("Bitmap view")); wxFrame *frame = new wxFrame(NULL, wxID_ANY, "Bitmap view");
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->CreateStatusBar(); frame->CreateStatusBar();
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -2042,7 +2045,7 @@ static void ShowBitmap(const wxBitmap& bitmap)
int w = bitmap.GetWidth(), int w = bitmap.GetWidth(),
h = bitmap.GetHeight(); h = bitmap.GetHeight();
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->SetStatusText(wxString::Format(wxT("%dx%d"), w, h)); frame->SetStatusText(wxString::Format("%dx%d", w, h));
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
frame->SetClientSize(w > 100 ? 100 : w, h > 100 ? 100 : h); frame->SetClientSize(w > 100 ? 100 : w, h > 100 ? 100 : h);
@@ -2053,13 +2056,13 @@ static void ShowBitmap(const wxBitmap& bitmap)
static void ShowMetaFile(const wxMetaFile& metafile) static void ShowMetaFile(const wxMetaFile& metafile)
{ {
wxFrame *frame = new wxFrame(NULL, wxID_ANY, wxT("Metafile view")); wxFrame *frame = new wxFrame(NULL, wxID_ANY, "Metafile view");
frame->CreateStatusBar(); frame->CreateStatusBar();
DnDCanvasMetafile *canvas = new DnDCanvasMetafile(frame); DnDCanvasMetafile *canvas = new DnDCanvasMetafile(frame);
canvas->SetMetafile(metafile); canvas->SetMetafile(metafile);
wxSize size = metafile.GetSize(); wxSize size = metafile.GetSize();
frame->SetStatusText(wxString::Format(wxT("%dx%d"), size.x, size.y)); frame->SetStatusText(wxString::Format("%dx%d", size.x, size.y));
frame->SetClientSize(size.x > 100 ? 100 : size.x, frame->SetClientSize(size.x > 100 ? 100 : size.x,
size.y > 100 ? 100 : size.y); size.y > 100 ? 100 : size.y);

View File

@@ -178,7 +178,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
} }
case SHAPE_DRAG_TEXT: case SHAPE_DRAG_TEXT:
{ {
m_dragImage = new MyDragImage(this, wxString(wxT("Dragging some test text")), wxCursor(wxCURSOR_HAND)); m_dragImage = new MyDragImage(this, wxString("Dragging some test text"), wxCursor(wxCURSOR_HAND));
break; break;
} }
case SHAPE_DRAG_ICON: case SHAPE_DRAG_ICON:
@@ -313,16 +313,16 @@ wxBEGIN_EVENT_TABLE(MyFrame,wxFrame)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, wxID_ANY, wxT("wxDragImage sample"), : wxFrame( (wxFrame *)NULL, wxID_ANY, "wxDragImage sample",
wxPoint(20,20), wxSize(470,360) ) wxPoint(20,20), wxSize(470,360) )
{ {
wxMenu *file_menu = new wxMenu(); wxMenu *file_menu = new wxMenu();
file_menu->Append( wxID_ABOUT, wxT("&About")); file_menu->Append( wxID_ABOUT, "&About");
file_menu->AppendCheckItem( TEST_USE_SCREEN, wxT("&Use whole screen for dragging"), wxT("Use whole screen")); file_menu->AppendCheckItem( TEST_USE_SCREEN, "&Use whole screen for dragging", "Use whole screen");
file_menu->Append( wxID_EXIT, wxT("E&xit")); file_menu->Append( wxID_EXIT, "E&xit");
wxMenuBar *menu_bar = new wxMenuBar(); wxMenuBar *menu_bar = new wxMenuBar();
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
SetMenuBar( menu_bar ); SetMenuBar( menu_bar );
@@ -343,9 +343,9 @@ void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
{ {
(void)wxMessageBox( wxT("wxDragImage demo\n") (void)wxMessageBox( "wxDragImage demo\n"
wxT("Julian Smart (c) 2000"), "Julian Smart (c) 2000",
wxT("About wxDragImage Demo"), "About wxDragImage Demo",
wxICON_INFORMATION | wxOK ); wxICON_INFORMATION | wxOK );
} }
@@ -373,14 +373,14 @@ bool MyApp::OnInit()
#endif #endif
wxImage image; wxImage image;
if (image.LoadFile(wxT("backgrnd.png"), wxBITMAP_TYPE_PNG)) if (image.LoadFile("backgrnd.png", wxBITMAP_TYPE_PNG))
{ {
m_background = wxBitmap(image); m_background = wxBitmap(image);
} }
MyFrame *frame = new MyFrame(); MyFrame *frame = new MyFrame();
wxString rootName(wxT("shape0")); wxString rootName("shape0");
for (int i = 1; i < 4; i++) for (int i = 1; i < 4; i++)
{ {

View File

@@ -411,12 +411,12 @@ bool MyApp::LoadImages()
// special hack for Unix in-tree sample build, don't do this in real // special hack for Unix in-tree sample build, don't do this in real
// programs, use wxStandardPaths instead // programs, use wxStandardPaths instead
pathList.Add(wxFileName(argv[0]).GetPath()); pathList.Add(wxFileName(argv[0]).GetPath());
pathList.Add(wxT(".")); pathList.Add(".");
pathList.Add(wxT("..")); pathList.Add("..");
pathList.Add(wxT("../drawing")); pathList.Add("../drawing");
pathList.Add(wxT("../../../samples/drawing")); pathList.Add("../../../samples/drawing");
wxString path = pathList.FindValidPath(wxT("pat4.bmp")); wxString path = pathList.FindValidPath("pat4.bmp");
if ( !path ) if ( !path )
return false; return false;
@@ -427,21 +427,21 @@ bool MyApp::LoadImages()
wxMask* mask4 = new wxMask(*gs_bmp4_mono, *wxBLACK); wxMask* mask4 = new wxMask(*gs_bmp4_mono, *wxBLACK);
gs_bmp4_mono->SetMask(mask4); gs_bmp4_mono->SetMask(mask4);
path = pathList.FindValidPath(wxT("pat36.bmp")); path = pathList.FindValidPath("pat36.bmp");
if ( !path ) if ( !path )
return false; return false;
gs_bmp36->LoadFile(path, wxBITMAP_TYPE_BMP); gs_bmp36->LoadFile(path, wxBITMAP_TYPE_BMP);
wxMask* mask36 = new wxMask(*gs_bmp36, *wxBLACK); wxMask* mask36 = new wxMask(*gs_bmp36, *wxBLACK);
gs_bmp36->SetMask(mask36); gs_bmp36->SetMask(mask36);
path = pathList.FindValidPath(wxT("image.bmp")); path = pathList.FindValidPath("image.bmp");
if ( !path ) if ( !path )
return false; return false;
gs_bmpNoMask->LoadFile(path, wxBITMAP_TYPE_BMP); gs_bmpNoMask->LoadFile(path, wxBITMAP_TYPE_BMP);
gs_bmpWithMask->LoadFile(path, wxBITMAP_TYPE_BMP); gs_bmpWithMask->LoadFile(path, wxBITMAP_TYPE_BMP);
gs_bmpWithColMask->LoadFile(path, wxBITMAP_TYPE_BMP); gs_bmpWithColMask->LoadFile(path, wxBITMAP_TYPE_BMP);
path = pathList.FindValidPath(wxT("mask.bmp")); path = pathList.FindValidPath("mask.bmp");
if ( !path ) if ( !path )
return false; return false;
gs_bmpMask->LoadFile(path, wxBITMAP_TYPE_BMP); gs_bmpMask->LoadFile(path, wxBITMAP_TYPE_BMP);
@@ -462,7 +462,7 @@ bool MyApp::OnInit()
return false; return false;
// Create the main application window // Create the main application window
MyFrame *frame = new MyFrame(wxT("Drawing sample"), MyFrame *frame = new MyFrame("Drawing sample",
wxDefaultPosition, wxSize(550, 840)); wxDefaultPosition, wxSize(550, 840));
// Show it // Show it
@@ -470,9 +470,9 @@ bool MyApp::OnInit()
if ( !LoadImages() ) if ( !LoadImages() )
{ {
wxLogError(wxT("Can't load one of the bitmap files needed ") wxLogError("Can't load one of the bitmap files needed "
wxT("for this sample from the current or parent ") "for this sample from the current or parent "
wxT("directory, please copy them there.")); "directory, please copy them there.");
// still continue, the sample can be used without images too if they're // still continue, the sample can be used without images too if they're
// missing for whatever reason // missing for whatever reason
@@ -539,37 +539,37 @@ void MyCanvas::DrawTestBrushes(wxDC& dc)
dc.SetBrush(*wxGREEN_BRUSH); dc.SetBrush(*wxGREEN_BRUSH);
dc.DrawRectangle(x, y, WIDTH, HEIGHT); dc.DrawRectangle(x, y, WIDTH, HEIGHT);
dc.DrawText(wxT("Solid green"), x + 10, y + 10); dc.DrawText("Solid green", x + 10, y + 10);
y += HEIGHT; y += HEIGHT;
dc.SetBrush(wxBrush(*wxRED, wxBRUSHSTYLE_CROSSDIAG_HATCH)); dc.SetBrush(wxBrush(*wxRED, wxBRUSHSTYLE_CROSSDIAG_HATCH));
dc.DrawRectangle(x, y, WIDTH, HEIGHT); dc.DrawRectangle(x, y, WIDTH, HEIGHT);
dc.DrawText(wxT("Diagonally hatched red"), x + 10, y + 10); dc.DrawText("Diagonally hatched red", x + 10, y + 10);
y += HEIGHT; y += HEIGHT;
dc.SetBrush(wxBrush(*wxBLUE, wxBRUSHSTYLE_CROSS_HATCH)); dc.SetBrush(wxBrush(*wxBLUE, wxBRUSHSTYLE_CROSS_HATCH));
dc.DrawRectangle(x, y, WIDTH, HEIGHT); dc.DrawRectangle(x, y, WIDTH, HEIGHT);
dc.DrawText(wxT("Cross hatched blue"), x + 10, y + 10); dc.DrawText("Cross hatched blue", x + 10, y + 10);
y += HEIGHT; y += HEIGHT;
dc.SetBrush(wxBrush(*wxCYAN, wxBRUSHSTYLE_VERTICAL_HATCH)); dc.SetBrush(wxBrush(*wxCYAN, wxBRUSHSTYLE_VERTICAL_HATCH));
dc.DrawRectangle(x, y, WIDTH, HEIGHT); dc.DrawRectangle(x, y, WIDTH, HEIGHT);
dc.DrawText(wxT("Vertically hatched cyan"), x + 10, y + 10); dc.DrawText("Vertically hatched cyan", x + 10, y + 10);
y += HEIGHT; y += HEIGHT;
dc.SetBrush(wxBrush(*wxBLACK, wxBRUSHSTYLE_HORIZONTAL_HATCH)); dc.SetBrush(wxBrush(*wxBLACK, wxBRUSHSTYLE_HORIZONTAL_HATCH));
dc.DrawRectangle(x, y, WIDTH, HEIGHT); dc.DrawRectangle(x, y, WIDTH, HEIGHT);
dc.DrawText(wxT("Horizontally hatched black"), x + 10, y + 10); dc.DrawText("Horizontally hatched black", x + 10, y + 10);
y += HEIGHT; y += HEIGHT;
dc.SetBrush(wxBrush(*gs_bmpMask)); dc.SetBrush(wxBrush(*gs_bmpMask));
dc.DrawRectangle(x, y, WIDTH, HEIGHT); dc.DrawRectangle(x, y, WIDTH, HEIGHT);
dc.DrawText(wxT("Stipple mono"), x + 10, y + 10); dc.DrawText("Stipple mono", x + 10, y + 10);
y += HEIGHT; y += HEIGHT;
dc.SetBrush(wxBrush(*gs_bmpNoMask)); dc.SetBrush(wxBrush(*gs_bmpNoMask));
dc.DrawRectangle(x, y, WIDTH, HEIGHT); dc.DrawRectangle(x, y, WIDTH, HEIGHT);
dc.DrawText(wxT("Stipple colour"), x + 10, y + 10); dc.DrawText("Stipple colour", x + 10, y + 10);
} }
void MyCanvas::DrawTestPoly(wxDC& dc) void MyCanvas::DrawTestPoly(wxDC& dc)
@@ -584,11 +584,11 @@ void MyCanvas::DrawTestPoly(wxDC& dc)
star[3] = wxPoint(40, 100); star[3] = wxPoint(40, 100);
star[4] = wxPoint(140, 150); star[4] = wxPoint(140, 150);
dc.DrawText(wxT("You should see two (irregular) stars below, the left one ") dc.DrawText("You should see two (irregular) stars below, the left one "
wxT("hatched"), 10, 10); "hatched", 10, 10);
dc.DrawText(wxT("except for the central region and the right ") dc.DrawText("except for the central region and the right "
wxT("one entirely hatched"), 10, 30); "one entirely hatched", 10, 30);
dc.DrawText(wxT("The third star only has a hatched outline"), 10, 50); dc.DrawText("The third star only has a hatched outline", 10, 50);
dc.DrawPolygon(WXSIZEOF(star), star, 0, 30); dc.DrawPolygon(WXSIZEOF(star), star, 0, 30);
dc.DrawPolygon(WXSIZEOF(star), star, 160, 30, wxWINDING_RULE); dc.DrawPolygon(WXSIZEOF(star), star, 160, 30, wxWINDING_RULE);
@@ -615,10 +615,10 @@ void MyCanvas::DrawTestLines( int x, int y, int width, wxDC &dc )
{ {
dc.SetPen( wxPen( *wxBLACK, width ) ); dc.SetPen( wxPen( *wxBLACK, width ) );
dc.SetBrush( *wxRED_BRUSH ); dc.SetBrush( *wxRED_BRUSH );
dc.DrawText(wxString::Format(wxT("Testing lines of width %d"), width), x + 10, y - 10); dc.DrawText(wxString::Format("Testing lines of width %d", width), x + 10, y - 10);
dc.DrawRectangle( x+10, y+10, 100, 190 ); dc.DrawRectangle( x+10, y+10, 100, 190 );
dc.DrawText(wxT("Solid/dot/short dash/long dash/dot dash"), x + 150, y + 10); dc.DrawText("Solid/dot/short dash/long dash/dot dash", x + 150, y + 10);
dc.SetPen( wxPen( *wxBLACK, width ) ); dc.SetPen( wxPen( *wxBLACK, width ) );
dc.DrawLine( x+20, y+20, 100, y+20 ); dc.DrawLine( x+20, y+20, 100, y+20 );
dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_DOT) ); dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_DOT) );
@@ -630,7 +630,7 @@ void MyCanvas::DrawTestLines( int x, int y, int width, wxDC &dc )
dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_DOT_DASH) ); dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_DOT_DASH) );
dc.DrawLine( x+20, y+60, 100, y+60 ); dc.DrawLine( x+20, y+60, 100, y+60 );
dc.DrawText(wxT("Misc hatches"), x + 150, y + 70); dc.DrawText("Misc hatches", x + 150, y + 70);
dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_BDIAGONAL_HATCH) ); dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_BDIAGONAL_HATCH) );
dc.DrawLine( x+20, y+70, 100, y+70 ); dc.DrawLine( x+20, y+70, 100, y+70 );
dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_CROSSDIAG_HATCH) ); dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_CROSSDIAG_HATCH) );
@@ -644,7 +644,7 @@ void MyCanvas::DrawTestLines( int x, int y, int width, wxDC &dc )
dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_VERTICAL_HATCH) ); dc.SetPen( wxPen( *wxBLACK, width, wxPENSTYLE_VERTICAL_HATCH) );
dc.DrawLine( x+20, y+120, 100, y+120 ); dc.DrawLine( x+20, y+120, 100, y+120 );
dc.DrawText(wxT("User dash"), x + 150, y + 140); dc.DrawText("User dash", x + 150, y + 140);
wxPen ud( *wxBLACK, width, wxPENSTYLE_USER_DASH ); wxPen ud( *wxBLACK, width, wxPENSTYLE_USER_DASH );
wxDash dash1[6]; wxDash dash1[6];
dash1[0] = 8; // Long dash <---------+ dash1[0] = 8; // Long dash <---------+
@@ -887,8 +887,8 @@ void MyCanvas::DrawText(wxDC& dc)
{ {
// set underlined font for testing // set underlined font for testing
dc.SetFont( wxFontInfo(12).Family(wxFONTFAMILY_MODERN).Underlined() ); dc.SetFont( wxFontInfo(12).Family(wxFONTFAMILY_MODERN).Underlined() );
dc.DrawText( wxT("This is text"), 110, 10 ); dc.DrawText( "This is text", 110, 10 );
dc.DrawRotatedText( wxT("That is text"), 20, 10, -45 ); dc.DrawRotatedText( "That is text", 20, 10, -45 );
// use wxSWISS_FONT and not wxNORMAL_FONT as the latter can't be rotated // use wxSWISS_FONT and not wxNORMAL_FONT as the latter can't be rotated
// under MSW (it is not TrueType) // under MSW (it is not TrueType)
@@ -899,22 +899,22 @@ void MyCanvas::DrawText(wxDC& dc)
for ( int n = -180; n < 180; n += 30 ) for ( int n = -180; n < 180; n += 30 )
{ {
text.Printf(wxT(" %d rotated text"), n); text.Printf(" %d rotated text", n);
dc.DrawRotatedText(text , 400, 400, n); dc.DrawRotatedText(text , 400, 400, n);
} }
dc.SetFont( wxFontInfo(18).Family(wxFONTFAMILY_SWISS) ); dc.SetFont( wxFontInfo(18).Family(wxFONTFAMILY_SWISS) );
dc.DrawText( wxT("This is Swiss 18pt text."), 110, 40 ); dc.DrawText( "This is Swiss 18pt text.", 110, 40 );
wxCoord length; wxCoord length;
wxCoord height; wxCoord height;
wxCoord descent; wxCoord descent;
dc.GetTextExtent( wxT("This is Swiss 18pt text."), &length, &height, &descent ); dc.GetTextExtent( "This is Swiss 18pt text.", &length, &height, &descent );
text.Printf( wxT("Dimensions are length %d, height %d, descent %d"), length, height, descent ); text.Printf( "Dimensions are length %d, height %d, descent %d", length, height, descent );
dc.DrawText( text, 110, 80 ); dc.DrawText( text, 110, 80 );
text.Printf( wxT("CharHeight() returns: %d"), dc.GetCharHeight() ); text.Printf( "CharHeight() returns: %d", dc.GetCharHeight() );
dc.DrawText( text, 110, 120 ); dc.DrawText( text, 110, 120 );
dc.DrawRectangle( 100, 40, 4, height ); dc.DrawRectangle( 100, 40, 4, height );
@@ -923,19 +923,19 @@ void MyCanvas::DrawText(wxDC& dc)
wxCoord y = 150; wxCoord y = 150;
dc.SetLogicalFunction(wxINVERT); dc.SetLogicalFunction(wxINVERT);
// text drawing should ignore logical function // text drawing should ignore logical function
dc.DrawText( wxT("There should be a text below"), 110, y ); dc.DrawText( "There should be a text below", 110, y );
dc.DrawRectangle( 110, y, 100, height ); dc.DrawRectangle( 110, y, 100, height );
y += height; y += height;
dc.DrawText( wxT("Visible text"), 110, y ); dc.DrawText( "Visible text", 110, y );
dc.DrawRectangle( 110, y, 100, height ); dc.DrawRectangle( 110, y, 100, height );
dc.DrawText( wxT("Visible text"), 110, y ); dc.DrawText( "Visible text", 110, y );
dc.DrawRectangle( 110, y, 100, height ); dc.DrawRectangle( 110, y, 100, height );
dc.SetLogicalFunction(wxCOPY); dc.SetLogicalFunction(wxCOPY);
y += height; y += height;
dc.DrawRectangle( 110, y, 100, height ); dc.DrawRectangle( 110, y, 100, height );
dc.DrawText( wxT("Another visible text"), 110, y ); dc.DrawText( "Another visible text", 110, y );
y += height; y += height;
dc.DrawText("And\nmore\ntext on\nmultiple\nlines", 110, y); dc.DrawText("And\nmore\ntext on\nmultiple\nlines", 110, y);
@@ -947,36 +947,36 @@ void MyCanvas::DrawText(wxDC& dc)
static const struct static const struct
{ {
const wxChar *name; wxString name;
wxRasterOperationMode rop; wxRasterOperationMode rop;
} rasterOperations[] = } rasterOperations[] =
{ {
{ wxT("wxAND"), wxAND }, { "wxAND", wxAND },
{ wxT("wxAND_INVERT"), wxAND_INVERT }, { "wxAND_INVERT", wxAND_INVERT },
{ wxT("wxAND_REVERSE"), wxAND_REVERSE }, { "wxAND_REVERSE", wxAND_REVERSE },
{ wxT("wxCLEAR"), wxCLEAR }, { "wxCLEAR", wxCLEAR },
{ wxT("wxCOPY"), wxCOPY }, { "wxCOPY", wxCOPY },
{ wxT("wxEQUIV"), wxEQUIV }, { "wxEQUIV", wxEQUIV },
{ wxT("wxINVERT"), wxINVERT }, { "wxINVERT", wxINVERT },
{ wxT("wxNAND"), wxNAND }, { "wxNAND", wxNAND },
{ wxT("wxNO_OP"), wxNO_OP }, { "wxNO_OP", wxNO_OP },
{ wxT("wxOR"), wxOR }, { "wxOR", wxOR },
{ wxT("wxOR_INVERT"), wxOR_INVERT }, { "wxOR_INVERT", wxOR_INVERT },
{ wxT("wxOR_REVERSE"), wxOR_REVERSE }, { "wxOR_REVERSE", wxOR_REVERSE },
{ wxT("wxSET"), wxSET }, { "wxSET", wxSET },
{ wxT("wxSRC_INVERT"), wxSRC_INVERT }, { "wxSRC_INVERT", wxSRC_INVERT },
{ wxT("wxXOR"), wxXOR }, { "wxXOR", wxXOR },
}; };
void MyCanvas::DrawImages(wxDC& dc, DrawMode mode) void MyCanvas::DrawImages(wxDC& dc, DrawMode mode)
{ {
dc.DrawText(wxT("original image"), 0, 0); dc.DrawText("original image", 0, 0);
dc.DrawBitmap(*gs_bmpNoMask, 0, 20, 0); dc.DrawBitmap(*gs_bmpNoMask, 0, 20, 0);
dc.DrawText(wxT("with colour mask"), 0, 100); dc.DrawText("with colour mask", 0, 100);
dc.DrawBitmap(*gs_bmpWithColMask, 0, 120, true); dc.DrawBitmap(*gs_bmpWithColMask, 0, 120, true);
dc.DrawText(wxT("the mask image"), 0, 200); dc.DrawText("the mask image", 0, 200);
dc.DrawBitmap(*gs_bmpMask, 0, 220, 0); dc.DrawBitmap(*gs_bmpMask, 0, 220, 0);
dc.DrawText(wxT("masked image"), 0, 300); dc.DrawText("masked image", 0, 300);
dc.DrawBitmap(*gs_bmpWithMask, 0, 320, true); dc.DrawBitmap(*gs_bmpWithMask, 0, 320, true);
int cx = gs_bmpWithColMask->GetWidth(), int cx = gs_bmpWithColMask->GetWidth(),
@@ -1073,7 +1073,7 @@ void MyCanvas::DrawAlpha(wxDC& dc)
dc.SetTextBackground( wxColour(160, 192, 160, 160) ); dc.SetTextBackground( wxColour(160, 192, 160, 160) );
dc.SetTextForeground( wxColour(255, 128, 128, 128) ); dc.SetTextForeground( wxColour(255, 128, 128, 128) );
dc.SetFont( wxFontInfo(40).Family(wxFONTFAMILY_SWISS).Italic() ); dc.SetFont( wxFontInfo(40).Family(wxFONTFAMILY_SWISS).Italic() );
dc.DrawText( wxT("Hello!"), 120, 80 ); dc.DrawText( "Hello!", 120, 80 );
} }
#endif // wxDRAWING_DC_SUPPORTS_ALPHA || wxUSE_GRAPHICS_CONTEXT #endif // wxDRAWING_DC_SUPPORTS_ALPHA || wxUSE_GRAPHICS_CONTEXT
@@ -1225,19 +1225,19 @@ void MyCanvas::DrawCircles(wxDC& dc)
dc.SetPen( *wxRED_PEN ); dc.SetPen( *wxRED_PEN );
dc.SetBrush( *wxGREEN_BRUSH ); dc.SetBrush( *wxGREEN_BRUSH );
dc.DrawText(wxT("Some circles"), 0, y); dc.DrawText("Some circles", 0, y);
dc.DrawCircle(x, y, r); dc.DrawCircle(x, y, r);
dc.DrawCircle(x + 2*r, y, r); dc.DrawCircle(x + 2*r, y, r);
dc.DrawCircle(x + 4*r, y, r); dc.DrawCircle(x + 4*r, y, r);
y += 2*r; y += 2*r;
dc.DrawText(wxT("And ellipses"), 0, y); dc.DrawText("And ellipses", 0, y);
dc.DrawEllipse(x - r, y, 2*r, r); dc.DrawEllipse(x - r, y, 2*r, r);
dc.DrawEllipse(x + r, y, 2*r, r); dc.DrawEllipse(x + r, y, 2*r, r);
dc.DrawEllipse(x + 3*r, y, 2*r, r); dc.DrawEllipse(x + 3*r, y, 2*r, r);
y += 2*r; y += 2*r;
dc.DrawText(wxT("And arcs"), 0, y); dc.DrawText("And arcs", 0, y);
dc.DrawArc(x - r, y, x + r, y, x, y); dc.DrawArc(x - r, y, x + r, y, x, y);
dc.DrawArc(x + 4*r, y, x + 2*r, y, x + 3*r, y); dc.DrawArc(x + 4*r, y, x + 2*r, y, x + 3*r, y);
dc.DrawArc(x + 5*r, y, x + 5*r, y, x + 6*r, y); dc.DrawArc(x + 5*r, y, x + 5*r, y, x + 6*r, y);
@@ -1254,19 +1254,19 @@ void MyCanvas::DrawCircles(wxDC& dc)
dc.SetBrush( *wxTRANSPARENT_BRUSH ); dc.SetBrush( *wxTRANSPARENT_BRUSH );
y += 2*r; y += 2*r;
dc.DrawText(wxT("Some circles"), 0, y); dc.DrawText("Some circles", 0, y);
dc.DrawCircle(x, y, r); dc.DrawCircle(x, y, r);
dc.DrawCircle(x + 2*r, y, r); dc.DrawCircle(x + 2*r, y, r);
dc.DrawCircle(x + 4*r, y, r); dc.DrawCircle(x + 4*r, y, r);
y += 2*r; y += 2*r;
dc.DrawText(wxT("And ellipses"), 0, y); dc.DrawText("And ellipses", 0, y);
dc.DrawEllipse(x - r, y, 2*r, r); dc.DrawEllipse(x - r, y, 2*r, r);
dc.DrawEllipse(x + r, y, 2*r, r); dc.DrawEllipse(x + r, y, 2*r, r);
dc.DrawEllipse(x + 3*r, y, 2*r, r); dc.DrawEllipse(x + 3*r, y, 2*r, r);
y += 2*r; y += 2*r;
dc.DrawText(wxT("And arcs"), 0, y); dc.DrawText("And arcs", 0, y);
dc.DrawArc(x - r, y, x + r, y, x, y); dc.DrawArc(x - r, y, x + r, y, x, y);
dc.DrawArc(x + 4*r, y, x + 2*r, y, x + 3*r, y); dc.DrawArc(x + 4*r, y, x + 2*r, y, x + 3*r, y);
dc.DrawArc(x + 5*r, y, x + 5*r, y, x + 6*r, y); dc.DrawArc(x + 5*r, y, x + 5*r, y, x + 6*r, y);
@@ -1282,7 +1282,7 @@ void MyCanvas::DrawCircles(wxDC& dc)
void MyCanvas::DrawSplines(wxDC& dc) void MyCanvas::DrawSplines(wxDC& dc)
{ {
#if wxUSE_SPLINES #if wxUSE_SPLINES
dc.DrawText(wxT("Some splines"), 10, 5); dc.DrawText("Some splines", 10, 5);
// values are hardcoded rather than randomly generated // values are hardcoded rather than randomly generated
// so the output can be compared between native // so the output can be compared between native
@@ -1363,7 +1363,7 @@ void MyCanvas::DrawSplines(wxDC& dc)
} }
#else #else
dc.DrawText(wxT("Splines not supported."), 10, 5); dc.DrawText("Splines not supported.", 10, 5);
#endif #endif
} }
@@ -1373,22 +1373,22 @@ void MyCanvas::DrawGradients(wxDC& dc)
// LHS: linear // LHS: linear
wxRect r(10, 10, 50, 50); wxRect r(10, 10, 50, 50);
dc.DrawText(wxT("wxRIGHT"), r.x, r.y); dc.DrawText("wxRIGHT", r.x, r.y);
r.Offset(0, TEXT_HEIGHT); r.Offset(0, TEXT_HEIGHT);
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxRIGHT); dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxRIGHT);
r.Offset(0, r.height + 10); r.Offset(0, r.height + 10);
dc.DrawText(wxT("wxLEFT"), r.x, r.y); dc.DrawText("wxLEFT", r.x, r.y);
r.Offset(0, TEXT_HEIGHT); r.Offset(0, TEXT_HEIGHT);
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxLEFT); dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxLEFT);
r.Offset(0, r.height + 10); r.Offset(0, r.height + 10);
dc.DrawText(wxT("wxDOWN"), r.x, r.y); dc.DrawText("wxDOWN", r.x, r.y);
r.Offset(0, TEXT_HEIGHT); r.Offset(0, TEXT_HEIGHT);
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxDOWN); dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxDOWN);
r.Offset(0, r.height + 10); r.Offset(0, r.height + 10);
dc.DrawText(wxT("wxUP"), r.x, r.y); dc.DrawText("wxUP", r.x, r.y);
r.Offset(0, TEXT_HEIGHT); r.Offset(0, TEXT_HEIGHT);
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxUP); dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxUP);
@@ -1396,22 +1396,22 @@ void MyCanvas::DrawGradients(wxDC& dc)
// RHS: concentric // RHS: concentric
r = wxRect(200, 10, 50, 50); r = wxRect(200, 10, 50, 50);
dc.DrawText(wxT("Blue inside"), r.x, r.y); dc.DrawText("Blue inside", r.x, r.y);
r.Offset(0, TEXT_HEIGHT); r.Offset(0, TEXT_HEIGHT);
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE); dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE);
r.Offset(0, r.height + 10); r.Offset(0, r.height + 10);
dc.DrawText(wxT("White inside"), r.x, r.y); dc.DrawText("White inside", r.x, r.y);
r.Offset(0, TEXT_HEIGHT); r.Offset(0, TEXT_HEIGHT);
dc.GradientFillConcentric(r, *wxWHITE, *wxBLUE); dc.GradientFillConcentric(r, *wxWHITE, *wxBLUE);
r.Offset(0, r.height + 10); r.Offset(0, r.height + 10);
dc.DrawText(wxT("Blue in top left corner"), r.x, r.y); dc.DrawText("Blue in top left corner", r.x, r.y);
r.Offset(0, TEXT_HEIGHT); r.Offset(0, TEXT_HEIGHT);
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE, wxPoint(0, 0)); dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE, wxPoint(0, 0));
r.Offset(0, r.height + 10); r.Offset(0, r.height + 10);
dc.DrawText(wxT("Blue in bottom right corner"), r.x, r.y); dc.DrawText("Blue in bottom right corner", r.x, r.y);
r.Offset(0, TEXT_HEIGHT); r.Offset(0, TEXT_HEIGHT);
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE, wxPoint(r.width, r.height)); dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE, wxPoint(r.width, r.height));
@@ -1456,7 +1456,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
double boxX, boxY, boxWidth, boxHeight; double boxX, boxY, boxWidth, boxHeight;
gfr.Offset(0, gfr.height + 10); gfr.Offset(0, gfr.height + 10);
dc.DrawText(wxT("Linear Gradient with Stops"), gfr.x, gfr.y); dc.DrawText("Linear Gradient with Stops", gfr.x, gfr.y);
gfr.Offset(0, TEXT_HEIGHT); gfr.Offset(0, TEXT_HEIGHT);
stops = wxGraphicsGradientStops(*wxRED, *wxBLUE); stops = wxGraphicsGradientStops(*wxRED, *wxBLUE);
@@ -1480,7 +1480,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
wxGraphicsGradientStops simpleStops(*wxRED, *wxBLUE); wxGraphicsGradientStops simpleStops(*wxRED, *wxBLUE);
gfr.Offset(0, gfr.height + 10); gfr.Offset(0, gfr.height + 10);
dc.DrawText(wxT("Radial Gradient from Red to Blue without intermediary Stops"), dc.DrawText("Radial Gradient from Red to Blue without intermediary Stops",
gfr.x, gfr.y); gfr.x, gfr.y);
gfr.Offset(0, TEXT_HEIGHT); gfr.Offset(0, TEXT_HEIGHT);
@@ -1503,7 +1503,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight)); dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight));
gfr.Offset(0, gfr.height + 10); gfr.Offset(0, gfr.height + 10);
dc.DrawText(wxT("Radial Gradient from Red to Blue with Yellow and Green Stops"), dc.DrawText("Radial Gradient from Red to Blue with Yellow and Green Stops",
gfr.x, gfr.y); gfr.x, gfr.y);
gfr.Offset(0, TEXT_HEIGHT); gfr.Offset(0, TEXT_HEIGHT);
@@ -1525,7 +1525,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight)); dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight));
gfr.Offset(0, gfr.height + 10); gfr.Offset(0, gfr.height + 10);
dc.DrawText(wxT("Linear Gradient with Stops and Gaps"), gfr.x, gfr.y); dc.DrawText("Linear Gradient with Stops and Gaps", gfr.x, gfr.y);
gfr.Offset(0, TEXT_HEIGHT); gfr.Offset(0, TEXT_HEIGHT);
stops = wxGraphicsGradientStops(*wxRED, *wxBLUE); stops = wxGraphicsGradientStops(*wxRED, *wxBLUE);
@@ -1549,7 +1549,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight)); dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight));
gfr.Offset(0, gfr.height + 10); gfr.Offset(0, gfr.height + 10);
dc.DrawText(wxT("Radial Gradient with Stops and Gaps"), gfr.x, gfr.y); dc.DrawText("Radial Gradient with Stops and Gaps", gfr.x, gfr.y);
gfr.Offset(0, TEXT_HEIGHT); gfr.Offset(0, TEXT_HEIGHT);
gc->SetBrush(gc->CreateRadialGradientBrush(gfr.x + gfr.width / 2, gc->SetBrush(gc->CreateRadialGradientBrush(gfr.x + gfr.width / 2,
@@ -1570,7 +1570,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight)); dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight));
gfr.Offset(0, gfr.height + 10); gfr.Offset(0, gfr.height + 10);
dc.DrawText(wxT("Gradients with Stops and Transparency"), gfr.x, gfr.y); dc.DrawText("Gradients with Stops and Transparency", gfr.x, gfr.y);
gfr.Offset(0, TEXT_HEIGHT); gfr.Offset(0, TEXT_HEIGHT);
stops = wxGraphicsGradientStops(*wxRED, wxTransparentColour); stops = wxGraphicsGradientStops(*wxRED, wxTransparentColour);
@@ -1685,12 +1685,12 @@ void MyCanvas::DrawSystemColours(wxDC& dc)
void MyCanvas::DrawRegions(wxDC& dc) void MyCanvas::DrawRegions(wxDC& dc)
{ {
dc.DrawText(wxT("You should see a red rect partly covered by a cyan one ") dc.DrawText("You should see a red rect partly covered by a cyan one "
wxT("on the left"), 10, 5); "on the left", 10, 5);
dc.DrawText(wxT("and 5 smileys from which 4 are partially clipped on the right"), dc.DrawText("and 5 smileys from which 4 are partially clipped on the right",
10, 5 + dc.GetCharHeight()); 10, 5 + dc.GetCharHeight());
dc.DrawText(wxT("The second copy should be identical but right part of it ") dc.DrawText("The second copy should be identical but right part of it "
wxT("should be offset by 10 pixels."), "should be offset by 10 pixels.",
10, 5 + 2*dc.GetCharHeight()); 10, 5 + 2*dc.GetCharHeight());
DrawRegionsHelper(dc, 10, true); DrawRegionsHelper(dc, 10, true);
@@ -1941,7 +1941,7 @@ void MyCanvas::OnMouseMove(wxMouseEvent &event)
long x = dc.DeviceToLogicalX( pos.x ); long x = dc.DeviceToLogicalX( pos.x );
long y = dc.DeviceToLogicalY( pos.y ); long y = dc.DeviceToLogicalY( pos.y );
wxString str; wxString str;
str.Printf( wxT("Current mouse position: %d,%d"), (int)x, (int)y ); str.Printf( "Current mouse position: %d,%d", (int)x, (int)y );
m_owner->SetStatusText( str ); m_owner->SetStatusText( str );
} }
@@ -2083,25 +2083,25 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
wxMenu *menuScreen = new wxMenu; wxMenu *menuScreen = new wxMenu;
menuScreen->Append(File_ShowDefault, wxT("&Default screen\tF1")); menuScreen->Append(File_ShowDefault, "&Default screen\tF1");
menuScreen->Append(File_ShowText, wxT("&Text screen\tF2")); menuScreen->Append(File_ShowText, "&Text screen\tF2");
menuScreen->Append(File_ShowLines, wxT("&Lines screen\tF3")); menuScreen->Append(File_ShowLines, "&Lines screen\tF3");
menuScreen->Append(File_ShowBrushes, wxT("&Brushes screen\tF4")); menuScreen->Append(File_ShowBrushes, "&Brushes screen\tF4");
menuScreen->Append(File_ShowPolygons, wxT("&Polygons screen\tF5")); menuScreen->Append(File_ShowPolygons, "&Polygons screen\tF5");
menuScreen->Append(File_ShowMask, wxT("&Mask screen\tF6")); menuScreen->Append(File_ShowMask, "&Mask screen\tF6");
menuScreen->Append(File_ShowMaskStretch, wxT("1/&2 scaled mask\tShift-F6")); menuScreen->Append(File_ShowMaskStretch, "1/&2 scaled mask\tShift-F6");
menuScreen->Append(File_ShowOps, wxT("&Raster operations screen\tF7")); menuScreen->Append(File_ShowOps, "&Raster operations screen\tF7");
menuScreen->Append(File_ShowRegions, wxT("Re&gions screen\tF8")); menuScreen->Append(File_ShowRegions, "Re&gions screen\tF8");
menuScreen->Append(File_ShowCircles, wxT("&Circles screen\tF9")); menuScreen->Append(File_ShowCircles, "&Circles screen\tF9");
#if wxDRAWING_DC_SUPPORTS_ALPHA || wxUSE_GRAPHICS_CONTEXT #if wxDRAWING_DC_SUPPORTS_ALPHA || wxUSE_GRAPHICS_CONTEXT
menuScreen->Append(File_ShowAlpha, wxT("&Alpha screen\tF10")); menuScreen->Append(File_ShowAlpha, "&Alpha screen\tF10");
#endif // wxDRAWING_DC_SUPPORTS_ALPHA || wxUSE_GRAPHICS_CONTEXT #endif // wxDRAWING_DC_SUPPORTS_ALPHA || wxUSE_GRAPHICS_CONTEXT
menuScreen->Append(File_ShowSplines, wxT("Spl&ines screen\tF11")); menuScreen->Append(File_ShowSplines, "Spl&ines screen\tF11");
menuScreen->Append(File_ShowGradients, wxT("&Gradients screen\tF12")); menuScreen->Append(File_ShowGradients, "&Gradients screen\tF12");
#if wxUSE_GRAPHICS_CONTEXT #if wxUSE_GRAPHICS_CONTEXT
menuScreen->Append(File_ShowGraphics, wxT("&Graphics screen")); menuScreen->Append(File_ShowGraphics, "&Graphics screen");
#endif #endif
menuScreen->Append(File_ShowSystemColours, wxT("System &colours")); menuScreen->Append(File_ShowSystemColours, "System &colours");
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
#if wxUSE_GRAPHICS_CONTEXT #if wxUSE_GRAPHICS_CONTEXT
@@ -2122,71 +2122,71 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->AppendCheckItem(File_BBox, wxS("Show bounding box\tCtrl-E"), menuFile->AppendCheckItem(File_BBox, wxS("Show bounding box\tCtrl-E"),
wxS("Show extents used in drawing operations")); wxS("Show extents used in drawing operations"));
menuFile->AppendCheckItem(File_Clip, wxT("&Clip\tCtrl-C"), wxT("Clip/unclip drawing")); menuFile->AppendCheckItem(File_Clip, "&Clip\tCtrl-C", "Clip/unclip drawing");
menuFile->AppendCheckItem(File_Buffer, wxT("&Use wx&BufferedPaintDC\tCtrl-Z"), wxT("Buffer painting")); menuFile->AppendCheckItem(File_Buffer, "&Use wx&BufferedPaintDC\tCtrl-Z", "Buffer painting");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
#if wxUSE_METAFILE && defined(wxMETAFILE_IS_ENH) #if wxUSE_METAFILE && defined(wxMETAFILE_IS_ENH)
menuFile->Append(File_Copy, wxT("Copy to clipboard")); menuFile->Append(File_Copy, "Copy to clipboard");
#endif #endif
menuFile->Append(File_Save, wxT("&Save...\tCtrl-S"), wxT("Save drawing to file")); menuFile->Append(File_Save, "&Save...\tCtrl-S", "Save drawing to file");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(File_About, wxT("&About\tCtrl-A"), wxT("Show about dialog")); menuFile->Append(File_About, "&About\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(File_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(File_Quit, "E&xit\tAlt-X", "Quit this program");
wxMenu *menuMapMode = new wxMenu; wxMenu *menuMapMode = new wxMenu;
menuMapMode->Append( MapMode_Text, wxT("&TEXT map mode") ); menuMapMode->Append( MapMode_Text, "&TEXT map mode" );
menuMapMode->Append( MapMode_Lometric, wxT("&LOMETRIC map mode") ); menuMapMode->Append( MapMode_Lometric, "&LOMETRIC map mode" );
menuMapMode->Append( MapMode_Twips, wxT("T&WIPS map mode") ); menuMapMode->Append( MapMode_Twips, "T&WIPS map mode" );
menuMapMode->Append( MapMode_Points, wxT("&POINTS map mode") ); menuMapMode->Append( MapMode_Points, "&POINTS map mode" );
menuMapMode->Append( MapMode_Metric, wxT("&METRIC map mode") ); menuMapMode->Append( MapMode_Metric, "&METRIC map mode" );
wxMenu *menuUserScale = new wxMenu; wxMenu *menuUserScale = new wxMenu;
menuUserScale->Append( UserScale_StretchHoriz, wxT("Stretch &horizontally\tCtrl-H") ); menuUserScale->Append( UserScale_StretchHoriz, "Stretch &horizontally\tCtrl-H" );
menuUserScale->Append( UserScale_ShrinkHoriz, wxT("Shrin&k horizontally\tCtrl-G") ); menuUserScale->Append( UserScale_ShrinkHoriz, "Shrin&k horizontally\tCtrl-G" );
menuUserScale->Append( UserScale_StretchVertic, wxT("Stretch &vertically\tCtrl-V") ); menuUserScale->Append( UserScale_StretchVertic, "Stretch &vertically\tCtrl-V" );
menuUserScale->Append( UserScale_ShrinkVertic, wxT("&Shrink vertically\tCtrl-W") ); menuUserScale->Append( UserScale_ShrinkVertic, "&Shrink vertically\tCtrl-W" );
menuUserScale->AppendSeparator(); menuUserScale->AppendSeparator();
menuUserScale->Append( UserScale_Restore, wxT("&Restore to normal\tCtrl-0") ); menuUserScale->Append( UserScale_Restore, "&Restore to normal\tCtrl-0" );
wxMenu *menuAxis = new wxMenu; wxMenu *menuAxis = new wxMenu;
menuAxis->AppendCheckItem( AxisMirror_Horiz, wxT("Mirror horizontally\tCtrl-M") ); menuAxis->AppendCheckItem( AxisMirror_Horiz, "Mirror horizontally\tCtrl-M" );
menuAxis->AppendCheckItem( AxisMirror_Vertic, wxT("Mirror vertically\tCtrl-N") ); menuAxis->AppendCheckItem( AxisMirror_Vertic, "Mirror vertically\tCtrl-N" );
wxMenu *menuLogical = new wxMenu; wxMenu *menuLogical = new wxMenu;
menuLogical->Append( LogicalOrigin_MoveDown, wxT("Move &down\tCtrl-D") ); menuLogical->Append( LogicalOrigin_MoveDown, "Move &down\tCtrl-D" );
menuLogical->Append( LogicalOrigin_MoveUp, wxT("Move &up\tCtrl-U") ); menuLogical->Append( LogicalOrigin_MoveUp, "Move &up\tCtrl-U" );
menuLogical->Append( LogicalOrigin_MoveLeft, wxT("Move &right\tCtrl-L") ); menuLogical->Append( LogicalOrigin_MoveLeft, "Move &right\tCtrl-L" );
menuLogical->Append( LogicalOrigin_MoveRight, wxT("Move &left\tCtrl-R") ); menuLogical->Append( LogicalOrigin_MoveRight, "Move &left\tCtrl-R" );
menuLogical->AppendSeparator(); menuLogical->AppendSeparator();
menuLogical->Append( LogicalOrigin_Set, wxT("Set to (&100, 100)\tShift-Ctrl-1") ); menuLogical->Append( LogicalOrigin_Set, "Set to (&100, 100)\tShift-Ctrl-1" );
menuLogical->Append( LogicalOrigin_Restore, wxT("&Restore to normal\tShift-Ctrl-0") ); menuLogical->Append( LogicalOrigin_Restore, "&Restore to normal\tShift-Ctrl-0" );
wxMenu *menuColour = new wxMenu; wxMenu *menuColour = new wxMenu;
#if wxUSE_COLOURDLG #if wxUSE_COLOURDLG
menuColour->Append( Colour_TextForeground, wxT("Text &foreground...") ); menuColour->Append( Colour_TextForeground, "Text &foreground..." );
menuColour->Append( Colour_TextBackground, wxT("Text &background...") ); menuColour->Append( Colour_TextBackground, "Text &background..." );
menuColour->Append( Colour_Background, wxT("Background &colour...") ); menuColour->Append( Colour_Background, "Background &colour..." );
#endif // wxUSE_COLOURDLG #endif // wxUSE_COLOURDLG
menuColour->AppendCheckItem( Colour_BackgroundMode, wxT("&Opaque/transparent\tCtrl-B") ); menuColour->AppendCheckItem( Colour_BackgroundMode, "&Opaque/transparent\tCtrl-B" );
menuColour->AppendCheckItem( Colour_TextureBackgound, wxT("Draw textured back&ground\tCtrl-T") ); menuColour->AppendCheckItem( Colour_TextureBackgound, "Draw textured back&ground\tCtrl-T" );
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, wxT("&Drawing")); menuBar->Append(menuFile, "&Drawing");
menuBar->Append(menuScreen, wxT("Scree&n")); menuBar->Append(menuScreen, "Scree&n");
menuBar->Append(menuMapMode, wxT("&Mode")); menuBar->Append(menuMapMode, "&Mode");
menuBar->Append(menuUserScale, wxT("&Scale")); menuBar->Append(menuUserScale, "&Scale");
menuBar->Append(menuAxis, wxT("&Axis")); menuBar->Append(menuAxis, "&Axis");
menuBar->Append(menuLogical, wxT("&Origin")); menuBar->Append(menuLogical, "&Origin");
menuBar->Append(menuColour, wxT("&Colours")); menuBar->Append(menuColour, "&Colours");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
m_mapMode = wxMM_TEXT; m_mapMode = wxMM_TEXT;
@@ -2216,13 +2216,13 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is the about dialog of the drawing sample.\n") msg.Printf( "This is the about dialog of the drawing sample.\n"
wxT("This sample tests various primitive drawing functions\n") "This sample tests various primitive drawing functions\n"
wxT("(without any attempts to prevent flicker).\n") "(without any attempts to prevent flicker).\n"
wxT("Copyright (c) Robert Roebling 1999") "Copyright (c) Robert Roebling 1999"
); );
wxMessageBox(msg, wxT("About Drawing"), wxOK | wxICON_INFORMATION, this); wxMessageBox(msg, "About Drawing", wxOK | wxICON_INFORMATION, this);
} }
void MyFrame::OnClip(wxCommandEvent& event) void MyFrame::OnClip(wxCommandEvent& event)
@@ -2263,7 +2263,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
wildCard.Append(wxS("|PostScript file (*.ps)|*.ps;*.PS")); wildCard.Append(wxS("|PostScript file (*.ps)|*.ps;*.PS"));
#endif #endif
wxFileDialog dlg(this, wxT("Save as bitmap"), wxEmptyString, wxEmptyString, wxFileDialog dlg(this, "Save as bitmap", wxEmptyString, wxEmptyString,
wildCard, wildCard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT); wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() == wxID_OK) if (dlg.ShowModal() == wxID_OK)
@@ -2273,7 +2273,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
wxFileName fn(dlg.GetPath()); wxFileName fn(dlg.GetPath());
wxString ext = fn.GetExt().Lower(); wxString ext = fn.GetExt().Lower();
#if wxUSE_SVG #if wxUSE_SVG
if (ext == wxT("svg")) if (ext == "svg")
{ {
#if wxUSE_GRAPHICS_CONTEXT #if wxUSE_GRAPHICS_CONTEXT
// Graphics screen can only be drawn using GraphicsContext // Graphics screen can only be drawn using GraphicsContext
@@ -2284,7 +2284,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
wxGraphicsRenderer* tempRenderer = m_canvas->GetRenderer(); wxGraphicsRenderer* tempRenderer = m_canvas->GetRenderer();
m_canvas->UseGraphicRenderer(NULL); m_canvas->UseGraphicRenderer(NULL);
#endif #endif
wxSVGFileDC svgdc(dlg.GetPath(), width, height, 72, wxT("Drawing sample")); wxSVGFileDC svgdc(dlg.GetPath(), width, height, 72, "Drawing sample");
svgdc.SetBitmapHandler(new wxSVGBitmapEmbedHandler()); svgdc.SetBitmapHandler(new wxSVGBitmapEmbedHandler());
m_canvas->Draw(svgdc); m_canvas->Draw(svgdc);
#if wxUSE_GRAPHICS_CONTEXT #if wxUSE_GRAPHICS_CONTEXT

View File

@@ -196,7 +196,7 @@ public:
void OnTest(wxCommandEvent& event) void OnTest(wxCommandEvent& event)
{ {
wxLogMessage(wxT("This is the pushed test event handler #%u"), m_level); wxLogMessage("This is the pushed test event handler #%u", m_level);
// if we don't skip the event, the other event handlers won't get it: // if we don't skip the event, the other event handlers won't get it:
// try commenting out this line and see what changes // try commenting out this line and see what changes
@@ -298,7 +298,7 @@ bool MyApp::OnInit()
return false; return false;
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(wxT("Event wxWidgets Sample"), MyFrame *frame = new MyFrame("Event wxWidgets Sample",
wxPoint(50, 50), wxSize(600, 340)); wxPoint(50, 50), wxSize(600, 340));
// and show it (the frames, unlike simple controls, are not shown when // and show it (the frames, unlike simple controls, are not shown when
@@ -367,43 +367,43 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(Event_About, wxT("&About\tCtrl-A"), wxT("Show about dialog")); menuFile->Append(Event_About, "&About\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Event_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(Event_Quit, "E&xit\tAlt-X", "Quit this program");
wxMenu *menuEvent = new wxMenu; wxMenu *menuEvent = new wxMenu;
menuEvent->AppendCheckItem(Event_Bind, "&Bind\tCtrl-B", menuEvent->AppendCheckItem(Event_Bind, "&Bind\tCtrl-B",
"Bind or unbind a dynamic event handler"); "Bind or unbind a dynamic event handler");
menuEvent->AppendCheckItem(Event_Connect, wxT("&Connect\tCtrl-C"), menuEvent->AppendCheckItem(Event_Connect, "&Connect\tCtrl-C",
wxT("Connect or disconnect the dynamic event handler")); "Connect or disconnect the dynamic event handler");
menuEvent->Append(Event_Dynamic, wxT("&Dynamic event\tCtrl-D"), menuEvent->Append(Event_Dynamic, "&Dynamic event\tCtrl-D",
wxT("Dynamic event sample - only works after Connect")); "Dynamic event sample - only works after Connect");
menuEvent->AppendSeparator(); menuEvent->AppendSeparator();
menuEvent->Append(Event_Push, wxT("&Push event handler\tCtrl-P"), menuEvent->Append(Event_Push, "&Push event handler\tCtrl-P",
wxT("Push event handler for test event")); "Push event handler for test event");
menuEvent->Append(Event_Pop, wxT("P&op event handler\tCtrl-O"), menuEvent->Append(Event_Pop, "P&op event handler\tCtrl-O",
wxT("Pop event handler for test event")); "Pop event handler for test event");
menuEvent->Append(Event_Test, wxT("Test event\tCtrl-T"), menuEvent->Append(Event_Test, "Test event\tCtrl-T",
wxT("Test event processed by pushed event handler")); "Test event processed by pushed event handler");
menuEvent->AppendSeparator(); menuEvent->AppendSeparator();
menuEvent->Append(Event_Custom, wxT("Fire c&ustom event\tCtrl-U"), menuEvent->Append(Event_Custom, "Fire c&ustom event\tCtrl-U",
wxT("Generate a custom event")); "Generate a custom event");
menuEvent->Append(Event_Gesture, wxT("&Gesture events\tCtrl-G"), menuEvent->Append(Event_Gesture, "&Gesture events\tCtrl-G",
wxT("Gesture event")); "Gesture event");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(menuEvent, wxT("&Event")); menuBar->Append(menuEvent, "&Event");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
CreateStatusBar(3); CreateStatusBar(3);
SetStatusText(wxT("Welcome to wxWidgets event sample")); SetStatusText("Welcome to wxWidgets event sample");
SetStatusText(wxT("Dynamic: off"), Status_Dynamic); SetStatusText("Dynamic: off", Status_Dynamic);
SetStatusText(wxT("Push count: 0"), Status_Push); SetStatusText("Push count: 0", Status_Push);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
wxPanel * const panel = new wxPanel(this); wxPanel * const panel = new wxPanel(this);
@@ -562,19 +562,19 @@ void MyFrame::OnPushEventHandler(wxCommandEvent& WXUNUSED(event))
PushEventHandler(new MyEvtHandler(++m_nPush)); PushEventHandler(new MyEvtHandler(++m_nPush));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxString::Format(wxT("Push count: %u"), m_nPush), Status_Push); SetStatusText(wxString::Format("Push count: %u", m_nPush), Status_Push);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
{ {
wxCHECK_RET( m_nPush, wxT("this command should be disabled!") ); wxCHECK_RET( m_nPush, "this command should be disabled!" );
PopEventHandler(true /* delete handler */); PopEventHandler(true /* delete handler */);
m_nPush--; m_nPush--;
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxString::Format(wxT("Push count: %u"), m_nPush), Status_Push); SetStatusText(wxString::Format("Push count: %u", m_nPush), Status_Push);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -593,7 +593,7 @@ void MyFrame::OnGesture(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("This is the test event handler in the main frame")); wxLogMessage("This is the test event handler in the main frame");
} }
void MyFrame::OnUpdateUIPop(wxUpdateUIEvent& event) void MyFrame::OnUpdateUIPop(wxUpdateUIEvent& event)
@@ -614,5 +614,5 @@ void MyFrame::OnFireCustom(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnProcessCustom(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnProcessCustom(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Got a custom event!")); wxLogMessage("Got a custom event!");
} }

View File

@@ -302,11 +302,11 @@ bool MyApp::OnExceptionInMainLoop()
} }
catch ( int i ) catch ( int i )
{ {
wxLogWarning(wxT("Caught an int %d in MyApp."), i); wxLogWarning("Caught an int %d in MyApp.", i);
} }
catch ( MyException& e ) catch ( MyException& e )
{ {
wxLogWarning(wxT("Caught MyException(%s) in MyApp."), e.what()); wxLogWarning("Caught MyException(%s) in MyApp.", e.what());
} }
catch ( ... ) catch ( ... )
{ {
@@ -364,15 +364,15 @@ void MyApp::OnUnhandledException()
} }
catch ( ... ) catch ( ... )
{ {
wxMessageBox(wxT("Unhandled exception caught, program will terminate."), wxMessageBox("Unhandled exception caught, program will terminate.",
wxT("wxExcept Sample"), wxOK | wxICON_ERROR); "wxExcept Sample", wxOK | wxICON_ERROR);
} }
} }
void MyApp::OnFatalException() void MyApp::OnFatalException()
{ {
wxMessageBox(wxT("Program has crashed and will terminate."), wxMessageBox("Program has crashed and will terminate.",
wxT("wxExcept Sample"), wxOK | wxICON_ERROR); "wxExcept Sample", wxOK | wxICON_ERROR);
} }
void MyApp::OnAssertFailure(const wxChar *file, void MyApp::OnAssertFailure(const wxChar *file,
@@ -403,7 +403,7 @@ void MyApp::OnAssertFailure(const wxChar *file,
// frame constructor // frame constructor
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, wxT("Except wxWidgets App"), : wxFrame(NULL, wxID_ANY, "Except wxWidgets App",
wxPoint(50, 50), wxSize(450, 340)) wxPoint(50, 50), wxSize(450, 340))
{ {
// set the frame icon // set the frame icon
@@ -412,38 +412,38 @@ MyFrame::MyFrame()
#if wxUSE_MENUS #if wxUSE_MENUS
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(Except_Dialog, wxT("Show &dialog\tCtrl-D")); menuFile->Append(Except_Dialog, "Show &dialog\tCtrl-D");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Except_ThrowInt, wxT("Throw an &int\tCtrl-I")); menuFile->Append(Except_ThrowInt, "Throw an &int\tCtrl-I");
menuFile->Append(Except_ThrowString, wxT("Throw a &string\tCtrl-S")); menuFile->Append(Except_ThrowString, "Throw a &string\tCtrl-S");
menuFile->Append(Except_ThrowObject, wxT("Throw an &object\tCtrl-O")); menuFile->Append(Except_ThrowObject, "Throw an &object\tCtrl-O");
menuFile->Append(Except_ThrowUnhandled, menuFile->Append(Except_ThrowUnhandled,
wxT("Throw &unhandled exception\tCtrl-U")); "Throw &unhandled exception\tCtrl-U");
menuFile->Append(Except_ThrowFromYield, menuFile->Append(Except_ThrowFromYield,
wxT("Throw from wx&Yield()\tCtrl-Y")); "Throw from wx&Yield()\tCtrl-Y");
menuFile->Append(Except_Crash, wxT("&Crash\tCtrl-C")); menuFile->Append(Except_Crash, "&Crash\tCtrl-C");
menuFile->Append(Except_Trap, "&Trap\tCtrl-T", menuFile->Append(Except_Trap, "&Trap\tCtrl-T",
"Break into the debugger (if one is running)"); "Break into the debugger (if one is running)");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
#if wxUSE_ON_FATAL_EXCEPTION #if wxUSE_ON_FATAL_EXCEPTION
menuFile->AppendCheckItem(Except_HandleCrash, wxT("&Handle crashes\tCtrl-H")); menuFile->AppendCheckItem(Except_HandleCrash, "&Handle crashes\tCtrl-H");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
#endif // wxUSE_ON_FATAL_EXCEPTION #endif // wxUSE_ON_FATAL_EXCEPTION
menuFile->Append(Except_ShowAssert, wxT("Provoke &assert failure\tCtrl-A")); menuFile->Append(Except_ShowAssert, "Provoke &assert failure\tCtrl-A");
#if wxUSE_THREADS #if wxUSE_THREADS
menuFile->Append(Except_ShowAssertInThread, menuFile->Append(Except_ShowAssertInThread,
wxT("Assert failure in &thread\tShift-Ctrl-A")); "Assert failure in &thread\tShift-Ctrl-A");
#endif // wxUSE_THREADS #endif // wxUSE_THREADS
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Except_Quit, wxT("E&xit\tCtrl-Q"), wxT("Quit this program")); menuFile->Append(Except_Quit, "E&xit\tCtrl-Q", "Quit this program");
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(Except_About, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(Except_About, "&About\tF1", "Show about dialog");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -452,7 +452,7 @@ MyFrame::MyFrame()
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -490,7 +490,7 @@ void MyFrame::OnDialog(wxCommandEvent& WXUNUSED(event))
} }
catch ( ... ) catch ( ... )
{ {
wxLogWarning(wxT("An exception in MyDialog")); wxLogWarning("An exception in MyDialog");
Destroy(); Destroy();
throw; throw;
@@ -504,12 +504,12 @@ void MyFrame::OnThrowInt(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnThrowString(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnThrowString(wxCommandEvent& WXUNUSED(event))
{ {
throw wxT("string thrown from MyFrame"); throw "string thrown from MyFrame";
} }
void MyFrame::OnThrowObject(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnThrowObject(wxCommandEvent& WXUNUSED(event))
{ {
throw MyException(wxT("Exception thrown from MyFrame")); throw MyException("Exception thrown from MyFrame");
} }
void MyFrame::OnThrowUnhandled(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnThrowUnhandled(wxCommandEvent& WXUNUSED(event))
@@ -602,10 +602,10 @@ void MyFrame::OnShowAssertInThread(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is the About dialog of the except sample.\n") msg.Printf( "This is the About dialog of the except sample.\n"
wxT("Welcome to %s"), wxVERSION_STRING); "Welcome to %s", wxVERSION_STRING);
wxMessageBox(msg, wxT("About Except"), wxOK | wxICON_INFORMATION, this); wxMessageBox(msg, "About Except", wxOK | wxICON_INFORMATION, this);
} }
// ============================================================================ // ============================================================================
@@ -613,19 +613,19 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
// ============================================================================ // ============================================================================
MyDialog::MyDialog(wxFrame *parent) MyDialog::MyDialog(wxFrame *parent)
: wxDialog(parent, wxID_ANY, wxString(wxT("Throw exception dialog"))) : wxDialog(parent, wxID_ANY, wxString("Throw exception dialog"))
{ {
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(new wxButton(this, Except_ThrowInt, wxT("Throw &int")), sizerTop->Add(new wxButton(this, Except_ThrowInt, "Throw &int"),
0, wxEXPAND | wxALL, 5); 0, wxEXPAND | wxALL, 5);
sizerTop->Add(new wxButton(this, Except_ThrowObject, wxT("Throw &object")), sizerTop->Add(new wxButton(this, Except_ThrowObject, "Throw &object"),
0, wxEXPAND | wxALL, 5); 0, wxEXPAND | wxALL, 5);
sizerTop->Add(new wxButton(this, Except_ThrowUnhandled, wxT("Throw &unhandled")), sizerTop->Add(new wxButton(this, Except_ThrowUnhandled, "Throw &unhandled"),
0, wxEXPAND | wxALL, 5); 0, wxEXPAND | wxALL, 5);
sizerTop->Add(new wxButton(this, Except_Crash, wxT("&Crash")), sizerTop->Add(new wxButton(this, Except_Crash, "&Crash"),
0, wxEXPAND | wxALL, 5); 0, wxEXPAND | wxALL, 5);
sizerTop->Add(new wxButton(this, wxID_CANCEL, wxT("&Cancel")), sizerTop->Add(new wxButton(this, wxID_CANCEL, "&Cancel"),
0, wxEXPAND | wxALL, 5); 0, wxEXPAND | wxALL, 5);
SetSizerAndFit(sizerTop); SetSizerAndFit(sizerTop);
@@ -638,7 +638,7 @@ void MyDialog::OnThrowInt(wxCommandEvent& WXUNUSED(event))
void MyDialog::OnThrowObject(wxCommandEvent& WXUNUSED(event)) void MyDialog::OnThrowObject(wxCommandEvent& WXUNUSED(event))
{ {
throw MyException(wxT("Exception thrown from MyDialog")); throw MyException("Exception thrown from MyDialog");
} }
void MyDialog::OnThrowUnhandled(wxCommandEvent& WXUNUSED(event)) void MyDialog::OnThrowUnhandled(wxCommandEvent& WXUNUSED(event))

View File

@@ -218,7 +218,7 @@ protected:
void DoSend() void DoSend()
{ {
wxString s(m_textOut->GetValue()); wxString s(m_textOut->GetValue());
s += wxT('\n'); s += '\n';
m_out.Write(s.c_str(), s.length()); m_out.Write(s.c_str(), s.length());
m_textOut->Clear(); m_textOut->Clear();
@@ -343,7 +343,10 @@ enum
Exec_Btn_Close Exec_Btn_Close
}; };
static const wxChar *DIALOG_TITLE = wxT("Exec sample"); static wxString DIALOG_TITLE()
{
return "Exec sample";
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// event tables and other macros for wxWidgets // event tables and other macros for wxWidgets
@@ -420,7 +423,7 @@ bool MyApp::OnInit()
return false; return false;
// Create the main application window // Create the main application window
MyFrame *frame = new MyFrame(wxT("Exec wxWidgets sample"), MyFrame *frame = new MyFrame("Exec wxWidgets sample",
wxDefaultPosition, wxSize(500, 140)); wxDefaultPosition, wxSize(500, 140));
// Show it // Show it
@@ -458,26 +461,26 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF); wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
menuFile->Append(Exec_Kill, wxT("&Kill process...\tCtrl-K"), menuFile->Append(Exec_Kill, "&Kill process...\tCtrl-K",
wxT("Kill a process by PID")); "Kill a process by PID");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Exec_OpenFile, wxT("Open &file...\tCtrl-F"), menuFile->Append(Exec_OpenFile, "Open &file...\tCtrl-F",
wxT("Launch the command to open this kind of files")); "Launch the command to open this kind of files");
menuFile->Append(Exec_ShowCommandForExt, menuFile->Append(Exec_ShowCommandForExt,
"Show association for extension...\tShift-Ctrl-A", "Show association for extension...\tShift-Ctrl-A",
"Show the command associated with the given extension"); "Show the command associated with the given extension");
menuFile->Append(Exec_LaunchFile, wxT("La&unch file...\tShift-Ctrl-F"), menuFile->Append(Exec_LaunchFile, "La&unch file...\tShift-Ctrl-F",
wxT("Launch the default application associated with the file")); "Launch the default application associated with the file");
menuFile->Append(Exec_OpenURL, wxT("Open &URL...\tCtrl-U"), menuFile->Append(Exec_OpenURL, "Open &URL...\tCtrl-U",
wxT("Launch the default browser with the given URL")); "Launch the default browser with the given URL");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Exec_BeginBusyCursor, wxT("Show &busy cursor\tCtrl-C")); menuFile->Append(Exec_BeginBusyCursor, "Show &busy cursor\tCtrl-C");
menuFile->Append(Exec_EndBusyCursor, wxT("Show &normal cursor\tShift-Ctrl-C")); menuFile->Append(Exec_EndBusyCursor, "Show &normal cursor\tShift-Ctrl-C");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Exec_ClearLog, wxT("&Clear log\tCtrl-L"), menuFile->Append(Exec_ClearLog, "&Clear log\tCtrl-L",
wxT("Clear the log window")); "Clear the log window");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Exec_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(Exec_Quit, "E&xit\tAlt-X", "Quit this program");
wxMenu *flagsMenu = new wxMenu; wxMenu *flagsMenu = new wxMenu;
flagsMenu->AppendCheckItem(Exec_Flags_HideConsole, "Always &hide console"); flagsMenu->AppendCheckItem(Exec_Flags_HideConsole, "Always &hide console");
@@ -488,34 +491,34 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
wxMenu *execMenu = new wxMenu; wxMenu *execMenu = new wxMenu;
execMenu->AppendSubMenu(flagsMenu, "Execution flags"); execMenu->AppendSubMenu(flagsMenu, "Execution flags");
execMenu->AppendSeparator(); execMenu->AppendSeparator();
execMenu->Append(Exec_SyncExec, wxT("Sync &execution...\tCtrl-E"), execMenu->Append(Exec_SyncExec, "Sync &execution...\tCtrl-E",
wxT("Launch a program and return when it terminates")); "Launch a program and return when it terminates");
execMenu->Append(Exec_AsyncExec, wxT("&Async execution...\tCtrl-A"), execMenu->Append(Exec_AsyncExec, "&Async execution...\tCtrl-A",
wxT("Launch a program and return immediately")); "Launch a program and return immediately");
execMenu->Append(Exec_Shell, wxT("Execute &shell command...\tCtrl-S"), execMenu->Append(Exec_Shell, "Execute &shell command...\tCtrl-S",
wxT("Launch a shell and execute a command in it")); "Launch a shell and execute a command in it");
execMenu->AppendSeparator(); execMenu->AppendSeparator();
execMenu->Append(Exec_Redirect, wxT("Capture command &output...\tCtrl-O"), execMenu->Append(Exec_Redirect, "Capture command &output...\tCtrl-O",
wxT("Launch a program and capture its output")); "Launch a program and capture its output");
execMenu->Append(Exec_Pipe, wxT("&Pipe through command..."), execMenu->Append(Exec_Pipe, "&Pipe through command...",
wxT("Pipe a string through a filter")); "Pipe a string through a filter");
execMenu->Append(Exec_POpen, wxT("&Open a pipe to a command...\tCtrl-P"), execMenu->Append(Exec_POpen, "&Open a pipe to a command...\tCtrl-P",
wxT("Open a pipe to and from another program")); "Open a pipe to and from another program");
#ifdef __WINDOWS__ #ifdef __WINDOWS__
execMenu->AppendSeparator(); execMenu->AppendSeparator();
execMenu->Append(Exec_DDEExec, wxT("Execute command via &DDE...\tCtrl-D")); execMenu->Append(Exec_DDEExec, "Execute command via &DDE...\tCtrl-D");
execMenu->Append(Exec_DDERequest, wxT("Send DDE &request...\tCtrl-R")); execMenu->Append(Exec_DDERequest, "Send DDE &request...\tCtrl-R");
#endif #endif
wxMenu *helpMenu = new wxMenu(wxEmptyString, wxMENU_TEAROFF); wxMenu *helpMenu = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
helpMenu->Append(Exec_About, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(Exec_About, "&About\tF1", "Show about dialog");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(execMenu, wxT("&Exec")); menuBar->Append(execMenu, "&Exec");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -529,7 +532,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets exec sample!")); SetStatusText("Welcome to wxWidgets exec sample!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
m_timerBg.Start(1000); m_timerBg.Start(1000);
@@ -573,15 +576,15 @@ void MyFrame::OnEndBusyCursor(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("Exec wxWidgets Sample\n(c) 2000-2002 Vadim Zeitlin"), wxMessageBox("Exec wxWidgets Sample\n(c) 2000-2002 Vadim Zeitlin",
wxT("About Exec"), wxOK | wxICON_INFORMATION, this); "About Exec", wxOK | wxICON_INFORMATION, this);
} }
void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
{ {
long pid = wxGetNumberFromUser(wxT("Please specify the process to kill"), long pid = wxGetNumberFromUser("Please specify the process to kill",
wxT("Enter PID:"), "Enter PID:",
wxT("Exec question"), "Exec question",
m_pidLast, m_pidLast,
// we need the full unsigned int range // we need the full unsigned int range
-INT_MAX, INT_MAX, -INT_MAX, INT_MAX,
@@ -596,34 +599,34 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
static const wxString signalNames[] = static const wxString signalNames[] =
{ {
wxT("Just test (SIGNONE)"), "Just test (SIGNONE)",
wxT("Hangup (SIGHUP)"), "Hangup (SIGHUP)",
wxT("Interrupt (SIGINT)"), "Interrupt (SIGINT)",
wxT("Quit (SIGQUIT)"), "Quit (SIGQUIT)",
wxT("Illegal instruction (SIGILL)"), "Illegal instruction (SIGILL)",
wxT("Trap (SIGTRAP)"), "Trap (SIGTRAP)",
wxT("Abort (SIGABRT)"), "Abort (SIGABRT)",
wxT("Emulated trap (SIGEMT)"), "Emulated trap (SIGEMT)",
wxT("FP exception (SIGFPE)"), "FP exception (SIGFPE)",
wxT("Kill (SIGKILL)"), "Kill (SIGKILL)",
wxT("Bus (SIGBUS)"), "Bus (SIGBUS)",
wxT("Segment violation (SIGSEGV)"), "Segment violation (SIGSEGV)",
wxT("System (SIGSYS)"), "System (SIGSYS)",
wxT("Broken pipe (SIGPIPE)"), "Broken pipe (SIGPIPE)",
wxT("Alarm (SIGALRM)"), "Alarm (SIGALRM)",
wxT("Terminate (SIGTERM)"), "Terminate (SIGTERM)",
}; };
static int s_sigLast = wxSIGNONE; static int s_sigLast = wxSIGNONE;
int sig = wxGetSingleChoiceIndex(wxT("How to kill the process?"), int sig = wxGetSingleChoiceIndex("How to kill the process?",
wxT("Exec question"), "Exec question",
WXSIZEOF(signalNames), signalNames, WXSIZEOF(signalNames), signalNames,
s_sigLast, s_sigLast,
this); this);
switch ( sig ) switch ( sig )
{ {
default: default:
wxFAIL_MSG( wxT("unexpected return value") ); wxFAIL_MSG( "unexpected return value" );
// fall through // fall through
case -1: case -1:
@@ -656,11 +659,11 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
// This simply calls Kill(wxSIGNONE) but using it is more convenient. // This simply calls Kill(wxSIGNONE) but using it is more convenient.
if ( wxProcess::Exists(pid) ) if ( wxProcess::Exists(pid) )
{ {
wxLogStatus(wxT("Process %ld is running."), pid); wxLogStatus("Process %ld is running.", pid);
} }
else else
{ {
wxLogStatus(wxT("No process with pid = %ld."), pid); wxLogStatus("No process with pid = %ld.", pid);
} }
} }
else // not SIGNONE else // not SIGNONE
@@ -668,20 +671,18 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
wxKillError rc = wxProcess::Kill(pid, (wxSignal)sig); wxKillError rc = wxProcess::Kill(pid, (wxSignal)sig);
if ( rc == wxKILL_OK ) if ( rc == wxKILL_OK )
{ {
wxLogStatus(wxT("Process %ld killed with signal %d."), pid, sig); wxLogStatus("Process %ld killed with signal %d.", pid, sig);
} }
else else
{ {
static const wxChar *errorText[] = wxArrayString errorText;
{ errorText.push_back(""); // no error
wxT(""), // no error errorText.push_back("signal not supported");
wxT("signal not supported"), errorText.push_back("permission denied");
wxT("permission denied"), errorText.push_back("no such process");
wxT("no such process"), errorText.push_back("unspecified error");
wxT("unspecified error"),
};
wxLogStatus(wxT("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]);
} }
} }
@@ -741,7 +742,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, DIALOG_TITLE(),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{ {
@@ -854,13 +855,13 @@ void MyFrame::DoAsyncExec(const wxString& cmd)
m_pidLast = wxExecute(cmd, wxEXEC_ASYNC | GetExecFlags(), process); m_pidLast = wxExecute(cmd, wxEXEC_ASYNC | GetExecFlags(), process);
if ( !m_pidLast ) if ( !m_pidLast )
{ {
wxLogError(wxT("Execution of '%s' failed."), cmd.c_str()); wxLogError("Execution of '%s' failed.", cmd.c_str());
delete process; delete process;
} }
else else
{ {
wxLogStatus(wxT("Process %ld (%s) launched."), m_pidLast, cmd.c_str()); wxLogStatus("Process %ld (%s) launched.", m_pidLast, cmd.c_str());
m_cmdLast = cmd; m_cmdLast = cmd;
@@ -877,11 +878,11 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event))
if ( !QueryExec(cmd, env) ) if ( !QueryExec(cmd, env) )
return; return;
wxLogStatus( wxT("'%s' is running please wait..."), cmd.c_str() ); wxLogStatus( "'%s' is running please wait...", cmd.c_str() );
int code = wxExecute(cmd, wxEXEC_SYNC | GetExecFlags(), NULL, &env); int code = wxExecute(cmd, wxEXEC_SYNC | GetExecFlags(), NULL, &env);
wxLogStatus(wxT("Process '%s' terminated with exit code %d."), wxLogStatus("Process '%s' terminated with exit code %d.",
cmd.c_str(), code); cmd.c_str(), code);
m_cmdLast = cmd; m_cmdLast = cmd;
@@ -889,8 +890,8 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event))
{ {
wxString cmd = wxGetTextFromUser(wxT("Enter the command: "), wxString cmd = wxGetTextFromUser("Enter the command: ",
DIALOG_TITLE, DIALOG_TITLE(),
m_cmdLast); m_cmdLast);
if ( !cmd ) if ( !cmd )
@@ -901,15 +902,15 @@ void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnShell(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnShell(wxCommandEvent& WXUNUSED(event))
{ {
wxString cmd = wxGetTextFromUser(wxT("Enter the command: "), wxString cmd = wxGetTextFromUser("Enter the command: ",
DIALOG_TITLE, DIALOG_TITLE(),
m_cmdLast); m_cmdLast);
if ( !cmd ) if ( !cmd )
return; return;
int code = wxShell(cmd); int code = wxShell(cmd);
wxLogStatus(wxT("Shell command '%s' terminated with exit code %d."), wxLogStatus("Shell command '%s' terminated with exit code %d.",
cmd.c_str(), code); cmd.c_str(), code);
m_cmdLast = cmd; m_cmdLast = cmd;
} }
@@ -925,16 +926,16 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event))
#endif #endif
} }
wxString cmd = wxGetTextFromUser(wxT("Enter the command: "), wxString cmd = wxGetTextFromUser("Enter the command: ",
DIALOG_TITLE, DIALOG_TITLE(),
m_cmdLast); m_cmdLast);
if ( !cmd ) if ( !cmd )
return; return;
bool sync; bool sync;
switch ( wxMessageBox(wxT("Execute it synchronously?"), switch ( wxMessageBox("Execute it synchronously?",
wxT("Exec question"), "Exec question",
wxYES_NO | wxCANCEL | wxICON_QUESTION, this) ) wxYES_NO | wxCANCEL | wxICON_QUESTION, this) )
{ {
case wxYES: case wxYES:
@@ -961,15 +962,15 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event))
wxLogStatus("Command \"%s\" terminated after %ldms; exit code %d.", wxLogStatus("Command \"%s\" terminated after %ldms; exit code %d.",
cmd, sw.Time(), code); cmd, sw.Time(), code);
ShowOutput(cmd, output, wxT("Output")); ShowOutput(cmd, output, "Output");
ShowOutput(cmd, errors, wxT("Errors")); ShowOutput(cmd, errors, "Errors");
} }
else // async exec else // async exec
{ {
MyPipedProcess *process = new MyPipedProcess(this, cmd); MyPipedProcess *process = new MyPipedProcess(this, cmd);
if ( !wxExecute(cmd, wxEXEC_ASYNC, process) ) if ( !wxExecute(cmd, wxEXEC_ASYNC, process) )
{ {
wxLogError(wxT("Execution of '%s' failed."), cmd.c_str()); wxLogError("Execution of '%s' failed.", cmd.c_str());
delete process; delete process;
} }
@@ -985,17 +986,17 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
{ {
if ( !m_cmdLast ) if ( !m_cmdLast )
m_cmdLast = wxT("tr [a-z] [A-Z]"); m_cmdLast = "tr [a-z] [A-Z]";
wxString cmd = wxGetTextFromUser(wxT("Enter the command: "), wxString cmd = wxGetTextFromUser("Enter the command: ",
DIALOG_TITLE, DIALOG_TITLE(),
m_cmdLast); m_cmdLast);
if ( !cmd ) if ( !cmd )
return; return;
wxString input = wxGetTextFromUser(wxT("Enter the string to send to it: "), wxString input = wxGetTextFromUser("Enter the string to send to it: ",
DIALOG_TITLE); DIALOG_TITLE());
if ( !input ) if ( !input )
return; return;
@@ -1004,13 +1005,13 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
long pid = wxExecute(cmd, wxEXEC_ASYNC, process); long pid = wxExecute(cmd, wxEXEC_ASYNC, process);
if ( pid ) if ( pid )
{ {
wxLogStatus(wxT("Process %ld (%s) launched."), pid, cmd.c_str()); wxLogStatus("Process %ld (%s) launched.", pid, cmd.c_str());
AddPipedProcess(process); AddPipedProcess(process);
} }
else else
{ {
wxLogError(wxT("Execution of '%s' failed."), cmd.c_str()); wxLogError("Execution of '%s' failed.", cmd.c_str());
delete process; delete process;
} }
@@ -1020,8 +1021,8 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnPOpen(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPOpen(wxCommandEvent& WXUNUSED(event))
{ {
wxString cmd = wxGetTextFromUser(wxT("Enter the command to launch: "), wxString cmd = wxGetTextFromUser("Enter the command to launch: ",
DIALOG_TITLE, DIALOG_TITLE(),
m_cmdLast); m_cmdLast);
if ( cmd.empty() ) if ( cmd.empty() )
return; return;
@@ -1029,23 +1030,23 @@ void MyFrame::OnPOpen(wxCommandEvent& WXUNUSED(event))
wxProcess *process = wxProcess::Open(cmd); wxProcess *process = wxProcess::Open(cmd);
if ( !process ) if ( !process )
{ {
wxLogError(wxT("Failed to launch the command.")); wxLogError("Failed to launch the command.");
return; return;
} }
wxLogVerbose(wxT("PID of the new process: %ld"), process->GetPid()); wxLogVerbose("PID of the new process: %ld", process->GetPid());
wxOutputStream *out = process->GetOutputStream(); wxOutputStream *out = process->GetOutputStream();
if ( !out ) if ( !out )
{ {
wxLogError(wxT("Failed to connect to child stdin")); wxLogError("Failed to connect to child stdin");
return; return;
} }
wxInputStream *in = process->GetInputStream(); wxInputStream *in = process->GetInputStream();
if ( !in ) if ( !in )
{ {
wxLogError(wxT("Failed to connect to child stdout")); wxLogError("Failed to connect to child stdout");
return; return;
} }
@@ -1059,9 +1060,9 @@ static bool AskUserForFileName()
wxString filename; wxString filename;
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
filename = wxLoadFileSelector(wxT("any"), wxEmptyString, gs_lastFile); filename = wxLoadFileSelector("any", wxEmptyString, gs_lastFile);
#else // !wxUSE_FILEDLG #else // !wxUSE_FILEDLG
filename = wxGetTextFromUser(wxT("Enter the file name"), wxT("exec sample"), filename = wxGetTextFromUser("Enter the file name", "exec sample",
gs_lastFile); gs_lastFile);
#endif // wxUSE_FILEDLG/!wxUSE_FILEDLG #endif // wxUSE_FILEDLG/!wxUSE_FILEDLG
@@ -1082,7 +1083,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event))
wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(ext); wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);
if ( !ft ) if ( !ft )
{ {
wxLogError(wxT("Impossible to determine the file type for extension '%s'"), wxLogError("Impossible to determine the file type for extension '%s'",
ext.c_str()); ext.c_str());
return; return;
} }
@@ -1092,7 +1093,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event))
const wxFileType::MessageParameters params(gs_lastFile); const wxFileType::MessageParameters params(gs_lastFile);
#ifdef __WXMSW__ #ifdef __WXMSW__
// try editor, for instance Notepad if extension is .xml // try editor, for instance Notepad if extension is .xml
cmd = ft->GetExpandedCommand(wxT("edit"), params); cmd = ft->GetExpandedCommand("edit", params);
ok = !cmd.empty(); ok = !cmd.empty();
#endif #endif
if (!ok) // else try viewer if (!ok) // else try viewer
@@ -1100,7 +1101,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event))
delete ft; delete ft;
if ( !ok ) if ( !ok )
{ {
wxLogError(wxT("Impossible to find out how to open files of extension '%s'"), wxLogError("Impossible to find out how to open files of extension '%s'",
ext.c_str()); ext.c_str());
return; return;
} }
@@ -1156,12 +1157,12 @@ void MyFrame::OnFileLaunch(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event))
{ {
static wxString s_url(wxT("http://www.wxwidgets.org/")); static wxString s_url("http://www.wxwidgets.org/");
wxString filename = wxGetTextFromUser wxString filename = wxGetTextFromUser
( (
wxT("Enter the URL"), "Enter the URL",
wxT("exec sample"), "exec sample",
s_url, s_url,
this this
); );
@@ -1185,20 +1186,20 @@ void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event))
bool MyFrame::GetDDEServer() bool MyFrame::GetDDEServer()
{ {
wxString server = wxGetTextFromUser(wxT("Server to connect to:"), wxString server = wxGetTextFromUser("Server to connect to:",
DIALOG_TITLE, m_server); DIALOG_TITLE(), m_server);
if ( !server ) if ( !server )
return false; return false;
m_server = server; m_server = server;
wxString topic = wxGetTextFromUser(wxT("DDE topic:"), DIALOG_TITLE, m_topic); wxString topic = wxGetTextFromUser("DDE topic:", DIALOG_TITLE(), m_topic);
if ( !topic ) if ( !topic )
return false; return false;
m_topic = topic; m_topic = topic;
wxString cmd = wxGetTextFromUser(wxT("DDE command:"), DIALOG_TITLE, m_cmdDde); wxString cmd = wxGetTextFromUser("DDE command:", DIALOG_TITLE(), m_cmdDde);
if ( !cmd ) if ( !cmd )
return false; return false;
@@ -1216,19 +1217,19 @@ void MyFrame::OnDDEExec(wxCommandEvent& WXUNUSED(event))
wxConnectionBase *conn = client.MakeConnection(wxEmptyString, m_server, m_topic); wxConnectionBase *conn = client.MakeConnection(wxEmptyString, m_server, m_topic);
if ( !conn ) if ( !conn )
{ {
wxLogError(wxT("Failed to connect to the DDE server '%s'."), wxLogError("Failed to connect to the DDE server '%s'.",
m_server.c_str()); m_server.c_str());
} }
else else
{ {
if ( !conn->Execute(m_cmdDde) ) if ( !conn->Execute(m_cmdDde) )
{ {
wxLogError(wxT("Failed to execute command '%s' via DDE."), wxLogError("Failed to execute command '%s' via DDE.",
m_cmdDde.c_str()); m_cmdDde.c_str());
} }
else else
{ {
wxLogStatus(wxT("Successfully executed DDE command")); wxLogStatus("Successfully executed DDE command");
} }
} }
} }
@@ -1242,19 +1243,19 @@ void MyFrame::OnDDERequest(wxCommandEvent& WXUNUSED(event))
wxConnectionBase *conn = client.MakeConnection(wxEmptyString, m_server, m_topic); wxConnectionBase *conn = client.MakeConnection(wxEmptyString, m_server, m_topic);
if ( !conn ) if ( !conn )
{ {
wxLogError(wxT("Failed to connect to the DDE server '%s'."), wxLogError("Failed to connect to the DDE server '%s'.",
m_server.c_str()); m_server.c_str());
} }
else else
{ {
if ( !conn->Request(m_cmdDde) ) if ( !conn->Request(m_cmdDde) )
{ {
wxLogError(wxT("Failed to send request '%s' via DDE."), wxLogError("Failed to send request '%s' via DDE.",
m_cmdDde.c_str()); m_cmdDde.c_str());
} }
else else
{ {
wxLogStatus(wxT("Successfully sent DDE request.")); wxLogStatus("Successfully sent DDE request.");
} }
} }
} }
@@ -1335,7 +1336,7 @@ void MyFrame::ShowOutput(const wxString& cmd,
if ( !count ) if ( !count )
return; return;
m_lbox->Append(wxString::Format(wxT("--- %s of '%s' ---"), m_lbox->Append(wxString::Format("--- %s of '%s' ---",
title.c_str(), cmd.c_str())); title.c_str(), cmd.c_str()));
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
@@ -1343,7 +1344,7 @@ void MyFrame::ShowOutput(const wxString& cmd,
m_lbox->Append(output[n]); m_lbox->Append(output[n]);
} }
m_lbox->Append(wxString::Format(wxT("--- End of %s ---"), m_lbox->Append(wxString::Format("--- End of %s ---",
title.Lower().c_str())); title.Lower().c_str()));
} }
@@ -1353,7 +1354,7 @@ void MyFrame::ShowOutput(const wxString& cmd,
void MyProcess::OnTerminate(int pid, int status) void MyProcess::OnTerminate(int pid, int status)
{ {
wxLogStatus(m_parent, wxT("Process %u ('%s') terminated with exit code %d."), wxLogStatus(m_parent, "Process %u ('%s') terminated with exit code %d.",
pid, m_cmd.c_str(), status); pid, m_cmd.c_str(), status);
m_parent->OnAsyncTermination(this); m_parent->OnAsyncTermination(this);
@@ -1373,7 +1374,7 @@ bool MyPipedProcess::HasInput()
// this assumes that the output is always line buffered // this assumes that the output is always line buffered
wxString msg; wxString msg;
msg << m_cmd << wxT(" (stdout): ") << tis.ReadLine(); msg << m_cmd << " (stdout): " << tis.ReadLine();
m_parent->GetLogListBox()->Append(msg); m_parent->GetLogListBox()->Append(msg);
@@ -1386,7 +1387,7 @@ bool MyPipedProcess::HasInput()
// this assumes that the output is always line buffered // this assumes that the output is always line buffered
wxString msg; wxString msg;
msg << m_cmd << wxT(" (stderr): ") << tis.ReadLine(); msg << m_cmd << " (stderr): " << tis.ReadLine();
m_parent->GetLogListBox()->Append(msg); m_parent->GetLogListBox()->Append(msg);
@@ -1463,13 +1464,13 @@ MyPipeFrame::MyPipeFrame(wxFrame *parent,
wxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL);
sizerBtns-> sizerBtns->
Add(new wxButton(panel, Exec_Btn_Send, wxT("&Send")), 0, wxALL, 5); Add(new wxButton(panel, Exec_Btn_Send, "&Send"), 0, wxALL, 5);
sizerBtns-> sizerBtns->
Add(new wxButton(panel, Exec_Btn_SendFile, wxT("&File...")), 0, wxALL, 5); Add(new wxButton(panel, Exec_Btn_SendFile, "&File..."), 0, wxALL, 5);
sizerBtns-> sizerBtns->
Add(new wxButton(panel, Exec_Btn_Get, wxT("&Get")), 0, wxALL, 5); Add(new wxButton(panel, Exec_Btn_Get, "&Get"), 0, wxALL, 5);
sizerBtns-> sizerBtns->
Add(new wxButton(panel, Exec_Btn_Close, wxT("&Close")), 0, wxALL, 5); Add(new wxButton(panel, Exec_Btn_Close, "&Close"), 0, wxALL, 5);
sizerTop->Add(sizerBtns, 0, wxCENTRE | wxALL, 5); sizerTop->Add(sizerBtns, 0, wxCENTRE | wxALL, 5);
sizerTop->Add(m_textIn, 1, wxGROW | wxALL, 5); sizerTop->Add(m_textIn, 1, wxGROW | wxALL, 5);
@@ -1484,11 +1485,11 @@ MyPipeFrame::MyPipeFrame(wxFrame *parent,
void MyPipeFrame::OnBtnSendFile(wxCommandEvent& WXUNUSED(event)) void MyPipeFrame::OnBtnSendFile(wxCommandEvent& WXUNUSED(event))
{ {
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
wxFileDialog filedlg(this, wxT("Select file to send")); wxFileDialog filedlg(this, "Select file to send");
if ( filedlg.ShowModal() != wxID_OK ) if ( filedlg.ShowModal() != wxID_OK )
return; return;
wxFFile file(filedlg.GetFilename(), wxT("r")); wxFFile file(filedlg.GetFilename(), "r");
wxString data; wxString data;
if ( !file.IsOpened() || !file.ReadAll(&data) ) if ( !file.IsOpened() || !file.ReadAll(&data) )
return; return;
@@ -1575,7 +1576,7 @@ void MyPipeFrame::OnProcessTerm(wxProcessEvent& WXUNUSED(event))
wxDELETE(m_process); wxDELETE(m_process);
wxLogWarning(wxT("The other process has terminated, closing")); wxLogWarning("The other process has terminated, closing");
DisableInput(); DisableInput();
DisableOutput(); DisableOutput();

View File

@@ -45,7 +45,10 @@
#endif #endif
// used as title for several dialog boxes // used as title for several dialog boxes
static const wxChar SAMPLE_TITLE[] = wxT("wxWidgets Font Sample"); static wxString SAMPLE_TITLE()
{
return "wxWidgets Font Sample";
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private classes // private classes
@@ -415,80 +418,80 @@ MyFrame::MyFrame()
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(Font_TestTextValue, wxT("&Test text value"), menuFile->Append(Font_TestTextValue, "&Test text value",
wxT("Verify that getting and setting text value doesn't change it")); "Verify that getting and setting text value doesn't change it");
menuFile->Append(Font_ViewMsg, wxT("&View...\tCtrl-V"), menuFile->Append(Font_ViewMsg, "&View...\tCtrl-V",
wxT("View an email message file")); "View an email message file");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Font_About, wxT("&About\tCtrl-A"), wxT("Show about dialog")); menuFile->Append(Font_About, "&About\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Font_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(Font_Quit, "E&xit\tAlt-X", "Quit this program");
wxMenu *menuFont = new wxMenu; wxMenu *menuFont = new wxMenu;
menuFont->Append(Font_IncSize, wxT("&Increase font size by 2 points\tCtrl-I")); menuFont->Append(Font_IncSize, "&Increase font size by 2 points\tCtrl-I");
menuFont->Append(Font_DecSize, wxT("&Decrease font size by 2 points\tCtrl-D")); menuFont->Append(Font_DecSize, "&Decrease font size by 2 points\tCtrl-D");
menuFont->Append(Font_GetBaseFont, wxT("Use &base version of the font\tCtrl-0")); menuFont->Append(Font_GetBaseFont, "Use &base version of the font\tCtrl-0");
menuFont->AppendSeparator(); menuFont->AppendSeparator();
menuFont->AppendCheckItem(Font_Bold, wxT("&Bold\tCtrl-B"), wxT("Toggle bold state")); menuFont->AppendCheckItem(Font_Bold, "&Bold\tCtrl-B", "Toggle bold state");
menuFont->AppendCheckItem(Font_Light, wxT("&Light\tCtrl-L"), wxT("Toggle light state")); menuFont->AppendCheckItem(Font_Light, "&Light\tCtrl-L", "Toggle light state");
menuFont->AppendSeparator(); menuFont->AppendSeparator();
menuFont->AppendCheckItem(Font_Italic, wxT("&Oblique\tCtrl-O"), wxT("Toggle italic state")); menuFont->AppendCheckItem(Font_Italic, "&Oblique\tCtrl-O", "Toggle italic state");
#ifndef __WXMSW__ #ifndef __WXMSW__
// under wxMSW slant == italic so there's no reason to provide another menu item for the same thing // under wxMSW slant == italic so there's no reason to provide another menu item for the same thing
menuFont->AppendCheckItem(Font_Slant, wxT("&Slant\tCtrl-S"), wxT("Toggle slant state")); menuFont->AppendCheckItem(Font_Slant, "&Slant\tCtrl-S", "Toggle slant state");
#endif #endif
menuFont->AppendSeparator(); menuFont->AppendSeparator();
menuFont->AppendCheckItem(Font_Underlined, wxT("&Underlined\tCtrl-U"), menuFont->AppendCheckItem(Font_Underlined, "&Underlined\tCtrl-U",
wxT("Toggle underlined state")); "Toggle underlined state");
menuFont->AppendCheckItem(Font_Strikethrough, wxT("&Strikethrough"), menuFont->AppendCheckItem(Font_Strikethrough, "&Strikethrough",
wxT("Toggle strikethrough state")); "Toggle strikethrough state");
menuFont->AppendSeparator(); menuFont->AppendSeparator();
menuFont->Append(Font_SetNativeDesc, menuFont->Append(Font_SetNativeDesc,
wxT("Set native font &description\tShift-Ctrl-D")); "Set native font &description\tShift-Ctrl-D");
menuFont->Append(Font_SetNativeUserDesc, menuFont->Append(Font_SetNativeUserDesc,
wxT("Set &user font description\tShift-Ctrl-U")); "Set &user font description\tShift-Ctrl-U");
menuFont->AppendSeparator(); menuFont->AppendSeparator();
menuFont->Append(Font_SetFamily, wxT("Set font family")); menuFont->Append(Font_SetFamily, "Set font family");
menuFont->Append(Font_SetFaceName, wxT("Set font face name")); menuFont->Append(Font_SetFaceName, "Set font face name");
menuFont->Append(Font_SetEncoding, wxT("Set font &encoding\tShift-Ctrl-E")); menuFont->Append(Font_SetEncoding, "Set font &encoding\tShift-Ctrl-E");
wxMenu *menuSelect = new wxMenu; wxMenu *menuSelect = new wxMenu;
menuSelect->Append(Font_Choose, wxT("&Select font...\tCtrl-S"), menuSelect->Append(Font_Choose, "&Select font...\tCtrl-S",
wxT("Select a standard font")); "Select a standard font");
wxMenu *menuStdFonts = new wxMenu; wxMenu *menuStdFonts = new wxMenu;
menuStdFonts->Append(Font_wxNORMAL_FONT, wxT("wxNORMAL_FONT"), wxT("Normal font used by wxWidgets")); menuStdFonts->Append(Font_wxNORMAL_FONT, "wxNORMAL_FONT", "Normal font used by wxWidgets");
menuStdFonts->Append(Font_wxSMALL_FONT, wxT("wxSMALL_FONT"), wxT("Small font used by wxWidgets")); menuStdFonts->Append(Font_wxSMALL_FONT, "wxSMALL_FONT", "Small font used by wxWidgets");
menuStdFonts->Append(Font_wxITALIC_FONT, wxT("wxITALIC_FONT"), wxT("Italic font used by wxWidgets")); menuStdFonts->Append(Font_wxITALIC_FONT, "wxITALIC_FONT", "Italic font used by wxWidgets");
menuStdFonts->Append(Font_wxSWISS_FONT, wxT("wxSWISS_FONT"), wxT("Swiss font used by wxWidgets")); menuStdFonts->Append(Font_wxSWISS_FONT, "wxSWISS_FONT", "Swiss font used by wxWidgets");
menuStdFonts->Append(Font_wxFont_Default, wxT("wxFont()"), wxT("wxFont constructed from default wxFontInfo")); menuStdFonts->Append(Font_wxFont_Default, "wxFont()", "wxFont constructed from default wxFontInfo");
menuSelect->Append(Font_Standard, wxT("Standar&d fonts"), menuStdFonts); menuSelect->Append(Font_Standard, "Standar&d fonts", menuStdFonts);
wxMenu *menuSettingFonts = new wxMenu; wxMenu *menuSettingFonts = new wxMenu;
menuSettingFonts->Append(Font_wxSYS_OEM_FIXED_FONT, wxT("wxSYS_OEM_FIXED_FONT"), menuSettingFonts->Append(Font_wxSYS_OEM_FIXED_FONT, "wxSYS_OEM_FIXED_FONT",
wxT("Original equipment manufacturer dependent fixed-pitch font.")); "Original equipment manufacturer dependent fixed-pitch font.");
menuSettingFonts->Append(Font_wxSYS_ANSI_FIXED_FONT, wxT("wxSYS_ANSI_FIXED_FONT"), menuSettingFonts->Append(Font_wxSYS_ANSI_FIXED_FONT, "wxSYS_ANSI_FIXED_FONT",
wxT("Windows fixed-pitch (monospaced) font. ")); "Windows fixed-pitch (monospaced) font. ");
menuSettingFonts->Append(Font_wxSYS_ANSI_VAR_FONT, wxT("wxSYS_ANSI_VAR_FONT"), menuSettingFonts->Append(Font_wxSYS_ANSI_VAR_FONT, "wxSYS_ANSI_VAR_FONT",
wxT("Windows variable-pitch (proportional) font.")); "Windows variable-pitch (proportional) font.");
menuSettingFonts->Append(Font_wxSYS_SYSTEM_FONT, wxT("wxSYS_SYSTEM_FONT"), menuSettingFonts->Append(Font_wxSYS_SYSTEM_FONT, "wxSYS_SYSTEM_FONT",
wxT("System font.")); "System font.");
menuSettingFonts->Append(Font_wxSYS_DEVICE_DEFAULT_FONT, wxT("wxSYS_DEVICE_DEFAULT_FONT"), menuSettingFonts->Append(Font_wxSYS_DEVICE_DEFAULT_FONT, "wxSYS_DEVICE_DEFAULT_FONT",
wxT("Device-dependent font.")); "Device-dependent font.");
menuSettingFonts->Append(Font_wxSYS_DEFAULT_GUI_FONT, wxT("wxSYS_DEFAULT_GUI_FONT"), menuSettingFonts->Append(Font_wxSYS_DEFAULT_GUI_FONT, "wxSYS_DEFAULT_GUI_FONT",
wxT("Default font for user interface objects such as menus and dialog boxes. ")); "Default font for user interface objects such as menus and dialog boxes. ");
menuSelect->Append(Font_SystemSettings, wxT("System fonts"), menuSettingFonts); menuSelect->Append(Font_SystemSettings, "System fonts", menuSettingFonts);
menuSelect->AppendSeparator(); menuSelect->AppendSeparator();
menuSelect->Append(Font_EnumFamilies, wxT("Enumerate font &families\tCtrl-F")); menuSelect->Append(Font_EnumFamilies, "Enumerate font &families\tCtrl-F");
menuSelect->Append(Font_EnumFixedFamilies, menuSelect->Append(Font_EnumFixedFamilies,
wxT("Enumerate fi&xed font families\tCtrl-X")); "Enumerate fi&xed font families\tCtrl-X");
menuSelect->Append(Font_EnumEncodings, menuSelect->Append(Font_EnumEncodings,
wxT("Enumerate &encodings\tCtrl-E")); "Enumerate &encodings\tCtrl-E");
menuSelect->Append(Font_EnumFamiliesForEncoding, menuSelect->Append(Font_EnumFamiliesForEncoding,
wxT("Find font for en&coding...\tCtrl-C"), "Find font for en&coding...\tCtrl-C",
wxT("Find font families for given encoding")); "Find font families for given encoding");
#if wxUSE_PRIVATE_FONTS #if wxUSE_PRIVATE_FONTS
// Try to use a private font, under most platforms we just look for it in // Try to use a private font, under most platforms we just look for it in
@@ -531,9 +534,9 @@ MyFrame::MyFrame()
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(menuFont, wxT("F&ont")); menuBar->Append(menuFont, "F&ont");
menuBar->Append(menuSelect, wxT("&Select")); menuBar->Append(menuSelect, "&Select");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -545,7 +548,7 @@ MyFrame::MyFrame()
m_fontWindow->Bind(wxEVT_BUTTON, &MyFrame::OnFontPanelApply, this); m_fontWindow->Bind(wxEVT_BUTTON, &MyFrame::OnFontPanelApply, this);
m_textctrl = new wxTextCtrl(splitter, wxID_ANY, m_textctrl = new wxTextCtrl(splitter, wxID_ANY,
wxT("Paste text here to see how it looks\nlike in the given font"), "Paste text here to see how it looks\nlike in the given font",
wxDefaultPosition, wxDefaultPosition,
wxSize(-1, 6*GetCharHeight()), wxSize(-1, 6*GetCharHeight()),
wxTE_MULTILINE); wxTE_MULTILINE);
@@ -555,7 +558,7 @@ MyFrame::MyFrame()
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(); CreateStatusBar();
SetStatusText(wxT("Welcome to wxWidgets font demo!")); SetStatusText("Welcome to wxWidgets font demo!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
SetClientSize(splitter->GetBestSize()); SetClientSize(splitter->GetBestSize());
@@ -578,7 +581,7 @@ protected:
const wxString& encoding) wxOVERRIDE const wxString& encoding) wxOVERRIDE
{ {
wxString text; wxString text;
text.Printf(wxT("Encoding %u: %s (available in facename '%s')\n"), text.Printf("Encoding %u: %s (available in facename '%s')\n",
(unsigned int) ++m_n, encoding.c_str(), facename.c_str()); (unsigned int) ++m_n, encoding.c_str(), facename.c_str());
m_text += text; m_text += text;
return true; return true;
@@ -595,7 +598,7 @@ void MyFrame::OnEnumerateEncodings(wxCommandEvent& WXUNUSED(event))
fontEnumerator.EnumerateEncodings(); fontEnumerator.EnumerateEncodings();
wxLogMessage(wxT("Enumerating all available encodings:\n%s"), wxLogMessage("Enumerating all available encodings:\n%s",
fontEnumerator.GetText().c_str()); fontEnumerator.GetText().c_str());
} }
@@ -634,8 +637,8 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
int nFacenames = fontEnumerator.GetFacenames().GetCount(); int nFacenames = fontEnumerator.GetFacenames().GetCount();
if ( !silent ) if ( !silent )
{ {
wxLogStatus(this, wxT("Found %d %sfonts"), wxLogStatus(this, "Found %d %sfonts",
nFacenames, fixedWidthOnly ? wxT("fixed width ") : wxT("")); nFacenames, fixedWidthOnly ? "fixed width " : "");
} }
wxString facename; wxString facename;
@@ -655,8 +658,8 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
n = wxGetSingleChoiceIndex n = wxGetSingleChoiceIndex
( (
wxT("Choose a facename"), "Choose a facename",
SAMPLE_TITLE, SAMPLE_TITLE(),
nFacenames, nFacenames,
facenames, facenames,
this this
@@ -679,7 +682,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
} }
else if ( !silent ) else if ( !silent )
{ {
wxLogWarning(wxT("No such fonts found.")); wxLogWarning("No such fonts found.");
} }
return false; return false;
@@ -698,8 +701,8 @@ void MyFrame::OnSetNativeDesc(wxCommandEvent& WXUNUSED(event))
{ {
wxString fontInfo = wxGetTextFromUser wxString fontInfo = wxGetTextFromUser
( (
wxT("Enter native font string"), "Enter native font string",
wxT("Input font description"), "Input font description",
m_fontWindow->GetTextFont().GetNativeFontInfoDesc(), m_fontWindow->GetTextFont().GetNativeFontInfoDesc(),
this this
); );
@@ -722,8 +725,8 @@ void MyFrame::OnSetNativeUserDesc(wxCommandEvent& WXUNUSED(event))
{ {
wxString fontdesc = m_fontWindow->GetTextFont().GetNativeFontInfoUserDesc(); wxString fontdesc = m_fontWindow->GetTextFont().GetNativeFontInfoUserDesc();
wxString fontUserInfo = wxGetTextFromUser( wxString fontUserInfo = wxGetTextFromUser(
wxT("Here you can edit current font description"), "Here you can edit current font description",
wxT("Input font description"), fontdesc, "Input font description", fontdesc,
this); this);
if (fontUserInfo.IsEmpty()) if (fontUserInfo.IsEmpty())
return; // user clicked "Cancel" - do nothing return; // user clicked "Cancel" - do nothing
@@ -731,13 +734,13 @@ void MyFrame::OnSetNativeUserDesc(wxCommandEvent& WXUNUSED(event))
wxFont font; wxFont font;
if (font.SetNativeFontInfoUserDesc(fontUserInfo)) if (font.SetNativeFontInfoUserDesc(fontUserInfo))
{ {
wxASSERT_MSG(font.IsOk(), wxT("The font should now be valid")); wxASSERT_MSG(font.IsOk(), "The font should now be valid");
DoChangeFont(font); DoChangeFont(font);
} }
else else
{ {
wxASSERT_MSG(!font.IsOk(), wxT("The font should now be invalid")); wxASSERT_MSG(!font.IsOk(), "The font should now be invalid");
wxMessageBox(wxT("Error trying to create a font with such description...")); wxMessageBox("Error trying to create a font with such description...");
} }
} }
@@ -754,8 +757,8 @@ void MyFrame::OnSetFaceName(wxCommandEvent& WXUNUSED(event))
{ {
wxString facename = m_fontWindow->GetTextFont().GetFaceName(); wxString facename = m_fontWindow->GetTextFont().GetFaceName();
wxString newFaceName = wxGetTextFromUser( wxString newFaceName = wxGetTextFromUser(
wxT("Here you can edit current font face name."), "Here you can edit current font face name.",
wxT("Input font facename"), facename, "Input font facename", facename,
this); this);
if (newFaceName.IsEmpty()) if (newFaceName.IsEmpty())
return; // user clicked "Cancel" - do nothing return; // user clicked "Cancel" - do nothing
@@ -763,14 +766,14 @@ void MyFrame::OnSetFaceName(wxCommandEvent& WXUNUSED(event))
wxFont font(m_fontWindow->GetTextFont()); wxFont font(m_fontWindow->GetTextFont());
if (font.SetFaceName(newFaceName)) // change facename only if (font.SetFaceName(newFaceName)) // change facename only
{ {
wxASSERT_MSG(font.IsOk(), wxT("The font should now be valid")); wxASSERT_MSG(font.IsOk(), "The font should now be valid");
DoChangeFont(font); DoChangeFont(font);
} }
else else
{ {
wxASSERT_MSG(!font.IsOk(), wxT("The font should now be invalid")); wxASSERT_MSG(!font.IsOk(), "The font should now be invalid");
wxMessageBox(wxT("There is no font with such face name..."), wxMessageBox("There is no font with such face name...",
wxT("Invalid face name"), wxOK|wxICON_ERROR, this); "Invalid face name", wxOK|wxICON_ERROR, this);
} }
} }
@@ -803,8 +806,8 @@ wxFontEncoding MyFrame::GetEncodingFromUser()
int i = wxGetSingleChoiceIndex int i = wxGetSingleChoiceIndex
( (
wxT("Choose the encoding"), "Choose the encoding",
SAMPLE_TITLE, SAMPLE_TITLE(),
names, names,
this this
); );
@@ -833,8 +836,8 @@ wxFontFamily MyFrame::GetFamilyFromUser()
int i = wxGetSingleChoiceIndex int i = wxGetSingleChoiceIndex
( (
wxT("Choose the family"), "Choose the family",
SAMPLE_TITLE, SAMPLE_TITLE(),
names, names,
this this
); );
@@ -920,7 +923,7 @@ void MyFrame::OnwxPointerFont(wxCommandEvent& event)
break; break;
default: default:
wxFAIL_MSG( wxT("unknown standard font") ); wxFAIL_MSG( "unknown standard font" );
return; return;
} }
@@ -963,7 +966,7 @@ void MyFrame::OnwxSystemSettingsFont(wxCommandEvent& event)
break; break;
default: default:
wxFAIL_MSG( wxT("unknown standard font") ); wxFAIL_MSG( "unknown standard font" );
return; return;
} }
@@ -1018,7 +1021,7 @@ void MyFrame::OnPrivateFont(wxCommandEvent& WXUNUSED(event))
wxFont font(m_fontWindow->GetTextFont()); wxFont font(m_fontWindow->GetTextFont());
if (font.SetFaceName("wxprivate")) if (font.SetFaceName("wxprivate"))
{ {
wxASSERT_MSG( font.IsOk(), wxT("The font should now be valid")) ; wxASSERT_MSG( font.IsOk(), "The font should now be valid") ;
DoChangeFont(font); DoChangeFont(font);
} }
else else
@@ -1039,7 +1042,7 @@ void MyFrame::OnTestTextValue(wxCommandEvent& WXUNUSED(event))
m_textctrl->SetValue(value); m_textctrl->SetValue(value);
if ( m_textctrl->GetValue() != value ) if ( m_textctrl->GetValue() != value )
{ {
wxLogError(wxT("Text value changed after getting and setting it")); wxLogError("Text value changed after getting and setting it");
} }
} }
@@ -1048,7 +1051,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
// first, choose the file // first, choose the file
static wxString s_dir, s_file; static wxString s_dir, s_file;
wxFileDialog dialog(this, wxT("Open an email message file"), wxFileDialog dialog(this, "Open an email message file",
s_dir, s_file); s_dir, s_file);
if ( dialog.ShowModal() != wxID_OK ) if ( dialog.ShowModal() != wxID_OK )
return; return;
@@ -1066,7 +1069,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
wxString charset; wxString charset;
static const wxChar *prefix = wxT("Content-Type: text/plain; charset="); wxString prefix = "Content-Type: text/plain; charset=";
const size_t len = wxStrlen(prefix); const size_t len = wxStrlen(prefix);
size_t n, count = file.GetLineCount(); size_t n, count = file.GetLineCount();
@@ -1099,7 +1102,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
if ( !charset ) if ( !charset )
{ {
wxLogError(wxT("The file '%s' doesn't contain charset information."), wxLogError("The file '%s' doesn't contain charset information.",
filename.c_str()); filename.c_str());
return; return;
@@ -1109,7 +1112,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
wxFontEncoding fontenc = wxFontMapper::Get()->CharsetToEncoding(charset); wxFontEncoding fontenc = wxFontMapper::Get()->CharsetToEncoding(charset);
if ( fontenc == wxFONTENCODING_SYSTEM ) if ( fontenc == wxFONTENCODING_SYSTEM )
{ {
wxLogError(wxT("Charset '%s' is unsupported."), charset.c_str()); wxLogError("Charset '%s' is unsupported.", charset.c_str());
return; return;
} }
@@ -1131,13 +1134,13 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
wxLogWarning(wxT("Cannot convert from '%s' to '%s'."), wxLogWarning("Cannot convert from '%s' to '%s'.",
wxFontMapper::GetEncodingDescription(fontenc).c_str(), wxFontMapper::GetEncodingDescription(fontenc).c_str(),
wxFontMapper::GetEncodingDescription(encAlt).c_str()); wxFontMapper::GetEncodingDescription(encAlt).c_str());
} }
} }
else else
wxLogWarning(wxT("No fonts for encoding '%s' on this system."), wxLogWarning("No fonts for encoding '%s' on this system.",
wxFontMapper::GetEncodingDescription(fontenc).c_str()); wxFontMapper::GetEncodingDescription(fontenc).c_str());
} }
@@ -1151,7 +1154,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
wxLogWarning(wxT("No fonts for encoding '%s' on this system."), wxLogWarning("No fonts for encoding '%s' on this system.",
wxFontMapper::GetEncodingDescription(fontenc).c_str()); wxFontMapper::GetEncodingDescription(fontenc).c_str());
} }
} }
@@ -1160,9 +1163,9 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("wxWidgets font sample\n") wxMessageBox("wxWidgets font sample\n"
wxT("(c) 1999-2006 Vadim Zeitlin"), "(c) 1999-2006 Vadim Zeitlin",
wxString(wxT("About ")) + SAMPLE_TITLE, wxString("About ") + SAMPLE_TITLE(),
wxOK | wxICON_INFORMATION, this); wxOK | wxICON_INFORMATION, this);
} }
@@ -1496,7 +1499,7 @@ void FontCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
// the size of one cell (Normally biggest char + small margin) // the size of one cell (Normally biggest char + small margin)
wxCoord maxCharWidth, maxCharHeight; wxCoord maxCharWidth, maxCharHeight;
dc.GetTextExtent(wxT("W"), &maxCharWidth, &maxCharHeight); dc.GetTextExtent("W", &maxCharWidth, &maxCharHeight);
int w = maxCharWidth + 5, int w = maxCharWidth + 5,
h = maxCharHeight + 4; h = maxCharHeight + 4;

View File

@@ -243,16 +243,16 @@ wxEND_EVENT_TABLE()
GridFrame::GridFrame() GridFrame::GridFrame()
: wxFrame( (wxFrame *)NULL, wxID_ANY, wxT("wxWidgets grid class demo"), : wxFrame( (wxFrame *)NULL, wxID_ANY, "wxWidgets grid class demo",
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize ) wxDefaultSize )
{ {
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
wxMenu *fileMenu = new wxMenu; wxMenu *fileMenu = new wxMenu;
fileMenu->Append( ID_VTABLE, wxT("&Virtual table test\tCtrl-V")); fileMenu->Append( ID_VTABLE, "&Virtual table test\tCtrl-V");
fileMenu->Append( ID_BUGS_TABLE, wxT("&Bugs table test\tCtrl-B")); fileMenu->Append( ID_BUGS_TABLE, "&Bugs table test\tCtrl-B");
fileMenu->Append( ID_TABULAR_TABLE, wxT("&Tabular table test\tCtrl-T")); fileMenu->Append( ID_TABULAR_TABLE, "&Tabular table test\tCtrl-T");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
wxMenu* setupMenu = new wxMenu; wxMenu* setupMenu = new wxMenu;
@@ -286,7 +286,7 @@ GridFrame::GridFrame()
fileMenu->Append( ID_RENDER_COORDS, "Render G5:P30" ); fileMenu->Append( ID_RENDER_COORDS, "Render G5:P30" );
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append( wxID_EXIT, wxT("E&xit\tAlt-X") ); fileMenu->Append( wxID_EXIT, "E&xit\tAlt-X" );
wxMenu *viewMenu = new wxMenu; wxMenu *viewMenu = new wxMenu;
viewMenu->AppendCheckItem(ID_TOGGLEROWLABELS, "&Row labels"); viewMenu->AppendCheckItem(ID_TOGGLEROWLABELS, "&Row labels");
@@ -309,41 +309,41 @@ GridFrame::GridFrame()
viewMenu->Append(ID_SHOWROW, "&Show row 2"); viewMenu->Append(ID_SHOWROW, "&Show row 2");
wxMenu *rowLabelMenu = new wxMenu; wxMenu *rowLabelMenu = new wxMenu;
viewMenu->Append( ID_ROWLABELALIGN, wxT("R&ow label alignment"), viewMenu->Append( ID_ROWLABELALIGN, "R&ow label alignment",
rowLabelMenu, rowLabelMenu,
wxT("Change alignment of row labels") ); "Change alignment of row labels" );
rowLabelMenu->AppendRadioItem( ID_ROWLABELHORIZALIGN, wxT("&Horizontal") ); rowLabelMenu->AppendRadioItem( ID_ROWLABELHORIZALIGN, "&Horizontal" );
rowLabelMenu->AppendRadioItem( ID_ROWLABELVERTALIGN, wxT("&Vertical") ); rowLabelMenu->AppendRadioItem( ID_ROWLABELVERTALIGN, "&Vertical" );
wxMenu *colLabelMenu = new wxMenu; wxMenu *colLabelMenu = new wxMenu;
viewMenu->Append( ID_COLLABELALIGN, wxT("Col l&abel alignment"), viewMenu->Append( ID_COLLABELALIGN, "Col l&abel alignment",
colLabelMenu, colLabelMenu,
wxT("Change alignment of col labels") ); "Change alignment of col labels" );
colLabelMenu->AppendRadioItem( ID_COLLABELHORIZALIGN, wxT("&Horizontal") ); colLabelMenu->AppendRadioItem( ID_COLLABELHORIZALIGN, "&Horizontal" );
colLabelMenu->AppendRadioItem( ID_COLLABELVERTALIGN, wxT("&Vertical") ); colLabelMenu->AppendRadioItem( ID_COLLABELVERTALIGN, "&Vertical" );
wxMenu *cornerLabelMenu = new wxMenu; wxMenu *cornerLabelMenu = new wxMenu;
viewMenu->Append( ID_CORNERLABELALIGN, wxT("Corner label alignment"), viewMenu->Append( ID_CORNERLABELALIGN, "Corner label alignment",
cornerLabelMenu, cornerLabelMenu,
wxT("Change alignment of corner label") ); "Change alignment of corner label" );
cornerLabelMenu->AppendRadioItem( ID_CORNERLABELHORIZALIGN, wxT("&Horizontal") ); cornerLabelMenu->AppendRadioItem( ID_CORNERLABELHORIZALIGN, "&Horizontal" );
cornerLabelMenu->AppendRadioItem( ID_CORNERLABELVERTALIGN, wxT("&Vertical") ); cornerLabelMenu->AppendRadioItem( ID_CORNERLABELVERTALIGN, "&Vertical" );
viewMenu->Append( ID_CORNERLABELORIENTATION, wxT("Toggle corner label orientation") ); viewMenu->Append( ID_CORNERLABELORIENTATION, "Toggle corner label orientation" );
wxMenu *colHeaderMenu = new wxMenu; wxMenu *colHeaderMenu = new wxMenu;
viewMenu->Append( ID_ROWLABELALIGN, wxT("Col header style"), viewMenu->Append( ID_ROWLABELALIGN, "Col header style",
colHeaderMenu, colHeaderMenu,
wxT("Change style of col header") ); "Change style of col header" );
colHeaderMenu->AppendRadioItem( ID_COLDEFAULTHEADER, wxT("&Default") ); colHeaderMenu->AppendRadioItem( ID_COLDEFAULTHEADER, "&Default" );
colHeaderMenu->AppendRadioItem( ID_COLNATIVEHEADER, wxT("&Native") ); colHeaderMenu->AppendRadioItem( ID_COLNATIVEHEADER, "&Native" );
colHeaderMenu->AppendRadioItem( ID_COLCUSTOMHEADER, wxT("&Custom") ); colHeaderMenu->AppendRadioItem( ID_COLCUSTOMHEADER, "&Custom" );
wxMenu *tabBehaviourMenu = new wxMenu; wxMenu *tabBehaviourMenu = new wxMenu;
tabBehaviourMenu->AppendRadioItem(ID_TAB_STOP, "&Stop at the boundary"); tabBehaviourMenu->AppendRadioItem(ID_TAB_STOP, "&Stop at the boundary");
@@ -353,67 +353,67 @@ GridFrame::GridFrame()
viewMenu->AppendSubMenu(tabBehaviourMenu, "&Tab behaviour"); viewMenu->AppendSubMenu(tabBehaviourMenu, "&Tab behaviour");
wxMenu *colMenu = new wxMenu; wxMenu *colMenu = new wxMenu;
colMenu->Append( ID_SETLABELCOLOUR, wxT("Set &label colour...") ); colMenu->Append( ID_SETLABELCOLOUR, "Set &label colour..." );
colMenu->Append( ID_SETLABELTEXTCOLOUR, wxT("Set label &text colour...") ); colMenu->Append( ID_SETLABELTEXTCOLOUR, "Set label &text colour..." );
colMenu->Append( ID_SETLABEL_FONT, wxT("Set label fo&nt...") ); colMenu->Append( ID_SETLABEL_FONT, "Set label fo&nt..." );
colMenu->Append( ID_GRIDLINECOLOUR, wxT("&Grid line colour...") ); colMenu->Append( ID_GRIDLINECOLOUR, "&Grid line colour..." );
colMenu->Append( ID_SET_CELL_FG_COLOUR, wxT("Set cell &foreground colour...") ); colMenu->Append( ID_SET_CELL_FG_COLOUR, "Set cell &foreground colour..." );
colMenu->Append( ID_SET_CELL_BG_COLOUR, wxT("Set cell &background colour...") ); colMenu->Append( ID_SET_CELL_BG_COLOUR, "Set cell &background colour..." );
wxMenu *editMenu = new wxMenu; wxMenu *editMenu = new wxMenu;
editMenu->Append( ID_INSERTROW, wxT("Insert &row") ); editMenu->Append( ID_INSERTROW, "Insert &row" );
editMenu->Append( ID_INSERTCOL, wxT("Insert &column") ); editMenu->Append( ID_INSERTCOL, "Insert &column" );
editMenu->Append( ID_DELETEROW, wxT("Delete selected ro&ws") ); editMenu->Append( ID_DELETEROW, "Delete selected ro&ws" );
editMenu->Append( ID_DELETECOL, wxT("Delete selected co&ls") ); editMenu->Append( ID_DELETECOL, "Delete selected co&ls" );
editMenu->Append( ID_CLEARGRID, wxT("Cl&ear grid cell contents") ); editMenu->Append( ID_CLEARGRID, "Cl&ear grid cell contents" );
editMenu->Append( ID_SETCORNERLABEL, wxT("&Set corner label...") ); editMenu->Append( ID_SETCORNERLABEL, "&Set corner label..." );
wxMenu *selectMenu = new wxMenu; wxMenu *selectMenu = new wxMenu;
selectMenu->Append( ID_SELECT_UNSELECT, wxT("Add new cells to the selection"), selectMenu->Append( ID_SELECT_UNSELECT, "Add new cells to the selection",
wxT("When off, old selection is deselected before ") "When off, old selection is deselected before "
wxT("selecting the new cells"), wxITEM_CHECK ); "selecting the new cells", wxITEM_CHECK );
selectMenu->AppendSeparator(); selectMenu->AppendSeparator();
selectMenu->Append( ID_SELECT_ALL, wxT("Select all")); selectMenu->Append( ID_SELECT_ALL, "Select all");
selectMenu->Append( ID_SELECT_ROW, wxT("Select row 2")); selectMenu->Append( ID_SELECT_ROW, "Select row 2");
selectMenu->Append( ID_SELECT_COL, wxT("Select col 2")); selectMenu->Append( ID_SELECT_COL, "Select col 2");
selectMenu->Append( ID_SELECT_CELL, wxT("Select cell (3, 1)")); selectMenu->Append( ID_SELECT_CELL, "Select cell (3, 1)");
selectMenu->AppendSeparator(); selectMenu->AppendSeparator();
selectMenu->Append( ID_DESELECT_ALL, wxT("Deselect all")); selectMenu->Append( ID_DESELECT_ALL, "Deselect all");
selectMenu->Append( ID_DESELECT_ROW, wxT("Deselect row 2")); selectMenu->Append( ID_DESELECT_ROW, "Deselect row 2");
selectMenu->Append( ID_DESELECT_COL, wxT("Deselect col 2")); selectMenu->Append( ID_DESELECT_COL, "Deselect col 2");
selectMenu->Append( ID_DESELECT_CELL, wxT("Deselect cell (3, 1)")); selectMenu->Append( ID_DESELECT_CELL, "Deselect cell (3, 1)");
selectMenu->AppendSeparator(); selectMenu->AppendSeparator();
wxMenu *selectionMenu = new wxMenu; wxMenu *selectionMenu = new wxMenu;
selectMenu->Append( ID_SHOWSEL, "&Show current selection\tCtrl-S" ); selectMenu->Append( ID_SHOWSEL, "&Show current selection\tCtrl-S" );
selectMenu->Append( ID_CHANGESEL, wxT("Change &selection mode"), selectMenu->Append( ID_CHANGESEL, "Change &selection mode",
selectionMenu, selectionMenu,
wxT("Change selection mode") ); "Change selection mode" );
selectionMenu->Append( ID_SELCELLS, wxT("Select &cells") ); selectionMenu->Append( ID_SELCELLS, "Select &cells" );
selectionMenu->Append( ID_SELROWS, wxT("Select &rows") ); selectionMenu->Append( ID_SELROWS, "Select &rows" );
selectionMenu->Append( ID_SELCOLS, wxT("Select col&umns") ); selectionMenu->Append( ID_SELCOLS, "Select col&umns" );
selectionMenu->Append( ID_SELROWSORCOLS, wxT("Select rows &or columns") ); selectionMenu->Append( ID_SELROWSORCOLS, "Select rows &or columns" );
wxMenu *autosizeMenu = new wxMenu; wxMenu *autosizeMenu = new wxMenu;
autosizeMenu->Append( ID_SIZE_ROW, wxT("Selected &row data") ); autosizeMenu->Append( ID_SIZE_ROW, "Selected &row data" );
autosizeMenu->Append( ID_SIZE_COL, wxT("Selected &column data") ); autosizeMenu->Append( ID_SIZE_COL, "Selected &column data" );
autosizeMenu->Append( ID_SIZE_ROW_LABEL, wxT("Selected row la&bel") ); autosizeMenu->Append( ID_SIZE_ROW_LABEL, "Selected row la&bel" );
autosizeMenu->Append( ID_SIZE_COL_LABEL, wxT("Selected column &label") ); autosizeMenu->Append( ID_SIZE_COL_LABEL, "Selected column &label" );
autosizeMenu->Append( ID_SIZE_LABELS_COL, wxT("Column la&bels") ); autosizeMenu->Append( ID_SIZE_LABELS_COL, "Column la&bels" );
autosizeMenu->Append( ID_SIZE_LABELS_ROW, wxT("Row label&s") ); autosizeMenu->Append( ID_SIZE_LABELS_ROW, "Row label&s" );
autosizeMenu->Append( ID_SIZE_GRID, wxT("Entire &grid") ); autosizeMenu->Append( ID_SIZE_GRID, "Entire &grid" );
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append( wxID_ABOUT, wxT("&About wxGrid demo") ); helpMenu->Append( wxID_ABOUT, "&About wxGrid demo" );
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( fileMenu, wxT("&File") ); menuBar->Append( fileMenu, "&File" );
menuBar->Append( viewMenu, wxT("&Grid") ); menuBar->Append( viewMenu, "&Grid" );
menuBar->Append( colMenu, wxT("&Colours") ); menuBar->Append( colMenu, "&Colours" );
menuBar->Append( editMenu, wxT("&Edit") ); menuBar->Append( editMenu, "&Edit" );
menuBar->Append( selectMenu, wxT("&Select") ); menuBar->Append( selectMenu, "&Select" );
menuBar->Append( autosizeMenu, wxT("&Autosize") ); menuBar->Append( autosizeMenu, "&Autosize" );
menuBar->Append( helpMenu, wxT("&Help") ); menuBar->Append( helpMenu, "&Help" );
SetMenuBar( menuBar ); SetMenuBar( menuBar );
@@ -455,55 +455,55 @@ GridFrame::GridFrame()
grid->AppendRows(ir); grid->AppendRows(ir);
grid->SetRowSize( 0, 60 ); grid->SetRowSize( 0, 60 );
grid->SetCellValue( 0, 0, wxT("Ctrl+Home\nwill go to\nthis cell") ); grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" );
grid->SetCellValue( 0, 1, wxT("A long piece of text to demonstrate wrapping.") ); grid->SetCellValue( 0, 1, "A long piece of text to demonstrate wrapping." );
grid->SetCellRenderer(0 , 1, new wxGridCellAutoWrapStringRenderer); grid->SetCellRenderer(0 , 1, new wxGridCellAutoWrapStringRenderer);
grid->SetCellEditor( 0, 1 , new wxGridCellAutoWrapStringEditor); grid->SetCellEditor( 0, 1 , new wxGridCellAutoWrapStringEditor);
grid->SetCellValue( 0, 2, wxT("Blah") ); grid->SetCellValue( 0, 2, "Blah" );
grid->SetCellValue( 0, 3, wxT("Read only") ); grid->SetCellValue( 0, 3, "Read only" );
grid->SetReadOnly( 0, 3 ); grid->SetReadOnly( 0, 3 );
grid->SetCellValue( 0, 4, wxT("Can veto edit this cell") ); grid->SetCellValue( 0, 4, "Can veto edit this cell" );
grid->SetColSize(10, 150); grid->SetColSize(10, 150);
wxString longtext = wxT("abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\n"); wxString longtext = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\n";
longtext += wxT("With tabs :\n"); longtext += "With tabs :\n";
longtext += wxT("Home,\t\thome\t\t\tagain\n"); longtext += "Home,\t\thome\t\t\tagain\n";
longtext += wxT("Long word at start :\n"); longtext += "Long word at start :\n";
longtext += wxT("ILikeToBeHereWhen I can\n"); longtext += "ILikeToBeHereWhen I can\n";
longtext += wxT("Long word in the middle :\n"); longtext += "Long word in the middle :\n";
longtext += wxT("When IComeHome,ColdAnd tired\n"); longtext += "When IComeHome,ColdAnd tired\n";
longtext += wxT("Long last word :\n"); longtext += "Long last word :\n";
longtext += wxT("It's GoodToWarmMyBonesBesideTheFire"); longtext += "It's GoodToWarmMyBonesBesideTheFire";
grid->SetCellValue( 0, 10, longtext ); grid->SetCellValue( 0, 10, longtext );
grid->SetCellRenderer(0 , 10, new wxGridCellAutoWrapStringRenderer); grid->SetCellRenderer(0 , 10, new wxGridCellAutoWrapStringRenderer);
grid->SetCellEditor( 0, 10 , new wxGridCellAutoWrapStringEditor); grid->SetCellEditor( 0, 10 , new wxGridCellAutoWrapStringEditor);
grid->SetCellValue( 0, 11, wxT("K1 cell editor blocker") ); grid->SetCellValue( 0, 11, "K1 cell editor blocker" );
grid->SetCellValue( 0, 5, wxT("Press\nCtrl+arrow\nto skip over\ncells") ); grid->SetCellValue( 0, 5, "Press\nCtrl+arrow\nto skip over\ncells" );
grid->SetRowSize( 99, 60 ); grid->SetRowSize( 99, 60 );
grid->SetCellValue(98, 98, "Test background colour setting"); grid->SetCellValue(98, 98, "Test background colour setting");
grid->SetCellBackgroundColour(98, 99, wxColour(255, 127, 127)); grid->SetCellBackgroundColour(98, 99, wxColour(255, 127, 127));
grid->SetCellBackgroundColour(99, 98, wxColour(255, 127, 127)); grid->SetCellBackgroundColour(99, 98, wxColour(255, 127, 127));
grid->SetCellValue( 99, 99, wxT("Ctrl+End\nwill go to\nthis cell") ); grid->SetCellValue( 99, 99, "Ctrl+End\nwill go to\nthis cell" );
grid->SetCellValue( 1, 0, wxT("This default cell will overflow into neighboring cells, but not if you turn overflow off.")); grid->SetCellValue( 1, 0, "This default cell will overflow into neighboring cells, but not if you turn overflow off.");
grid->SetCellTextColour(1, 2, *wxRED); grid->SetCellTextColour(1, 2, *wxRED);
grid->SetCellBackgroundColour(1, 2, *wxGREEN); grid->SetCellBackgroundColour(1, 2, *wxGREEN);
grid->SetCellValue( 1, 4, wxT("I'm in the middle")); grid->SetCellValue( 1, 4, "I'm in the middle");
grid->SetCellValue(2, 2, wxT("red")); grid->SetCellValue(2, 2, "red");
grid->SetCellTextColour(2, 2, *wxRED); grid->SetCellTextColour(2, 2, *wxRED);
grid->SetCellValue(3, 3, wxT("green on grey")); grid->SetCellValue(3, 3, "green on grey");
grid->SetCellTextColour(3, 3, *wxGREEN); grid->SetCellTextColour(3, 3, *wxGREEN);
grid->SetCellBackgroundColour(3, 3, *wxLIGHT_GREY); grid->SetCellBackgroundColour(3, 3, *wxLIGHT_GREY);
grid->SetCellValue(4, 4, wxT("a weird looking cell")); grid->SetCellValue(4, 4, "a weird looking cell");
grid->SetCellAlignment(4, 4, wxALIGN_CENTRE, wxALIGN_CENTRE); grid->SetCellAlignment(4, 4, wxALIGN_CENTRE, wxALIGN_CENTRE);
grid->SetCellRenderer(4, 4, new MyGridCellRenderer); grid->SetCellRenderer(4, 4, new MyGridCellRenderer);
@@ -519,33 +519,33 @@ GridFrame::GridFrame()
attr->SetBackgroundColour(*wxRED); attr->SetBackgroundColour(*wxRED);
grid->SetRowAttr(5, attr); grid->SetRowAttr(5, attr);
grid->SetCellValue(2, 4, wxT("a wider column")); grid->SetCellValue(2, 4, "a wider column");
grid->SetColSize(4, 120); grid->SetColSize(4, 120);
grid->SetColMinimalWidth(4, 120); grid->SetColMinimalWidth(4, 120);
grid->SetCellTextColour(5, 8, *wxGREEN); grid->SetCellTextColour(5, 8, *wxGREEN);
grid->SetCellValue(5, 8, wxT("Bg from row attr\nText col from cell attr")); grid->SetCellValue(5, 8, "Bg from row attr\nText col from cell attr");
grid->SetCellValue(5, 5, wxT("Bg from row attr Text col from col attr and this text is so long that it covers over many many empty cells but is broken by one that isn't")); grid->SetCellValue(5, 5, "Bg from row attr Text col from col attr and this text is so long that it covers over many many empty cells but is broken by one that isn't");
// Some numeric columns with different formatting. // Some numeric columns with different formatting.
grid->SetColFormatFloat(6); grid->SetColFormatFloat(6);
grid->SetCellValue(0, 6, "Default\nfloat format"); grid->SetCellValue(0, 6, "Default\nfloat format");
grid->SetCellValue(1, 6, wxString::Format(wxT("%g"), 3.1415)); grid->SetCellValue(1, 6, wxString::Format("%g", 3.1415));
grid->SetCellValue(2, 6, wxString::Format(wxT("%g"), 1415.0)); grid->SetCellValue(2, 6, wxString::Format("%g", 1415.0));
grid->SetCellValue(3, 6, wxString::Format(wxT("%g"), 12345.67890)); grid->SetCellValue(3, 6, wxString::Format("%g", 12345.67890));
grid->SetColFormatFloat(7, 6, 2); grid->SetColFormatFloat(7, 6, 2);
grid->SetCellValue(0, 7, "Width 6\nprecision 2"); grid->SetCellValue(0, 7, "Width 6\nprecision 2");
grid->SetCellValue(1, 7, wxString::Format(wxT("%g"), 3.1415)); grid->SetCellValue(1, 7, wxString::Format("%g", 3.1415));
grid->SetCellValue(2, 7, wxString::Format(wxT("%g"), 1415.0)); grid->SetCellValue(2, 7, wxString::Format("%g", 1415.0));
grid->SetCellValue(3, 7, wxString::Format(wxT("%g"), 12345.67890)); grid->SetCellValue(3, 7, wxString::Format("%g", 12345.67890));
grid->SetColFormatCustom(8, grid->SetColFormatCustom(8,
wxString::Format("%s:%i,%i,%s", wxGRID_VALUE_FLOAT, -1, 4, "g")); wxString::Format("%s:%i,%i,%s", wxGRID_VALUE_FLOAT, -1, 4, "g"));
grid->SetCellValue(0, 8, "Compact\nformat"); grid->SetCellValue(0, 8, "Compact\nformat");
grid->SetCellValue(1, 8, wxT("31415e-4")); grid->SetCellValue(1, 8, "31415e-4");
grid->SetCellValue(2, 8, wxT("1415")); grid->SetCellValue(2, 8, "1415");
grid->SetCellValue(3, 8, wxT("123456789e-4")); grid->SetCellValue(3, 8, "123456789e-4");
grid->SetColFormatNumber(9); grid->SetColFormatNumber(9);
grid->SetCellValue(0, 9, "Integer\ncolumn"); grid->SetCellValue(0, 9, "Integer\ncolumn");
@@ -557,9 +557,9 @@ GridFrame::GridFrame()
const wxString choices[] = const wxString choices[] =
{ {
wxT("Please select a choice"), "Please select a choice",
wxT("This takes two cells"), "This takes two cells",
wxT("Another choice"), "Another choice",
}; };
grid->SetCellEditor(4, 0, new wxGridCellChoiceEditor(WXSIZEOF(choices), choices)); grid->SetCellEditor(4, 0, new wxGridCellChoiceEditor(WXSIZEOF(choices), choices));
grid->SetCellSize(4, 0, 1, 2); grid->SetCellSize(4, 0, 1, 2);
@@ -568,7 +568,7 @@ GridFrame::GridFrame()
grid->SetCellSize(7, 1, 3, 4); grid->SetCellSize(7, 1, 3, 4);
grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE); grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE);
grid->SetCellValue(7, 1, wxT("Big box!")); grid->SetCellValue(7, 1, "Big box!");
// create a separator-like row: it's grey and it's non-resizable // create a separator-like row: it's grey and it's non-resizable
grid->DisableRowResize(10); grid->DisableRowResize(10);
@@ -755,10 +755,10 @@ void GridFrame::ToggleGridLines( wxCommandEvent& WXUNUSED(ev) )
void GridFrame::OnSetHighlightWidth( wxCommandEvent& WXUNUSED(ev) ) void GridFrame::OnSetHighlightWidth( wxCommandEvent& WXUNUSED(ev) )
{ {
wxString choices[] = { wxT("0"), wxT("1"), wxT("2"), wxT("3"), wxT("4"), wxT("5"), wxT("6"), wxT("7"), wxT("8"), wxT("9"), wxT("10")}; wxString choices[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
wxSingleChoiceDialog dlg(this, wxT("Choose the thickness of the highlight pen:"), wxSingleChoiceDialog dlg(this, "Choose the thickness of the highlight pen:",
wxT("Pen Width"), 11, choices); "Pen Width", 11, choices);
int current = grid->GetCellHighlightPenWidth(); int current = grid->GetCellHighlightPenWidth();
dlg.SetSelection(current); dlg.SetSelection(current);
@@ -769,10 +769,10 @@ void GridFrame::OnSetHighlightWidth( wxCommandEvent& WXUNUSED(ev) )
void GridFrame::OnSetROHighlightWidth( wxCommandEvent& WXUNUSED(ev) ) void GridFrame::OnSetROHighlightWidth( wxCommandEvent& WXUNUSED(ev) )
{ {
wxString choices[] = { wxT("0"), wxT("1"), wxT("2"), wxT("3"), wxT("4"), wxT("5"), wxT("6"), wxT("7"), wxT("8"), wxT("9"), wxT("10")}; wxString choices[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
wxSingleChoiceDialog dlg(this, wxT("Choose the thickness of the highlight pen:"), wxSingleChoiceDialog dlg(this, "Choose the thickness of the highlight pen:",
wxT("Pen Width"), 11, choices); "Pen Width", 11, choices);
int current = grid->GetCellHighlightROPenWidth(); int current = grid->GetCellHighlightROPenWidth();
dlg.SetSelection(current); dlg.SetSelection(current);
@@ -1260,22 +1260,22 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
wxString logBuf; wxString logBuf;
if ( ev.GetRow() != -1 ) if ( ev.GetRow() != -1 )
{ {
logBuf << wxT("Left click on row label ") << ev.GetRow(); logBuf << "Left click on row label " << ev.GetRow();
} }
else if ( ev.GetCol() != -1 ) else if ( ev.GetCol() != -1 )
{ {
logBuf << wxT("Left click on col label ") << ev.GetCol(); logBuf << "Left click on col label " << ev.GetCol();
} }
else else
{ {
logBuf << wxT("Left click on corner label"); logBuf << "Left click on corner label";
} }
if ( ev.ShiftDown() ) if ( ev.ShiftDown() )
logBuf << wxT(" (shift down)"); logBuf << " (shift down)";
if ( ev.ControlDown() ) if ( ev.ControlDown() )
logBuf << wxT(" (control down)"); logBuf << " (control down)";
wxLogMessage( wxT("%s"), logBuf.c_str() ); wxLogMessage( "%s", logBuf.c_str() );
// you must call event skip if you want default grid processing // you must call event skip if you want default grid processing
// //
@@ -1285,7 +1285,7 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
void GridFrame::OnCellLeftClick( wxGridEvent& ev ) void GridFrame::OnCellLeftClick( wxGridEvent& ev )
{ {
wxLogMessage(wxT("Left click at row %d, col %d"), ev.GetRow(), ev.GetCol()); wxLogMessage("Left click at row %d, col %d", ev.GetRow(), ev.GetCol());
// you must call event skip if you want default grid processing // you must call event skip if you want default grid processing
// (cell highlighting etc.) // (cell highlighting etc.)
@@ -1335,21 +1335,21 @@ void GridFrame::OnSelectCell( wxGridEvent& ev )
{ {
wxString logBuf; wxString logBuf;
if ( ev.Selecting() ) if ( ev.Selecting() )
logBuf << wxT("Selected "); logBuf << "Selected ";
else else
logBuf << wxT("Deselected "); logBuf << "Deselected ";
logBuf << wxT("cell at row ") << ev.GetRow() logBuf << "cell at row " << ev.GetRow()
<< wxT(" col ") << ev.GetCol() << " col " << ev.GetCol()
<< wxT(" ( ControlDown: ")<< (ev.ControlDown() ? 'T':'F') << " ( ControlDown: "<< (ev.ControlDown() ? 'T':'F')
<< wxT(", ShiftDown: ")<< (ev.ShiftDown() ? 'T':'F') << ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F')
<< wxT(", AltDown: ")<< (ev.AltDown() ? 'T':'F') << ", AltDown: "<< (ev.AltDown() ? 'T':'F')
<< wxT(", MetaDown: ")<< (ev.MetaDown() ? 'T':'F') << wxT(" )"); << ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )";
//Indicate whether this column was moved //Indicate whether this column was moved
if ( ((wxGrid *)ev.GetEventObject())->GetColPos( ev.GetCol() ) != ev.GetCol() ) if ( ((wxGrid *)ev.GetEventObject())->GetColPos( ev.GetCol() ) != ev.GetCol() )
logBuf << wxT(" *** Column moved, current position: ") << ((wxGrid *)ev.GetEventObject())->GetColPos( ev.GetCol() ); logBuf << " *** Column moved, current position: " << ((wxGrid *)ev.GetEventObject())->GetColPos( ev.GetCol() );
wxLogMessage( wxT("%s"), logBuf.c_str() ); wxLogMessage( "%s", logBuf.c_str() );
// you must call Skip() if you want the default processing // you must call Skip() if you want the default processing
// to occur in wxGrid // to occur in wxGrid
@@ -1360,18 +1360,18 @@ void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev )
{ {
wxString logBuf; wxString logBuf;
if ( ev.Selecting() ) if ( ev.Selecting() )
logBuf << wxT("Selected "); logBuf << "Selected ";
else else
logBuf << wxT("Deselected "); logBuf << "Deselected ";
logBuf << wxT("cells from row ") << ev.GetTopRow() logBuf << "cells from row " << ev.GetTopRow()
<< wxT(" col ") << ev.GetLeftCol() << " col " << ev.GetLeftCol()
<< wxT(" to row ") << ev.GetBottomRow() << " to row " << ev.GetBottomRow()
<< wxT(" col ") << ev.GetRightCol() << " col " << ev.GetRightCol()
<< wxT(" ( ControlDown: ")<< (ev.ControlDown() ? 'T':'F') << " ( ControlDown: "<< (ev.ControlDown() ? 'T':'F')
<< wxT(", ShiftDown: ")<< (ev.ShiftDown() ? 'T':'F') << ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F')
<< wxT(", AltDown: ")<< (ev.AltDown() ? 'T':'F') << ", AltDown: "<< (ev.AltDown() ? 'T':'F')
<< wxT(", MetaDown: ")<< (ev.MetaDown() ? 'T':'F') << wxT(" )"); << ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )";
wxLogMessage( wxT("%s"), logBuf.c_str() ); wxLogMessage( "%s", logBuf.c_str() );
ev.Skip(); ev.Skip();
} }
@@ -1412,7 +1412,7 @@ void GridFrame::OnCellValueChanged( wxGridEvent& ev )
void GridFrame::OnCellBeginDrag( wxGridEvent& ev ) void GridFrame::OnCellBeginDrag( wxGridEvent& ev )
{ {
wxLogMessage(wxT("Got request to drag cell at row %d, col %d"), wxLogMessage("Got request to drag cell at row %d, col %d",
ev.GetRow(), ev.GetCol()); ev.GetRow(), ev.GetCol());
ev.Skip(); ev.Skip();
@@ -1423,14 +1423,14 @@ void GridFrame::OnEditorShown( wxGridEvent& ev )
if ( (ev.GetCol() == 4) && if ( (ev.GetCol() == 4) &&
(ev.GetRow() == 0) && (ev.GetRow() == 0) &&
(wxMessageBox(wxT("Are you sure you wish to edit this cell"), (wxMessageBox("Are you sure you wish to edit this cell",
wxT("Checking"),wxYES_NO) == wxNO ) ) { "Checking",wxYES_NO) == wxNO ) ) {
ev.Veto(); ev.Veto();
return; return;
} }
wxLogMessage( wxT("Cell editor shown.") ); wxLogMessage( "Cell editor shown." );
ev.Skip(); ev.Skip();
} }
@@ -1440,14 +1440,14 @@ void GridFrame::OnEditorHidden( wxGridEvent& ev )
if ( (ev.GetCol() == 4) && if ( (ev.GetCol() == 4) &&
(ev.GetRow() == 0) && (ev.GetRow() == 0) &&
(wxMessageBox(wxT("Are you sure you wish to finish editing this cell"), (wxMessageBox("Are you sure you wish to finish editing this cell",
wxT("Checking"),wxYES_NO) == wxNO ) ) { "Checking",wxYES_NO) == wxNO ) ) {
ev.Veto(); ev.Veto();
return; return;
} }
wxLogMessage( wxT("Cell editor hidden.") ); wxLogMessage( "Cell editor hidden." );
ev.Skip(); ev.Skip();
} }
@@ -1455,18 +1455,18 @@ void GridFrame::OnEditorHidden( wxGridEvent& ev )
void GridFrame::About( wxCommandEvent& WXUNUSED(ev) ) void GridFrame::About( wxCommandEvent& WXUNUSED(ev) )
{ {
wxAboutDialogInfo aboutInfo; wxAboutDialogInfo aboutInfo;
aboutInfo.SetName(wxT("wxGrid demo")); aboutInfo.SetName("wxGrid demo");
aboutInfo.SetDescription(_("wxGrid sample program")); aboutInfo.SetDescription(_("wxGrid sample program"));
aboutInfo.AddDeveloper(wxT("Michael Bedward")); aboutInfo.AddDeveloper("Michael Bedward");
aboutInfo.AddDeveloper(wxT("Julian Smart")); aboutInfo.AddDeveloper("Julian Smart");
aboutInfo.AddDeveloper(wxT("Vadim Zeitlin")); aboutInfo.AddDeveloper("Vadim Zeitlin");
// this is just to force the generic version of the about // this is just to force the generic version of the about
// dialog under wxMSW so that it's easy to test if the grid // dialog under wxMSW so that it's easy to test if the grid
// repaints correctly when it has lost focus and a dialog // repaints correctly when it has lost focus and a dialog
// (different from the Windows standard message box -- it doesn't // (different from the Windows standard message box -- it doesn't
// work with it for some reason) is moved over it. // work with it for some reason) is moved over it.
aboutInfo.SetWebSite(wxT("http://www.wxwidgets.org")); aboutInfo.SetWebSite("http://www.wxwidgets.org");
wxAboutBox(aboutInfo, this); wxAboutBox(aboutInfo, this);
} }
@@ -1529,9 +1529,9 @@ void GridFrame::OnVTable(wxCommandEvent& )
{ {
static long s_sizeGrid = 10000; static long s_sizeGrid = 10000;
s_sizeGrid = wxGetNumberFromUser(wxT("Size of the table to create"), s_sizeGrid = wxGetNumberFromUser("Size of the table to create",
wxT("Size: "), "Size: ",
wxT("wxGridDemo question"), "wxGridDemo question",
s_sizeGrid, s_sizeGrid,
0, 32000, this); 0, 32000, this);
@@ -1568,7 +1568,7 @@ void MyGridCellRenderer::Draw(wxGrid& grid,
// ============================================================================ // ============================================================================
BigGridFrame::BigGridFrame(long sizeGrid) BigGridFrame::BigGridFrame(long sizeGrid)
: wxFrame(NULL, wxID_ANY, wxT("Plugin Virtual Table"), : wxFrame(NULL, wxID_ANY, "Plugin Virtual Table",
wxDefaultPosition, wxSize(500, 450)) wxDefaultPosition, wxSize(500, 450))
{ {
m_grid = new wxGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); m_grid = new wxGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
@@ -1619,37 +1619,27 @@ enum Severity
static const wxString severities[] = static const wxString severities[] =
{ {
wxT("wishlist"), "wishlist",
wxT("minor"), "minor",
wxT("normal"), "normal",
wxT("major"), "major",
wxT("critical"), "critical",
}; };
static struct BugsGridData static struct BugsGridData
{ {
int id; int id;
wxChar summary[80]; wxString summary;
Severity severity; Severity severity;
int prio; int prio;
wxChar platform[12]; wxString platform;
bool opened; bool opened;
} gs_dataBugsGrid [] = } gs_dataBugsGrid [] =
{ {
{ 18, wxT("foo doesn't work"), Sev_Major, 1, wxT("wxMSW"), true }, { 18, "foo doesn't work", Sev_Major, 1, "wxMSW", true },
{ 27, wxT("bar crashes"), Sev_Critical, 1, wxT("all"), false }, { 27, "bar crashes", Sev_Critical, 1, "all", false },
{ 45, wxT("printing is slow"), Sev_Minor, 3, wxT("wxMSW"), true }, { 45, "printing is slow", Sev_Minor, 3, "wxMSW", true },
{ 68, wxT("Rectangle() fails"), Sev_Normal, 1, wxT("wxMSW"), false }, { 68, "Rectangle() fails", Sev_Normal, 1, "wxMSW", false },
};
static const wxChar *headers[Col_Max] =
{
wxT("Id"),
wxT("Summary"),
wxT("Severity"),
wxT("Priority"),
wxT("Platform"),
wxT("Opened?"),
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1668,16 +1658,16 @@ wxString BugsGridTable::GetTypeName(int WXUNUSED(row), int col)
// fall thorugh (TODO should be a list) // fall thorugh (TODO should be a list)
case Col_Summary: case Col_Summary:
return wxString::Format(wxT("%s:80"), wxGRID_VALUE_STRING); return wxString::Format("%s:80", wxGRID_VALUE_STRING);
case Col_Platform: case Col_Platform:
return wxString::Format(wxT("%s:all,MSW,GTK,other"), wxGRID_VALUE_CHOICE); return wxString::Format("%s:all,MSW,GTK,other", wxGRID_VALUE_CHOICE);
case Col_Opened: case Col_Opened:
return wxGRID_VALUE_BOOL; return wxGRID_VALUE_BOOL;
} }
wxFAIL_MSG(wxT("unknown column")); wxFAIL_MSG("unknown column");
return wxEmptyString; return wxEmptyString;
} }
@@ -1704,13 +1694,13 @@ wxString BugsGridTable::GetValue( int row, int col )
switch ( col ) switch ( col )
{ {
case Col_Id: case Col_Id:
return wxString::Format(wxT("%d"), gd.id); return wxString::Format("%d", gd.id);
case Col_Priority: case Col_Priority:
return wxString::Format(wxT("%d"), gd.prio); return wxString::Format("%d", gd.prio);
case Col_Opened: case Col_Opened:
return gd.opened ? wxT("1") : wxT("0"); return gd.opened ? "1" : "0";
case Col_Severity: case Col_Severity:
return severities[gd.severity]; return severities[gd.severity];
@@ -1734,7 +1724,7 @@ void BugsGridTable::SetValue( int row, int col, const wxString& value )
case Col_Id: case Col_Id:
case Col_Priority: case Col_Priority:
case Col_Opened: case Col_Opened:
wxFAIL_MSG(wxT("unexpected column")); wxFAIL_MSG("unexpected column");
break; break;
case Col_Severity: case Col_Severity:
@@ -1751,7 +1741,7 @@ void BugsGridTable::SetValue( int row, int col, const wxString& value )
if ( n == WXSIZEOF(severities) ) if ( n == WXSIZEOF(severities) )
{ {
wxLogWarning(wxT("Invalid severity value '%s'."), wxLogWarning("Invalid severity value '%s'.",
value.c_str()); value.c_str());
gd.severity = Sev_Normal; gd.severity = Sev_Normal;
} }
@@ -1759,11 +1749,11 @@ void BugsGridTable::SetValue( int row, int col, const wxString& value )
break; break;
case Col_Summary: case Col_Summary:
wxStrncpy(gd.summary, value, WXSIZEOF(gd.summary)); gd.summary = value;
break; break;
case Col_Platform: case Col_Platform:
wxStrncpy(gd.platform, value, WXSIZEOF(gd.platform)); gd.platform = value;
break; break;
} }
} }
@@ -1812,7 +1802,7 @@ long BugsGridTable::GetValueAsLong( int row, int col )
return gd.severity; return gd.severity;
default: default:
wxFAIL_MSG(wxT("unexpected column")); wxFAIL_MSG("unexpected column");
return -1; return -1;
} }
} }
@@ -1825,7 +1815,7 @@ bool BugsGridTable::GetValueAsBool( int row, int col )
} }
else else
{ {
wxFAIL_MSG(wxT("unexpected column")); wxFAIL_MSG("unexpected column");
return false; return false;
} }
@@ -1842,7 +1832,7 @@ void BugsGridTable::SetValueAsLong( int row, int col, long value )
break; break;
default: default:
wxFAIL_MSG(wxT("unexpected column")); wxFAIL_MSG("unexpected column");
} }
} }
@@ -1854,12 +1844,19 @@ void BugsGridTable::SetValueAsBool( int row, int col, bool value )
} }
else else
{ {
wxFAIL_MSG(wxT("unexpected column")); wxFAIL_MSG("unexpected column");
} }
} }
wxString BugsGridTable::GetColLabelValue( int col ) wxString BugsGridTable::GetColLabelValue( int col )
{ {
static wxArrayString headers;
headers.push_back("Id");
headers.push_back("Summary");
headers.push_back("Severity");
headers.push_back("Priority");
headers.push_back("Platform");
headers.push_back("Opened?");
return headers[col]; return headers[col];
} }
@@ -1868,7 +1865,7 @@ wxString BugsGridTable::GetColLabelValue( int col )
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
BugsGridFrame::BugsGridFrame() BugsGridFrame::BugsGridFrame()
: wxFrame(NULL, wxID_ANY, wxT("Bugs table")) : wxFrame(NULL, wxID_ANY, "Bugs table")
{ {
wxGrid *grid = new wxGrid(this, wxID_ANY); wxGrid *grid = new wxGrid(this, wxID_ANY);
wxGridTableBase *table = new BugsGridTable(); wxGridTableBase *table = new BugsGridTable();

View File

@@ -256,7 +256,7 @@ public:
int GetNumberCols() wxOVERRIDE { return m_sizeGrid; } int GetNumberCols() wxOVERRIDE { return m_sizeGrid; }
wxString GetValue( int row, int col ) wxOVERRIDE wxString GetValue( int row, int col ) wxOVERRIDE
{ {
return wxString::Format(wxT("(%d, %d)"), row, col); return wxString::Format("(%d, %d)", row, col);
} }
void SetValue( int , int , const wxString& ) wxOVERRIDE { /* ignore */ } void SetValue( int , int , const wxString& ) wxOVERRIDE { /* ignore */ }

View File

@@ -311,7 +311,7 @@ bool MyApp::OnInit()
#endif // wxUSE_HTML #endif // wxUSE_HTML
// Create the main application window // Create the main application window
MyFrame *frame = new MyFrame(wxT("HelpDemo wxWidgets App"), MyFrame *frame = new MyFrame("HelpDemo wxWidgets App",
wxPoint(50, 50), wxSize(450, 340)); wxPoint(50, 50), wxSize(450, 340));
#if !USE_SIMPLE_HELP_PROVIDER #if !USE_SIMPLE_HELP_PROVIDER
@@ -327,34 +327,34 @@ bool MyApp::OnInit()
// initialise the help system: this means that we'll use doc.hlp file under // initialise the help system: this means that we'll use doc.hlp file under
// Windows and that the HTML docs are in the subdirectory doc for platforms // Windows and that the HTML docs are in the subdirectory doc for platforms
// using HTML help // using HTML help
if ( !frame->GetHelpController().Initialize(wxT("doc")) ) if ( !frame->GetHelpController().Initialize("doc") )
{ {
wxLogError(wxT("Cannot initialize the help system, aborting.")); wxLogError("Cannot initialize the help system, aborting.");
return false; return false;
} }
#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__) #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
if( !frame->GetMSHtmlHelpController().Initialize(wxT("doc")) ) if( !frame->GetMSHtmlHelpController().Initialize("doc") )
{ {
wxLogError(wxT("Cannot initialize the MS HTML Help system.")); wxLogError("Cannot initialize the MS HTML Help system.");
} }
#endif #endif
#if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__) #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
// you need to call Initialize in order to use wxBestHelpController // you need to call Initialize in order to use wxBestHelpController
if( !frame->GetBestHelpController().Initialize(wxT("doc")) ) if( !frame->GetBestHelpController().Initialize("doc") )
{ {
wxLogError(wxT("Cannot initialize the best help system, aborting.")); wxLogError("Cannot initialize the best help system, aborting.");
} }
#endif #endif
#if USE_HTML_HELP #if USE_HTML_HELP
// initialise the advanced HTML help system: this means that the HTML docs are in .htb // initialise the advanced HTML help system: this means that the HTML docs are in .htb
// (zipped) form // (zipped) form
if ( !frame->GetAdvancedHtmlHelpController().Initialize(wxT("doc")) ) if ( !frame->GetAdvancedHtmlHelpController().Initialize("doc") )
{ {
wxLogError(wxT("Cannot initialize the advanced HTML help system, aborting.")); wxLogError("Cannot initialize the advanced HTML help system, aborting.");
return false; return false;
} }
@@ -363,7 +363,7 @@ bool MyApp::OnInit()
#if 0 #if 0
// defined(__WXMSW__) && wxUSE_MS_HTML_HELP // defined(__WXMSW__) && wxUSE_MS_HTML_HELP
wxString path(wxGetCwd()); wxString path(wxGetCwd());
if ( !frame->GetMSHtmlHelpController().Initialize(path + wxT("\\doc.chm")) ) if ( !frame->GetMSHtmlHelpController().Initialize(path + "\\doc.chm") )
{ {
wxLogError("Cannot initialize the MS HTML help system, aborting."); wxLogError("Cannot initialize the MS HTML help system, aborting.");
@@ -399,51 +399,51 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(HelpDemo_Help_Index, wxT("&Help Index...")); menuFile->Append(HelpDemo_Help_Index, "&Help Index...");
menuFile->Append(HelpDemo_Help_Classes, wxT("&Help on Classes...")); menuFile->Append(HelpDemo_Help_Classes, "&Help on Classes...");
menuFile->Append(HelpDemo_Help_Functions, wxT("&Help on Functions...")); menuFile->Append(HelpDemo_Help_Functions, "&Help on Functions...");
menuFile->Append(HelpDemo_Help_ContextHelp, wxT("&Context Help...")); menuFile->Append(HelpDemo_Help_ContextHelp, "&Context Help...");
menuFile->Append(HelpDemo_Help_DialogContextHelp, wxT("&Dialog Context Help...\tCtrl-H")); menuFile->Append(HelpDemo_Help_DialogContextHelp, "&Dialog Context Help...\tCtrl-H");
menuFile->Append(HelpDemo_Help_Help, wxT("&About Help Demo...")); menuFile->Append(HelpDemo_Help_Help, "&About Help Demo...");
menuFile->Append(HelpDemo_Help_Search, wxT("&Search help...")); menuFile->Append(HelpDemo_Help_Search, "&Search help...");
#if USE_HTML_HELP #if USE_HTML_HELP
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(HelpDemo_Advanced_Html_Help_Index, wxT("Advanced HTML &Help Index...")); menuFile->Append(HelpDemo_Advanced_Html_Help_Index, "Advanced HTML &Help Index...");
menuFile->Append(HelpDemo_Advanced_Html_Help_Classes, wxT("Advanced HTML &Help on Classes...")); menuFile->Append(HelpDemo_Advanced_Html_Help_Classes, "Advanced HTML &Help on Classes...");
menuFile->Append(HelpDemo_Advanced_Html_Help_Functions, wxT("Advanced HTML &Help on Functions...")); menuFile->Append(HelpDemo_Advanced_Html_Help_Functions, "Advanced HTML &Help on Functions...");
menuFile->Append(HelpDemo_Advanced_Html_Help_Help, wxT("Advanced HTML &About Help Demo...")); menuFile->Append(HelpDemo_Advanced_Html_Help_Help, "Advanced HTML &About Help Demo...");
menuFile->Append(HelpDemo_Advanced_Html_Help_Search, wxT("Advanced HTML &Search help...")); menuFile->Append(HelpDemo_Advanced_Html_Help_Search, "Advanced HTML &Search help...");
menuFile->Append(HelpDemo_Advanced_Html_Help_Modal, wxT("Advanced HTML Help &Modal Dialog...")); menuFile->Append(HelpDemo_Advanced_Html_Help_Modal, "Advanced HTML Help &Modal Dialog...");
#endif #endif
#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__) #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(HelpDemo_MS_Html_Help_Index, wxT("MS HTML &Help Index...")); menuFile->Append(HelpDemo_MS_Html_Help_Index, "MS HTML &Help Index...");
menuFile->Append(HelpDemo_MS_Html_Help_Classes, wxT("MS HTML &Help on Classes...")); menuFile->Append(HelpDemo_MS_Html_Help_Classes, "MS HTML &Help on Classes...");
menuFile->Append(HelpDemo_MS_Html_Help_Functions, wxT("MS HTML &Help on Functions...")); menuFile->Append(HelpDemo_MS_Html_Help_Functions, "MS HTML &Help on Functions...");
menuFile->Append(HelpDemo_MS_Html_Help_Help, wxT("MS HTML &About Help Demo...")); menuFile->Append(HelpDemo_MS_Html_Help_Help, "MS HTML &About Help Demo...");
menuFile->Append(HelpDemo_MS_Html_Help_Search, wxT("MS HTML &Search help...")); menuFile->Append(HelpDemo_MS_Html_Help_Search, "MS HTML &Search help...");
#endif #endif
#if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__) #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(HelpDemo_Best_Help_Index, wxT("Best &Help Index...")); menuFile->Append(HelpDemo_Best_Help_Index, "Best &Help Index...");
#endif #endif
#ifndef __WXMSW__ #ifndef __WXMSW__
#if !wxUSE_HTML #if !wxUSE_HTML
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(HelpDemo_Help_KDE, wxT("Use &KDE")); menuFile->Append(HelpDemo_Help_KDE, "Use &KDE");
menuFile->Append(HelpDemo_Help_GNOME, wxT("Use &GNOME")); menuFile->Append(HelpDemo_Help_GNOME, "Use &GNOME");
menuFile->Append(HelpDemo_Help_Netscape, wxT("Use &Netscape")); menuFile->Append(HelpDemo_Help_Netscape, "Use &Netscape");
#endif #endif
#endif #endif
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(HelpDemo_Quit, wxT("E&xit")); menuFile->Append(HelpDemo_Quit, "E&xit");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -451,7 +451,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(); CreateStatusBar();
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
#if USE_HTML_HELP #if USE_HTML_HELP
@@ -463,8 +463,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
m_embeddedHelpWindow->Create(this, m_embeddedHelpWindow->Create(this,
wxID_ANY, wxDefaultPosition, GetClientSize(), wxTAB_TRAVERSAL|wxNO_BORDER, wxHF_DEFAULT_STYLE); wxID_ANY, wxDefaultPosition, GetClientSize(), wxTAB_TRAVERSAL|wxNO_BORDER, wxHF_DEFAULT_STYLE);
m_embeddedHtmlHelp.AddBook(wxFileName(wxT("doc.zip"))); m_embeddedHtmlHelp.AddBook(wxFileName("doc.zip"));
m_embeddedHtmlHelp.Display(wxT("Introduction")); m_embeddedHtmlHelp.Display("Introduction");
#else #else
// now create some controls // now create some controls
@@ -475,7 +475,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
//panel->SetHelpText(wxContextId(300)); //panel->SetHelpText(wxContextId(300));
// and a static control whose parent is the panel // and a static control whose parent is the panel
wxStaticText* staticText = new wxStaticText(panel, 302, wxT("Hello, world!"), wxPoint(10, 10)); wxStaticText* staticText = new wxStaticText(panel, 302, "Hello, world!", wxPoint(10, 10));
staticText->SetHelpText(_("This static text control isn't doing a lot right now.")); staticText->SetHelpText(_("This static text control isn't doing a lot right now."));
#endif #endif
} }
@@ -531,7 +531,7 @@ void MyFrame::OnBestHelp(wxCommandEvent& event)
#if USE_HTML_HELP #if USE_HTML_HELP
void MyFrame::OnModalHtmlHelp(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnModalHtmlHelp(wxCommandEvent& WXUNUSED(event))
{ {
wxHtmlModalHelp(this, wxT("doc.zip"), wxT("Introduction")); wxHtmlModalHelp(this, "doc.zip", "Introduction");
} }
#endif #endif
@@ -638,8 +638,8 @@ void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController)
case HelpDemo_MS_Html_Help_Search: case HelpDemo_MS_Html_Help_Search:
case HelpDemo_Best_Help_Search: case HelpDemo_Best_Help_Search:
{ {
wxString key = wxGetTextFromUser(wxT("Search for?"), wxString key = wxGetTextFromUser("Search for?",
wxT("Search help for keyword"), "Search help for keyword",
wxEmptyString, wxEmptyString,
this); this);
if(! key.IsEmpty()) if(! key.IsEmpty())
@@ -658,13 +658,13 @@ void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController)
// These three calls are only used by wxExtHelpController // These three calls are only used by wxExtHelpController
case HelpDemo_Help_KDE: case HelpDemo_Help_KDE:
helpController.SetViewer(wxT("kdehelp")); helpController.SetViewer("kdehelp");
break; break;
case HelpDemo_Help_GNOME: case HelpDemo_Help_GNOME:
helpController.SetViewer(wxT("gnome-help-browser")); helpController.SetViewer("gnome-help-browser");
break; break;
case HelpDemo_Help_Netscape: case HelpDemo_Help_Netscape:
helpController.SetViewer(wxT("netscape"), wxHELP_NETSCAPE); helpController.SetViewer("netscape", wxHELP_NETSCAPE);
break; break;
} }
} }
@@ -678,7 +678,7 @@ wxBEGIN_EVENT_TABLE(MyModalDialog, wxDialog)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyModalDialog::MyModalDialog(wxWindow *parent) MyModalDialog::MyModalDialog(wxWindow *parent)
: wxDialog(parent, wxID_ANY, wxString(wxT("Modal dialog"))) : wxDialog(parent, wxID_ANY, wxString("Modal dialog"))
{ {
// Add the context-sensitive help button on the caption for the platforms // Add the context-sensitive help button on the caption for the platforms
// which support it (currently MSW only) // which support it (currently MSW only)
@@ -688,10 +688,10 @@ MyModalDialog::MyModalDialog(wxWindow *parent)
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
wxButton* btnOK = new wxButton(this, wxID_OK, wxT("&OK")); wxButton* btnOK = new wxButton(this, wxID_OK, "&OK");
btnOK->SetHelpText(_("The OK button confirms the dialog choices.")); btnOK->SetHelpText(_("The OK button confirms the dialog choices."));
wxButton* btnCancel = new wxButton(this, wxID_CANCEL, wxT("&Cancel")); wxButton* btnCancel = new wxButton(this, wxID_CANCEL, "&Cancel");
btnCancel->SetHelpText(_("The Cancel button cancels the dialog.")); btnCancel->SetHelpText(_("The Cancel button cancels the dialog."));
sizerRow->Add(btnOK, 0, wxALIGN_CENTER | wxALL, 5); sizerRow->Add(btnOK, 0, wxALIGN_CENTER | wxALL, 5);
@@ -702,7 +702,7 @@ MyModalDialog::MyModalDialog(wxWindow *parent)
sizerRow->Add(new wxContextHelpButton(this), 0, wxALIGN_CENTER | wxALL, 5); sizerRow->Add(new wxContextHelpButton(this), 0, wxALIGN_CENTER | wxALL, 5);
#endif #endif
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxT("A demo text control"), wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, "A demo text control",
wxDefaultPosition, wxSize(300, 100), wxDefaultPosition, wxSize(300, 100),
wxTE_MULTILINE); wxTE_MULTILINE);
text->SetHelpText(_("Type text here if you have got nothing more interesting to do")); text->SetHelpText(_("Type text here if you have got nothing more interesting to do"));

View File

@@ -128,7 +128,7 @@ public:
void OnLboxSelect(wxCommandEvent& event); void OnLboxSelect(wxCommandEvent& event);
void OnLboxDClick(wxCommandEvent& event) void OnLboxDClick(wxCommandEvent& event)
{ {
wxLogMessage(wxT("Listbox item %d double clicked."), event.GetInt()); wxLogMessage("Listbox item %d double clicked.", event.GetInt());
} }
void OnHtmlLinkClicked(wxHtmlLinkEvent& event); void OnHtmlLinkClicked(wxHtmlLinkEvent& event);
@@ -236,7 +236,7 @@ wxIMPLEMENT_APP(MyApp);
// frame constructor // frame constructor
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, wxT("HtmlLbox wxWidgets Sample"), : wxFrame(NULL, wxID_ANY, "HtmlLbox wxWidgets Sample",
wxDefaultPosition, wxSize(500, 500)) wxDefaultPosition, wxSize(500, 500))
{ {
// set the frame icon // set the frame icon
@@ -245,48 +245,48 @@ MyFrame::MyFrame()
#if wxUSE_MENUS #if wxUSE_MENUS
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->AppendRadioItem(HtmlLbox_CustomBox, wxT("Use custom box"), menuFile->AppendRadioItem(HtmlLbox_CustomBox, "Use custom box",
wxT("Use a wxHtmlListBox virtual class control")); "Use a wxHtmlListBox virtual class control");
menuFile->AppendRadioItem(HtmlLbox_SimpleBox, wxT("Use simple box"), menuFile->AppendRadioItem(HtmlLbox_SimpleBox, "Use simple box",
wxT("Use a wxSimpleHtmlListBox control")); "Use a wxSimpleHtmlListBox control");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(HtmlLbox_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(HtmlLbox_Quit, "E&xit\tAlt-X", "Quit this program");
// create our specific menu // create our specific menu
wxMenu *menuHLbox = new wxMenu; wxMenu *menuHLbox = new wxMenu;
menuHLbox->Append(HtmlLbox_SetMargins, menuHLbox->Append(HtmlLbox_SetMargins,
wxT("Set &margins...\tCtrl-G"), "Set &margins...\tCtrl-G",
wxT("Change the margins around the items")); "Change the margins around the items");
menuHLbox->AppendCheckItem(HtmlLbox_DrawSeparator, menuHLbox->AppendCheckItem(HtmlLbox_DrawSeparator,
wxT("&Draw separators\tCtrl-D"), "&Draw separators\tCtrl-D",
wxT("Toggle drawing separators between cells")); "Toggle drawing separators between cells");
menuHLbox->AppendSeparator(); menuHLbox->AppendSeparator();
menuHLbox->AppendCheckItem(HtmlLbox_ToggleMulti, menuHLbox->AppendCheckItem(HtmlLbox_ToggleMulti,
wxT("&Multiple selection\tCtrl-M"), "&Multiple selection\tCtrl-M",
wxT("Toggle multiple selection on/off")); "Toggle multiple selection on/off");
menuHLbox->AppendSeparator(); menuHLbox->AppendSeparator();
menuHLbox->Append(HtmlLbox_SelectAll, wxT("Select &all items\tCtrl-A")); menuHLbox->Append(HtmlLbox_SelectAll, "Select &all items\tCtrl-A");
menuHLbox->Append(HtmlLbox_UpdateItem, wxT("Update &first item\tCtrl-U")); menuHLbox->Append(HtmlLbox_UpdateItem, "Update &first item\tCtrl-U");
menuHLbox->Append(HtmlLbox_GetItemRect, wxT("Show &rectangle of item #10\tCtrl-R")); menuHLbox->Append(HtmlLbox_GetItemRect, "Show &rectangle of item #10\tCtrl-R");
menuHLbox->AppendSeparator(); menuHLbox->AppendSeparator();
menuHLbox->Append(HtmlLbox_SetBgCol, wxT("Set &background...\tCtrl-B")); menuHLbox->Append(HtmlLbox_SetBgCol, "Set &background...\tCtrl-B");
menuHLbox->Append(HtmlLbox_SetSelBgCol, menuHLbox->Append(HtmlLbox_SetSelBgCol,
wxT("Set &selection background...\tCtrl-S")); "Set &selection background...\tCtrl-S");
menuHLbox->AppendCheckItem(HtmlLbox_SetSelFgCol, menuHLbox->AppendCheckItem(HtmlLbox_SetSelFgCol,
wxT("Keep &foreground in selection\tCtrl-F")); "Keep &foreground in selection\tCtrl-F");
menuHLbox->AppendSeparator(); menuHLbox->AppendSeparator();
menuHLbox->Append(HtmlLbox_Clear, wxT("&Clear\tCtrl-L")); menuHLbox->Append(HtmlLbox_Clear, "&Clear\tCtrl-L");
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(HtmlLbox_About, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(HtmlLbox_About, "&About\tF1", "Show about dialog");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(menuHLbox, wxT("&Listbox")); menuBar->Append(menuHLbox, "&Listbox");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
menuBar->Check(HtmlLbox_DrawSeparator, true); menuBar->Check(HtmlLbox_DrawSeparator, true);
@@ -297,12 +297,12 @@ MyFrame::MyFrame()
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
// create the child controls // create the child controls
CreateBox(); CreateBox();
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxT(""), wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE); wxTE_MULTILINE);
delete wxLog::SetActiveTarget(new wxLogTextCtrl(text)); delete wxLog::SetActiveTarget(new wxLogTextCtrl(text));
@@ -344,9 +344,9 @@ void MyFrame::CreateBox()
(unsigned char)(abs((int)n - 128) % 256)); (unsigned char)(abs((int)n - 128) % 256));
int level = n % 6 + 1; int level = n % 6 + 1;
wxString label = wxString::Format(wxT("<h%d><font color=%s>") wxString label = wxString::Format("<h%d><font color=%s>"
wxT("Item</font> <b>%lu</b>") "Item</font> <b>%lu</b>"
wxT("</h%d>"), "</h%d>",
level, level,
clr.GetAsString(wxC2S_HTML_SYNTAX).c_str(), clr.GetAsString(wxC2S_HTML_SYNTAX).c_str(),
(unsigned long)n, level); (unsigned long)n, level);
@@ -383,10 +383,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("This sample shows wxHtmlListBox class.\n") wxMessageBox("This sample shows wxHtmlListBox class.\n"
wxT("\n") "\n"
wxT("(c) 2003 Vadim Zeitlin"), "(c) 2003 Vadim Zeitlin",
wxT("About HtmlLbox"), "About HtmlLbox",
wxOK | wxICON_INFORMATION, wxOK | wxICON_INFORMATION,
this); this);
} }
@@ -395,9 +395,9 @@ void MyFrame::OnSetMargins(wxCommandEvent& WXUNUSED(event))
{ {
long margin = wxGetNumberFromUser long margin = wxGetNumberFromUser
( (
wxT("Enter the margins to use for the listbox items."), "Enter the margins to use for the listbox items.",
wxT("Margin: "), "Margin: ",
wxT("HtmlLbox: Set the margins"), "HtmlLbox: Set the margins",
0, 0, 20, 0, 0, 20,
this this
); );
@@ -454,7 +454,7 @@ void MyFrame::OnSetBgCol(wxCommandEvent& WXUNUSED(event))
m_hlbox->Refresh(); m_hlbox->Refresh();
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Background colour changed.")); SetStatusText("Background colour changed.");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
} }
@@ -468,7 +468,7 @@ void MyFrame::OnSetSelBgCol(wxCommandEvent& WXUNUSED(event))
m_hlbox->Refresh(); m_hlbox->Refresh();
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Selection background colour changed.")); SetStatusText("Selection background colour changed.");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
} }
@@ -489,7 +489,7 @@ void MyFrame::OnClear(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &event) void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &event)
{ {
wxLogMessage(wxT("The url '%s' has been clicked!"), event.GetLinkInfo().GetHref().c_str()); wxLogMessage("The url '%s' has been clicked!", event.GetLinkInfo().GetHref().c_str());
if (GetMyBox()) if (GetMyBox())
{ {
@@ -500,13 +500,13 @@ void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &event)
void MyFrame::OnHtmlCellHover(wxHtmlCellEvent &event) void MyFrame::OnHtmlCellHover(wxHtmlCellEvent &event)
{ {
wxLogMessage(wxT("Mouse moved over cell %p at %d;%d"), wxLogMessage("Mouse moved over cell %p at %d;%d",
event.GetCell(), event.GetPoint().x, event.GetPoint().y); event.GetCell(), event.GetPoint().x, event.GetPoint().y);
} }
void MyFrame::OnHtmlCellClicked(wxHtmlCellEvent &event) void MyFrame::OnHtmlCellClicked(wxHtmlCellEvent &event)
{ {
wxLogMessage(wxT("Click over cell %p at %d;%d"), wxLogMessage("Click over cell %p at %d;%d",
event.GetCell(), event.GetPoint().x, event.GetPoint().y); event.GetCell(), event.GetPoint().x, event.GetPoint().y);
// if we don't skip the event, OnHtmlLinkClicked won't be called! // if we don't skip the event, OnHtmlLinkClicked won't be called!
@@ -519,7 +519,7 @@ void MyFrame::OnHtmlCellClicked(wxHtmlCellEvent &event)
void MyFrame::OnLboxSelect(wxCommandEvent& event) void MyFrame::OnLboxSelect(wxCommandEvent& event)
{ {
wxLogMessage(wxT("Listbox selection is now %d."), event.GetInt()); wxLogMessage("Listbox selection is now %d.", event.GetInt());
if ( m_hlbox->HasMultipleSelection() ) if ( m_hlbox->HasMultipleSelection() )
{ {
@@ -534,20 +534,20 @@ void MyFrame::OnLboxSelect(wxCommandEvent& event)
if ( first ) if ( first )
first = false; first = false;
else else
s << wxT(", "); s << ", ";
s << item; s << item;
} }
if ( !s.empty() ) if ( !s.empty() )
{ {
wxLogMessage(wxT("Selected items: %s"), s.c_str()); wxLogMessage("Selected items: %s", s.c_str());
} }
} }
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxString::Format( SetStatusText(wxString::Format(
wxT("# items selected = %lu"), "# items selected = %lu",
(unsigned long)m_hlbox->GetSelectedCount() (unsigned long)m_hlbox->GetSelectedCount()
)); ));
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -571,9 +571,9 @@ MyHtmlListBox::MyHtmlListBox(wxWindow *parent, bool multi)
SetMargins(5, 5); SetMargins(5, 5);
#ifdef USE_HTML_FILE #ifdef USE_HTML_FILE
if ( !m_file.Open(wxT("results")) ) if ( !m_file.Open("results") )
{ {
wxLogError(wxT("Failed to open results file")); wxLogError("Failed to open results file");
} }
else else
{ {
@@ -601,7 +601,7 @@ wxString MyHtmlListBox::OnGetItem(size_t n) const
{ {
if ( !n && m_firstItemUpdated ) if ( !n && m_firstItemUpdated )
{ {
return wxT("<h1><b>Just updated</b></h1>"); return "<h1><b>Just updated</b></h1>";
} }
#ifdef USE_HTML_FILE #ifdef USE_HTML_FILE
@@ -617,18 +617,18 @@ wxString MyHtmlListBox::OnGetItem(size_t n) const
(unsigned char)(abs((int)n - 256) % 256), (unsigned char)(abs((int)n - 256) % 256),
(unsigned char)(abs((int)n - 128) % 256)); (unsigned char)(abs((int)n - 128) % 256));
wxString label = wxString::Format(wxT("<h%d><font color=%s>") wxString label = wxString::Format("<h%d><font color=%s>"
wxT("Item</font> <b>%lu</b>") "Item</font> <b>%lu</b>"
wxT("</h%d>"), "</h%d>",
level, level,
clr.GetAsString(wxC2S_HTML_SYNTAX).c_str(), clr.GetAsString(wxC2S_HTML_SYNTAX).c_str(),
(unsigned long)n, level); (unsigned long)n, level);
if ( n == 1 ) if ( n == 1 )
{ {
if ( !m_linkClicked ) if ( !m_linkClicked )
label += wxT("<a href='1'>Click here...</a>"); label += "<a href='1'>Click here...</a>";
else else
label += wxT("<font color='#9999ff'>Clicked here...</font>"); label += "<font color='#9999ff'>Clicked here...</font>";
} }
return label; return label;

View File

@@ -154,7 +154,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER); html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
html -> SetBorders(0); html -> SetBorders(0);
html -> LoadPage(wxT("data/about.htm")); html -> LoadPage("data/about.htm");
html -> SetInitialSize(wxSize(html -> GetInternalRepresentation() -> GetWidth(), html -> SetInitialSize(wxSize(html -> GetInternalRepresentation() -> GetWidth(),
html -> GetInternalRepresentation() -> GetHeight())); html -> GetInternalRepresentation() -> GetHeight()));

View File

@@ -119,8 +119,8 @@ bool MyApp::OnInit()
#if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB #if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
wxFileSystem::AddHandler(new wxZipFSHandler); wxFileSystem::AddHandler(new wxZipFSHandler);
#endif #endif
SetVendorName(wxT("wxWidgets")); SetVendorName("wxWidgets");
SetAppName(wxT("wxHTMLHelp")); SetAppName("wxHTMLHelp");
// Create the main application window // Create the main application window
MyFrame *frame = new MyFrame(_("HTML Help Sample"), MyFrame *frame = new MyFrame(_("HTML Help Sample"),
@@ -162,17 +162,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
help.UseConfig(wxConfig::Get()); help.UseConfig(wxConfig::Get());
bool ret; bool ret;
help.SetTempDir(wxT(".")); help.SetTempDir(".");
wxPathList pathlist; wxPathList pathlist;
pathlist.Add(wxT("./helpfiles")); pathlist.Add("./helpfiles");
pathlist.Add(wxT("../helpfiles")); pathlist.Add("../helpfiles");
pathlist.Add(wxT("../../html/help/helpfiles")); pathlist.Add("../../html/help/helpfiles");
ret = help.AddBook(wxFileName(pathlist.FindValidPath(wxT("testing.hhp")), wxPATH_UNIX)); ret = help.AddBook(wxFileName(pathlist.FindValidPath("testing.hhp"), wxPATH_UNIX));
if (! ret) if (! ret)
wxMessageBox(wxT("Failed adding book helpfiles/testing.hhp")); wxMessageBox("Failed adding book helpfiles/testing.hhp");
ret = help.AddBook(wxFileName(pathlist.FindValidPath(wxT("another.hhp")), wxPATH_UNIX)); ret = help.AddBook(wxFileName(pathlist.FindValidPath("another.hhp"), wxPATH_UNIX));
if (! ret) if (! ret)
wxMessageBox(_("Failed adding book helpfiles/another.hhp")); wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
} }
@@ -188,7 +188,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnHelp(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
{ {
help.Display(wxT("Test HELPFILE")); help.Display("Test HELPFILE");
} }
void MyFrame::OnClose(wxCloseEvent& event) void MyFrame::OnClose(wxCloseEvent& event)

View File

@@ -66,15 +66,15 @@ bool MyApp::OnInit()
wxInitAllImageHandlers(); wxInitAllImageHandlers();
wxFileSystem::AddHandler(new wxZipFSHandler); wxFileSystem::AddHandler(new wxZipFSHandler);
SetVendorName(wxT("wxWidgets")); SetVendorName("wxWidgets");
SetAppName(wxT("wxHTMLHelp")); SetAppName("wxHTMLHelp");
wxConfig::Get(); // create an instance wxConfig::Get(); // create an instance
help = new wxHtmlHelpController; help = new wxHtmlHelpController;
if (argc < 2) { if (argc < 2) {
wxLogError(wxT("Usage : helpview <helpfile> [<more helpfiles>]")); wxLogError("Usage : helpview <helpfile> [<more helpfiles>]");
wxLogError(wxT(" helpfile may be .hhp, .zip or .htb")); wxLogError(" helpfile may be .hhp, .zip or .htb");
return false; return false;
} }

View File

@@ -132,7 +132,7 @@ bool MyApp::OnInit()
return false; return false;
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(wxT("wxWebKit Sample")); MyFrame *frame = new MyFrame("wxWebKit Sample");
// and show it (the frames, unlike simple controls, are not shown when // and show it (the frames, unlike simple controls, are not shown when
// created initially) // created initially)
@@ -183,7 +183,7 @@ MyFrame::MyFrame(const wxString& title)
wxButton* btnReload = new wxButton(myToolbar, ID_RELOAD, _("Reload")); wxButton* btnReload = new wxButton(myToolbar, ID_RELOAD, _("Reload"));
myToolbar->AddControl(btnReload); myToolbar->AddControl(btnReload);
myToolbar->AddSeparator(); myToolbar->AddSeparator();
urlText = new wxTextCtrl(myToolbar, ID_URLLIST, wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxSize(220, -1), wxTE_PROCESS_ENTER); urlText = new wxTextCtrl(myToolbar, ID_URLLIST, "http://www.wxwidgets.org", wxDefaultPosition, wxSize(220, -1), wxTE_PROCESS_ENTER);
myToolbar->AddControl(urlText); myToolbar->AddControl(urlText);
myToolbar->AddSeparator(); myToolbar->AddSeparator();
myToolbar->Realize(); myToolbar->Realize();
@@ -195,7 +195,7 @@ MyFrame::MyFrame(const wxString& title)
wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
panel->SetSizer(boxSizer); panel->SetSizer(boxSizer);
mySafari = new wxWebKitCtrl(panel, ID_WEBKIT, wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxSize(200, 200)); mySafari = new wxWebKitCtrl(panel, ID_WEBKIT, "http://www.wxwidgets.org", wxDefaultPosition, wxSize(200, 200));
boxSizer->Add(mySafari, 1, wxEXPAND); boxSizer->Add(mySafari, 1, wxEXPAND);
@@ -203,7 +203,7 @@ MyFrame::MyFrame(const wxString& title)
SetSizer(frameSizer); SetSizer(frameSizer);
frameSizer->Add(panel, 1, wxEXPAND); frameSizer->Add(panel, 1, wxEXPAND);
#else #else
mySafari = new wxWebKitCtrl(this, ID_WEBKIT, wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxSize(200, 200)); mySafari = new wxWebKitCtrl(this, ID_WEBKIT, "http://www.wxwidgets.org", wxDefaultPosition, wxSize(200, 200));
#endif #endif
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
@@ -274,7 +274,7 @@ void MyFrame::OnSetSource(wxCommandEvent& WXUNUSED(myEvent))
{ {
if (mySafari) if (mySafari)
{ {
wxString myText = wxT("<HTML><HEAD></HEAD><BODY><P>Hello world!</P></BODY></HTML>"); wxString myText = "<HTML><HEAD></HEAD><BODY><P>Hello world!</P></BODY></HTML>";
mySafari->SetPageSource(myText); mySafari->SetPageSource(myText);
} }
} }

View File

@@ -205,15 +205,15 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
m_Html -> SetRelatedStatusBar(0); m_Html -> SetRelatedStatusBar(0);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
m_Name = wxT("test.htm"); m_Name = "test.htm";
m_Html -> LoadPage(m_Name); m_Html -> LoadPage(m_Name);
m_Prn = new wxHtmlEasyPrinting(_("Easy Printing Demo"), this); m_Prn = new wxHtmlEasyPrinting(_("Easy Printing Demo"), this);
m_Prn -> SetHeader(m_Name + wxT("(@PAGENUM@/@PAGESCNT@)<hr>"), wxPAGE_ALL); m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)<hr>", wxPAGE_ALL);
// To specify where the AFM files are kept on Unix, // To specify where the AFM files are kept on Unix,
// you may wish to do something like this // you may wish to do something like this
// m_Prn->GetPrintData()->SetFontMetricPath(wxT("/home/julians/afm")); // m_Prn->GetPrintData()->SetFontMetricPath("/home/julians/afm");
} }
// frame destructor // frame destructor
@@ -258,13 +258,13 @@ void MyFrame::OnPreview(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
{ {
wxFileDialog dialog(this, _("Open HTML page"), wxT(""), wxT(""), wxT("*.htm"), 0); wxFileDialog dialog(this, _("Open HTML page"), "", "", "*.htm", 0);
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
{ {
m_Name = dialog.GetPath(); m_Name = dialog.GetPath();
m_Html -> LoadPage(m_Name); m_Html -> LoadPage(m_Name);
m_Prn -> SetHeader(m_Name + wxT("(@PAGENUM@/@PAGESCNT@)<hr>"), wxPAGE_ALL); m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)<hr>", wxPAGE_ALL);
} }
} }

View File

@@ -113,10 +113,10 @@ public:
virtual wxString Process(const wxString& s) const wxOVERRIDE virtual wxString Process(const wxString& s) const wxOVERRIDE
{ {
wxString r(s); wxString r(s);
r.Replace(wxT("<b>"), wxEmptyString); r.Replace("<b>", wxEmptyString);
r.Replace(wxT("<B>"), wxEmptyString); r.Replace("<B>", wxEmptyString);
r.Replace(wxT("</b>"), wxEmptyString); r.Replace("</b>", wxEmptyString);
r.Replace(wxT("</B>"), wxEmptyString); r.Replace("</B>", wxEmptyString);
return r; return r;
} }
@@ -175,7 +175,7 @@ bool MyApp::OnInit()
return false; return false;
#if wxUSE_SYSTEM_OPTIONS #if wxUSE_SYSTEM_OPTIONS
wxSystemOptions::SetOption(wxT("no-maskblt"), 1); wxSystemOptions::SetOption("no-maskblt", 1);
#endif #endif
wxInitAllImageHandlers(); wxInitAllImageHandlers();
@@ -183,8 +183,8 @@ bool MyApp::OnInit()
wxFileSystem::AddHandler(new wxInternetFSHandler); wxFileSystem::AddHandler(new wxInternetFSHandler);
#endif #endif
SetVendorName(wxT("wxWidgets")); SetVendorName("wxWidgets");
SetAppName(wxT("wxHtmlTest")); SetAppName("wxHtmlTest");
// the following call to wxConfig::Get will use it to create an object... // the following call to wxConfig::Get will use it to create an object...
// Create the main application window // Create the main application window
@@ -203,7 +203,7 @@ bool MyApp::OnInit()
// frame constructor // frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size, : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size,
wxDEFAULT_FRAME_STYLE, wxT("html_test_app")) wxDEFAULT_FRAME_STYLE, "html_test_app")
{ {
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
@@ -254,10 +254,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
m_Html->SetRelatedStatusBar(1); m_Html->SetRelatedStatusBar(1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
m_Html->ReadCustomization(wxConfig::Get()); m_Html->ReadCustomization(wxConfig::Get());
m_Html->LoadFile(wxFileName(wxT("test.htm"))); m_Html->LoadFile(wxFileName("test.htm"));
m_Html->AddProcessor(m_Processor); m_Html->AddProcessor(m_Processor);
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxT(""), wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE); wxTE_MULTILINE);
@@ -285,7 +285,7 @@ void MyFrame::OnPageOpen(wxCommandEvent& WXUNUSED(event))
{ {
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
wxString p = wxFileSelector(_("Open HTML document"), wxEmptyString, wxString p = wxFileSelector(_("Open HTML document"), wxEmptyString,
wxEmptyString, wxEmptyString, wxT("HTML files|*.htm;*.html")); wxEmptyString, wxEmptyString, "HTML files|*.htm;*.html");
if (!p.empty()) if (!p.empty())
{ {
@@ -314,7 +314,7 @@ void MyFrame::OnDefaultWebBrowser(wxCommandEvent& WXUNUSED(event))
wxString page = m_Html->GetOpenedPage(); wxString page = m_Html->GetOpenedPage();
if (!page.empty()) if (!page.empty())
{ {
wxLaunchDefaultBrowser(wxT("http://www.google.com")); wxLaunchDefaultBrowser("http://www.google.com");
} }
} }
@@ -347,7 +347,7 @@ void MyFrame::OnDrawCustomBg(wxCommandEvent& event)
void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &event) void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &event)
{ {
wxLogMessage(wxT("The url '%s' has been clicked!"), event.GetLinkInfo().GetHref().c_str()); wxLogMessage("The url '%s' has been clicked!", event.GetLinkInfo().GetHref().c_str());
// skipping this event the default behaviour (load the clicked URL) // skipping this event the default behaviour (load the clicked URL)
// will happen... // will happen...
@@ -356,13 +356,13 @@ void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &event)
void MyFrame::OnHtmlCellHover(wxHtmlCellEvent &event) void MyFrame::OnHtmlCellHover(wxHtmlCellEvent &event)
{ {
wxLogMessage(wxT("Mouse moved over cell %p at %d;%d"), wxLogMessage("Mouse moved over cell %p at %d;%d",
event.GetCell(), event.GetPoint().x, event.GetPoint().y); event.GetCell(), event.GetPoint().x, event.GetPoint().y);
} }
void MyFrame::OnHtmlCellClicked(wxHtmlCellEvent &event) void MyFrame::OnHtmlCellClicked(wxHtmlCellEvent &event)
{ {
wxLogMessage(wxT("Click over cell %p at %d;%d"), wxLogMessage("Click over cell %p at %d;%d",
event.GetCell(), event.GetPoint().x, event.GetPoint().y); event.GetCell(), event.GetPoint().x, event.GetPoint().y);
// if we don't skip the event, OnHtmlLinkClicked won't be called! // if we don't skip the event, OnHtmlLinkClicked won't be called!
@@ -373,7 +373,7 @@ wxHtmlOpeningStatus MyHtmlWindow::OnOpeningURL(wxHtmlURLType WXUNUSED(type),
const wxString& url, const wxString& url,
wxString *WXUNUSED(redirect)) const wxString *WXUNUSED(redirect)) const
{ {
GetRelatedFrame()->SetStatusText(url + wxT(" lately opened"),1); GetRelatedFrame()->SetStatusText(url + " lately opened",1);
return wxHTML_OPEN; return wxHTML_OPEN;
} }
@@ -397,17 +397,17 @@ void MyHtmlWindow::OnClipboardEvent(wxClipboardTextEvent& WXUNUSED(event))
const wxString text = data.GetText(); const wxString text = data.GetText();
const size_t maxTextLength = 100; const size_t maxTextLength = 100;
wxLogStatus(wxString::Format(wxT("Clipboard: '%s%s'"), wxLogStatus(wxString::Format("Clipboard: '%s%s'",
wxString(text, maxTextLength).c_str(), wxString(text, maxTextLength).c_str(),
(text.length() > maxTextLength) ? wxT("...") (text.length() > maxTextLength) ? "..."
: wxT(""))); : ""));
wxTheClipboard->Close(); wxTheClipboard->Close();
return; return;
} }
} }
wxLogStatus(wxT("Clipboard: nothing")); wxLogStatus("Clipboard: nothing");
} }
#endif // wxUSE_CLIPBOARD #endif // wxUSE_CLIPBOARD

View File

@@ -48,7 +48,7 @@ public:
bool MyVFS::CanOpen(const wxString& location) bool MyVFS::CanOpen(const wxString& location)
{ {
return (GetProtocol(location) == wxT("myVFS")); return (GetProtocol(location) == "myVFS");
} }
wxFSFile* MyVFS::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location) wxFSFile* MyVFS::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
@@ -73,7 +73,7 @@ wxFSFile* MyVFS::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
// this won't happen because wxHTML keeps only one "page" file opened at the // this won't happen because wxHTML keeps only one "page" file opened at the
// time. // time.
str = new wxMemoryInputStream(buf, strlen(buf)); str = new wxMemoryInputStream(buf, strlen(buf));
f = new wxFSFile(str, location, wxT("text/html"), wxEmptyString, wxDateTime::Today()); f = new wxFSFile(str, location, "text/html", wxEmptyString, wxDateTime::Today());
return f; return f;
} }
@@ -216,7 +216,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
html -> SetRelatedStatusBar(1); html -> SetRelatedStatusBar(1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
html -> LoadPage(wxT("start.htm")); html -> LoadPage("start.htm");
} }

View File

@@ -40,16 +40,16 @@ TAG_HANDLER_PROC(tag)
int ax, ay; int ax, ay;
int fl = 0; int fl = 0;
tag.ScanParam(wxT("X"), wxT("%i"), &ax); tag.ScanParam("X", "%i", &ax);
tag.ScanParam(wxT("Y"), wxT("%i"), &ay); tag.ScanParam("Y", "%i", &ay);
if (tag.HasParam(wxT("FLOAT"))) fl = ax; if (tag.HasParam("FLOAT")) fl = ax;
wnd = new wxTextCtrl wnd = new wxTextCtrl
( (
m_WParser->GetWindowInterface()->GetHTMLWindow(), m_WParser->GetWindowInterface()->GetHTMLWindow(),
wxID_ANY, wxID_ANY,
tag.GetParam(wxT("NAME")), tag.GetParam("NAME"),
wxPoint(0,0), wxPoint(0,0),
wxSize(ax, ay), wxSize(ax, ay),
wxTE_MULTILINE wxTE_MULTILINE
@@ -209,7 +209,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
html -> SetRelatedStatusBar(1); html -> SetRelatedStatusBar(1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
html -> LoadPage(wxT("start.htm")); html -> LoadPage("start.htm");
} }

View File

@@ -169,7 +169,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
html -> SetRelatedStatusBar(0); html -> SetRelatedStatusBar(0);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
html -> LoadPage(wxT("start.htm")); html -> LoadPage("start.htm");
} }

View File

@@ -71,40 +71,40 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
// try to find the directory with our images // try to find the directory with our images
wxString dir; wxString dir;
if ( wxFile::Exists(wxT("./horse.png")) ) if ( wxFile::Exists("./horse.png") )
dir = wxT("./"); dir = "./";
else if ( wxFile::Exists(wxT("../horse.png")) ) else if ( wxFile::Exists("../horse.png") )
dir = wxT("../"); dir = "../";
else else
wxLogWarning(wxT("Can't find image files in either '.' or '..'!")); wxLogWarning("Can't find image files in either '.' or '..'!");
wxImage image = bitmap.ConvertToImage(); wxImage image = bitmap.ConvertToImage();
#if wxUSE_LIBPNG #if wxUSE_LIBPNG
if ( !image.SaveFile( dir + wxT("test.png"), wxBITMAP_TYPE_PNG )) if ( !image.SaveFile( dir + "test.png", wxBITMAP_TYPE_PNG ))
{ {
wxLogError(wxT("Can't save file")); wxLogError("Can't save file");
} }
image.Destroy(); image.Destroy();
if ( image.LoadFile( dir + wxT("test.png") ) ) if ( image.LoadFile( dir + "test.png" ) )
my_square = wxBitmap( image ); my_square = wxBitmap( image );
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.png")) ) if ( !image.LoadFile( dir + "horse.png") )
{ {
wxLogError(wxT("Can't load PNG image")); wxLogError("Can't load PNG image");
} }
else else
{ {
my_horse_png = wxBitmap( image ); my_horse_png = wxBitmap( image );
} }
if ( !image.LoadFile( dir + wxT("toucan.png")) ) if ( !image.LoadFile( dir + "toucan.png") )
{ {
wxLogError(wxT("Can't load PNG image")); wxLogError("Can't load PNG image");
} }
else else
{ {
@@ -125,9 +125,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
#if wxUSE_LIBJPEG #if wxUSE_LIBJPEG
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.jpg")) ) if ( !image.LoadFile( dir + "horse.jpg") )
{ {
wxLogError(wxT("Can't load JPG image")); wxLogError("Can't load JPG image");
} }
else else
{ {
@@ -140,9 +140,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
colorized_horse_jpeg = wxBitmap( image ); colorized_horse_jpeg = wxBitmap( image );
} }
if ( !image.LoadFile( dir + wxT("cmyk.jpg")) ) if ( !image.LoadFile( dir + "cmyk.jpg") )
{ {
wxLogError(wxT("Can't load CMYK JPG image")); wxLogError("Can't load CMYK JPG image");
} }
else else
{ {
@@ -155,7 +155,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
if ( !image.LoadFile( dir + wxT("horse.gif" )) ) if ( !image.LoadFile( dir + wxT("horse.gif" )) )
{ {
wxLogError(wxT("Can't load GIF image")); wxLogError("Can't load GIF image");
} }
else else
{ {
@@ -166,9 +166,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
#if wxUSE_PCX #if wxUSE_PCX
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.pcx"), wxBITMAP_TYPE_PCX ) ) if ( !image.LoadFile( dir + "horse.pcx", wxBITMAP_TYPE_PCX ) )
{ {
wxLogError(wxT("Can't load PCX image")); wxLogError("Can't load PCX image");
} }
else else
{ {
@@ -178,9 +178,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.bmp"), wxBITMAP_TYPE_BMP ) ) if ( !image.LoadFile( dir + "horse.bmp", wxBITMAP_TYPE_BMP ) )
{ {
wxLogError(wxT("Can't load BMP image")); wxLogError("Can't load BMP image");
} }
else else
{ {
@@ -190,27 +190,27 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
#if wxUSE_XPM #if wxUSE_XPM
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.xpm"), wxBITMAP_TYPE_XPM ) ) if ( !image.LoadFile( dir + "horse.xpm", wxBITMAP_TYPE_XPM ) )
{ {
wxLogError(wxT("Can't load XPM image")); wxLogError("Can't load XPM image");
} }
else else
{ {
my_horse_xpm = wxBitmap( image ); my_horse_xpm = wxBitmap( image );
} }
if ( !image.SaveFile( dir + wxT("test.xpm"), wxBITMAP_TYPE_XPM )) if ( !image.SaveFile( dir + "test.xpm", wxBITMAP_TYPE_XPM ))
{ {
wxLogError(wxT("Can't save file")); wxLogError("Can't save file");
} }
#endif #endif
#if wxUSE_PNM #if wxUSE_PNM
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.pnm"), wxBITMAP_TYPE_PNM ) ) if ( !image.LoadFile( dir + "horse.pnm", wxBITMAP_TYPE_PNM ) )
{ {
wxLogError(wxT("Can't load PNM image")); wxLogError("Can't load PNM image");
} }
else else
{ {
@@ -219,9 +219,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse_ag.pnm"), wxBITMAP_TYPE_PNM ) ) if ( !image.LoadFile( dir + "horse_ag.pnm", wxBITMAP_TYPE_PNM ) )
{ {
wxLogError(wxT("Can't load PNM image")); wxLogError("Can't load PNM image");
} }
else else
{ {
@@ -230,9 +230,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse_rg.pnm"), wxBITMAP_TYPE_PNM ) ) if ( !image.LoadFile( dir + "horse_rg.pnm", wxBITMAP_TYPE_PNM ) )
{ {
wxLogError(wxT("Can't load PNM image")); wxLogError("Can't load PNM image");
} }
else else
{ {
@@ -243,9 +243,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
#if wxUSE_LIBTIFF #if wxUSE_LIBTIFF
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.tif"), wxBITMAP_TYPE_TIFF ) ) if ( !image.LoadFile( dir + "horse.tif", wxBITMAP_TYPE_TIFF ) )
{ {
wxLogError(wxT("Can't load TIFF image")); wxLogError("Can't load TIFF image");
} }
else else
{ {
@@ -256,9 +256,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
#if wxUSE_TGA #if wxUSE_TGA
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.tga"), wxBITMAP_TYPE_TGA ) ) if ( !image.LoadFile( dir + "horse.tga", wxBITMAP_TYPE_TGA ) )
{ {
wxLogError(wxT("Can't load TGA image")); wxLogError("Can't load TGA image");
} }
else else
{ {
@@ -273,14 +273,14 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
// demonstrates XPM automatically using the mask when saving // demonstrates XPM automatically using the mask when saving
if ( m_bmpSmileXpm.IsOk() ) if ( m_bmpSmileXpm.IsOk() )
m_bmpSmileXpm.SaveFile(wxT("saved.xpm"), wxBITMAP_TYPE_XPM); m_bmpSmileXpm.SaveFile("saved.xpm", wxBITMAP_TYPE_XPM);
#if wxUSE_ICO_CUR #if wxUSE_ICO_CUR
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.ico"), wxBITMAP_TYPE_ICO, 0 ) ) if ( !image.LoadFile( dir + "horse.ico", wxBITMAP_TYPE_ICO, 0 ) )
{ {
wxLogError(wxT("Can't load first ICO image")); wxLogError("Can't load first ICO image");
} }
else else
{ {
@@ -289,9 +289,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.ico"), wxBITMAP_TYPE_ICO, 1 ) ) if ( !image.LoadFile( dir + "horse.ico", wxBITMAP_TYPE_ICO, 1 ) )
{ {
wxLogError(wxT("Can't load second ICO image")); wxLogError("Can't load second ICO image");
} }
else else
{ {
@@ -300,9 +300,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.ico") ) ) if ( !image.LoadFile( dir + "horse.ico" ) )
{ {
wxLogError(wxT("Can't load best ICO image")); wxLogError("Can't load best ICO image");
} }
else else
{ {
@@ -311,9 +311,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
image.Destroy(); image.Destroy();
if ( !image.LoadFile( dir + wxT("horse.cur"), wxBITMAP_TYPE_CUR ) ) if ( !image.LoadFile( dir + "horse.cur", wxBITMAP_TYPE_CUR ) )
{ {
wxLogError(wxT("Can't load best ICO image")); wxLogError("Can't load best ICO image");
} }
else else
{ {
@@ -322,10 +322,10 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
yH = 2420 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ; yH = 2420 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ;
} }
m_ani_images = wxImage::GetImageCount ( dir + wxT("horse3.ani"), wxBITMAP_TYPE_ANI ); m_ani_images = wxImage::GetImageCount ( dir + "horse3.ani", wxBITMAP_TYPE_ANI );
if (m_ani_images==0) if (m_ani_images==0)
{ {
wxLogError(wxT("No ANI-format images found")); wxLogError("No ANI-format images found");
} }
else else
{ {
@@ -336,9 +336,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
for (i=0; i < m_ani_images; i++) for (i=0; i < m_ani_images; i++)
{ {
image.Destroy(); image.Destroy();
if (!image.LoadFile( dir + wxT("horse3.ani"), wxBITMAP_TYPE_ANI, i )) if (!image.LoadFile( dir + "horse3.ani", wxBITMAP_TYPE_ANI, i ))
{ {
wxString tmp = wxT("Can't load image number "); wxString tmp = "Can't load image number ";
tmp << i ; tmp << i ;
wxLogError(tmp); wxLogError(tmp);
} }
@@ -351,7 +351,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
image.Destroy(); image.Destroy();
// test image loading from stream // test image loading from stream
wxFile file(dir + wxT("horse.bmp")); wxFile file(dir + "horse.bmp");
if ( file.IsOpened() ) if ( file.IsOpened() )
{ {
wxFileOffset len = file.Length(); wxFileOffset len = file.Length();
@@ -359,14 +359,14 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
void *data = malloc(dataSize); void *data = malloc(dataSize);
if ( file.Read(data, dataSize) != len ) if ( file.Read(data, dataSize) != len )
{ {
wxLogError(wxT("Reading bitmap file failed")); wxLogError("Reading bitmap file failed");
} }
else else
{ {
wxMemoryInputStream mis(data, dataSize); wxMemoryInputStream mis(data, dataSize);
if ( !image.LoadFile(mis) ) if ( !image.LoadFile(mis) )
{ {
wxLogError(wxT("Can't load BMP image from stream")); wxLogError("Can't load BMP image from stream");
} }
else else
{ {
@@ -401,11 +401,11 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
wxPaintDC dc( this ); wxPaintDC dc( this );
PrepareDC( dc ); PrepareDC( dc );
dc.DrawText( wxT("Loaded image"), 30, 10 ); dc.DrawText( "Loaded image", 30, 10 );
if (my_square.IsOk()) if (my_square.IsOk())
dc.DrawBitmap( my_square, 30, 30 ); dc.DrawBitmap( my_square, 30, 30 );
dc.DrawText( wxT("Drawn directly"), 150, 10 ); dc.DrawText( "Drawn directly", 150, 10 );
dc.SetBrush( wxBrush( wxS("orange") ) ); dc.SetBrush( wxBrush( wxS("orange") ) );
dc.SetPen( *wxBLACK_PEN ); dc.SetPen( *wxBLACK_PEN );
dc.DrawRectangle( 150, 30, 100, 100 ); dc.DrawRectangle( 150, 30, 100, 100 );
@@ -415,65 +415,65 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
if (my_anti.IsOk()) if (my_anti.IsOk())
dc.DrawBitmap( my_anti, 280, 30 ); dc.DrawBitmap( my_anti, 280, 30 );
dc.DrawText( wxT("PNG handler"), 30, 135 ); dc.DrawText( "PNG handler", 30, 135 );
if (my_horse_png.IsOk()) if (my_horse_png.IsOk())
{ {
dc.DrawBitmap( my_horse_png, 30, 150 ); dc.DrawBitmap( my_horse_png, 30, 150 );
wxRect rect(0,0,100,100); wxRect rect(0,0,100,100);
wxBitmap sub( my_horse_png.GetSubBitmap(rect) ); wxBitmap sub( my_horse_png.GetSubBitmap(rect) );
dc.DrawText( wxT("GetSubBitmap()"), 280, 175 ); dc.DrawText( "GetSubBitmap()", 280, 175 );
dc.DrawBitmap( sub, 280, 195 ); dc.DrawBitmap( sub, 280, 195 );
} }
dc.DrawText( wxT("JPEG handler"), 30, 365 ); dc.DrawText( "JPEG handler", 30, 365 );
if (my_horse_jpeg.IsOk()) if (my_horse_jpeg.IsOk())
dc.DrawBitmap( my_horse_jpeg, 30, 380 ); dc.DrawBitmap( my_horse_jpeg, 30, 380 );
dc.DrawText( wxT("Green rotated to red"), 280, 365 ); dc.DrawText( "Green rotated to red", 280, 365 );
if (colorized_horse_jpeg.IsOk()) if (colorized_horse_jpeg.IsOk())
dc.DrawBitmap( colorized_horse_jpeg, 280, 380 ); dc.DrawBitmap( colorized_horse_jpeg, 280, 380 );
dc.DrawText( wxT("CMYK JPEG image"), 530, 365 ); dc.DrawText( "CMYK JPEG image", 530, 365 );
if (my_cmyk_jpeg.IsOk()) if (my_cmyk_jpeg.IsOk())
dc.DrawBitmap( my_cmyk_jpeg, 530, 380 ); dc.DrawBitmap( my_cmyk_jpeg, 530, 380 );
dc.DrawText( wxT("GIF handler"), 30, 595 ); dc.DrawText( "GIF handler", 30, 595 );
if (my_horse_gif.IsOk()) if (my_horse_gif.IsOk())
dc.DrawBitmap( my_horse_gif, 30, 610 ); dc.DrawBitmap( my_horse_gif, 30, 610 );
dc.DrawText( wxT("PCX handler"), 30, 825 ); dc.DrawText( "PCX handler", 30, 825 );
if (my_horse_pcx.IsOk()) if (my_horse_pcx.IsOk())
dc.DrawBitmap( my_horse_pcx, 30, 840 ); dc.DrawBitmap( my_horse_pcx, 30, 840 );
dc.DrawText( wxT("BMP handler"), 30, 1055 ); dc.DrawText( "BMP handler", 30, 1055 );
if (my_horse_bmp.IsOk()) if (my_horse_bmp.IsOk())
dc.DrawBitmap( my_horse_bmp, 30, 1070 ); dc.DrawBitmap( my_horse_bmp, 30, 1070 );
dc.DrawText( wxT("BMP read from memory"), 280, 1055 ); dc.DrawText( "BMP read from memory", 280, 1055 );
if (my_horse_bmp2.IsOk()) if (my_horse_bmp2.IsOk())
dc.DrawBitmap( my_horse_bmp2, 280, 1070 ); dc.DrawBitmap( my_horse_bmp2, 280, 1070 );
dc.DrawText( wxT("PNM handler"), 30, 1285 ); dc.DrawText( "PNM handler", 30, 1285 );
if (my_horse_pnm.IsOk()) if (my_horse_pnm.IsOk())
dc.DrawBitmap( my_horse_pnm, 30, 1300 ); dc.DrawBitmap( my_horse_pnm, 30, 1300 );
dc.DrawText( wxT("PNM handler (ascii grey)"), 280, 1285 ); dc.DrawText( "PNM handler (ascii grey)", 280, 1285 );
if (my_horse_asciigrey_pnm.IsOk()) if (my_horse_asciigrey_pnm.IsOk())
dc.DrawBitmap( my_horse_asciigrey_pnm, 280, 1300 ); dc.DrawBitmap( my_horse_asciigrey_pnm, 280, 1300 );
dc.DrawText( wxT("PNM handler (raw grey)"), 530, 1285 ); dc.DrawText( "PNM handler (raw grey)", 530, 1285 );
if (my_horse_rawgrey_pnm.IsOk()) if (my_horse_rawgrey_pnm.IsOk())
dc.DrawBitmap( my_horse_rawgrey_pnm, 530, 1300 ); dc.DrawBitmap( my_horse_rawgrey_pnm, 530, 1300 );
dc.DrawText( wxT("TIFF handler"), 30, 1515 ); dc.DrawText( "TIFF handler", 30, 1515 );
if (my_horse_tiff.IsOk()) if (my_horse_tiff.IsOk())
dc.DrawBitmap( my_horse_tiff, 30, 1530 ); dc.DrawBitmap( my_horse_tiff, 30, 1530 );
dc.DrawText( wxT("TGA handler"), 30, 1745 ); dc.DrawText( "TGA handler", 30, 1745 );
if (my_horse_tga.IsOk()) if (my_horse_tga.IsOk())
dc.DrawBitmap( my_horse_tga, 30, 1760 ); dc.DrawBitmap( my_horse_tga, 30, 1760 );
dc.DrawText( wxT("XPM handler"), 30, 1975 ); dc.DrawText( "XPM handler", 30, 1975 );
if (my_horse_xpm.IsOk()) if (my_horse_xpm.IsOk())
dc.DrawBitmap( my_horse_xpm, 30, 2000 ); dc.DrawBitmap( my_horse_xpm, 30, 2000 );
@@ -481,36 +481,36 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
int x = 750, y = 10, yy = 170; int x = 750, y = 10, yy = 170;
dc.DrawText(wxT("Original toucan"), x+50, y); dc.DrawText("Original toucan", x+50, y);
dc.DrawBitmap(my_toucan, x, y+15, true); dc.DrawBitmap(my_toucan, x, y+15, true);
y += yy; y += yy;
dc.DrawText(wxT("Flipped horizontally"), x+50, y); dc.DrawText("Flipped horizontally", x+50, y);
dc.DrawBitmap(my_toucan_flipped_horiz, x, y+15, true); dc.DrawBitmap(my_toucan_flipped_horiz, x, y+15, true);
y += yy; y += yy;
dc.DrawText(wxT("Flipped vertically"), x+50, y); dc.DrawText("Flipped vertically", x+50, y);
dc.DrawBitmap(my_toucan_flipped_vert, x, y+15, true); dc.DrawBitmap(my_toucan_flipped_vert, x, y+15, true);
y += yy; y += yy;
dc.DrawText(wxT("Flipped both h&v"), x+50, y); dc.DrawText("Flipped both h&v", x+50, y);
dc.DrawBitmap(my_toucan_flipped_both, x, y+15, true); dc.DrawBitmap(my_toucan_flipped_both, x, y+15, true);
y += yy; y += yy;
dc.DrawText(wxT("In greyscale"), x+50, y); dc.DrawText("In greyscale", x+50, y);
dc.DrawBitmap(my_toucan_grey, x, y+15, true); dc.DrawBitmap(my_toucan_grey, x, y+15, true);
y += yy; y += yy;
dc.DrawText(wxT("Toucan's head"), x+50, y); dc.DrawText("Toucan's head", x+50, y);
dc.DrawBitmap(my_toucan_head, x, y+15, true); dc.DrawBitmap(my_toucan_head, x, y+15, true);
y += yy; y += yy;
dc.DrawText(wxT("Scaled with normal quality"), x+50, y); dc.DrawText("Scaled with normal quality", x+50, y);
dc.DrawBitmap(my_toucan_scaled_normal, x, y+15, true); dc.DrawBitmap(my_toucan_scaled_normal, x, y+15, true);
y += yy; y += yy;
dc.DrawText(wxT("Scaled with high quality"), x+50, y); dc.DrawText("Scaled with high quality", x+50, y);
dc.DrawBitmap(my_toucan_scaled_high, x, y+15, true); dc.DrawBitmap(my_toucan_scaled_high, x, y+15, true);
y += yy; y += yy;
dc.DrawText(wxT("Blured"), x+50, y); dc.DrawText("Blured", x+50, y);
dc.DrawBitmap(my_toucan_blur, x, y+15, true); dc.DrawBitmap(my_toucan_blur, x, y+15, true);
} }
@@ -518,16 +518,16 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
int x = 300, y = 1800; int x = 300, y = 1800;
dc.DrawText( wxT("XBM bitmap"), x, y ); dc.DrawText( "XBM bitmap", x, y );
dc.DrawText( wxT("(green on red)"), x, y + 15 ); dc.DrawText( "(green on red)", x, y + 15 );
dc.SetTextForeground( wxT("GREEN") ); dc.SetTextForeground( "GREEN" );
dc.SetTextBackground( wxT("RED") ); dc.SetTextBackground( "RED" );
dc.DrawBitmap( my_smile_xbm, x, y + 30 ); dc.DrawBitmap( my_smile_xbm, x, y + 30 );
dc.SetTextForeground( *wxBLACK ); dc.SetTextForeground( *wxBLACK );
dc.DrawText( wxT("After wxImage conversion"), x + 120, y ); dc.DrawText( "After wxImage conversion", x + 120, y );
dc.DrawText( wxT("(red on white)"), x + 120, y + 15 ); dc.DrawText( "(red on white)", x + 120, y + 15 );
dc.SetTextForeground( wxT("RED") ); dc.SetTextForeground( "RED" );
wxImage i = my_smile_xbm.ConvertToImage(); wxImage i = my_smile_xbm.ConvertToImage();
i.SetMaskColour( 255, 255, 255 ); i.SetMaskColour( 255, 255, 255 );
i.Replace( 0, 0, 0, i.Replace( 0, 0, 0,
@@ -548,7 +548,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
memdc.SetTextForeground( *wxBLACK ); memdc.SetTextForeground( *wxBLACK );
#ifndef __WXGTK20__ #ifndef __WXGTK20__
// I cannot convince GTK2 to draw into mono bitmaps // I cannot convince GTK2 to draw into mono bitmaps
memdc.DrawText( wxT("Hi!"), 5, 5 ); memdc.DrawText( "Hi!", 5, 5 );
#endif #endif
memdc.SetBrush( *wxBLACK_BRUSH ); memdc.SetBrush( *wxBLACK_BRUSH );
memdc.DrawRectangle( 33,5,20,20 ); memdc.DrawRectangle( 33,5,20,20 );
@@ -560,16 +560,16 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
int x = 300, y = 1900; int x = 300, y = 1900;
dc.DrawText( wxT("Mono bitmap"), x, y ); dc.DrawText( "Mono bitmap", x, y );
dc.DrawText( wxT("(red on green)"), x, y + 15 ); dc.DrawText( "(red on green)", x, y + 15 );
dc.SetTextForeground( wxT("RED") ); dc.SetTextForeground( "RED" );
dc.SetTextBackground( wxT("GREEN") ); dc.SetTextBackground( "GREEN" );
dc.DrawBitmap( mono, x, y + 30 ); dc.DrawBitmap( mono, x, y + 30 );
dc.SetTextForeground( *wxBLACK ); dc.SetTextForeground( *wxBLACK );
dc.DrawText( wxT("After wxImage conversion"), x + 120, y ); dc.DrawText( "After wxImage conversion", x + 120, y );
dc.DrawText( wxT("(red on white)"), x + 120, y + 15 ); dc.DrawText( "(red on white)", x + 120, y + 15 );
dc.SetTextForeground( wxT("RED") ); dc.SetTextForeground( "RED" );
wxImage i = mono.ConvertToImage(); wxImage i = mono.ConvertToImage();
i.SetMaskColour( 255,255,255 ); i.SetMaskColour( 255,255,255 );
i.Replace( 0,0,0, i.Replace( 0,0,0,
@@ -584,11 +584,11 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
dc.SetBrush( *wxRED_BRUSH ); dc.SetBrush( *wxRED_BRUSH );
dc.DrawRectangle( 20, 2220, 560, 68 ); dc.DrawRectangle( 20, 2220, 560, 68 );
dc.DrawText(wxT("XPM bitmap"), 30, 2230 ); dc.DrawText("XPM bitmap", 30, 2230 );
if ( m_bmpSmileXpm.IsOk() ) if ( m_bmpSmileXpm.IsOk() )
dc.DrawBitmap(m_bmpSmileXpm, 30, 2250, true); dc.DrawBitmap(m_bmpSmileXpm, 30, 2250, true);
dc.DrawText(wxT("XPM icon"), 110, 2230 ); dc.DrawText("XPM icon", 110, 2230 );
if ( m_iconSmileXpm.IsOk() ) if ( m_iconSmileXpm.IsOk() )
dc.DrawIcon(m_iconSmileXpm, 110, 2250); dc.DrawIcon(m_iconSmileXpm, 110, 2250);
@@ -596,19 +596,19 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
wxBitmap to_blit( m_iconSmileXpm ); wxBitmap to_blit( m_iconSmileXpm );
if (to_blit.IsOk()) if (to_blit.IsOk())
{ {
dc.DrawText( wxT("SubBitmap"), 170, 2230 ); dc.DrawText( "SubBitmap", 170, 2230 );
wxBitmap sub = to_blit.GetSubBitmap( wxRect(0,0,15,15) ); wxBitmap sub = to_blit.GetSubBitmap( wxRect(0,0,15,15) );
if (sub.IsOk()) if (sub.IsOk())
dc.DrawBitmap( sub, 170, 2250, true ); dc.DrawBitmap( sub, 170, 2250, true );
dc.DrawText( wxT("Enlarged"), 250, 2230 ); dc.DrawText( "Enlarged", 250, 2230 );
dc.SetUserScale( 1.5, 1.5 ); dc.SetUserScale( 1.5, 1.5 );
dc.DrawBitmap( to_blit, (int)(250/1.5), (int)(2250/1.5), true ); dc.DrawBitmap( to_blit, (int)(250/1.5), (int)(2250/1.5), true );
dc.SetUserScale( 2, 2 ); dc.SetUserScale( 2, 2 );
dc.DrawBitmap( to_blit, (int)(300/2), (int)(2250/2), true ); dc.DrawBitmap( to_blit, (int)(300/2), (int)(2250/2), true );
dc.SetUserScale( 1.0, 1.0 ); dc.SetUserScale( 1.0, 1.0 );
dc.DrawText( wxT("Blit"), 400, 2230); dc.DrawText( "Blit", 400, 2230);
wxMemoryDC blit_dc; wxMemoryDC blit_dc;
blit_dc.SelectObject( to_blit ); blit_dc.SelectObject( to_blit );
dc.Blit( 400, 2250, to_blit.GetWidth(), to_blit.GetHeight(), &blit_dc, 0, 0, wxCOPY, true ); dc.Blit( 400, 2250, to_blit.GetWidth(), to_blit.GetHeight(), &blit_dc, 0, 0, wxCOPY, true );
@@ -619,19 +619,19 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
dc.SetUserScale( 1.0, 1.0 ); dc.SetUserScale( 1.0, 1.0 );
} }
dc.DrawText( wxT("ICO handler (1st image)"), 30, 2290 ); dc.DrawText( "ICO handler (1st image)", 30, 2290 );
if (my_horse_ico32.IsOk()) if (my_horse_ico32.IsOk())
dc.DrawBitmap( my_horse_ico32, 30, 2330, true ); dc.DrawBitmap( my_horse_ico32, 30, 2330, true );
dc.DrawText( wxT("ICO handler (2nd image)"), 230, 2290 ); dc.DrawText( "ICO handler (2nd image)", 230, 2290 );
if (my_horse_ico16.IsOk()) if (my_horse_ico16.IsOk())
dc.DrawBitmap( my_horse_ico16, 230, 2330, true ); dc.DrawBitmap( my_horse_ico16, 230, 2330, true );
dc.DrawText( wxT("ICO handler (best image)"), 430, 2290 ); dc.DrawText( "ICO handler (best image)", 430, 2290 );
if (my_horse_ico.IsOk()) if (my_horse_ico.IsOk())
dc.DrawBitmap( my_horse_ico, 430, 2330, true ); dc.DrawBitmap( my_horse_ico, 430, 2330, true );
dc.DrawText( wxT("CUR handler"), 30, 2390 ); dc.DrawText( "CUR handler", 30, 2390 );
if (my_horse_cur.IsOk()) if (my_horse_cur.IsOk())
{ {
dc.DrawBitmap( my_horse_cur, 30, 2420, true ); dc.DrawBitmap( my_horse_cur, 30, 2420, true );
@@ -640,7 +640,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
dc.DrawLine (xH,yH-10,xH,yH+10); dc.DrawLine (xH,yH-10,xH,yH+10);
} }
dc.DrawText( wxT("ANI handler"), 230, 2390 ); dc.DrawText( "ANI handler", 230, 2390 );
for ( int i=0; i < m_ani_images; i++ ) for ( int i=0; i < m_ani_images; i++ )
{ {
if (my_horse_ani[i].IsOk()) if (my_horse_ani[i].IsOk())
@@ -667,9 +667,9 @@ void MyCanvas::CreateAntiAliasedBitmap()
dc.Clear(); dc.Clear();
dc.SetFont( wxFontInfo(24).Family(wxFONTFAMILY_DECORATIVE) ); dc.SetFont( wxFontInfo(24).Family(wxFONTFAMILY_DECORATIVE) );
dc.SetTextForeground( wxT("RED") ); dc.SetTextForeground( "RED" );
dc.DrawText( wxT("This is anti-aliased Text."), 20, 5 ); dc.DrawText( "This is anti-aliased Text.", 20, 5 );
dc.DrawText( wxT("And a Rectangle."), 20, 45 ); dc.DrawText( "And a Rectangle.", 20, 45 );
dc.SetBrush( *wxRED_BRUSH ); dc.SetBrush( *wxRED_BRUSH );
dc.SetPen( *wxTRANSPARENT_PEN ); dc.SetPen( *wxTRANSPARENT_PEN );

View File

@@ -143,7 +143,7 @@ private:
int numImages = 1) int numImages = 1)
{ {
if ( !wxFrame::Create(parent, wxID_ANY, if ( !wxFrame::Create(parent, wxID_ANY,
wxString::Format(wxT("Image from %s"), desc), wxString::Format("Image from %s", desc),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE) ) wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE) )
return false; return false;
@@ -154,19 +154,19 @@ private:
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
menu->Append(wxID_SAVEAS); menu->Append(wxID_SAVEAS);
menu->AppendSeparator(); menu->AppendSeparator();
menu->AppendCheckItem(ID_PAINT_BG, wxT("&Paint background"), menu->AppendCheckItem(ID_PAINT_BG, "&Paint background",
"Uncheck this for transparent images"); "Uncheck this for transparent images");
menu->AppendSeparator(); menu->AppendSeparator();
menu->Append(ID_RESIZE, wxT("&Fit to window\tCtrl-F")); menu->Append(ID_RESIZE, "&Fit to window\tCtrl-F");
menu->Append(wxID_ZOOM_IN, "Zoom &in\tCtrl-+"); menu->Append(wxID_ZOOM_IN, "Zoom &in\tCtrl-+");
menu->Append(wxID_ZOOM_OUT, "Zoom &out\tCtrl--"); menu->Append(wxID_ZOOM_OUT, "Zoom &out\tCtrl--");
menu->Append(wxID_ZOOM_100, "Reset zoom to &100%\tCtrl-1"); menu->Append(wxID_ZOOM_100, "Reset zoom to &100%\tCtrl-1");
menu->AppendSeparator(); menu->AppendSeparator();
menu->Append(ID_ROTATE_LEFT, wxT("Rotate &left\tCtrl-L")); menu->Append(ID_ROTATE_LEFT, "Rotate &left\tCtrl-L");
menu->Append(ID_ROTATE_RIGHT, wxT("Rotate &right\tCtrl-R")); menu->Append(ID_ROTATE_RIGHT, "Rotate &right\tCtrl-R");
wxMenuBar *mbar = new wxMenuBar; wxMenuBar *mbar = new wxMenuBar;
mbar->Append(menu, wxT("&Image")); mbar->Append(menu, "&Image");
SetMenuBar(mbar); SetMenuBar(mbar);
mbar->Check(ID_PAINT_BG, true); mbar->Check(ID_PAINT_BG, true);
@@ -213,31 +213,31 @@ private:
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
wxImage image = m_bitmap.ConvertToImage(); wxImage image = m_bitmap.ConvertToImage();
wxString savefilename = wxFileSelector( wxT("Save Image"), wxString savefilename = wxFileSelector( "Save Image",
wxEmptyString, wxEmptyString,
wxEmptyString, wxEmptyString,
wxEmptyString, wxEmptyString,
wxT("BMP files (*.bmp)|*.bmp|") "BMP files (*.bmp)|*.bmp|"
#if wxUSE_LIBPNG #if wxUSE_LIBPNG
wxT("PNG files (*.png)|*.png|") "PNG files (*.png)|*.png|"
#endif #endif
#if wxUSE_LIBJPEG #if wxUSE_LIBJPEG
wxT("JPEG files (*.jpg)|*.jpg|") "JPEG files (*.jpg)|*.jpg|"
#endif #endif
#if wxUSE_GIF #if wxUSE_GIF
wxT("GIF files (*.gif)|*.gif|") "GIF files (*.gif)|*.gif|"
#endif #endif
#if wxUSE_LIBTIFF #if wxUSE_LIBTIFF
wxT("TIFF files (*.tif)|*.tif|") "TIFF files (*.tif)|*.tif|"
#endif #endif
#if wxUSE_PCX #if wxUSE_PCX
wxT("PCX files (*.pcx)|*.pcx|") "PCX files (*.pcx)|*.pcx|"
#endif #endif
#if wxUSE_XPM #if wxUSE_XPM
wxT("X PixMap files (*.xpm)|*.xpm|") "X PixMap files (*.xpm)|*.xpm|"
#endif #endif
wxT("ICO files (*.ico)|*.ico|") "ICO files (*.ico)|*.ico|"
wxT("CUR files (*.cur)|*.cur"), "CUR files (*.cur)|*.cur",
wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
this); this);
@@ -248,7 +248,7 @@ private:
wxFileName::SplitPath(savefilename, NULL, NULL, &extension); wxFileName::SplitPath(savefilename, NULL, NULL, &extension);
bool saved = false; bool saved = false;
if ( extension == wxT("bmp") ) if ( extension == "bmp" )
{ {
static const int bppvalues[] = static const int bppvalues[] =
{ {
@@ -264,18 +264,18 @@ private:
const wxString bppchoices[] = const wxString bppchoices[] =
{ {
wxT("1 bpp color"), "1 bpp color",
wxT("1 bpp B&W"), "1 bpp B&W",
wxT("4 bpp color"), "4 bpp color",
wxT("8 bpp color"), "8 bpp color",
wxT("8 bpp greyscale"), "8 bpp greyscale",
wxT("8 bpp red"), "8 bpp red",
wxT("8 bpp own palette"), "8 bpp own palette",
wxT("24 bpp") "24 bpp"
}; };
int bppselection = wxGetSingleChoiceIndex(wxT("Set BMP BPP"), int bppselection = wxGetSingleChoiceIndex("Set BMP BPP",
wxT("Image sample: save file"), "Image sample: save file",
WXSIZEOF(bppchoices), WXSIZEOF(bppchoices),
bppchoices, bppchoices,
this); this);
@@ -296,7 +296,7 @@ private:
} }
} }
#if wxUSE_LIBPNG #if wxUSE_LIBPNG
else if ( extension == wxT("png") ) else if ( extension == "png" )
{ {
static const int pngvalues[] = static const int pngvalues[] =
{ {
@@ -310,16 +310,16 @@ private:
const wxString pngchoices[] = const wxString pngchoices[] =
{ {
wxT("Colour 8bpp"), "Colour 8bpp",
wxT("Colour 16bpp"), "Colour 16bpp",
wxT("Grey 8bpp"), "Grey 8bpp",
wxT("Grey 16bpp"), "Grey 16bpp",
wxT("Grey red 8bpp"), "Grey red 8bpp",
wxT("Grey red 16bpp"), "Grey red 16bpp",
}; };
int sel = wxGetSingleChoiceIndex(wxT("Set PNG format"), int sel = wxGetSingleChoiceIndex("Set PNG format",
wxT("Image sample: save file"), "Image sample: save file",
WXSIZEOF(pngchoices), WXSIZEOF(pngchoices),
pngchoices, pngchoices,
this); this);
@@ -331,22 +331,22 @@ private:
// these values are taken from OptiPNG with -o3 switch // these values are taken from OptiPNG with -o3 switch
const wxString compressionChoices[] = const wxString compressionChoices[] =
{ {
wxT("compression = 9, memory = 8, strategy = 0, filter = 0"), "compression = 9, memory = 8, strategy = 0, filter = 0",
wxT("compression = 9, memory = 9, strategy = 0, filter = 0"), "compression = 9, memory = 9, strategy = 0, filter = 0",
wxT("compression = 9, memory = 8, strategy = 1, filter = 0"), "compression = 9, memory = 8, strategy = 1, filter = 0",
wxT("compression = 9, memory = 9, strategy = 1, filter = 0"), "compression = 9, memory = 9, strategy = 1, filter = 0",
wxT("compression = 1, memory = 8, strategy = 2, filter = 0"), "compression = 1, memory = 8, strategy = 2, filter = 0",
wxT("compression = 1, memory = 9, strategy = 2, filter = 0"), "compression = 1, memory = 9, strategy = 2, filter = 0",
wxT("compression = 9, memory = 8, strategy = 0, filter = 5"), "compression = 9, memory = 8, strategy = 0, filter = 5",
wxT("compression = 9, memory = 9, strategy = 0, filter = 5"), "compression = 9, memory = 9, strategy = 0, filter = 5",
wxT("compression = 9, memory = 8, strategy = 1, filter = 5"), "compression = 9, memory = 8, strategy = 1, filter = 5",
wxT("compression = 9, memory = 9, strategy = 1, filter = 5"), "compression = 9, memory = 9, strategy = 1, filter = 5",
wxT("compression = 1, memory = 8, strategy = 2, filter = 5"), "compression = 1, memory = 8, strategy = 2, filter = 5",
wxT("compression = 1, memory = 9, strategy = 2, filter = 5"), "compression = 1, memory = 9, strategy = 2, filter = 5",
}; };
sel = wxGetSingleChoiceIndex(wxT("Select compression option (Cancel to use default)\n"), sel = wxGetSingleChoiceIndex("Select compression option (Cancel to use default)\n",
wxT("PNG Compression Options"), "PNG Compression Options",
WXSIZEOF(compressionChoices), WXSIZEOF(compressionChoices),
compressionChoices, compressionChoices,
this); this);
@@ -367,7 +367,7 @@ private:
} }
} }
#endif // wxUSE_LIBPNG #endif // wxUSE_LIBPNG
else if ( extension == wxT("cur") ) else if ( extension == "cur" )
{ {
image.Rescale(32,32); image.Rescale(32,32);
image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, 0); image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, 0);
@@ -419,7 +419,7 @@ private:
img = img.Rotate(angle, wxPoint(img.GetWidth() / 2, img.GetHeight() / 2)); img = img.Rotate(angle, wxPoint(img.GetWidth() / 2, img.GetHeight() / 2));
if ( !img.IsOk() ) if ( !img.IsOk() )
{ {
wxLogWarning(wxT("Rotation failed")); wxLogWarning("Rotation failed");
return; return;
} }
@@ -430,7 +430,7 @@ private:
void UpdateStatusBar() void UpdateStatusBar()
{ {
wxLogStatus(this, wxT("Image size: (%d, %d), zoom %.2f"), wxLogStatus(this, "Image size: (%d, %d), zoom %.2f",
m_bitmap.GetWidth(), m_bitmap.GetWidth(),
m_bitmap.GetHeight(), m_bitmap.GetHeight(),
m_zoom); m_zoom);
@@ -458,7 +458,7 @@ public:
}; };
MyRawBitmapFrame(wxFrame *parent) MyRawBitmapFrame(wxFrame *parent)
: wxFrame(parent, wxID_ANY, wxT("Raw bitmaps (how exciting)")), : wxFrame(parent, wxID_ANY, "Raw bitmaps (how exciting)"),
m_bitmap(SIZE, SIZE, 24), m_bitmap(SIZE, SIZE, 24),
m_alphaBitmap(SIZE, SIZE, 32) m_alphaBitmap(SIZE, SIZE, 32)
{ {
@@ -476,7 +476,7 @@ public:
wxAlphaPixelData data( m_alphaBitmap, wxPoint(0,0), wxSize(SIZE, SIZE) ); wxAlphaPixelData data( m_alphaBitmap, wxPoint(0,0), wxSize(SIZE, SIZE) );
if ( !data ) if ( !data )
{ {
wxLogError(wxT("Failed to gain raw access to bitmap data")); wxLogError("Failed to gain raw access to bitmap data");
return; return;
} }
wxAlphaPixelData::Iterator p(data); wxAlphaPixelData::Iterator p(data);
@@ -498,7 +498,7 @@ public:
wxSize(REAL_SIZE, REAL_SIZE)); wxSize(REAL_SIZE, REAL_SIZE));
if ( !data ) if ( !data )
{ {
wxLogError(wxT("Failed to gain raw access to bitmap data")); wxLogError("Failed to gain raw access to bitmap data");
return; return;
} }
@@ -535,7 +535,7 @@ public:
wxNativePixelData data(m_bitmap); wxNativePixelData data(m_bitmap);
if ( !data ) if ( !data )
{ {
wxLogError(wxT("Failed to gain raw access to bitmap data")); wxLogError("Failed to gain raw access to bitmap data");
return; return;
} }
@@ -564,12 +564,12 @@ public:
void OnPaint(wxPaintEvent& WXUNUSED(event)) void OnPaint(wxPaintEvent& WXUNUSED(event))
{ {
wxPaintDC dc( this ); wxPaintDC dc( this );
dc.DrawText(wxT("This is alpha and raw bitmap test"), 0, BORDER); dc.DrawText("This is alpha and raw bitmap test", 0, BORDER);
dc.DrawText(wxT("This is alpha and raw bitmap test"), 0, SIZE/2 - BORDER); dc.DrawText("This is alpha and raw bitmap test", 0, SIZE/2 - BORDER);
dc.DrawText(wxT("This is alpha and raw bitmap test"), 0, SIZE - 2*BORDER); dc.DrawText("This is alpha and raw bitmap test", 0, SIZE - 2*BORDER);
dc.DrawBitmap( m_alphaBitmap, 0, 0, true /* use mask */ ); dc.DrawBitmap( m_alphaBitmap, 0, 0, true /* use mask */ );
dc.DrawText(wxT("Raw bitmap access without alpha"), 0, SIZE+5); dc.DrawText("Raw bitmap access without alpha", 0, SIZE+5);
dc.DrawBitmap( m_bitmap, 0, SIZE+5+dc.GetCharHeight()); dc.DrawBitmap( m_bitmap, 0, SIZE+5+dc.GetCharHeight());
} }
@@ -654,7 +654,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, wxID_ANY, wxT("wxImage sample"), : wxFrame( (wxFrame *)NULL, wxID_ANY, "wxImage sample",
wxPoint(20, 20), wxSize(950, 700) ) wxPoint(20, 20), wxSize(950, 700) )
{ {
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
@@ -662,31 +662,31 @@ MyFrame::MyFrame()
wxMenuBar *menu_bar = new wxMenuBar(); wxMenuBar *menu_bar = new wxMenuBar();
wxMenu *menuImage = new wxMenu; wxMenu *menuImage = new wxMenu;
menuImage->Append( ID_NEW, wxT("&Show any image...\tCtrl-O")); menuImage->Append( ID_NEW, "&Show any image...\tCtrl-O");
menuImage->Append(ID_NEW_HIDPI, wxS("Show any image as &HiDPI...\tCtrl-H")); menuImage->Append(ID_NEW_HIDPI, wxS("Show any image as &HiDPI...\tCtrl-H"));
menuImage->Append( ID_INFO, wxT("Show image &information...\tCtrl-I")); menuImage->Append( ID_INFO, "Show image &information...\tCtrl-I");
#ifdef wxHAVE_RAW_BITMAP #ifdef wxHAVE_RAW_BITMAP
menuImage->AppendSeparator(); menuImage->AppendSeparator();
menuImage->Append( ID_SHOWRAW, wxT("Test &raw bitmap...\tCtrl-R")); menuImage->Append( ID_SHOWRAW, "Test &raw bitmap...\tCtrl-R");
#endif #endif
#if wxUSE_GRAPHICS_CONTEXT #if wxUSE_GRAPHICS_CONTEXT
menuImage->AppendSeparator(); menuImage->AppendSeparator();
menuImage->Append(ID_GRAPHICS, "Test &graphics context...\tCtrl-G"); menuImage->Append(ID_GRAPHICS, "Test &graphics context...\tCtrl-G");
#endif // wxUSE_GRAPHICS_CONTEXT #endif // wxUSE_GRAPHICS_CONTEXT
menuImage->AppendSeparator(); menuImage->AppendSeparator();
menuImage->Append( ID_SHOWTHUMBNAIL, wxT("Test &thumbnail...\tCtrl-T"), menuImage->Append( ID_SHOWTHUMBNAIL, "Test &thumbnail...\tCtrl-T",
"Test scaling the image during load (try with JPEG)"); "Test scaling the image during load (try with JPEG)");
menuImage->AppendSeparator(); menuImage->AppendSeparator();
menuImage->Append( ID_ABOUT, wxT("&About\tF1")); menuImage->Append( ID_ABOUT, "&About\tF1");
menuImage->AppendSeparator(); menuImage->AppendSeparator();
menuImage->Append( ID_QUIT, wxT("E&xit\tCtrl-Q")); menuImage->Append( ID_QUIT, "E&xit\tCtrl-Q");
menu_bar->Append(menuImage, wxT("&Image")); menu_bar->Append(menuImage, "&Image");
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
wxMenu *menuClipboard = new wxMenu; wxMenu *menuClipboard = new wxMenu;
menuClipboard->Append(wxID_COPY, wxT("&Copy test image\tCtrl-C")); menuClipboard->Append(wxID_COPY, "&Copy test image\tCtrl-C");
menuClipboard->Append(wxID_PASTE, wxT("&Paste image\tCtrl-V")); menuClipboard->Append(wxID_PASTE, "&Paste image\tCtrl-V");
menu_bar->Append(menuClipboard, wxT("&Clipboard")); menu_bar->Append(menuClipboard, "&Clipboard");
#endif // wxUSE_CLIPBOARD #endif // wxUSE_CLIPBOARD
SetMenuBar( menu_bar ); SetMenuBar( menu_bar );
@@ -747,12 +747,12 @@ wxString MyFrame::LoadUserImage(wxImage& image)
wxString filename; wxString filename;
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
filename = wxLoadFileSelector(wxT("image"), wxEmptyString); filename = wxLoadFileSelector("image", wxEmptyString);
if ( !filename.empty() ) if ( !filename.empty() )
{ {
if ( !image.LoadFile(filename) ) if ( !image.LoadFile(filename) )
{ {
wxLogError(wxT("Couldn't load image from '%s'."), filename.c_str()); wxLogError("Couldn't load image from '%s'.", filename.c_str());
return wxEmptyString; return wxEmptyString;
} }
@@ -921,7 +921,7 @@ void MyFrame::OnCopy(wxCommandEvent& WXUNUSED(event))
if ( !wxTheClipboard->SetData(dobjBmp) ) if ( !wxTheClipboard->SetData(dobjBmp) )
{ {
wxLogError(wxT("Failed to copy bitmap to clipboard")); wxLogError("Failed to copy bitmap to clipboard");
} }
wxTheClipboard->Close(); wxTheClipboard->Close();
@@ -934,11 +934,11 @@ void MyFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
wxTheClipboard->Open(); wxTheClipboard->Open();
if ( !wxTheClipboard->GetData(dobjBmp) ) if ( !wxTheClipboard->GetData(dobjBmp) )
{ {
wxLogMessage(wxT("No bitmap data in the clipboard")); wxLogMessage("No bitmap data in the clipboard");
} }
else else
{ {
new MyImageFrame(this, wxT("Clipboard"), dobjBmp.GetBitmap()); new MyImageFrame(this, "Clipboard", dobjBmp.GetBitmap());
} }
wxTheClipboard->Close(); wxTheClipboard->Close();
} }
@@ -948,7 +948,7 @@ void MyFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnThumbnail( wxCommandEvent &WXUNUSED(event) ) void MyFrame::OnThumbnail( wxCommandEvent &WXUNUSED(event) )
{ {
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
wxString filename = wxLoadFileSelector(wxT("image"), wxEmptyString, wxEmptyString, this); wxString filename = wxLoadFileSelector("image", wxEmptyString, wxEmptyString, this);
if ( filename.empty() ) if ( filename.empty() )
return; return;
@@ -962,7 +962,7 @@ void MyFrame::OnThumbnail( wxCommandEvent &WXUNUSED(event) )
wxStopWatch sw; wxStopWatch sw;
if ( !image.LoadFile(filename) ) if ( !image.LoadFile(filename) )
{ {
wxLogError(wxT("Couldn't load image from '%s'."), filename.c_str()); wxLogError("Couldn't load image from '%s'.", filename.c_str());
return; return;
} }
@@ -975,7 +975,7 @@ void MyFrame::OnThumbnail( wxCommandEvent &WXUNUSED(event) )
wxLogStatus(frame, "Loaded \"%s\" in %ldms; original size was (%d, %d)", wxLogStatus(frame, "Loaded \"%s\" in %ldms; original size was (%d, %d)",
filename, loadTime, origWidth, origHeight); filename, loadTime, origWidth, origHeight);
#else #else
wxLogError( wxT("Couldn't create file selector dialog") ); wxLogError( "Couldn't create file selector dialog" );
return; return;
#endif // wxUSE_FILEDLG #endif // wxUSE_FILEDLG
} }

View File

@@ -399,7 +399,7 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
{ {
// this message is not translated (not in catalog) because we used wxT() // this message is not translated (not in catalog) because we used wxT()
// and not _() around it // and not _() around it
str = wxT("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

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

View File

@@ -15,7 +15,7 @@
// the default service name // the default service name
#define IPC_SERVICE "4242" #define IPC_SERVICE "4242"
//#define IPC_SERVICE wxT("/tmp/wxsrv424") //#define IPC_SERVICE "/tmp/wxsrv424"
// the hostname // the hostname
#define IPC_HOST "localhost" #define IPC_HOST "localhost"

View File

@@ -54,12 +54,12 @@ bool MyApp::OnInit()
wxJoystick stick(wxJOYSTICK1); wxJoystick stick(wxJOYSTICK1);
if (!stick.IsOk()) if (!stick.IsOk())
{ {
wxMessageBox(wxT("No joystick detected!")); wxMessageBox("No joystick detected!");
return false; return false;
} }
#if wxUSE_SOUND #if wxUSE_SOUND
m_fire.Create(wxT("buttonpress.wav")); m_fire.Create("buttonpress.wav");
#endif // wxUSE_SOUND #endif // wxUSE_SOUND
m_minX = stick.GetXMin(); m_minX = stick.GetXMin();
@@ -69,7 +69,7 @@ bool MyApp::OnInit()
// Create the main frame window // Create the main frame window
frame = new MyFrame(NULL, wxT("Joystick Demo"), wxDefaultPosition, frame = new MyFrame(NULL, "Joystick Demo", wxDefaultPosition,
wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
frame->SetIcon(wxICON(sample)); frame->SetIcon(wxICON(sample));
@@ -77,18 +77,18 @@ bool MyApp::OnInit()
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(JOYTEST_QUIT, wxT("&Exit")); file_menu->Append(JOYTEST_QUIT, "&Exit");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
// Associate the menu bar with the frame // Associate the menu bar with the frame
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->CreateStatusBar(); frame->CreateStatusBar();
frame->SetStatusText(wxString::Format(wxT("Device [%s] (PID:[%i] MID:[%i]) Ready... # of joysticks:[%i]"), stick.GetProductName().c_str(), stick.GetProductId(), stick.GetManufacturerId(), wxJoystick::GetNumberJoysticks())); frame->SetStatusText(wxString::Format("Device [%s] (PID:[%i] MID:[%i]) Ready... # of joysticks:[%i]", stick.GetProductName().c_str(), stick.GetProductId(), stick.GetManufacturerId(), wxJoystick::GetNumberJoysticks()));
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
frame->CenterOnScreen(); frame->CenterOnScreen();
@@ -159,15 +159,15 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
wxString buf; wxString buf;
if (event.ButtonDown()) if (event.ButtonDown())
buf.Printf(wxT("Joystick (%ld, %ld) #%i Fire!"), xpos, ypos, event.GetButtonChange()); buf.Printf("Joystick (%ld, %ld) #%i Fire!", xpos, ypos, event.GetButtonChange());
else else
buf.Printf(wxT("Joystick (%ld, %ld) "), xpos, ypos); buf.Printf("Joystick (%ld, %ld) ", xpos, ypos);
/* /*
for(int i = 0; i < nButtons; ++i) for(int i = 0; i < nButtons; ++i)
{ {
buf += wxString(wxT("[")) + buf += wxString("[") +
((event.GetButtonState() & (1 << i)) ? wxT("Y") : wxT("N")) + wxString(wxT("]")); ((event.GetButtonState() & (1 << i)) ? "Y" : "N") + wxString("]");
} }
*/ */

View File

@@ -77,38 +77,38 @@ wxEND_EVENT_TABLE()
// Define my frame constructor // Define my frame constructor
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, wxT("wxWidgets Layout Demo")) : wxFrame(NULL, wxID_ANY, "wxWidgets Layout Demo")
{ {
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(LAYOUT_TEST_PROPORTIONS, wxT("&Proportions demo...\tF1")); file_menu->Append(LAYOUT_TEST_PROPORTIONS, "&Proportions demo...\tF1");
file_menu->Append(LAYOUT_TEST_SIZER, wxT("Test wx&FlexSizer...\tF2")); file_menu->Append(LAYOUT_TEST_SIZER, "Test wx&FlexSizer...\tF2");
file_menu->Append(LAYOUT_TEST_NB_SIZER, wxT("Test &notebook sizers...\tF3")); file_menu->Append(LAYOUT_TEST_NB_SIZER, "Test &notebook sizers...\tF3");
file_menu->Append(LAYOUT_TEST_GB_SIZER, wxT("Test &gridbag sizer...\tF4")); file_menu->Append(LAYOUT_TEST_GB_SIZER, "Test &gridbag sizer...\tF4");
file_menu->Append(LAYOUT_TEST_SET_MINIMAL, wxT("Test Set&ItemMinSize...\tF5")); file_menu->Append(LAYOUT_TEST_SET_MINIMAL, "Test Set&ItemMinSize...\tF5");
file_menu->Append(LAYOUT_TEST_NESTED, wxT("Test nested sizer in a wxPanel...\tF6")); file_menu->Append(LAYOUT_TEST_NESTED, "Test nested sizer in a wxPanel...\tF6");
file_menu->Append(LAYOUT_TEST_WRAP, wxT("Test wrap sizers...\tF7")); file_menu->Append(LAYOUT_TEST_WRAP, "Test wrap sizers...\tF7");
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(LAYOUT_QUIT, wxT("E&xit"), wxT("Quit program")); file_menu->Append(LAYOUT_QUIT, "E&xit", "Quit program");
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append(LAYOUT_ABOUT, wxT("&About"), wxT("About layout demo...")); help_menu->Append(LAYOUT_ABOUT, "&About", "About layout demo...");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
menu_bar->Append(help_menu, wxT("&Help")); menu_bar->Append(help_menu, "&Help");
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("wxWidgets layout demo")); SetStatusText("wxWidgets layout demo");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
wxPanel* p = new wxPanel(this, wxID_ANY); wxPanel* p = new wxPanel(this, wxID_ANY);
@@ -121,25 +121,25 @@ MyFrame::MyFrame()
// 1) top: create wxStaticText with minimum size equal to its default size // 1) top: create wxStaticText with minimum size equal to its default size
topsizer->Add( topsizer->Add(
new wxStaticText( p, wxID_ANY, wxT("An explanation (wxALIGN_RIGHT).") ), new wxStaticText( p, wxID_ANY, "An explanation (wxALIGN_RIGHT)." ),
wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxALL & ~wxBOTTOM, 5)); wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxALL & ~wxBOTTOM, 5));
topsizer->Add( topsizer->Add(
new wxStaticText( p, wxID_ANY, wxT("An explanation (wxALIGN_LEFT).") ), new wxStaticText( p, wxID_ANY, "An explanation (wxALIGN_LEFT)." ),
wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5)); wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
topsizer->Add( topsizer->Add(
new wxStaticText( p, wxID_ANY, wxT("An explanation (wxALIGN_CENTRE_HORIZONTAL).") ), new wxStaticText( p, wxID_ANY, "An explanation (wxALIGN_CENTRE_HORIZONTAL)." ),
wxSizerFlags().Align(wxALIGN_CENTRE_HORIZONTAL).Border(wxALL & ~wxBOTTOM, 5)); wxSizerFlags().Align(wxALIGN_CENTRE_HORIZONTAL).Border(wxALL & ~wxBOTTOM, 5));
// 2) top: create wxTextCtrl with minimum size (100x60) // 2) top: create wxTextCtrl with minimum size (100x60)
topsizer->Add( topsizer->Add(
new wxTextCtrl( p, wxID_ANY, wxT("My text (wxEXPAND)."), wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE), new wxTextCtrl( p, wxID_ANY, "My text (wxEXPAND).", wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
wxSizerFlags(1).Expand().Border(wxALL, 5)); wxSizerFlags(1).Expand().Border(wxALL, 5));
// 2.5) Gratuitous test of wxStaticBoxSizers // 2.5) Gratuitous test of wxStaticBoxSizers
wxBoxSizer *statsizer = new wxStaticBoxSizer( wxBoxSizer *statsizer = new wxStaticBoxSizer(
new wxStaticBox(p, wxID_ANY, wxT("A wxStaticBoxSizer")), wxVERTICAL ); new wxStaticBox(p, wxID_ANY, "A wxStaticBoxSizer"), wxVERTICAL );
statsizer->Add( statsizer->Add(
new wxStaticText(p, wxID_ANY, wxT("And some TEXT inside it")), new wxStaticText(p, wxID_ANY, "And some TEXT inside it"),
wxSizerFlags().Border(wxALL, 30)); wxSizerFlags().Border(wxALL, 30));
topsizer->Add( topsizer->Add(
statsizer, statsizer,
@@ -147,17 +147,17 @@ MyFrame::MyFrame()
// 2.7) And a test of wxGridSizer // 2.7) And a test of wxGridSizer
wxGridSizer *gridsizer = new wxGridSizer(2, 5, 5); wxGridSizer *gridsizer = new wxGridSizer(2, 5, 5);
gridsizer->Add(new wxStaticText(p, wxID_ANY, wxT("Label")), gridsizer->Add(new wxStaticText(p, wxID_ANY, "Label"),
wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL)); wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxTextCtrl(p, wxID_ANY, wxT("Grid sizer demo")), gridsizer->Add(new wxTextCtrl(p, wxID_ANY, "Grid sizer demo"),
wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL)); wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxStaticText(p, wxID_ANY, wxT("Another label")), gridsizer->Add(new wxStaticText(p, wxID_ANY, "Another label"),
wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL)); wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxTextCtrl(p, wxID_ANY, wxT("More text")), gridsizer->Add(new wxTextCtrl(p, wxID_ANY, "More text"),
wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL)); wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxStaticText(p, wxID_ANY, wxT("Final label")), gridsizer->Add(new wxStaticText(p, wxID_ANY, "Final label"),
wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL)); wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxTextCtrl(p, wxID_ANY, wxT("And yet more text")), gridsizer->Add(new wxTextCtrl(p, wxID_ANY, "And yet more text"),
wxSizerFlags().Align(wxGROW | wxALIGN_CENTER_VERTICAL)); wxSizerFlags().Align(wxGROW | wxALIGN_CENTER_VERTICAL));
topsizer->Add( topsizer->Add(
gridsizer, gridsizer,
@@ -175,10 +175,10 @@ MyFrame::MyFrame()
// 4) bottom: create two centred wxButtons // 4) bottom: create two centred wxButtons
wxBoxSizer *button_box = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *button_box = new wxBoxSizer( wxHORIZONTAL );
button_box->Add( button_box->Add(
new wxButton( p, wxID_ANY, wxT("Two buttons in a box") ), new wxButton( p, wxID_ANY, "Two buttons in a box" ),
wxSizerFlags().Border(wxALL, 7)); wxSizerFlags().Border(wxALL, 7));
button_box->Add( button_box->Add(
new wxButton( p, wxID_ANY, wxT("(wxCENTER)") ), new wxButton( p, wxID_ANY, "(wxCENTER)" ),
wxSizerFlags().Border(wxALL, 7)); wxSizerFlags().Border(wxALL, 7));
topsizer->Add(button_box, wxSizerFlags().Center()); topsizer->Add(button_box, wxSizerFlags().Center());
@@ -207,7 +207,7 @@ void MyFrame::TestFlexSizers(wxCommandEvent& WXUNUSED(event) )
void MyFrame::TestNotebookSizers(wxCommandEvent& WXUNUSED(event) ) void MyFrame::TestNotebookSizers(wxCommandEvent& WXUNUSED(event) )
{ {
MySizerDialog dialog( this, wxT("Notebook Sizer Test Dialog") ); MySizerDialog dialog( this, "Notebook Sizer Test Dialog" );
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -230,8 +230,8 @@ void MyFrame::TestWrap(wxCommandEvent& WXUNUSED(event) )
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{ {
(void)wxMessageBox(wxT("wxWidgets GUI library layout demo\n"), (void)wxMessageBox("wxWidgets GUI library layout demo\n",
wxT("About Layout Demo"), wxOK|wxICON_INFORMATION); "About Layout Demo", wxOK|wxICON_INFORMATION);
} }
void MyFrame::TestGridBagSizer(wxCommandEvent& WXUNUSED(event) ) void MyFrame::TestGridBagSizer(wxCommandEvent& WXUNUSED(event) )
@@ -244,7 +244,7 @@ void MyFrame::TestGridBagSizer(wxCommandEvent& WXUNUSED(event) )
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
MyProportionsFrame::MyProportionsFrame(wxFrame *parent) MyProportionsFrame::MyProportionsFrame(wxFrame *parent)
: wxFrame(parent, wxID_ANY, wxT("Box Sizer Proportions Demo")) : wxFrame(parent, wxID_ANY, "Box Sizer Proportions Demo")
{ {
size_t n; size_t n;
@@ -258,7 +258,7 @@ MyProportionsFrame::MyProportionsFrame(wxFrame *parent)
// lay them out // lay them out
m_sizer = new wxStaticBoxSizer(wxHORIZONTAL, panel, m_sizer = new wxStaticBoxSizer(wxHORIZONTAL, panel,
wxT("Try changing elements proportions and resizing the window")); "Try changing elements proportions and resizing the window");
for ( n = 0; n < WXSIZEOF(m_spins); n++ ) for ( n = 0; n < WXSIZEOF(m_spins); n++ )
m_sizer->Add(m_spins[n], wxSizerFlags().Border()); m_sizer->Add(m_spins[n], wxSizerFlags().Border());
@@ -326,24 +326,24 @@ MyFlexSizerFrame::MyFlexSizerFrame(wxFrame* parent)
// consttuct the first column // consttuct the first column
wxSizer *sizerCol1 = new wxBoxSizer(wxVERTICAL); wxSizer *sizerCol1 = new wxBoxSizer(wxVERTICAL);
sizerCol1->Add(new wxStaticText(p, wxID_ANY, wxT("Ungrowable:")), 0, wxCENTER | wxTOP, 20); sizerCol1->Add(new wxStaticText(p, wxID_ANY, "Ungrowable:"), 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);
sizerCol1->Add(sizerFlex, 1, wxALL | wxEXPAND, 10); sizerCol1->Add(sizerFlex, 1, wxALL | wxEXPAND, 10);
sizerCol1->Add(new wxStaticText(p, wxID_ANY, wxT("Growable middle column:")), 0, wxCENTER | wxTOP, 20); sizerCol1->Add(new wxStaticText(p, wxID_ANY, "Growable middle column:"), 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);
sizerCol1->Add(sizerFlex, 1, wxALL | wxEXPAND, 10); sizerCol1->Add(sizerFlex, 1, wxALL | wxEXPAND, 10);
sizerCol1->Add(new wxStaticText(p, wxID_ANY, wxT("Growable middle row:")), 0, wxCENTER | wxTOP, 20); sizerCol1->Add(new wxStaticText(p, wxID_ANY, "Growable middle row:"), 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->AddGrowableRow(1); sizerFlex->AddGrowableRow(1);
sizerCol1->Add(sizerFlex, 1, wxALL | wxEXPAND, 10); sizerCol1->Add(sizerFlex, 1, wxALL | wxEXPAND, 10);
sizerCol1->Add(new wxStaticText(p, wxID_ANY, wxT("All growable columns:")), 0, wxCENTER | wxTOP, 20); sizerCol1->Add(new wxStaticText(p, wxID_ANY, "All growable columns:"), 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(0, 1); sizerFlex->AddGrowableCol(0, 1);
@@ -353,14 +353,14 @@ MyFlexSizerFrame::MyFlexSizerFrame(wxFrame* parent)
// the second one // the second one
wxSizer *sizerCol2 = new wxBoxSizer(wxVERTICAL); wxSizer *sizerCol2 = new wxBoxSizer(wxVERTICAL);
sizerCol2->Add(new wxStaticText(p, wxID_ANY, wxT("Growable middle row and column:")), 0, wxCENTER | wxTOP, 20); sizerCol2->Add(new wxStaticText(p, wxID_ANY, "Growable middle row and column:"), 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);
sizerFlex->AddGrowableRow(1); sizerFlex->AddGrowableRow(1);
sizerCol2->Add(sizerFlex, 1, wxALL | wxEXPAND, 10); sizerCol2->Add(sizerFlex, 1, wxALL | wxEXPAND, 10);
sizerCol2->Add(new wxStaticText(p, wxID_ANY, wxT("Same with horz flex direction")), 0, wxCENTER | wxTOP, 20); sizerCol2->Add(new wxStaticText(p, wxID_ANY, "Same with horz flex direction"), 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);
@@ -410,24 +410,24 @@ MySizerDialog::MySizerDialog(wxWindow *parent, const wxString &title)
wxNotebook *notebook = new wxNotebook( this, wxID_ANY ); wxNotebook *notebook = new wxNotebook( this, wxID_ANY );
topsizer->Add( notebook, 1, wxGROW ); topsizer->Add( notebook, 1, wxGROW );
wxButton *button = new wxButton( this, wxID_OK, wxT("OK") ); wxButton *button = new wxButton( this, wxID_OK, "OK" );
topsizer->Add( button, 0, wxALIGN_RIGHT | wxALL, 10 ); topsizer->Add( button, 0, wxALIGN_RIGHT | wxALL, 10 );
// First page: one big text ctrl // First page: one big text ctrl
wxTextCtrl *multi = new wxTextCtrl( notebook, wxID_ANY, wxT("TextCtrl."), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); wxTextCtrl *multi = new wxTextCtrl( notebook, wxID_ANY, "TextCtrl.", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
notebook->AddPage( multi, wxT("Page One") ); notebook->AddPage( multi, "Page One" );
// Second page: a text ctrl and a button // Second page: a text ctrl and a button
wxPanel *panel = new wxPanel( notebook, wxID_ANY ); wxPanel *panel = new wxPanel( notebook, wxID_ANY );
notebook->AddPage( panel, wxT("Page Two") ); notebook->AddPage( panel, "Page Two" );
wxSizer *panelsizer = new wxBoxSizer( wxVERTICAL ); wxSizer *panelsizer = new wxBoxSizer( wxVERTICAL );
wxTextCtrl *text = new wxTextCtrl( panel, wxID_ANY, wxT("TextLine 1."), wxDefaultPosition, wxSize(250,wxDefaultCoord) ); wxTextCtrl *text = new wxTextCtrl( panel, wxID_ANY, "TextLine 1.", wxDefaultPosition, wxSize(250,wxDefaultCoord) );
panelsizer->Add( text, 0, wxGROW|wxALL, 30 ); panelsizer->Add( text, 0, wxGROW|wxALL, 30 );
text = new wxTextCtrl( panel, wxID_ANY, wxT("TextLine 2."), wxDefaultPosition, wxSize(250,wxDefaultCoord) ); text = new wxTextCtrl( panel, wxID_ANY, "TextLine 2.", wxDefaultPosition, wxSize(250,wxDefaultCoord) );
panelsizer->Add( text, 0, wxGROW|wxALL, 30 ); panelsizer->Add( text, 0, wxGROW|wxALL, 30 );
wxButton *button2 = new wxButton( panel, wxID_ANY, wxT("Hallo") ); wxButton *button2 = new wxButton( panel, wxID_ANY, "Hallo" );
panelsizer->Add( button2, 0, wxALIGN_RIGHT | wxLEFT|wxRIGHT|wxBOTTOM, 30 ); panelsizer->Add( button2, 0, wxALIGN_RIGHT | wxLEFT|wxRIGHT|wxBOTTOM, 30 );
panel->SetSizer( panelsizer ); panel->SetSizer( panelsizer );
@@ -499,19 +499,19 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(wxFrame* parent)
//m_gbs->Add( TEXTCTRL("bad position"), POS(5,3) ); // Test for assert //m_gbs->Add( TEXTCTRL("bad position"), POS(5,3) ); // Test for assert
m_moveBtn1 = new wxButton(p, GBS_MOVE_BTN1, wxT("Move this to (3,6)")); m_moveBtn1 = new wxButton(p, GBS_MOVE_BTN1, "Move this to (3,6)");
m_moveBtn2 = new wxButton(p, GBS_MOVE_BTN2, wxT("Move this to (3,6)")); m_moveBtn2 = new wxButton(p, GBS_MOVE_BTN2, "Move this to (3,6)");
m_gbs->Add( m_moveBtn1, POS(10,2) ); m_gbs->Add( m_moveBtn1, POS(10,2) );
m_gbs->Add( m_moveBtn2, POS(10,3) ); m_gbs->Add( m_moveBtn2, POS(10,3) );
m_hideBtn = new wxButton(p, GBS_HIDE_BTN, wxT("Hide this item -->")); m_hideBtn = new wxButton(p, GBS_HIDE_BTN, "Hide this item -->");
m_gbs->Add(m_hideBtn, POS(12, 3)); m_gbs->Add(m_hideBtn, POS(12, 3));
m_hideTxt = new wxTextCtrl(p, wxID_ANY, wxT("pos(12,4), size(150, wxDefaultCoord)"), m_hideTxt = new wxTextCtrl(p, wxID_ANY, "pos(12,4), size(150, wxDefaultCoord)",
wxDefaultPosition, wxSize(150,wxDefaultCoord)); wxDefaultPosition, wxSize(150,wxDefaultCoord));
m_gbs->Add( m_hideTxt, POS(12,4) ); m_gbs->Add( m_hideTxt, POS(12,4) );
m_showBtn = new wxButton(p, GBS_SHOW_BTN, wxT("<-- Show it again")); m_showBtn = new wxButton(p, GBS_SHOW_BTN, "<-- Show it again");
m_gbs->Add(m_showBtn, POS(12, 5)); m_gbs->Add(m_showBtn, POS(12, 5));
m_showBtn->Disable(); m_showBtn->Disable();
@@ -551,7 +551,7 @@ void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent& event)
if (curPos == wxGBPosition(3,6)) if (curPos == wxGBPosition(3,6))
{ {
m_gbs->SetItemPosition(btn, m_lastPos); m_gbs->SetItemPosition(btn, m_lastPos);
btn->SetLabel(wxT("Move this to (3,6)")); btn->SetLabel("Move this to (3,6)");
} }
else else
{ {
@@ -559,12 +559,12 @@ void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent& event)
wxMessageBox( wxMessageBox(
wxT("wxGridBagSizer will not allow items to be in the same cell as\n\ wxT("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."), wxT("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)) )
{ {
m_lastPos = curPos; m_lastPos = curPos;
btn->SetLabel(wxT("Move it back")); btn->SetLabel("Move it back");
} }
} }
m_gbs->Layout(); m_gbs->Layout();
@@ -590,11 +590,11 @@ MySimpleSizerFrame::MySimpleSizerFrame(wxFrame* parent)
{ {
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
menu->Append(ID_SET_SMALL, wxT("Make text control small\tF4")); menu->Append(ID_SET_SMALL, "Make text control small\tF4");
menu->Append(ID_SET_BIG, wxT("Make text control big\tF5")); menu->Append(ID_SET_BIG, "Make text control big\tF5");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(menu, wxT("&File")); menu_bar->Append(menu, "&File");
SetMenuBar( menu_bar ); SetMenuBar( menu_bar );
@@ -603,7 +603,7 @@ MySimpleSizerFrame::MySimpleSizerFrame(wxFrame* parent)
m_target = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, wxDefaultCoord ) ); m_target = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, wxDefaultCoord ) );
main_sizer->Add( m_target, 1, wxALL, 5 ); main_sizer->Add( m_target, 1, wxALL, 5 );
main_sizer->Add( new wxStaticText( this, wxID_ANY, wxT("Set alternating sizes using F4 and F5") ), 0, wxALL, 5 ); main_sizer->Add( new wxStaticText( this, wxID_ANY, "Set alternating sizes using F4 and F5" ), 0, wxALL, 5 );
SetSizer( main_sizer); SetSizer( main_sizer);
@@ -636,30 +636,30 @@ MyNestedSizerFrame::MyNestedSizerFrame(wxFrame* parent)
{ {
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
menu->Append(wxID_ABOUT, wxT("Do nothing")); menu->Append(wxID_ABOUT, "Do nothing");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(menu, wxT("&File")); menu_bar->Append(menu, "&File");
SetMenuBar( menu_bar ); SetMenuBar( menu_bar );
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
main_sizer->Add( new wxStaticText( this, -1, wxT("Hello outside") ), 0, wxALIGN_CENTER ); main_sizer->Add( new wxStaticText( this, -1, "Hello outside" ), 0, wxALIGN_CENTER );
main_sizer->Add( new wxStaticText( this, -1, wxT("Hello outside") ), 0, wxALIGN_CENTER ); main_sizer->Add( new wxStaticText( this, -1, "Hello outside" ), 0, wxALIGN_CENTER );
main_sizer->Add( new wxStaticText( this, -1, wxT("Hello outside") ), 0, wxALIGN_CENTER ); main_sizer->Add( new wxStaticText( this, -1, "Hello outside" ), 0, wxALIGN_CENTER );
main_sizer->Add( new wxStaticText( this, -1, wxT("Hello outside") ), 0, wxALIGN_CENTER ); main_sizer->Add( new wxStaticText( this, -1, "Hello outside" ), 0, wxALIGN_CENTER );
wxPanel *panel = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize, wxPanel *panel = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL | wxSUNKEN_BORDER ); wxTAB_TRAVERSAL | wxSUNKEN_BORDER );
main_sizer->Add( panel, 0, wxALIGN_CENTER ); main_sizer->Add( panel, 0, wxALIGN_CENTER );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel->SetSizer( panel_sizer ); panel->SetSizer( panel_sizer );
panel_sizer->Add( new wxStaticText( panel, -1, wxT("Hello inside") ) ); panel_sizer->Add( new wxStaticText( panel, -1, "Hello inside" ) );
panel_sizer->Add( new wxStaticText( panel, -1, wxT("Hello inside") ) ); panel_sizer->Add( new wxStaticText( panel, -1, "Hello inside" ) );
panel_sizer->Add( new wxStaticText( panel, -1, wxT("Hello inside") ) ); panel_sizer->Add( new wxStaticText( panel, -1, "Hello inside" ) );
main_sizer->Add( new wxStaticText( this, -1, wxT("Hello outside") ), 0, wxALIGN_CENTER ); main_sizer->Add( new wxStaticText( this, -1, "Hello outside" ), 0, wxALIGN_CENTER );
m_target = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, wxDefaultCoord ) ); m_target = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, wxDefaultCoord ) );
main_sizer->Add( m_target, 1, wxALL|wxGROW, 5 ); main_sizer->Add( m_target, 1, wxALL|wxGROW, 5 );

View File

@@ -307,7 +307,7 @@ public:
kNewItem.SetData(new wxString(szString)); kNewItem.SetData(new wxString(szString));
this->InsertItem(kNewItem); this->InsertItem(kNewItem);
this->SetItem(nID, 0, wxT("*")); this->SetItem(nID, 0, "*");
this->SetItem(nID, 1, wxFileName(szString).GetName()); this->SetItem(nID, 1, wxFileName(szString).GetName());
if (nID % 2) if (nID % 2)
@@ -381,17 +381,17 @@ public:
// Converts a wxMediaCtrl state into something useful that we can display // Converts a wxMediaCtrl state into something useful that we can display
// to the user // to the user
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const wxChar* wxGetMediaStateText(int nState) const wxString wxGetMediaStateText(int nState)
{ {
switch(nState) switch(nState)
{ {
case wxMEDIASTATE_PLAYING: case wxMEDIASTATE_PLAYING:
return wxT("Playing"); return "Playing";
case wxMEDIASTATE_STOPPED: case wxMEDIASTATE_STOPPED:
return wxT("Stopped"); return "Stopped";
///case wxMEDIASTATE_PAUSED: ///case wxMEDIASTATE_PAUSED:
default: default:
return wxT("Paused"); return "Paused";
} }
} }
@@ -456,10 +456,10 @@ bool wxMediaPlayerApp::OnInit()
return false; return false;
// SetAppName() lets wxConfig and others know where to write // SetAppName() lets wxConfig and others know where to write
SetAppName(wxT("wxMediaPlayer")); SetAppName("wxMediaPlayer");
wxMediaPlayerFrame *frame = wxMediaPlayerFrame *frame =
new wxMediaPlayerFrame(wxT("MediaPlayer wxWidgets Sample")); new wxMediaPlayerFrame("MediaPlayer wxWidgets Sample");
frame->Show(true); frame->Show(true);
#if wxUSE_CMDLINE_PARSER #if wxUSE_CMDLINE_PARSER
@@ -516,50 +516,50 @@ wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title)
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
wxMenu *debugMenu = new wxMenu; wxMenu *debugMenu = new wxMenu;
fileMenu->Append(wxID_OPENFILESAMEPAGE, wxT("&Open File\tCtrl-Shift-O"), fileMenu->Append(wxID_OPENFILESAMEPAGE, "&Open File\tCtrl-Shift-O",
wxT("Open a File in the current notebook page")); "Open a File in the current notebook page");
fileMenu->Append(wxID_OPENFILENEWPAGE, wxT("&Open File in a new page"), fileMenu->Append(wxID_OPENFILENEWPAGE, "&Open File in a new page",
wxT("Open a File in a new notebook page")); "Open a File in a new notebook page");
fileMenu->Append(wxID_OPENURLSAMEPAGE, wxT("&Open URL"), fileMenu->Append(wxID_OPENURLSAMEPAGE, "&Open URL",
wxT("Open a URL in the current notebook page")); "Open a URL in the current notebook page");
fileMenu->Append(wxID_OPENURLNEWPAGE, wxT("&Open URL in a new page"), fileMenu->Append(wxID_OPENURLNEWPAGE, "&Open URL in a new page",
wxT("Open a URL in a new notebook page")); "Open a URL in a new notebook page");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(wxID_CLOSECURRENTPAGE, wxT("&Close Current Page\tCtrl-C"), fileMenu->Append(wxID_CLOSECURRENTPAGE, "&Close Current Page\tCtrl-C",
wxT("Close current notebook page")); "Close current notebook page");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, fileMenu->Append(wxID_EXIT,
wxT("E&xit\tAlt-X"), "E&xit\tAlt-X",
wxT("Quit this program")); "Quit this program");
controlsMenu->Append(wxID_PLAY, wxT("&Play/Pause\tCtrl-P"), wxT("Resume/Pause playback")); controlsMenu->Append(wxID_PLAY, "&Play/Pause\tCtrl-P", "Resume/Pause playback");
controlsMenu->Append(wxID_STOP, wxT("&Stop\tCtrl-S"), wxT("Stop playback")); controlsMenu->Append(wxID_STOP, "&Stop\tCtrl-S", "Stop playback");
controlsMenu->AppendSeparator(); controlsMenu->AppendSeparator();
controlsMenu->Append(wxID_PREV, wxT("&Previous\tCtrl-B"), wxT("Go to previous track")); controlsMenu->Append(wxID_PREV, "&Previous\tCtrl-B", "Go to previous track");
controlsMenu->Append(wxID_NEXT, wxT("&Next\tCtrl-N"), wxT("Skip to next track")); controlsMenu->Append(wxID_NEXT, "&Next\tCtrl-N", "Skip to next track");
optionsMenu->AppendCheckItem(wxID_LOOP, optionsMenu->AppendCheckItem(wxID_LOOP,
wxT("&Loop\tCtrl-L"), "&Loop\tCtrl-L",
wxT("Loop Selected Media")); "Loop Selected Media");
optionsMenu->AppendCheckItem(wxID_SHOWINTERFACE, optionsMenu->AppendCheckItem(wxID_SHOWINTERFACE,
wxT("&Show Interface\tCtrl-I"), "&Show Interface\tCtrl-I",
wxT("Show wxMediaCtrl native controls")); "Show wxMediaCtrl native controls");
debugMenu->Append(wxID_SELECTBACKEND, debugMenu->Append(wxID_SELECTBACKEND,
wxT("&Select Backend...\tCtrl-D"), "&Select Backend...\tCtrl-D",
wxT("Select a backend manually")); "Select a backend manually");
helpMenu->Append(wxID_ABOUT, helpMenu->Append(wxID_ABOUT,
wxT("&About\tF1"), "&About\tF1",
wxT("Show about dialog")); "Show about dialog");
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(fileMenu, "&File");
menuBar->Append(controlsMenu, wxT("&Controls")); menuBar->Append(controlsMenu, "&Controls");
menuBar->Append(optionsMenu, wxT("&Options")); menuBar->Append(optionsMenu, "&Options");
menuBar->Append(debugMenu, wxT("&Debug")); menuBar->Append(debugMenu, "&Debug");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
SetMenuBar(menuBar); SetMenuBar(menuBar);
// //
@@ -633,7 +633,7 @@ wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title)
wxMediaPlayerNotebookPage* page = wxMediaPlayerNotebookPage* page =
new wxMediaPlayerNotebookPage(this, m_notebook); new wxMediaPlayerNotebookPage(this, m_notebook);
m_notebook->AddPage(page, m_notebook->AddPage(page,
wxT(""), "",
true); true);
@@ -760,24 +760,24 @@ void wxMediaPlayerFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void wxMediaPlayerFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void wxMediaPlayerFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is a test of wxMediaCtrl.\n\n") msg.Printf( "This is a test of wxMediaCtrl.\n\n"
wxT("Instructions:\n") "Instructions:\n"
wxT("The top slider shows the current the current position, ") "The top slider shows the current the current position, "
wxT("which you can change by dragging and releasing it.\n") "which you can change by dragging and releasing it.\n"
wxT("The gauge (progress bar) shows the progress in ") "The gauge (progress bar) shows the progress in "
wxT("downloading data of the current file - it may always be ") "downloading data of the current file - it may always be "
wxT("empty due to lack of support from the current backend.\n") "empty due to lack of support from the current backend.\n"
wxT("The lower-left slider controls the volume and the lower-") "The lower-left slider controls the volume and the lower-"
wxT("right slider controls the playback rate/speed of the ") "right slider controls the playback rate/speed of the "
wxT("media\n\n") "media\n\n"
wxT("Currently using: %s"), wxVERSION_STRING); "Currently using: %s", wxVERSION_STRING);
wxMessageBox(msg, wxT("About wxMediaCtrl test"), wxMessageBox(msg, "About wxMediaCtrl test",
wxOK | wxICON_INFORMATION, this); wxOK | wxICON_INFORMATION, this);
} }
@@ -816,9 +816,9 @@ void wxMediaPlayerFrame::OnShowInterface(wxCommandEvent& event)
pSIItem->Check(!event.IsChecked()); pSIItem->Check(!event.IsChecked());
if(event.IsChecked()) if(event.IsChecked())
wxMessageBox(wxT("Could not show player controls")); wxMessageBox("Could not show player controls");
else else
wxMessageBox(wxT("Could not hide player controls")); wxMessageBox("Could not hide player controls");
} }
} }
@@ -894,7 +894,7 @@ void wxMediaPlayerFrame::DoOpenFile(const wxString& path, bool bNewPage)
newlistitem.SetData(new wxString(path)); newlistitem.SetData(new wxString(path));
currentpage->m_playlist->InsertItem(newlistitem); currentpage->m_playlist->InsertItem(newlistitem);
currentpage->m_playlist->SetItem(nID, 0, wxT("*")); currentpage->m_playlist->SetItem(nID, 0, "*");
currentpage->m_playlist->SetItem(nID, 1, wxFileName(path).GetName()); currentpage->m_playlist->SetItem(nID, 1, wxFileName(path).GetName());
if (nID % 2) if (nID % 2)
@@ -931,12 +931,12 @@ void wxMediaPlayerFrame::DoPlayFile(const wxString& path)
if(currentpage->m_mediactrl->GetState() == wxMEDIASTATE_PLAYING) if(currentpage->m_mediactrl->GetState() == wxMEDIASTATE_PLAYING)
{ {
if( !currentpage->m_mediactrl->Pause() ) if( !currentpage->m_mediactrl->Pause() )
wxMessageBox(wxT("Couldn't pause movie!")); wxMessageBox("Couldn't pause movie!");
} }
else else
{ {
if( !currentpage->m_mediactrl->Play() ) if( !currentpage->m_mediactrl->Play() )
wxMessageBox(wxT("Couldn't play movie!")); wxMessageBox("Couldn't play movie!");
} }
} }
else else
@@ -948,31 +948,31 @@ void wxMediaPlayerFrame::DoPlayFile(const wxString& path)
if(currentpage->m_nLastFileId != -1) if(currentpage->m_nLastFileId != -1)
currentpage->m_playlist->SetItem( currentpage->m_playlist->SetItem(
currentpage->m_nLastFileId, 0, wxT("*")); currentpage->m_nLastFileId, 0, "*");
wxURI uripath(path); wxURI uripath(path);
if( uripath.IsReference() ) if( uripath.IsReference() )
{ {
if( !currentpage->m_mediactrl->Load(path) ) if( !currentpage->m_mediactrl->Load(path) )
{ {
wxMessageBox(wxT("Couldn't load file!")); wxMessageBox("Couldn't load file!");
currentpage->m_playlist->SetItem(nNewId, 0, wxT("E")); currentpage->m_playlist->SetItem(nNewId, 0, "E");
} }
else else
{ {
currentpage->m_playlist->SetItem(nNewId, 0, wxT("O")); currentpage->m_playlist->SetItem(nNewId, 0, "O");
} }
} }
else else
{ {
if( !currentpage->m_mediactrl->Load(uripath) ) if( !currentpage->m_mediactrl->Load(uripath) )
{ {
wxMessageBox(wxT("Couldn't load URL!")); wxMessageBox("Couldn't load URL!");
currentpage->m_playlist->SetItem(nNewId, 0, wxT("E")); currentpage->m_playlist->SetItem(nNewId, 0, "E");
} }
else else
{ {
currentpage->m_playlist->SetItem(nNewId, 0, wxT("O")); currentpage->m_playlist->SetItem(nNewId, 0, "O");
} }
} }
@@ -981,7 +981,7 @@ void wxMediaPlayerFrame::DoPlayFile(const wxString& path)
currentpage->m_playlist->SetItem(currentpage->m_nLastFileId, currentpage->m_playlist->SetItem(currentpage->m_nLastFileId,
1, wxFileName(path).GetName()); 1, wxFileName(path).GetName());
currentpage->m_playlist->SetItem(currentpage->m_nLastFileId, currentpage->m_playlist->SetItem(currentpage->m_nLastFileId,
2, wxT("")); 2, "");
} }
} }
@@ -998,12 +998,12 @@ void wxMediaPlayerFrame::OnMediaLoaded(wxMediaEvent& WXUNUSED(evt))
if( !currentpage->m_mediactrl->Play() ) if( !currentpage->m_mediactrl->Play() )
{ {
wxMessageBox(wxT("Couldn't play movie!")); wxMessageBox("Couldn't play movie!");
currentpage->m_playlist->SetItem(currentpage->m_nLastFileId, 0, wxT("E")); currentpage->m_playlist->SetItem(currentpage->m_nLastFileId, 0, "E");
} }
else else
{ {
currentpage->m_playlist->SetItem(currentpage->m_nLastFileId, 0, wxT(">")); currentpage->m_playlist->SetItem(currentpage->m_nLastFileId, 0, ">");
} }
} }
@@ -1018,7 +1018,7 @@ void wxMediaPlayerFrame::OnMediaLoaded(wxMediaEvent& WXUNUSED(evt))
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxMediaPlayerFrame::OnSelectBackend(wxCommandEvent& WXUNUSED(evt)) void wxMediaPlayerFrame::OnSelectBackend(wxCommandEvent& WXUNUSED(evt))
{ {
wxString sBackend = wxGetTextFromUser(wxT("Enter backend to use")); wxString sBackend = wxGetTextFromUser("Enter backend to use");
if(sBackend.empty() == false) // could have been cancelled by the user if(sBackend.empty() == false) // could have been cancelled by the user
{ {
@@ -1031,7 +1031,7 @@ void wxMediaPlayerFrame::OnSelectBackend(wxCommandEvent& WXUNUSED(evt))
m_notebook->AddPage(new wxMediaPlayerNotebookPage(this, m_notebook, m_notebook->AddPage(new wxMediaPlayerNotebookPage(this, m_notebook,
sBackend sBackend
), wxT(""), true); ), "", true);
DoOpenFile( DoOpenFile(
((wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage())->m_szFile, ((wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage())->m_szFile,
@@ -1070,7 +1070,7 @@ void wxMediaPlayerFrame::OnOpenURLNewPage(wxCommandEvent& WXUNUSED(event))
void wxMediaPlayerFrame::OpenURL(bool bNewPage) void wxMediaPlayerFrame::OpenURL(bool bNewPage)
{ {
wxString sUrl = wxGetTextFromUser( wxString sUrl = wxGetTextFromUser(
wxT("Enter the URL that has the movie to play") "Enter the URL that has the movie to play"
); );
if(sUrl.empty() == false) // could have been cancelled by user if(sUrl.empty() == false) // could have been cancelled by user
@@ -1101,7 +1101,7 @@ void wxMediaPlayerFrame::OnCloseCurrentPage(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
wxMessageBox(wxT("Cannot close main page")); wxMessageBox("Cannot close main page");
} }
} }
@@ -1126,7 +1126,7 @@ void wxMediaPlayerFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
wxLIST_STATE_DONTCARE)) == -1) wxLIST_STATE_DONTCARE)) == -1)
{ {
// no items in list // no items in list
wxMessageBox(wxT("No items in playlist!")); wxMessageBox("No items in playlist!");
} }
else else
{ {
@@ -1194,10 +1194,10 @@ void wxMediaPlayerFrame::OnStop(wxCommandEvent& WXUNUSED(evt))
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage(); (wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
if( !currentpage->m_mediactrl->Stop() ) if( !currentpage->m_mediactrl->Stop() )
wxMessageBox(wxT("Couldn't stop movie!")); wxMessageBox("Couldn't stop movie!");
else else
currentpage->m_playlist->SetItem( currentpage->m_playlist->SetItem(
currentpage->m_nLastFileId, 0, wxT("[]")); currentpage->m_nLastFileId, 0, "[]");
} }
@@ -1218,7 +1218,7 @@ void wxMediaPlayerFrame::OnChangeSong(wxListEvent& WXUNUSED(evt))
if(listitem.GetData()) if(listitem.GetData())
DoPlayFile((*((wxString*) listitem.GetData()))); DoPlayFile((*((wxString*) listitem.GetData())));
else else
wxMessageBox(wxT("No selected item!")); wxMessageBox("No selected item!");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1385,7 +1385,7 @@ void wxMediaPlayerTimer::Notify()
// Duration string (i.e. MM:SS) // Duration string (i.e. MM:SS)
wxString sDuration; wxString sDuration;
sDuration.Printf(wxT("%2i:%02i"), nMinutes, nSeconds); sDuration.Printf("%2i:%02i", nMinutes, nSeconds);
// Number of minutes/seconds total // Number of minutes/seconds total
@@ -1395,7 +1395,7 @@ void wxMediaPlayerTimer::Notify()
// Position string (i.e. MM:SS) // Position string (i.e. MM:SS)
wxString sPosition; wxString sPosition;
sPosition.Printf(wxT("%2i:%02i"), nMinutes, nSeconds); sPosition.Printf("%2i:%02i", nMinutes, nSeconds);
// Set the third item in the listctrl entry to the duration string // Set the third item in the listctrl entry to the duration string
@@ -1433,9 +1433,9 @@ void wxMediaPlayerTimer::Notify()
// hold various metadata about the media // hold various metadata about the media
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
m_frame->SetStatusText(wxString::Format( m_frame->SetStatusText(wxString::Format(
wxT("Size(x,y):%i,%i ") "Size(x,y):%i,%i "
wxT("Position:%s/%s Speed:%1.1fx ") "Position:%s/%s Speed:%1.1fx "
wxT("State:%s Loops:%i D/T:[%i]/[%i] V:%i%%"), "State:%s Loops:%i D/T:[%i]/[%i] V:%i%%",
videoSize.x, videoSize.x,
videoSize.y, videoSize.y,
sPosition.c_str(), sPosition.c_str(),
@@ -1498,13 +1498,13 @@ wxMediaPlayerNotebookPage::wxMediaPlayerNotebookPage(wxMediaPlayerFrame* parentF
wxDefaultPosition, wxDefaultSize, 0, wxDefaultPosition, wxDefaultSize, 0,
// you could specify a macro backend here like // you could specify a macro backend here like
// wxMEDIABACKEND_WMP10); // wxMEDIABACKEND_WMP10);
// wxT("wxPDFMediaBackend")); // "wxPDFMediaBackend");
szBackend); szBackend);
// you could change the cursor here like // you could change the cursor here like
// m_mediactrl->SetCursor(wxCURSOR_BLANK); // m_mediactrl->SetCursor(wxCURSOR_BLANK);
// note that this may not effect it if SetPlayerControls // note that this may not effect it if SetPlayerControls
// is set to something else than wxMEDIACTRLPLAYERCONTROLS_NONE // is set to something else than wxMEDIACTRLPLAYERCONTROLS_NONE
wxASSERT_MSG(bOK, wxT("Could not create media control!")); wxASSERT_MSG(bOK, "Could not create media control!");
wxUnusedVar(bOK); wxUnusedVar(bOK);
sizer->Add(m_mediactrl, wxSizerFlags().Expand().Border()); sizer->Add(m_mediactrl, wxSizerFlags().Expand().Border());
@@ -1561,17 +1561,17 @@ wxMediaPlayerNotebookPage::wxMediaPlayerNotebookPage(wxMediaPlayerFrame* parentF
m_vdButton = new wxButton(); m_vdButton = new wxButton();
m_vuButton = new wxButton(); m_vuButton = new wxButton();
m_prevButton->Create(this, wxID_BUTTONPREV, wxT("|<")); m_prevButton->Create(this, wxID_BUTTONPREV, "|<");
m_prevButton->SetToolTip("Previous"); m_prevButton->SetToolTip("Previous");
m_playButton->Create(this, wxID_BUTTONPLAY, wxT(">")); m_playButton->Create(this, wxID_BUTTONPLAY, ">");
m_playButton->SetToolTip("Play"); m_playButton->SetToolTip("Play");
m_stopButton->Create(this, wxID_BUTTONSTOP, wxT("[]")); m_stopButton->Create(this, wxID_BUTTONSTOP, "[]");
m_stopButton->SetToolTip("Stop"); m_stopButton->SetToolTip("Stop");
m_nextButton->Create(this, wxID_BUTTONNEXT, wxT(">|")); m_nextButton->Create(this, wxID_BUTTONNEXT, ">|");
m_nextButton->SetToolTip("Next"); m_nextButton->SetToolTip("Next");
m_vdButton->Create(this, wxID_BUTTONVD, wxT("((")); m_vdButton->Create(this, wxID_BUTTONVD, "((");
m_vdButton->SetToolTip("Volume down"); m_vdButton->SetToolTip("Volume down");
m_vuButton->Create(this, wxID_BUTTONVU, wxT("))")); m_vuButton->Create(this, wxID_BUTTONVU, "))");
m_vuButton->SetToolTip("Volume up"); m_vuButton->SetToolTip("Volume up");
vertsizer->Add(m_prevButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); vertsizer->Add(m_prevButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
@@ -1699,7 +1699,7 @@ void wxMediaPlayerNotebookPage::OnEndSeek(wxScrollEvent& WXUNUSED(event))
if( m_mediactrl->Seek( if( m_mediactrl->Seek(
m_slider->GetValue() * 1000 m_slider->GetValue() * 1000
) == wxInvalidOffset ) ) == wxInvalidOffset )
wxMessageBox(wxT("Couldn't seek in movie!")); wxMessageBox("Couldn't seek in movie!");
m_bIsBeingDragged = false; m_bIsBeingDragged = false;
} }
@@ -1724,7 +1724,7 @@ void wxMediaPlayerNotebookPage::OnVolChange(wxScrollEvent& WXUNUSED(event))
if( m_mediactrl->SetVolume( if( m_mediactrl->SetVolume(
m_volSlider->GetValue() / 100.0 m_volSlider->GetValue() / 100.0
) == false ) ) == false )
wxMessageBox(wxT("Couldn't set volume!")); wxMessageBox("Couldn't set volume!");
} }
@@ -1738,7 +1738,7 @@ void wxMediaPlayerNotebookPage::OnPBChange(wxScrollEvent& WXUNUSED(event))
if( m_mediactrl->SetPlaybackRate( if( m_mediactrl->SetPlaybackRate(
m_pbSlider->GetValue() * .25 m_pbSlider->GetValue() * .25
) == false ) ) == false )
wxMessageBox(wxT("Couldn't set playbackrate!")); wxMessageBox("Couldn't set playbackrate!");
} }
@@ -1749,7 +1749,7 @@ void wxMediaPlayerNotebookPage::OnPBChange(wxScrollEvent& WXUNUSED(event))
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxMediaPlayerNotebookPage::OnMediaPlay(wxMediaEvent& WXUNUSED(event)) void wxMediaPlayerNotebookPage::OnMediaPlay(wxMediaEvent& WXUNUSED(event))
{ {
m_playlist->SetItem(m_nLastFileId, 0, wxT(">")); m_playlist->SetItem(m_nLastFileId, 0, ">");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1759,7 +1759,7 @@ void wxMediaPlayerNotebookPage::OnMediaPlay(wxMediaEvent& WXUNUSED(event))
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxMediaPlayerNotebookPage::OnMediaPause(wxMediaEvent& WXUNUSED(event)) void wxMediaPlayerNotebookPage::OnMediaPause(wxMediaEvent& WXUNUSED(event))
{ {
m_playlist->SetItem(m_nLastFileId, 0, wxT("||")); m_playlist->SetItem(m_nLastFileId, 0, "||");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1769,7 +1769,7 @@ void wxMediaPlayerNotebookPage::OnMediaPause(wxMediaEvent& WXUNUSED(event))
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxMediaPlayerNotebookPage::OnMediaStop(wxMediaEvent& WXUNUSED(event)) void wxMediaPlayerNotebookPage::OnMediaStop(wxMediaEvent& WXUNUSED(event))
{ {
m_playlist->SetItem(m_nLastFileId, 0, wxT("[]")); m_playlist->SetItem(m_nLastFileId, 0, "[]");
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1784,15 +1784,15 @@ void wxMediaPlayerNotebookPage::OnMediaFinished(wxMediaEvent& WXUNUSED(event))
{ {
if ( !m_mediactrl->Play() ) if ( !m_mediactrl->Play() )
{ {
wxMessageBox(wxT("Couldn't loop movie!")); wxMessageBox("Couldn't loop movie!");
m_playlist->SetItem(m_nLastFileId, 0, wxT("E")); m_playlist->SetItem(m_nLastFileId, 0, "E");
} }
else else
++m_nLoops; ++m_nLoops;
} }
else else
{ {
m_playlist->SetItem(m_nLastFileId, 0, wxT("[]")); m_playlist->SetItem(m_nLastFileId, 0, "[]");
} }
} }

View File

@@ -67,15 +67,15 @@ bool MyApp::OnInit(void)
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(wxID_EXIT, wxT("E&xit")); file_menu->Append(wxID_EXIT, "E&xit");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("File")); menu_bar->Append(file_menu, "File");
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
// Make a panel with a message // Make a panel with a message
wxPanel *panel = new wxPanel(frame); wxPanel *panel = new wxPanel(frame);
(void)new wxStaticText(panel, wxID_ANY, wxT("Hello, this is a minimal debugging wxWidgets program!"), wxPoint(10, 10)); (void)new wxStaticText(panel, wxID_ANY, "Hello, this is a minimal debugging wxWidgets program!", wxPoint(10, 10));
// Show the frame // Show the frame
frame->Show(true); frame->Show(true);
@@ -126,7 +126,7 @@ wxEND_EVENT_TABLE()
// My frame constructor // My frame constructor
MyFrame::MyFrame(wxFrame *parent): MyFrame::MyFrame(wxFrame *parent):
wxFrame(parent, wxID_ANY, wxT("MemCheck wxWidgets Sample"), wxDefaultPosition, wxSize(400, 200)) wxFrame(parent, wxID_ANY, "MemCheck wxWidgets Sample", wxDefaultPosition, wxSize(400, 200))
{} {}
// Intercept menu commands // Intercept menu commands

View File

@@ -140,19 +140,19 @@ protected:
void OnMenuOpen(wxMenuEvent& event) void OnMenuOpen(wxMenuEvent& event)
{ {
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
LogMenuOpenCloseOrHighlight(event, wxT("opened")); event.Skip(); LogMenuOpenCloseOrHighlight(event, "opened"); event.Skip();
#endif #endif
} }
void OnMenuClose(wxMenuEvent& event) void OnMenuClose(wxMenuEvent& event)
{ {
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
LogMenuOpenCloseOrHighlight(event, wxT("closed")); event.Skip(); LogMenuOpenCloseOrHighlight(event, "closed"); event.Skip();
#endif #endif
} }
void OnMenuHighlight(wxMenuEvent& event) void OnMenuHighlight(wxMenuEvent& event)
{ {
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
LogMenuOpenCloseOrHighlight(event, wxT("highlighted")); event.Skip(); LogMenuOpenCloseOrHighlight(event, "highlighted"); event.Skip();
#endif #endif
} }
@@ -162,7 +162,7 @@ protected:
private: private:
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
void LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxChar *what); void LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxString& what);
#endif #endif
void ShowContextMenu(const wxPoint& pos); void ShowContextMenu(const wxPoint& pos);
@@ -202,25 +202,25 @@ public:
void OnMenuOpen(wxMenuEvent& event) void OnMenuOpen(wxMenuEvent& event)
{ {
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
LogMenuOpenCloseOrHighlight(event, wxT("opened")); event.Skip(); LogMenuOpenCloseOrHighlight(event, "opened"); event.Skip();
#endif #endif
} }
void OnMenuClose(wxMenuEvent& event) void OnMenuClose(wxMenuEvent& event)
{ {
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
LogMenuOpenCloseOrHighlight(event, wxT("closed")); event.Skip(); LogMenuOpenCloseOrHighlight(event, "closed"); event.Skip();
#endif #endif
} }
void OnMenuHighlight(wxMenuEvent& event) void OnMenuHighlight(wxMenuEvent& event)
{ {
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
LogMenuOpenCloseOrHighlight(event, wxT("highlighted")); event.Skip(); LogMenuOpenCloseOrHighlight(event, "highlighted"); event.Skip();
#endif #endif
} }
private: private:
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
void LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxChar *what); void LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxString& what);
#endif #endif
void ShowContextMenu(const wxPoint& pos); void ShowContextMenu(const wxPoint& pos);
@@ -429,7 +429,7 @@ bool MyApp::OnInit()
frame->Show(true); frame->Show(true);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->SetStatusText(wxT("Welcome to wxWidgets menu sample")); frame->SetStatusText("Welcome to wxWidgets menu sample");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
return true; return true;
@@ -441,7 +441,7 @@ bool MyApp::OnInit()
// Define my frame constructor // Define my frame constructor
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame((wxFrame *)NULL, wxID_ANY, wxT("wxWidgets menu sample")) : wxFrame((wxFrame *)NULL, wxID_ANY, "wxWidgets menu sample")
{ {
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
@@ -528,87 +528,87 @@ MyFrame::MyFrame()
stockSubMenu->Append(wxID_ZOOM_FIT); stockSubMenu->Append(wxID_ZOOM_FIT);
stockSubMenu->Append(wxID_ZOOM_IN); stockSubMenu->Append(wxID_ZOOM_IN);
stockSubMenu->Append(wxID_ZOOM_OUT); stockSubMenu->Append(wxID_ZOOM_OUT);
fileMenu->AppendSubMenu(stockSubMenu, wxT("&Standard items demo")); fileMenu->AppendSubMenu(stockSubMenu, "&Standard items demo");
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog, wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog,
wxT("Clear &log\tCtrl-L")); "Clear &log\tCtrl-L");
item->SetBitmap(copy_xpm); item->SetBitmap(copy_xpm);
fileMenu->Append(item); fileMenu->Append(item);
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
#endif // USE_LOG_WINDOW #endif // USE_LOG_WINDOW
fileMenu->Append(Menu_File_ShowDialog, wxT("Show &Dialog\tCtrl-D"), fileMenu->Append(Menu_File_ShowDialog, "Show &Dialog\tCtrl-D",
wxT("Show a dialog")); "Show a dialog");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(Menu_File_Quit, wxT("E&xit\tAlt-X"), wxT("Quit menu sample")); fileMenu->Append(Menu_File_Quit, "E&xit\tAlt-X", "Quit menu sample");
wxMenu *menubarMenu = new wxMenu; wxMenu *menubarMenu = new wxMenu;
menubarMenu->Append(Menu_MenuBar_Append, wxT("&Append menu\tCtrl-A"), menubarMenu->Append(Menu_MenuBar_Append, "&Append menu\tCtrl-A",
wxT("Append a menu to the menubar")); "Append a menu to the menubar");
menubarMenu->Append(Menu_MenuBar_Insert, wxT("&Insert menu\tCtrl-I"), menubarMenu->Append(Menu_MenuBar_Insert, "&Insert menu\tCtrl-I",
wxT("Insert a menu into the menubar")); "Insert a menu into the menubar");
menubarMenu->Append(Menu_MenuBar_Delete, wxT("&Delete menu\tCtrl-D"), menubarMenu->Append(Menu_MenuBar_Delete, "&Delete menu\tCtrl-D",
wxT("Delete the last menu from the menubar")); "Delete the last menu from the menubar");
menubarMenu->Append(Menu_MenuBar_Toggle, wxT("&Toggle menu\tCtrl-T"), menubarMenu->Append(Menu_MenuBar_Toggle, "&Toggle menu\tCtrl-T",
wxT("Toggle the first menu in the menubar"), true); "Toggle the first menu in the menubar", true);
menubarMenu->AppendSeparator(); menubarMenu->AppendSeparator();
menubarMenu->Append(Menu_MenuBar_Enable, wxT("&Enable menu\tCtrl-E"), menubarMenu->Append(Menu_MenuBar_Enable, "&Enable menu\tCtrl-E",
wxT("Enable or disable the last menu"), true); "Enable or disable the last menu", true);
menubarMenu->AppendSeparator(); menubarMenu->AppendSeparator();
menubarMenu->Append(Menu_MenuBar_GetLabel, wxT("&Get menu label\tCtrl-G"), menubarMenu->Append(Menu_MenuBar_GetLabel, "&Get menu label\tCtrl-G",
wxT("Get the label of the last menu")); "Get the label of the last menu");
#if wxUSE_TEXTDLG #if wxUSE_TEXTDLG
menubarMenu->Append(Menu_MenuBar_SetLabel, wxT("&Set menu label\tCtrl-S"), menubarMenu->Append(Menu_MenuBar_SetLabel, "&Set menu label\tCtrl-S",
wxT("Change the label of the last menu")); "Change the label of the last menu");
menubarMenu->AppendSeparator(); menubarMenu->AppendSeparator();
menubarMenu->Append(Menu_MenuBar_FindMenu, wxT("&Find menu from label\tCtrl-F"), menubarMenu->Append(Menu_MenuBar_FindMenu, "&Find menu from label\tCtrl-F",
wxT("Find a menu by searching for its label")); "Find a menu by searching for its label");
#endif #endif
wxMenu* subMenu = new wxMenu; wxMenu* subMenu = new wxMenu;
subMenu->Append(Menu_SubMenu_Normal, wxT("&Normal submenu item"), wxT("Disabled submenu item")); subMenu->Append(Menu_SubMenu_Normal, "&Normal submenu item", "Disabled submenu item");
subMenu->AppendCheckItem(Menu_SubMenu_Check, wxT("&Check submenu item"), wxT("Check submenu item")); subMenu->AppendCheckItem(Menu_SubMenu_Check, "&Check submenu item", "Check submenu item");
subMenu->AppendRadioItem(Menu_SubMenu_Radio1, wxT("Radio item &1"), wxT("Radio item")); subMenu->AppendRadioItem(Menu_SubMenu_Radio1, "Radio item &1", "Radio item");
subMenu->AppendRadioItem(Menu_SubMenu_Radio2, wxT("Radio item &2"), wxT("Radio item")); subMenu->AppendRadioItem(Menu_SubMenu_Radio2, "Radio item &2", "Radio item");
subMenu->AppendRadioItem(Menu_SubMenu_Radio3, wxT("Radio item &3"), wxT("Radio item")); subMenu->AppendRadioItem(Menu_SubMenu_Radio3, "Radio item &3", "Radio item");
menubarMenu->Append(Menu_SubMenu, wxT("Submenu"), subMenu); menubarMenu->Append(Menu_SubMenu, "Submenu", subMenu);
wxMenu *menuMenu = new wxMenu; wxMenu *menuMenu = new wxMenu;
menuMenu->Append(Menu_Menu_Append, wxT("&Append menu item\tAlt-A"), menuMenu->Append(Menu_Menu_Append, "&Append menu item\tAlt-A",
wxT("Append a menu item to the 'Test' menu")); "Append a menu item to the 'Test' menu");
menuMenu->Append(Menu_Menu_AppendSub, wxT("&Append sub menu\tAlt-S"), menuMenu->Append(Menu_Menu_AppendSub, "&Append sub menu\tAlt-S",
wxT("Append a sub menu to the 'Test' menu")); "Append a sub menu to the 'Test' menu");
menuMenu->Append(Menu_Menu_Insert, wxT("&Insert menu item\tAlt-I"), menuMenu->Append(Menu_Menu_Insert, "&Insert menu item\tAlt-I",
wxT("Insert a menu item in head of the 'Test' menu")); "Insert a menu item in head of the 'Test' menu");
menuMenu->Append(Menu_Menu_Delete, wxT("&Delete menu item\tAlt-D"), menuMenu->Append(Menu_Menu_Delete, "&Delete menu item\tAlt-D",
wxT("Delete the last menu item from the 'Test' menu")); "Delete the last menu item from the 'Test' menu");
menuMenu->Append(Menu_Menu_DeleteSub, wxT("Delete last &submenu\tAlt-K"), menuMenu->Append(Menu_Menu_DeleteSub, "Delete last &submenu\tAlt-K",
wxT("Delete the last submenu from the 'Test' menu")); "Delete the last submenu from the 'Test' menu");
menuMenu->AppendSeparator(); menuMenu->AppendSeparator();
menuMenu->Append(Menu_Menu_Enable, wxT("&Enable menu item\tAlt-E"), menuMenu->Append(Menu_Menu_Enable, "&Enable menu item\tAlt-E",
wxT("Enable or disable the last menu item"), true); "Enable or disable the last menu item", true);
menuMenu->Append(Menu_Menu_Check, wxT("&Check menu item\tAlt-C"), menuMenu->Append(Menu_Menu_Check, "&Check menu item\tAlt-C",
wxT("Check or uncheck the last menu item"), true); "Check or uncheck the last menu item", true);
menuMenu->AppendSeparator(); menuMenu->AppendSeparator();
menuMenu->Append(Menu_Menu_GetInfo, wxT("Get menu item in&fo\tAlt-F"), menuMenu->Append(Menu_Menu_GetInfo, "Get menu item in&fo\tAlt-F",
wxT("Show the state of the last menu item")); "Show the state of the last menu item");
#if wxUSE_TEXTDLG #if wxUSE_TEXTDLG
menuMenu->Append(Menu_Menu_SetLabel, wxT("Set menu item label\tAlt-L"), menuMenu->Append(Menu_Menu_SetLabel, "Set menu item label\tAlt-L",
wxT("Set the label of a menu item")); "Set the label of a menu item");
#endif #endif
#if wxUSE_TEXTDLG #if wxUSE_TEXTDLG
menuMenu->AppendSeparator(); menuMenu->AppendSeparator();
menuMenu->Append(Menu_Menu_FindItem, wxT("Find menu item from label"), menuMenu->Append(Menu_Menu_FindItem, "Find menu item from label",
wxT("Find a menu item by searching for its label")); "Find a menu item by searching for its label");
#endif #endif
wxMenu *testMenu = new wxMenu; wxMenu *testMenu = new wxMenu;
testMenu->Append(Menu_Test_Normal, wxT("&Normal item")); testMenu->Append(Menu_Test_Normal, "&Normal item");
testMenu->AppendSeparator(); testMenu->AppendSeparator();
testMenu->AppendCheckItem(Menu_Test_Check, wxT("&Check item")); testMenu->AppendCheckItem(Menu_Test_Check, "&Check item");
#ifdef __WXMSW__ #ifdef __WXMSW__
#if wxUSE_IMAGE #if wxUSE_IMAGE
@@ -637,20 +637,20 @@ MyFrame::MyFrame()
#endif #endif
testMenu->AppendSeparator(); testMenu->AppendSeparator();
testMenu->AppendRadioItem(Menu_Test_Radio1, wxT("Radio item &1")); testMenu->AppendRadioItem(Menu_Test_Radio1, "Radio item &1");
testMenu->AppendRadioItem(Menu_Test_Radio2, wxT("Radio item &2")); testMenu->AppendRadioItem(Menu_Test_Radio2, "Radio item &2");
testMenu->AppendRadioItem(Menu_Test_Radio3, wxT("Radio item &3")); testMenu->AppendRadioItem(Menu_Test_Radio3, "Radio item &3");
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(Menu_Help_About, wxT("&About\tF1"), wxT("About menu sample")); helpMenu->Append(Menu_Help_About, "&About\tF1", "About menu sample");
wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE ); wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE );
menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(fileMenu, "&File");
menuBar->Append(menubarMenu, wxT("Menu&bar")); menuBar->Append(menubarMenu, "Menu&bar");
menuBar->Append(menuMenu, wxT("&Menu")); menuBar->Append(menuMenu, "&Menu");
menuBar->Append(testMenu, wxT("&Test")); menuBar->Append(testMenu, "&Test");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// these items should be initially checked // these items should be initially checked
menuBar->Check(Menu_MenuBar_Toggle, true); menuBar->Check(Menu_MenuBar_Toggle, true);
@@ -677,8 +677,8 @@ MyFrame::MyFrame()
wxLogMessage(wxT("Brief explanations: the commands in the \"Menu\" menu ") wxLogMessage(wxT("Brief explanations: the commands in the \"Menu\" menu ")
wxT("append/insert/delete items to/from the \"Test\" menu.\n") wxT("append/insert/delete items to/from the \"Test\" menu.\n")
wxT("The commands in the \"Menubar\" menu work with the ") wxT("The commands in the \"Menubar\" menu work with the ")
wxT("menubar itself.\n\n") "menubar itself.\n\n"
wxT("Right click the band below to test popup menus.\n")); "Right click the band below to test popup menus.\n");
#endif #endif
} }
@@ -698,13 +698,13 @@ MyFrame::~MyFrame()
wxMenu *MyFrame::CreateDummyMenu(wxString *title) wxMenu *MyFrame::CreateDummyMenu(wxString *title)
{ {
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
menu->Append(Menu_Dummy_First, wxT("&First item\tCtrl-F1")); menu->Append(Menu_Dummy_First, "&First item\tCtrl-F1");
menu->AppendSeparator(); menu->AppendSeparator();
menu->AppendCheckItem(Menu_Dummy_Second, wxT("&Second item\tCtrl-F2")); menu->AppendCheckItem(Menu_Dummy_Second, "&Second item\tCtrl-F2");
if ( title ) if ( title )
{ {
title->Printf(wxT("Dummy menu &%u"), (unsigned)++m_countDummy); title->Printf("Dummy menu &%u", (unsigned)++m_countDummy);
} }
return menu; return menu;
@@ -714,12 +714,12 @@ wxMenuItem *MyFrame::GetLastMenuItem() const
{ {
wxMenuBar *menubar = GetMenuBar(); wxMenuBar *menubar = GetMenuBar();
wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test")); wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test"));
wxCHECK_MSG( menu, NULL, wxT("no 'Test' menu?") ); wxCHECK_MSG( menu, NULL, "no 'Test' menu?" );
wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetLast(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetLast();
if ( !node ) if ( !node )
{ {
wxLogWarning(wxT("No last item in the 'Test' menu!")); wxLogWarning("No last item in the 'Test' menu!");
return NULL; return NULL;
} }
@@ -733,15 +733,15 @@ void MyFrame::LogMenuEvent(const wxCommandEvent& event)
{ {
int id = event.GetId(); int id = event.GetId();
wxString msg = wxString::Format(wxT("Menu command %d"), id); wxString msg = wxString::Format("Menu command %d", id);
// catch all checkable menubar items and also the check item from the popup // catch all checkable menubar items and also the check item from the popup
// menu // menu
wxMenuItem *item = GetMenuBar()->FindItem(id); wxMenuItem *item = GetMenuBar()->FindItem(id);
if ( (item && item->IsCheckable()) || id == Menu_Popup_ToBeChecked ) if ( (item && item->IsCheckable()) || id == Menu_Popup_ToBeChecked )
{ {
msg += wxString::Format(wxT(" (the item is currently %schecked)"), msg += wxString::Format(" (the item is currently %schecked)",
event.IsChecked() ? wxT("") : wxT("not ")); event.IsChecked() ? "" : "not ");
} }
wxLogMessage(msg); wxLogMessage(msg);
@@ -781,8 +781,8 @@ void MyFrame::OnShowDialog(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
(void)wxMessageBox(wxT("wxWidgets menu sample\n(c) 1999-2001 Vadim Zeitlin"), (void)wxMessageBox("wxWidgets menu sample\n(c) 1999-2001 Vadim Zeitlin",
wxT("About wxWidgets menu sample"), "About wxWidgets menu sample",
wxOK | wxICON_INFORMATION); wxOK | wxICON_INFORMATION);
} }
@@ -794,7 +794,7 @@ void MyFrame::OnDeleteMenu(wxCommandEvent& WXUNUSED(event))
if ( count == 4 ) if ( count == 4 )
{ {
// don't let delete the first 4 menus // don't let delete the first 4 menus
wxLogError(wxT("Can't delete any more menus")); wxLogError("Can't delete any more menus");
} }
else else
{ {
@@ -829,7 +829,7 @@ void MyFrame::OnToggleMenu(wxCommandEvent& WXUNUSED(event))
else else
{ {
// restore it // restore it
mbar->Insert(0, m_menu, wxT("&File")); mbar->Insert(0, m_menu, "&File");
m_menu = NULL; m_menu = NULL;
} }
} }
@@ -847,9 +847,9 @@ void MyFrame::OnGetLabelMenu(wxCommandEvent& WXUNUSED(event))
wxMenuBar *mbar = GetMenuBar(); wxMenuBar *mbar = GetMenuBar();
size_t count = mbar->GetMenuCount(); size_t count = mbar->GetMenuCount();
wxCHECK_RET( count, wxT("no last menu?") ); wxCHECK_RET( count, "no last menu?" );
wxLogMessage(wxT("The label of the last menu item is '%s'"), wxLogMessage("The label of the last menu item is '%s'",
mbar->GetMenuLabel(count - 1).c_str()); mbar->GetMenuLabel(count - 1).c_str());
} }
@@ -859,12 +859,12 @@ void MyFrame::OnSetLabelMenu(wxCommandEvent& WXUNUSED(event))
wxMenuBar *mbar = GetMenuBar(); wxMenuBar *mbar = GetMenuBar();
size_t count = mbar->GetMenuCount(); size_t count = mbar->GetMenuCount();
wxCHECK_RET( count, wxT("no last menu?") ); wxCHECK_RET( count, "no last menu?" );
wxString label = wxGetTextFromUser wxString label = wxGetTextFromUser
( (
wxT("Enter new label: "), "Enter new label: ",
wxT("Change last menu text"), "Change last menu text",
mbar->GetMenuLabel(count - 1), mbar->GetMenuLabel(count - 1),
this this
); );
@@ -880,12 +880,12 @@ void MyFrame::OnFindMenu(wxCommandEvent& WXUNUSED(event))
wxMenuBar *mbar = GetMenuBar(); wxMenuBar *mbar = GetMenuBar();
size_t count = mbar->GetMenuCount(); size_t count = mbar->GetMenuCount();
wxCHECK_RET( count, wxT("no last menu?") ); wxCHECK_RET( count, "no last menu?" );
wxString label = wxGetTextFromUser wxString label = wxGetTextFromUser
( (
wxT("Enter label to search for: "), "Enter label to search for: ",
wxT("Find menu"), "Find menu",
wxEmptyString, wxEmptyString,
this this
); );
@@ -896,11 +896,11 @@ void MyFrame::OnFindMenu(wxCommandEvent& WXUNUSED(event))
if (index == wxNOT_FOUND) if (index == wxNOT_FOUND)
{ {
wxLogWarning(wxT("No menu with label '%s'"), label.c_str()); wxLogWarning("No menu with label '%s'", label.c_str());
} }
else else
{ {
wxLogMessage(wxT("Menu %d has label '%s'"), index, label.c_str()); wxLogMessage("Menu %d has label '%s'", index, label.c_str());
} }
} }
} }
@@ -908,40 +908,40 @@ void MyFrame::OnFindMenu(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnDummy(wxCommandEvent& event) void MyFrame::OnDummy(wxCommandEvent& event)
{ {
wxLogMessage(wxT("Dummy item #%d"), event.GetId() - Menu_Dummy_First + 1); wxLogMessage("Dummy item #%d", event.GetId() - Menu_Dummy_First + 1);
} }
void MyFrame::OnAppendMenuItem(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAppendMenuItem(wxCommandEvent& WXUNUSED(event))
{ {
wxMenuBar *menubar = GetMenuBar(); wxMenuBar *menubar = GetMenuBar();
wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test")); wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test"));
wxCHECK_RET( menu, wxT("no 'Test' menu?") ); wxCHECK_RET( menu, "no 'Test' menu?" );
menu->AppendSeparator(); menu->AppendSeparator();
menu->Append(Menu_Dummy_Third, wxT("&Third dummy item\tCtrl-F3"), menu->Append(Menu_Dummy_Third, "&Third dummy item\tCtrl-F3",
wxT("Checkable item"), true); "Checkable item", true);
} }
void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event))
{ {
wxMenuBar *menubar = GetMenuBar(); wxMenuBar *menubar = GetMenuBar();
wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test")); wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test"));
wxCHECK_RET( menu, wxT("no 'Test' menu?") ); wxCHECK_RET( menu, "no 'Test' menu?" );
menu->Append(Menu_Dummy_Last, wxT("&Dummy sub menu"), menu->Append(Menu_Dummy_Last, "&Dummy sub menu",
CreateDummyMenu(NULL), wxT("Dummy sub menu help")); CreateDummyMenu(NULL), "Dummy sub menu help");
} }
void MyFrame::OnDeleteMenuItem(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnDeleteMenuItem(wxCommandEvent& WXUNUSED(event))
{ {
wxMenuBar *menubar = GetMenuBar(); wxMenuBar *menubar = GetMenuBar();
wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test")); wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test"));
wxCHECK_RET( menu, wxT("no 'Test' menu?") ); wxCHECK_RET( menu, "no 'Test' menu?" );
size_t count = menu->GetMenuItemCount(); size_t count = menu->GetMenuItemCount();
if ( !count ) if ( !count )
{ {
wxLogWarning(wxT("No items to delete!")); wxLogWarning("No items to delete!");
} }
else else
{ {
@@ -953,7 +953,7 @@ void MyFrame::OnDeleteSubMenu(wxCommandEvent& WXUNUSED(event))
{ {
wxMenuBar *menubar = GetMenuBar(); wxMenuBar *menubar = GetMenuBar();
wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test")); wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test"));
wxCHECK_RET( menu, wxT("no 'Test' menu?") ); wxCHECK_RET( menu, "no 'Test' menu?" );
for ( int n = menu->GetMenuItemCount() - 1; n >=0 ; --n ) for ( int n = menu->GetMenuItemCount() - 1; n >=0 ; --n )
{ {
@@ -965,17 +965,17 @@ void MyFrame::OnDeleteSubMenu(wxCommandEvent& WXUNUSED(event))
} }
} }
wxLogWarning(wxT("No submenu to delete!")); wxLogWarning("No submenu to delete!");
} }
void MyFrame::OnInsertMenuItem(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnInsertMenuItem(wxCommandEvent& WXUNUSED(event))
{ {
wxMenuBar *menubar = GetMenuBar(); wxMenuBar *menubar = GetMenuBar();
wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test")); wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test"));
wxCHECK_RET( menu, wxT("no 'Test' menu?") ); wxCHECK_RET( menu, "no 'Test' menu?" );
menu->Insert(0, wxMenuItem::New(menu, Menu_Dummy_Fourth, menu->Insert(0, wxMenuItem::New(menu, Menu_Dummy_Fourth,
wxT("Fourth dummy item\tCtrl-F4"))); "Fourth dummy item\tCtrl-F4"));
menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR)); menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR));
} }
@@ -1015,7 +1015,7 @@ void MyFrame::OnGetLabelMenuItem(wxCommandEvent& WXUNUSED(event))
if ( item ) if ( item )
{ {
wxString label = item->GetItemLabel(); wxString label = item->GetItemLabel();
wxLogMessage(wxT("The label of the last menu item is '%s'"), wxLogMessage("The label of the last menu item is '%s'",
label.c_str()); label.c_str());
} }
} }
@@ -1029,12 +1029,12 @@ void MyFrame::OnSetLabelMenuItem(wxCommandEvent& WXUNUSED(event))
{ {
wxString label = wxGetTextFromUser wxString label = wxGetTextFromUser
( (
wxT("Enter new label: "), "Enter new label: ",
wxT("Change last menu item text"), "Change last menu item text",
item->GetItemLabel(), item->GetItemLabel(),
this this
); );
label.Replace( wxT("\\t"), wxT("\t") ); label.Replace( "\\t", "\t" );
if ( !label.empty() ) if ( !label.empty() )
{ {
@@ -1051,29 +1051,29 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
if ( item ) if ( item )
{ {
wxString msg; wxString msg;
msg << wxT("The item is ") << (item->IsEnabled() ? wxT("enabled") msg << "The item is " << (item->IsEnabled() ? "enabled"
: wxT("disabled")) : "disabled")
<< wxT('\n'); << '\n';
if ( item->IsCheckable() ) if ( item->IsCheckable() )
{ {
msg << wxT("It is checkable and ") << (item->IsChecked() ? wxT("") : wxT("un")) msg << "It is checkable and " << (item->IsChecked() ? "" : "un")
<< wxT("checked\n"); << "checked\n";
} }
#if wxUSE_ACCEL #if wxUSE_ACCEL
wxAcceleratorEntry *accel = item->GetAccel(); wxAcceleratorEntry *accel = item->GetAccel();
if ( accel ) if ( accel )
{ {
msg << wxT("Its accelerator is "); msg << "Its accelerator is ";
int flags = accel->GetFlags(); int flags = accel->GetFlags();
if ( flags & wxACCEL_ALT ) if ( flags & wxACCEL_ALT )
msg << wxT("Alt-"); msg << "Alt-";
if ( flags & wxACCEL_CTRL ) if ( flags & wxACCEL_CTRL )
msg << wxT("Ctrl-"); msg << "Ctrl-";
if ( flags & wxACCEL_SHIFT ) if ( flags & wxACCEL_SHIFT )
msg << wxT("Shift-"); msg << "Shift-";
int code = accel->GetKeyCode(); int code = accel->GetKeyCode();
switch ( code ) switch ( code )
@@ -1090,7 +1090,7 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
case WXK_F10: case WXK_F10:
case WXK_F11: case WXK_F11:
case WXK_F12: case WXK_F12:
msg << wxT('F') << code - WXK_F1 + 1; msg << 'F' << code - WXK_F1 + 1;
break; break;
// if there are any other keys wxGetAccelFromString() may return, // if there are any other keys wxGetAccelFromString() may return,
@@ -1104,14 +1104,14 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
break; break;
} }
wxFAIL_MSG( wxT("unknown keyboard accel") ); wxFAIL_MSG( "unknown keyboard accel" );
} }
delete accel; delete accel;
} }
else else
{ {
msg << wxT("It doesn't have an accelerator"); msg << "It doesn't have an accelerator";
} }
#endif // wxUSE_ACCEL #endif // wxUSE_ACCEL
@@ -1125,12 +1125,12 @@ void MyFrame::OnFindMenuItem(wxCommandEvent& WXUNUSED(event))
wxMenuBar *mbar = GetMenuBar(); wxMenuBar *mbar = GetMenuBar();
size_t count = mbar->GetMenuCount(); size_t count = mbar->GetMenuCount();
wxCHECK_RET( count, wxT("no last menu?") ); wxCHECK_RET( count, "no last menu?" );
wxString label = wxGetTextFromUser wxString label = wxGetTextFromUser
( (
wxT("Enter label to search for: "), "Enter label to search for: ",
wxT("Find menu item"), "Find menu item",
wxEmptyString, wxEmptyString,
this this
); );
@@ -1146,11 +1146,11 @@ void MyFrame::OnFindMenuItem(wxCommandEvent& WXUNUSED(event))
} }
if (index == wxNOT_FOUND) if (index == wxNOT_FOUND)
{ {
wxLogWarning(wxT("No menu item with label '%s'"), label.c_str()); wxLogWarning("No menu item with label '%s'", label.c_str());
} }
else else
{ {
wxLogMessage(wxT("Menu item %d in menu %lu has label '%s'"), wxLogMessage("Menu item %d in menu %lu has label '%s'",
index, (unsigned long)menuindex, label.c_str()); index, (unsigned long)menuindex, label.c_str());
} }
} }
@@ -1183,14 +1183,14 @@ void MyFrame::ShowContextMenu(const wxPoint& pos)
} }
else // normal case, shift not pressed else // normal case, shift not pressed
{ {
menu.Append(Menu_Help_About, wxT("&About")); menu.Append(Menu_Help_About, "&About");
menu.Append(Menu_Popup_Submenu, wxT("&Submenu"), CreateDummyMenu(NULL)); menu.Append(Menu_Popup_Submenu, "&Submenu", CreateDummyMenu(NULL));
menu.Append(Menu_Popup_ToBeDeleted, wxT("To be &deleted")); menu.Append(Menu_Popup_ToBeDeleted, "To be &deleted");
menu.AppendCheckItem(Menu_Popup_ToBeChecked, wxT("To be &checked")); menu.AppendCheckItem(Menu_Popup_ToBeChecked, "To be &checked");
menu.Append(Menu_Popup_ToBeGreyed, wxT("To be &greyed"), menu.Append(Menu_Popup_ToBeGreyed, "To be &greyed",
wxT("This menu item should be initially greyed out")); "This menu item should be initially greyed out");
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append(Menu_File_Quit, wxT("E&xit")); menu.Append(Menu_File_Quit, "E&xit");
menu.Delete(Menu_Popup_ToBeDeleted); menu.Delete(Menu_Popup_ToBeDeleted);
menu.Check(Menu_Popup_ToBeChecked, true); menu.Check(Menu_Popup_ToBeChecked, true);
@@ -1209,33 +1209,33 @@ void MyFrame::ShowContextMenu(const wxPoint& pos)
void MyFrame::OnTestNormal(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTestNormal(wxCommandEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("Normal item selected")); wxLogMessage("Normal item selected");
} }
void MyFrame::OnTestCheck(wxCommandEvent& event) void MyFrame::OnTestCheck(wxCommandEvent& event)
{ {
wxLogMessage(wxT("Check item %schecked"), wxLogMessage("Check item %schecked",
event.IsChecked() ? wxT("") : wxT("un")); event.IsChecked() ? "" : "un");
} }
void MyFrame::OnTestRadio(wxCommandEvent& event) void MyFrame::OnTestRadio(wxCommandEvent& event)
{ {
wxLogMessage(wxT("Radio item %d selected"), wxLogMessage("Radio item %d selected",
event.GetId() - Menu_Test_Radio1 + 1); event.GetId() - Menu_Test_Radio1 + 1);
} }
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
void MyFrame::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxChar *what) void MyFrame::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxString& what)
{ {
wxString msg; wxString msg;
msg << wxT("A ") msg << "A "
<< ( event.IsPopup() ? wxT("popup ") : wxT("") ) << ( event.IsPopup() ? "popup " : "" )
<< wxT("menu has been ") << "menu has been "
<< what; << what;
if ( event.GetEventType() == wxEVT_MENU_HIGHLIGHT ) if ( event.GetEventType() == wxEVT_MENU_HIGHLIGHT )
{ {
msg << wxT(" (id=") << event.GetId() << wxT(")"); msg << " (id=" << event.GetId() << ")";
} }
else // wxEVT_MENU_{OPEN,CLOSE} else // wxEVT_MENU_{OPEN,CLOSE}
{ {
@@ -1250,7 +1250,7 @@ void MyFrame::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxChar
} }
} }
msg << wxT("."); msg << ".";
wxLogStatus(this, msg.c_str()); wxLogStatus(this, msg.c_str());
} }
@@ -1324,24 +1324,24 @@ MyDialog::MyDialog(wxWindow* parent)
wxTE_MULTILINE); wxTE_MULTILINE);
m_textctrl->SetEditable(false); m_textctrl->SetEditable(false);
m_textctrl->AppendText(wxT("Dialogs do not have menus, but popup menus should function the same\n\n") m_textctrl->AppendText("Dialogs do not have menus, but popup menus should function the same\n\n"
wxT("Right click this text ctrl to test popup menus.\n")); "Right click this text ctrl to test popup menus.\n");
#endif #endif
} }
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
void MyDialog::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxChar *what) void MyDialog::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxString& what)
{ {
wxString msg; wxString msg;
msg << wxT("A ") msg << "A "
<< ( event.IsPopup() ? wxT("popup ") : wxT("") ) << ( event.IsPopup() ? "popup " : "" )
<< wxT("menu has been ") << "menu has been "
<< what; << what;
if ( event.GetEventType() == wxEVT_MENU_HIGHLIGHT ) if ( event.GetEventType() == wxEVT_MENU_HIGHLIGHT )
{ {
msg << wxT(" (id=") << event.GetId() << wxT(")"); msg << " (id=" << event.GetId() << ")";
} }
msg << wxT(".\n"); msg << ".\n";
m_textctrl->AppendText(msg); m_textctrl->AppendText(msg);
} }
@@ -1366,13 +1366,13 @@ void MyDialog::ShowContextMenu(const wxPoint& pos)
{ {
wxMenu menu; wxMenu menu;
menu.Append(Menu_Help_About, wxT("&About")); menu.Append(Menu_Help_About, "&About");
menu.Append(Menu_Popup_ToBeDeleted, wxT("To be &deleted")); menu.Append(Menu_Popup_ToBeDeleted, "To be &deleted");
menu.AppendCheckItem(Menu_Popup_ToBeChecked, wxT("To be &checked")); menu.AppendCheckItem(Menu_Popup_ToBeChecked, "To be &checked");
menu.Append(Menu_Popup_ToBeGreyed, wxT("To be &greyed"), menu.Append(Menu_Popup_ToBeGreyed, "To be &greyed",
wxT("This menu item should be initially greyed out")); "This menu item should be initially greyed out");
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append(Menu_File_Quit, wxT("E&xit")); menu.Append(Menu_File_Quit, "E&xit");
menu.Delete(Menu_Popup_ToBeDeleted); menu.Delete(Menu_Popup_ToBeDeleted);
menu.Check(Menu_Popup_ToBeChecked, true); menu.Check(Menu_Popup_ToBeChecked, true);

View File

@@ -176,9 +176,9 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, char *, int)
CMainWindow::CMainWindow() CMainWindow::CMainWindow()
{ {
LoadAccelTable( wxT("MainAccelTable") ); LoadAccelTable( "MainAccelTable" );
Create( NULL, wxT("Hello Foundation Application"), Create( NULL, "Hello Foundation Application",
WS_OVERLAPPEDWINDOW, rectDefault, NULL, wxT("MainMenu") ); WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" );
// Create a container representing the MFC window in wxWidgets window // Create a container representing the MFC window in wxWidgets window
// hierarchy. // hierarchy.
@@ -195,7 +195,7 @@ CMainWindow::CMainWindow()
void CMainWindow::OnPaint() void CMainWindow::OnPaint()
{ {
CString s = wxT("Hello, Windows!"); CString s = "Hello, Windows!";
CPaintDC dc( this ); CPaintDC dc( this );
CRect rect; CRect rect;
@@ -209,13 +209,13 @@ void CMainWindow::OnPaint()
void CMainWindow::OnAbout() void CMainWindow::OnAbout()
{ {
CDialog about( wxT("AboutBox"), this ); CDialog about( "AboutBox", this );
about.DoModal(); about.DoModal();
} }
void CMainWindow::OnTest() void CMainWindow::OnTest()
{ {
wxMessageBox(wxT("This is a wxWidgets message box.\nWe're about to create a new wxWidgets frame."), wxT("wxWidgets"), wxOK); wxMessageBox("This is a wxWidgets message box.\nWe're about to create a new wxWidgets frame.", "wxWidgets", wxOK);
wxGetApp().CreateFrame(); wxGetApp().CreateFrame();
} }
@@ -254,10 +254,10 @@ bool MyApp::OnInit()
wxFrame *MyApp::CreateFrame() wxFrame *MyApp::CreateFrame()
{ {
MyChild *subframe = new MyChild(NULL, wxT("Canvas Frame"), wxPoint(10, 10), wxSize(300, 300), MyChild *subframe = new MyChild(NULL, "Canvas Frame", wxPoint(10, 10), wxSize(300, 300),
wxDEFAULT_FRAME_STYLE); wxDEFAULT_FRAME_STYLE);
subframe->SetTitle(wxT("wxWidgets canvas frame")); subframe->SetTitle("wxWidgets canvas frame");
// Give it a status line // Give it a status line
subframe->CreateStatusBar(); subframe->CreateStatusBar();
@@ -265,12 +265,12 @@ wxFrame *MyApp::CreateFrame()
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(HELLO_NEW, wxT("&New MFC Window")); file_menu->Append(HELLO_NEW, "&New MFC Window");
file_menu->Append(HELLO_QUIT, wxT("&Close")); file_menu->Append(HELLO_QUIT, "&Close");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
// Associate the menu bar with the frame // Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar); subframe->SetMenuBar(menu_bar);
@@ -315,7 +315,7 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
dc.DrawEllipse(250, 250, 100, 50); dc.DrawEllipse(250, 250, 100, 50);
dc.DrawLine(50, 230, 200, 230); dc.DrawLine(50, 230, 200, 230);
dc.DrawText(wxT("This is a test string"), 50, 230); dc.DrawText("This is a test string", 50, 230);
} }
// This implements a tiny doodling program! Drag the mouse using // This implements a tiny doodling program! Drag the mouse using

View File

@@ -42,7 +42,7 @@ bool MyApp::OnInit(void)
return false; return false;
// Create the main frame window // Create the main frame window
MyFrame *frame = new MyFrame(NULL, wxID_ANY, wxT("wxWidgets Native Dialog Sample"), wxPoint(0, 0), wxSize(300, 250)); MyFrame *frame = new MyFrame(NULL, wxID_ANY, "wxWidgets Native Dialog Sample", wxPoint(0, 0), wxSize(300, 250));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// Give it a status line // Give it a status line
@@ -52,18 +52,18 @@ bool MyApp::OnInit(void)
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(RESOURCE_TEST1, wxT("&Dialog box test"), wxT("Test dialog box resource")); file_menu->Append(RESOURCE_TEST1, "&Dialog box test", "Test dialog box resource");
file_menu->Append(RESOURCE_QUIT, wxT("E&xit"), wxT("Quit program")); file_menu->Append(RESOURCE_QUIT, "E&xit", "Quit program");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
// Associate the menu bar with the frame // Associate the menu bar with the frame
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
// Make a panel // Make a panel
frame->panel = new wxWindow(frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 400), 0, wxT("MyMainFrame")); frame->panel = new wxWindow(frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 400), 0, "MyMainFrame");
frame->Show(true); frame->Show(true);
return true; return true;
@@ -92,12 +92,12 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
{ {
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
MyDialog dialog; MyDialog dialog;
if (dialog.LoadNativeDialog(this, wxT("dialog1"))) if (dialog.LoadNativeDialog(this, "dialog1"))
{ {
dialog.ShowModal(); dialog.ShowModal();
} }
#else #else
wxMessageBox(wxT("No native dialog support"),wxT("Platform limitation")); wxMessageBox("No native dialog support","Platform limitation");
#endif #endif
} }

View File

@@ -73,7 +73,7 @@ wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent)
panel->SetHelpText( wxT( "Panel with a Button" ) ); panel->SetHelpText( wxT( "Panel with a Button" ) );
#endif #endif
(void) new wxButton( panel, wxID_ANY, wxT("Button"), (void) new wxButton( panel, wxID_ANY, "Button",
wxPoint(10, 10), wxDefaultSize ); wxPoint(10, 10), wxDefaultSize );
return panel; return panel;
@@ -88,18 +88,18 @@ wxPanel *CreateRadioButtonsPage(wxBookCtrlBase *parent)
#endif #endif
wxString animals[] = wxString animals[] =
{ wxT("Fox"), wxT("Hare"), wxT("Rabbit"), { "Fox", "Hare", "Rabbit",
wxT("Sabre-toothed tiger"), wxT("T Rex") }; "Sabre-toothed tiger", "T Rex" };
wxRadioBox *radiobox1 = new wxRadioBox(panel, wxID_ANY, wxT("Choose one"), wxRadioBox *radiobox1 = new wxRadioBox(panel, wxID_ANY, "Choose one",
wxDefaultPosition, wxDefaultSize, 5, animals, 2, wxRA_SPECIFY_ROWS); wxDefaultPosition, wxDefaultSize, 5, animals, 2, wxRA_SPECIFY_ROWS);
wxString computers[] = wxString computers[] =
{ wxT("Amiga"), wxT("Commodore 64"), wxT("PET"), { "Amiga", "Commodore 64", "PET",
wxT("Another") }; "Another" };
wxRadioBox *radiobox2 = new wxRadioBox(panel, wxID_ANY, wxRadioBox *radiobox2 = new wxRadioBox(panel, wxID_ANY,
wxT("Choose your favourite"), wxDefaultPosition, wxDefaultSize, "Choose your favourite", wxDefaultPosition, wxDefaultSize,
4, computers, 0, wxRA_SPECIFY_COLS); 4, computers, 0, wxRA_SPECIFY_COLS);
wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL);
@@ -119,7 +119,7 @@ wxPanel *CreateVetoPage(wxBookCtrlBase *parent)
#endif #endif
(void) new wxStaticText( panel, wxID_ANY, (void) new wxStaticText( panel, wxID_ANY,
wxT("This page intentionally left blank"), "This page intentionally left blank",
wxPoint(10, 10) ); wxPoint(10, 10) );
return panel; return panel;
@@ -133,7 +133,7 @@ wxPanel *CreateBigButtonPage(wxBookCtrlBase *parent)
panel->SetHelpText( wxT( "Panel with a maximized button" ) ); panel->SetHelpText( wxT( "Panel with a maximized button" ) );
#endif #endif
wxButton *buttonBig = new wxButton(panel, wxID_ANY, wxT("Maximized button")); wxButton *buttonBig = new wxButton(panel, wxID_ANY, "Maximized button");
wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL);
sizerPanel->Add(buttonBig, 1, wxEXPAND); sizerPanel->Add(buttonBig, 1, wxEXPAND);
@@ -150,9 +150,9 @@ wxPanel *CreateInsertPage(wxBookCtrlBase *parent)
panel->SetHelpText( wxT( "Maroon panel" ) ); panel->SetHelpText( wxT( "Maroon panel" ) );
#endif #endif
panel->SetBackgroundColour( wxColour( wxT("MAROON") ) ); panel->SetBackgroundColour( wxColour( "MAROON" ) );
(void) new wxStaticText( panel, wxID_ANY, (void) new wxStaticText( panel, wxID_ANY,
wxT("This page has been inserted, not added."), "This page has been inserted, not added.",
wxPoint(10, 10) ); wxPoint(10, 10) );
return panel; return panel;
@@ -211,7 +211,7 @@ wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName)
if ( pageName == MAXIMIZED_BUTTON_PAGE_NAME ) if ( pageName == MAXIMIZED_BUTTON_PAGE_NAME )
return CreateBigButtonPage(parent); return CreateBigButtonPage(parent);
wxFAIL_MSG( wxT("unknown page name") ); wxFAIL_MSG( "unknown page name" );
return NULL; return NULL;
} }
@@ -282,7 +282,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, wxString(wxT("wxWidgets book controls sample"))) : wxFrame(NULL, wxID_ANY, wxString("wxWidgets book controls sample"))
{ {
#if wxUSE_HELP #if wxUSE_HELP
SetExtraStyle(wxFRAME_EX_CONTEXTHELP); SetExtraStyle(wxFRAME_EX_CONTEXTHELP);
@@ -317,83 +317,83 @@ MyFrame::MyFrame()
// menu of the sample // menu of the sample
wxMenu *menuType = new wxMenu; wxMenu *menuType = new wxMenu;
#if wxUSE_NOTEBOOK #if wxUSE_NOTEBOOK
menuType->AppendRadioItem(ID_BOOK_NOTEBOOK, wxT("&Notebook\tCtrl-1")); menuType->AppendRadioItem(ID_BOOK_NOTEBOOK, "&Notebook\tCtrl-1");
#endif #endif
#if wxUSE_LISTBOOK #if wxUSE_LISTBOOK
menuType->AppendRadioItem(ID_BOOK_LISTBOOK, wxT("&Listbook\tCtrl-2")); menuType->AppendRadioItem(ID_BOOK_LISTBOOK, "&Listbook\tCtrl-2");
#endif #endif
#if wxUSE_CHOICEBOOK #if wxUSE_CHOICEBOOK
menuType->AppendRadioItem(ID_BOOK_CHOICEBOOK, wxT("&Choicebook\tCtrl-3")); menuType->AppendRadioItem(ID_BOOK_CHOICEBOOK, "&Choicebook\tCtrl-3");
#endif #endif
#if wxUSE_TREEBOOK #if wxUSE_TREEBOOK
menuType->AppendRadioItem(ID_BOOK_TREEBOOK, wxT("&Treebook\tCtrl-4")); menuType->AppendRadioItem(ID_BOOK_TREEBOOK, "&Treebook\tCtrl-4");
#endif #endif
#if wxUSE_TOOLBOOK #if wxUSE_TOOLBOOK
menuType->AppendRadioItem(ID_BOOK_TOOLBOOK, wxT("T&oolbook\tCtrl-5")); menuType->AppendRadioItem(ID_BOOK_TOOLBOOK, "T&oolbook\tCtrl-5");
#endif #endif
#if wxUSE_AUI #if wxUSE_AUI
menuType->AppendRadioItem(ID_BOOK_AUINOTEBOOK, wxT("&AuiNotebook\tCtrl-6")); menuType->AppendRadioItem(ID_BOOK_AUINOTEBOOK, "&AuiNotebook\tCtrl-6");
#endif #endif
menuType->AppendRadioItem(ID_BOOK_SIMPLEBOOK, "&Simple book\tCtrl-7"); menuType->AppendRadioItem(ID_BOOK_SIMPLEBOOK, "&Simple book\tCtrl-7");
menuType->Check(ID_BOOK_NOTEBOOK + m_type, true); menuType->Check(ID_BOOK_NOTEBOOK + m_type, true);
wxMenu *menuOrient = new wxMenu; wxMenu *menuOrient = new wxMenu;
menuOrient->AppendRadioItem(ID_ORIENT_DEFAULT, wxT("&Default\tAlt-0")); menuOrient->AppendRadioItem(ID_ORIENT_DEFAULT, "&Default\tAlt-0");
menuOrient->AppendRadioItem(ID_ORIENT_TOP, wxT("&Top\tAlt-1")); menuOrient->AppendRadioItem(ID_ORIENT_TOP, "&Top\tAlt-1");
menuOrient->AppendRadioItem(ID_ORIENT_BOTTOM, wxT("&Bottom\tAlt-2")); menuOrient->AppendRadioItem(ID_ORIENT_BOTTOM, "&Bottom\tAlt-2");
menuOrient->AppendRadioItem(ID_ORIENT_LEFT, wxT("&Left\tAlt-3")); menuOrient->AppendRadioItem(ID_ORIENT_LEFT, "&Left\tAlt-3");
menuOrient->AppendRadioItem(ID_ORIENT_RIGHT, wxT("&Right\tAlt-4")); menuOrient->AppendRadioItem(ID_ORIENT_RIGHT, "&Right\tAlt-4");
wxMenu *menuStyle = new wxMenu; wxMenu *menuStyle = new wxMenu;
#if wxUSE_NOTEBOOK #if wxUSE_NOTEBOOK
menuStyle->AppendCheckItem(ID_FIXEDWIDTH, wxT("&Fixed Width (wxNotebook)")); menuStyle->AppendCheckItem(ID_FIXEDWIDTH, "&Fixed Width (wxNotebook)");
menuStyle->AppendCheckItem(ID_MULTI, wxT("&Multiple lines (wxNotebook)")); menuStyle->AppendCheckItem(ID_MULTI, "&Multiple lines (wxNotebook)");
menuStyle->AppendCheckItem(ID_NOPAGETHEME, wxT("&No Page Theme (wxNotebook)")); menuStyle->AppendCheckItem(ID_NOPAGETHEME, "&No Page Theme (wxNotebook)");
#endif #endif
#if wxUSE_TOOLBOOK #if wxUSE_TOOLBOOK
menuStyle->AppendCheckItem(ID_BUTTONBAR, wxT("&Button Bar (wxToolbook)")); menuStyle->AppendCheckItem(ID_BUTTONBAR, "&Button Bar (wxToolbook)");
menuStyle->AppendCheckItem(ID_HORZ_LAYOUT, wxT("&Horizontal layout (wxToolbook)")); menuStyle->AppendCheckItem(ID_HORZ_LAYOUT, "&Horizontal layout (wxToolbook)");
#endif #endif
wxMenu *menuPageOperations = new wxMenu; wxMenu *menuPageOperations = new wxMenu;
menuPageOperations->Append(ID_ADD_PAGE, wxT("&Add page\tAlt-A")); menuPageOperations->Append(ID_ADD_PAGE, "&Add page\tAlt-A");
menuPageOperations->Append(ID_ADD_PAGE_NO_SELECT, wxT("&Add page (don't select)\tAlt-B")); menuPageOperations->Append(ID_ADD_PAGE_NO_SELECT, "&Add page (don't select)\tAlt-B");
menuPageOperations->Append(ID_INSERT_PAGE, wxT("&Insert page\tAlt-I")); menuPageOperations->Append(ID_INSERT_PAGE, "&Insert page\tAlt-I");
menuPageOperations->Append(ID_DELETE_CUR_PAGE, wxT("&Delete current page\tAlt-D")); menuPageOperations->Append(ID_DELETE_CUR_PAGE, "&Delete current page\tAlt-D");
menuPageOperations->Append(ID_DELETE_LAST_PAGE, wxT("D&elete last page\tAlt-L")); menuPageOperations->Append(ID_DELETE_LAST_PAGE, "D&elete last page\tAlt-L");
menuPageOperations->Append(ID_NEXT_PAGE, wxT("&Next page\tAlt-N")); menuPageOperations->Append(ID_NEXT_PAGE, "&Next page\tAlt-N");
#if wxUSE_TREEBOOK #if wxUSE_TREEBOOK
menuPageOperations->AppendSeparator(); menuPageOperations->AppendSeparator();
menuPageOperations->Append(ID_ADD_PAGE_BEFORE, wxT("Insert page &before\tAlt-B")); menuPageOperations->Append(ID_ADD_PAGE_BEFORE, "Insert page &before\tAlt-B");
menuPageOperations->Append(ID_ADD_SUB_PAGE, wxT("Add s&ub page\tAlt-U")); menuPageOperations->Append(ID_ADD_SUB_PAGE, "Add s&ub page\tAlt-U");
#endif #endif
menuPageOperations->AppendSeparator(); menuPageOperations->AppendSeparator();
menuPageOperations->Append(ID_CHANGE_SELECTION, wxT("&Change selection to 0\tCtrl-0")); menuPageOperations->Append(ID_CHANGE_SELECTION, "&Change selection to 0\tCtrl-0");
menuPageOperations->Append(ID_SET_SELECTION, wxT("&Set selection to 0\tShift-Ctrl-0")); menuPageOperations->Append(ID_SET_SELECTION, "&Set selection to 0\tShift-Ctrl-0");
menuPageOperations->AppendSeparator(); menuPageOperations->AppendSeparator();
menuPageOperations->Append(ID_GET_PAGE_SIZE, "Sho&w page size"); menuPageOperations->Append(ID_GET_PAGE_SIZE, "Sho&w page size");
menuPageOperations->Append(ID_SET_PAGE_SIZE, "Set &page size"); menuPageOperations->Append(ID_SET_PAGE_SIZE, "Set &page size");
wxMenu *menuOperations = new wxMenu; wxMenu *menuOperations = new wxMenu;
#if wxUSE_HELP #if wxUSE_HELP
menuOperations->Append(ID_CONTEXT_HELP, wxT("&Context help\tCtrl-F1")); menuOperations->Append(ID_CONTEXT_HELP, "&Context help\tCtrl-F1");
#endif // wxUSE_HELP #endif // wxUSE_HELP
menuOperations->Append(ID_HITTEST, wxT("&Hit test\tCtrl-H")); menuOperations->Append(ID_HITTEST, "&Hit test\tCtrl-H");
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(wxID_ANY, wxT("&Type"), menuType, wxT("Type of control")); menuFile->Append(wxID_ANY, "&Type", menuType, "Type of control");
menuFile->Append(wxID_ANY, wxT("&Orientation"), menuOrient, wxT("Orientation of control")); menuFile->Append(wxID_ANY, "&Orientation", menuOrient, "Orientation of control");
menuFile->AppendCheckItem(ID_SHOW_IMAGES, wxT("&Show images\tAlt-S")); menuFile->AppendCheckItem(ID_SHOW_IMAGES, "&Show images\tAlt-S");
menuFile->Append(wxID_ANY, wxT("&Style"), menuStyle, wxT("Style of control")); menuFile->Append(wxID_ANY, "&Style", menuStyle, "Style of control");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(wxID_EXIT, wxT("E&xit"), wxT("Quits the application")); menuFile->Append(wxID_EXIT, "E&xit", "Quits the application");
menuFile->Check(ID_SHOW_IMAGES, m_chkShowImages); menuFile->Check(ID_SHOW_IMAGES, m_chkShowImages);
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(menuPageOperations, wxT("&Pages")); menuBar->Append(menuPageOperations, "&Pages");
menuBar->Append(menuOperations, wxT("&Operations")); menuBar->Append(menuOperations, "&Operations");
SetMenuBar(menuBar); SetMenuBar(menuBar);
// books creation // books creation
@@ -503,7 +503,7 @@ MyFrame::~MyFrame()
CASE_SIMPLEBOOK(before sb after) \ CASE_SIMPLEBOOK(before sb after) \
\ \
default: \ default: \
wxFAIL_MSG( wxT("unknown book control type") ); \ wxFAIL_MSG( "unknown book control type" ); \
} }
void MyFrame::RecreateBook() void MyFrame::RecreateBook()
@@ -627,12 +627,12 @@ void MyFrame::RecreateBook()
} }
void MyFrame::AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, void MyFrame::AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag,
const wxChar * flagName) const const wxString& flagName) const
{ {
if( (flags & flag) == flag ) if( (flags & flag) == flag )
{ {
if( !flagStr.empty() ) if( !flagStr.empty() )
flagStr += wxT(" | "); flagStr += " | ";
flagStr += flagName; flagStr += flagName;
} }
} }
@@ -645,8 +645,8 @@ wxPanel *MyFrame::CreateNewPage() const
panel->SetHelpText( wxT( "Panel with \"First\" and \"Second\" buttons" ) ); panel->SetHelpText( wxT( "Panel with \"First\" and \"Second\" buttons" ) );
#endif #endif
(void) new wxButton(panel, wxID_ANY, wxT("First button"), wxPoint(10, 30)); (void) new wxButton(panel, wxID_ANY, "First button", wxPoint(10, 30));
(void) new wxButton(panel, wxID_ANY, wxT("Second button"), wxPoint(150, 30)); (void) new wxButton(panel, wxID_ANY, "Second button", wxPoint(150, 30));
return panel; return panel;
} }
@@ -676,13 +676,13 @@ void MyFrame::OnHitTest(wxCommandEvent& WXUNUSED(event))
wxString flagsStr; wxString flagsStr;
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_NOWHERE, wxT("wxBK_HITTEST_NOWHERE") ); AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_NOWHERE, "wxBK_HITTEST_NOWHERE" );
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONICON, wxT("wxBK_HITTEST_ONICON") ); AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONICON, "wxBK_HITTEST_ONICON" );
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONLABEL, wxT("wxBK_HITTEST_ONLABEL") ); AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONLABEL, "wxBK_HITTEST_ONLABEL" );
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONITEM, wxT("wxBK_HITTEST_ONITEM") ); AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONITEM, "wxBK_HITTEST_ONITEM" );
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONPAGE, wxT("wxBK_HITTEST_ONPAGE") ); AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONPAGE, "wxBK_HITTEST_ONPAGE" );
wxLogMessage(wxT("HitTest at (%d,%d): %d: %s"), wxLogMessage("HitTest at (%d,%d): %d: %s",
pt.x, pt.x,
pt.y, pt.y,
pagePos, pagePos,
@@ -754,7 +754,7 @@ void MyFrame::OnAddPage(wxCommandEvent& WXUNUSED(event))
currBook->AddPage(CreateNewPage(), currBook->AddPage(CreateNewPage(),
wxString::Format wxString::Format
( (
ADDED_PAGE_NAME wxT("%u"), ADDED_PAGE_NAME "%u",
++s_pageAdded ++s_pageAdded
), ),
true, true,
@@ -772,7 +772,7 @@ void MyFrame::OnAddPageNoSelect(wxCommandEvent& WXUNUSED(event))
currBook->AddPage(CreateNewPage(), currBook->AddPage(CreateNewPage(),
wxString::Format wxString::Format
( (
ADDED_PAGE_NAME wxT("%u"), ADDED_PAGE_NAME "%u",
++s_pageAdded ++s_pageAdded
), ),
false, false,
@@ -789,7 +789,7 @@ void MyFrame::OnAddSubPage(wxCommandEvent& WXUNUSED(event))
const int selPos = currBook->GetSelection(); const int selPos = currBook->GetSelection();
if ( selPos == wxNOT_FOUND ) if ( selPos == wxNOT_FOUND )
{ {
wxLogError(wxT("Select the parent page first!")); wxLogError("Select the parent page first!");
return; return;
} }
@@ -800,7 +800,7 @@ void MyFrame::OnAddSubPage(wxCommandEvent& WXUNUSED(event))
CreateNewPage(), CreateNewPage(),
wxString::Format wxString::Format
( (
ADDED_SUB_PAGE_NAME wxT("%u"), ADDED_SUB_PAGE_NAME "%u",
++s_subPageAdded ++s_subPageAdded
), ),
true, true,
@@ -817,7 +817,7 @@ void MyFrame::OnAddPageBefore(wxCommandEvent& WXUNUSED(event))
const int selPos = currBook->GetSelection(); const int selPos = currBook->GetSelection();
if ( selPos == wxNOT_FOUND ) if ( selPos == wxNOT_FOUND )
{ {
wxLogError(wxT("Select the parent page first!")); wxLogError("Select the parent page first!");
return; return;
} }
@@ -826,7 +826,7 @@ void MyFrame::OnAddPageBefore(wxCommandEvent& WXUNUSED(event))
CreateNewPage(), CreateNewPage(),
wxString::Format wxString::Format
( (
ADDED_PAGE_NAME_BEFORE wxT("%u"), ADDED_PAGE_NAME_BEFORE "%u",
++s_subPageAdded ++s_subPageAdded
), ),
true, true,
@@ -846,7 +846,7 @@ void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event))
wxPanel *panel = CreateUserCreatedPage( currBook ); wxPanel *panel = CreateUserCreatedPage( currBook );
currBook->InsertPage( 0, panel, currBook->InsertPage( 0, panel,
wxString::Format(INSERTED_PAGE_NAME wxT("%u"), ++s_pageIns), false, wxString::Format(INSERTED_PAGE_NAME "%u", ++s_pageIns), false,
GetIconIndex(currBook) ); GetIconIndex(currBook) );
currBook->SetSelection(0); currBook->SetSelection(0);
@@ -955,12 +955,12 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
wxString selection; wxString selection;
if ( nSel == wxNOT_FOUND ) if ( nSel == wxNOT_FOUND )
selection << wxT("not found"); selection << "not found";
else else
selection << nSel; selection << nSel;
wxString title; wxString title;
title.Printf(wxT("Notebook and friends (%d pages, selection: %s)"), nPages, selection.c_str()); title.Printf("Notebook and friends (%d pages, selection: %s)", nPages, selection.c_str());
SetTitle(title); SetTitle(title);
} }
@@ -972,49 +972,49 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
{ {
wxEventType typeChanged, wxEventType typeChanged,
typeChanging; typeChanging;
const wxChar *name; const wxString name;
} events[] = } events[] =
{ {
#if wxUSE_NOTEBOOK #if wxUSE_NOTEBOOK
{ {
wxEVT_NOTEBOOK_PAGE_CHANGED, wxEVT_NOTEBOOK_PAGE_CHANGED,
wxEVT_NOTEBOOK_PAGE_CHANGING, wxEVT_NOTEBOOK_PAGE_CHANGING,
wxT("wxNotebook") "wxNotebook"
}, },
#endif // wxUSE_NOTEBOOK #endif // wxUSE_NOTEBOOK
#if wxUSE_LISTBOOK #if wxUSE_LISTBOOK
{ {
wxEVT_LISTBOOK_PAGE_CHANGED, wxEVT_LISTBOOK_PAGE_CHANGED,
wxEVT_LISTBOOK_PAGE_CHANGING, wxEVT_LISTBOOK_PAGE_CHANGING,
wxT("wxListbook") "wxListbook"
}, },
#endif // wxUSE_LISTBOOK #endif // wxUSE_LISTBOOK
#if wxUSE_CHOICEBOOK #if wxUSE_CHOICEBOOK
{ {
wxEVT_CHOICEBOOK_PAGE_CHANGED, wxEVT_CHOICEBOOK_PAGE_CHANGED,
wxEVT_CHOICEBOOK_PAGE_CHANGING, wxEVT_CHOICEBOOK_PAGE_CHANGING,
wxT("wxChoicebook") "wxChoicebook"
}, },
#endif // wxUSE_CHOICEBOOK #endif // wxUSE_CHOICEBOOK
#if wxUSE_TREEBOOK #if wxUSE_TREEBOOK
{ {
wxEVT_TREEBOOK_PAGE_CHANGED, wxEVT_TREEBOOK_PAGE_CHANGED,
wxEVT_TREEBOOK_PAGE_CHANGING, wxEVT_TREEBOOK_PAGE_CHANGING,
wxT("wxTreebook") "wxTreebook"
}, },
#endif // wxUSE_TREEBOOK #endif // wxUSE_TREEBOOK
#if wxUSE_TOOLBOOK #if wxUSE_TOOLBOOK
{ {
wxEVT_TOOLBOOK_PAGE_CHANGED, wxEVT_TOOLBOOK_PAGE_CHANGED,
wxEVT_TOOLBOOK_PAGE_CHANGING, wxEVT_TOOLBOOK_PAGE_CHANGING,
wxT("wxToolbook") "wxToolbook"
}, },
#endif // wxUSE_TOOLBOOK #endif // wxUSE_TOOLBOOK
#if wxUSE_AUI #if wxUSE_AUI
{ {
wxEVT_AUINOTEBOOK_PAGE_CHANGED, wxEVT_AUINOTEBOOK_PAGE_CHANGED,
wxEVT_AUINOTEBOOK_PAGE_CHANGING, wxEVT_AUINOTEBOOK_PAGE_CHANGING,
wxT("wxAuiNotebook") "wxAuiNotebook"
}, },
#endif // wxUSE_AUI #endif // wxUSE_AUI
}; };
@@ -1035,7 +1035,7 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
const EventInfo& ei = events[n]; const EventInfo& ei = events[n];
if ( eventType == ei.typeChanged ) if ( eventType == ei.typeChanged )
{ {
nameEvent = wxT("Changed"); nameEvent = "Changed";
} }
else if ( eventType == ei.typeChanging ) else if ( eventType == ei.typeChanging )
{ {
@@ -1046,19 +1046,19 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
{ {
if ( wxMessageBox if ( wxMessageBox
( (
wxT("Are you sure you want to leave this page?\n") "Are you sure you want to leave this page?\n"
wxT("(This demonstrates veto-ing)"), "(This demonstrates veto-ing)",
wxT("Notebook sample"), "Notebook sample",
wxICON_QUESTION | wxYES_NO, wxICON_QUESTION | wxYES_NO,
this this
) != wxYES ) ) != wxYES )
{ {
event.Veto(); event.Veto();
veto = wxT(" (vetoed)"); veto = " (vetoed)";
} }
} }
nameEvent = wxT("Changing"); nameEvent = "Changing";
} }
else // skip end of the loop else // skip end of the loop
{ {
@@ -1071,7 +1071,7 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
static int s_num = 0; static int s_num = 0;
wxLogMessage(wxT("Event #%d: %s: %s (%d) new sel %d, old %d, current %d%s"), wxLogMessage("Event #%d: %s: %s (%d) new sel %d, old %d, current %d%s",
++s_num, ++s_num,
nameControl.c_str(), nameControl.c_str(),
nameEvent.c_str(), nameEvent.c_str(),

View File

@@ -97,7 +97,7 @@ private:
void RecreateBook(); void RecreateBook();
wxPanel *CreateNewPage() const; wxPanel *CreateNewPage() const;
void AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxChar * flagName) const; void AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag, const wxString& flagName) const;
// Sample setup // Sample setup
enum BookType enum BookType
@@ -186,15 +186,15 @@ enum ID_COMMANDS
to decide what type of page it is. to decide what type of page it is.
*/ */
#define I_WAS_INSERTED_PAGE_NAME wxT("Inserted") #define I_WAS_INSERTED_PAGE_NAME "Inserted"
#define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons") #define RADIOBUTTONS_PAGE_NAME "Radiobuttons"
#define VETO_PAGE_NAME wxT("Veto") #define VETO_PAGE_NAME "Veto"
#define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button") #define MAXIMIZED_BUTTON_PAGE_NAME "Maximized button"
// Pages that can be added by the user // Pages that can be added by the user
#define INSERTED_PAGE_NAME wxT("Inserted ") #define INSERTED_PAGE_NAME "Inserted "
#define ADDED_PAGE_NAME wxT("Added ") #define ADDED_PAGE_NAME "Added "
#define ADDED_PAGE_NAME_BEFORE wxT(" Inserted before ") #define ADDED_PAGE_NAME_BEFORE " Inserted before "
#define ADDED_SUB_PAGE_NAME wxT(" Inserted sub-page ") #define ADDED_SUB_PAGE_NAME " Inserted sub-page "

View File

@@ -128,7 +128,7 @@ bool MyApp::OnInit()
return false; return false;
// Create the main application window // Create the main application window
MyFrame *frame = new MyFrame(wxT("OleAuto wxWidgets App"), MyFrame *frame = new MyFrame("OleAuto wxWidgets App",
wxPoint(50, 50), wxSize(450, 340)); wxPoint(50, 50), wxSize(450, 340));
// Show it // Show it
@@ -154,14 +154,14 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(OleAuto_Test, wxT("&Test Excel Automation...")); menuFile->Append(OleAuto_Test, "&Test Excel Automation...");
menuFile->Append(OleAuto_About, wxT("&About")); menuFile->Append(OleAuto_About, "&About");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(OleAuto_Quit, wxT("E&xit")); menuFile->Append(OleAuto_Quit, "E&xit");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -169,7 +169,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -184,8 +184,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("This is an OLE Automation sample"), wxMessageBox("This is an OLE Automation sample",
wxT("About OleAuto"), wxOK | wxICON_INFORMATION, this); "About OleAuto", wxOK | wxICON_INFORMATION, this);
} }
/* Tests OLE automation by making the active Excel cell bold, /* Tests OLE automation by making the active Excel cell bold,
@@ -193,47 +193,47 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
*/ */
void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("Excel will be started if it is not running after you have pressed OK button.") wxMessageBox("Excel will be started if it is not running after you have pressed OK button."
wxT("\nThe active cell should then say 'wxWidgets automation test!' in bold."), "\nThe active cell should then say 'wxWidgets automation test!' in bold.",
wxT("Excel start")); "Excel start");
wxAutomationObject excelObject; wxAutomationObject excelObject;
if ( !excelObject.GetInstance(wxT("Excel.Application")) ) if ( !excelObject.GetInstance("Excel.Application") )
{ {
wxLogError(wxT("Could not create Excel object.")); wxLogError("Could not create Excel object.");
return; return;
} }
// Ensure that Excel is visible // Ensure that Excel is visible
if (!excelObject.PutProperty(wxT("Visible"), true)) if (!excelObject.PutProperty("Visible", true))
{ {
wxLogError(wxT("Could not make Excel object visible")); wxLogError("Could not make Excel object visible");
} }
const wxVariant workbooksCountVariant = excelObject.GetProperty(wxT("Workbooks.Count")); const wxVariant workbooksCountVariant = excelObject.GetProperty("Workbooks.Count");
if (workbooksCountVariant.IsNull()) if (workbooksCountVariant.IsNull())
{ {
wxLogError(wxT("Could not get workbooks count")); wxLogError("Could not get workbooks count");
return; return;
} }
const long workbooksCount = workbooksCountVariant; const long workbooksCount = workbooksCountVariant;
if (workbooksCount == 0) if (workbooksCount == 0)
{ {
const wxVariant workbook = excelObject.CallMethod(wxT("Workbooks.Add")); const wxVariant workbook = excelObject.CallMethod("Workbooks.Add");
if (workbook.IsNull()) if (workbook.IsNull())
{ {
wxLogError(wxT("Could not create new Workbook")); wxLogError("Could not create new Workbook");
return; return;
} }
} }
if (!excelObject.PutProperty(wxT("ActiveCell.Value"), wxT("wxWidgets automation test!"))) if (!excelObject.PutProperty("ActiveCell.Value", "wxWidgets automation test!"))
{ {
wxLogError(wxT("Could not set active cell value.")); wxLogError("Could not set active cell value.");
return; return;
} }
if (!excelObject.PutProperty(wxT("ActiveCell.Font.Bold"), wxVariant(true)) ) if (!excelObject.PutProperty("ActiveCell.Font.Bold", wxVariant(true)) )
{ {
wxLogError(wxT("Could not put Bold property to active cell.")); wxLogError("Could not put Bold property to active cell.");
return; return;
} }
} }

View File

@@ -66,20 +66,20 @@ static void CheckGLError()
// so check that we get a different error than the last time // so check that we get a different error than the last time
if ( err == errLast ) if ( err == errLast )
{ {
wxLogError(wxT("OpenGL error state couldn't be reset.")); wxLogError("OpenGL error state couldn't be reset.");
return; return;
} }
errLast = err; errLast = err;
wxLogError(wxT("OpenGL error %d"), err); wxLogError("OpenGL error %d", err);
} }
} }
// function to draw the texture for cube faces // function to draw the texture for cube faces
static wxImage DrawDice(int size, unsigned num) static wxImage DrawDice(int size, unsigned num)
{ {
wxASSERT_MSG( num >= 1 && num <= 6, wxT("invalid dice index") ); wxASSERT_MSG( num >= 1 && num <= 6, "invalid dice index" );
const int dot = size/16; // radius of a single dot const int dot = size/16; // radius of a single dot
const int gap = 5*size/32; // gap between dots const int gap = 5*size/32; // gap between dots
@@ -459,7 +459,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyFrame::MyFrame( bool stereoWindow ) MyFrame::MyFrame( bool stereoWindow )
: wxFrame(NULL, wxID_ANY, wxT("wxWidgets OpenGL Cube Sample")) : wxFrame(NULL, wxID_ANY, "wxWidgets OpenGL Cube Sample")
{ {
int stereoAttribList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_STEREO, 0 }; int stereoAttribList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_STEREO, 0 };
@@ -474,7 +474,7 @@ MyFrame::MyFrame( bool stereoWindow )
menu->AppendSeparator(); menu->AppendSeparator();
menu->Append(wxID_CLOSE); menu->Append(wxID_CLOSE);
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menu, wxT("&Cube")); menuBar->Append(menu, "&Cube");
SetMenuBar(menuBar); SetMenuBar(menuBar);

View File

@@ -56,7 +56,7 @@ bool MyApp::OnInit()
return false; return false;
// Create the main frame window // Create the main frame window
new MyFrame(NULL, wxT("wxWidgets OpenGL Isosurf Sample")); new MyFrame(NULL, "wxWidgets OpenGL Isosurf Sample");
return true; return true;
} }
@@ -102,9 +102,9 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
// Make a menubar // Make a menubar
wxMenu *fileMenu = new wxMenu; wxMenu *fileMenu = new wxMenu;
fileMenu->Append(wxID_EXIT, wxT("E&xit")); fileMenu->Append(wxID_EXIT, "E&xit");
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(fileMenu, "&File");
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -225,7 +225,7 @@ void TestGLCanvas::LoadSurface(const wxString& filename)
delete stream; delete stream;
wxLogMessage(wxT("Loaded %d vertices, %d triangles from '%s'"), wxLogMessage("Loaded %d vertices, %d triangles from '%s'",
m_numverts, m_numverts-2, filename.c_str()); m_numverts, m_numverts-2, filename.c_str());
// NOTE: for some reason under wxGTK the following is required to avoid that // NOTE: for some reason under wxGTK the following is required to avoid that

View File

@@ -388,7 +388,7 @@ bool DXFRenderer::ParseHeader(wxInputStream& stream)
while (stream.CanRead()) while (stream.CanRead())
{ {
GetLines(text, line1, line2); GetLines(text, line1, line2);
if (line1 == wxT("0") && line2 == wxT("ENDSEC")) if (line1 == "0" && line2 == "ENDSEC")
return true; return true;
} }
return false; return false;
@@ -404,7 +404,7 @@ bool DXFRenderer::ParseTables(wxInputStream& stream)
while (stream.CanRead()) while (stream.CanRead())
{ {
GetLines(text, line1, line2); GetLines(text, line1, line2);
if (line1 == wxT("0") && inlayer) if (line1 == "0" && inlayer)
{ {
// flush layer // flush layer
if (!layer.name.IsEmpty() && layer.colour != -1) if (!layer.name.IsEmpty() && layer.colour != -1)
@@ -417,15 +417,15 @@ bool DXFRenderer::ParseTables(wxInputStream& stream)
layer = DXFLayer(); layer = DXFLayer();
inlayer = false; inlayer = false;
} }
if (line1 == wxT("0") && line2 == wxT("ENDSEC")) if (line1 == "0" && line2 == "ENDSEC")
return true; return true;
else if (line1 == wxT("0") && line2 == wxT("LAYER")) else if (line1 == "0" && line2 == "LAYER")
inlayer = true; inlayer = true;
else if (inlayer) else if (inlayer)
{ {
if (line1 == wxT("2")) // layer name if (line1 == "2") // layer name
layer.name = line2; layer.name = line2;
else if (line1 == wxT("62")) // ACI colour else if (line1 == "62") // ACI colour
{ {
long l; long l;
line2.ToLong(&l); line2.ToLong(&l);
@@ -464,7 +464,7 @@ bool DXFRenderer::ParseEntities(wxInputStream& stream)
while (stream.CanRead()) while (stream.CanRead())
{ {
GetLines(text, line1, line2); GetLines(text, line1, line2);
if (line1 == wxT("0") && state > 0) if (line1 == "0" && state > 0)
{ {
// flush entity // flush entity
if (state == 1) // 3DFACE if (state == 1) // 3DFACE
@@ -499,43 +499,43 @@ bool DXFRenderer::ParseEntities(wxInputStream& stream)
state = 0; state = 0;
} }
} }
if (line1 == wxT("0") && line2 == wxT("ENDSEC")) if (line1 == "0" && line2 == "ENDSEC")
return true; return true;
else if (line1 == wxT("0") && line2 == wxT("3DFACE")) else if (line1 == "0" && line2 == "3DFACE")
state = 1; state = 1;
else if (line1 == wxT("0") && line2 == wxT("LINE")) else if (line1 == "0" && line2 == "LINE")
state = 2; state = 2;
else if (state > 0) else if (state > 0)
{ {
const double d=ToDouble(line2); const double d=ToDouble(line2);
if (line1 == wxT("10")) if (line1 == "10")
v[0].x = d; v[0].x = d;
else if (line1 == wxT("20")) else if (line1 == "20")
v[0].y = d; v[0].y = d;
else if (line1 == wxT("30")) else if (line1 == "30")
v[0].z = d; v[0].z = d;
else if (line1 == wxT("11")) else if (line1 == "11")
v[1].x = d; v[1].x = d;
else if (line1 == wxT("21")) else if (line1 == "21")
v[1].y = d; v[1].y = d;
else if (line1 == wxT("31")) else if (line1 == "31")
v[1].z = d; v[1].z = d;
else if (line1 == wxT("12")) else if (line1 == "12")
v[2].x = d; v[2].x = d;
else if (line1 == wxT("22")) else if (line1 == "22")
v[2].y = d; v[2].y = d;
else if (line1 == wxT("32")) else if (line1 == "32")
v[2].z = d; v[2].z = d;
else if (line1 == wxT("13")) else if (line1 == "13")
v[3].x = d; v[3].x = d;
else if (line1 == wxT("23")) else if (line1 == "23")
v[3].y = d; v[3].y = d;
else if (line1 == wxT("33")) else if (line1 == "33")
v[3].z = d; v[3].z = d;
else if (line1 == wxT("8")) // layer else if (line1 == "8") // layer
layer = line2; layer = line2;
else if (line1 == wxT("62")) // colour else if (line1 == "62") // colour
{ {
long l; long l;
line2.ToLong(&l); line2.ToLong(&l);
@@ -557,24 +557,24 @@ bool DXFRenderer::Load(wxInputStream& stream)
while (stream.CanRead()) while (stream.CanRead())
{ {
GetLines(text, line1, line2); GetLines(text, line1, line2);
if (line1 == wxT("999")) // comment if (line1 == "999") // comment
continue; continue;
else if (line1 == wxT("0") && line2 == wxT("SECTION")) else if (line1 == "0" && line2 == "SECTION")
{ {
GetLines(text, line1, line2); GetLines(text, line1, line2);
if (line1 == wxT("2")) if (line1 == "2")
{ {
if (line2 == wxT("HEADER")) if (line2 == "HEADER")
{ {
if (!ParseHeader(stream)) if (!ParseHeader(stream))
return false; return false;
} }
else if (line2 == wxT("TABLES")) else if (line2 == "TABLES")
{ {
if (!ParseTables(stream)) if (!ParseTables(stream))
return false; return false;
} }
else if (line2 == wxT("ENTITIES")) else if (line2 == "ENTITIES")
{ {
if (!ParseEntities(stream)) if (!ParseEntities(stream))
return false; return false;

View File

@@ -43,15 +43,15 @@ bool MyApp::OnInit()
return false; return false;
// Create the main frame window // Create the main frame window
MyFrame *frame = new MyFrame(NULL, wxT("wxWidgets Penguin Sample"), MyFrame *frame = new MyFrame(NULL, "wxWidgets Penguin Sample",
wxDefaultPosition, wxDefaultSize); wxDefaultPosition, wxDefaultSize);
#if wxUSE_ZLIB #if wxUSE_ZLIB
if (wxFileExists(wxT("penguin.dxf.gz"))) if (wxFileExists("penguin.dxf.gz"))
frame->GetCanvas()->LoadDXF(wxT("penguin.dxf.gz")); frame->GetCanvas()->LoadDXF("penguin.dxf.gz");
#else #else
if (wxFileExists(wxT("penguin.dxf"))) if (wxFileExists("penguin.dxf"))
frame->GetCanvas()->LoadDXF(wxT("penguin.dxf")); frame->GetCanvas()->LoadDXF("penguin.dxf");
#endif #endif
/* Show the frame */ /* Show the frame */
@@ -81,16 +81,16 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
// Make the "File" menu // Make the "File" menu
wxMenu *fileMenu = new wxMenu; wxMenu *fileMenu = new wxMenu;
fileMenu->Append(wxID_OPEN, wxT("&Open...")); fileMenu->Append(wxID_OPEN, "&Open...");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, wxT("E&xit\tALT-X")); fileMenu->Append(wxID_EXIT, "E&xit\tALT-X");
// Make the "Help" menu // Make the "Help" menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(wxID_HELP, wxT("&About")); helpMenu->Append(wxID_HELP, "&About");
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(fileMenu, "&File");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
SetMenuBar(menuBar); SetMenuBar(menuBar);
Show(true); Show(true);
@@ -102,11 +102,11 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
// File|Open... command // File|Open... command
void MyFrame::OnMenuFileOpen( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnMenuFileOpen( wxCommandEvent& WXUNUSED(event) )
{ {
wxString filename = wxFileSelector(wxT("Choose DXF Model"), wxT(""), wxT(""), wxT(""), wxString filename = wxFileSelector("Choose DXF Model", "", "", "",
#if wxUSE_ZLIB #if wxUSE_ZLIB
wxT("DXF Drawing (*.dxf;*.dxf.gz)|*.dxf;*.dxf.gz|All files (*.*)|*.*"), "DXF Drawing (*.dxf;*.dxf.gz)|*.dxf;*.dxf.gz|All files (*.*)|*.*",
#else #else
wxT("DXF Drawing (*.dxf)|*.dxf)|All files (*.*)|*.*"), "DXF Drawing (*.dxf)|*.dxf)|All files (*.*)|*.*",
#endif #endif
wxFD_OPEN); wxFD_OPEN);
if (!filename.IsEmpty()) if (!filename.IsEmpty())
@@ -126,7 +126,7 @@ void MyFrame::OnMenuFileExit( wxCommandEvent& WXUNUSED(event) )
// Help|About command // Help|About command
void MyFrame::OnMenuHelpAbout( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnMenuHelpAbout( wxCommandEvent& WXUNUSED(event) )
{ {
wxMessageBox(wxT("OpenGL Penguin Sample (c) Robert Roebling, Sandro Sigala et al")); wxMessageBox("OpenGL Penguin Sample (c) Robert Roebling, Sandro Sigala et al");
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -222,7 +222,7 @@ void TestGLCanvas::LoadDXF(const wxString& filename)
if (stream.IsOk()) if (stream.IsOk())
#if wxUSE_ZLIB #if wxUSE_ZLIB
{ {
if (filename.Right(3).Lower() == wxT(".gz")) if (filename.Right(3).Lower() == ".gz")
{ {
wxZlibInputStream zstream(stream); wxZlibInputStream zstream(stream);
m_renderer.Load(zstream); m_renderer.Load(zstream);

View File

@@ -79,7 +79,7 @@ public:
TestGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, TestGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = wxT("TestGLCanvas")); const wxString& name = "TestGLCanvas");
virtual ~TestGLCanvas(); virtual ~TestGLCanvas();

View File

@@ -115,75 +115,75 @@ void OwnerDrawnFrame::InitMenu()
fontBmp(wxFontInfo(14)); fontBmp(wxFontInfo(14));
// sorry for my artistic skills... // sorry for my artistic skills...
wxBitmap bmpBell(wxT("bell")), wxBitmap bmpBell("bell"),
bmpSound(wxT("sound")), bmpSound("sound"),
bmpNoSound(wxT("nosound")), bmpNoSound("nosound"),
bmpInfo(wxT("info")), bmpInfo("info"),
bmpInfo_mono(wxT("info_mono")); bmpInfo_mono("info_mono");
// construct submenu // construct submenu
pItem = new wxMenuItem(sub_menu, Menu_Sub1, wxT("Submenu &first"), wxT("large")); pItem = new wxMenuItem(sub_menu, Menu_Sub1, "Submenu &first", "large");
pItem->SetFont(fontLarge); pItem->SetFont(fontLarge);
sub_menu->Append(pItem); sub_menu->Append(pItem);
pItem = new wxMenuItem(sub_menu, Menu_Sub2, wxT("Submenu &second"), wxT("italic"), pItem = new wxMenuItem(sub_menu, Menu_Sub2, "Submenu &second", "italic",
wxITEM_CHECK); wxITEM_CHECK);
pItem->SetFont(fontItalic); pItem->SetFont(fontItalic);
sub_menu->Append(pItem); sub_menu->Append(pItem);
pItem = new wxMenuItem(sub_menu, Menu_Sub3, wxT("Submenu &third"), wxT("underlined"), pItem = new wxMenuItem(sub_menu, Menu_Sub3, "Submenu &third", "underlined",
wxITEM_CHECK); wxITEM_CHECK);
pItem->SetFont(fontUlined); pItem->SetFont(fontUlined);
sub_menu->Append(pItem); sub_menu->Append(pItem);
// construct menu // construct menu
pItem = new wxMenuItem(file_menu, Menu_Test1, wxT("&Uncheckable"), wxT("red item")); pItem = new wxMenuItem(file_menu, Menu_Test1, "&Uncheckable", "red item");
pItem->SetFont(*wxITALIC_FONT); pItem->SetFont(*wxITALIC_FONT);
pItem->SetTextColour(wxColor(255, 0, 0)); pItem->SetTextColour(wxColor(255, 0, 0));
file_menu->Append(pItem); file_menu->Append(pItem);
pItem = new wxMenuItem(file_menu, Menu_Test2, wxT("&Checkable"), pItem = new wxMenuItem(file_menu, Menu_Test2, "&Checkable",
wxT("checkable item"), wxITEM_CHECK); "checkable item", wxITEM_CHECK);
pItem->SetFont(*wxSMALL_FONT); pItem->SetFont(*wxSMALL_FONT);
file_menu->Append(pItem); file_menu->Append(pItem);
file_menu->Check(Menu_Test2, true); file_menu->Check(Menu_Test2, true);
pItem = new wxMenuItem(file_menu, Menu_Test3, wxT("&Disabled"), wxT("disabled item")); pItem = new wxMenuItem(file_menu, Menu_Test3, "&Disabled", "disabled item");
pItem->SetFont(*wxNORMAL_FONT); pItem->SetFont(*wxNORMAL_FONT);
file_menu->Append(pItem); file_menu->Append(pItem);
file_menu->Enable(Menu_Test3, false); file_menu->Enable(Menu_Test3, false);
file_menu->AppendSeparator(); file_menu->AppendSeparator();
pItem = new wxMenuItem(file_menu, Menu_Bitmap, wxT("&Bell"), pItem = new wxMenuItem(file_menu, Menu_Bitmap, "&Bell",
wxT("check/uncheck me!"), wxITEM_CHECK); "check/uncheck me!", wxITEM_CHECK);
pItem->SetFont(fontBmp); pItem->SetFont(fontBmp);
pItem->SetBitmaps(bmpBell); pItem->SetBitmaps(bmpBell);
file_menu->Append(pItem); file_menu->Append(pItem);
pItem = new wxMenuItem(file_menu, Menu_Bitmap2, wxT("So&und"), pItem = new wxMenuItem(file_menu, Menu_Bitmap2, "So&und",
wxT("icon changes!"), wxITEM_CHECK); "icon changes!", wxITEM_CHECK);
pItem->SetFont(fontBmp); pItem->SetFont(fontBmp);
pItem->SetBitmaps(bmpSound, bmpNoSound); pItem->SetBitmaps(bmpSound, bmpNoSound);
file_menu->Append(pItem); file_menu->Append(pItem);
file_menu->AppendSeparator(); file_menu->AppendSeparator();
pItem = new wxMenuItem(file_menu, Menu_Submenu, wxT("&Sub menu"), wxT(""), pItem = new wxMenuItem(file_menu, Menu_Submenu, "&Sub menu", "",
wxITEM_CHECK, sub_menu); wxITEM_CHECK, sub_menu);
pItem->SetFont(*wxSWISS_FONT); pItem->SetFont(*wxSWISS_FONT);
file_menu->Append(pItem); file_menu->Append(pItem);
file_menu->AppendSeparator(); file_menu->AppendSeparator();
pItem = new wxMenuItem(file_menu, Menu_Toggle, wxT("&Disable/Enable\tCtrl+D"), pItem = new wxMenuItem(file_menu, Menu_Toggle, "&Disable/Enable\tCtrl+D",
wxT("enables/disables the About-Item"), wxITEM_NORMAL); "enables/disables the About-Item", wxITEM_NORMAL);
pItem->SetFont(*wxNORMAL_FONT); pItem->SetFont(*wxNORMAL_FONT);
file_menu->Append(pItem); file_menu->Append(pItem);
// Of course Ctrl+RatherLongAccel will not work in this example: // Of course Ctrl+RatherLongAccel will not work in this example:
pAboutItem = new wxMenuItem(file_menu, Menu_About, wxT("&About\tCtrl+RatherLongAccel"), pAboutItem = new wxMenuItem(file_menu, Menu_About, "&About\tCtrl+RatherLongAccel",
wxT("display program information"), wxITEM_NORMAL); "display program information", wxITEM_NORMAL);
pAboutItem->SetBitmap(bmpInfo); pAboutItem->SetBitmap(bmpInfo);
pAboutItem->SetDisabledBitmap(bmpInfo_mono); pAboutItem->SetDisabledBitmap(bmpInfo_mono);
file_menu->Append(pAboutItem); file_menu->Append(pAboutItem);
@@ -191,66 +191,66 @@ void OwnerDrawnFrame::InitMenu()
file_menu->AppendSeparator(); file_menu->AppendSeparator();
#endif #endif
pItem = new wxMenuItem(file_menu, Menu_Quit, wxT("&Quit"), wxT("Normal item"), pItem = new wxMenuItem(file_menu, Menu_Quit, "&Quit", "Normal item",
wxITEM_NORMAL); wxITEM_NORMAL);
file_menu->Append(pItem); file_menu->Append(pItem);
wxMenu* drawn_menu = new wxMenu; wxMenu* drawn_menu = new wxMenu;
pItem = new wxMenuItem(drawn_menu, Menu_Drawn1, wxT("&Menu item\tCtrl+K")); pItem = new wxMenuItem(drawn_menu, Menu_Drawn1, "&Menu item\tCtrl+K");
drawn_menu->Append(pItem); drawn_menu->Append(pItem);
drawn_menu->AppendSeparator(); drawn_menu->AppendSeparator();
pItem = new wxMenuItem(drawn_menu, Menu_Drawn2, wxT("&Checked item"), pItem = new wxMenuItem(drawn_menu, Menu_Drawn2, "&Checked item",
wxT("check/uncheck me!"), wxITEM_CHECK); "check/uncheck me!", wxITEM_CHECK);
drawn_menu->Append(pItem); drawn_menu->Append(pItem);
drawn_menu->Check(Menu_Drawn2, true); drawn_menu->Check(Menu_Drawn2, true);
pItem = new wxMenuItem(drawn_menu, Menu_Drawn3, wxT("&Radio item"), pItem = new wxMenuItem(drawn_menu, Menu_Drawn3, "&Radio item",
wxT("check/uncheck me!"), wxITEM_RADIO); "check/uncheck me!", wxITEM_RADIO);
drawn_menu->Append(pItem); drawn_menu->Append(pItem);
drawn_menu->AppendSeparator(); drawn_menu->AppendSeparator();
pItem = new wxMenuItem(drawn_menu, Menu_Drawn4, wxT("&Disabled item\tCtrl+RatherLongAccel"), pItem = new wxMenuItem(drawn_menu, Menu_Drawn4, "&Disabled item\tCtrl+RatherLongAccel",
wxT("disabled item")); "disabled item");
pItem->Enable(false); pItem->Enable(false);
drawn_menu->Append(pItem); drawn_menu->Append(pItem);
pItem = new wxMenuItem(drawn_menu, Menu_Drawn5, wxT("&Other\tCtrl+O"), wxT("other item")); pItem = new wxMenuItem(drawn_menu, Menu_Drawn5, "&Other\tCtrl+O", "other item");
pItem->SetTextColour(*wxRED); pItem->SetTextColour(*wxRED);
drawn_menu->Append(pItem); drawn_menu->Append(pItem);
wxMenu* native_menu = new wxMenu; wxMenu* native_menu = new wxMenu;
pItem = new wxMenuItem(native_menu, Menu_Native1, wxT("&Menu item\tCtrl+K")); pItem = new wxMenuItem(native_menu, Menu_Native1, "&Menu item\tCtrl+K");
native_menu->Append(pItem); native_menu->Append(pItem);
native_menu->AppendSeparator(); native_menu->AppendSeparator();
pItem = new wxMenuItem(native_menu, Menu_Native2, wxT("&Checked item"), pItem = new wxMenuItem(native_menu, Menu_Native2, "&Checked item",
wxT("check/uncheck me!"), wxITEM_CHECK); "check/uncheck me!", wxITEM_CHECK);
native_menu->Append(pItem); native_menu->Append(pItem);
native_menu->Check(Menu_Native2, true); native_menu->Check(Menu_Native2, true);
pItem = new wxMenuItem(native_menu, Menu_Native3, wxT("&Radio item"), pItem = new wxMenuItem(native_menu, Menu_Native3, "&Radio item",
wxT("check/uncheck me!"), wxITEM_RADIO); "check/uncheck me!", wxITEM_RADIO);
native_menu->Append(pItem); native_menu->Append(pItem);
native_menu->AppendSeparator(); native_menu->AppendSeparator();
pItem = new wxMenuItem(native_menu, Menu_Native4, wxT("&Disabled item\tCtrl+RatherLongAccel"), pItem = new wxMenuItem(native_menu, Menu_Native4, "&Disabled item\tCtrl+RatherLongAccel",
wxT("disabled item")); "disabled item");
pItem->Enable(false); pItem->Enable(false);
native_menu->Append(pItem); native_menu->Append(pItem);
pItem = new wxMenuItem(native_menu, Menu_Native5, wxT("&Other\tCtrl+O"), wxT("other item")); pItem = new wxMenuItem(native_menu, Menu_Native5, "&Other\tCtrl+O", "other item");
native_menu->Append(pItem); native_menu->Append(pItem);
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
menu_bar->Append(drawn_menu, wxT("&Drawn")); menu_bar->Append(drawn_menu, "&Drawn");
menu_bar->Append(native_menu, wxT("&Native")); menu_bar->Append(native_menu, "&Native");
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
} }
@@ -270,16 +270,16 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, const wxString& title,
const int widths[] = { -1, 60 }; const int widths[] = { -1, 60 };
CreateStatusBar(2); CreateStatusBar(2);
SetStatusWidths(2, widths); SetStatusWidths(2, widths);
SetStatusText(wxT("no selection"), 0); SetStatusText("no selection", 0);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
// make a panel with some controls // make a panel with some controls
wxPanel *pPanel = new wxPanel(this); wxPanel *pPanel = new wxPanel(this);
// check list box // check list box
static const wxChar* aszChoices[] = { wxT("Hello"), wxT("world"), wxT("and"), static const wxString aszChoices[] = { "Hello", "world", "and",
wxT("goodbye"), wxT("cruel"), wxT("world"), "goodbye", "cruel", "world",
wxT("-------"), wxT("owner-drawn"), wxT("listbox") }; "-------", "owner-drawn", "listbox" };
wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)]; wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
unsigned int ui; unsigned int ui;
@@ -308,9 +308,9 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, const wxString& title,
m_pListBox->Check(2); m_pListBox->Check(2);
// normal (but owner-drawn) listbox // normal (but owner-drawn) listbox
static const wxChar* aszColors[] = { wxT("Red"), wxT("Blue"), wxT("Pink"), static const wxString aszColors[] = { "Red", "Blue", "Pink",
wxT("Green"), wxT("Yellow"), "Green", "Yellow",
wxT("Black"), wxT("Violet") }; "Black", "Violet" };
astrChoices = new wxString[WXSIZEOF(aszColors)]; astrChoices = new wxString[WXSIZEOF(aszColors)];
@@ -376,8 +376,8 @@ void OwnerDrawnFrame::OnMenuToggle(wxCommandEvent& WXUNUSED(event))
void OwnerDrawnFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void OwnerDrawnFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageDialog dialog(this, wxMessageDialog dialog(this,
wxT("Demo of owner-drawn controls\n"), "Demo of owner-drawn controls\n",
wxT("About wxOwnerDrawn"), wxYES_NO | wxCANCEL); "About wxOwnerDrawn", wxYES_NO | wxCANCEL);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -386,8 +386,8 @@ void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
wxString strSelection; wxString strSelection;
unsigned int nSel = event.GetSelection(); unsigned int nSel = event.GetSelection();
strSelection.Printf(wxT("item %d selected (%schecked)"), nSel, strSelection.Printf("item %d selected (%schecked)", nSel,
m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not ")); m_pListBox->IsChecked(nSel) ? "" : "not ");
SetStatusText(strSelection); SetStatusText(strSelection);
#else #else
wxUnusedVar(event); wxUnusedVar(event);
@@ -397,7 +397,7 @@ void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& WXUNUSED(event)) void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& WXUNUSED(event))
{ {
wxString strSelection; wxString strSelection;
strSelection.Printf(wxT("item %d double clicked"), strSelection.Printf("item %d double clicked",
m_pListBox->GetSelection()); m_pListBox->GetSelection());
wxMessageDialog dialog(this, strSelection); wxMessageDialog dialog(this, strSelection);
dialog.ShowModal(); dialog.ShowModal();
@@ -408,8 +408,8 @@ void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
wxString strSelection; wxString strSelection;
unsigned int nItem = event.GetInt(); unsigned int nItem = event.GetInt();
strSelection.Printf(wxT("item %d was %schecked"), nItem, strSelection.Printf("item %d was %schecked", nItem,
m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un")); m_pListBox->IsChecked(nItem) ? "" : "un");
SetStatusText(strSelection); SetStatusText(strSelection);
#else #else
wxUnusedVar(event); wxUnusedVar(event);

View File

@@ -119,17 +119,17 @@ SimpleTransientPopup::SimpleTransientPopup( wxWindow *parent, bool scrolled )
m_panel->Bind(wxEVT_MOTION, &SimpleTransientPopup::OnMouse, this); m_panel->Bind(wxEVT_MOTION, &SimpleTransientPopup::OnMouse, this);
wxStaticText *text = new wxStaticText( m_panel, wxID_ANY, wxStaticText *text = new wxStaticText( m_panel, wxID_ANY,
wxT("wxPopupTransientWindow is a\n") "wxPopupTransientWindow is a\n"
wxT("wxPopupWindow which disappears\n") "wxPopupWindow which disappears\n"
wxT("automatically when the user\n") "automatically when the user\n"
wxT("clicks the mouse outside it or if it\n") "clicks the mouse outside it or if it\n"
wxT("(or its first child) loses focus in \n") "(or its first child) loses focus in \n"
wxT("any other way.") ); "any other way." );
m_button = new wxButton(m_panel, Minimal_PopupButton, wxT("Press Me")); m_button = new wxButton(m_panel, Minimal_PopupButton, "Press Me");
m_spinCtrl = new wxSpinCtrl(m_panel, Minimal_PopupSpinctrl, wxT("Hello")); m_spinCtrl = new wxSpinCtrl(m_panel, Minimal_PopupSpinctrl, "Hello");
m_mouseText = new wxStaticText(m_panel, wxID_ANY, m_mouseText = new wxStaticText(m_panel, wxID_ANY,
wxT("<- Test Mouse ->")); "<- Test Mouse ->");
wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
topSizer->Add( text, 0, wxALL, 5 ); topSizer->Add( text, 0, wxALL, 5 );
@@ -235,10 +235,10 @@ void SimpleTransientPopup::OnButton(wxCommandEvent& event)
wxLogMessage( "%p SimpleTransientPopup::OnButton ID %d", this, event.GetId()); wxLogMessage( "%p SimpleTransientPopup::OnButton ID %d", this, event.GetId());
wxButton *button = wxDynamicCast(event.GetEventObject(), wxButton); wxButton *button = wxDynamicCast(event.GetEventObject(), wxButton);
if (button->GetLabel() == wxT("Press Me")) if (button->GetLabel() == "Press Me")
button->SetLabel(wxT("Pressed")); button->SetLabel("Pressed");
else else
button->SetLabel(wxT("Press Me")); button->SetLabel("Press Me");
event.Skip(); event.Skip();
} }
@@ -311,7 +311,7 @@ bool MyApp::OnInit()
return false; return false;
// create the main application window // create the main application window
m_frame = new MyFrame(wxT("Popup wxWidgets App")); m_frame = new MyFrame("Popup wxWidgets App");
// and show it (the frames, unlike simple controls, are not shown when // and show it (the frames, unlike simple controls, are not shown when
// created initially) // created initially)
@@ -348,15 +348,15 @@ MyFrame::MyFrame(const wxString& title)
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(Minimal_About, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(Minimal_About, "&About\tF1", "Show about dialog");
menuFile->Append(Minimal_TestDialog, wxT("&Test dialog\tAlt-T"), wxT("Test dialog")); menuFile->Append(Minimal_TestDialog, "&Test dialog\tAlt-T", "Test dialog");
menuFile->Append(Minimal_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -365,12 +365,12 @@ MyFrame::MyFrame(const wxString& title)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
wxPanel *panel = new wxPanel(this, -1); wxPanel *panel = new wxPanel(this, -1);
wxButton *button1 = new wxButton( panel, Minimal_StartSimplePopup, wxT("Show simple popup"), wxPoint(20,20) ); wxButton *button1 = new wxButton( panel, Minimal_StartSimplePopup, "Show simple popup", wxPoint(20,20) );
wxButton *button2 = new wxButton( panel, Minimal_StartScrolledPopup, wxT("Show scrolled popup"), wxPoint(20,70) ); wxButton *button2 = new wxButton( panel, Minimal_StartScrolledPopup, "Show scrolled popup", wxPoint(20,70) );
m_logWin = new wxTextCtrl( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, m_logWin = new wxTextCtrl( panel, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxDefaultSize, wxTE_MULTILINE ); wxDefaultSize, wxTE_MULTILINE );
@@ -398,12 +398,12 @@ MyFrame::~MyFrame()
void MyFrame::OnActivate(wxActivateEvent& WXUNUSED(event)) void MyFrame::OnActivate(wxActivateEvent& WXUNUSED(event))
{ {
wxLogMessage( wxT("In activate...") ); wxLogMessage( "In activate..." );
} }
void MyFrame::OnStartSimplePopup(wxCommandEvent& event) void MyFrame::OnStartSimplePopup(wxCommandEvent& event)
{ {
wxLogMessage( wxT("================================================") ); wxLogMessage( "================================================" );
delete m_simplePopup; delete m_simplePopup;
m_simplePopup = new SimpleTransientPopup( this, false ); m_simplePopup = new SimpleTransientPopup( this, false );
wxWindow *btn = (wxWindow*) event.GetEventObject(); wxWindow *btn = (wxWindow*) event.GetEventObject();
@@ -416,7 +416,7 @@ void MyFrame::OnStartSimplePopup(wxCommandEvent& event)
void MyFrame::OnStartScrolledPopup(wxCommandEvent& event) void MyFrame::OnStartScrolledPopup(wxCommandEvent& event)
{ {
wxLogMessage( wxT("================================================") ); wxLogMessage( "================================================" );
delete m_scrolledPopup; delete m_scrolledPopup;
m_scrolledPopup = new SimpleTransientPopup( this, true ); m_scrolledPopup = new SimpleTransientPopup( this, true );
wxWindow *btn = (wxWindow*) event.GetEventObject(); wxWindow *btn = (wxWindow*) event.GetEventObject();
@@ -429,7 +429,7 @@ void MyFrame::OnStartScrolledPopup(wxCommandEvent& event)
void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event))
{ {
MyDialog dialog( wxT("Test") ); MyDialog dialog( "Test" );
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -442,10 +442,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is the About dialog of the popup sample.\n") msg.Printf( "This is the About dialog of the popup sample.\n"
wxT("Welcome to %s"), wxVERSION_STRING); "Welcome to %s", wxVERSION_STRING);
wxMessageBox(msg, wxT("About Popup"), wxOK | wxICON_INFORMATION, this); wxMessageBox(msg, "About Popup", wxOK | wxICON_INFORMATION, this);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -463,10 +463,10 @@ MyDialog::MyDialog(const wxString& title)
m_simplePopup = m_scrolledPopup = NULL; m_simplePopup = m_scrolledPopup = NULL;
wxPanel *panel = new wxPanel(this, -1); wxPanel *panel = new wxPanel(this, -1);
wxButton *button1 = new wxButton( panel, Minimal_StartSimplePopup, wxT("Show simple popup"), wxPoint(20,20) ); wxButton *button1 = new wxButton( panel, Minimal_StartSimplePopup, "Show simple popup", wxPoint(20,20) );
wxButton *button2 = new wxButton( panel, Minimal_StartScrolledPopup, wxT("Show scrolled popup"), wxPoint(20,60) ); wxButton *button2 = new wxButton( panel, Minimal_StartScrolledPopup, "Show scrolled popup", wxPoint(20,60) );
wxButton *okButton = new wxButton( panel, wxID_OK, wxT("OK"), wxPoint(20,200) ); wxButton *okButton = new wxButton( panel, wxID_OK, "OK", wxPoint(20,200) );
wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
topSizer->Add( button1, 0, wxALL, 5 ); topSizer->Add( button1, 0, wxALL, 5 );
@@ -479,7 +479,7 @@ MyDialog::MyDialog(const wxString& title)
void MyDialog::OnStartSimplePopup(wxCommandEvent& event) void MyDialog::OnStartSimplePopup(wxCommandEvent& event)
{ {
wxLogMessage( wxT("================================================") ); wxLogMessage( "================================================" );
delete m_simplePopup; delete m_simplePopup;
m_simplePopup = new SimpleTransientPopup( this, false ); m_simplePopup = new SimpleTransientPopup( this, false );
wxWindow *btn = (wxWindow*) event.GetEventObject(); wxWindow *btn = (wxWindow*) event.GetEventObject();
@@ -492,7 +492,7 @@ void MyDialog::OnStartSimplePopup(wxCommandEvent& event)
void MyDialog::OnStartScrolledPopup(wxCommandEvent& event) void MyDialog::OnStartScrolledPopup(wxCommandEvent& event)
{ {
wxLogMessage( wxT("================================================") ); wxLogMessage( "================================================" );
delete m_scrolledPopup; delete m_scrolledPopup;
m_scrolledPopup = new SimpleTransientPopup( this, true ); m_scrolledPopup = new SimpleTransientPopup( this, true );
wxWindow *btn = (wxWindow*) event.GetEventObject(); wxWindow *btn = (wxWindow*) event.GetEventObject();

View File

@@ -46,7 +46,7 @@ class MyFrame : public wxFrame
{ {
public: public:
MyFrame() MyFrame()
: wxFrame(NULL, wxID_ANY, wxT("wxWidgets Power Management Sample"), : wxFrame(NULL, wxID_ANY, "wxWidgets Power Management Sample",
wxDefaultPosition, wxSize(500, 200)) wxDefaultPosition, wxSize(500, 200))
{ {
m_powerResourceBlocker = NULL; m_powerResourceBlocker = NULL;
@@ -56,10 +56,10 @@ public:
fileMenu->Append(wxID_ABORT, "Stop long running task"); fileMenu->Append(wxID_ABORT, "Stop long running task");
wxMenuBar* menuBar = new wxMenuBar(); wxMenuBar* menuBar = new wxMenuBar();
menuBar->Append(fileMenu, wxT("&Task")); menuBar->Append(fileMenu, "&Task");
SetMenuBar(menuBar); SetMenuBar(menuBar);
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxT(""), wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY); wxTE_MULTILINE | wxTE_READONLY);
m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(text)); m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(text));
@@ -101,28 +101,28 @@ private:
#ifdef wxHAS_POWER_EVENTS #ifdef wxHAS_POWER_EVENTS
void OnSuspending(wxPowerEvent& event) void OnSuspending(wxPowerEvent& event)
{ {
wxLogMessage(wxT("System suspend starting...")); wxLogMessage("System suspend starting...");
if ( wxMessageBox(wxT("Veto suspend?"), wxT("Please answer"), if ( wxMessageBox("Veto suspend?", "Please answer",
wxYES_NO, this) == wxYES ) wxYES_NO, this) == wxYES )
{ {
event.Veto(); event.Veto();
wxLogMessage(wxT("Vetoed suspend.")); wxLogMessage("Vetoed suspend.");
} }
} }
void OnSuspended(wxPowerEvent& WXUNUSED(event)) void OnSuspended(wxPowerEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("System is going to suspend.")); wxLogMessage("System is going to suspend.");
} }
void OnSuspendCancel(wxPowerEvent& WXUNUSED(event)) void OnSuspendCancel(wxPowerEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("System suspend was cancelled.")); wxLogMessage("System suspend was cancelled.");
} }
void OnResume(wxPowerEvent& WXUNUSED(event)) void OnResume(wxPowerEvent& WXUNUSED(event))
{ {
wxLogMessage(wxT("System resumed from suspend.")); wxLogMessage("System resumed from suspend.");
} }
#endif // wxHAS_POWER_EVENTS #endif // wxHAS_POWER_EVENTS
@@ -133,19 +133,19 @@ private:
switch ( m_powerType = powerType ) switch ( m_powerType = powerType )
{ {
case wxPOWER_SOCKET: case wxPOWER_SOCKET:
powerStr = wxT("wall"); powerStr = "wall";
break; break;
case wxPOWER_BATTERY: case wxPOWER_BATTERY:
powerStr = wxT("battery"); powerStr = "battery";
break; break;
default: default:
wxFAIL_MSG(wxT("unknown wxPowerType value")); wxFAIL_MSG("unknown wxPowerType value");
// fall through // fall through
case wxPOWER_UNKNOWN: case wxPOWER_UNKNOWN:
powerStr = wxT("psychic"); powerStr = "psychic";
break; break;
} }
@@ -153,32 +153,32 @@ private:
switch ( m_batteryState = batteryState ) switch ( m_batteryState = batteryState )
{ {
case wxBATTERY_NORMAL_STATE: case wxBATTERY_NORMAL_STATE:
batteryStr = wxT("charged"); batteryStr = "charged";
break; break;
case wxBATTERY_LOW_STATE: case wxBATTERY_LOW_STATE:
batteryStr = wxT("low"); batteryStr = "low";
break; break;
case wxBATTERY_CRITICAL_STATE: case wxBATTERY_CRITICAL_STATE:
batteryStr = wxT("critical"); batteryStr = "critical";
break; break;
case wxBATTERY_SHUTDOWN_STATE: case wxBATTERY_SHUTDOWN_STATE:
batteryStr = wxT("empty"); batteryStr = "empty";
break; break;
default: default:
wxFAIL_MSG(wxT("unknown wxBatteryState value")); wxFAIL_MSG("unknown wxBatteryState value");
// fall through // fall through
case wxBATTERY_UNKNOWN_STATE: case wxBATTERY_UNKNOWN_STATE:
batteryStr = wxT("unknown"); batteryStr = "unknown";
break; break;
} }
SetStatusText(wxString::Format( SetStatusText(wxString::Format(
wxT("System is on %s power, battery state is %s"), "System is on %s power, battery state is %s",
powerStr.c_str(), powerStr.c_str(),
batteryStr.c_str())); batteryStr.c_str()));
} }

View File

@@ -97,7 +97,7 @@ bool MyApp::OnInit(void)
// ---------------------- // ----------------------
#if 0 #if 0
wxImage image( wxT("test.jpg") ); wxImage image( "test.jpg" );
image.SetAlpha(); image.SetAlpha();
int i,j; int i,j;
for (i = 0; i < image.GetWidth(); i++) for (i = 0; i < image.GetWidth(); i++)
@@ -112,7 +112,7 @@ bool MyApp::OnInit(void)
// Create the main frame window // Create the main frame window
// ---------------------------- // ----------------------------
MyFrame* frame = new MyFrame((wxFrame *) NULL, wxT("wxWidgets Printing Demo"), MyFrame* frame = new MyFrame((wxFrame *) NULL, "wxWidgets Printing Demo",
wxPoint(0, 0), wxSize(400, 400)); wxPoint(0, 0), wxSize(400, 400));
frame->Centre(wxBOTH); frame->Centre(wxBOTH);
@@ -154,13 +154,13 @@ void MyApp::Draw(wxDC&dc)
dc.DrawRoundedRectangle(0, 20, 200, 80, 20); dc.DrawRoundedRectangle(0, 20, 200, 80, 20);
dc.DrawText( wxT("Rectangle 200 by 80"), 40, 40); dc.DrawText( "Rectangle 200 by 80", 40, 40);
dc.SetPen( wxPen(*wxBLACK, 0, wxPENSTYLE_DOT_DASH) ); dc.SetPen( wxPen(*wxBLACK, 0, wxPENSTYLE_DOT_DASH) );
dc.DrawEllipse(50, 140, 100, 50); dc.DrawEllipse(50, 140, 100, 50);
dc.SetPen(*wxRED_PEN); dc.SetPen(*wxRED_PEN);
dc.DrawText( wxT("Test message: this is in 10 point text"), 10, 180); dc.DrawText( "Test message: this is in 10 point text", 10, 180);
dc.DrawRotatedText( wxS("This\nis\na multi-line\ntext"), 170, 100, -m_angle/1.5); dc.DrawRotatedText( wxS("This\nis\na multi-line\ntext"), 170, 100, -m_angle/1.5);
@@ -204,11 +204,11 @@ void MyApp::Draw(wxDC&dc)
wxString str; wxString str;
int i = 0; int i = 0;
str.Printf( wxT("---- Text at angle %d ----"), i ); str.Printf( "---- Text at angle %d ----", i );
dc.DrawRotatedText( str, 100, 300, i ); dc.DrawRotatedText( str, 100, 300, i );
i = m_angle; i = m_angle;
str.Printf( wxT("---- Text at angle %d ----"), i ); str.Printf( "---- Text at angle %d ----", i );
dc.DrawRotatedText( str, 100, 300, i ); dc.DrawRotatedText( str, 100, 300, i );
wxIcon my_icon = wxICON(sample); wxIcon my_icon = wxICON(sample);
@@ -290,7 +290,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// Give us a status line // Give us a status line
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Printing demo")); SetStatusText("Printing demo");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
// Load icon and bitmap // Load icon and bitmap
@@ -299,12 +299,12 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(wxID_PRINT, wxT("&Print..."), wxT("Print")); file_menu->Append(wxID_PRINT, "&Print...", "Print");
file_menu->Append(WXPRINT_PAGE_SETUP, wxT("Page Set&up..."), wxT("Page setup")); file_menu->Append(WXPRINT_PAGE_SETUP, "Page Set&up...", "Page setup");
#ifdef __WXMAC__ #ifdef __WXMAC__
file_menu->Append(WXPRINT_PAGE_MARGINS, wxT("Page Margins..."), wxT("Page margins")); file_menu->Append(WXPRINT_PAGE_MARGINS, "Page Margins...", "Page margins");
#endif #endif
file_menu->Append(wxID_PREVIEW, wxT("Print Pre&view"), wxT("Preview")); file_menu->Append(wxID_PREVIEW, "Print Pre&view", "Preview");
wxMenu * const menuModalKind = new wxMenu; wxMenu * const menuModalKind = new wxMenu;
menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_APP, "&App modal"); menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_APP, "&App modal");
@@ -321,24 +321,24 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const
#if wxUSE_POSTSCRIPT #if wxUSE_POSTSCRIPT
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(WXPRINT_PRINT_PS, wxT("Print PostScript..."), wxT("Print (PostScript)")); file_menu->Append(WXPRINT_PRINT_PS, "Print PostScript...", "Print (PostScript)");
file_menu->Append(WXPRINT_PAGE_SETUP_PS, wxT("Page Setup PostScript..."), wxT("Page setup (PostScript)")); file_menu->Append(WXPRINT_PAGE_SETUP_PS, "Page Setup PostScript...", "Page setup (PostScript)");
file_menu->Append(WXPRINT_PREVIEW_PS, wxT("Print Preview PostScript"), wxT("Preview (PostScript)")); file_menu->Append(WXPRINT_PREVIEW_PS, "Print Preview PostScript", "Preview (PostScript)");
#endif #endif
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(WXPRINT_ANGLEUP, wxT("Angle up\tAlt-U"), wxT("Raise rotated text angle")); file_menu->Append(WXPRINT_ANGLEUP, "Angle up\tAlt-U", "Raise rotated text angle");
file_menu->Append(WXPRINT_ANGLEDOWN, wxT("Angle down\tAlt-D"), wxT("Lower rotated text angle")); file_menu->Append(WXPRINT_ANGLEDOWN, "Angle down\tAlt-D", "Lower rotated text angle");
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(wxID_EXIT, wxT("E&xit"), wxT("Exit program")); file_menu->Append(wxID_EXIT, "E&xit", "Exit program");
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append(wxID_ABOUT, wxT("&About"), wxT("About this demo")); help_menu->Append(wxID_ABOUT, "&About", "About this demo");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
menu_bar->Append(help_menu, wxT("&Help")); menu_bar->Append(help_menu, "&Help");
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
@@ -364,16 +364,16 @@ void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
wxPrintDialogData printDialogData(* g_printData); wxPrintDialogData printDialogData(* g_printData);
wxPrinter printer(&printDialogData); wxPrinter printer(&printDialogData);
MyPrintout printout(this, wxT("My printout")); MyPrintout printout(this, "My printout");
if (!printer.Print(this, &printout, true /*prompt*/)) if (!printer.Print(this, &printout, true /*prompt*/))
{ {
if (wxPrinter::GetLastError() == wxPRINTER_ERROR) if (wxPrinter::GetLastError() == wxPRINTER_ERROR)
{ {
wxLogError(wxT("There was a problem printing. Perhaps your current printer is not set correctly?")); wxLogError("There was a problem printing. Perhaps your current printer is not set correctly?");
} }
else else
{ {
wxLogMessage(wxT("You canceled printing")); wxLogMessage("You canceled printing");
} }
} }
else else
@@ -391,12 +391,12 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
if (!preview->IsOk()) if (!preview->IsOk())
{ {
delete preview; delete preview;
wxLogError(wxT("There was a problem previewing.\nPerhaps your current printer is not set correctly?")); wxLogError("There was a problem previewing.\nPerhaps your current printer is not set correctly?");
return; return;
} }
wxPreviewFrame *frame = wxPreviewFrame *frame =
new wxPreviewFrame(preview, this, wxT("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650)); new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
frame->Centre(wxBOTH); frame->Centre(wxBOTH);
frame->InitializeWithModality(m_previewModality); frame->InitializeWithModality(m_previewModality);
frame->Show(); frame->Show();
@@ -419,7 +419,7 @@ void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
wxPrintDialogData printDialogData(* g_printData); wxPrintDialogData printDialogData(* g_printData);
wxPostScriptPrinter printer(&printDialogData); wxPostScriptPrinter printer(&printDialogData);
MyPrintout printout(this, wxT("My printout")); MyPrintout printout(this, "My printout");
printer.Print(this, &printout, true/*prompt*/); printer.Print(this, &printout, true/*prompt*/);
(*g_printData) = printer.GetPrintDialogData().GetPrintData(); (*g_printData) = printer.GetPrintDialogData().GetPrintData();
@@ -431,7 +431,7 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
wxPrintDialogData printDialogData(* g_printData); wxPrintDialogData printDialogData(* g_printData);
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout(this), new MyPrintout(this), &printDialogData); wxPrintPreview *preview = new wxPrintPreview(new MyPrintout(this), new MyPrintout(this), &printDialogData);
wxPreviewFrame *frame = wxPreviewFrame *frame =
new wxPreviewFrame(preview, this, wxT("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650)); new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
frame->Centre(wxBOTH); frame->Centre(wxBOTH);
frame->Initialize(); frame->Initialize();
frame->Show(); frame->Show();
@@ -464,8 +464,8 @@ void MyFrame::OnPageMargins(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event))
{ {
(void)wxMessageBox(wxT("wxWidgets printing demo\nAuthor: Julian Smart"), (void)wxMessageBox("wxWidgets printing demo\nAuthor: Julian Smart",
wxT("About wxWidgets printing demo"), wxOK|wxCENTRE); "About wxWidgets printing demo", wxOK|wxCENTRE);
} }
void MyFrame::OnAngleUp(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAngleUp(wxCommandEvent& WXUNUSED(event))
@@ -527,7 +527,7 @@ bool MyPrintout::OnPrintPage(int page)
// screen size of text matches paper size. // screen size of text matches paper size.
MapScreenSizeToPage(); MapScreenSizeToPage();
dc->DrawText(wxString::Format(wxT("PAGE %d"), page), 0, 0); dc->DrawText(wxString::Format("PAGE %d", page), 0, 0);
return true; return true;
} }
@@ -683,8 +683,8 @@ void MyPrintout::DrawPageTwo()
dc->SetBrush(*wxTRANSPARENT_BRUSH); dc->SetBrush(*wxTRANSPARENT_BRUSH);
{ // GetTextExtent demo: { // GetTextExtent demo:
wxString words[7] = { wxT("This "), wxT("is "), wxT("GetTextExtent "), wxString words[7] = { "This ", "is ", "GetTextExtent ",
wxT("testing "), wxT("string. "), wxT("Enjoy "), wxT("it!") }; "testing ", "string. ", "Enjoy ", "it!" };
long x = 200, y= 250; long x = 200, y= 250;
dc->SetFont(wxFontInfo(15).Family(wxFONTFAMILY_SWISS)); dc->SetFont(wxFontInfo(15).Family(wxFONTFAMILY_SWISS));
@@ -705,7 +705,7 @@ void MyPrintout::DrawPageTwo()
dc->SetFont(wxGetApp().GetTestFont()); dc->SetFont(wxGetApp().GetTestFont());
dc->DrawText(wxT("Some test text"), 200, 300 ); dc->DrawText("Some test text", 200, 300 );
// TESTING // TESTING
@@ -728,7 +728,7 @@ void MyPrintout::DrawPageTwo()
dc->DrawLine( (long)leftMarginLogical, (long)bottomMarginLogical, dc->DrawLine( (long)leftMarginLogical, (long)bottomMarginLogical,
(long)rightMarginLogical, (long)bottomMarginLogical); (long)rightMarginLogical, (long)bottomMarginLogical);
WritePageHeader(this, dc, wxT("A header"), logUnitsFactor); WritePageHeader(this, dc, "A header", logUnitsFactor);
} }
// Writes a header on a page. Margin units are in millimetres. // Writes a header on a page. Margin units are in millimetres.

View File

@@ -86,7 +86,7 @@ private:
class MyPrintout: public wxPrintout class MyPrintout: public wxPrintout
{ {
public: public:
MyPrintout(MyFrame* frame, const wxString &title = wxT("My printout")) MyPrintout(MyFrame* frame, const wxString &title = "My printout")
: wxPrintout(title) { m_frame=frame; } : wxPrintout(title) { m_frame=frame; }
virtual bool OnPrintPage(int page) wxOVERRIDE; virtual bool OnPrintPage(int page) wxOVERRIDE;

View File

@@ -135,7 +135,7 @@ private:
void Refresh(); void Refresh();
bool DeleteChild(TreeNode *child); bool DeleteChild(TreeNode *child);
void DestroyChildren(); void DestroyChildren();
const wxChar *FullName() const; const wxString FullName() const;
void SetRegistryView(wxRegKey::WOW64ViewMode viewMode); void SetRegistryView(wxRegKey::WOW64ViewMode viewMode);
// get the associated key: make sure the pointer is !NULL // get the associated key: make sure the pointer is !NULL
@@ -186,7 +186,7 @@ class RegFrame : public wxFrame
{ {
public: public:
// ctor & dtor // ctor & dtor
RegFrame(wxFrame *parent, const wxChar *title, int x, int y, int w, int h); RegFrame(wxFrame *parent, const wxString& title, int x, int y, int w, int h);
virtual ~RegFrame(); virtual ~RegFrame();
// callbacks // callbacks
@@ -304,38 +304,38 @@ wxEND_EVENT_TABLE()
wxMenu *CreateRegistryMenu() wxMenu *CreateRegistryMenu()
{ {
wxMenu *pMenuNew = new wxMenu; wxMenu *pMenuNew = new wxMenu;
pMenuNew->Append(Menu_NewKey, wxT("&Key"), wxT("Create a new key")); pMenuNew->Append(Menu_NewKey, "&Key", "Create a new key");
pMenuNew->AppendSeparator(); pMenuNew->AppendSeparator();
pMenuNew->Append(Menu_NewText, wxT("&Text value"), wxT("Create a new text value")); pMenuNew->Append(Menu_NewText, "&Text value", "Create a new text value");
pMenuNew->Append(Menu_NewBinary, wxT("&Binary value"), wxT("Create a new binary value")); pMenuNew->Append(Menu_NewBinary, "&Binary value", "Create a new binary value");
wxMenu *pMenuView = new wxMenu; wxMenu *pMenuView = new wxMenu;
pMenuView->AppendRadioItem( pMenuView->AppendRadioItem(
Menu_ViewDefault, Menu_ViewDefault,
wxT("&Default"), "&Default",
wxT("Default registry view for the program environment.")); "Default registry view for the program environment.");
pMenuView->AppendRadioItem( pMenuView->AppendRadioItem(
Menu_View32, Menu_View32,
wxT("32-bit Registry"), "32-bit Registry",
wxT("View 32-bit registry.")); "View 32-bit registry.");
pMenuView->AppendRadioItem( pMenuView->AppendRadioItem(
Menu_View64, Menu_View64,
wxT("64-bit Registry"), "64-bit Registry",
wxT("View 64-bit registry.")); "View 64-bit registry.");
wxMenu *pMenuReg = new wxMenu; wxMenu *pMenuReg = new wxMenu;
pMenuReg->Append(Menu_New, wxT("&New"), pMenuNew); pMenuReg->Append(Menu_New, "&New", pMenuNew);
pMenuReg->Append(Menu_Delete, wxT("&Delete..."), wxT("Delete selected key/value")); pMenuReg->Append(Menu_Delete, "&Delete...", "Delete selected key/value");
pMenuReg->AppendSeparator(); pMenuReg->AppendSeparator();
pMenuReg->Append(Menu_GoTo, wxT("&Go to...\tCtrl-G"), wxT("Go to registry key")); pMenuReg->Append(Menu_GoTo, "&Go to...\tCtrl-G", "Go to registry key");
pMenuReg->Append(Menu_Expand, wxT("&Expand"), wxT("Expand current key")); pMenuReg->Append(Menu_Expand, "&Expand", "Expand current key");
pMenuReg->Append(Menu_Collapse, wxT("&Collapse"), wxT("Collapse current key")); pMenuReg->Append(Menu_Collapse, "&Collapse", "Collapse current key");
pMenuReg->Append(Menu_Toggle, wxT("&Toggle"), wxT("Toggle current key")); pMenuReg->Append(Menu_Toggle, "&Toggle", "Toggle current key");
pMenuReg->AppendSeparator(); pMenuReg->AppendSeparator();
pMenuReg->Append(Menu_Refresh, wxT("&Refresh"), wxT("Refresh the subtree")); pMenuReg->Append(Menu_Refresh, "&Refresh", "Refresh the subtree");
pMenuReg->Append(Menu_View, wxT("&View"), pMenuView); pMenuReg->Append(Menu_View, "&View", pMenuView);
pMenuReg->AppendSeparator(); pMenuReg->AppendSeparator();
pMenuReg->Append(Menu_Info, wxT("&Properties"),wxT("Information about current selection")); pMenuReg->Append(Menu_Info, "&Properties","Information about current selection");
return pMenuReg; return pMenuReg;
} }
@@ -352,7 +352,7 @@ bool RegApp::OnInit()
return false; return false;
// create the main frame window and show it // create the main frame window and show it
RegFrame *frame = new RegFrame(NULL, wxT("wxRegTest"), 50, 50, 600, 350); RegFrame *frame = new RegFrame(NULL, "wxRegTest", 50, 50, 600, 350);
frame->Show(true); frame->Show(true);
return true; return true;
@@ -362,7 +362,7 @@ bool RegApp::OnInit()
// RegFrame // RegFrame
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
RegFrame::RegFrame(wxFrame *parent, const wxChar *title, int x, int y, int w, int h) RegFrame::RegFrame(wxFrame *parent, const wxString& title, int x, int y, int w, int h)
: wxFrame(parent, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)) : wxFrame(parent, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
{ {
// this reduces flicker effects // this reduces flicker effects
@@ -370,20 +370,20 @@ RegFrame::RegFrame(wxFrame *parent, const wxChar *title, int x, int y, int w, in
// set the icon // set the icon
// ------------ // ------------
SetIcon(wxIcon(wxT("app_icon"))); SetIcon(wxIcon("app_icon"));
// create menu // create menu
// ----------- // -----------
wxMenu *pMenuFile = new wxMenu; wxMenu *pMenuFile = new wxMenu;
pMenuFile->Append(Menu_Test, wxT("Te&st"), wxT("Test key creation")); pMenuFile->Append(Menu_Test, "Te&st", "Test key creation");
pMenuFile->AppendSeparator(); pMenuFile->AppendSeparator();
pMenuFile->Append(Menu_About, wxT("&About"), wxT("Show an extraordinarily beautiful dialog")); pMenuFile->Append(Menu_About, "&About", "Show an extraordinarily beautiful dialog");
pMenuFile->AppendSeparator(); pMenuFile->AppendSeparator();
pMenuFile->Append(Menu_Quit, wxT("E&xit"), wxT("Quit this program")); pMenuFile->Append(Menu_Quit, "E&xit", "Quit this program");
wxMenuBar *pMenu = new wxMenuBar; wxMenuBar *pMenu = new wxMenuBar;
pMenu->Append(pMenuFile, wxT("&File")); pMenu->Append(pMenuFile, "&File");
pMenu->Append(CreateRegistryMenu(), wxT("&Registry")); pMenu->Append(CreateRegistryMenu(), "&Registry");
SetMenuBar(pMenu); SetMenuBar(pMenu);
#if DO_REGTEST #if DO_REGTEST
@@ -415,9 +415,9 @@ void RegFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void RegFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void RegFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageDialog dialog(this, wxMessageDialog dialog(this,
wxT("wxRegistry sample\n") "wxRegistry sample\n"
wxT("(c) 1998, 2000 Vadim Zeitlin"), "(c) 1998, 2000 Vadim Zeitlin",
wxT("About wxRegTest"), wxOK); "About wxRegTest", wxOK);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -431,11 +431,11 @@ void RegFrame::OnTest(wxCommandEvent& WXUNUSED(event))
void RegFrame::OnGoTo(wxCommandEvent& WXUNUSED(event)) void RegFrame::OnGoTo(wxCommandEvent& WXUNUSED(event))
{ {
static wxString s_location = wxT("HKEY_CURRENT_USER\\Software\\wxWidgets"); static wxString s_location = "HKEY_CURRENT_USER\\Software\\wxWidgets";
wxString location = wxGetTextFromUser( wxString location = wxGetTextFromUser(
wxT("Enter the location to go to:"), "Enter the location to go to:",
wxT("wxRegTest question"), "wxRegTest question",
s_location, s_location,
this); this);
@@ -489,7 +489,7 @@ void RegFrame::OnNewKey(wxCommandEvent& WXUNUSED(event))
if ( m_treeCtrl->IsKeySelected() ) if ( m_treeCtrl->IsKeySelected() )
{ {
m_treeCtrl->CreateNewKey( m_treeCtrl->CreateNewKey(
wxGetTextFromUser(wxT("Enter the name of the new key"))); wxGetTextFromUser("Enter the name of the new key"));
} }
#endif #endif
} }
@@ -500,7 +500,7 @@ void RegFrame::OnNewText(wxCommandEvent& WXUNUSED(event))
if ( m_treeCtrl->IsKeySelected() ) if ( m_treeCtrl->IsKeySelected() )
{ {
m_treeCtrl->CreateNewTextValue( m_treeCtrl->CreateNewTextValue(
wxGetTextFromUser(wxT("Enter the name for the new text value"))); wxGetTextFromUser("Enter the name for the new text value"));
} }
#endif #endif
} }
@@ -511,7 +511,7 @@ void RegFrame::OnNewBinary(wxCommandEvent& WXUNUSED(event))
if ( m_treeCtrl->IsKeySelected() ) if ( m_treeCtrl->IsKeySelected() )
{ {
m_treeCtrl->CreateNewBinaryValue( m_treeCtrl->CreateNewBinaryValue(
wxGetTextFromUser(wxT("Enter the name for the new binary value"))); wxGetTextFromUser("Enter the name for the new binary value"));
} }
#endif #endif
} }
@@ -556,8 +556,8 @@ void RegFrame::OnViewChange(wxCommandEvent& event)
RegImageList::RegImageList() : wxImageList(16, 16, true) RegImageList::RegImageList() : wxImageList(16, 16, true)
{ {
// should be in sync with enum RegImageList::RegIcon // should be in sync with enum RegImageList::RegIcon
static const wxChar *aszIcons[] = { wxT("key1"),wxT("key2"),wxT("key3"),wxT("value1"),wxT("value2") }; static const wxString aszIcons[] = { "key1","key2","key3","value1","value2" };
wxString str = wxT("icon_"); wxString str = "icon_";
for ( unsigned int n = 0; n < WXSIZEOF(aszIcons); n++ ) for ( unsigned int n = 0; n < WXSIZEOF(aszIcons); n++ )
{ {
Add(wxIcon(str + aszIcons[n], wxBITMAP_TYPE_ICO_RESOURCE)); Add(wxIcon(str + aszIcons[n], wxBITMAP_TYPE_ICO_RESOURCE));
@@ -597,7 +597,7 @@ RegTreeCtrl::TreeNode *RegTreeCtrl::InsertNewTreeNode(
pNewNode->m_id = AddRoot(strName); pNewNode->m_id = AddRoot(strName);
} }
wxASSERT_MSG( pNewNode->m_id, wxT("can't create tree control item!")); wxASSERT_MSG( pNewNode->m_id, "can't create tree control item!");
// save the pointer in the item // save the pointer in the item
SetItemData(pNewNode->m_id, pNewNode); SetItemData(pNewNode->m_id, pNewNode);
@@ -643,7 +643,7 @@ RegTreeCtrl::RegTreeCtrl(wxWindow *parent, wxWindowID id)
m_pRoot = m_pRoot =
InsertNewTreeNode( InsertNewTreeNode(
NULL, NULL,
wxT("Registry Root"), "Registry Root",
RegImageList::Root, RegImageList::Root,
NULL, NULL,
m_viewMode); m_viewMode);
@@ -682,7 +682,7 @@ void RegTreeCtrl::OnIdle(wxIdleEvent& WXUNUSED(event))
if ( m_restoreStatus ) if ( m_restoreStatus )
{ {
// restore it after OnItemExpanding() // restore it after OnItemExpanding()
wxLogStatus(wxT("Ok")); wxLogStatus("Ok");
wxSetCursor(*wxSTANDARD_CURSOR); wxSetCursor(*wxSTANDARD_CURSOR);
m_restoreStatus = false; m_restoreStatus = false;
@@ -714,40 +714,40 @@ void RegTreeCtrl::OnMenuTest()
wxTreeItemId lId = GetSelection(); wxTreeItemId lId = GetSelection();
TreeNode *pNode = (TreeNode *)GetItemData(lId); TreeNode *pNode = (TreeNode *)GetItemData(lId);
wxCHECK_RET( pNode != NULL, wxT("tree item without data?") ); wxCHECK_RET( pNode != NULL, "tree item without data?" );
if ( pNode->IsRoot() ) if ( pNode->IsRoot() )
{ {
wxLogError(wxT("Can't create a subkey under the root key.")); wxLogError("Can't create a subkey under the root key.");
return; return;
} }
if ( !pNode->IsKey() ) if ( !pNode->IsKey() )
{ {
wxLogError(wxT("Can't create a subkey under a value!")); wxLogError("Can't create a subkey under a value!");
return; return;
} }
wxRegKey key1(pNode->Key(), wxT("key1")); wxRegKey key1(pNode->Key(), "key1");
if ( key1.Create() ) if ( key1.Create() )
{ {
wxRegKey key2a(key1, wxT("key2a")), key2b(key1, wxT("key2b")); wxRegKey key2a(key1, "key2a"), key2b(key1, "key2b");
if ( key2a.Create() && key2b.Create() ) if ( key2a.Create() && key2b.Create() )
{ {
// put some values under the newly created keys // put some values under the newly created keys
key1.SetValue(wxT("first_term"), wxT("10")); key1.SetValue("first_term", "10");
key1.SetValue(wxT("second_term"), wxT("7")); key1.SetValue("second_term", "7");
key2a = wxT("this is the unnamed value"); key2a = "this is the unnamed value";
key2b.SetValue(wxT("sum"), 17); key2b.SetValue("sum", 17);
// refresh tree // refresh tree
pNode->Refresh(); pNode->Refresh();
wxLogStatus(wxT("Test keys successfully added.")); wxLogStatus("Test keys successfully added.");
return; return;
} }
} }
wxLogError(wxT("Creation of test keys failed.")); wxLogError("Creation of test keys failed.");
} }
void RegTreeCtrl::OnChar(wxKeyEvent& event) void RegTreeCtrl::OnChar(wxKeyEvent& event)
@@ -787,7 +787,7 @@ void RegTreeCtrl::OnItemExpanding(wxTreeEvent& event)
// expansion might take some time // expansion might take some time
wxSetCursor(*wxHOURGLASS_CURSOR); wxSetCursor(*wxHOURGLASS_CURSOR);
wxLogStatus(wxT("Working...")); wxLogStatus("Working...");
wxYield(); // to give the status line a chance to refresh itself wxYield(); // to give the status line a chance to refresh itself
m_restoreStatus = true; // some time later... m_restoreStatus = true; // some time later...
@@ -812,7 +812,7 @@ void RegTreeCtrl::OnBeginEdit(wxTreeEvent& event)
TreeNode *pNode = GetNode(event); TreeNode *pNode = GetNode(event);
if ( pNode->IsRoot() || pNode->Parent()->IsRoot() ) if ( pNode->IsRoot() || pNode->Parent()->IsRoot() )
{ {
wxLogStatus(wxT("This registry key can't be renamed.")); wxLogStatus("This registry key can't be renamed.");
event.Veto(); event.Veto();
} }
@@ -844,7 +844,7 @@ void RegTreeCtrl::OnEndEdit(wxTreeEvent& event)
if ( !ok ) if ( !ok )
{ {
wxLogError(wxT("Failed to rename '%s' to '%s'."), wxLogError("Failed to rename '%s' to '%s'.",
m_nameOld.c_str(), name.c_str()); m_nameOld.c_str(), name.c_str());
} }
#if 0 // MSW tree ctrl doesn't like this at all, it hangs #if 0 // MSW tree ctrl doesn't like this at all, it hangs
@@ -862,13 +862,13 @@ void RegTreeCtrl::OnBeginDrag(wxTreeEvent& event)
TreeNode *pNode = GetNode(event); TreeNode *pNode = GetNode(event);
if ( pNode->IsRoot() || pNode->Parent()->IsRoot() ) if ( pNode->IsRoot() || pNode->Parent()->IsRoot() )
{ {
wxLogStatus(wxT("This registry key can't be %s."), wxLogStatus("This registry key can't be %s.",
m_copyOnDrop ? wxT("copied") : wxT("moved")); m_copyOnDrop ? "copied" : "moved");
} }
else else
{ {
wxLogStatus(wxT("%s item %s..."), wxLogStatus("%s item %s...",
m_copyOnDrop ? wxT("Copying") : wxT("Moving"), m_copyOnDrop ? "Copying" : "Moving",
pNode->FullName()); pNode->FullName());
m_draggedItem = pNode; m_draggedItem = pNode;
@@ -879,7 +879,7 @@ void RegTreeCtrl::OnBeginDrag(wxTreeEvent& event)
void RegTreeCtrl::OnEndDrag(wxTreeEvent& event) void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
{ {
wxCHECK_RET( m_draggedItem, wxT("end drag without begin drag?") ); wxCHECK_RET( m_draggedItem, "end drag without begin drag?" );
// clear the pointer anyhow // clear the pointer anyhow
TreeNode *src = m_draggedItem; TreeNode *src = m_draggedItem;
@@ -895,7 +895,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
if ( !dst || dst->IsRoot() ) if ( !dst || dst->IsRoot() )
{ {
wxLogError(wxT("Can't create a key here.")); wxLogError("Can't create a key here.");
return; return;
} }
@@ -903,7 +903,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
bool isKey = src->IsKey(); bool isKey = src->IsKey();
if ( (isKey && (src == dst)) || if ( (isKey && (src == dst)) ||
(!isKey && (dst->Parent() == src)) ) { (!isKey && (dst->Parent() == src)) ) {
wxLogStatus(wxT("Can't copy something on itself")); wxLogStatus("Can't copy something on itself");
return; return;
} }
@@ -914,18 +914,18 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
nameDst << wxString(dst->FullName()).AfterFirst('\\') << '\\' nameDst << wxString(dst->FullName()).AfterFirst('\\') << '\\'
<< wxString(src->FullName()).AfterLast('\\'); << wxString(src->FullName()).AfterLast('\\');
wxString verb = m_copyOnDrop ? wxT("copy") : wxT("move"); wxString verb = m_copyOnDrop ? "copy" : "move";
wxString what = isKey ? wxT("key") : wxT("value"); wxString what = isKey ? "key" : "value";
if ( wxMessageBox(wxString::Format if ( wxMessageBox(wxString::Format
( (
wxT("Do you really want to %s the %s %s to %s?"), "Do you really want to %s the %s %s to %s?",
verb.c_str(), verb.c_str(),
what.c_str(), what.c_str(),
nameSrc.c_str(), nameSrc.c_str(),
nameDst.c_str() nameDst.c_str()
), ),
wxT("RegTest Confirm"), "RegTest Confirm",
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) { wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) {
return; return;
} }
@@ -938,7 +938,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
ok = keyDst.Create(false); ok = keyDst.Create(false);
if ( !ok ) if ( !ok )
{ {
wxLogError(wxT("Key '%s' already exists"), keyDst.GetName().c_str()); wxLogError("Key '%s' already exists", keyDst.GetName().c_str());
} }
else else
{ {
@@ -968,7 +968,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
if ( !ok ) if ( !ok )
{ {
wxLogError(wxT("Failed to %s registry %s."), wxLogError("Failed to %s registry %s.",
verb.c_str(), what.c_str()); verb.c_str(), what.c_str());
} }
else else
@@ -1009,7 +1009,7 @@ bool RegTreeCtrl::TreeNode::OnExpand()
if ( !m_pKey->Open() ) if ( !m_pKey->Open() )
{ {
wxLogError(wxT("The key '%s' can't be opened."), FullName()); wxLogError("The key '%s' can't be opened.", FullName());
return false; return false;
} }
@@ -1043,10 +1043,10 @@ bool RegTreeCtrl::TreeNode::OnExpand()
{ {
wxString strItem; wxString strItem;
if (str.empty()) if (str.empty())
strItem = wxT("<default>"); strItem = "<default>";
else else
strItem = str; strItem = str;
strItem += wxT(" = "); strItem += " = ";
// determine the appropriate icon // determine the appropriate icon
RegImageList::Icon icon; RegImageList::Icon icon;
@@ -1131,7 +1131,7 @@ bool RegTreeCtrl::TreeNode::DeleteChild(TreeNode *child)
{ {
int index = m_aChildren.Index(child); int index = m_aChildren.Index(child);
wxCHECK_MSG( index != wxNOT_FOUND, false, wxCHECK_MSG( index != wxNOT_FOUND, false,
wxT("our child in tree should be in m_aChildren") ); "our child in tree should be in m_aChildren" );
m_aChildren.RemoveAt((size_t)index); m_aChildren.RemoveAt((size_t)index);
@@ -1177,20 +1177,20 @@ RegTreeCtrl::TreeNode::~TreeNode()
delete m_pKey; delete m_pKey;
} }
const wxChar *RegTreeCtrl::TreeNode::FullName() const const wxString RegTreeCtrl::TreeNode::FullName() const
{ {
static wxString s_strName; static wxString s_strName;
if ( IsRoot() ) if ( IsRoot() )
{ {
return wxT("Registry Root"); return "Registry Root";
} }
else else
{ {
// our own registry key might not (yet) exist or we might be a value, // our own registry key might not (yet) exist or we might be a value,
// so just use the parent's and concatenate // so just use the parent's and concatenate
s_strName = Parent()->FullName(); s_strName = Parent()->FullName();
s_strName << wxT('\\') << m_strName; s_strName << '\\' << m_strName;
return s_strName.t_str(); return s_strName.t_str();
} }
@@ -1212,7 +1212,7 @@ void RegTreeCtrl::TreeNode::SetRegistryView(wxRegKey::WOW64ViewMode viewMode)
void RegTreeCtrl::GoTo(const wxString& location) void RegTreeCtrl::GoTo(const wxString& location)
{ {
wxStringTokenizer tk(location, wxT("\\")); wxStringTokenizer tk(location, "\\");
wxTreeItemId id = GetRootItem(); wxTreeItemId id = GetRootItem();
@@ -1255,7 +1255,7 @@ void RegTreeCtrl::GoTo(const wxString& location)
if ( !id.IsOk() ) if ( !id.IsOk() )
{ {
wxLogError(wxT("No such key '%s'."), location.c_str()); wxLogError("No such key '%s'.", location.c_str());
return; return;
} }
@@ -1272,28 +1272,28 @@ void RegTreeCtrl::DeleteSelected()
if ( lParent == GetRootItem() ) if ( lParent == GetRootItem() )
{ {
wxLogError(wxT("Can't delete root key.")); wxLogError("Can't delete root key.");
return; return;
} }
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent), TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent),
*pParent = (TreeNode *)GetItemData(lParent); *pParent = (TreeNode *)GetItemData(lParent);
wxCHECK_RET(pCurrent && pParent, wxT("either node or parent without data?")); wxCHECK_RET(pCurrent && pParent, "either node or parent without data?");
if ( pParent->IsRoot() ) if ( pParent->IsRoot() )
{ {
wxLogError(wxT("Can't delete standard key.")); wxLogError("Can't delete standard key.");
return; return;
} }
wxString what = pCurrent->IsKey() ? wxT("key") : wxT("value"); wxString what = pCurrent->IsKey() ? "key" : "value";
if ( wxMessageBox(wxString::Format if ( wxMessageBox(wxString::Format
( (
wxT("Do you really want to delete this %s?"), "Do you really want to delete this %s?",
what.c_str() what.c_str()
), ),
wxT("Confirmation"), "Confirmation",
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES )
{ {
return; return;
@@ -1307,13 +1307,13 @@ void RegTreeCtrl::CreateNewKey(const wxString& strName)
wxTreeItemId lCurrent = GetSelection(); wxTreeItemId lCurrent = GetSelection();
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent); TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
wxCHECK_RET( pCurrent != NULL, wxT("node without data?") ); wxCHECK_RET( pCurrent != NULL, "node without data?" );
wxASSERT( pCurrent->IsKey() ); // check must have been done before wxASSERT( pCurrent->IsKey() ); // check must have been done before
if ( pCurrent->IsRoot() ) if ( pCurrent->IsRoot() )
{ {
wxLogError(wxT("Can't create a new key under the root key.")); wxLogError("Can't create a new key under the root key.");
return; return;
} }
@@ -1327,13 +1327,13 @@ void RegTreeCtrl::CreateNewTextValue(const wxString& strName)
wxTreeItemId lCurrent = GetSelection(); wxTreeItemId lCurrent = GetSelection();
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent); TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
wxCHECK_RET( pCurrent != NULL, wxT("node without data?") ); wxCHECK_RET( pCurrent != NULL, "node without data?" );
wxASSERT( pCurrent->IsKey() ); // check must have been done before wxASSERT( pCurrent->IsKey() ); // check must have been done before
if ( pCurrent->IsRoot() ) if ( pCurrent->IsRoot() )
{ {
wxLogError(wxT("Can't create a new value under the root key.")); wxLogError("Can't create a new value under the root key.");
return; return;
} }
@@ -1346,13 +1346,13 @@ void RegTreeCtrl::CreateNewBinaryValue(const wxString& strName)
wxTreeItemId lCurrent = GetSelection(); wxTreeItemId lCurrent = GetSelection();
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent); TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
wxCHECK_RET( pCurrent != NULL, wxT("node without data?") ); wxCHECK_RET( pCurrent != NULL, "node without data?" );
wxASSERT( pCurrent->IsKey() ); // check must have been done before wxASSERT( pCurrent->IsKey() ); // check must have been done before
if ( pCurrent->IsRoot() ) if ( pCurrent->IsRoot() )
{ {
wxLogError(wxT("Can't create a new value under the root key.")); wxLogError("Can't create a new value under the root key.");
return; return;
} }
@@ -1374,7 +1374,7 @@ void RegTreeCtrl::ShowProperties()
if ( !pCurrent || pCurrent->IsRoot() ) if ( !pCurrent || pCurrent->IsRoot() )
{ {
wxLogStatus(wxT("No properties")); wxLogStatus("No properties");
return; return;
} }
@@ -1385,27 +1385,27 @@ void RegTreeCtrl::ShowProperties()
size_t nSubKeys, nValues; size_t nSubKeys, nValues;
if ( !key.GetKeyInfo(&nSubKeys, NULL, &nValues, NULL) ) if ( !key.GetKeyInfo(&nSubKeys, NULL, &nValues, NULL) )
{ {
wxLogError(wxT("Couldn't get key info")); wxLogError("Couldn't get key info");
} }
else else
{ {
wxLogMessage(wxT("Key '%s' has %u subkeys and %u values."), wxLogMessage("Key '%s' has %u subkeys and %u values.",
key.GetName().c_str(), nSubKeys, nValues); key.GetName().c_str(), nSubKeys, nValues);
} }
} }
else // it's a value else // it's a value
{ {
TreeNode *parent = pCurrent->Parent(); TreeNode *parent = pCurrent->Parent();
wxCHECK_RET( parent, wxT("reg value without key?") ); wxCHECK_RET( parent, "reg value without key?" );
const wxRegKey& key = parent->Key(); const wxRegKey& key = parent->Key();
const wxChar *value = pCurrent->m_strName.c_str(); const wxChar *value = pCurrent->m_strName.c_str();
wxLogMessage(wxT("Value '%s' under the key '%s' is of type ") wxLogMessage("Value '%s' under the key '%s' is of type "
wxT("%d (%s)."), "%d (%s).",
value, value,
parent->m_strName.c_str(), parent->m_strName.c_str(),
key.GetValueType(value), key.GetValueType(value),
key.IsNumericValue(value) ? wxT("numeric") : wxT("string")); key.IsNumericValue(value) ? "numeric" : "string");
} }
} }
@@ -1428,7 +1428,7 @@ void RegTreeCtrl::DoRefresh()
TreeNode *pNode = (TreeNode *) GetItemData(lId); TreeNode *pNode = (TreeNode *) GetItemData(lId);
wxCHECK_RET( pNode != NULL, wxT("tree item without data?") ); wxCHECK_RET( pNode != NULL, "tree item without data?" );
pNode->Refresh(); pNode->Refresh();
} }

View File

@@ -50,12 +50,12 @@ public:
#if 0 // just for debugging #if 0 // just for debugging
MyDllRenderer() MyDllRenderer()
{ {
wxMessageBox(wxT("Creating MyDllRenderer"), wxT("Renderer Sample")); wxMessageBox("Creating MyDllRenderer", "Renderer Sample");
} }
virtual ~MyDllRenderer() virtual ~MyDllRenderer()
{ {
wxMessageBox(wxT("Deleting MyDllRenderer"), wxT("Renderer Sample")); wxMessageBox("Deleting MyDllRenderer", "Renderer Sample");
} }
#endif // 0 #endif // 0
}; };

View File

@@ -436,7 +436,7 @@ bool MyApp::OnInit()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, : wxFrame(NULL,
wxID_ANY, wxID_ANY,
wxT("Render wxWidgets Sample")) "Render wxWidgets Sample")
{ {
// set the frame icon // set the frame icon
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
@@ -471,8 +471,8 @@ MyFrame::MyFrame()
menuFile->AppendCheckItem(Render_UseGeneric, "Use &generic renderer\tCtrl-G"); menuFile->AppendCheckItem(Render_UseGeneric, "Use &generic renderer\tCtrl-G");
#if wxUSE_DYNLIB_CLASS #if wxUSE_DYNLIB_CLASS
menuFile->Append(Render_Load, wxT("&Load renderer...\tCtrl-L")); menuFile->Append(Render_Load, "&Load renderer...\tCtrl-L");
menuFile->Append(Render_Unload, wxT("&Unload renderer\tCtrl-U")); menuFile->Append(Render_Unload, "&Unload renderer\tCtrl-U");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
#endif // wxUSE_DYNLIB_CLASS #endif // wxUSE_DYNLIB_CLASS
menuFile->Append(Render_Quit); menuFile->Append(Render_Quit);
@@ -483,8 +483,8 @@ MyFrame::MyFrame()
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -497,7 +497,7 @@ MyFrame::MyFrame()
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
Show(); Show();
@@ -551,12 +551,12 @@ void MyFrame::OnUseGeneric(wxCommandEvent& event)
void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event))
{ {
static wxString s_name = wxT("renddll"); static wxString s_name = "renddll";
wxString name = wxGetTextFromUser wxString name = wxGetTextFromUser
( (
wxT("Name of the renderer to load:"), "Name of the renderer to load:",
wxT("Render wxWidgets Sample"), "Render wxWidgets Sample",
s_name, s_name,
this this
); );
@@ -593,11 +593,11 @@ void MyFrame::OnUnload(wxCommandEvent& WXUNUSED(event))
m_panel->Refresh(); m_panel->Refresh();
wxLogStatus(this, wxT("Unloaded the previously loaded renderer.")); wxLogStatus(this, "Unloaded the previously loaded renderer.");
} }
else else
{ {
wxLogWarning(wxT("No renderer to unload.")); wxLogWarning("No renderer to unload.");
} }
} }
@@ -611,10 +611,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("Render sample shows how to use custom renderers.\n") wxMessageBox("Render sample shows how to use custom renderers.\n"
wxT("\n") "\n"
wxT("(c) 2003 Vadim Zeitlin"), "(c) 2003 Vadim Zeitlin",
wxT("About Render wxWidgets Sample"), "About Render wxWidgets Sample",
wxOK | wxICON_INFORMATION, this); wxOK | wxICON_INFORMATION, this);
} }

View File

@@ -288,7 +288,7 @@ wxEND_EVENT_TABLE()
#include "triangle.xpm" #include "triangle.xpm"
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, wxT("wxRibbon Sample Application"), wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE) : wxFrame(NULL, wxID_ANY, "wxRibbon Sample Application", wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE)
{ {
m_ribbon = new wxRibbonBar(this,-1,wxDefaultPosition, wxDefaultSize, wxRIBBON_BAR_FLOW_HORIZONTAL m_ribbon = new wxRibbonBar(this,-1,wxDefaultPosition, wxDefaultSize, wxRIBBON_BAR_FLOW_HORIZONTAL
| wxRIBBON_BAR_SHOW_PAGE_LABELS | wxRIBBON_BAR_SHOW_PAGE_LABELS
@@ -298,8 +298,8 @@ MyFrame::MyFrame()
); );
{ {
wxRibbonPage* home = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Examples"), ribbon_xpm); wxRibbonPage* home = new wxRibbonPage(m_ribbon, wxID_ANY, "Examples", ribbon_xpm);
wxRibbonPanel *toolbar_panel = new wxRibbonPanel(home, wxID_ANY, wxT("Toolbar"), wxRibbonPanel *toolbar_panel = new wxRibbonPanel(home, wxID_ANY, "Toolbar",
wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxNullBitmap, wxDefaultPosition, wxDefaultSize,
wxRIBBON_PANEL_NO_AUTO_MINIMISE | wxRIBBON_PANEL_NO_AUTO_MINIMISE |
wxRIBBON_PANEL_EXT_BUTTON); wxRIBBON_PANEL_EXT_BUTTON);
@@ -331,24 +331,24 @@ MyFrame::MyFrame()
"This is the Print button tooltip\ndemonstrating a tooltip"); "This is the Print button tooltip\ndemonstrating a tooltip");
toolbar->SetRows(2, 3); toolbar->SetRows(2, 3);
wxRibbonPanel *selection_panel = new wxRibbonPanel(home, wxID_ANY, wxT("Selection"), wxBitmap(selection_panel_xpm)); wxRibbonPanel *selection_panel = new wxRibbonPanel(home, wxID_ANY, "Selection", wxBitmap(selection_panel_xpm));
wxRibbonButtonBar *selection = new wxRibbonButtonBar(selection_panel); wxRibbonButtonBar *selection = new wxRibbonButtonBar(selection_panel);
selection->AddButton(ID_SELECTION_EXPAND_V, wxT("Expand Vertically"), wxBitmap(expand_selection_v_xpm), selection->AddButton(ID_SELECTION_EXPAND_V, "Expand Vertically", wxBitmap(expand_selection_v_xpm),
"This is a tooltip for Expand Vertically\ndemonstrating a tooltip"); "This is a tooltip for Expand Vertically\ndemonstrating a tooltip");
selection->AddButton(ID_SELECTION_EXPAND_H, wxT("Expand Horizontally"), wxBitmap(expand_selection_h_xpm), wxEmptyString); selection->AddButton(ID_SELECTION_EXPAND_H, "Expand Horizontally", wxBitmap(expand_selection_h_xpm), wxEmptyString);
selection->AddButton(ID_SELECTION_CONTRACT, wxT("Contract"), wxBitmap(auto_crop_selection_xpm), wxBitmap(auto_crop_selection_small_xpm)); selection->AddButton(ID_SELECTION_CONTRACT, "Contract", wxBitmap(auto_crop_selection_xpm), wxBitmap(auto_crop_selection_small_xpm));
wxRibbonPanel *shapes_panel = new wxRibbonPanel(home, wxID_ANY, wxT("Shapes"), wxBitmap(circle_small_xpm)); wxRibbonPanel *shapes_panel = new wxRibbonPanel(home, wxID_ANY, "Shapes", wxBitmap(circle_small_xpm));
wxRibbonButtonBar *shapes = new wxRibbonButtonBar(shapes_panel); wxRibbonButtonBar *shapes = new wxRibbonButtonBar(shapes_panel);
shapes->AddButton(ID_CIRCLE, wxT("Circle"), wxBitmap(circle_xpm), wxBitmap(circle_small_xpm), shapes->AddButton(ID_CIRCLE, "Circle", wxBitmap(circle_xpm), wxBitmap(circle_small_xpm),
wxNullBitmap, wxNullBitmap, wxRIBBON_BUTTON_NORMAL, wxNullBitmap, wxNullBitmap, wxRIBBON_BUTTON_NORMAL,
"This is a tooltip for the circle button\ndemonstrating another tooltip"); "This is a tooltip for the circle button\ndemonstrating another tooltip");
shapes->AddButton(ID_CROSS, wxT("Cross"), wxBitmap(cross_xpm), wxEmptyString); shapes->AddButton(ID_CROSS, "Cross", wxBitmap(cross_xpm), wxEmptyString);
shapes->AddHybridButton(ID_TRIANGLE, wxT("Triangle"), wxBitmap(triangle_xpm)); shapes->AddHybridButton(ID_TRIANGLE, "Triangle", wxBitmap(triangle_xpm));
shapes->AddButton(ID_SQUARE, wxT("Square"), wxBitmap(square_xpm), wxEmptyString); shapes->AddButton(ID_SQUARE, "Square", wxBitmap(square_xpm), wxEmptyString);
shapes->AddDropdownButton(ID_POLYGON, wxT("Other Polygon"), wxBitmap(hexagon_xpm), wxEmptyString); shapes->AddDropdownButton(ID_POLYGON, "Other Polygon", wxBitmap(hexagon_xpm), wxEmptyString);
wxRibbonPanel *sizer_panel = new wxRibbonPanel(home, wxID_ANY, wxT("Panel with Sizer"), wxRibbonPanel *sizer_panel = new wxRibbonPanel(home, wxID_ANY, "Panel with Sizer",
wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxNullBitmap, wxDefaultPosition, wxDefaultSize,
wxRIBBON_PANEL_DEFAULT_STYLE); wxRIBBON_PANEL_DEFAULT_STYLE);
@@ -371,8 +371,8 @@ MyFrame::MyFrame()
sizer_panelcombo2->SetMinSize(wxSize(150, -1)); sizer_panelcombo2->SetMinSize(wxSize(150, -1));
wxRibbonButtonBar* bar = new wxRibbonButtonBar(sizer_panel, wxID_ANY); wxRibbonButtonBar* bar = new wxRibbonButtonBar(sizer_panel, wxID_ANY);
bar->AddButton(ID_BUTTON_XX, wxT("xx"), ribbon_xpm); bar->AddButton(ID_BUTTON_XX, "xx", ribbon_xpm);
bar->AddButton(ID_BUTTON_XY, wxT("xy"), ribbon_xpm); bar->AddButton(ID_BUTTON_XY, "xy", ribbon_xpm);
// This prevents ribbon buttons in panels with sizer from collapsing. // This prevents ribbon buttons in panels with sizer from collapsing.
bar->SetButtonMinSizeClass(ID_BUTTON_XX, wxRIBBON_BUTTONBAR_BUTTON_LARGE); bar->SetButtonMinSizeClass(ID_BUTTON_XX, wxRIBBON_BUTTONBAR_BUTTON_LARGE);
bar->SetButtonMinSizeClass(ID_BUTTON_XY, wxRIBBON_BUTTONBAR_BUTTON_LARGE); bar->SetButtonMinSizeClass(ID_BUTTON_XY, wxRIBBON_BUTTONBAR_BUTTON_LARGE);
@@ -390,109 +390,109 @@ MyFrame::MyFrame()
wxFont label_font(wxFontInfo(8).Light()); wxFont label_font(wxFontInfo(8).Light());
m_bitmap_creation_dc.SetFont(label_font); m_bitmap_creation_dc.SetFont(label_font);
wxRibbonPage* scheme = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Appearance"), eye_xpm); wxRibbonPage* scheme = new wxRibbonPage(m_ribbon, wxID_ANY, "Appearance", eye_xpm);
m_ribbon->GetArtProvider()->GetColourScheme(&m_default_primary, m_ribbon->GetArtProvider()->GetColourScheme(&m_default_primary,
&m_default_secondary, &m_default_tertiary); &m_default_secondary, &m_default_tertiary);
wxRibbonPanel *provider_panel = new wxRibbonPanel(scheme, wxID_ANY, wxRibbonPanel *provider_panel = new wxRibbonPanel(scheme, wxID_ANY,
wxT("Art"), wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_NO_AUTO_MINIMISE); "Art", wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_NO_AUTO_MINIMISE);
wxRibbonButtonBar *provider_bar = new wxRibbonButtonBar(provider_panel, wxID_ANY); wxRibbonButtonBar *provider_bar = new wxRibbonButtonBar(provider_panel, wxID_ANY);
provider_bar->AddButton(ID_DEFAULT_PROVIDER, wxT("Default Provider"), provider_bar->AddButton(ID_DEFAULT_PROVIDER, "Default Provider",
wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, wxSize(32, 32))); wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, wxSize(32, 32)));
provider_bar->AddButton(ID_AUI_PROVIDER, wxT("AUI Provider"), aui_style_xpm); provider_bar->AddButton(ID_AUI_PROVIDER, "AUI Provider", aui_style_xpm);
provider_bar->AddButton(ID_MSW_PROVIDER, wxT("MSW Provider"), msw_style_xpm); provider_bar->AddButton(ID_MSW_PROVIDER, "MSW Provider", msw_style_xpm);
wxRibbonPanel *primary_panel = new wxRibbonPanel(scheme, wxID_ANY, wxRibbonPanel *primary_panel = new wxRibbonPanel(scheme, wxID_ANY,
wxT("Primary Colour"), colours_xpm); "Primary Colour", colours_xpm);
m_primary_gallery = PopulateColoursPanel(primary_panel, m_primary_gallery = PopulateColoursPanel(primary_panel,
m_default_primary, ID_PRIMARY_COLOUR); m_default_primary, ID_PRIMARY_COLOUR);
wxRibbonPanel *secondary_panel = new wxRibbonPanel(scheme, wxID_ANY, wxRibbonPanel *secondary_panel = new wxRibbonPanel(scheme, wxID_ANY,
wxT("Secondary Colour"), colours_xpm); "Secondary Colour", colours_xpm);
m_secondary_gallery = PopulateColoursPanel(secondary_panel, m_secondary_gallery = PopulateColoursPanel(secondary_panel,
m_default_secondary, ID_SECONDARY_COLOUR); m_default_secondary, ID_SECONDARY_COLOUR);
} }
{ {
wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("UI Updated"), ribbon_xpm); wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, "UI Updated", ribbon_xpm);
wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, wxT("Enable/Disable"), ribbon_xpm); wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, "Enable/Disable", ribbon_xpm);
wxRibbonButtonBar *bar = new wxRibbonButtonBar(panel, wxID_ANY); wxRibbonButtonBar *bar = new wxRibbonButtonBar(panel, wxID_ANY);
bar->AddButton(ID_DISABLED, wxT("Disabled"), ribbon_xpm); bar->AddButton(ID_DISABLED, "Disabled", ribbon_xpm);
bar->AddButton(ID_ENABLE, wxT("Enable"), ribbon_xpm); bar->AddButton(ID_ENABLE, "Enable", ribbon_xpm);
bar->AddButton(ID_DISABLE, wxT("Disable"), ribbon_xpm); bar->AddButton(ID_DISABLE, "Disable", ribbon_xpm);
bar->AddButton(ID_UI_ENABLE_UPDATED, wxT("Enable UI updated"), ribbon_xpm); bar->AddButton(ID_UI_ENABLE_UPDATED, "Enable UI updated", ribbon_xpm);
bar->EnableButton(ID_DISABLED, false); bar->EnableButton(ID_DISABLED, false);
m_bEnabled = true; m_bEnabled = true;
panel = new wxRibbonPanel(page, wxID_ANY, wxT("Toggle"), ribbon_xpm); panel = new wxRibbonPanel(page, wxID_ANY, "Toggle", ribbon_xpm);
bar = new wxRibbonButtonBar(panel, wxID_ANY); bar = new wxRibbonButtonBar(panel, wxID_ANY);
bar->AddButton(ID_CHECK, wxT("Toggle"), ribbon_xpm); bar->AddButton(ID_CHECK, "Toggle", ribbon_xpm);
bar->AddToggleButton(ID_UI_CHECK_UPDATED, wxT("Toggled UI updated"), ribbon_xpm); bar->AddToggleButton(ID_UI_CHECK_UPDATED, "Toggled UI updated", ribbon_xpm);
m_bChecked = true; m_bChecked = true;
panel = new wxRibbonPanel(page, wxID_ANY, wxT("Change text"), ribbon_xpm); panel = new wxRibbonPanel(page, wxID_ANY, "Change text", ribbon_xpm);
bar = new wxRibbonButtonBar(panel, wxID_ANY); bar = new wxRibbonButtonBar(panel, wxID_ANY);
bar->AddButton(ID_CHANGE_TEXT1, wxT("One"), ribbon_xpm); bar->AddButton(ID_CHANGE_TEXT1, "One", ribbon_xpm);
bar->AddButton(ID_CHANGE_TEXT2, wxT("Two"), ribbon_xpm); bar->AddButton(ID_CHANGE_TEXT2, "Two", ribbon_xpm);
bar->AddButton(ID_UI_CHANGE_TEXT_UPDATED, wxT("Zero"), ribbon_xpm); bar->AddButton(ID_UI_CHANGE_TEXT_UPDATED, "Zero", ribbon_xpm);
//Also set the general disabled text colour: //Also set the general disabled text colour:
wxRibbonArtProvider* artProvider = m_ribbon->GetArtProvider(); wxRibbonArtProvider* artProvider = m_ribbon->GetArtProvider();
wxColour tColour = artProvider->GetColor(wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR); wxColour tColour = artProvider->GetColor(wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR);
artProvider->SetColor(wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR, tColour.MakeDisabled()); artProvider->SetColor(wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR, tColour.MakeDisabled());
} }
new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Empty Page"), empty_xpm); new wxRibbonPage(m_ribbon, wxID_ANY, "Empty Page", empty_xpm);
{ {
wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Another Page"), empty_xpm); wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, "Another Page", empty_xpm);
wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, wxT("Page manipulation"), ribbon_xpm); wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, "Page manipulation", ribbon_xpm);
wxRibbonButtonBar *bar = new wxRibbonButtonBar(panel, wxID_ANY); wxRibbonButtonBar *bar = new wxRibbonButtonBar(panel, wxID_ANY);
bar->AddButton(ID_REMOVE_PAGE, wxT("Remove"), wxArtProvider::GetBitmap(wxART_DELETE, wxART_OTHER, wxSize(24, 24))); bar->AddButton(ID_REMOVE_PAGE, "Remove", wxArtProvider::GetBitmap(wxART_DELETE, wxART_OTHER, wxSize(24, 24)));
bar->AddButton(ID_HIDE_PAGES, wxT("Hide Pages"), ribbon_xpm); bar->AddButton(ID_HIDE_PAGES, "Hide Pages", ribbon_xpm);
bar->AddButton(ID_SHOW_PAGES, wxT("Show Pages"), ribbon_xpm); bar->AddButton(ID_SHOW_PAGES, "Show Pages", ribbon_xpm);
panel = new wxRibbonPanel(page, wxID_ANY, wxT("Button bar manipulation"), ribbon_xpm); panel = new wxRibbonPanel(page, wxID_ANY, "Button bar manipulation", ribbon_xpm);
m_mutable_button_bar = new wxRibbonButtonBar(panel, wxID_ANY); m_mutable_button_bar = new wxRibbonButtonBar(panel, wxID_ANY);
m_mutable_button_bar->AddButton(ID_PLUS_MINUS, wxT("+/-"), m_mutable_button_bar->AddButton(ID_PLUS_MINUS, "+/-",
wxArtProvider::GetBitmap(wxART_PLUS, wxART_OTHER, wxSize(24, 24))); wxArtProvider::GetBitmap(wxART_PLUS, wxART_OTHER, wxSize(24, 24)));
m_plus_minus_state = false; m_plus_minus_state = false;
m_mutable_button_bar->AddButton(ID_CHANGE_LABEL, wxT("short"), ribbon_xpm); m_mutable_button_bar->AddButton(ID_CHANGE_LABEL, "short", ribbon_xpm);
m_mutable_button_bar->SetButtonTextMinWidth(ID_CHANGE_LABEL, wxT("some long text")); m_mutable_button_bar->SetButtonTextMinWidth(ID_CHANGE_LABEL, "some long text");
m_change_label_state = false; m_change_label_state = false;
panel = new wxRibbonPanel(page, wxID_ANY, wxT("Always medium buttons"), ribbon_xpm); panel = new wxRibbonPanel(page, wxID_ANY, "Always medium buttons", ribbon_xpm);
bar = new wxRibbonButtonBar(panel, wxID_ANY); bar = new wxRibbonButtonBar(panel, wxID_ANY);
bar->AddButton(ID_SMALL_BUTTON_1, wxT("Button 1"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_1, "Button 1", ribbon_xpm);
bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_1, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM); bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_1, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM);
bar->AddButton(ID_SMALL_BUTTON_2, wxT("Button 2"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_2, "Button 2", ribbon_xpm);
bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_2, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM); bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_2, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM);
bar->AddButton(ID_SMALL_BUTTON_3, wxT("Button 3"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_3, "Button 3", ribbon_xpm);
bar->AddButton(ID_SMALL_BUTTON_4, wxT("Button 4"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_4, "Button 4", ribbon_xpm);
bar->AddButton(ID_SMALL_BUTTON_5, wxT("Button 5"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_5, "Button 5", ribbon_xpm);
bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_5, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM); bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_5, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM);
bar->AddButton(ID_SMALL_BUTTON_6, wxT("Button 6"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_6, "Button 6", ribbon_xpm);
bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_6, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM); bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_6, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM);
} }
new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Highlight Page"), empty_xpm); new wxRibbonPage(m_ribbon, wxID_ANY, "Highlight Page", empty_xpm);
m_ribbon->AddPageHighlight(m_ribbon->GetPageCount()-1); m_ribbon->AddPageHighlight(m_ribbon->GetPageCount()-1);
{ {
wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Advanced"), empty_xpm); wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, "Advanced", empty_xpm);
wxRibbonPanel* panel = new wxRibbonPanel(page, wxID_ANY, wxT("Button bar manipulation"), ribbon_xpm); wxRibbonPanel* panel = new wxRibbonPanel(page, wxID_ANY, "Button bar manipulation", ribbon_xpm);
m_mutable_button_bar = new wxRibbonButtonBar(panel, wxID_ANY); m_mutable_button_bar = new wxRibbonButtonBar(panel, wxID_ANY);
m_mutable_button_bar->AddButton(ID_PLUS_MINUS, wxT("+/-"), m_mutable_button_bar->AddButton(ID_PLUS_MINUS, "+/-",
wxArtProvider::GetBitmap(wxART_PLUS, wxART_OTHER, wxSize(24, 24))); wxArtProvider::GetBitmap(wxART_PLUS, wxART_OTHER, wxSize(24, 24)));
m_plus_minus_state = false; m_plus_minus_state = false;
m_mutable_button_bar->AddButton(ID_CHANGE_LABEL, wxT("short"), ribbon_xpm); m_mutable_button_bar->AddButton(ID_CHANGE_LABEL, "short", ribbon_xpm);
m_mutable_button_bar->SetButtonTextMinWidth(ID_CHANGE_LABEL, wxT("some long text")); m_mutable_button_bar->SetButtonTextMinWidth(ID_CHANGE_LABEL, "some long text");
m_change_label_state = false; m_change_label_state = false;
panel = new wxRibbonPanel(page, wxID_ANY, wxT("Always medium buttons"), ribbon_xpm); panel = new wxRibbonPanel(page, wxID_ANY, "Always medium buttons", ribbon_xpm);
wxRibbonButtonBar* bar = new wxRibbonButtonBar(panel, wxID_ANY); wxRibbonButtonBar* bar = new wxRibbonButtonBar(panel, wxID_ANY);
bar->AddButton(ID_SMALL_BUTTON_1, wxT("Button 1"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_1, "Button 1", ribbon_xpm);
bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_1, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM); bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_1, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM);
bar->AddButton(ID_SMALL_BUTTON_2, wxT("Button 2"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_2, "Button 2", ribbon_xpm);
bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_2, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM); bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_2, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM);
bar->AddButton(ID_SMALL_BUTTON_3, wxT("Button 3"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_3, "Button 3", ribbon_xpm);
bar->AddButton(ID_SMALL_BUTTON_4, wxT("Button 4"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_4, "Button 4", ribbon_xpm);
bar->AddButton(ID_SMALL_BUTTON_5, wxT("Button 5"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_5, "Button 5", ribbon_xpm);
bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_5, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM); bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_5, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM);
bar->AddButton(ID_SMALL_BUTTON_6, wxT("Button 6"), ribbon_xpm); bar->AddButton(ID_SMALL_BUTTON_6, "Button 6", ribbon_xpm);
bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_6, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM); bar->SetButtonMaxSizeClass(ID_SMALL_BUTTON_6, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM);
} }
@@ -567,45 +567,45 @@ wxRibbonGallery* MyFrame::PopulateColoursPanel(wxWindow* panel,
gallery = new wxRibbonGallery(panel, gallery_id); gallery = new wxRibbonGallery(panel, gallery_id);
wxMemoryDC& dc = m_bitmap_creation_dc; wxMemoryDC& dc = m_bitmap_creation_dc;
wxRibbonGalleryItem *def_item = wxRibbonGalleryItem *def_item =
AddColourToGallery(gallery, wxT("Default"), dc, &def); AddColourToGallery(gallery, "Default", dc, &def);
gallery->SetSelection(def_item); gallery->SetSelection(def_item);
AddColourToGallery(gallery, wxT("BLUE"), dc); AddColourToGallery(gallery, "BLUE", dc);
AddColourToGallery(gallery, wxT("BLUE VIOLET"), dc); AddColourToGallery(gallery, "BLUE VIOLET", dc);
AddColourToGallery(gallery, wxT("BROWN"), dc); AddColourToGallery(gallery, "BROWN", dc);
AddColourToGallery(gallery, wxT("CADET BLUE"), dc); AddColourToGallery(gallery, "CADET BLUE", dc);
AddColourToGallery(gallery, wxT("CORAL"), dc); AddColourToGallery(gallery, "CORAL", dc);
AddColourToGallery(gallery, wxT("CYAN"), dc); AddColourToGallery(gallery, "CYAN", dc);
AddColourToGallery(gallery, wxT("DARK GREEN"), dc); AddColourToGallery(gallery, "DARK GREEN", dc);
AddColourToGallery(gallery, wxT("DARK ORCHID"), dc); AddColourToGallery(gallery, "DARK ORCHID", dc);
AddColourToGallery(gallery, wxT("FIREBRICK"), dc); AddColourToGallery(gallery, "FIREBRICK", dc);
AddColourToGallery(gallery, wxT("GOLD"), dc); AddColourToGallery(gallery, "GOLD", dc);
AddColourToGallery(gallery, wxT("GOLDENROD"), dc); AddColourToGallery(gallery, "GOLDENROD", dc);
AddColourToGallery(gallery, wxT("GREEN"), dc); AddColourToGallery(gallery, "GREEN", dc);
AddColourToGallery(gallery, wxT("INDIAN RED"), dc); AddColourToGallery(gallery, "INDIAN RED", dc);
AddColourToGallery(gallery, wxT("KHAKI"), dc); AddColourToGallery(gallery, "KHAKI", dc);
AddColourToGallery(gallery, wxT("LIGHT BLUE"), dc); AddColourToGallery(gallery, "LIGHT BLUE", dc);
AddColourToGallery(gallery, wxT("LIME GREEN"), dc); AddColourToGallery(gallery, "LIME GREEN", dc);
AddColourToGallery(gallery, wxT("MAGENTA"), dc); AddColourToGallery(gallery, "MAGENTA", dc);
AddColourToGallery(gallery, wxT("MAROON"), dc); AddColourToGallery(gallery, "MAROON", dc);
AddColourToGallery(gallery, wxT("NAVY"), dc); AddColourToGallery(gallery, "NAVY", dc);
AddColourToGallery(gallery, wxT("ORANGE"), dc); AddColourToGallery(gallery, "ORANGE", dc);
AddColourToGallery(gallery, wxT("ORCHID"), dc); AddColourToGallery(gallery, "ORCHID", dc);
AddColourToGallery(gallery, wxT("PINK"), dc); AddColourToGallery(gallery, "PINK", dc);
AddColourToGallery(gallery, wxT("PLUM"), dc); AddColourToGallery(gallery, "PLUM", dc);
AddColourToGallery(gallery, wxT("PURPLE"), dc); AddColourToGallery(gallery, "PURPLE", dc);
AddColourToGallery(gallery, wxT("RED"), dc); AddColourToGallery(gallery, "RED", dc);
AddColourToGallery(gallery, wxT("SALMON"), dc); AddColourToGallery(gallery, "SALMON", dc);
AddColourToGallery(gallery, wxT("SEA GREEN"), dc); AddColourToGallery(gallery, "SEA GREEN", dc);
AddColourToGallery(gallery, wxT("SIENNA"), dc); AddColourToGallery(gallery, "SIENNA", dc);
AddColourToGallery(gallery, wxT("SKY BLUE"), dc); AddColourToGallery(gallery, "SKY BLUE", dc);
AddColourToGallery(gallery, wxT("TAN"), dc); AddColourToGallery(gallery, "TAN", dc);
AddColourToGallery(gallery, wxT("THISTLE"), dc); AddColourToGallery(gallery, "THISTLE", dc);
AddColourToGallery(gallery, wxT("TURQUOISE"), dc); AddColourToGallery(gallery, "TURQUOISE", dc);
AddColourToGallery(gallery, wxT("VIOLET"), dc); AddColourToGallery(gallery, "VIOLET", dc);
AddColourToGallery(gallery, wxT("VIOLET RED"), dc); AddColourToGallery(gallery, "VIOLET RED", dc);
AddColourToGallery(gallery, wxT("WHEAT"), dc); AddColourToGallery(gallery, "WHEAT", dc);
AddColourToGallery(gallery, wxT("WHITE"), dc); AddColourToGallery(gallery, "WHITE", dc);
AddColourToGallery(gallery, wxT("YELLOW"), dc); AddColourToGallery(gallery, "YELLOW", dc);
return gallery; return gallery;
} }
@@ -687,12 +687,12 @@ void MyFrame::ResetGalleryArtProviders()
void MyFrame::OnChangeText1(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnChangeText1(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
m_new_text = wxT("One"); m_new_text = "One";
} }
void MyFrame::OnChangeText2(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnChangeText2(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
m_new_text = wxT("Two"); m_new_text = "Two";
} }
void MyFrame::OnEnable(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnEnable(wxRibbonButtonBarEvent& WXUNUSED(evt))
@@ -735,64 +735,64 @@ void MyFrame::OnChangeTextUpdateUI(wxUpdateUIEvent& evt)
if ( !m_new_text.IsEmpty() ) if ( !m_new_text.IsEmpty() )
{ {
evt.SetText(m_new_text); evt.SetText(m_new_text);
m_new_text = wxT(""); m_new_text = "";
} }
} }
void MyFrame::OnSelectionExpandHButton(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnSelectionExpandHButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
AddText(wxT("Expand selection horizontally button clicked.")); AddText("Expand selection horizontally button clicked.");
} }
void MyFrame::OnSelectionExpandVButton(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnSelectionExpandVButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
AddText(wxT("Expand selection vertically button clicked.")); AddText("Expand selection vertically button clicked.");
} }
void MyFrame::OnSelectionContractButton(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnSelectionContractButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
AddText(wxT("Contract selection button clicked.")); AddText("Contract selection button clicked.");
} }
void MyFrame::OnCircleButton(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnCircleButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
AddText(wxT("Circle button clicked.")); AddText("Circle button clicked.");
} }
void MyFrame::OnCrossButton(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnCrossButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
AddText(wxT("Cross button clicked.")); AddText("Cross button clicked.");
} }
void MyFrame::OnTriangleButton(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnTriangleButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
AddText(wxT("Triangle button clicked.")); AddText("Triangle button clicked.");
} }
void MyFrame::OnTriangleDropdown(wxRibbonButtonBarEvent& evt) void MyFrame::OnTriangleDropdown(wxRibbonButtonBarEvent& evt)
{ {
wxMenu menu; wxMenu menu;
menu.Append(wxID_ANY, wxT("Equilateral")); menu.Append(wxID_ANY, "Equilateral");
menu.Append(wxID_ANY, wxT("Isosceles")); menu.Append(wxID_ANY, "Isosceles");
menu.Append(wxID_ANY, wxT("Scalene")); menu.Append(wxID_ANY, "Scalene");
evt.PopupMenu(&menu); evt.PopupMenu(&menu);
} }
void MyFrame::OnSquareButton(wxRibbonButtonBarEvent& WXUNUSED(evt)) void MyFrame::OnSquareButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
AddText(wxT("Square button clicked.")); AddText("Square button clicked.");
} }
void MyFrame::OnPolygonDropdown(wxRibbonButtonBarEvent& evt) void MyFrame::OnPolygonDropdown(wxRibbonButtonBarEvent& evt)
{ {
wxMenu menu; wxMenu menu;
menu.Append(wxID_ANY, wxT("Pentagon (5 sided)")); menu.Append(wxID_ANY, "Pentagon (5 sided)");
menu.Append(wxID_ANY, wxT("Hexagon (6 sided)")); menu.Append(wxID_ANY, "Hexagon (6 sided)");
menu.Append(wxID_ANY, wxT("Heptagon (7 sided)")); menu.Append(wxID_ANY, "Heptagon (7 sided)");
menu.Append(wxID_ANY, wxT("Octogon (8 sided)")); menu.Append(wxID_ANY, "Octogon (8 sided)");
menu.Append(wxID_ANY, wxT("Nonagon (9 sided)")); menu.Append(wxID_ANY, "Nonagon (9 sided)");
menu.Append(wxID_ANY, wxT("Decagon (10 sided)")); menu.Append(wxID_ANY, "Decagon (10 sided)");
evt.PopupMenu(&menu); evt.PopupMenu(&menu);
} }
@@ -833,30 +833,30 @@ void MyFrame::OnJustifyUpdateUI(wxUpdateUIEvent& evt)
void MyFrame::OnNew(wxRibbonToolBarEvent& WXUNUSED(evt)) void MyFrame::OnNew(wxRibbonToolBarEvent& WXUNUSED(evt))
{ {
AddText(wxT("New button clicked.")); AddText("New button clicked.");
} }
void MyFrame::OnNewDropdown(wxRibbonToolBarEvent& evt) void MyFrame::OnNewDropdown(wxRibbonToolBarEvent& evt)
{ {
wxMenu menu; wxMenu menu;
menu.Append(wxID_ANY, wxT("New Document")); menu.Append(wxID_ANY, "New Document");
menu.Append(wxID_ANY, wxT("New Template")); menu.Append(wxID_ANY, "New Template");
menu.Append(wxID_ANY, wxT("New Mail")); menu.Append(wxID_ANY, "New Mail");
evt.PopupMenu(&menu); evt.PopupMenu(&menu);
} }
void MyFrame::OnPrint(wxRibbonToolBarEvent& WXUNUSED(evt)) void MyFrame::OnPrint(wxRibbonToolBarEvent& WXUNUSED(evt))
{ {
AddText(wxT("Print button clicked.")); AddText("Print button clicked.");
} }
void MyFrame::OnPrintDropdown(wxRibbonToolBarEvent& evt) void MyFrame::OnPrintDropdown(wxRibbonToolBarEvent& evt)
{ {
wxMenu menu; wxMenu menu;
menu.Append(wxID_ANY, wxT("Print")); menu.Append(wxID_ANY, "Print");
menu.Append(wxID_ANY, wxT("Preview")); menu.Append(wxID_ANY, "Preview");
menu.Append(wxID_ANY, wxT("Options")); menu.Append(wxID_ANY, "Options");
evt.PopupMenu(&menu); evt.PopupMenu(&menu);
} }
@@ -864,9 +864,9 @@ void MyFrame::OnPrintDropdown(wxRibbonToolBarEvent& evt)
void MyFrame::OnRedoDropdown(wxRibbonToolBarEvent& evt) void MyFrame::OnRedoDropdown(wxRibbonToolBarEvent& evt)
{ {
wxMenu menu; wxMenu menu;
menu.Append(wxID_ANY, wxT("Redo E")); menu.Append(wxID_ANY, "Redo E");
menu.Append(wxID_ANY, wxT("Redo F")); menu.Append(wxID_ANY, "Redo F");
menu.Append(wxID_ANY, wxT("Redo G")); menu.Append(wxID_ANY, "Redo G");
evt.PopupMenu(&menu); evt.PopupMenu(&menu);
} }
@@ -874,9 +874,9 @@ void MyFrame::OnRedoDropdown(wxRibbonToolBarEvent& evt)
void MyFrame::OnUndoDropdown(wxRibbonToolBarEvent& evt) void MyFrame::OnUndoDropdown(wxRibbonToolBarEvent& evt)
{ {
wxMenu menu; wxMenu menu;
menu.Append(wxID_ANY, wxT("Undo C")); menu.Append(wxID_ANY, "Undo C");
menu.Append(wxID_ANY, wxT("Undo B")); menu.Append(wxID_ANY, "Undo B");
menu.Append(wxID_ANY, wxT("Undo A")); menu.Append(wxID_ANY, "Undo A");
evt.PopupMenu(&menu); evt.PopupMenu(&menu);
} }
@@ -922,9 +922,9 @@ void MyFrame::OnPositionTop(wxRibbonToolBarEvent& evt)
void MyFrame::OnPositionTopDropdown(wxRibbonToolBarEvent& evt) void MyFrame::OnPositionTopDropdown(wxRibbonToolBarEvent& evt)
{ {
wxMenu menu; wxMenu menu;
menu.Append(ID_POSITION_TOP, wxT("Top with Labels")); menu.Append(ID_POSITION_TOP, "Top with Labels");
menu.Append(ID_POSITION_TOP_ICONS, wxT("Top with Icons")); menu.Append(ID_POSITION_TOP_ICONS, "Top with Icons");
menu.Append(ID_POSITION_TOP_BOTH, wxT("Top with Both")); menu.Append(ID_POSITION_TOP_BOTH, "Top with Both");
evt.PopupMenu(&menu); evt.PopupMenu(&menu);
} }
@@ -936,9 +936,9 @@ void MyFrame::OnPositionLeft(wxRibbonToolBarEvent& evt)
void MyFrame::OnPositionLeftDropdown(wxRibbonToolBarEvent& evt) void MyFrame::OnPositionLeftDropdown(wxRibbonToolBarEvent& evt)
{ {
wxMenu menu; wxMenu menu;
menu.Append(ID_POSITION_LEFT, wxT("Left with Icons")); menu.Append(ID_POSITION_LEFT, "Left with Icons");
menu.Append(ID_POSITION_LEFT_LABELS, wxT("Left with Labels")); menu.Append(ID_POSITION_LEFT_LABELS, "Left with Labels");
menu.Append(ID_POSITION_LEFT_BOTH, wxT("Left with Both")); menu.Append(ID_POSITION_LEFT_BOTH, "Left with Both");
evt.PopupMenu(&menu); evt.PopupMenu(&menu);
} }
@@ -955,7 +955,7 @@ void MyFrame::OnExtButton(wxRibbonPanelEvent& WXUNUSED(evt))
void MyFrame::AddText(wxString msg) void MyFrame::AddText(wxString msg)
{ {
m_logwindow->AppendText(msg); m_logwindow->AppendText(msg);
m_logwindow->AppendText(wxT("\n")); m_logwindow->AppendText("\n");
m_ribbon->DismissExpandedPanel(); m_ribbon->DismissExpandedPanel();
} }
@@ -965,7 +965,7 @@ wxRibbonGalleryItem* MyFrame::AddColourToGallery(wxRibbonGallery *gallery,
{ {
wxRibbonGalleryItem* item = NULL; wxRibbonGalleryItem* item = NULL;
wxColour c; wxColour c;
if (colour != wxT("Default")) if (colour != "Default")
c = wxColour(colour); c = wxColour(colour);
if (!c.IsOk()) if (!c.IsOk())
c = *value; c = *value;
@@ -1132,12 +1132,12 @@ void MyFrame::OnChangeLabel(wxRibbonButtonBarEvent& WXUNUSED(evt))
{ {
if(m_change_label_state) if(m_change_label_state)
{ {
m_mutable_button_bar->SetButtonText(ID_CHANGE_LABEL, wxT("short")); m_mutable_button_bar->SetButtonText(ID_CHANGE_LABEL, "short");
m_change_label_state = false; m_change_label_state = false;
} }
else else
{ {
m_mutable_button_bar->SetButtonText(ID_CHANGE_LABEL, wxT("some long text")); m_mutable_button_bar->SetButtonText(ID_CHANGE_LABEL, "some long text");
m_change_label_state = true; m_change_label_state = true;
} }
} }

View File

@@ -98,7 +98,7 @@ public:
virtual bool EditProperties(wxRichTextField* WXUNUSED(obj), wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) wxOVERRIDE virtual bool EditProperties(wxRichTextField* WXUNUSED(obj), wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) wxOVERRIDE
{ {
wxString label = GetLabel(); wxString label = GetLabel();
wxMessageBox(wxString::Format(wxT("Editing %s"), label.c_str())); wxMessageBox(wxString::Format("Editing %s", label.c_str()));
return true; return true;
} }
@@ -523,10 +523,10 @@ bool MyApp::OnInit()
m_styleSheet = new wxRichTextStyleSheet; m_styleSheet = new wxRichTextStyleSheet;
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
m_printing = new wxRichTextPrinting(wxT("Test Document")); m_printing = new wxRichTextPrinting("Test Document");
m_printing->SetFooterText(wxT("@TITLE@"), wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_CENTRE); m_printing->SetFooterText("@TITLE@", wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_CENTRE);
m_printing->SetFooterText(wxT("Page @PAGENUM@"), wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_RIGHT); m_printing->SetFooterText("Page @PAGENUM@", wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_RIGHT);
#endif #endif
CreateStyles(); CreateStyles();
@@ -539,21 +539,21 @@ bool MyApp::OnInit()
// Add field types // Add field types
wxRichTextBuffer::AddFieldType(new wxRichTextFieldTypePropertiesTest(wxT("rectangle"), wxT("RECTANGLE"), wxRichTextFieldTypeStandard::wxRICHTEXT_FIELD_STYLE_RECTANGLE)); wxRichTextBuffer::AddFieldType(new wxRichTextFieldTypePropertiesTest("rectangle", "RECTANGLE", wxRichTextFieldTypeStandard::wxRICHTEXT_FIELD_STYLE_RECTANGLE));
wxRichTextFieldTypeStandard* s1 = new wxRichTextFieldTypeStandard(wxT("begin-section"), wxT("SECTION"), wxRichTextFieldTypeStandard::wxRICHTEXT_FIELD_STYLE_START_TAG); wxRichTextFieldTypeStandard* s1 = new wxRichTextFieldTypeStandard("begin-section", "SECTION", wxRichTextFieldTypeStandard::wxRICHTEXT_FIELD_STYLE_START_TAG);
s1->SetBackgroundColour(*wxBLUE); s1->SetBackgroundColour(*wxBLUE);
wxRichTextFieldTypeStandard* s2 = new wxRichTextFieldTypeStandard(wxT("end-section"), wxT("SECTION"), wxRichTextFieldTypeStandard::wxRICHTEXT_FIELD_STYLE_END_TAG); wxRichTextFieldTypeStandard* s2 = new wxRichTextFieldTypeStandard("end-section", "SECTION", wxRichTextFieldTypeStandard::wxRICHTEXT_FIELD_STYLE_END_TAG);
s2->SetBackgroundColour(*wxBLUE); s2->SetBackgroundColour(*wxBLUE);
wxRichTextFieldTypeStandard* s3 = new wxRichTextFieldTypeStandard(wxT("bitmap"), wxBitmap(paste_xpm), wxRichTextFieldTypeStandard::wxRICHTEXT_FIELD_STYLE_NO_BORDER); wxRichTextFieldTypeStandard* s3 = new wxRichTextFieldTypeStandard("bitmap", wxBitmap(paste_xpm), wxRichTextFieldTypeStandard::wxRICHTEXT_FIELD_STYLE_NO_BORDER);
wxRichTextBuffer::AddFieldType(s1); wxRichTextBuffer::AddFieldType(s1);
wxRichTextBuffer::AddFieldType(s2); wxRichTextBuffer::AddFieldType(s2);
wxRichTextBuffer::AddFieldType(s3); wxRichTextBuffer::AddFieldType(s3);
wxRichTextFieldTypeCompositeTest* s4 = new wxRichTextFieldTypeCompositeTest(wxT("composite"), wxT("This is a field value")); wxRichTextFieldTypeCompositeTest* s4 = new wxRichTextFieldTypeCompositeTest("composite", "This is a field value");
wxRichTextBuffer::AddFieldType(s4); wxRichTextBuffer::AddFieldType(s4);
// Add image handlers // Add image handlers
@@ -576,7 +576,7 @@ bool MyApp::OnInit()
// create the main application window // create the main application window
wxSize size = wxGetDisplaySize(); wxSize size = wxGetDisplaySize();
size.Scale(0.75, 0.75); size.Scale(0.75, 0.75);
MyFrame *frame = new MyFrame(wxT("wxRichTextCtrl Sample"), wxID_ANY, wxDefaultPosition, size); MyFrame *frame = new MyFrame("wxRichTextCtrl Sample", wxID_ANY, wxDefaultPosition, size);
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
m_printing->SetParentWindow(frame); m_printing->SetParentWindow(frame);
@@ -609,7 +609,7 @@ void MyApp::CreateStyles()
wxFont romanFont(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN)); wxFont romanFont(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN));
wxFont swissFont(wxFontInfo(12).Family(wxFONTFAMILY_SWISS)); wxFont swissFont(wxFontInfo(12).Family(wxFONTFAMILY_SWISS));
wxRichTextParagraphStyleDefinition* normalPara = new wxRichTextParagraphStyleDefinition(wxT("Normal")); wxRichTextParagraphStyleDefinition* normalPara = new wxRichTextParagraphStyleDefinition("Normal");
wxRichTextAttr normalAttr; wxRichTextAttr normalAttr;
normalAttr.SetFontFaceName(romanFont.GetFaceName()); normalAttr.SetFontFaceName(romanFont.GetFaceName());
normalAttr.SetFontSize(12); normalAttr.SetFontSize(12);
@@ -621,7 +621,7 @@ void MyApp::CreateStyles()
m_styleSheet->AddParagraphStyle(normalPara); m_styleSheet->AddParagraphStyle(normalPara);
wxRichTextParagraphStyleDefinition* indentedPara = new wxRichTextParagraphStyleDefinition(wxT("Indented")); wxRichTextParagraphStyleDefinition* indentedPara = new wxRichTextParagraphStyleDefinition("Indented");
wxRichTextAttr indentedAttr; wxRichTextAttr indentedAttr;
indentedAttr.SetFontFaceName(romanFont.GetFaceName()); indentedAttr.SetFontFaceName(romanFont.GetFaceName());
indentedAttr.SetFontSize(12); indentedAttr.SetFontSize(12);
@@ -632,7 +632,7 @@ void MyApp::CreateStyles()
m_styleSheet->AddParagraphStyle(indentedPara); m_styleSheet->AddParagraphStyle(indentedPara);
wxRichTextParagraphStyleDefinition* indentedPara2 = new wxRichTextParagraphStyleDefinition(wxT("Red Bold Indented")); wxRichTextParagraphStyleDefinition* indentedPara2 = new wxRichTextParagraphStyleDefinition("Red Bold Indented");
wxRichTextAttr indentedAttr2; wxRichTextAttr indentedAttr2;
indentedAttr2.SetFontFaceName(romanFont.GetFaceName()); indentedAttr2.SetFontFaceName(romanFont.GetFaceName());
indentedAttr2.SetFontSize(12); indentedAttr2.SetFontSize(12);
@@ -646,7 +646,7 @@ void MyApp::CreateStyles()
m_styleSheet->AddParagraphStyle(indentedPara2); m_styleSheet->AddParagraphStyle(indentedPara2);
wxRichTextParagraphStyleDefinition* flIndentedPara = new wxRichTextParagraphStyleDefinition(wxT("First Line Indented")); wxRichTextParagraphStyleDefinition* flIndentedPara = new wxRichTextParagraphStyleDefinition("First Line Indented");
wxRichTextAttr flIndentedAttr; wxRichTextAttr flIndentedAttr;
flIndentedAttr.SetFontFaceName(swissFont.GetFaceName()); flIndentedAttr.SetFontFaceName(swissFont.GetFaceName());
flIndentedAttr.SetFontSize(12); flIndentedAttr.SetFontSize(12);
@@ -659,7 +659,7 @@ void MyApp::CreateStyles()
// Character styles // Character styles
wxRichTextCharacterStyleDefinition* boldDef = new wxRichTextCharacterStyleDefinition(wxT("Bold")); wxRichTextCharacterStyleDefinition* boldDef = new wxRichTextCharacterStyleDefinition("Bold");
wxRichTextAttr boldAttr; wxRichTextAttr boldAttr;
boldAttr.SetFontFaceName(romanFont.GetFaceName()); boldAttr.SetFontFaceName(romanFont.GetFaceName());
boldAttr.SetFontSize(12); boldAttr.SetFontSize(12);
@@ -670,7 +670,7 @@ void MyApp::CreateStyles()
m_styleSheet->AddCharacterStyle(boldDef); m_styleSheet->AddCharacterStyle(boldDef);
wxRichTextCharacterStyleDefinition* italicDef = new wxRichTextCharacterStyleDefinition(wxT("Italic")); wxRichTextCharacterStyleDefinition* italicDef = new wxRichTextCharacterStyleDefinition("Italic");
wxRichTextAttr italicAttr; wxRichTextAttr italicAttr;
italicAttr.SetFontFaceName(romanFont.GetFaceName()); italicAttr.SetFontFaceName(romanFont.GetFaceName());
italicAttr.SetFontSize(12); italicAttr.SetFontSize(12);
@@ -681,7 +681,7 @@ void MyApp::CreateStyles()
m_styleSheet->AddCharacterStyle(italicDef); m_styleSheet->AddCharacterStyle(italicDef);
wxRichTextCharacterStyleDefinition* redDef = new wxRichTextCharacterStyleDefinition(wxT("Red Bold")); wxRichTextCharacterStyleDefinition* redDef = new wxRichTextCharacterStyleDefinition("Red Bold");
wxRichTextAttr redAttr; wxRichTextAttr redAttr;
redAttr.SetFontFaceName(romanFont.GetFaceName()); redAttr.SetFontFaceName(romanFont.GetFaceName());
redAttr.SetFontSize(12); redAttr.SetFontSize(12);
@@ -693,28 +693,28 @@ void MyApp::CreateStyles()
m_styleSheet->AddCharacterStyle(redDef); m_styleSheet->AddCharacterStyle(redDef);
wxRichTextListStyleDefinition* bulletList = new wxRichTextListStyleDefinition(wxT("Bullet List 1")); wxRichTextListStyleDefinition* bulletList = new wxRichTextListStyleDefinition("Bullet List 1");
int i; int i;
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
{ {
wxString bulletText; wxString bulletText;
if (i == 0) if (i == 0)
bulletText = wxT("standard/circle"); bulletText = "standard/circle";
else if (i == 1) else if (i == 1)
bulletText = wxT("standard/square"); bulletText = "standard/square";
else if (i == 2) else if (i == 2)
bulletText = wxT("standard/circle"); bulletText = "standard/circle";
else if (i == 3) else if (i == 3)
bulletText = wxT("standard/square"); bulletText = "standard/square";
else else
bulletText = wxT("standard/circle"); bulletText = "standard/circle";
bulletList->SetAttributes(i, (i+1)*60, 60, wxTEXT_ATTR_BULLET_STYLE_STANDARD, bulletText); bulletList->SetAttributes(i, (i+1)*60, 60, wxTEXT_ATTR_BULLET_STYLE_STANDARD, bulletText);
} }
m_styleSheet->AddListStyle(bulletList); m_styleSheet->AddListStyle(bulletList);
wxRichTextListStyleDefinition* numberedList = new wxRichTextListStyleDefinition(wxT("Numbered List 1")); wxRichTextListStyleDefinition* numberedList = new wxRichTextListStyleDefinition("Numbered List 1");
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
{ {
long numberStyle; long numberStyle;
@@ -736,7 +736,7 @@ void MyApp::CreateStyles()
m_styleSheet->AddListStyle(numberedList); m_styleSheet->AddListStyle(numberedList);
wxRichTextListStyleDefinition* outlineList = new wxRichTextListStyleDefinition(wxT("Outline List 1")); wxRichTextListStyleDefinition* outlineList = new wxRichTextListStyleDefinition("Outline List 1");
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
{ {
long numberStyle; long numberStyle;
@@ -772,23 +772,23 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(ID_About, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(ID_About, "&About\tF1", "Show about dialog");
fileMenu->Append(wxID_OPEN, wxT("&Open\tCtrl+O"), wxT("Open a file")); fileMenu->Append(wxID_OPEN, "&Open\tCtrl+O", "Open a file");
fileMenu->Append(wxID_SAVE, wxT("&Save\tCtrl+S"), wxT("Save a file")); fileMenu->Append(wxID_SAVE, "&Save\tCtrl+S", "Save a file");
fileMenu->Append(wxID_SAVEAS, wxT("&Save As...\tF12"), wxT("Save to a new file")); fileMenu->Append(wxID_SAVEAS, "&Save As...\tF12", "Save to a new file");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(ID_RELOAD, wxT("&Reload Text\tF2"), wxT("Reload the initial text")); fileMenu->Append(ID_RELOAD, "&Reload Text\tF2", "Reload the initial text");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(ID_PAGE_SETUP, wxT("Page Set&up..."), wxT("Page setup")); fileMenu->Append(ID_PAGE_SETUP, "Page Set&up...", "Page setup");
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
fileMenu->Append(ID_PRINT, wxT("&Print...\tCtrl+P"), wxT("Print")); fileMenu->Append(ID_PRINT, "&Print...\tCtrl+P", "Print");
fileMenu->Append(ID_PREVIEW, wxT("Print Pre&view"), wxT("Print preview")); fileMenu->Append(ID_PREVIEW, "Print Pre&view", "Print preview");
#endif #endif
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(ID_VIEW_HTML, wxT("&View as HTML"), wxT("View HTML")); fileMenu->Append(ID_VIEW_HTML, "&View as HTML", "View HTML");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(ID_Quit, wxT("E&xit\tAlt+X"), wxT("Quit this program")); fileMenu->Append(ID_Quit, "E&xit\tAlt+X", "Quit this program");
wxMenu* editMenu = new wxMenu; wxMenu* editMenu = new wxMenu;
editMenu->Append(wxID_UNDO, _("&Undo\tCtrl+Z")); editMenu->Append(wxID_UNDO, _("&Undo\tCtrl+Z"));
@@ -858,13 +858,13 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(fileMenu, "&File");
menuBar->Append(editMenu, wxT("&Edit")); menuBar->Append(editMenu, "&Edit");
menuBar->Append(formatMenu, wxT("F&ormat")); menuBar->Append(formatMenu, "F&ormat");
menuBar->Append(listsMenu, wxT("&Lists")); menuBar->Append(listsMenu, "&Lists");
menuBar->Append(tableMenu, wxT("&Tables")); menuBar->Append(tableMenu, "&Tables");
menuBar->Append(insertMenu, wxT("&Insert")); menuBar->Append(insertMenu, "&Insert");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -877,7 +877,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
if ( !is_pda ) if ( !is_pda )
{ {
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxRichTextCtrl!")); SetStatusText("Welcome to wxRichTextCtrl!");
} }
#endif #endif
@@ -890,7 +890,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
// toolbar to avoid the need for this workaround. Or, use the toolbar in a container window // toolbar to avoid the need for this workaround. Or, use the toolbar in a container window
// as part of a more complex hierarchy, and the toolbar will automatically be non-native. // as part of a more complex hierarchy, and the toolbar will automatically be non-native.
wxSystemOptions::SetOption(wxT("mac.toolbar.no-native"), 1); wxSystemOptions::SetOption("mac.toolbar.no-native", 1);
wxToolBar* toolBar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxToolBar* toolBar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxNO_BORDER|wxTB_FLAT|wxTB_NODIVIDER|wxTB_NOALIGN); wxNO_BORDER|wxTB_FLAT|wxTB_NODIVIDER|wxTB_NOALIGN);
@@ -995,11 +995,11 @@ void MyFrame::WriteInitialText()
wxString lineBreak = (wxChar) 29; wxString lineBreak = (wxChar) 29;
r.WriteText(wxString(wxT("Welcome to wxRichTextCtrl, a wxWidgets control")) + lineBreak + wxT("for editing and presenting styled text and images\n")); r.WriteText(wxString("Welcome to wxRichTextCtrl, a wxWidgets control") + lineBreak + "for editing and presenting styled text and images\n");
r.EndFontSize(); r.EndFontSize();
r.BeginItalic(); r.BeginItalic();
r.WriteText(wxT("by Julian Smart")); r.WriteText("by Julian Smart");
r.EndItalic(); r.EndItalic();
r.EndBold(); r.EndBold();
@@ -1014,7 +1014,7 @@ void MyFrame::WriteInitialText()
#if 0 #if 0
r.BeginAlignment(wxTEXT_ALIGNMENT_CENTRE); r.BeginAlignment(wxTEXT_ALIGNMENT_CENTRE);
r.WriteText(wxString(wxT("This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side."))); r.WriteText(wxString("This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side."));
r.Newline(); r.Newline();
r.EndAlignment(); r.EndAlignment();
#endif #endif
@@ -1022,98 +1022,98 @@ void MyFrame::WriteInitialText()
r.BeginAlignment(wxTEXT_ALIGNMENT_LEFT); r.BeginAlignment(wxTEXT_ALIGNMENT_LEFT);
wxRichTextAttr imageAttr; wxRichTextAttr imageAttr;
imageAttr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_LEFT); imageAttr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_LEFT);
r.WriteText(wxString(wxT("This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side."))); r.WriteText(wxString("This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side."));
r.WriteImage(wxBitmap(zebra_xpm), wxBITMAP_TYPE_PNG, imageAttr); r.WriteImage(wxBitmap(zebra_xpm), wxBITMAP_TYPE_PNG, imageAttr);
imageAttr.GetTextBoxAttr().GetTop().SetValue(200); imageAttr.GetTextBoxAttr().GetTop().SetValue(200);
imageAttr.GetTextBoxAttr().GetTop().SetUnits(wxTEXT_ATTR_UNITS_PIXELS); imageAttr.GetTextBoxAttr().GetTop().SetUnits(wxTEXT_ATTR_UNITS_PIXELS);
imageAttr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_RIGHT); imageAttr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_RIGHT);
r.WriteImage(wxBitmap(zebra_xpm), wxBITMAP_TYPE_PNG, imageAttr); r.WriteImage(wxBitmap(zebra_xpm), wxBITMAP_TYPE_PNG, imageAttr);
r.WriteText(wxString(wxT("This is a simple test for a floating right image test. The zebra image should be placed at the right side of the current buffer and all the text should flow around it at the left side. This is a simple test for a floating left image test. The zebra image should be placed at the right side of the current buffer and all the text should flow around it at the left side. This is a simple test for a floating left image test. The zebra image should be placed at the right side of the current buffer and all the text should flow around it at the left side."))); r.WriteText(wxString("This is a simple test for a floating right image test. The zebra image should be placed at the right side of the current buffer and all the text should flow around it at the left side. This is a simple test for a floating left image test. The zebra image should be placed at the right side of the current buffer and all the text should flow around it at the left side. This is a simple test for a floating left image test. The zebra image should be placed at the right side of the current buffer and all the text should flow around it at the left side."));
r.EndAlignment(); r.EndAlignment();
r.Newline(); r.Newline();
r.WriteText(wxT("What can you do with this thing? ")); r.WriteText("What can you do with this thing? ");
r.WriteImage(wxBitmap(smiley_xpm)); r.WriteImage(wxBitmap(smiley_xpm));
r.WriteText(wxT(" Well, you can change text ")); r.WriteText(" Well, you can change text ");
r.BeginTextColour(*wxRED); r.BeginTextColour(*wxRED);
r.WriteText(wxT("colour, like this red bit.")); r.WriteText("colour, like this red bit.");
r.EndTextColour(); r.EndTextColour();
wxRichTextAttr backgroundColourAttr; wxRichTextAttr backgroundColourAttr;
backgroundColourAttr.SetBackgroundColour(*wxGREEN); backgroundColourAttr.SetBackgroundColour(*wxGREEN);
backgroundColourAttr.SetTextColour(*wxBLUE); backgroundColourAttr.SetTextColour(*wxBLUE);
r.BeginStyle(backgroundColourAttr); r.BeginStyle(backgroundColourAttr);
r.WriteText(wxT(" And this blue on green bit.")); r.WriteText(" And this blue on green bit.");
r.EndStyle(); r.EndStyle();
r.WriteText(wxT(" Naturally you can make things ")); r.WriteText(" Naturally you can make things ");
r.BeginBold(); r.BeginBold();
r.WriteText(wxT("bold ")); r.WriteText("bold ");
r.EndBold(); r.EndBold();
r.BeginItalic(); r.BeginItalic();
r.WriteText(wxT("or italic ")); r.WriteText("or italic ");
r.EndItalic(); r.EndItalic();
r.BeginUnderline(); r.BeginUnderline();
r.WriteText(wxT("or underlined.")); r.WriteText("or underlined.");
r.EndUnderline(); r.EndUnderline();
r.BeginFontSize(14); r.BeginFontSize(14);
r.WriteText(wxT(" Different font sizes on the same line is allowed, too.")); r.WriteText(" Different font sizes on the same line is allowed, too.");
r.EndFontSize(); r.EndFontSize();
r.WriteText(wxT(" Next we'll show an indented paragraph.")); r.WriteText(" Next we'll show an indented paragraph.");
r.Newline(); r.Newline();
r.BeginLeftIndent(60); r.BeginLeftIndent(60);
r.WriteText(wxT("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.")); r.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.");
r.Newline(); r.Newline();
r.EndLeftIndent(); r.EndLeftIndent();
r.WriteText(wxT("Next, we'll show a first-line indent, achieved using BeginLeftIndent(100, -40).")); r.WriteText("Next, we'll show a first-line indent, achieved using BeginLeftIndent(100, -40).");
r.Newline(); r.Newline();
r.BeginLeftIndent(100, -40); r.BeginLeftIndent(100, -40);
r.WriteText(wxT("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.")); r.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.");
r.Newline(); r.Newline();
r.EndLeftIndent(); r.EndLeftIndent();
r.WriteText(wxT("Numbered bullets are possible, again using subindents:")); r.WriteText("Numbered bullets are possible, again using subindents:");
r.Newline(); r.Newline();
r.BeginNumberedBullet(1, 100, 60); r.BeginNumberedBullet(1, 100, 60);
r.WriteText(wxT("This is my first item. Note that wxRichTextCtrl can apply numbering and bullets automatically based on list styles, but this list is formatted explicitly by setting indents.")); r.WriteText("This is my first item. Note that wxRichTextCtrl can apply numbering and bullets automatically based on list styles, but this list is formatted explicitly by setting indents.");
r.Newline(); r.Newline();
r.EndNumberedBullet(); r.EndNumberedBullet();
r.BeginNumberedBullet(2, 100, 60); r.BeginNumberedBullet(2, 100, 60);
r.WriteText(wxT("This is my second item.")); r.WriteText("This is my second item.");
r.Newline(); r.Newline();
r.EndNumberedBullet(); r.EndNumberedBullet();
r.WriteText(wxT("The following paragraph is right-indented:")); r.WriteText("The following paragraph is right-indented:");
r.Newline(); r.Newline();
r.BeginRightIndent(200); r.BeginRightIndent(200);
r.WriteText(wxT("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.")); r.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.");
r.Newline(); r.Newline();
r.EndRightIndent(); r.EndRightIndent();
r.WriteText(wxT("The following paragraph is right-aligned with 1.5 line spacing:")); r.WriteText("The following paragraph is right-aligned with 1.5 line spacing:");
r.Newline(); r.Newline();
r.BeginAlignment(wxTEXT_ALIGNMENT_RIGHT); r.BeginAlignment(wxTEXT_ALIGNMENT_RIGHT);
r.BeginLineSpacing(wxTEXT_ATTR_LINE_SPACING_HALF); r.BeginLineSpacing(wxTEXT_ATTR_LINE_SPACING_HALF);
r.WriteText(wxT("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.")); r.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. An attractive woman came into the cafe, which is nothing remarkable.");
r.Newline(); r.Newline();
r.EndLineSpacing(); r.EndLineSpacing();
r.EndAlignment(); r.EndAlignment();
@@ -1128,44 +1128,44 @@ void MyFrame::WriteInitialText()
attr.SetTabs(tabs); attr.SetTabs(tabs);
r.SetDefaultStyle(attr); r.SetDefaultStyle(attr);
r.WriteText(wxT("This line contains tabs:\tFirst tab\tSecond tab\tThird tab")); r.WriteText("This line contains tabs:\tFirst tab\tSecond tab\tThird tab");
r.Newline(); r.Newline();
r.WriteText(wxT("Other notable features of wxRichTextCtrl include:")); r.WriteText("Other notable features of wxRichTextCtrl include:");
r.Newline(); r.Newline();
r.BeginSymbolBullet(wxT('*'), 100, 60); r.BeginSymbolBullet('*', 100, 60);
r.WriteText(wxT("Compatibility with wxTextCtrl API")); r.WriteText("Compatibility with wxTextCtrl API");
r.Newline(); r.Newline();
r.EndSymbolBullet(); r.EndSymbolBullet();
r.BeginSymbolBullet(wxT('*'), 100, 60); r.BeginSymbolBullet('*', 100, 60);
r.WriteText(wxT("Easy stack-based BeginXXX()...EndXXX() style setting in addition to SetStyle()")); r.WriteText("Easy stack-based BeginXXX()...EndXXX() style setting in addition to SetStyle()");
r.Newline(); r.Newline();
r.EndSymbolBullet(); r.EndSymbolBullet();
r.BeginSymbolBullet(wxT('*'), 100, 60); r.BeginSymbolBullet('*', 100, 60);
r.WriteText(wxT("XML loading and saving")); r.WriteText("XML loading and saving");
r.Newline(); r.Newline();
r.EndSymbolBullet(); r.EndSymbolBullet();
r.BeginSymbolBullet(wxT('*'), 100, 60); r.BeginSymbolBullet('*', 100, 60);
r.WriteText(wxT("Undo/Redo, with batching option and Undo suppressing")); r.WriteText("Undo/Redo, with batching option and Undo suppressing");
r.Newline(); r.Newline();
r.EndSymbolBullet(); r.EndSymbolBullet();
r.BeginSymbolBullet(wxT('*'), 100, 60); r.BeginSymbolBullet('*', 100, 60);
r.WriteText(wxT("Clipboard copy and paste")); r.WriteText("Clipboard copy and paste");
r.Newline(); r.Newline();
r.EndSymbolBullet(); r.EndSymbolBullet();
r.BeginSymbolBullet(wxT('*'), 100, 60); r.BeginSymbolBullet('*', 100, 60);
r.WriteText(wxT("wxRichTextStyleSheet with named character and paragraph styles, and control for applying named styles")); r.WriteText("wxRichTextStyleSheet with named character and paragraph styles, and control for applying named styles");
r.Newline(); r.Newline();
r.EndSymbolBullet(); r.EndSymbolBullet();
r.BeginSymbolBullet(wxT('*'), 100, 60); r.BeginSymbolBullet('*', 100, 60);
r.WriteText(wxT("A design that can easily be extended to other content types, ultimately with text boxes, tables, controls, and so on")); r.WriteText("A design that can easily be extended to other content types, ultimately with text boxes, tables, controls, and so on");
r.Newline(); r.Newline();
r.EndSymbolBullet(); r.EndSymbolBullet();
@@ -1174,17 +1174,17 @@ void MyFrame::WriteInitialText()
urlStyle.SetTextColour(*wxBLUE); urlStyle.SetTextColour(*wxBLUE);
urlStyle.SetFontUnderlined(true); urlStyle.SetFontUnderlined(true);
r.WriteText(wxT("wxRichTextCtrl can also display URLs, such as this one: ")); r.WriteText("wxRichTextCtrl can also display URLs, such as this one: ");
r.BeginStyle(urlStyle); r.BeginStyle(urlStyle);
r.BeginURL(wxT("http://www.wxwidgets.org")); r.BeginURL("http://www.wxwidgets.org");
r.WriteText(wxT("The wxWidgets Web Site")); r.WriteText("The wxWidgets Web Site");
r.EndURL(); r.EndURL();
r.EndStyle(); r.EndStyle();
r.WriteText(wxT(". Click on the URL to generate an event.")); r.WriteText(". Click on the URL to generate an event.");
r.Newline(); r.Newline();
r.WriteText(wxT("Note: this sample content was generated programmatically from within the MyFrame constructor in the demo. The images were loaded from inline XPMs. Enjoy wxRichTextCtrl!\n")); r.WriteText("Note: this sample content was generated programmatically from within the MyFrame constructor in the demo. The images were loaded from inline XPMs. Enjoy wxRichTextCtrl!\n");
r.EndParagraphSpacing(); r.EndParagraphSpacing();
@@ -1207,7 +1207,7 @@ void MyFrame::WriteInitialText()
wxRichTextBox* textBox = r.WriteTextBox(attr); wxRichTextBox* textBox = r.WriteTextBox(attr);
r.SetFocusObject(textBox); r.SetFocusObject(textBox);
r.WriteText(wxT("This is a text box. Just testing! Once more unto the breach, dear friends, once more...")); r.WriteText("This is a text box. Just testing! Once more unto the breach, dear friends, once more...");
r.SetFocusObject(NULL); // Set the focus back to the main buffer r.SetFocusObject(NULL); // Set the focus back to the main buffer
r.SetInsertionPointEnd(); r.SetInsertionPointEnd();
@@ -1242,7 +1242,7 @@ void MyFrame::WriteInitialText()
{ {
for (i = 0; i < table->GetColumnCount(); i++) for (i = 0; i < table->GetColumnCount(); i++)
{ {
wxString msg = wxString::Format(wxT("This is cell %d, %d"), (j+1), (i+1)); wxString msg = wxString::Format("This is cell %d, %d", (j+1), (i+1));
r.SetFocusObject(table->GetCell(j, i)); r.SetFocusObject(table->GetCell(j, i));
r.WriteText(msg); r.WriteText(msg);
} }
@@ -1276,18 +1276,18 @@ void MyFrame::WriteInitialText()
r.Newline(); r.Newline(); r.Newline(); r.Newline();
wxRichTextProperties properties; wxRichTextProperties properties;
r.WriteText(wxT("This is a rectangle field: ")); r.WriteText("This is a rectangle field: ");
r.WriteField(wxT("rectangle"), properties); r.WriteField("rectangle", properties);
r.WriteText(wxT(" and a begin section field: ")); r.WriteText(" and a begin section field: ");
r.WriteField(wxT("begin-section"), properties); r.WriteField("begin-section", properties);
r.WriteText(wxT("This is text between the two tags.")); r.WriteText("This is text between the two tags.");
r.WriteField(wxT("end-section"), properties); r.WriteField("end-section", properties);
r.WriteText(wxT(" Now a bitmap. ")); r.WriteText(" Now a bitmap. ");
r.WriteField(wxT("bitmap"), properties); r.WriteField("bitmap", properties);
r.WriteText(wxT(" Before we go, here's a composite field: ***")); r.WriteText(" Before we go, here's a composite field: ***");
wxRichTextField* field = r.WriteField(wxT("composite"), properties); wxRichTextField* field = r.WriteField("composite", properties);
field->UpdateField(& r.GetBuffer()); // Creates the composite value (sort of a text box) field->UpdateField(& r.GetBuffer()); // Creates the composite value (sort of a text box)
r.WriteText(wxT("*** End of composite field.")); r.WriteText("*** End of composite field.");
r.Newline(); r.Newline();
r.EndSuppressUndo(); r.EndSuppressUndo();
@@ -1295,13 +1295,13 @@ void MyFrame::WriteInitialText()
// Add some locked content first - needs Undo to be enabled // Add some locked content first - needs Undo to be enabled
{ {
r.BeginLock(); r.BeginLock();
r.WriteText(wxString(wxT("This is a locked object."))); r.WriteText(wxString("This is a locked object."));
r.EndLock(); r.EndLock();
r.WriteText(wxString(wxT(" This is unlocked text. "))); r.WriteText(wxString(" This is unlocked text. "));
r.BeginLock(); r.BeginLock();
r.WriteText(wxString(wxT("More locked content."))); r.WriteText(wxString("More locked content."));
r.EndLock(); r.EndLock();
r.Newline(); r.Newline();
@@ -1323,8 +1323,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is a demo for wxRichTextCtrl, a control for editing styled text.\n(c) Julian Smart, 2005")); msg.Printf( "This is a demo for wxRichTextCtrl, a control for editing styled text.\n(c) Julian Smart, 2005");
wxMessageBox(msg, wxT("About wxRichTextCtrl Sample"), wxOK | wxICON_INFORMATION, this); wxMessageBox(msg, "About wxRichTextCtrl Sample", wxOK | wxICON_INFORMATION, this);
} }
// Forward command events to the current rich text control, if any // Forward command events to the current rich text control, if any
@@ -1374,8 +1374,8 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
wxString filter = wxRichTextBuffer::GetExtWildcard(false, false, & fileTypes); wxString filter = wxRichTextBuffer::GetExtWildcard(false, false, & fileTypes);
if (!filter.empty()) if (!filter.empty())
filter += wxT("|"); filter += "|";
filter += wxT("All files (*.*)|*.*"); filter += "All files (*.*)|*.*";
wxFileDialog dialog(this, wxFileDialog dialog(this,
_("Choose a filename"), _("Choose a filename"),
@@ -1434,8 +1434,8 @@ void MyFrame::OnSaveAs(wxCommandEvent& WXUNUSED(event))
m_richTextCtrl->SaveFile(path); m_richTextCtrl->SaveFile(path);
long t = stopwatch.Time(); long t = stopwatch.Time();
wxLogDebug(wxT("Saving took %ldms"), t); wxLogDebug("Saving took %ldms", t);
wxMessageBox(wxString::Format(wxT("Saving took %ldms"), t)); wxMessageBox(wxString::Format("Saving took %ldms", t));
} }
} }
} }
@@ -1780,7 +1780,7 @@ void MyFrame::OnViewHTML(wxCommandEvent& WXUNUSED(event))
wxHtmlWindow* win = new wxHtmlWindow(& dialog, wxID_ANY, wxDefaultPosition, wxSize(500, 400), wxSUNKEN_BORDER); wxHtmlWindow* win = new wxHtmlWindow(& dialog, wxID_ANY, wxDefaultPosition, wxSize(500, 400), wxSUNKEN_BORDER);
boxSizer->Add(win, 1, wxALL, 5); boxSizer->Add(win, 1, wxALL, 5);
wxButton* cancelButton = new wxButton(& dialog, wxID_CANCEL, wxT("&Close")); wxButton* cancelButton = new wxButton(& dialog, wxID_CANCEL, "&Close");
boxSizer->Add(cancelButton, 0, wxALL|wxCENTRE, 5); boxSizer->Add(cancelButton, 0, wxALL|wxCENTRE, 5);
wxString text; wxString text;
@@ -1891,7 +1891,7 @@ void MyFrame::OnInsertSymbol(wxCommandEvent& WXUNUSED(event))
// 'normal text', i.e. the current font) but do tell the dialog // 'normal text', i.e. the current font) but do tell the dialog
// what 'normal text' is. // what 'normal text' is.
wxSymbolPickerDialog dlg(wxT("*"), wxEmptyString, currentFontName, this); wxSymbolPickerDialog dlg("*", wxEmptyString, currentFontName, this);
if (dlg.ShowModal() == wxID_OK) if (dlg.ShowModal() == wxID_OK)
{ {
@@ -1917,7 +1917,7 @@ void MyFrame::OnNumberList(wxCommandEvent& WXUNUSED(event))
if (m_richTextCtrl->HasSelection()) if (m_richTextCtrl->HasSelection())
{ {
wxRichTextRange range = m_richTextCtrl->GetSelectionRange(); wxRichTextRange range = m_richTextCtrl->GetSelectionRange();
m_richTextCtrl->SetListStyle(range, wxT("Numbered List 1"), wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER); m_richTextCtrl->SetListStyle(range, "Numbered List 1", wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER);
} }
} }
@@ -1940,7 +1940,7 @@ void MyFrame::OnItemizeList(wxCommandEvent& WXUNUSED(event))
if (m_richTextCtrl->HasSelection()) if (m_richTextCtrl->HasSelection())
{ {
wxRichTextRange range = m_richTextCtrl->GetSelectionRange(); wxRichTextRange range = m_richTextCtrl->GetSelectionRange();
m_richTextCtrl->SetListStyle(range, wxT("Bullet List 1")); m_richTextCtrl->SetListStyle(range, "Bullet List 1");
} }
} }
@@ -2110,19 +2110,19 @@ void MyFrame::OnPreview(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
{ {
wxDialog dialog(this, wxID_ANY, wxT("Testing"), wxPoint(10, 10), wxSize(400, 300), wxDEFAULT_DIALOG_STYLE); wxDialog dialog(this, wxID_ANY, "Testing", wxPoint(10, 10), wxSize(400, 300), wxDEFAULT_DIALOG_STYLE);
wxNotebook* nb = new wxNotebook(& dialog, wxID_ANY, wxPoint(5, 5), wxSize(300, 250)); wxNotebook* nb = new wxNotebook(& dialog, wxID_ANY, wxPoint(5, 5), wxSize(300, 250));
wxPanel* panel = new wxPanel(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize); wxPanel* panel = new wxPanel(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize);
wxPanel* panel2 = new wxPanel(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize); wxPanel* panel2 = new wxPanel(nb, wxID_ANY, wxDefaultPosition, wxDefaultSize);
new wxRichTextCtrl(panel, wxID_ANY, wxEmptyString, wxPoint(5, 5), wxSize(200, 150), wxVSCROLL|wxTE_READONLY); new wxRichTextCtrl(panel, wxID_ANY, wxEmptyString, wxPoint(5, 5), wxSize(200, 150), wxVSCROLL|wxTE_READONLY);
nb->AddPage(panel, wxT("Page 1")); nb->AddPage(panel, "Page 1");
new wxRichTextCtrl(panel2, wxID_ANY, wxEmptyString, wxPoint(5, 5), wxSize(200, 150), wxVSCROLL|wxTE_READONLY); new wxRichTextCtrl(panel2, wxID_ANY, wxEmptyString, wxPoint(5, 5), wxSize(200, 150), wxVSCROLL|wxTE_READONLY);
nb->AddPage(panel2, wxT("Page 2")); nb->AddPage(panel2, "Page 2");
new wxButton(& dialog, wxID_OK, wxT("OK"), wxPoint(5, 180)); new wxButton(& dialog, wxID_OK, "OK", wxPoint(5, 180));
dialog.ShowModal(); dialog.ShowModal();
@@ -2131,24 +2131,24 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnSetFontScale(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSetFontScale(wxCommandEvent& WXUNUSED(event))
{ {
wxString value = wxString::Format(wxT("%g"), m_richTextCtrl->GetFontScale()); wxString value = wxString::Format("%g", m_richTextCtrl->GetFontScale());
wxString text = wxGetTextFromUser(wxT("Enter a text scale factor:"), wxT("Text Scale Factor"), value, wxGetTopLevelParent(this)); wxString text = wxGetTextFromUser("Enter a text scale factor:", "Text Scale Factor", value, wxGetTopLevelParent(this));
if (!text.IsEmpty() && value != text) if (!text.IsEmpty() && value != text)
{ {
double scale = 1.0; double scale = 1.0;
wxSscanf(text, wxT("%lf"), & scale); wxSscanf(text, "%lf", & scale);
m_richTextCtrl->SetFontScale(scale, true); m_richTextCtrl->SetFontScale(scale, true);
} }
} }
void MyFrame::OnSetDimensionScale(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSetDimensionScale(wxCommandEvent& WXUNUSED(event))
{ {
wxString value = wxString::Format(wxT("%g"), m_richTextCtrl->GetDimensionScale()); wxString value = wxString::Format("%g", m_richTextCtrl->GetDimensionScale());
wxString text = wxGetTextFromUser(wxT("Enter a dimension scale factor:"), wxT("Dimension Scale Factor"), value, wxGetTopLevelParent(this)); wxString text = wxGetTextFromUser("Enter a dimension scale factor:", "Dimension Scale Factor", value, wxGetTopLevelParent(this));
if (!text.IsEmpty() && value != text) if (!text.IsEmpty() && value != text)
{ {
double scale = 1.0; double scale = 1.0;
wxSscanf(text, wxT("%lf"), & scale); wxSscanf(text, "%lf", & scale);
m_richTextCtrl->SetDimensionScale(scale, true); m_richTextCtrl->SetDimensionScale(scale, true);
} }
} }
@@ -2168,7 +2168,7 @@ void MyRichTextCtrl::PrepareContent(wxRichTextParagraphLayoutBox& container)
while (childNode) while (childNode)
{ {
wxRichTextObject* obj = childNode->GetData(); wxRichTextObject* obj = childNode->GetData();
obj->GetProperties().SetProperty(wxT("Lock"), m_lockId); obj->GetProperties().SetProperty("Lock", m_lockId);
childNode = childNode->GetNext(); childNode = childNode->GetNext();
} }
@@ -2184,7 +2184,7 @@ bool MyRichTextCtrl::CanDeleteRange(wxRichTextParagraphLayoutBox& container, con
for (i = range.GetStart(); i < range.GetEnd(); i++) for (i = range.GetStart(); i < range.GetEnd(); i++)
{ {
wxRichTextObject* obj = container.GetLeafObjectAtPosition(i); wxRichTextObject* obj = container.GetLeafObjectAtPosition(i);
if (obj && obj->GetProperties().HasProperty(wxT("Lock"))) if (obj && obj->GetProperties().HasProperty("Lock"))
{ {
return false; return false;
} }
@@ -2199,10 +2199,10 @@ bool MyRichTextCtrl::CanInsertContent(wxRichTextParagraphLayoutBox& container, l
long lock1 = -1, lock2 = -1; long lock1 = -1, lock2 = -1;
if (child1 && child1->GetProperties().HasProperty(wxT("Lock"))) if (child1 && child1->GetProperties().HasProperty("Lock"))
lock1 = child1->GetProperties().GetPropertyLong(wxT("Lock")); lock1 = child1->GetProperties().GetPropertyLong("Lock");
if (child2 && child2->GetProperties().HasProperty(wxT("Lock"))) if (child2 && child2->GetProperties().HasProperty("Lock"))
lock2 = child2->GetProperties().GetPropertyLong(wxT("Lock")); lock2 = child2->GetProperties().GetPropertyLong("Lock");
if (lock1 != -1 && lock1 == lock2) if (lock1 != -1 && lock1 == lock2)
return false; return false;
@@ -2220,7 +2220,7 @@ class wxRichTextEnhancedDrawingHandler: public wxRichTextDrawingHandler
public: public:
wxRichTextEnhancedDrawingHandler() wxRichTextEnhancedDrawingHandler()
{ {
SetName(wxT("enhanceddrawing")); SetName("enhanceddrawing");
m_lockBackgroundColour = wxColour(220, 220, 220); m_lockBackgroundColour = wxColour(220, 220, 220);
} }
@@ -2264,12 +2264,12 @@ public:
bool wxRichTextEnhancedDrawingHandler::HasVirtualAttributes(wxRichTextObject* obj) const bool wxRichTextEnhancedDrawingHandler::HasVirtualAttributes(wxRichTextObject* obj) const
{ {
return obj->GetProperties().HasProperty(wxT("Lock")); return obj->GetProperties().HasProperty("Lock");
} }
bool wxRichTextEnhancedDrawingHandler::GetVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const bool wxRichTextEnhancedDrawingHandler::GetVirtualAttributes(wxRichTextAttr& attr, wxRichTextObject* obj) const
{ {
if (obj->GetProperties().HasProperty(wxT("Lock"))) if (obj->GetProperties().HasProperty("Lock"))
{ {
attr.SetBackgroundColour(m_lockBackgroundColour); attr.SetBackgroundColour(m_lockBackgroundColour);
return true; return true;

View File

@@ -44,30 +44,30 @@ bool MyApp::OnInit(void)
// Create the main frame window // Create the main frame window
frame = new MyFrame(NULL, wxID_ANY, wxT("Sash Demo"), wxPoint(0, 0), wxSize(500, 400), frame = new MyFrame(NULL, wxID_ANY, "Sash Demo", wxPoint(0, 0), wxSize(500, 400),
wxDEFAULT_FRAME_STYLE | wxDEFAULT_FRAME_STYLE |
wxNO_FULL_REPAINT_ON_RESIZE | wxNO_FULL_REPAINT_ON_RESIZE |
wxHSCROLL | wxVSCROLL); wxHSCROLL | wxVSCROLL);
// Give it an icon (this is ignored in MDI mode: uses resources) // Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__ #ifdef __WXMSW__
frame->SetIcon(wxIcon(wxT("sashtest_icn"))); frame->SetIcon(wxIcon("sashtest_icn"));
#endif #endif
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(SASHTEST_NEW_WINDOW, wxT("&New window")); file_menu->Append(SASHTEST_NEW_WINDOW, "&New window");
file_menu->Append(SASHTEST_TOGGLE_WINDOW, wxT("&Toggle window")); file_menu->Append(SASHTEST_TOGGLE_WINDOW, "&Toggle window");
file_menu->Append(SASHTEST_QUIT, wxT("&Exit")); file_menu->Append(SASHTEST_QUIT, "&Exit");
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append(SASHTEST_ABOUT, wxT("&About")); help_menu->Append(SASHTEST_ABOUT, "&About");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
menu_bar->Append(help_menu, wxT("&Help")); menu_bar->Append(help_menu, "&Help");
// Associate the menu bar with the frame // Associate the menu bar with the frame
frame->SetMenuBar(menu_bar); frame->SetMenuBar(menu_bar);
@@ -138,7 +138,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c
wxTextCtrl* textWindow = new wxTextCtrl(win, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTextCtrl* textWindow = new wxTextCtrl(win, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE|wxSUNKEN_BORDER); wxTE_MULTILINE|wxSUNKEN_BORDER);
// wxTE_MULTILINE|wxNO_BORDER); // wxTE_MULTILINE|wxNO_BORDER);
textWindow->SetValue(wxT("A help window")); textWindow->SetValue("A help window");
m_leftWindow1 = win; m_leftWindow1 = win;
@@ -162,7 +162,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
(void)wxMessageBox(wxT("wxWidgets 2.0 Sash Demo\nAuthor: Julian Smart (c) 1998"), wxT("About Sash Demo")); (void)wxMessageBox("wxWidgets 2.0 Sash Demo\nAuthor: Julian Smart (c) 1998", "About Sash Demo");
} }
void MyFrame::OnToggleWindow(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnToggleWindow(wxCommandEvent& WXUNUSED(event))
@@ -222,17 +222,17 @@ void MyFrame::OnSashDrag(wxSashEvent& event)
void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event))
{ {
// Make another frame, containing a canvas // Make another frame, containing a canvas
MyChild *subframe = new MyChild(frame, wxT("Canvas Frame"), MyChild *subframe = new MyChild(frame, "Canvas Frame",
wxPoint(10, 10), wxSize(300, 300), wxPoint(10, 10), wxSize(300, 300),
wxDEFAULT_FRAME_STYLE | wxDEFAULT_FRAME_STYLE |
wxNO_FULL_REPAINT_ON_RESIZE); wxNO_FULL_REPAINT_ON_RESIZE);
subframe->SetTitle(wxString::Format(wxT("Canvas Frame %d"), winNumber)); subframe->SetTitle(wxString::Format("Canvas Frame %d", winNumber));
winNumber ++; winNumber ++;
// Give it an icon (this is ignored in MDI mode: uses resources) // Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__ #ifdef __WXMSW__
subframe->SetIcon(wxIcon(wxT("sashtest_icn"))); subframe->SetIcon(wxIcon("sashtest_icn"));
#endif #endif
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
@@ -243,23 +243,23 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event))
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append(SASHTEST_NEW_WINDOW, wxT("&New window")); file_menu->Append(SASHTEST_NEW_WINDOW, "&New window");
file_menu->Append(SASHTEST_CHILD_QUIT, wxT("&Close child")); file_menu->Append(SASHTEST_CHILD_QUIT, "&Close child");
file_menu->Append(SASHTEST_QUIT, wxT("&Exit")); file_menu->Append(SASHTEST_QUIT, "&Exit");
wxMenu *option_menu = new wxMenu; wxMenu *option_menu = new wxMenu;
// Dummy option // Dummy option
option_menu->Append(SASHTEST_REFRESH, wxT("&Refresh picture")); option_menu->Append(SASHTEST_REFRESH, "&Refresh picture");
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append(SASHTEST_ABOUT, wxT("&About")); help_menu->Append(SASHTEST_ABOUT, "&About");
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
menu_bar->Append(option_menu, wxT("&Options")); menu_bar->Append(option_menu, "&Options");
menu_bar->Append(help_menu, wxT("&Help")); menu_bar->Append(help_menu, "&Help");
// Associate the menu bar with the frame // Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar); subframe->SetMenuBar(menu_bar);
@@ -306,7 +306,7 @@ void MyCanvas::OnDraw(wxDC& dc)
dc.DrawSpline(50, 200, 50, 100, 200, 10); dc.DrawSpline(50, 200, 50, 100, 200, 10);
#endif // wxUSE_SPLINES #endif // wxUSE_SPLINES
dc.DrawLine(50, 230, 200, 230); dc.DrawLine(50, 230, 200, 230);
dc.DrawText(wxT("This is a test string"), 50, 230); dc.DrawText("This is a test string", 50, 230);
wxPoint points[3]; wxPoint points[3];
points[0].x = 200; points[0].y = 300; points[0].x = 200; points[0].y = 300;

View File

@@ -387,9 +387,9 @@ ShapedFrame::ShapedFrame(wxFrame *parent)
) )
{ {
m_shapeKind = Shape_Star; m_shapeKind = Shape_Star;
m_bmp = wxBitmap(wxT("star.png"), wxBITMAP_TYPE_PNG); m_bmp = wxBitmap("star.png", wxBITMAP_TYPE_PNG);
SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight())); SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()));
SetToolTip(wxT("Right-click to close, double click to cycle shape")); SetToolTip("Right-click to close, double click to cycle shape");
SetWindowShape(); SetWindowShape();
} }

View File

@@ -173,20 +173,20 @@ WX_DEFINE_LIST(EList);
wxString wxString
CreateIdent(const wxIPV4address& addr) CreateIdent(const wxIPV4address& addr)
{ {
return wxString::Format(wxT("%s:%d"),addr.IPAddress().c_str(),addr.Service()); return wxString::Format("%s:%d",addr.IPAddress().c_str(),addr.Service());
} }
void void
Client::OnInitCmdLine(wxCmdLineParser& pParser) Client::OnInitCmdLine(wxCmdLineParser& pParser)
{ {
wxApp::OnInitCmdLine(pParser); wxApp::OnInitCmdLine(pParser);
pParser.AddSwitch(wxT("e"),wxT("event"),_("Use event based worker (default)"),wxCMD_LINE_PARAM_OPTIONAL); pParser.AddSwitch("e","event",_("Use event based worker (default)"),wxCMD_LINE_PARAM_OPTIONAL);
pParser.AddSwitch(wxT("t"),wxT("thread"),_("Use thread based worker"),wxCMD_LINE_PARAM_OPTIONAL); pParser.AddSwitch("t","thread",_("Use thread based worker"),wxCMD_LINE_PARAM_OPTIONAL);
pParser.AddSwitch(wxT("r"),wxT("random"),_("Send random data (default)"),wxCMD_LINE_PARAM_OPTIONAL); pParser.AddSwitch("r","random",_("Send random data (default)"),wxCMD_LINE_PARAM_OPTIONAL);
pParser.AddOption(wxT("m"),wxT("message"),_("Send message from <str>"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL); pParser.AddOption("m","message",_("Send message from <str>"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL);
pParser.AddOption(wxT("f"),wxT("file"),_("Send contents of <file>"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL); pParser.AddOption("f","file",_("Send contents of <file>"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL);
pParser.AddOption(wxT("H"),wxT("hostname"),_("IP or name of host to connect to"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL); pParser.AddOption("H","hostname",_("IP or name of host to connect to"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL);
pParser.AddOption(wxT("s"),wxT("stress"),_("stress test with <num> concurrent connections"),wxCMD_LINE_VAL_NUMBER,wxCMD_LINE_PARAM_OPTIONAL); pParser.AddOption("s","stress",_("stress test with <num> concurrent connections"),wxCMD_LINE_VAL_NUMBER,wxCMD_LINE_PARAM_OPTIONAL);
} }
@@ -199,38 +199,38 @@ Client::OnCmdLineParsed(wxCmdLineParser& pParser)
if (pParser.Found(_("verbose"))) if (pParser.Found(_("verbose")))
{ {
wxLog::AddTraceMask(wxT("wxSocket")); wxLog::AddTraceMask("wxSocket");
wxLog::AddTraceMask(wxT("epolldispatcher")); wxLog::AddTraceMask("epolldispatcher");
wxLog::AddTraceMask(wxT("selectdispatcher")); wxLog::AddTraceMask("selectdispatcher");
wxLog::AddTraceMask(wxT("thread")); wxLog::AddTraceMask("thread");
wxLog::AddTraceMask(wxT("events")); wxLog::AddTraceMask("events");
} }
if (pParser.Found(wxT("t"))) if (pParser.Found("t"))
m_workMode = THREADS; m_workMode = THREADS;
m_sendType = SEND_RANDOM; m_sendType = SEND_RANDOM;
if (pParser.Found(wxT("m"),&m_message)) if (pParser.Found("m",&m_message))
m_sendType = SEND_MESSAGE; m_sendType = SEND_MESSAGE;
else if (pParser.Found(wxT("f"),&fname)) else if (pParser.Found("f",&fname))
{ {
wxFFile file(fname); wxFFile file(fname);
if (!file.IsOpened()) { if (!file.IsOpened()) {
wxLogError(wxT("Cannot open file %s"),fname.c_str()); wxLogError("Cannot open file %s",fname.c_str());
return false; return false;
}; };
if (!file.ReadAll(&m_message)) { if (!file.ReadAll(&m_message)) {
wxLogError(wxT("Cannot read content of file %s"),fname.c_str()); wxLogError("Cannot read content of file %s",fname.c_str());
return false; return false;
}; };
m_sendType = SEND_MESSAGE; m_sendType = SEND_MESSAGE;
}; };
if (pParser.Found(wxT("s"),&m_stressWorkers)) if (pParser.Found("s",&m_stressWorkers))
m_sendType = STRESS_TEST; m_sendType = STRESS_TEST;
m_host = wxT("127.0.0.1"); m_host = "127.0.0.1";
pParser.Found(wxT("H"),&m_host); pParser.Found("H",&m_host);
return wxApp::OnCmdLineParsed(pParser); return wxApp::OnCmdLineParsed(pParser);
}; };
@@ -352,7 +352,7 @@ Client::StartWorker(workMode pMode) {
if (pMode == THREADS) { if (pMode == THREADS) {
ThreadWorker* c = new ThreadWorker(m_host,buf,msgsize+2); ThreadWorker* c = new ThreadWorker(m_host,buf,msgsize+2);
if (c->Create() != wxTHREAD_NO_ERROR) { if (c->Create() != wxTHREAD_NO_ERROR) {
wxLogError(wxT("Cannot create more threads")); wxLogError("Cannot create more threads");
} else { } else {
c->Run(); c->Run();
m_threadWorkers.Append(c); m_threadWorkers.Append(c);
@@ -377,7 +377,7 @@ Client::StartWorker(workMode pMode, const wxString& pMessage) {
if (pMode == THREADS) { if (pMode == THREADS) {
ThreadWorker* c = new ThreadWorker(m_host,buf,msgsize+2); ThreadWorker* c = new ThreadWorker(m_host,buf,msgsize+2);
if (c->Create() != wxTHREAD_NO_ERROR) { if (c->Create() != wxTHREAD_NO_ERROR) {
wxLogError(wxT("Cannot create more threads")); wxLogError("Cannot create more threads");
} else { } else {
c->Run(); c->Run();
m_threadWorkers.Append(c); m_threadWorkers.Append(c);
@@ -476,7 +476,7 @@ void
Client::RemoveEventWorker(EventWorker* p_worker) { Client::RemoveEventWorker(EventWorker* p_worker) {
for(EList::compatibility_iterator it = m_eventWorkers.GetFirst(); it ; it = it->GetNext()) { for(EList::compatibility_iterator it = m_eventWorkers.GetFirst(); it ; it = it->GetNext()) {
if (it->GetData() == p_worker) { if (it->GetData() == p_worker) {
//wxLogDebug(wxT("Deleting event worker")); //wxLogDebug("Deleting event worker");
delete it->GetData(); delete it->GetData();
m_eventWorkers.DeleteNode(it); m_eventWorkers.DeleteNode(it);
return; return;
@@ -496,7 +496,7 @@ Client::dumpStatistics() {
m_statFailed m_statFailed
)); ));
wxLogMessage(wxT("Current status:\n%s\n"),msg.c_str()); wxLogMessage("Current status:\n%s\n",msg.c_str());
} }
void void
@@ -533,7 +533,7 @@ EventWorker::Run() {
m_clientSocket->Notify(true); m_clientSocket->Notify(true);
m_currentType = WorkerEvent::CONNECTING; m_currentType = WorkerEvent::CONNECTING;
m_doneSent = false; m_doneSent = false;
//wxLogMessage(wxT("EventWorker: Connecting.....")); //wxLogMessage("EventWorker: Connecting.....");
m_clientSocket->Connect(ca,false); m_clientSocket->Connect(ca,false);
} }
@@ -541,7 +541,7 @@ void
EventWorker::OnSocketEvent(wxSocketEvent& pEvent) { EventWorker::OnSocketEvent(wxSocketEvent& pEvent) {
switch(pEvent.GetSocketEvent()) { switch(pEvent.GetSocketEvent()) {
case wxSOCKET_INPUT: case wxSOCKET_INPUT:
//wxLogDebug(wxT("EventWorker: INPUT")); //wxLogDebug("EventWorker: INPUT");
do { do {
if (m_readed == m_insize) if (m_readed == m_insize)
return; //event already posted return; //event already posted
@@ -550,74 +550,74 @@ EventWorker::OnSocketEvent(wxSocketEvent& pEvent) {
{ {
if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK) if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK)
{ {
wxLogError(wxT("%s: read error"),CreateIdent(m_localaddr).c_str()); wxLogError("%s: read error",CreateIdent(m_localaddr).c_str());
SendEvent(true); SendEvent(true);
} }
} }
m_readed += m_clientSocket->LastCount(); m_readed += m_clientSocket->LastCount();
//wxLogDebug(wxT("EventWorker: readed %d bytes, %d bytes to do"),m_clientSocket->LastCount(), m_insize - m_readed); //wxLogDebug("EventWorker: readed %d bytes, %d bytes to do",m_clientSocket->LastCount(), m_insize - m_readed);
if (m_readed == m_insize) if (m_readed == m_insize)
{ {
if (!memcmp(m_inbuf,m_outbuf,m_insize)) { if (!memcmp(m_inbuf,m_outbuf,m_insize)) {
wxLogError(wxT("%s: data mismatch"),CreateIdent(m_localaddr).c_str()); wxLogError("%s: data mismatch",CreateIdent(m_localaddr).c_str());
SendEvent(true); SendEvent(true);
} }
m_currentType = WorkerEvent::DISCONNECTING; m_currentType = WorkerEvent::DISCONNECTING;
wxLogDebug(wxT("%s: DISCONNECTING"),CreateIdent(m_localaddr).c_str()); wxLogDebug("%s: DISCONNECTING",CreateIdent(m_localaddr).c_str());
SendEvent(false); SendEvent(false);
//wxLogDebug(wxT("EventWorker %p closing"),this); //wxLogDebug("EventWorker %p closing",this);
m_clientSocket->Close(); m_clientSocket->Close();
m_currentType = WorkerEvent::DONE; m_currentType = WorkerEvent::DONE;
wxLogDebug(wxT("%s: DONE"),CreateIdent(m_localaddr).c_str()); wxLogDebug("%s: DONE",CreateIdent(m_localaddr).c_str());
SendEvent(false); SendEvent(false);
} }
} while (!m_clientSocket->Error()); } while (!m_clientSocket->Error());
break; break;
case wxSOCKET_OUTPUT: case wxSOCKET_OUTPUT:
//wxLogDebug(wxT("EventWorker: OUTPUT")); //wxLogDebug("EventWorker: OUTPUT");
do { do {
if (m_written == m_outsize) if (m_written == m_outsize)
return; return;
if (m_written == 0) if (m_written == 0)
{ {
m_currentType = WorkerEvent::SENDING; m_currentType = WorkerEvent::SENDING;
wxLogDebug(wxT("%s: SENDING"),CreateIdent(m_localaddr).c_str()); wxLogDebug("%s: SENDING",CreateIdent(m_localaddr).c_str());
} }
m_clientSocket->Write(m_outbuf + m_written, m_outsize - m_written); m_clientSocket->Write(m_outbuf + m_written, m_outsize - m_written);
if (m_clientSocket->Error()) if (m_clientSocket->Error())
{ {
if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK) { if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK) {
wxLogError(wxT("%s: Write error"),CreateIdent(m_localaddr).c_str()); wxLogError("%s: Write error",CreateIdent(m_localaddr).c_str());
SendEvent(true); SendEvent(true);
} }
} }
m_written += m_clientSocket->LastCount(); m_written += m_clientSocket->LastCount();
if (m_written != m_outsize) if (m_written != m_outsize)
{ {
//wxLogDebug(wxT("EventWorker: written %d bytes, %d bytes to do"),m_clientSocket->LastCount(),m_outsize - m_written); //wxLogDebug("EventWorker: written %d bytes, %d bytes to do",m_clientSocket->LastCount(),m_outsize - m_written);
} }
else else
{ {
//wxLogDebug(wxT("EventWorker %p SENDING->RECEIVING"),this); //wxLogDebug("EventWorker %p SENDING->RECEIVING",this);
m_currentType = WorkerEvent::RECEIVING; m_currentType = WorkerEvent::RECEIVING;
wxLogDebug(wxT("%s: RECEIVING"),CreateIdent(m_localaddr).c_str()); wxLogDebug("%s: RECEIVING",CreateIdent(m_localaddr).c_str());
SendEvent(false); SendEvent(false);
} }
} while(!m_clientSocket->Error()); } while(!m_clientSocket->Error());
break; break;
case wxSOCKET_CONNECTION: case wxSOCKET_CONNECTION:
{ {
//wxLogMessage(wxT("EventWorker: got connection")); //wxLogMessage("EventWorker: got connection");
wxLogMessage(wxT("%s: starting writing message (2 bytes for signature and %d bytes of data to write)"),CreateIdent(m_localaddr).c_str(),m_outsize-2); wxLogMessage("%s: starting writing message (2 bytes for signature and %d bytes of data to write)",CreateIdent(m_localaddr).c_str(),m_outsize-2);
if (!m_clientSocket->GetLocal(m_localaddr)) if (!m_clientSocket->GetLocal(m_localaddr))
{ {
wxLogError(_("Cannot get peer data for socket %p"),m_clientSocket); wxLogError(_("Cannot get peer data for socket %p"),m_clientSocket);
} }
m_currentType = WorkerEvent::SENDING; m_currentType = WorkerEvent::SENDING;
wxLogDebug(wxT("%s: CONNECTING"),CreateIdent(m_localaddr).c_str()); wxLogDebug("%s: CONNECTING",CreateIdent(m_localaddr).c_str());
SendEvent(false); SendEvent(false);
} }
break; break;
@@ -667,15 +667,15 @@ wxThread::ExitCode ThreadWorker::Entry()
wxIPV4address ca; wxIPV4address ca;
ca.Hostname(m_host); ca.Hostname(m_host);
ca.Service(5678); ca.Service(5678);
//wxLogDebug(wxT("ThreadWorker: Connecting.....")); //wxLogDebug("ThreadWorker: Connecting.....");
m_clientSocket->SetTimeout(60); m_clientSocket->SetTimeout(60);
bool failed = false; bool failed = false;
WorkerEvent::evt_type etype = WorkerEvent::CONNECTING; WorkerEvent::evt_type etype = WorkerEvent::CONNECTING;
if (!m_clientSocket->Connect(ca)) { if (!m_clientSocket->Connect(ca)) {
wxLogError(wxT("Cannot connect to %s:%d"),ca.IPAddress().c_str(), ca.Service()); wxLogError("Cannot connect to %s:%d",ca.IPAddress().c_str(), ca.Service());
failed = true; failed = true;
} else { } else {
//wxLogMessage(wxT("ThreadWorker: Connected. Sending %d bytes of data"),m_outsize); //wxLogMessage("ThreadWorker: Connected. Sending %d bytes of data",m_outsize);
etype = WorkerEvent::SENDING; etype = WorkerEvent::SENDING;
WorkerEvent e(this,etype); WorkerEvent e(this,etype);
wxGetApp().AddPendingEvent(e); wxGetApp().AddPendingEvent(e);
@@ -683,11 +683,11 @@ wxThread::ExitCode ThreadWorker::Entry()
do { do {
m_clientSocket->Write(m_outbuf,m_outsize); m_clientSocket->Write(m_outbuf,m_outsize);
if (m_clientSocket->Error()) { if (m_clientSocket->Error()) {
wxLogError(wxT("ThreadWorker: Write error")); wxLogError("ThreadWorker: Write error");
failed = true; failed = true;
} }
to_process -= m_clientSocket->LastCount(); to_process -= m_clientSocket->LastCount();
//wxLogDebug(wxT("EventWorker: written %d bytes, %d bytes to do"),m_clientSocket->LastCount(),to_process); //wxLogDebug("EventWorker: written %d bytes, %d bytes to do",m_clientSocket->LastCount(),to_process);
} while(!m_clientSocket->Error() && to_process != 0); } while(!m_clientSocket->Error() && to_process != 0);
if (!failed) { if (!failed) {
@@ -698,23 +698,23 @@ wxThread::ExitCode ThreadWorker::Entry()
do { do {
m_clientSocket->Read(m_inbuf,m_insize); m_clientSocket->Read(m_inbuf,m_insize);
if (m_clientSocket->Error()) { if (m_clientSocket->Error()) {
wxLogError(wxT("ThreadWorker: Read error")); wxLogError("ThreadWorker: Read error");
failed = true; failed = true;
break; break;
} }
to_process -= m_clientSocket->LastCount(); to_process -= m_clientSocket->LastCount();
//wxLogDebug(wxT("EventWorker: readed %d bytes, %d bytes to do"),m_clientSocket->LastCount(),to_process); //wxLogDebug("EventWorker: readed %d bytes, %d bytes to do",m_clientSocket->LastCount(),to_process);
} while(!m_clientSocket->Error() && to_process != 0); } while(!m_clientSocket->Error() && to_process != 0);
} }
char* outdat = (char*)m_outbuf+2; char* outdat = (char*)m_outbuf+2;
if (!failed && (memcmp(m_inbuf,outdat,m_insize) != 0)) if (!failed && (memcmp(m_inbuf,outdat,m_insize) != 0))
{ {
wxLogError(wxT("Data mismatch")); wxLogError("Data mismatch");
failed = true; failed = true;
} }
} }
//wxLogDebug(wxT("ThreadWorker: Finished")); //wxLogDebug("ThreadWorker: Finished");
if (!failed) { if (!failed) {
etype = WorkerEvent::DISCONNECTING; etype = WorkerEvent::DISCONNECTING;
WorkerEvent e(this,etype); WorkerEvent e(this,etype);

View File

@@ -39,7 +39,7 @@
#include "../sample.xpm" #include "../sample.xpm"
#endif #endif
#define WAV_FILE wxT("doggrowl.wav") #define WAV_FILE "doggrowl.wav"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private classes // private classes
@@ -166,7 +166,7 @@ bool MyApp::OnInit()
return false; return false;
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(wxT("wxWidgets Sound Sample")); MyFrame *frame = new MyFrame("wxWidgets Sound Sample");
// and show it (the frames, unlike simple controls, are not shown when // and show it (the frames, unlike simple controls, are not shown when
// created initially) // created initially)
@@ -194,32 +194,32 @@ MyFrame::MyFrame(const wxString& title)
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(Sound_SelectFile, wxT("Select WAV &file...\tCtrl-O"), wxT("Select a new wav file to play")); menuFile->Append(Sound_SelectFile, "Select WAV &file...\tCtrl-O", "Select a new wav file to play");
#ifdef __WXMSW__ #ifdef __WXMSW__
menuFile->Append(Sound_SelectResource, wxT("Select WAV &resource...\tCtrl-R"), wxT("Select a new resource to play")); menuFile->Append(Sound_SelectResource, "Select WAV &resource...\tCtrl-R", "Select a new resource to play");
menuFile->Append(Sound_SelectMemory, wxT("Select WAV &data\tCtrl-M"), wxT("Choose to play from memory buffer")); menuFile->Append(Sound_SelectMemory, "Select WAV &data\tCtrl-M", "Choose to play from memory buffer");
#endif // __WXMSW__ #endif // __WXMSW__
menuFile->Append(Sound_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(Sound_Quit, "E&xit\tAlt-X", "Quit this program");
wxMenu *playMenu = new wxMenu; wxMenu *playMenu = new wxMenu;
playMenu->Append(Sound_PlaySync, wxT("Play sound &synchronously\tCtrl-S")); playMenu->Append(Sound_PlaySync, "Play sound &synchronously\tCtrl-S");
playMenu->Append(Sound_PlayAsync, wxT("Play sound &asynchronously\tCtrl-A")); playMenu->Append(Sound_PlayAsync, "Play sound &asynchronously\tCtrl-A");
playMenu->Append(Sound_PlayAsyncOnStack, wxT("Play sound asynchronously (&object on stack)\tCtrl-K")); playMenu->Append(Sound_PlayAsyncOnStack, "Play sound asynchronously (&object on stack)\tCtrl-K");
playMenu->Append(Sound_PlayLoop, wxT("&Loop sound\tCtrl-L")); playMenu->Append(Sound_PlayLoop, "&Loop sound\tCtrl-L");
playMenu->AppendSeparator(); playMenu->AppendSeparator();
playMenu->Append(Sound_Stop, wxT("&Stop playing\tCtrl-T")); playMenu->Append(Sound_Stop, "&Stop playing\tCtrl-T");
playMenu->AppendSeparator(); playMenu->AppendSeparator();
playMenu->Append(Sound_PlayBell, wxT("Play system bell")); playMenu->Append(Sound_PlayBell, "Play system bell");
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(Sound_About, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(Sound_About, "&About\tF1", "Show about dialog");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(playMenu, wxT("&Play")); menuBar->Append(playMenu, "&Play");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -991,7 +991,7 @@ wxSound* MyFrame::TryCreateSound() const
void MyFrame::NotifyUsingFile(const wxString& name) void MyFrame::NotifyUsingFile(const wxString& name)
{ {
wxString msg; wxString msg;
msg << wxT("Using sound file: ") << name << wxT("\n"); msg << "Using sound file: " << name << "\n";
m_tc->AppendText(msg); m_tc->AppendText(msg);
} }
@@ -1002,7 +1002,7 @@ void MyFrame::NotifyUsingFile(const wxString& name)
void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event))
{ {
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
wxFileDialog dlg(this, wxT("Choose a sound file"), wxFileDialog dlg(this, "Choose a sound file",
wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString,
wxString::Format wxString::Format
( (
@@ -1031,9 +1031,9 @@ void MyFrame::OnSelectResource(wxCommandEvent& WXUNUSED(event))
{ {
m_soundRes = wxGetTextFromUser m_soundRes = wxGetTextFromUser
( (
wxT("Enter resource name:"), "Enter resource name:",
wxT("wxWidgets Sound Sample"), "wxWidgets Sound Sample",
wxT("FromResource"), "FromResource",
this this
); );
if ( m_soundRes.empty() ) if ( m_soundRes.empty() )
@@ -1044,7 +1044,7 @@ void MyFrame::OnSelectResource(wxCommandEvent& WXUNUSED(event))
wxDELETE(m_sound); wxDELETE(m_sound);
NotifyUsingFile(wxT("Windows WAV resource")); NotifyUsingFile("Windows WAV resource");
} }
#endif // __WXMSW__ #endif // __WXMSW__
@@ -1053,7 +1053,7 @@ void MyFrame::OnSelectMemory(wxCommandEvent& WXUNUSED(event))
{ {
m_useMemory = true; m_useMemory = true;
NotifyUsingFile(wxT("embedded sound fragment")); NotifyUsingFile("embedded sound fragment");
} }
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
@@ -1109,10 +1109,10 @@ void MyFrame::OnPlayBell(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is the About dialog of the sound sample.\n") msg.Printf( "This is the About dialog of the sound sample.\n"
wxT("Welcome to %s"), wxVERSION_STRING); "Welcome to %s", wxVERSION_STRING);
wxMessageBox(msg, wxT("About"), wxOK | wxICON_INFORMATION, this); wxMessageBox(msg, "About", wxOK | wxICON_INFORMATION, this);
} }
void MyFrame::OnStop(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnStop(wxCommandEvent& WXUNUSED(event))

View File

@@ -128,7 +128,7 @@ bool MyApp::OnInit()
wxImage::AddHandler(new wxPNGHandler); wxImage::AddHandler(new wxPNGHandler);
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(wxT("wxSplashScreen sample application")); MyFrame *frame = new MyFrame("wxSplashScreen sample application");
wxBitmap bitmap; wxBitmap bitmap;
@@ -137,7 +137,7 @@ bool MyApp::OnInit()
bool ok = frame->m_isPda bool ok = frame->m_isPda
? bitmap.IsOk() ? bitmap.IsOk()
: bitmap.LoadFile(wxT("splash.png"), wxBITMAP_TYPE_PNG); : bitmap.LoadFile("splash.png", wxBITMAP_TYPE_PNG);
if (ok) if (ok)
{ {
@@ -181,14 +181,14 @@ MyFrame::MyFrame(const wxString& title)
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(wxID_ABOUT, wxT("&About\tF1"), wxT("Show about frame")); helpMenu->Append(wxID_ABOUT, "&About\tF1", "Show about frame");
menuFile->Append(wxID_EXIT, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(wxID_EXIT, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -197,7 +197,7 @@ MyFrame::MyFrame(const wxString& title)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -218,7 +218,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
bool ok = m_isPda bool ok = m_isPda
? bitmap.IsOk() ? bitmap.IsOk()
: bitmap.LoadFile(wxT("splash.png"), wxBITMAP_TYPE_PNG); : bitmap.LoadFile("splash.png", wxBITMAP_TYPE_PNG);
if (ok) if (ok)
{ {
@@ -236,12 +236,12 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
wxWindow *win = splash->GetSplashWindow(); wxWindow *win = splash->GetSplashWindow();
#if wxUSE_MEDIACTRL #if wxUSE_MEDIACTRL
wxMediaCtrl *media = new wxMediaCtrl( win, wxID_EXIT, wxT("press.mpg"), wxPoint(2,2)); wxMediaCtrl *media = new wxMediaCtrl( win, wxID_EXIT, "press.mpg", wxPoint(2,2));
media->Play(); media->Play();
#else #else
wxStaticText *text = new wxStaticText( win, wxStaticText *text = new wxStaticText( win,
wxID_EXIT, wxID_EXIT,
wxT("click somewhere\non this image"), "click somewhere\non this image",
wxPoint(m_isPda ? 0 : 13, wxPoint(m_isPda ? 0 : 13,
m_isPda ? 0 : 11) m_isPda ? 0 : 11)
); );

View File

@@ -213,7 +213,7 @@ wxEND_EVENT_TABLE()
// My frame constructor // My frame constructor
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, wxT("wxSplitterWindow sample"), : wxFrame(NULL, wxID_ANY, "wxSplitterWindow sample",
wxDefaultPosition, wxSize(420, 300), wxDefaultPosition, wxSize(420, 300),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{ {
@@ -226,58 +226,58 @@ MyFrame::MyFrame()
// Make a menubar // Make a menubar
wxMenu *splitMenu = new wxMenu; wxMenu *splitMenu = new wxMenu;
splitMenu->Append(SPLIT_VERTICAL, splitMenu->Append(SPLIT_VERTICAL,
wxT("Split &Vertically\tCtrl-V"), "Split &Vertically\tCtrl-V",
wxT("Split vertically")); "Split vertically");
splitMenu->Append(SPLIT_HORIZONTAL, splitMenu->Append(SPLIT_HORIZONTAL,
wxT("Split &Horizontally\tCtrl-H"), "Split &Horizontally\tCtrl-H",
wxT("Split horizontally")); "Split horizontally");
splitMenu->Append(SPLIT_UNSPLIT, splitMenu->Append(SPLIT_UNSPLIT,
wxT("&Unsplit\tCtrl-U"), "&Unsplit\tCtrl-U",
wxT("Unsplit")); "Unsplit");
splitMenu->AppendCheckItem(SPLIT_INVISIBLE, splitMenu->AppendCheckItem(SPLIT_INVISIBLE,
wxT("Toggle sash &invisibility\tCtrl-I"), "Toggle sash &invisibility\tCtrl-I",
wxT("Toggle sash invisibility")); "Toggle sash invisibility");
splitMenu->AppendSeparator(); splitMenu->AppendSeparator();
splitMenu->AppendCheckItem(SPLIT_LIVE, splitMenu->AppendCheckItem(SPLIT_LIVE,
wxT("&Live update\tCtrl-L"), "&Live update\tCtrl-L",
wxT("Toggle live update mode")); "Toggle live update mode");
splitMenu->AppendCheckItem(SPLIT_BORDER, splitMenu->AppendCheckItem(SPLIT_BORDER,
wxT("3D &Border"), "3D &Border",
wxT("Toggle wxSP_BORDER flag")); "Toggle wxSP_BORDER flag");
splitMenu->Check(SPLIT_BORDER, true); splitMenu->Check(SPLIT_BORDER, true);
splitMenu->AppendCheckItem(SPLIT_3DSASH, splitMenu->AppendCheckItem(SPLIT_3DSASH,
wxT("&3D Sash"), "&3D Sash",
wxT("Toggle wxSP_3DSASH flag")); "Toggle wxSP_3DSASH flag");
splitMenu->Check(SPLIT_3DSASH, true); splitMenu->Check(SPLIT_3DSASH, true);
#ifdef __WXMSW__ #ifdef __WXMSW__
splitMenu->AppendCheckItem(SPLIT_NOTHEME, splitMenu->AppendCheckItem(SPLIT_NOTHEME,
wxT("Disable XP &theme"), "Disable XP &theme",
wxT("Toggle wxSP_NO_XP_THEME flag")); "Toggle wxSP_NO_XP_THEME flag");
#endif #endif
splitMenu->AppendCheckItem(SPLIT_CUSTOM_COLOUR, splitMenu->AppendCheckItem(SPLIT_CUSTOM_COLOUR,
wxT("Use custom &colour"), "Use custom &colour",
wxT("Toggle custom colour")); "Toggle custom colour");
splitMenu->Append(SPLIT_SETPOSITION, splitMenu->Append(SPLIT_SETPOSITION,
wxT("Set splitter &position\tCtrl-P"), "Set splitter &position\tCtrl-P",
wxT("Set the splitter position")); "Set the splitter position");
splitMenu->Append(SPLIT_SETMINSIZE, splitMenu->Append(SPLIT_SETMINSIZE,
wxT("Set &min size\tCtrl-M"), "Set &min size\tCtrl-M",
wxT("Set minimum pane size")); "Set minimum pane size");
splitMenu->Append(SPLIT_SETGRAVITY, splitMenu->Append(SPLIT_SETGRAVITY,
wxT("Set &gravity\tCtrl-G"), "Set &gravity\tCtrl-G",
wxT("Set gravity of sash")); "Set gravity of sash");
splitMenu->AppendSeparator(); splitMenu->AppendSeparator();
splitMenu->Append(SPLIT_REPLACE, splitMenu->Append(SPLIT_REPLACE,
wxT("&Replace right window"), "&Replace right window",
wxT("Replace right window")); "Replace right window");
splitMenu->AppendSeparator(); splitMenu->AppendSeparator();
splitMenu->Append(SPLIT_QUIT, wxT("E&xit\tAlt-X"), wxT("Exit")); splitMenu->Append(SPLIT_QUIT, "E&xit\tAlt-X", "Exit");
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(splitMenu, wxT("&Splitter")); menuBar->Append(splitMenu, "&Splitter");
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -300,8 +300,8 @@ MyFrame::MyFrame()
m_right = new MyCanvas(m_splitter, false); m_right = new MyCanvas(m_splitter, false);
m_right->SetBackgroundColour(*wxCYAN); m_right->SetBackgroundColour(*wxCYAN);
#else // for testing kbd navigation inside the splitter #else // for testing kbd navigation inside the splitter
m_left = new wxTextCtrl(m_splitter, wxID_ANY, wxT("first text")); m_left = new wxTextCtrl(m_splitter, wxID_ANY, "first text");
m_right = new wxTextCtrl(m_splitter, wxID_ANY, wxT("second text")); m_right = new wxTextCtrl(m_splitter, wxID_ANY, "second text");
#endif #endif
// you can also do this to start with a single window // you can also do this to start with a single window
@@ -314,7 +314,7 @@ MyFrame::MyFrame()
#endif #endif
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Min pane size = 0"), 1); SetStatusText("Min pane size = 0", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
m_replacewindow = NULL; m_replacewindow = NULL;
@@ -344,7 +344,7 @@ void MyFrame::OnSplitHorizontal(wxCommandEvent& WXUNUSED(event) )
m_replacewindow = NULL; m_replacewindow = NULL;
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Splitter split horizontally"), 1); SetStatusText("Splitter split horizontally", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -358,7 +358,7 @@ void MyFrame::OnSplitVertical(wxCommandEvent& WXUNUSED(event) )
m_replacewindow = NULL; m_replacewindow = NULL;
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Splitter split vertically"), 1); SetStatusText("Splitter split vertically", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -367,7 +367,7 @@ void MyFrame::OnUnsplit(wxCommandEvent& WXUNUSED(event) )
if ( m_splitter->IsSplit() ) if ( m_splitter->IsSplit() )
m_splitter->Unsplit(); m_splitter->Unsplit();
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("No splitter")); SetStatusText("No splitter");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -390,9 +390,9 @@ void MyFrame::ToggleFlag(int flag, bool enable)
void MyFrame::OnSetPosition(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnSetPosition(wxCommandEvent& WXUNUSED(event) )
{ {
wxString str; wxString str;
str.Printf( wxT("%d"), m_splitter->GetSashPosition()); str.Printf( "%d", m_splitter->GetSashPosition());
#if wxUSE_TEXTDLG #if wxUSE_TEXTDLG
str = wxGetTextFromUser(wxT("Enter splitter position:"), wxT(""), str, this); str = wxGetTextFromUser("Enter splitter position:", "", str, this);
#endif #endif
if ( str.empty() ) if ( str.empty() )
return; return;
@@ -400,21 +400,21 @@ void MyFrame::OnSetPosition(wxCommandEvent& WXUNUSED(event) )
long pos; long pos;
if ( !str.ToLong(&pos) ) if ( !str.ToLong(&pos) )
{ {
wxLogError(wxT("The splitter position should be an integer.")); wxLogError("The splitter position should be an integer.");
return; return;
} }
m_splitter->SetSashPosition(pos); m_splitter->SetSashPosition(pos);
wxLogStatus(this, wxT("Splitter position set to %ld"), pos); wxLogStatus(this, "Splitter position set to %ld", pos);
} }
void MyFrame::OnSetMinSize(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnSetMinSize(wxCommandEvent& WXUNUSED(event) )
{ {
wxString str; wxString str;
str.Printf( wxT("%d"), m_splitter->GetMinimumPaneSize()); str.Printf( "%d", m_splitter->GetMinimumPaneSize());
#if wxUSE_TEXTDLG #if wxUSE_TEXTDLG
str = wxGetTextFromUser(wxT("Enter minimal size for panes:"), wxT(""), str, this); str = wxGetTextFromUser("Enter minimal size for panes:", "", str, this);
#endif #endif
if ( str.empty() ) if ( str.empty() )
return; return;
@@ -422,7 +422,7 @@ void MyFrame::OnSetMinSize(wxCommandEvent& WXUNUSED(event) )
int minsize = wxStrtol( str, (wxChar**)NULL, 10 ); int minsize = wxStrtol( str, (wxChar**)NULL, 10 );
m_splitter->SetMinimumPaneSize(minsize); m_splitter->SetMinimumPaneSize(minsize);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
str.Printf( wxT("Min pane size = %d"), minsize); str.Printf( "Min pane size = %d", minsize);
SetStatusText(str, 1); SetStatusText(str, 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -430,9 +430,9 @@ void MyFrame::OnSetMinSize(wxCommandEvent& WXUNUSED(event) )
void MyFrame::OnSetGravity(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnSetGravity(wxCommandEvent& WXUNUSED(event) )
{ {
wxString str; wxString str;
str.Printf( wxT("%g"), m_splitter->GetSashGravity()); str.Printf( "%g", m_splitter->GetSashGravity());
#if wxUSE_TEXTDLG #if wxUSE_TEXTDLG
str = wxGetTextFromUser(wxT("Enter sash gravity (0,1):"), wxT(""), str, this); str = wxGetTextFromUser("Enter sash gravity (0,1):", "", str, this);
#endif #endif
if ( str.empty() ) if ( str.empty() )
return; return;
@@ -440,7 +440,7 @@ void MyFrame::OnSetGravity(wxCommandEvent& WXUNUSED(event) )
double gravity = wxStrtod( str, (wxChar**)NULL); double gravity = wxStrtod( str, (wxChar**)NULL);
m_splitter->SetSashGravity(gravity); m_splitter->SetSashGravity(gravity);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
str.Printf( wxT("Gravity = %g"), gravity); str.Printf( "Gravity = %g", gravity);
SetStatusText(str, 1); SetStatusText(str, 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -513,7 +513,7 @@ MySplitterWindow::MySplitterWindow(wxFrame *parent)
void MySplitterWindow::OnPositionChanged(wxSplitterEvent& event) void MySplitterWindow::OnPositionChanged(wxSplitterEvent& event)
{ {
wxLogStatus(m_frame, wxT("Position has changed, now = %d (or %d)"), wxLogStatus(m_frame, "Position has changed, now = %d (or %d)",
event.GetSashPosition(), GetSashPosition()); event.GetSashPosition(), GetSashPosition());
event.Skip(); event.Skip();
@@ -521,7 +521,7 @@ void MySplitterWindow::OnPositionChanged(wxSplitterEvent& event)
void MySplitterWindow::OnPositionChanging(wxSplitterEvent& event) void MySplitterWindow::OnPositionChanging(wxSplitterEvent& event)
{ {
wxLogStatus(m_frame, wxT("Position is changing, now = %d (or %d)"), wxLogStatus(m_frame, "Position is changing, now = %d (or %d)",
event.GetSashPosition(), GetSashPosition()); event.GetSashPosition(), GetSashPosition());
event.Skip(); event.Skip();
@@ -530,7 +530,7 @@ void MySplitterWindow::OnPositionChanging(wxSplitterEvent& event)
void MySplitterWindow::OnDClick(wxSplitterEvent& event) void MySplitterWindow::OnDClick(wxSplitterEvent& event)
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
m_frame->SetStatusText(wxT("Splitter double clicked"), 1); m_frame->SetStatusText("Splitter double clicked", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
event.Skip(); event.Skip();
@@ -539,7 +539,7 @@ void MySplitterWindow::OnDClick(wxSplitterEvent& event)
void MySplitterWindow::OnUnsplitEvent(wxSplitterEvent& event) void MySplitterWindow::OnUnsplitEvent(wxSplitterEvent& event)
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
m_frame->SetStatusText(wxT("Splitter unsplit"), 1); m_frame->SetStatusText("Splitter unsplit", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
event.Skip(); event.Skip();
@@ -565,7 +565,7 @@ void MyCanvas::OnDraw(wxDC& dcOrig)
dc.DrawLine(0, 0, 100, 200); dc.DrawLine(0, 0, 100, 200);
dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
dc.DrawText(wxT("Testing"), 50, 50); dc.DrawText("Testing", 50, 50);
dc.SetPen(*wxRED_PEN); dc.SetPen(*wxRED_PEN);
dc.SetBrush(*wxGREEN_BRUSH); dc.SetBrush(*wxGREEN_BRUSH);

View File

@@ -306,7 +306,7 @@ bool MyApp::OnInit()
return false; return false;
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(wxT("wxStatusBar sample"), MyFrame *frame = new MyFrame("wxStatusBar sample",
wxPoint(50, 50), wxSize(450, 340)); wxPoint(50, 50), wxSize(450, 340));
// and show it (the frames, unlike simple controls, are not shown when // and show it (the frames, unlike simple controls, are not shown when
@@ -338,101 +338,101 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(StatusBar_Quit, wxT("E&xit\tAlt-X"), menuFile->Append(StatusBar_Quit, "E&xit\tAlt-X",
wxT("Quit this program")); "Quit this program");
wxMenu *statbarMenu = new wxMenu; wxMenu *statbarMenu = new wxMenu;
wxMenu *statbarStyleMenu = new wxMenu; wxMenu *statbarStyleMenu = new wxMenu;
statbarStyleMenu->Append(StatusBar_SetStyleSizeGrip, wxT("wxSTB_SIZE_GRIP"), statbarStyleMenu->Append(StatusBar_SetStyleSizeGrip, "wxSTB_SIZE_GRIP",
wxT("Toggles the wxSTB_SIZE_GRIP style"), true); "Toggles the wxSTB_SIZE_GRIP style", true);
statbarStyleMenu->Append(StatusBar_SetStyleShowTips, wxT("wxSTB_SHOW_TIPS"), statbarStyleMenu->Append(StatusBar_SetStyleShowTips, "wxSTB_SHOW_TIPS",
wxT("Toggles the wxSTB_SHOW_TIPS style"), true); "Toggles the wxSTB_SHOW_TIPS style", true);
statbarStyleMenu->AppendSeparator(); statbarStyleMenu->AppendSeparator();
statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeStart, statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeStart,
wxT("wxSTB_ELLIPSIZE_START"), "wxSTB_ELLIPSIZE_START",
wxT("Toggle wxSTB_ELLIPSIZE_START style")); "Toggle wxSTB_ELLIPSIZE_START style");
statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeMiddle, statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeMiddle,
wxT("wxSTB_ELLIPSIZE_MIDDLE"), "wxSTB_ELLIPSIZE_MIDDLE",
wxT("Toggle wxSTB_ELLIPSIZE_MIDDLE style")); "Toggle wxSTB_ELLIPSIZE_MIDDLE style");
statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeEnd, statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeEnd,
wxT("wxSTB_ELLIPSIZE_END"), "wxSTB_ELLIPSIZE_END",
wxT("Toggle wxSTB_ELLIPSIZE_END style")); "Toggle wxSTB_ELLIPSIZE_END style");
statbarMenu->Append(StatusBar_SetPaneStyle, wxT("Status bar style"), statbarMenu->Append(StatusBar_SetPaneStyle, "Status bar style",
statbarStyleMenu); statbarStyleMenu);
statbarMenu->AppendSeparator(); statbarMenu->AppendSeparator();
statbarMenu->Append(StatusBar_SetField, "Set active field &number\tCtrl-N", statbarMenu->Append(StatusBar_SetField, "Set active field &number\tCtrl-N",
"Set the number of field used by the next commands."); "Set the number of field used by the next commands.");
statbarMenu->Append(StatusBar_SetText, wxT("Set field &text\tCtrl-T"), statbarMenu->Append(StatusBar_SetText, "Set field &text\tCtrl-T",
wxT("Set the text of the selected field.")); "Set the text of the selected field.");
statbarMenu->Append(StatusBar_PushText, "P&ush field text\tCtrl-P", statbarMenu->Append(StatusBar_PushText, "P&ush field text\tCtrl-P",
"Push a message on top the selected field."); "Push a message on top the selected field.");
statbarMenu->Append(StatusBar_PopText, "&Pop field text\tShift-Ctrl-P", statbarMenu->Append(StatusBar_PopText, "&Pop field text\tShift-Ctrl-P",
"Restore the previous contents of the selected field."); "Restore the previous contents of the selected field.");
statbarMenu->AppendSeparator(); statbarMenu->AppendSeparator();
statbarMenu->Append(StatusBar_SetFields, wxT("&Set field count\tCtrl-C"), statbarMenu->Append(StatusBar_SetFields, "&Set field count\tCtrl-C",
wxT("Set the number of status bar fields")); "Set the number of status bar fields");
statbarMenu->Append(StatusBar_SetFont, wxT("&Set field font\tCtrl-F"), statbarMenu->Append(StatusBar_SetFont, "&Set field font\tCtrl-F",
wxT("Set the font to use for status bar fields")); "Set the font to use for status bar fields");
wxMenu *statbarPaneStyleMenu = new wxMenu; wxMenu *statbarPaneStyleMenu = new wxMenu;
statbarPaneStyleMenu->AppendCheckItem statbarPaneStyleMenu->AppendCheckItem
( (
StatusBar_SetPaneStyleNormal, StatusBar_SetPaneStyleNormal,
wxT("&Normal"), "&Normal",
wxT("Sets the style of the first field to normal (sunken) look") "Sets the style of the first field to normal (sunken) look"
); );
statbarPaneStyleMenu->AppendCheckItem statbarPaneStyleMenu->AppendCheckItem
( (
StatusBar_SetPaneStyleFlat, StatusBar_SetPaneStyleFlat,
wxT("&Flat"), "&Flat",
wxT("Sets the style of the first field to flat look") "Sets the style of the first field to flat look"
); );
statbarPaneStyleMenu->AppendCheckItem statbarPaneStyleMenu->AppendCheckItem
( (
StatusBar_SetPaneStyleRaised, StatusBar_SetPaneStyleRaised,
wxT("&Raised"), "&Raised",
wxT("Sets the style of the first field to raised look") "Sets the style of the first field to raised look"
); );
statbarPaneStyleMenu->AppendCheckItem statbarPaneStyleMenu->AppendCheckItem
( (
StatusBar_SetPaneStyleSunken, StatusBar_SetPaneStyleSunken,
wxT("&Sunken"), "&Sunken",
wxT("Sets the style of the first field to sunken look") "Sets the style of the first field to sunken look"
); );
statbarMenu->Append(StatusBar_SetPaneStyle, wxT("Field style"), statbarMenu->Append(StatusBar_SetPaneStyle, "Field style",
statbarPaneStyleMenu); statbarPaneStyleMenu);
statbarMenu->Append(StatusBar_ResetFieldsWidth, wxT("Reset field widths"), statbarMenu->Append(StatusBar_ResetFieldsWidth, "Reset field widths",
wxT("Sets all fields to the same width")); "Sets all fields to the same width");
statbarMenu->Append(StatusBar_ShowFieldsRect, statbarMenu->Append(StatusBar_ShowFieldsRect,
wxT("Sho&w field rectangles\tCtrl-W"), "Sho&w field rectangles\tCtrl-W",
wxT("Visually show field rectangles")); "Visually show field rectangles");
statbarMenu->AppendSeparator(); statbarMenu->AppendSeparator();
statbarMenu->AppendCheckItem(StatusBar_Toggle, wxT("&Toggle Status Bar"), statbarMenu->AppendCheckItem(StatusBar_Toggle, "&Toggle Status Bar",
wxT("Toggle the status bar display")); "Toggle the status bar display");
statbarMenu->Append(StatusBar_Recreate, wxT("&Recreate\tCtrl-R"), statbarMenu->Append(StatusBar_Recreate, "&Recreate\tCtrl-R",
wxT("Toggle status bar format")); "Toggle status bar format");
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(StatusBar_About, wxT("&About\tCtrl-A"), helpMenu->Append(StatusBar_About, "&About\tCtrl-A",
wxT("Show about dialog")); "Show about dialog");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(statbarMenu, wxT("&Status bar")); menuBar->Append(statbarMenu, "&Status bar");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
// create default status bar to start with // create default status bar to start with
DoCreateStatusBar(StatBar_Default, wxSTB_DEFAULT_STYLE); DoCreateStatusBar(StatBar_Default, wxSTB_DEFAULT_STYLE);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
} }
void MyFrame::DoCreateStatusBar(MyFrame::StatusBarKind kind, long style) void MyFrame::DoCreateStatusBar(MyFrame::StatusBarKind kind, long style)
@@ -457,7 +457,7 @@ void MyFrame::DoCreateStatusBar(MyFrame::StatusBarKind kind, long style)
break; break;
default: default:
wxFAIL_MSG(wxT("unknown status bar kind")); wxFAIL_MSG("unknown status bar kind");
} }
SetStatusBar(statbarNew); SetStatusBar(statbarNew);
@@ -591,8 +591,8 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event))
long nFields = wxGetNumberFromUser long nFields = wxGetNumberFromUser
( (
wxT("Select the number of fields in the status bar"), "Select the number of fields in the status bar",
wxT("Fields:"), "Fields:",
SAMPLE_DIALOGS_TITLE, SAMPLE_DIALOGS_TITLE,
sb->GetFieldsCount(), sb->GetFieldsCount(),
1, 5, 1, 5,
@@ -625,13 +625,13 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event))
if ( widths ) if ( widths )
{ {
if ( widths[n] > 0 ) if ( widths[n] > 0 )
s.Printf(wxT("fixed (%d)"), widths[n]); s.Printf("fixed (%d)", widths[n]);
else else
s.Printf(wxT("variable (*%d)"), -widths[n]); s.Printf("variable (*%d)", -widths[n]);
} }
else else
{ {
s = wxT("default"); s = "default";
} }
SetStatusText(s, n); SetStatusText(s, n);
@@ -642,7 +642,7 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
wxLogStatus(this, wxT("Cancelled")); wxLogStatus(this, "Cancelled");
} }
} }
@@ -849,28 +849,28 @@ void MyFrame::OnSetStyle(wxCommandEvent& event)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
MyAboutDialog::MyAboutDialog(wxWindow *parent) MyAboutDialog::MyAboutDialog(wxWindow *parent)
: wxDialog(parent, wxID_ANY, wxString(wxT("About statbar")), : wxDialog(parent, wxID_ANY, wxString("About statbar"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{ {
wxStaticText *text = new wxStaticText(this, wxID_ANY, wxStaticText *text = new wxStaticText(this, wxID_ANY,
wxT("wxStatusBar sample\n") "wxStatusBar sample\n"
wxT("(c) 2000 Vadim Zeitlin")); "(c) 2000 Vadim Zeitlin");
wxButton *btn = new wxButton(this, wxID_OK, wxT("&Close")); wxButton *btn = new wxButton(this, wxID_OK, "&Close");
// create the top status bar without the size grip (default style), // create the top status bar without the size grip (default style),
// otherwise it looks weird // otherwise it looks weird
wxStatusBar *statbarTop = new wxStatusBar(this, wxID_ANY, 0); wxStatusBar *statbarTop = new wxStatusBar(this, wxID_ANY, 0);
statbarTop->SetFieldsCount(3); statbarTop->SetFieldsCount(3);
statbarTop->SetStatusText(wxT("This is a top status bar"), 0); statbarTop->SetStatusText("This is a top status bar", 0);
statbarTop->SetStatusText(wxT("in a dialog"), 1); statbarTop->SetStatusText("in a dialog", 1);
statbarTop->SetStatusText(wxT("Great, isn't it?"), 2); statbarTop->SetStatusText("Great, isn't it?", 2);
wxStatusBar *statbarBottom = new wxStatusBar(this, wxID_ANY); wxStatusBar *statbarBottom = new wxStatusBar(this, wxID_ANY);
statbarBottom->SetFieldsCount(2); statbarBottom->SetFieldsCount(2);
statbarBottom->SetStatusText(wxT("This is a bottom status bar"), 0); statbarBottom->SetStatusText("This is a bottom status bar", 0);
statbarBottom->SetStatusText(wxT("in a dialog"), 1); statbarBottom->SetStatusText("in a dialog", 1);
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(statbarTop, 0, wxGROW); sizerTop->Add(statbarTop, 0, wxGROW);
@@ -922,7 +922,7 @@ MyStatusBar::MyStatusBar(wxWindow *parent, long style)
SetStatusWidths(Field_Max, widths); SetStatusWidths(Field_Max, widths);
#if wxUSE_CHECKBOX #if wxUSE_CHECKBOX
m_checkbox = new wxCheckBox(this, StatusBar_Checkbox, wxT("&Toggle clock")); m_checkbox = new wxCheckBox(this, StatusBar_Checkbox, "&Toggle clock");
m_checkbox->SetValue(true); m_checkbox->SetValue(true);
#endif #endif

View File

@@ -139,7 +139,7 @@ bool MyApp::OnInit()
{ {
// Create the main frame window // Create the main frame window
MyFrame* frame = new MyFrame(NULL, -1, wxT("SVG Demo"), MyFrame* frame = new MyFrame(NULL, -1, "SVG Demo",
wxDefaultPosition, wxSize(500, 400)); wxDefaultPosition, wxSize(500, 400));
frame->Show(true); frame->Show(true);
@@ -174,8 +174,8 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
menu_bar->Append(help_menu, wxT("&Help")); menu_bar->Append(help_menu, "&Help");
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
@@ -198,12 +198,12 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
(void)wxMessageBox(wxT("wxWidgets SVG sample\n") (void)wxMessageBox("wxWidgets SVG sample\n"
wxT("Authors:\n") "Authors:\n"
wxT(" Chris Elliott (c) 2002-2009\n") " Chris Elliott (c) 2002-2009\n"
wxT(" Prashant Kumar Nirmal (c) 2017\n") " Prashant Kumar Nirmal (c) 2017\n"
wxT("Usage: click File|Save to Save the Selected SVG Test"), "Usage: click File|Save to Save the Selected SVG Test",
wxT("About SVG Test")); "About SVG Test");
} }
void MyFrame::FileSavePicture(wxCommandEvent& WXUNUSED(event)) void MyFrame::FileSavePicture(wxCommandEvent& WXUNUSED(event))
@@ -211,9 +211,9 @@ void MyFrame::FileSavePicture(wxCommandEvent& WXUNUSED(event))
#if wxUSE_FILEDLG #if wxUSE_FILEDLG
MyPage * const page = (MyPage *) m_notebook->GetCurrentPage(); MyPage * const page = (MyPage *) m_notebook->GetCurrentPage();
wxFileDialog dialog(this, wxT("Save Picture as"), wxEmptyString, wxFileDialog dialog(this, "Save Picture as", wxEmptyString,
m_notebook->GetPageText(m_notebook->GetSelection()), m_notebook->GetPageText(m_notebook->GetSelection()),
wxT("SVG vector picture files (*.svg)|*.svg"), "SVG vector picture files (*.svg)|*.svg",
wxFD_SAVE|wxFD_OVERWRITE_PROMPT); wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)
@@ -280,10 +280,10 @@ void MyPage::OnDraw(wxDC& dc)
dc.SetBrush(*wxCYAN_BRUSH); dc.SetBrush(*wxCYAN_BRUSH);
dc.SetPen(*wxRED_PEN); dc.SetPen(*wxRED_PEN);
dc.DrawRectangle(10, 10, 100, 70); dc.DrawRectangle(10, 10, 100, 70);
wB = wxBrush (wxT("DARK ORCHID"), wxBRUSHSTYLE_TRANSPARENT); wB = wxBrush ("DARK ORCHID", wxBRUSHSTYLE_TRANSPARENT);
dc.SetBrush (wB); dc.SetBrush (wB);
dc.DrawRoundedRectangle(50, 50, 100, 70, 20); dc.DrawRoundedRectangle(50, 50, 100, 70, 20);
dc.SetBrush (wxBrush(wxT("GOLDENROD")) ); dc.SetBrush (wxBrush("GOLDENROD") );
dc.DrawEllipse(100, 100, 100, 50); dc.DrawEllipse(100, 100, 100, 50);
points[0].x = 100; points[0].y = 200; points[0].x = 100; points[0].y = 200;
@@ -301,21 +301,21 @@ void MyPage::OnDraw(wxDC& dc)
// draw text in Arial or similar font // draw text in Arial or similar font
dc.DrawLine(50,25,50,35); dc.DrawLine(50,25,50,35);
dc.DrawLine(45,30,55,30); dc.DrawLine(45,30,55,30);
dc.DrawText(wxT("This is a Swiss-style string"), 50, 30); dc.DrawText("This is a Swiss-style string", 50, 30);
wC = dc.GetTextForeground(); wC = dc.GetTextForeground();
dc.SetTextForeground (wxT("FIREBRICK")); dc.SetTextForeground ("FIREBRICK");
// no effect in msw ?? // no effect in msw ??
dc.SetTextBackground (wxT("WHEAT")); dc.SetTextBackground ("WHEAT");
dc.DrawText(wxT("This is a Red string"), 50, 200); dc.DrawText("This is a Red string", 50, 200);
dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45); dc.DrawRotatedText("This is a 45 deg string", 50, 200, 45);
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90); dc.DrawRotatedText("This is a 90 deg string", 50, 200, 90);
dc.SetFont(wxFontInfo(18) dc.SetFont(wxFontInfo(18)
.FaceName("Times New Roman") .FaceName("Times New Roman")
.Family(wxFONTFAMILY_ROMAN) .Family(wxFONTFAMILY_ROMAN)
.Italic().Bold()); .Italic().Bold());
dc.SetTextForeground (wC); dc.SetTextForeground (wC);
dc.DrawText(wxT("This is a Times-style string"), 50, 60); dc.DrawText("This is a Times-style string", 50, 60);
break; break;
case Page_Arcs: case Page_Arcs:
@@ -328,11 +328,11 @@ void MyPage::OnDraw(wxDC& dc)
dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 ); dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
dc.SetDeviceOrigin(0,0); dc.SetDeviceOrigin(0,0);
wP.SetColour (wxT("CADET BLUE")); wP.SetColour ("CADET BLUE");
dc.SetPen(wP); dc.SetPen(wP);
dc.DrawArc ( 75,125, 110, 40, 75, 75 ); dc.DrawArc ( 75,125, 110, 40, 75, 75 );
wP.SetColour (wxT("SALMON")); wP.SetColour ("SALMON");
dc.SetPen(wP); dc.SetPen(wP);
dc.SetBrush(*wxRED_BRUSH); dc.SetBrush(*wxRED_BRUSH);
//top left corner, width and height, start and end angle //top left corner, width and height, start and end angle
@@ -343,7 +343,7 @@ void MyPage::OnDraw(wxDC& dc)
wP.SetWidth(3); wP.SetWidth(3);
dc.SetPen(wP); dc.SetPen(wP);
//wxTRANSPARENT)); //wxTRANSPARENT));
dc.SetBrush (wxBrush (wxT("SALMON"))); dc.SetBrush (wxBrush ("SALMON"));
dc.DrawEllipticArc(300, 0,200,100, 0.0,145.0); dc.DrawEllipticArc(300, 0,200,100, 0.0,145.0);
//same end point //same end point
dc.DrawEllipticArc(300, 50,200,100,90.0,145.0); dc.DrawEllipticArc(300, 50,200,100,90.0,145.0);
@@ -353,7 +353,7 @@ void MyPage::OnDraw(wxDC& dc)
case Page_Checkmarks: case Page_Checkmarks:
dc.DrawCheckMark ( 30,30,25,25); dc.DrawCheckMark ( 30,30,25,25);
dc.SetBrush (wxBrush (wxT("SALMON"),wxBRUSHSTYLE_TRANSPARENT)); dc.SetBrush (wxBrush ("SALMON",wxBRUSHSTYLE_TRANSPARENT));
dc.DrawCheckMark ( 80,50,75,75); dc.DrawCheckMark ( 80,50,75,75);
dc.DrawRectangle ( 80,50,75,75); dc.DrawRectangle ( 80,50,75,75);
break; break;
@@ -365,7 +365,7 @@ void MyPage::OnDraw(wxDC& dc)
.Italic().Bold()); .Italic().Bold());
dc.DrawLine(0, 0, 200, 200); dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200); dc.DrawLine(200, 0, 0, 200);
dc.DrawText(wxT("This is an 18pt string"), 50, 60); dc.DrawText("This is an 18pt string", 50, 60);
// rescale and draw in blue // rescale and draw in blue
wP = *wxCYAN_PEN; wP = *wxCYAN_PEN;
@@ -374,10 +374,10 @@ void MyPage::OnDraw(wxDC& dc)
dc.SetDeviceOrigin(200,0); dc.SetDeviceOrigin(200,0);
dc.DrawLine(0, 0, 200, 200); dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200); dc.DrawLine(200, 0, 0, 200);
dc.DrawText(wxT("This is an 18pt string 2 x 0.5 UserScaled"), 50, 60); dc.DrawText("This is an 18pt string 2 x 0.5 UserScaled", 50, 60);
dc.SetUserScale (2.0,2.0); dc.SetUserScale (2.0,2.0);
dc.SetDeviceOrigin(200,200); dc.SetDeviceOrigin(200,200);
dc.DrawText(wxT("This is an 18pt string 2 x 2 UserScaled"), 50, 60); dc.DrawText("This is an 18pt string 2 x 2 UserScaled", 50, 60);
wP = *wxRED_PEN; wP = *wxRED_PEN;
dc.SetPen(wP); dc.SetPen(wP);
@@ -386,7 +386,7 @@ void MyPage::OnDraw(wxDC& dc)
dc.SetMapMode (wxMM_METRIC); //svg ignores this dc.SetMapMode (wxMM_METRIC); //svg ignores this
dc.DrawLine(0, 0, 200, 200); dc.DrawLine(0, 0, 200, 200);
dc.DrawLine(200, 0, 0, 200); dc.DrawLine(200, 0, 0, 200);
dc.DrawText(wxT("This is an 18pt string in MapMode"), 50, 60); dc.DrawText("This is an 18pt string in MapMode", 50, 60);
break; break;
case Page_Bitmaps: case Page_Bitmaps:
@@ -395,15 +395,15 @@ void MyPage::OnDraw(wxDC& dc)
break; break;
case Page_Clipping: case Page_Clipping:
dc.SetTextForeground(wxT("RED")); dc.SetTextForeground("RED");
dc.DrawText(wxT("Red = Clipping Off"), 30, 5); dc.DrawText("Red = Clipping Off", 30, 5);
dc.SetTextForeground(wxT("GREEN")); dc.SetTextForeground("GREEN");
dc.DrawText(wxT("Green = Clipping On"), 30, 25); dc.DrawText("Green = Clipping On", 30, 25);
dc.SetTextForeground(wxT("BLACK")); dc.SetTextForeground("BLACK");
dc.SetPen(*wxRED_PEN); dc.SetPen(*wxRED_PEN);
dc.SetBrush (wxBrush (wxT("SALMON"),wxBRUSHSTYLE_TRANSPARENT)); dc.SetBrush (wxBrush ("SALMON",wxBRUSHSTYLE_TRANSPARENT));
dc.DrawCheckMark ( 80,50,75,75); dc.DrawCheckMark ( 80,50,75,75);
dc.DrawRectangle ( 80,50,75,75); dc.DrawRectangle ( 80,50,75,75);
@@ -464,7 +464,7 @@ void MyPage::OnDraw(wxDC& dc)
//dc.SetTextBackground(*wxBLUE); //dc.SetTextBackground(*wxBLUE);
// Horizontal text // Horizontal text
txtStr = wxT("Horizontal string"); txtStr = "Horizontal string";
dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL); dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL);
txtX = 50; txtX = 50;
txtY = 300; txtY = 300;
@@ -472,7 +472,7 @@ void MyPage::OnDraw(wxDC& dc)
dc.DrawText(txtStr, txtX + txtPad, txtY + txtPad); dc.DrawText(txtStr, txtX + txtPad, txtY + txtPad);
// Vertical text // Vertical text
txtStr = wxT("Vertical string"); txtStr = "Vertical string";
dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL); dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL);
txtX = 50; txtX = 50;
txtY = 250; txtY = 250;
@@ -480,7 +480,7 @@ void MyPage::OnDraw(wxDC& dc)
dc.DrawRotatedText(txtStr, txtX + txtPad, txtY - txtPad, 90); dc.DrawRotatedText(txtStr, txtX + txtPad, txtY - txtPad, 90);
// 45 degree text // 45 degree text
txtStr = wxT("45 deg string"); txtStr = "45 deg string";
dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL); dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL);
double lenW = (double)(txtW + 2*txtPad) / sqrt(2.0); double lenW = (double)(txtW + 2*txtPad) / sqrt(2.0);
double lenH = (double)(txtH + 2*txtPad) / sqrt(2.0); double lenH = (double)(txtH + 2*txtPad) / sqrt(2.0);

View File

@@ -100,11 +100,11 @@ private:
{ {
if ( m_panel->NavigateIn(flags) ) if ( m_panel->NavigateIn(flags) )
{ {
wxLogStatus(this, wxT("Navigation event processed")); wxLogStatus(this, "Navigation event processed");
} }
else else
{ {
wxLogStatus(this, wxT("Navigation event ignored")); wxLogStatus(this, "Navigation event ignored");
} }
} }
@@ -143,8 +143,8 @@ private:
if ( event.GetKeyCode() == WXK_TAB && if ( event.GetKeyCode() == WXK_TAB &&
wxMessageBox wxMessageBox
( (
wxT("Let the Tab be used for navigation?"), "Let the Tab be used for navigation?",
wxT("wxWidgets TabOrder sample: Tab key pressed"), "wxWidgets TabOrder sample: Tab key pressed",
wxICON_QUESTION | wxYES_NO, wxICON_QUESTION | wxYES_NO,
this this
) != wxYES ) ) != wxYES )
@@ -194,7 +194,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, wxT("TabOrder wxWidgets Sample"), : wxFrame(NULL, wxID_ANY, "TabOrder wxWidgets Sample",
wxDefaultPosition, wxSize(700, 450)) wxDefaultPosition, wxSize(700, 450))
{ {
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
@@ -205,14 +205,14 @@ MyFrame::MyFrame()
menuFile->Append(TabOrder_Quit); menuFile->Append(TabOrder_Quit);
wxMenu *menuNav = new wxMenu; wxMenu *menuNav = new wxMenu;
menuNav->Append(TabOrder_TabForward, wxT("Tab &forward\tCtrl-F"), menuNav->Append(TabOrder_TabForward, "Tab &forward\tCtrl-F",
wxT("Emulate a <Tab> press")); "Emulate a <Tab> press");
menuNav->Append(TabOrder_TabBackward, wxT("Tab &backward\tCtrl-B"), menuNav->Append(TabOrder_TabBackward, "Tab &backward\tCtrl-B",
wxT("Emulate a <Shift-Tab> press")); "Emulate a <Shift-Tab> press");
wxMenuBar *mbar = new wxMenuBar; wxMenuBar *mbar = new wxMenuBar;
mbar->Append(menuFile, wxT("&File")); mbar->Append(menuFile, "&File");
mbar->Append(menuNav, wxT("&Navigate")); mbar->Append(menuNav, "&Navigate");
SetMenuBar(mbar); SetMenuBar(mbar);
@@ -228,8 +228,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("Tab navigation sample\n(c) 2007 Vadim Zeitlin"), wxMessageBox("Tab navigation sample\n(c) 2007 Vadim Zeitlin",
wxT("About TabOrder wxWidgets Sample"), wxOK, this); "About TabOrder wxWidgets Sample", wxOK, this);
} }
void MyFrame::OnTabForward(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnTabForward(wxCommandEvent& WXUNUSED(event))
@@ -254,11 +254,11 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
wxString msg; wxString msg;
if ( focus ) if ( focus )
{ {
msg.Printf(wxT("Focus is at %s"), s_windowFocus->GetName().c_str()); msg.Printf("Focus is at %s", s_windowFocus->GetName().c_str());
} }
else else
{ {
msg = wxT("No focus"); msg = "No focus";
} }
SetStatusText(msg, StatusPane_Focus); SetStatusText(msg, StatusPane_Focus);
@@ -273,16 +273,16 @@ MyPanel::MyPanel(wxWindow *parent)
: wxPanel(parent, wxID_ANY) : wxPanel(parent, wxID_ANY)
{ {
wxNotebook *notebook = new wxNotebook(this, wxID_ANY); wxNotebook *notebook = new wxNotebook(this, wxID_ANY);
notebook->AddPage(CreateButtonPage(notebook), wxT("Button")); notebook->AddPage(CreateButtonPage(notebook), "Button");
notebook->AddPage(CreateTextPage(notebook), wxT("Text")); notebook->AddPage(CreateTextPage(notebook), "Text");
wxSizer *sizerV = new wxBoxSizer(wxVERTICAL); wxSizer *sizerV = new wxBoxSizer(wxVERTICAL);
sizerV->Add(notebook, wxSizerFlags(1).Expand()); sizerV->Add(notebook, wxSizerFlags(1).Expand());
wxListBox *lbox = new wxListBox(this, wxID_ANY); wxListBox *lbox = new wxListBox(this, wxID_ANY);
lbox->AppendString(wxT("Just a")); lbox->AppendString("Just a");
lbox->AppendString(wxT("simple")); lbox->AppendString("simple");
lbox->AppendString(wxT("listbox")); lbox->AppendString("listbox");
sizerV->Add(lbox, wxSizerFlags(1).Expand()); sizerV->Add(lbox, wxSizerFlags(1).Expand());
SetSizerAndFit(sizerV); SetSizerAndFit(sizerV);
@@ -294,10 +294,10 @@ wxWindow *MyPanel::CreateButtonPage(wxWindow *parent)
wxPanel *page = new wxPanel(parent); wxPanel *page = new wxPanel(parent);
wxSizer *sizerPage = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerPage = new wxBoxSizer(wxHORIZONTAL);
sizerPage->Add(new wxButton(page, wxID_ANY, wxT("&First")), flagsBorder); sizerPage->Add(new wxButton(page, wxID_ANY, "&First"), flagsBorder);
sizerPage->Add(new wxStaticText(page, wxID_ANY, wxT("[st&atic]")), sizerPage->Add(new wxStaticText(page, wxID_ANY, "[st&atic]"),
flagsBorder); flagsBorder);
sizerPage->Add(new wxButton(page, wxID_ANY, wxT("&Second")), flagsBorder); sizerPage->Add(new wxButton(page, wxID_ANY, "&Second"), flagsBorder);
page->SetSizer(sizerPage); page->SetSizer(sizerPage);
@@ -312,14 +312,14 @@ wxWindow *MyPanel::CreateTextPage(wxWindow *parent)
wxPanel *page = new wxPanel(parent); wxPanel *page = new wxPanel(parent);
wxSizer *sizerH = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerH = new wxBoxSizer(wxHORIZONTAL);
sizerH->Add(new wxStaticText(page, wxID_ANY, wxT("&Label:")), flagsBorder); sizerH->Add(new wxStaticText(page, wxID_ANY, "&Label:"), flagsBorder);
sizerH->Add(new MyTabTextCtrl(page, wxT("TAB ignored here")), flagsBorder); sizerH->Add(new MyTabTextCtrl(page, "TAB ignored here"), flagsBorder);
sizerPage->Add(sizerH, wxSizerFlags(1).Expand()); sizerPage->Add(sizerH, wxSizerFlags(1).Expand());
sizerH = new wxBoxSizer(wxHORIZONTAL); sizerH = new wxBoxSizer(wxHORIZONTAL);
sizerH->Add(new wxStaticText(page, wxID_ANY, wxT("&Another one:")), sizerH->Add(new wxStaticText(page, wxID_ANY, "&Another one:"),
flagsBorder); flagsBorder);
sizerH->Add(new MyTabTextCtrl(page, wxT("press Tab here"), wxTE_PROCESS_TAB), sizerH->Add(new MyTabTextCtrl(page, "press Tab here", wxTE_PROCESS_TAB),
flagsBorder); flagsBorder);
sizerPage->Add(sizerH, wxSizerFlags(1).Expand()); sizerPage->Add(sizerH, wxSizerFlags(1).Expand());

View File

@@ -70,7 +70,7 @@ bool MyApp::OnInit()
} }
// Create the main window // Create the main window
gs_dialog = new MyDialog(wxT("wxTaskBarIcon Test Dialog")); gs_dialog = new MyDialog("wxTaskBarIcon Test Dialog");
gs_dialog->Show(true); gs_dialog->Show(true);
@@ -102,22 +102,22 @@ MyDialog::MyDialog(const wxString& title)
( (
this, this,
wxID_ANY, wxID_ANY,
wxT("Press 'Hide me' to hide this window, Exit to quit.") "Press 'Hide me' to hide this window, Exit to quit."
), flags); ), flags);
sizerTop->Add(new wxStaticText sizerTop->Add(new wxStaticText
( (
this, this,
wxID_ANY, wxID_ANY,
wxT("Double-click on the taskbar icon to show me again.") "Double-click on the taskbar icon to show me again."
), flags); ), flags);
sizerTop->AddStretchSpacer()->SetMinSize(200, 50); sizerTop->AddStretchSpacer()->SetMinSize(200, 50);
wxSizer * const sizerBtns = new wxBoxSizer(wxHORIZONTAL); wxSizer * const sizerBtns = new wxBoxSizer(wxHORIZONTAL);
sizerBtns->Add(new wxButton(this, wxID_ABOUT, wxT("&About")), flags); sizerBtns->Add(new wxButton(this, wxID_ABOUT, "&About"), flags);
sizerBtns->Add(new wxButton(this, wxID_OK, wxT("&Hide")), flags); sizerBtns->Add(new wxButton(this, wxID_OK, "&Hide"), flags);
sizerBtns->Add(new wxButton(this, wxID_EXIT, wxT("E&xit")), flags); sizerBtns->Add(new wxButton(this, wxID_EXIT, "E&xit"), flags);
sizerTop->Add(sizerBtns, flags.Align(wxALIGN_CENTER_HORIZONTAL)); sizerTop->Add(sizerBtns, flags.Align(wxALIGN_CENTER_HORIZONTAL));
SetSizerAndFit(sizerTop); SetSizerAndFit(sizerTop);
@@ -132,14 +132,14 @@ MyDialog::MyDialog(const wxString& title)
"long tooltip whose length is\n" "long tooltip whose length is\n"
"greater than 64 characters.") ) "greater than 64 characters.") )
{ {
wxLogError(wxT("Could not set icon.")); wxLogError("Could not set icon.");
} }
#if defined(__WXOSX__) && wxOSX_USE_COCOA #if defined(__WXOSX__) && wxOSX_USE_COCOA
m_dockIcon = new MyTaskBarIcon(wxTBI_DOCK); m_dockIcon = new MyTaskBarIcon(wxTBI_DOCK);
if ( !m_dockIcon->SetIcon(wxICON(sample)) ) if ( !m_dockIcon->SetIcon(wxICON(sample)) )
{ {
wxLogError(wxT("Could not set icon.")); wxLogError("Could not set icon.");
} }
#endif #endif
} }
@@ -234,37 +234,37 @@ void MyTaskBarIcon::OnMenuSetNewIcon(wxCommandEvent&)
{ {
wxIcon icon(smile_xpm); wxIcon icon(smile_xpm);
if (!SetIcon(icon, wxT("wxTaskBarIcon Sample - a different icon"))) if (!SetIcon(icon, "wxTaskBarIcon Sample - a different icon"))
wxMessageBox(wxT("Could not set new icon.")); wxMessageBox("Could not set new icon.");
} }
void MyTaskBarIcon::OnMenuSub(wxCommandEvent&) void MyTaskBarIcon::OnMenuSub(wxCommandEvent&)
{ {
wxMessageBox(wxT("You clicked on a submenu!")); wxMessageBox("You clicked on a submenu!");
} }
// Overridables // Overridables
wxMenu *MyTaskBarIcon::CreatePopupMenu() wxMenu *MyTaskBarIcon::CreatePopupMenu()
{ {
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
menu->Append(PU_RESTORE, wxT("&Restore main window")); menu->Append(PU_RESTORE, "&Restore main window");
menu->AppendSeparator(); menu->AppendSeparator();
menu->Append(PU_NEW_ICON, wxT("&Set New Icon")); menu->Append(PU_NEW_ICON, "&Set New Icon");
menu->AppendSeparator(); menu->AppendSeparator();
menu->AppendCheckItem(PU_CHECKMARK, wxT("Test &check mark")); menu->AppendCheckItem(PU_CHECKMARK, "Test &check mark");
menu->AppendSeparator(); menu->AppendSeparator();
wxMenu *submenu = new wxMenu; wxMenu *submenu = new wxMenu;
submenu->Append(PU_SUB1, wxT("One submenu")); submenu->Append(PU_SUB1, "One submenu");
submenu->AppendSeparator(); submenu->AppendSeparator();
submenu->Append(PU_SUB2, wxT("Another submenu")); submenu->Append(PU_SUB2, "Another submenu");
menu->Append(PU_SUBMAIN, wxT("Submenu"), submenu); menu->Append(PU_SUBMAIN, "Submenu", submenu);
/* OSX has built-in quit menu for the dock menu, but not for the status item */ /* OSX has built-in quit menu for the dock menu, but not for the status item */
#ifdef __WXOSX__ #ifdef __WXOSX__
if ( OSXIsStatusItem() ) if ( OSXIsStatusItem() )
#endif #endif
{ {
menu->AppendSeparator(); menu->AppendSeparator();
menu->Append(PU_EXIT, wxT("E&xit")); menu->Append(PU_EXIT, "E&xit");
} }
return menu; return menu;
} }

View File

@@ -140,19 +140,19 @@ bool MyApp::OnInit()
wxTaskBarJumpListItem *item1 = new wxTaskBarJumpListItem( wxTaskBarJumpListItem *item1 = new wxTaskBarJumpListItem(
NULL, NULL,
wxTASKBAR_JUMP_LIST_TASK, wxTASKBAR_JUMP_LIST_TASK,
wxT("Task 1"), "Task 1",
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
wxEmptyString, wxEmptyString,
wxT("Test Task"), "Test Task",
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
0); 0);
wxTaskBarJumpListItem *item2 = new wxTaskBarJumpListItem( wxTaskBarJumpListItem *item2 = new wxTaskBarJumpListItem(
NULL, NULL,
wxTASKBAR_JUMP_LIST_TASK, wxTASKBAR_JUMP_LIST_TASK,
wxT("Task 2"), "Task 2",
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
wxEmptyString, wxEmptyString,
wxT("Test Task"), "Test Task",
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
0); 0);
jumpList.GetTasks().Append(item1); jumpList.GetTasks().Append(item1);
@@ -163,14 +163,14 @@ bool MyApp::OnInit()
jumpList.ShowFrequentCategory(); jumpList.ShowFrequentCategory();
wxTaskBarJumpListCategory* customCategory = wxTaskBarJumpListCategory* customCategory =
new wxTaskBarJumpListCategory(&jumpList, wxT("Custom")); new wxTaskBarJumpListCategory(&jumpList, "Custom");
wxTaskBarJumpListItem* item3 = new wxTaskBarJumpListItem( wxTaskBarJumpListItem* item3 = new wxTaskBarJumpListItem(
customCategory, customCategory,
wxTASKBAR_JUMP_LIST_DESTINATION, wxTASKBAR_JUMP_LIST_DESTINATION,
wxT("Help"), "Help",
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
wxT("--help"), "--help",
wxT("wxTaskBarButton help."), "wxTaskBarButton help.",
wxStandardPaths::Get().GetExecutablePath(), wxStandardPaths::Get().GetExecutablePath(),
0); 0);
customCategory->Append(item3); customCategory->Append(item3);
@@ -213,7 +213,7 @@ MyFrame::MyFrame(const wxString& title)
// SetProgressValue section. // SetProgressValue section.
wxStaticBoxSizer *spvSizer = wxStaticBoxSizer *spvSizer =
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetProgressValue")); new wxStaticBoxSizer(wxVERTICAL, panel, "SetProgressValue");
int flags = wxSL_MIN_MAX_LABELS | wxSL_VALUE_LABEL | wxSL_AUTOTICKS; int flags = wxSL_MIN_MAX_LABELS | wxSL_VALUE_LABEL | wxSL_AUTOTICKS;
m_slider = new wxSlider(spvSizer->GetStaticBox(), ProgressValueSlider, m_slider = new wxSlider(spvSizer->GetStaticBox(), ProgressValueSlider,
0, 0, 100, 0, 0, 100,
@@ -234,15 +234,15 @@ MyFrame::MyFrame(const wxString& title)
1, wxRA_SPECIFY_ROWS); 1, wxRA_SPECIFY_ROWS);
// SetThumbnailTooltip section. // SetThumbnailTooltip section.
wxStaticBoxSizer *sttSizer = wxStaticBoxSizer *sttSizer =
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetThumbnailTooltip")); new wxStaticBoxSizer(wxVERTICAL, panel, "SetThumbnailTooltip");
m_textCtrl = new wxTextCtrl(panel, wxID_ANY); m_textCtrl = new wxTextCtrl(panel, wxID_ANY);
wxButton *btn = new wxButton(panel, ThumbnailTooltipSetBtn, wxT("Set")); wxButton *btn = new wxButton(panel, ThumbnailTooltipSetBtn, "Set");
sttSizer->Add(m_textCtrl, 1, wxEXPAND | wxALL, 2); sttSizer->Add(m_textCtrl, 1, wxEXPAND | wxALL, 2);
sttSizer->Add(btn, 1, wxEXPAND | wxALL, 2); sttSizer->Add(btn, 1, wxEXPAND | wxALL, 2);
// SetProgressState section. // SetProgressState section.
wxStaticBoxSizer *spsSizer = wxStaticBoxSizer *spsSizer =
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetProgressState")); new wxStaticBoxSizer(wxVERTICAL, panel, "SetProgressState");
const wxString choices[] = const wxString choices[] =
{ {
"wxNoProgress", "wxNoProgress",
@@ -258,33 +258,33 @@ MyFrame::MyFrame(const wxString& title)
// SetOverlayIcon section. // SetOverlayIcon section.
wxStaticBoxSizer *soiSizer = wxStaticBoxSizer *soiSizer =
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetOverlayIcon")); new wxStaticBoxSizer(wxVERTICAL, panel, "SetOverlayIcon");
wxButton *setOverlayIconBtn = wxButton *setOverlayIconBtn =
new wxButton(panel, SetOverlayIconBtn, wxT("Set Overlay Icon")); new wxButton(panel, SetOverlayIconBtn, "Set Overlay Icon");
wxButton *clearOverlayIconBtn = wxButton *clearOverlayIconBtn =
new wxButton(panel, ClearOverlayIconBtn, wxT("Clear Overlay Icon")); new wxButton(panel, ClearOverlayIconBtn, "Clear Overlay Icon");
soiSizer->Add(setOverlayIconBtn, 1, wxEXPAND | wxALL, 2); soiSizer->Add(setOverlayIconBtn, 1, wxEXPAND | wxALL, 2);
soiSizer->Add(clearOverlayIconBtn, 1, wxEXPAND | wxALL, 2); soiSizer->Add(clearOverlayIconBtn, 1, wxEXPAND | wxALL, 2);
// SetThumbnailClip section. // SetThumbnailClip section.
wxStaticBoxSizer *stcSizer = wxStaticBoxSizer *stcSizer =
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetThumbnailClip")); new wxStaticBoxSizer(wxVERTICAL, panel, "SetThumbnailClip");
wxButton *setThumbnailClipBtn = wxButton *setThumbnailClipBtn =
new wxButton(panel, SetThumbnailClipBtn, wxT("Set Thumbnail Clip")); new wxButton(panel, SetThumbnailClipBtn, "Set Thumbnail Clip");
wxButton *restoreThumbnailClipBtn = wxButton *restoreThumbnailClipBtn =
new wxButton(panel, RestoreThumbnailClipBtn, new wxButton(panel, RestoreThumbnailClipBtn,
wxT("Restore Thumbnail Clip")); "Restore Thumbnail Clip");
stcSizer->Add(setThumbnailClipBtn, 1, wxEXPAND | wxALL, 2); stcSizer->Add(setThumbnailClipBtn, 1, wxEXPAND | wxALL, 2);
stcSizer->Add(restoreThumbnailClipBtn, 1, wxEXPAND | wxALL, 2); stcSizer->Add(restoreThumbnailClipBtn, 1, wxEXPAND | wxALL, 2);
// Thumbnail Toolbar Buttons section. // Thumbnail Toolbar Buttons section.
wxStaticBoxSizer *ttbSizer = wxStaticBoxSizer *ttbSizer =
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("ThumbBar Buttons")); new wxStaticBoxSizer(wxVERTICAL, panel, "ThumbBar Buttons");
wxButton *addThumbBarButtonBtn = wxButton *addThumbBarButtonBtn =
new wxButton(panel, AddThumbBarButtonBtn, wxT("Add ThumbBar Button")); new wxButton(panel, AddThumbBarButtonBtn, "Add ThumbBar Button");
wxButton *showThumbnailToolbarBtn = wxButton *showThumbnailToolbarBtn =
new wxButton(panel, RemoveThumbBarButtonBtn, new wxButton(panel, RemoveThumbBarButtonBtn,
wxT("Remove Last ThumbBar Button")); "Remove Last ThumbBar Button");
ttbSizer->Add(addThumbBarButtonBtn, 1, wxEXPAND | wxALL, 2); ttbSizer->Add(addThumbBarButtonBtn, 1, wxEXPAND | wxALL, 2);
ttbSizer->Add(showThumbnailToolbarBtn, 1, wxEXPAND | wxALL, 2); ttbSizer->Add(showThumbnailToolbarBtn, 1, wxEXPAND | wxALL, 2);
@@ -297,7 +297,7 @@ MyFrame::MyFrame(const wxString& title)
gs->Add(ttbSizer, 0, wxEXPAND); gs->Add(ttbSizer, 0, wxEXPAND);
wxStaticText *text = new wxStaticText( wxStaticText *text = new wxStaticText(
panel, wxID_ANY, wxT("Welcome to wxTaskBarButton sample")); panel, wxID_ANY, "Welcome to wxTaskBarButton sample");
mainSizer->Add(text, 0, wxALIGN_CENTRE_HORIZONTAL); mainSizer->Add(text, 0, wxALIGN_CENTRE_HORIZONTAL);
mainSizer->Add(gs); mainSizer->Add(gs);

File diff suppressed because it is too large Load Diff

View File

@@ -356,29 +356,29 @@ MyFrame::MyFrame(const wxString& title)
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(THREAD_CLEAR, wxT("&Clear log\tCtrl-L")); menuFile->Append(THREAD_CLEAR, "&Clear log\tCtrl-L");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(THREAD_QUIT, wxT("E&xit\tAlt-X")); menuFile->Append(THREAD_QUIT, "E&xit\tAlt-X");
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
wxMenu *menuThread = new wxMenu; wxMenu *menuThread = new wxMenu;
menuThread->Append(THREAD_START_THREAD, wxT("&Start a new thread\tCtrl-N")); menuThread->Append(THREAD_START_THREAD, "&Start a new thread\tCtrl-N");
menuThread->Append(THREAD_START_THREADS, wxT("Start &many threads at once")); menuThread->Append(THREAD_START_THREADS, "Start &many threads at once");
menuThread->Append(THREAD_STOP_THREAD, wxT("S&top the last spawned thread\tCtrl-S")); menuThread->Append(THREAD_STOP_THREAD, "S&top the last spawned thread\tCtrl-S");
menuThread->AppendSeparator(); menuThread->AppendSeparator();
menuThread->Append(THREAD_PAUSE_THREAD, wxT("&Pause the last spawned running thread\tCtrl-P")); menuThread->Append(THREAD_PAUSE_THREAD, "&Pause the last spawned running thread\tCtrl-P");
menuThread->Append(THREAD_RESUME_THREAD, wxT("&Resume the first suspended thread\tCtrl-R")); menuThread->Append(THREAD_RESUME_THREAD, "&Resume the first suspended thread\tCtrl-R");
menuThread->AppendSeparator(); menuThread->AppendSeparator();
menuThread->Append(THREAD_START_WORKER, wxT("Start a &worker thread\tCtrl-W")); menuThread->Append(THREAD_START_WORKER, "Start a &worker thread\tCtrl-W");
menuThread->Append(THREAD_EXEC_MAIN, wxT("&Launch a program from main thread\tF5")); menuThread->Append(THREAD_EXEC_MAIN, "&Launch a program from main thread\tF5");
menuThread->Append(THREAD_START_GUI_THREAD, wxT("Launch a &GUI thread\tF6")); menuThread->Append(THREAD_START_GUI_THREAD, "Launch a &GUI thread\tF6");
menuBar->Append(menuThread, wxT("&Thread")); menuBar->Append(menuThread, "&Thread");
wxMenu *menuHelp = new wxMenu; wxMenu *menuHelp = new wxMenu;
menuHelp->Append(THREAD_SHOWCPUS, wxT("&Show CPU count")); menuHelp->Append(THREAD_SHOWCPUS, "&Show CPU count");
menuHelp->AppendSeparator(); menuHelp->AppendSeparator();
menuHelp->Append(THREAD_ABOUT, wxT("&About")); menuHelp->Append(THREAD_ABOUT, "&About");
menuBar->Append(menuHelp, wxT("&Help")); menuBar->Append(menuHelp, "&Help");
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -488,7 +488,7 @@ MyThread *MyFrame::CreateThread()
if ( thread->Create() != wxTHREAD_NO_ERROR ) if ( thread->Create() != wxTHREAD_NO_ERROR )
{ {
wxLogError(wxT("Can't create thread!")); wxLogError("Can't create thread!");
} }
wxCriticalSectionLocker enter(wxGetApp().m_critsect); wxCriticalSectionLocker enter(wxGetApp().m_critsect);
@@ -515,7 +515,7 @@ void MyFrame::UpdateThreadStatus()
m_nRunning = nRunning; m_nRunning = nRunning;
m_nCount = nCount; m_nCount = nCount;
wxLogStatus(this, wxT("%u threads total, %u running."), unsigned(nCount), unsigned(nRunning)); wxLogStatus(this, "%u threads total, %u running.", unsigned(nCount), unsigned(nRunning));
} }
//else: avoid flicker - don't print anything //else: avoid flicker - don't print anything
} }
@@ -535,8 +535,8 @@ void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) )
{ {
static long s_num; static long s_num;
s_num = wxGetNumberFromUser(wxT("How many threads to start: "), wxT(""), s_num = wxGetNumberFromUser("How many threads to start: ", "",
wxT("wxThread sample"), s_num, 1, 10000, this); "wxThread sample", s_num, 1, 10000, this);
if ( s_num == -1 ) if ( s_num == -1 )
{ {
s_num = 10; s_num = 10;
@@ -568,7 +568,7 @@ void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) )
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
wxString msg; wxString msg;
msg.Printf(wxT("%d new threads created."), count); msg.Printf("%d new threads created.", count);
SetStatusText(msg, 1); SetStatusText(msg, 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -585,11 +585,11 @@ void MyFrame::OnStartThread(wxCommandEvent& WXUNUSED(event) )
if ( thread->Run() != wxTHREAD_NO_ERROR ) if ( thread->Run() != wxTHREAD_NO_ERROR )
{ {
wxLogError(wxT("Can't start thread!")); wxLogError("Can't start thread!");
} }
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("New thread started."), 1); SetStatusText("New thread started.", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -602,7 +602,7 @@ void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) )
// stop the last thread // stop the last thread
if ( wxGetApp().m_threads.IsEmpty() ) if ( wxGetApp().m_threads.IsEmpty() )
{ {
wxLogError(wxT("No thread to stop!")); wxLogError("No thread to stop!");
} }
else else
{ {
@@ -617,7 +617,7 @@ void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) )
toDelete->Delete(); toDelete->Delete();
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Last thread stopped."), 1); SetStatusText("Last thread stopped.", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
} }
@@ -633,14 +633,14 @@ void MyFrame::OnResumeThread(wxCommandEvent& WXUNUSED(event) )
if ( n == count ) if ( n == count )
{ {
wxLogError(wxT("No thread to resume!")); wxLogError("No thread to resume!");
} }
else else
{ {
wxGetApp().m_threads[n]->Resume(); wxGetApp().m_threads[n]->Resume();
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Thread resumed."), 1); SetStatusText("Thread resumed.", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
} }
@@ -656,14 +656,14 @@ void MyFrame::OnPauseThread(wxCommandEvent& WXUNUSED(event) )
if ( n < 0 ) if ( n < 0 )
{ {
wxLogError(wxT("No thread to pause!")); wxLogError("No thread to pause!");
} }
else else
{ {
wxGetApp().m_threads[n]->Pause(); wxGetApp().m_threads[n]->Pause();
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
SetStatusText(wxT("Thread paused."), 1); SetStatusText("Thread paused.", 1);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
} }
@@ -693,7 +693,7 @@ void MyFrame::OnExecMain(wxCommandEvent& WXUNUSED(event))
if (cmd.IsEmpty()) if (cmd.IsEmpty())
return; // user clicked cancel return; // user clicked cancel
wxLogMessage(wxT("The exit code from the main program is %ld"), wxLogMessage("The exit code from the main program is %ld",
EXEC(cmd)); EXEC(cmd));
} }
@@ -705,19 +705,19 @@ void MyFrame::OnShowCPUs(wxCommandEvent& WXUNUSED(event))
switch ( nCPUs ) switch ( nCPUs )
{ {
case -1: case -1:
msg = wxT("Unknown number of CPUs"); msg = "Unknown number of CPUs";
break; break;
case 0: case 0:
msg = wxT("WARNING: you're running without any CPUs!"); msg = "WARNING: you're running without any CPUs!";
break; break;
case 1: case 1:
msg = wxT("This system only has one CPU."); msg = "This system only has one CPU.";
break; break;
default: default:
msg.Printf(wxT("This system has %d CPUs"), nCPUs); msg.Printf("This system has %d CPUs", nCPUs);
} }
wxLogMessage(msg); wxLogMessage(msg);
@@ -726,11 +726,11 @@ void MyFrame::OnShowCPUs(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{ {
wxMessageDialog dialog(this, wxMessageDialog dialog(this,
wxT("wxWidgets multithreaded application sample\n") "wxWidgets multithreaded application sample\n"
wxT("(c) 1998 Julian Smart, Guilhem Lavaux\n") "(c) 1998 Julian Smart, Guilhem Lavaux\n"
wxT("(c) 2000 Robert Roebling\n") "(c) 2000 Robert Roebling\n"
wxT("(c) 1999,2009 Vadim Zeitlin"), "(c) 1999,2009 Vadim Zeitlin",
wxT("About wxThread sample"), "About wxThread sample",
wxOK | wxICON_INFORMATION); wxOK | wxICON_INFORMATION);
dialog.ShowModal(); dialog.ShowModal();
@@ -752,14 +752,14 @@ void MyFrame::OnStartWorker(wxCommandEvent& WXUNUSED(event))
if ( thread->Create() != wxTHREAD_NO_ERROR ) if ( thread->Create() != wxTHREAD_NO_ERROR )
{ {
wxLogError(wxT("Can't create thread!")); wxLogError("Can't create thread!");
return; return;
} }
m_dlgProgress = new wxProgressDialog m_dlgProgress = new wxProgressDialog
( (
wxT("Progress dialog"), "Progress dialog",
wxT("Wait until the thread terminates or press [Cancel]"), "Wait until the thread terminates or press [Cancel]",
100, 100,
this, this,
wxPD_CAN_ABORT | wxPD_CAN_ABORT |
@@ -848,7 +848,7 @@ MyImageDialog::MyImageDialog(wxFrame *parent)
if ( m_thread.Create() != wxTHREAD_NO_ERROR || if ( m_thread.Create() != wxTHREAD_NO_ERROR ||
m_thread.Run() != wxTHREAD_NO_ERROR ) m_thread.Run() != wxTHREAD_NO_ERROR )
{ {
wxLogError(wxT("Can't create/run thread!")); wxLogError("Can't create/run thread!");
return; return;
} }
} }

View File

@@ -95,7 +95,7 @@ class MyFrame: public wxFrame
public: public:
MyFrame(wxFrame *parent, MyFrame(wxFrame *parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
const wxString& title = wxT("wxToolBar Sample"), const wxString& title = "wxToolBar Sample",
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE); long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
@@ -306,13 +306,13 @@ bool MyApp::OnInit()
// Create the main frame window // Create the main frame window
MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY, MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY,
wxT("wxToolBar Sample"), "wxToolBar Sample",
wxPoint(100, 100), wxSize(650, 350)); wxPoint(100, 100), wxSize(650, 350));
frame->Show(true); frame->Show(true);
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
frame->SetStatusText(wxT("Hello, wxWidgets")); frame->SetStatusText("Hello, wxWidgets");
#endif #endif
wxInitAllImageHandlers(); wxInitAllImageHandlers();
@@ -421,41 +421,41 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
// size to fit the biggest icon used anyhow but it doesn't hurt neither // size to fit the biggest icon used anyhow but it doesn't hurt neither
toolBar->SetToolBitmapSize(wxSize(w, h)); toolBar->SetToolBitmapSize(wxSize(w, h));
toolBar->AddTool(wxID_NEW, wxT("New"), toolBar->AddTool(wxID_NEW, "New",
toolBarBitmaps[Tool_new], wxNullBitmap, wxITEM_DROPDOWN, toolBarBitmaps[Tool_new], wxNullBitmap, wxITEM_DROPDOWN,
wxT("New file"), wxT("This is help for new file tool")); "New file", "This is help for new file tool");
wxMenu* menu = new wxMenu; wxMenu* menu = new wxMenu;
menu->Append(wxID_ANY, wxT("&First dummy item")); menu->Append(wxID_ANY, "&First dummy item");
menu->Append(wxID_ANY, wxT("&Second dummy item")); menu->Append(wxID_ANY, "&Second dummy item");
menu->AppendSeparator(); menu->AppendSeparator();
menu->Append(wxID_EXIT, wxT("Exit")); menu->Append(wxID_EXIT, "Exit");
toolBar->SetDropdownMenu(wxID_NEW, menu); toolBar->SetDropdownMenu(wxID_NEW, menu);
toolBar->AddTool(wxID_OPEN, wxT("Open"), toolBar->AddTool(wxID_OPEN, "Open",
toolBarBitmaps[Tool_open], wxNullBitmap, wxITEM_NORMAL, toolBarBitmaps[Tool_open], wxNullBitmap, wxITEM_NORMAL,
wxT("Open file"), wxT("This is help for open file tool")); "Open file", "This is help for open file tool");
#if USE_CONTROLS_IN_TOOLBAR #if USE_CONTROLS_IN_TOOLBAR
// adding a combo to a vertical toolbar is not very smart // adding a combo to a vertical toolbar is not very smart
if ( !toolBar->IsVertical() ) if ( !toolBar->IsVertical() )
{ {
wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, wxSize(100,-1) ); wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, wxSize(100,-1) );
combo->Append(wxT("This")); combo->Append("This");
combo->Append(wxT("is a")); combo->Append("is a");
combo->Append(wxT("combobox")); combo->Append("combobox");
combo->Append(wxT("in a")); combo->Append("in a");
combo->Append(wxT("toolbar")); combo->Append("toolbar");
toolBar->AddControl(combo, wxT("Combo Label")); toolBar->AddControl(combo, "Combo Label");
} }
#endif // USE_CONTROLS_IN_TOOLBAR #endif // USE_CONTROLS_IN_TOOLBAR
toolBar->AddTool(wxID_SAVE, wxT("Save"), toolBarBitmaps[Tool_save], wxT("Toggle button 1"), wxITEM_CHECK); toolBar->AddTool(wxID_SAVE, "Save", toolBarBitmaps[Tool_save], "Toggle button 1", wxITEM_CHECK);
toolBar->AddSeparator(); toolBar->AddSeparator();
toolBar->AddTool(wxID_COPY, wxT("Copy"), toolBarBitmaps[Tool_copy], wxT("Toggle button 2"), wxITEM_CHECK); toolBar->AddTool(wxID_COPY, "Copy", toolBarBitmaps[Tool_copy], "Toggle button 2", wxITEM_CHECK);
toolBar->AddTool(wxID_CUT, wxT("Cut"), toolBarBitmaps[Tool_cut], wxT("Toggle/Untoggle help button")); toolBar->AddTool(wxID_CUT, "Cut", toolBarBitmaps[Tool_cut], "Toggle/Untoggle help button");
toolBar->AddTool(wxID_PASTE, wxT("Paste"), toolBarBitmaps[Tool_paste], wxT("Paste")); toolBar->AddTool(wxID_PASTE, "Paste", toolBarBitmaps[Tool_paste], "Paste");
toolBar->AddSeparator(); toolBar->AddSeparator();
if ( m_useCustomDisabled ) if ( m_useCustomDisabled )
@@ -471,13 +471,13 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
dc.DrawLine(0, 0, w, h); dc.DrawLine(0, 0, w, h);
} }
toolBar->AddTool(wxID_PRINT, wxT("Print"), toolBarBitmaps[Tool_print], toolBar->AddTool(wxID_PRINT, "Print", toolBarBitmaps[Tool_print],
bmpDisabled); bmpDisabled);
} }
else else
{ {
toolBar->AddTool(wxID_PRINT, wxT("Print"), toolBarBitmaps[Tool_print], toolBar->AddTool(wxID_PRINT, "Print", toolBarBitmaps[Tool_print],
wxT("Delete this tool. This is a very long tooltip to test whether it does the right thing when the tooltip is more than Windows can cope with.")); "Delete this tool. This is a very long tooltip to test whether it does the right thing when the tooltip is more than Windows can cope with.");
} }
m_nPrint = 1; m_nPrint = 1;
@@ -485,7 +485,7 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
// add a stretchable space before the "Help" button to make it // add a stretchable space before the "Help" button to make it
// right-aligned // right-aligned
toolBar->AddStretchableSpace(); toolBar->AddStretchableSpace();
toolBar->AddTool(wxID_HELP, wxT("Help"), toolBarBitmaps[Tool_help], wxT("Help button"), wxITEM_CHECK); toolBar->AddTool(wxID_HELP, "Help", toolBarBitmaps[Tool_help], "Help button", wxITEM_CHECK);
if ( !m_pathBmp.empty() ) if ( !m_pathBmp.empty() )
{ {
@@ -497,7 +497,7 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
img = img.GetSubImage(wxRect(0, 0, w, h)); img = img.GetSubImage(wxRect(0, 0, w, h));
toolBar->AddSeparator(); toolBar->AddSeparator();
toolBar->AddTool(wxID_ANY, wxT("Custom"), img); toolBar->AddTool(wxID_ANY, "Custom", img);
} }
} }
@@ -544,84 +544,84 @@ MyFrame::MyFrame(wxFrame* parent,
// Make a menubar // Make a menubar
wxMenu *tbarMenu = new wxMenu; wxMenu *tbarMenu = new wxMenu;
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_TOOLBAR, tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_TOOLBAR,
wxT("Toggle &toolbar\tCtrl-Z"), "Toggle &toolbar\tCtrl-Z",
wxT("Show or hide the toolbar")); "Show or hide the toolbar");
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR, tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
wxT("Toggle &another toolbar\tCtrl-A"), "Toggle &another toolbar\tCtrl-A",
wxT("Show/hide another test toolbar")); "Show/hide another test toolbar");
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_HORIZONTAL_TEXT, tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_HORIZONTAL_TEXT,
wxT("Toggle hori&zontal text\tCtrl-H"), "Toggle hori&zontal text\tCtrl-H",
wxT("Show text under/alongside the icon")); "Show text under/alongside the icon");
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARSIZE, tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARSIZE,
wxT("&Toggle toolbar size\tCtrl-S"), "&Toggle toolbar size\tCtrl-S",
wxT("Toggle between big/small toolbar")); "Toggle between big/small toolbar");
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARROWS, tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARROWS,
wxT("Toggle number of &rows\tCtrl-R"), "Toggle number of &rows\tCtrl-R",
wxT("Toggle number of toolbar rows between 1 and 2")); "Toggle number of toolbar rows between 1 and 2");
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLTIPS, tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLTIPS,
wxT("Show &tooltips\tCtrl-L"), "Show &tooltips\tCtrl-L",
wxT("Show tooltips for the toolbar tools")); "Show tooltips for the toolbar tools");
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLECUSTOMDISABLED, tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLECUSTOMDISABLED,
wxT("Use c&ustom disabled images\tCtrl-U"), "Use c&ustom disabled images\tCtrl-U",
wxT("Switch between using system-generated and custom disabled images")); "Switch between using system-generated and custom disabled images");
tbarMenu->AppendSeparator(); tbarMenu->AppendSeparator();
tbarMenu->AppendRadioItem(IDM_TOOLBAR_TOP_ORIENTATION, tbarMenu->AppendRadioItem(IDM_TOOLBAR_TOP_ORIENTATION,
wxT("Set toolbar at the top of the window"), "Set toolbar at the top of the window",
wxT("Set toolbar at the top of the window")); "Set toolbar at the top of the window");
tbarMenu->AppendRadioItem(IDM_TOOLBAR_LEFT_ORIENTATION, tbarMenu->AppendRadioItem(IDM_TOOLBAR_LEFT_ORIENTATION,
wxT("Set toolbar at the left of the window"), "Set toolbar at the left of the window",
wxT("Set toolbar at the left of the window")); "Set toolbar at the left of the window");
tbarMenu->AppendRadioItem(IDM_TOOLBAR_BOTTOM_ORIENTATION, tbarMenu->AppendRadioItem(IDM_TOOLBAR_BOTTOM_ORIENTATION,
wxT("Set toolbar at the bottom of the window"), "Set toolbar at the bottom of the window",
wxT("Set toolbar at the bottom of the window")); "Set toolbar at the bottom of the window");
tbarMenu->AppendRadioItem(IDM_TOOLBAR_RIGHT_ORIENTATION, tbarMenu->AppendRadioItem(IDM_TOOLBAR_RIGHT_ORIENTATION,
wxT("Set toolbar at the right edge of the window"), "Set toolbar at the right edge of the window",
wxT("Set toolbar at the right edge of the window")); "Set toolbar at the right edge of the window");
tbarMenu->AppendSeparator(); tbarMenu->AppendSeparator();
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_TEXT, wxT("Show &text\tCtrl-Alt-T")); tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_TEXT, "Show &text\tCtrl-Alt-T");
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_ICONS, wxT("Show &icons\tCtrl-Alt-I")); tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_ICONS, "Show &icons\tCtrl-Alt-I");
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, wxT("Show &both\tCtrl-Alt-B")); tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, "Show &both\tCtrl-Alt-B");
tbarMenu->AppendSeparator(); tbarMenu->AppendSeparator();
tbarMenu->Append(IDM_TOOLBAR_BG_COL, wxT("Choose bac&kground colour...")); tbarMenu->Append(IDM_TOOLBAR_BG_COL, "Choose bac&kground colour...");
tbarMenu->Append(IDM_TOOLBAR_CUSTOM_PATH, wxT("Custom &bitmap...\tCtrl-B")); tbarMenu->Append(IDM_TOOLBAR_CUSTOM_PATH, "Custom &bitmap...\tCtrl-B");
wxMenu *toolMenu = new wxMenu; wxMenu *toolMenu = new wxMenu;
toolMenu->Append(IDM_TOOLBAR_ENABLEPRINT, wxT("&Enable print button\tCtrl-E")); toolMenu->Append(IDM_TOOLBAR_ENABLEPRINT, "&Enable print button\tCtrl-E");
toolMenu->Append(IDM_TOOLBAR_DELETEPRINT, wxT("&Delete print button\tCtrl-D")); toolMenu->Append(IDM_TOOLBAR_DELETEPRINT, "&Delete print button\tCtrl-D");
toolMenu->Append(IDM_TOOLBAR_INSERTPRINT, wxT("&Insert print button\tCtrl-I")); toolMenu->Append(IDM_TOOLBAR_INSERTPRINT, "&Insert print button\tCtrl-I");
toolMenu->Append(IDM_TOOLBAR_TOGGLEHELP, wxT("Toggle &help button\tCtrl-T")); toolMenu->Append(IDM_TOOLBAR_TOGGLEHELP, "Toggle &help button\tCtrl-T");
toolMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLESEARCH, wxT("Toggle &search field\tCtrl-F")); toolMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLESEARCH, "Toggle &search field\tCtrl-F");
toolMenu->AppendSeparator(); toolMenu->AppendSeparator();
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN1, wxT("Toggle &1st radio button\tCtrl-1")); toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN1, "Toggle &1st radio button\tCtrl-1");
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN2, wxT("Toggle &2nd radio button\tCtrl-2")); toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN2, "Toggle &2nd radio button\tCtrl-2");
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN3, wxT("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, wxT("Change tooltip of \"New\""));
toolMenu->AppendSeparator(); toolMenu->AppendSeparator();
toolMenu->Append(IDM_TOOLBAR_INC_TOOL_SPACING, wxT("Increase spacing\tCtrl-+")); toolMenu->Append(IDM_TOOLBAR_INC_TOOL_SPACING, "Increase spacing\tCtrl-+");
toolMenu->Append(IDM_TOOLBAR_DEC_TOOL_SPACING, wxT("Decrease spacing\tCtrl--")); toolMenu->Append(IDM_TOOLBAR_DEC_TOOL_SPACING, "Decrease spacing\tCtrl--");
wxMenu *fileMenu = new wxMenu; wxMenu *fileMenu = new wxMenu;
fileMenu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"), wxT("Quit toolbar sample") ); fileMenu->Append(wxID_EXIT, "E&xit\tAlt-X", "Quit toolbar sample" );
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(wxID_HELP, wxT("&About"), wxT("About toolbar sample")); helpMenu->Append(wxID_HELP, "&About", "About toolbar sample");
wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE ); wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE );
menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(fileMenu, "&File");
menuBar->Append(tbarMenu, wxT("&Toolbar")); menuBar->Append(tbarMenu, "&Toolbar");
menuBar->Append(toolMenu, wxT("Tool&s")); menuBar->Append(toolMenu, "Tool&s");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -740,12 +740,12 @@ void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event))
m_tbar->SetMargins(4, 4); m_tbar->SetMargins(4, 4);
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_1, wxT("First"), wxBITMAP(new)); m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_1, "First", wxBITMAP(new));
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_2, wxT("Second"), wxBITMAP(open)); m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_2, "Second", wxBITMAP(open));
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_3, wxT("Third"), wxBITMAP(save)); m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_3, "Third", wxBITMAP(save));
m_tbar->AddSeparator(); m_tbar->AddSeparator();
m_tbar->AddTool(wxID_HELP, wxT("Help"), wxBITMAP(help)); m_tbar->AddTool(wxID_HELP, "Help", wxBITMAP(help));
m_tbar->AddTool(IDM_TOOLBAR_OTHER_4, wxT("Disabled"), wxBITMAP(cut), wxBITMAP(paste)); m_tbar->AddTool(IDM_TOOLBAR_OTHER_4, "Disabled", wxBITMAP(cut), wxBITMAP(paste));
m_tbar->EnableTool(IDM_TOOLBAR_OTHER_4, false); m_tbar->EnableTool(IDM_TOOLBAR_OTHER_4, false);
m_tbar->Realize(); m_tbar->Realize();
@@ -815,17 +815,17 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& event) void MyFrame::OnAbout(wxCommandEvent& event)
{ {
if ( event.IsChecked() ) if ( event.IsChecked() )
m_textWindow->AppendText( wxT("Help button down now.\n") ); m_textWindow->AppendText( "Help button down now.\n" );
else else
m_textWindow->AppendText( wxT("Help button up now.\n") ); m_textWindow->AppendText( "Help button up now.\n" );
(void)wxMessageBox(wxT("wxWidgets toolbar sample"), wxT("About wxToolBar")); (void)wxMessageBox("wxWidgets toolbar sample", "About wxToolBar");
} }
void MyFrame::OnToolLeftClick(wxCommandEvent& event) void MyFrame::OnToolLeftClick(wxCommandEvent& event)
{ {
wxString str; wxString str;
str.Printf( wxT("Clicked on tool %d\n"), event.GetId()); str.Printf( "Clicked on tool %d\n", event.GetId());
m_textWindow->AppendText( str ); m_textWindow->AppendText( str );
if (event.GetId() == wxID_COPY) if (event.GetId() == wxID_COPY)
@@ -847,13 +847,13 @@ void MyFrame::OnToolLeftClick(wxCommandEvent& event)
void MyFrame::OnToolRightClick(wxCommandEvent& event) void MyFrame::OnToolRightClick(wxCommandEvent& event)
{ {
m_textWindow->AppendText( m_textWindow->AppendText(
wxString::Format(wxT("Tool %d right clicked.\n"), wxString::Format("Tool %d right clicked.\n",
(int) event.GetInt())); (int) event.GetInt()));
} }
void MyFrame::OnCombo(wxCommandEvent& event) void MyFrame::OnCombo(wxCommandEvent& event)
{ {
wxLogStatus(wxT("Combobox string '%s' selected"), event.GetString().c_str()); wxLogStatus("Combobox string '%s' selected", event.GetString().c_str());
} }
void MyFrame::DoEnablePrint() void MyFrame::DoEnablePrint()
@@ -928,7 +928,7 @@ void MyFrame::OnUpdateToggleHorzText(wxUpdateUIEvent& event)
void MyFrame::OnChangeToolTip(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnChangeToolTip(wxCommandEvent& WXUNUSED(event))
{ {
GetToolBar()->SetToolShortHelp(wxID_NEW, wxT("New toolbar button")); GetToolBar()->SetToolShortHelp(wxID_NEW, "New toolbar button");
} }
void MyFrame::OnIncToolSpacing(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnIncToolSpacing(wxCommandEvent& WXUNUSED(event))
@@ -992,11 +992,11 @@ void MyFrame::OnInsertPrint(wxCommandEvent& WXUNUSED(event))
m_nPrint++; m_nPrint++;
wxToolBarBase *tb = GetToolBar(); wxToolBarBase *tb = GetToolBar();
tb->InsertTool(0, wxID_PRINT, wxT("New print"), tb->InsertTool(0, wxID_PRINT, "New print",
wxBITMAP(print), wxNullBitmap, wxBITMAP(print), wxNullBitmap,
wxITEM_NORMAL, wxITEM_NORMAL,
wxT("Delete this tool"), "Delete this tool",
wxT("This button was inserted into the toolbar")); "This button was inserted into the toolbar");
// must call Realize() after adding a new button // must call Realize() after adding a new button
tb->Realize(); tb->Realize();
@@ -1014,7 +1014,7 @@ void MyFrame::OnToggleRadioBtn(wxCommandEvent& event)
void MyFrame::OnToolDropdown(wxCommandEvent& event) void MyFrame::OnToolDropdown(wxCommandEvent& event)
{ {
wxString str; wxString str;
str.Printf( wxT("Dropdown on tool %d\n"), event.GetId()); str.Printf( "Dropdown on tool %d\n", event.GetId());
m_textWindow->AppendText( str ); m_textWindow->AppendText( str );
event.Skip(); event.Skip();

View File

@@ -62,8 +62,8 @@ static const int NUM_LEVELS = 2;
// verify that the item is ok and insult the user if it is not // verify that the item is ok and insult the user if it is not
#define CHECK_ITEM( item ) if ( !item.IsOk() ) { \ #define CHECK_ITEM( item ) if ( !item.IsOk() ) { \
wxMessageBox(wxT("Please select some item first!"), \ wxMessageBox("Please select some item first!", \
wxT("Tree sample error"), \ "Tree sample error", \
wxOK | wxICON_EXCLAMATION, \ wxOK | wxICON_EXCLAMATION, \
this); \ this); \
return; \ return; \
@@ -196,7 +196,7 @@ bool MyApp::OnInit()
return false; return false;
// Create the main frame window // Create the main frame window
MyFrame *frame = new MyFrame(wxT("wxTreeCtrl Test"), 50, 50, 450, 600); MyFrame *frame = new MyFrame("wxTreeCtrl Test", 50, 50, 450, 600);
// Show the frame // Show the frame
frame->Show(true); frame->Show(true);
@@ -229,84 +229,84 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
*item_menu = new wxMenu; *item_menu = new wxMenu;
#if wxUSE_LOG #if wxUSE_LOG
file_menu->Append(TreeTest_ClearLog, wxT("&Clear log\tCtrl-L")); file_menu->Append(TreeTest_ClearLog, "&Clear log\tCtrl-L");
file_menu->AppendSeparator(); file_menu->AppendSeparator();
#endif // wxUSE_LOG #endif // wxUSE_LOG
file_menu->Append(TreeTest_About, wxT("&About")); file_menu->Append(TreeTest_About, "&About");
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append(TreeTest_Quit, wxT("E&xit\tAlt-X")); file_menu->Append(TreeTest_Quit, "E&xit\tAlt-X");
style_menu->AppendCheckItem(TreeTest_TogButtons, wxT("Toggle &normal buttons")); style_menu->AppendCheckItem(TreeTest_TogButtons, "Toggle &normal buttons");
style_menu->AppendCheckItem(TreeTest_TogTwist, wxT("Toggle &twister buttons")); style_menu->AppendCheckItem(TreeTest_TogTwist, "Toggle &twister buttons");
style_menu->AppendCheckItem(TreeTest_ToggleButtons, wxT("Toggle image &buttons")); style_menu->AppendCheckItem(TreeTest_ToggleButtons, "Toggle image &buttons");
style_menu->AppendSeparator(); style_menu->AppendSeparator();
style_menu->AppendCheckItem(TreeTest_TogLines, wxT("Toggle &no lines")); style_menu->AppendCheckItem(TreeTest_TogLines, "Toggle &no lines");
style_menu->AppendCheckItem(TreeTest_TogRootLines, wxT("Toggle &lines at root")); style_menu->AppendCheckItem(TreeTest_TogRootLines, "Toggle &lines at root");
style_menu->AppendCheckItem(TreeTest_TogHideRoot, wxT("Toggle &hidden root")); style_menu->AppendCheckItem(TreeTest_TogHideRoot, "Toggle &hidden root");
style_menu->AppendCheckItem(TreeTest_TogBorder, wxT("Toggle &item border")); style_menu->AppendCheckItem(TreeTest_TogBorder, "Toggle &item border");
style_menu->AppendCheckItem(TreeTest_TogFullHighlight, wxT("Toggle &full row highlight")); style_menu->AppendCheckItem(TreeTest_TogFullHighlight, "Toggle &full row highlight");
style_menu->AppendCheckItem(TreeTest_TogEdit, wxT("Toggle &edit mode")); style_menu->AppendCheckItem(TreeTest_TogEdit, "Toggle &edit mode");
#ifndef NO_MULTIPLE_SELECTION #ifndef NO_MULTIPLE_SELECTION
style_menu->AppendCheckItem(TreeTest_ToggleSel, wxT("Toggle &selection mode\tCtrl-S")); style_menu->AppendCheckItem(TreeTest_ToggleSel, "Toggle &selection mode\tCtrl-S");
#endif // NO_MULTIPLE_SELECTION #endif // NO_MULTIPLE_SELECTION
style_menu->AppendCheckItem(TreeTest_ToggleImages, wxT("Toggle show ima&ges")); style_menu->AppendCheckItem(TreeTest_ToggleImages, "Toggle show ima&ges");
style_menu->AppendCheckItem(TreeTest_ToggleStates, wxT("Toggle show st&ates")); style_menu->AppendCheckItem(TreeTest_ToggleStates, "Toggle show st&ates");
style_menu->AppendCheckItem(TreeTest_ToggleBell, wxT("Toggle &bell on no match")); style_menu->AppendCheckItem(TreeTest_ToggleBell, "Toggle &bell on no match");
style_menu->AppendCheckItem(TreeTest_ToggleAlternateImages, wxT("Toggle alternate images")); style_menu->AppendCheckItem(TreeTest_ToggleAlternateImages, "Toggle alternate images");
style_menu->AppendCheckItem(TreeTest_ToggleAlternateStates, wxT("Toggle alternate state images")); style_menu->AppendCheckItem(TreeTest_ToggleAlternateStates, "Toggle alternate state images");
style_menu->Append(TreeTest_SetImageSize, wxT("Set image si&ze...")); style_menu->Append(TreeTest_SetImageSize, "Set image si&ze...");
style_menu->AppendSeparator(); style_menu->AppendSeparator();
style_menu->Append(TreeTest_SetFgColour, wxT("Set &foreground colour...")); style_menu->Append(TreeTest_SetFgColour, "Set &foreground colour...");
style_menu->Append(TreeTest_SetBgColour, wxT("Set &background colour...")); style_menu->Append(TreeTest_SetBgColour, "Set &background colour...");
style_menu->AppendSeparator(); style_menu->AppendSeparator();
style_menu->Append(TreeTest_ResetStyle, wxT("&Reset to default\tF10")); style_menu->Append(TreeTest_ResetStyle, "&Reset to default\tF10");
tree_menu->Append(TreeTest_Recreate, wxT("&Recreate the tree")); tree_menu->Append(TreeTest_Recreate, "&Recreate the tree");
tree_menu->Append(TreeTest_CollapseAndReset, wxT("C&ollapse and reset")); tree_menu->Append(TreeTest_CollapseAndReset, "C&ollapse and reset");
tree_menu->AppendSeparator(); tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_AddItem, wxT("Append a &new item")); tree_menu->Append(TreeTest_AddItem, "Append a &new item");
tree_menu->Append(TreeTest_AddManyItems, wxT("Appends &many items")); tree_menu->Append(TreeTest_AddManyItems, "Appends &many items");
tree_menu->Append(TreeTest_InsertItem, wxT("&Insert a new item")); tree_menu->Append(TreeTest_InsertItem, "&Insert a new item");
tree_menu->Append(TreeTest_Delete, wxT("&Delete this item")); tree_menu->Append(TreeTest_Delete, "&Delete this item");
tree_menu->Append(TreeTest_DeleteChildren, wxT("Delete &children")); tree_menu->Append(TreeTest_DeleteChildren, "Delete &children");
tree_menu->Append(TreeTest_DeleteAll, wxT("Delete &all items")); tree_menu->Append(TreeTest_DeleteAll, "Delete &all items");
tree_menu->Append(TreeTest_SelectRoot, wxT("Select root item")); tree_menu->Append(TreeTest_SelectRoot, "Select root item");
tree_menu->AppendSeparator(); tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_SetFocusedRoot, wxT("Set focus to root item")); tree_menu->Append(TreeTest_SetFocusedRoot, "Set focus to root item");
tree_menu->Append(TreeTest_ClearFocused, wxT("Reset focus")); tree_menu->Append(TreeTest_ClearFocused, "Reset focus");
tree_menu->AppendSeparator(); tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_Count, wxT("Count children of current item")); tree_menu->Append(TreeTest_Count, "Count children of current item");
tree_menu->Append(TreeTest_CountRec, wxT("Recursively count children of current item")); tree_menu->Append(TreeTest_CountRec, "Recursively count children of current item");
tree_menu->AppendSeparator(); tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_Sort, wxT("Sort children of current item")); tree_menu->Append(TreeTest_Sort, "Sort children of current item");
tree_menu->Append(TreeTest_SortRev, wxT("Sort in reversed order")); tree_menu->Append(TreeTest_SortRev, "Sort in reversed order");
tree_menu->AppendSeparator(); tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_EnsureVisible, wxT("Make the last item &visible")); tree_menu->Append(TreeTest_EnsureVisible, "Make the last item &visible");
tree_menu->Append(TreeTest_SetFocus, wxT("Set &focus to the tree")); tree_menu->Append(TreeTest_SetFocus, "Set &focus to the tree");
tree_menu->AppendSeparator(); tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_IncIndent, wxT("Add 5 points to indentation\tAlt-I")); tree_menu->Append(TreeTest_IncIndent, "Add 5 points to indentation\tAlt-I");
tree_menu->Append(TreeTest_DecIndent, wxT("Reduce indentation by 5 points\tAlt-R")); tree_menu->Append(TreeTest_DecIndent, "Reduce indentation by 5 points\tAlt-R");
tree_menu->AppendSeparator(); tree_menu->AppendSeparator();
tree_menu->Append(TreeTest_IncSpacing, wxT("Add 5 points to spacing\tCtrl-I")); tree_menu->Append(TreeTest_IncSpacing, "Add 5 points to spacing\tCtrl-I");
tree_menu->Append(TreeTest_DecSpacing, wxT("Reduce spacing by 5 points\tCtrl-R")); tree_menu->Append(TreeTest_DecSpacing, "Reduce spacing by 5 points\tCtrl-R");
item_menu->Append(TreeTest_Dump, wxT("&Dump item children")); item_menu->Append(TreeTest_Dump, "&Dump item children");
item_menu->Append(TreeTest_Rename, wxT("&Rename item...")); item_menu->Append(TreeTest_Rename, "&Rename item...");
item_menu->AppendSeparator(); item_menu->AppendSeparator();
item_menu->Append(TreeTest_SetBold, wxT("Make item &bold")); item_menu->Append(TreeTest_SetBold, "Make item &bold");
item_menu->Append(TreeTest_ClearBold, wxT("Make item &not bold")); item_menu->Append(TreeTest_ClearBold, "Make item &not bold");
item_menu->AppendSeparator(); item_menu->AppendSeparator();
item_menu->Append(TreeTest_ToggleIcon, wxT("Toggle the item's &icon")); item_menu->Append(TreeTest_ToggleIcon, "Toggle the item's &icon");
item_menu->Append(TreeTest_ToggleState, wxT("Toggle the item's &state")); item_menu->Append(TreeTest_ToggleState, "Toggle the item's &state");
item_menu->AppendSeparator(); item_menu->AppendSeparator();
item_menu->Append(TreeTest_ShowFirstVisible, wxT("Show &first visible")); item_menu->Append(TreeTest_ShowFirstVisible, "Show &first visible");
#ifdef wxHAS_LAST_VISIBLE #ifdef wxHAS_LAST_VISIBLE
item_menu->Append(TreeTest_ShowLastVisible, wxT("Show &last visible")); item_menu->Append(TreeTest_ShowLastVisible, "Show &last visible");
#endif // wxHAS_LAST_VISIBLE #endif // wxHAS_LAST_VISIBLE
item_menu->Append(TreeTest_ShowNextVisible, wxT("Show &next visible")); item_menu->Append(TreeTest_ShowNextVisible, "Show &next visible");
item_menu->Append(TreeTest_ShowPrevVisible, wxT("Show &previous visible")); item_menu->Append(TreeTest_ShowPrevVisible, "Show &previous visible");
item_menu->AppendSeparator(); item_menu->AppendSeparator();
item_menu->Append(TreeTest_ShowParent, "Show pa&rent"); item_menu->Append(TreeTest_ShowParent, "Show pa&rent");
item_menu->Append(TreeTest_ShowPrevSibling, "Show &previous sibling"); item_menu->Append(TreeTest_ShowPrevSibling, "Show &previous sibling");
@@ -319,17 +319,17 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
#ifndef NO_MULTIPLE_SELECTION #ifndef NO_MULTIPLE_SELECTION
item_menu->AppendSeparator(); item_menu->AppendSeparator();
item_menu->Append(TreeTest_DumpSelected, wxT("Dump selected items\tAlt-D")); item_menu->Append(TreeTest_DumpSelected, "Dump selected items\tAlt-D");
item_menu->Append(TreeTest_Select, wxT("Select current item\tAlt-S")); item_menu->Append(TreeTest_Select, "Select current item\tAlt-S");
item_menu->Append(TreeTest_Unselect, wxT("Unselect everything\tAlt-U")); item_menu->Append(TreeTest_Unselect, "Unselect everything\tAlt-U");
item_menu->Append(TreeTest_SelectChildren, wxT("Select all children\tCtrl-A")); item_menu->Append(TreeTest_SelectChildren, "Select all children\tCtrl-A");
#endif // NO_MULTIPLE_SELECTION #endif // NO_MULTIPLE_SELECTION
wxMenuBar *menu_bar = new wxMenuBar; wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(file_menu, "&File");
menu_bar->Append(style_menu, wxT("&Style")); menu_bar->Append(style_menu, "&Style");
menu_bar->Append(tree_menu, wxT("&Tree")); menu_bar->Append(tree_menu, "&Tree");
menu_bar->Append(item_menu, wxT("&Item")); menu_bar->Append(item_menu, "&Item");
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
@@ -337,7 +337,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
#if wxUSE_LOG #if wxUSE_LOG
// create the controls // create the controls
m_textCtrl = new wxTextCtrl(m_panel, wxID_ANY, wxT(""), m_textCtrl = new wxTextCtrl(m_panel, wxID_ANY, "",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxSUNKEN_BORDER); wxTE_MULTILINE | wxSUNKEN_BORDER);
@@ -433,13 +433,13 @@ void MyFrame::OnIdle(wxIdleEvent& event)
{ {
wxTreeItemId idLast = m_treeCtrl->GetLastTreeITem(); wxTreeItemId idLast = m_treeCtrl->GetLastTreeITem();
status = wxString::Format( status = wxString::Format(
wxT("Root/last item is %svisible/%svisible"), "Root/last item is %svisible/%svisible",
m_treeCtrl->IsVisible(idRoot) ? wxT("") : wxT("not "), m_treeCtrl->IsVisible(idRoot) ? "" : "not ",
idLast.IsOk() && m_treeCtrl->IsVisible(idLast) idLast.IsOk() && m_treeCtrl->IsVisible(idLast)
? wxT("") : wxT("not ")); ? "" : "not ");
} }
else else
status = wxT("No root item"); status = "No root item";
SetStatusText(status, 1); SetStatusText(status, 1);
} }
@@ -480,9 +480,9 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("Tree test sample\n") wxMessageBox("Tree test sample\n"
wxT("(c) Julian Smart 1997, Vadim Zeitlin 1998"), "(c) Julian Smart 1997, Vadim Zeitlin 1998",
wxT("About tree test"), "About tree test",
wxOK | wxICON_INFORMATION, this); wxOK | wxICON_INFORMATION, this);
} }
@@ -500,7 +500,7 @@ void MyFrame::OnRename(wxCommandEvent& WXUNUSED(event))
// old code - now we edit in place // old code - now we edit in place
#if 0 #if 0
static wxString s_text; static wxString s_text;
s_text = wxGetTextFromUser(wxT("New name: "), wxT("Tree sample question"), s_text = wxGetTextFromUser("New name: ", "Tree sample question",
s_text, this); s_text, this);
if ( !s_text.empty() ) if ( !s_text.empty() )
{ {
@@ -520,7 +520,7 @@ void MyFrame::OnCount(wxCommandEvent& WXUNUSED(event))
int i = m_treeCtrl->GetChildrenCount( item, false ); int i = m_treeCtrl->GetChildrenCount( item, false );
wxLogMessage(wxT("%d children"), i); wxLogMessage("%d children", i);
} }
void MyFrame::OnCountRec(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCountRec(wxCommandEvent& WXUNUSED(event))
@@ -531,7 +531,7 @@ void MyFrame::OnCountRec(wxCommandEvent& WXUNUSED(event))
int i = m_treeCtrl->GetChildrenCount( item ); int i = m_treeCtrl->GetChildrenCount( item );
wxLogMessage(wxT("%d children"), i); wxLogMessage("%d children", i);
} }
void MyFrame::DoSort(bool reverse) void MyFrame::DoSort(bool reverse)
@@ -552,7 +552,7 @@ void MyFrame::OnHighlight(wxCommandEvent& WXUNUSED(event))
wxRect r; wxRect r;
if ( !m_treeCtrl->GetBoundingRect(id, r, true /* text, not full row */) ) if ( !m_treeCtrl->GetBoundingRect(id, r, true /* text, not full row */) )
{ {
wxLogMessage(wxT("Failed to get bounding item rect")); wxLogMessage("Failed to get bounding item rect");
return; return;
} }
@@ -584,11 +584,11 @@ void MyFrame::OnDumpSelected(wxCommandEvent& WXUNUSED(event))
wxArrayTreeItemIds array; wxArrayTreeItemIds array;
size_t count = m_treeCtrl->GetSelections(array); size_t count = m_treeCtrl->GetSelections(array);
wxLogMessage(wxT("%u items selected"), unsigned(count)); wxLogMessage("%u items selected", unsigned(count));
for ( size_t n = 0; n < count; n++ ) for ( size_t n = 0; n < count; n++ )
{ {
wxLogMessage(wxT("\t%s"), m_treeCtrl->GetItemText(array.Item(n)).c_str()); wxLogMessage("\t%s", m_treeCtrl->GetItemText(array.Item(n)).c_str());
} }
} }
@@ -672,9 +672,9 @@ void MyFrame::OnRecreate(wxCommandEvent& event)
void MyFrame::OnSetImageSize(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSetImageSize(wxCommandEvent& WXUNUSED(event))
{ {
int size = wxGetNumberFromUser(wxT("Enter the size for the images to use"), int size = wxGetNumberFromUser("Enter the size for the images to use",
wxT("Size: "), "Size: ",
wxT("TreeCtrl sample"), "TreeCtrl sample",
m_treeCtrl->ImageSize()); m_treeCtrl->ImageSize());
if ( size == -1 ) if ( size == -1 )
return; return;
@@ -776,7 +776,7 @@ void MyFrame::OnSetFocus(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnInsertItem(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnInsertItem(wxCommandEvent& WXUNUSED(event))
{ {
int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_File : -1; int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_File : -1;
m_treeCtrl->InsertItem(m_treeCtrl->GetRootItem(), image, wxT("2nd item")); m_treeCtrl->InsertItem(m_treeCtrl->GetRootItem(), image, "2nd item");
} }
void MyFrame::OnAddItem(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAddItem(wxCommandEvent& WXUNUSED(event))
@@ -784,7 +784,7 @@ void MyFrame::OnAddItem(wxCommandEvent& WXUNUSED(event))
static int s_num = 0; static int s_num = 0;
wxString text; wxString text;
text.Printf(wxT("Item #%d"), ++s_num); text.Printf("Item #%d", ++s_num);
m_treeCtrl->AppendItem(m_treeCtrl->GetRootItem(), m_treeCtrl->AppendItem(m_treeCtrl->GetRootItem(),
text /*, text /*,
@@ -1136,9 +1136,9 @@ void MyTreeCtrl::AddItemsRecursively(const wxTreeItemId& idParent,
{ {
// at depth 1 elements won't have any more children // at depth 1 elements won't have any more children
if ( hasChildren ) if ( hasChildren )
str.Printf(wxT("%s child %u"), wxT("Folder"), unsigned(n + 1)); str.Printf("%s child %u", "Folder", unsigned(n + 1));
else else
str.Printf(wxT("%s child %u.%u"), wxT("File"), unsigned(folder), unsigned(n + 1)); str.Printf("%s child %u.%u", "File", unsigned(folder), unsigned(n + 1));
// here we pass to AppendItem() normal and selected item images (we // here we pass to AppendItem() normal and selected item images (we
// suppose that selected image follows the normal one in the enum) // suppose that selected image follows the normal one in the enum)
@@ -1175,9 +1175,9 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
size_t depth) size_t depth)
{ {
int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_Folder : -1; int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_Folder : -1;
wxTreeItemId rootId = AddRoot(wxT("Root"), wxTreeItemId rootId = AddRoot("Root",
image, image, image, image,
new MyTreeItemData(wxT("Root item"))); new MyTreeItemData("Root item"));
if ( !HasFlag(wxTR_HIDE_ROOT) && image != -1 ) if ( !HasFlag(wxTR_HIDE_ROOT) && image != -1 )
{ {
SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded); SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
@@ -1305,8 +1305,8 @@ void MyTreeCtrl::LogEvent(const wxChar *name, const wxTreeEvent& event)
if ( item.IsOk() ) if ( item.IsOk() )
text << wxT('"') << GetItemText(item).c_str() << wxT('"'); text << wxT('"') << GetItemText(item).c_str() << wxT('"');
else else
text = wxT("invalid item"); text = "invalid item";
wxLogMessage(wxT("%s(%s)"), name, text.c_str()); wxLogMessage("%s(%s)", name, text.c_str());
} }
// avoid repetition // avoid repetition
@@ -1329,153 +1329,153 @@ TREE_EVENT_HANDLER(OnSelChanging)
#undef TREE_EVENT_HANDLER #undef TREE_EVENT_HANDLER
void LogKeyEvent(const wxChar *name, const wxKeyEvent& event) void LogKeyEvent(const wxString& name, const wxKeyEvent& event)
{ {
wxString key; wxString key;
long keycode = event.GetKeyCode(); long keycode = event.GetKeyCode();
{ {
switch ( keycode ) switch ( keycode )
{ {
case WXK_BACK: key = wxT("BACK"); break; case WXK_BACK: key = "BACK"; break;
case WXK_TAB: key = wxT("TAB"); break; case WXK_TAB: key = "TAB"; break;
case WXK_RETURN: key = wxT("RETURN"); break; case WXK_RETURN: key = "RETURN"; break;
case WXK_ESCAPE: key = wxT("ESCAPE"); break; case WXK_ESCAPE: key = "ESCAPE"; break;
case WXK_SPACE: key = wxT("SPACE"); break; case WXK_SPACE: key = "SPACE"; break;
case WXK_DELETE: key = wxT("DELETE"); break; case WXK_DELETE: key = "DELETE"; break;
case WXK_START: key = wxT("START"); break; case WXK_START: key = "START"; break;
case WXK_LBUTTON: key = wxT("LBUTTON"); break; case WXK_LBUTTON: key = "LBUTTON"; break;
case WXK_RBUTTON: key = wxT("RBUTTON"); break; case WXK_RBUTTON: key = "RBUTTON"; break;
case WXK_CANCEL: key = wxT("CANCEL"); break; case WXK_CANCEL: key = "CANCEL"; break;
case WXK_MBUTTON: key = wxT("MBUTTON"); break; case WXK_MBUTTON: key = "MBUTTON"; break;
case WXK_CLEAR: key = wxT("CLEAR"); break; case WXK_CLEAR: key = "CLEAR"; break;
case WXK_SHIFT: key = wxT("SHIFT"); break; case WXK_SHIFT: key = "SHIFT"; break;
case WXK_ALT: key = wxT("ALT"); break; case WXK_ALT: key = "ALT"; break;
case WXK_CONTROL: key = wxT("CONTROL"); break; case WXK_CONTROL: key = "CONTROL"; break;
case WXK_MENU: key = wxT("MENU"); break; case WXK_MENU: key = "MENU"; break;
case WXK_PAUSE: key = wxT("PAUSE"); break; case WXK_PAUSE: key = "PAUSE"; break;
case WXK_CAPITAL: key = wxT("CAPITAL"); break; case WXK_CAPITAL: key = "CAPITAL"; break;
case WXK_END: key = wxT("END"); break; case WXK_END: key = "END"; break;
case WXK_HOME: key = wxT("HOME"); break; case WXK_HOME: key = "HOME"; break;
case WXK_LEFT: key = wxT("LEFT"); break; case WXK_LEFT: key = "LEFT"; break;
case WXK_UP: key = wxT("UP"); break; case WXK_UP: key = "UP"; break;
case WXK_RIGHT: key = wxT("RIGHT"); break; case WXK_RIGHT: key = "RIGHT"; break;
case WXK_DOWN: key = wxT("DOWN"); break; case WXK_DOWN: key = "DOWN"; break;
case WXK_SELECT: key = wxT("SELECT"); break; case WXK_SELECT: key = "SELECT"; break;
case WXK_PRINT: key = wxT("PRINT"); break; case WXK_PRINT: key = "PRINT"; break;
case WXK_EXECUTE: key = wxT("EXECUTE"); break; case WXK_EXECUTE: key = "EXECUTE"; break;
case WXK_SNAPSHOT: key = wxT("SNAPSHOT"); break; case WXK_SNAPSHOT: key = "SNAPSHOT"; break;
case WXK_INSERT: key = wxT("INSERT"); break; case WXK_INSERT: key = "INSERT"; break;
case WXK_HELP: key = wxT("HELP"); break; case WXK_HELP: key = "HELP"; break;
case WXK_NUMPAD0: key = wxT("NUMPAD0"); break; case WXK_NUMPAD0: key = "NUMPAD0"; break;
case WXK_NUMPAD1: key = wxT("NUMPAD1"); break; case WXK_NUMPAD1: key = "NUMPAD1"; break;
case WXK_NUMPAD2: key = wxT("NUMPAD2"); break; case WXK_NUMPAD2: key = "NUMPAD2"; break;
case WXK_NUMPAD3: key = wxT("NUMPAD3"); break; case WXK_NUMPAD3: key = "NUMPAD3"; break;
case WXK_NUMPAD4: key = wxT("NUMPAD4"); break; case WXK_NUMPAD4: key = "NUMPAD4"; break;
case WXK_NUMPAD5: key = wxT("NUMPAD5"); break; case WXK_NUMPAD5: key = "NUMPAD5"; break;
case WXK_NUMPAD6: key = wxT("NUMPAD6"); break; case WXK_NUMPAD6: key = "NUMPAD6"; break;
case WXK_NUMPAD7: key = wxT("NUMPAD7"); break; case WXK_NUMPAD7: key = "NUMPAD7"; break;
case WXK_NUMPAD8: key = wxT("NUMPAD8"); break; case WXK_NUMPAD8: key = "NUMPAD8"; break;
case WXK_NUMPAD9: key = wxT("NUMPAD9"); break; case WXK_NUMPAD9: key = "NUMPAD9"; break;
case WXK_MULTIPLY: key = wxT("MULTIPLY"); break; case WXK_MULTIPLY: key = "MULTIPLY"; break;
case WXK_ADD: key = wxT("ADD"); break; case WXK_ADD: key = "ADD"; break;
case WXK_SEPARATOR: key = wxT("SEPARATOR"); break; case WXK_SEPARATOR: key = "SEPARATOR"; break;
case WXK_SUBTRACT: key = wxT("SUBTRACT"); break; case WXK_SUBTRACT: key = "SUBTRACT"; break;
case WXK_DECIMAL: key = wxT("DECIMAL"); break; case WXK_DECIMAL: key = "DECIMAL"; break;
case WXK_DIVIDE: key = wxT("DIVIDE"); break; case WXK_DIVIDE: key = "DIVIDE"; break;
case WXK_F1: key = wxT("F1"); break; case WXK_F1: key = "F1"; break;
case WXK_F2: key = wxT("F2"); break; case WXK_F2: key = "F2"; break;
case WXK_F3: key = wxT("F3"); break; case WXK_F3: key = "F3"; break;
case WXK_F4: key = wxT("F4"); break; case WXK_F4: key = "F4"; break;
case WXK_F5: key = wxT("F5"); break; case WXK_F5: key = "F5"; break;
case WXK_F6: key = wxT("F6"); break; case WXK_F6: key = "F6"; break;
case WXK_F7: key = wxT("F7"); break; case WXK_F7: key = "F7"; break;
case WXK_F8: key = wxT("F8"); break; case WXK_F8: key = "F8"; break;
case WXK_F9: key = wxT("F9"); break; case WXK_F9: key = "F9"; break;
case WXK_F10: key = wxT("F10"); break; case WXK_F10: key = "F10"; break;
case WXK_F11: key = wxT("F11"); break; case WXK_F11: key = "F11"; break;
case WXK_F12: key = wxT("F12"); break; case WXK_F12: key = "F12"; break;
case WXK_F13: key = wxT("F13"); break; case WXK_F13: key = "F13"; break;
case WXK_F14: key = wxT("F14"); break; case WXK_F14: key = "F14"; break;
case WXK_F15: key = wxT("F15"); break; case WXK_F15: key = "F15"; break;
case WXK_F16: key = wxT("F16"); break; case WXK_F16: key = "F16"; break;
case WXK_F17: key = wxT("F17"); break; case WXK_F17: key = "F17"; break;
case WXK_F18: key = wxT("F18"); break; case WXK_F18: key = "F18"; break;
case WXK_F19: key = wxT("F19"); break; case WXK_F19: key = "F19"; break;
case WXK_F20: key = wxT("F20"); break; case WXK_F20: key = "F20"; break;
case WXK_F21: key = wxT("F21"); break; case WXK_F21: key = "F21"; break;
case WXK_F22: key = wxT("F22"); break; case WXK_F22: key = "F22"; break;
case WXK_F23: key = wxT("F23"); break; case WXK_F23: key = "F23"; break;
case WXK_F24: key = wxT("F24"); break; case WXK_F24: key = "F24"; break;
case WXK_NUMLOCK: key = wxT("NUMLOCK"); break; case WXK_NUMLOCK: key = "NUMLOCK"; break;
case WXK_SCROLL: key = wxT("SCROLL"); break; case WXK_SCROLL: key = "SCROLL"; break;
case WXK_PAGEUP: key = wxT("PAGEUP"); break; case WXK_PAGEUP: key = "PAGEUP"; break;
case WXK_PAGEDOWN: key = wxT("PAGEDOWN"); break; case WXK_PAGEDOWN: key = "PAGEDOWN"; break;
case WXK_NUMPAD_SPACE: key = wxT("NUMPAD_SPACE"); break; case WXK_NUMPAD_SPACE: key = "NUMPAD_SPACE"; break;
case WXK_NUMPAD_TAB: key = wxT("NUMPAD_TAB"); break; case WXK_NUMPAD_TAB: key = "NUMPAD_TAB"; break;
case WXK_NUMPAD_ENTER: key = wxT("NUMPAD_ENTER"); break; case WXK_NUMPAD_ENTER: key = "NUMPAD_ENTER"; break;
case WXK_NUMPAD_F1: key = wxT("NUMPAD_F1"); break; case WXK_NUMPAD_F1: key = "NUMPAD_F1"; break;
case WXK_NUMPAD_F2: key = wxT("NUMPAD_F2"); break; case WXK_NUMPAD_F2: key = "NUMPAD_F2"; break;
case WXK_NUMPAD_F3: key = wxT("NUMPAD_F3"); break; case WXK_NUMPAD_F3: key = "NUMPAD_F3"; break;
case WXK_NUMPAD_F4: key = wxT("NUMPAD_F4"); break; case WXK_NUMPAD_F4: key = "NUMPAD_F4"; break;
case WXK_NUMPAD_HOME: key = wxT("NUMPAD_HOME"); break; case WXK_NUMPAD_HOME: key = "NUMPAD_HOME"; break;
case WXK_NUMPAD_LEFT: key = wxT("NUMPAD_LEFT"); break; case WXK_NUMPAD_LEFT: key = "NUMPAD_LEFT"; break;
case WXK_NUMPAD_UP: key = wxT("NUMPAD_UP"); break; case WXK_NUMPAD_UP: key = "NUMPAD_UP"; break;
case WXK_NUMPAD_RIGHT: key = wxT("NUMPAD_RIGHT"); break; case WXK_NUMPAD_RIGHT: key = "NUMPAD_RIGHT"; break;
case WXK_NUMPAD_DOWN: key = wxT("NUMPAD_DOWN"); break; case WXK_NUMPAD_DOWN: key = "NUMPAD_DOWN"; break;
case WXK_NUMPAD_PAGEUP: key = wxT("NUMPAD_PAGEUP"); break; case WXK_NUMPAD_PAGEUP: key = "NUMPAD_PAGEUP"; break;
case WXK_NUMPAD_PAGEDOWN: key = wxT("NUMPAD_PAGEDOWN"); break; case WXK_NUMPAD_PAGEDOWN: key = "NUMPAD_PAGEDOWN"; break;
case WXK_NUMPAD_END: key = wxT("NUMPAD_END"); break; case WXK_NUMPAD_END: key = "NUMPAD_END"; break;
case WXK_NUMPAD_BEGIN: key = wxT("NUMPAD_BEGIN"); break; case WXK_NUMPAD_BEGIN: key = "NUMPAD_BEGIN"; break;
case WXK_NUMPAD_INSERT: key = wxT("NUMPAD_INSERT"); break; case WXK_NUMPAD_INSERT: key = "NUMPAD_INSERT"; break;
case WXK_NUMPAD_DELETE: key = wxT("NUMPAD_DELETE"); break; case WXK_NUMPAD_DELETE: key = "NUMPAD_DELETE"; break;
case WXK_NUMPAD_EQUAL: key = wxT("NUMPAD_EQUAL"); break; case WXK_NUMPAD_EQUAL: key = "NUMPAD_EQUAL"; break;
case WXK_NUMPAD_MULTIPLY: key = wxT("NUMPAD_MULTIPLY"); break; case WXK_NUMPAD_MULTIPLY: key = "NUMPAD_MULTIPLY"; break;
case WXK_NUMPAD_ADD: key = wxT("NUMPAD_ADD"); break; case WXK_NUMPAD_ADD: key = "NUMPAD_ADD"; break;
case WXK_NUMPAD_SEPARATOR: key = wxT("NUMPAD_SEPARATOR"); break; case WXK_NUMPAD_SEPARATOR: key = "NUMPAD_SEPARATOR"; break;
case WXK_NUMPAD_SUBTRACT: key = wxT("NUMPAD_SUBTRACT"); break; case WXK_NUMPAD_SUBTRACT: key = "NUMPAD_SUBTRACT"; break;
case WXK_NUMPAD_DECIMAL: key = wxT("NUMPAD_DECIMAL"); break; case WXK_NUMPAD_DECIMAL: key = "NUMPAD_DECIMAL"; break;
case WXK_BROWSER_BACK: key = wxT("BROWSER_BACK"); break; case WXK_BROWSER_BACK: key = "BROWSER_BACK"; break;
case WXK_BROWSER_FORWARD: key = wxT("BROWSER_FORWARD"); break; case WXK_BROWSER_FORWARD: key = "BROWSER_FORWARD"; break;
case WXK_BROWSER_REFRESH: key = wxT("BROWSER_REFRESH"); break; case WXK_BROWSER_REFRESH: key = "BROWSER_REFRESH"; break;
case WXK_BROWSER_STOP: key = wxT("BROWSER_STOP"); break; case WXK_BROWSER_STOP: key = "BROWSER_STOP"; break;
case WXK_BROWSER_SEARCH: key = wxT("BROWSER_SEARCH"); break; case WXK_BROWSER_SEARCH: key = "BROWSER_SEARCH"; break;
case WXK_BROWSER_FAVORITES: key = wxT("BROWSER_FAVORITES"); break; case WXK_BROWSER_FAVORITES: key = "BROWSER_FAVORITES"; break;
case WXK_BROWSER_HOME: key = wxT("BROWSER_HOME"); break; case WXK_BROWSER_HOME: key = "BROWSER_HOME"; break;
case WXK_VOLUME_MUTE: key = wxT("VOLUME_MUTE"); break; case WXK_VOLUME_MUTE: key = "VOLUME_MUTE"; break;
case WXK_VOLUME_DOWN: key = wxT("VOLUME_DOWN"); break; case WXK_VOLUME_DOWN: key = "VOLUME_DOWN"; break;
case WXK_VOLUME_UP: key = wxT("VOLUME_UP"); break; case WXK_VOLUME_UP: key = "VOLUME_UP"; break;
case WXK_MEDIA_NEXT_TRACK: key = wxT("MEDIA_NEXT_TRACK"); break; case WXK_MEDIA_NEXT_TRACK: key = "MEDIA_NEXT_TRACK"; break;
case WXK_MEDIA_PREV_TRACK: key = wxT("MEDIA_PREV_TRACK"); break; case WXK_MEDIA_PREV_TRACK: key = "MEDIA_PREV_TRACK"; break;
case WXK_MEDIA_STOP: key = wxT("MEDIA_STOP"); break; case WXK_MEDIA_STOP: key = "MEDIA_STOP"; break;
case WXK_MEDIA_PLAY_PAUSE: key = wxT("MEDIA_PLAY_PAUSE"); break; case WXK_MEDIA_PLAY_PAUSE: key = "MEDIA_PLAY_PAUSE"; break;
case WXK_LAUNCH_MAIL: key = wxT("LAUNCH_MAIL"); break; case WXK_LAUNCH_MAIL: key = "LAUNCH_MAIL"; break;
case WXK_LAUNCH_APP1: key = wxT("LAUNCH_APP1"); break; case WXK_LAUNCH_APP1: key = "LAUNCH_APP1"; break;
case WXK_LAUNCH_APP2: key = wxT("LAUNCH_APP2"); break; case WXK_LAUNCH_APP2: key = "LAUNCH_APP2"; break;
default: default:
{ {
if ( keycode < 128 && wxIsprint((int)keycode) ) if ( keycode < 128 && wxIsprint((int)keycode) )
key.Printf(wxT("'%c'"), (char)keycode); key.Printf("'%c'", (char)keycode);
else if ( keycode > 0 && keycode < 27 ) else if ( keycode > 0 && keycode < 27 )
key.Printf(_("Ctrl-%c"), wxT('A') + keycode - 1); key.Printf("Ctrl-%c", 'A' + keycode - 1);
else else
key.Printf(wxT("unknown (%ld)"), keycode); key.Printf("unknown (%ld)", keycode);
} }
} }
} }
wxLogMessage( wxT("%s event: %s (flags = %c%c%c%c)"), wxLogMessage( "%s event: %s (flags = %c%c%c%c)",
name, name,
key.c_str(), key.c_str(),
event.ControlDown() ? wxT('C') : wxT('-'), event.ControlDown() ? 'C' : '-',
event.AltDown() ? wxT('A') : wxT('-'), event.AltDown() ? 'A' : '-',
event.ShiftDown() ? wxT('S') : wxT('-'), event.ShiftDown() ? 'S' : '-',
event.MetaDown() ? wxT('M') : wxT('-')); event.MetaDown() ? 'M' : '-');
} }
void MyTreeCtrl::OnTreeKeyDown(wxTreeEvent& event) void MyTreeCtrl::OnTreeKeyDown(wxTreeEvent& event)
{ {
LogKeyEvent(wxT("Tree key down "), event.GetKeyEvent()); LogKeyEvent("Tree key down ", event.GetKeyEvent());
event.Skip(); event.Skip();
} }
@@ -1490,7 +1490,7 @@ void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event)
wxPoint clientpt = event.GetPoint(); wxPoint clientpt = event.GetPoint();
wxPoint screenpt = ClientToScreen(clientpt); wxPoint screenpt = ClientToScreen(clientpt);
wxLogMessage(wxT("OnBeginDrag: started dragging %s at screen coords (%i,%i)"), wxLogMessage("OnBeginDrag: started dragging %s at screen coords (%i,%i)",
GetItemText(m_draggedItem).c_str(), GetItemText(m_draggedItem).c_str(),
screenpt.x, screenpt.y); screenpt.x, screenpt.y);
@@ -1498,7 +1498,7 @@ void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event)
} }
else else
{ {
wxLogMessage(wxT("OnBeginDrag: this item can't be dragged.")); wxLogMessage("OnBeginDrag: this item can't be dragged.");
} }
} }
@@ -1517,13 +1517,13 @@ void MyTreeCtrl::OnEndDrag(wxTreeEvent& event)
if ( !itemDst.IsOk() ) if ( !itemDst.IsOk() )
{ {
wxLogMessage(wxT("OnEndDrag: can't drop here.")); wxLogMessage("OnEndDrag: can't drop here.");
return; return;
} }
wxString text = GetItemText(itemSrc); wxString text = GetItemText(itemSrc);
wxLogMessage(wxT("OnEndDrag: '%s' copied to '%s'."), wxLogMessage("OnEndDrag: '%s' copied to '%s'.",
text.c_str(), GetItemText(itemDst).c_str()); text.c_str(), GetItemText(itemDst).c_str());
// just do append here - we could also insert it just before/after the item // just do append here - we could also insert it just before/after the item
@@ -1542,31 +1542,31 @@ void MyTreeCtrl::OnEndDrag(wxTreeEvent& event)
void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event) void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event)
{ {
wxLogMessage(wxT("OnBeginLabelEdit")); wxLogMessage("OnBeginLabelEdit");
// for testing, prevent this item's label editing // for testing, prevent this item's label editing
wxTreeItemId itemId = event.GetItem(); wxTreeItemId itemId = event.GetItem();
if ( IsTestItem(itemId) ) if ( IsTestItem(itemId) )
{ {
wxMessageBox(wxT("You can't edit this item.")); wxMessageBox("You can't edit this item.");
event.Veto(); event.Veto();
} }
else if ( itemId == GetRootItem() ) else if ( itemId == GetRootItem() )
{ {
// test that it is possible to change the text of the item being edited // test that it is possible to change the text of the item being edited
SetItemText(itemId, wxT("Editing root item")); SetItemText(itemId, "Editing root item");
} }
} }
void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event) void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event)
{ {
wxLogMessage(wxT("OnEndLabelEdit")); wxLogMessage("OnEndLabelEdit");
// don't allow anything except letters in the labels // don't allow anything except letters in the labels
if ( !event.GetLabel().IsWord() ) if ( !event.GetLabel().IsWord() )
{ {
wxMessageBox(wxT("The new label should be a single word.")); wxMessageBox("The new label should be a single word.");
event.Veto(); event.Veto();
} }
@@ -1574,13 +1574,13 @@ void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event)
void MyTreeCtrl::OnItemCollapsing(wxTreeEvent& event) void MyTreeCtrl::OnItemCollapsing(wxTreeEvent& event)
{ {
wxLogMessage(wxT("OnItemCollapsing")); wxLogMessage("OnItemCollapsing");
// for testing, prevent the user from collapsing the first child folder // for testing, prevent the user from collapsing the first child folder
wxTreeItemId itemId = event.GetItem(); wxTreeItemId itemId = event.GetItem();
if ( IsTestItem(itemId) ) if ( IsTestItem(itemId) )
{ {
wxMessageBox(wxT("You can't collapse this item.")); wxMessageBox("You can't collapse this item.");
event.Veto(); event.Veto();
} }
@@ -1597,7 +1597,7 @@ void MyTreeCtrl::OnItemActivated(wxTreeEvent& event)
item->ShowInfo(this); item->ShowInfo(this);
} }
wxLogMessage(wxT("OnItemActivated")); wxLogMessage("OnItemActivated");
} }
void MyTreeCtrl::OnItemStateClick(wxTreeEvent& event) void MyTreeCtrl::OnItemStateClick(wxTreeEvent& event)
@@ -1630,7 +1630,7 @@ void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event)
{ {
wxPoint pt = event.GetPosition(); wxPoint pt = event.GetPosition();
wxLogMessage(wxT("OnContextMenu at screen coords (%i, %i)"), pt.x, pt.y); wxLogMessage("OnContextMenu at screen coords (%i, %i)", pt.x, pt.y);
event.Skip(); event.Skip();
} }
@@ -1640,19 +1640,19 @@ void MyTreeCtrl::ShowMenu(wxTreeItemId id, const wxPoint& pt)
wxString title; wxString title;
if ( id.IsOk() ) if ( id.IsOk() )
{ {
title << wxT("Menu for ") << GetItemText(id); title << "Menu for " << GetItemText(id);
} }
else else
{ {
title = wxT("Menu for no particular item"); title = "Menu for no particular item";
} }
#if wxUSE_MENUS #if wxUSE_MENUS
wxMenu menu(title); wxMenu menu(title);
menu.Append(TreeTest_About, wxT("&About")); menu.Append(TreeTest_About, "&About");
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append(TreeTest_Highlight, wxT("&Highlight item")); menu.Append(TreeTest_Highlight, "&Highlight item");
menu.Append(TreeTest_Dump, wxT("&Dump")); menu.Append(TreeTest_Dump, "&Dump");
PopupMenu(&menu, pt); PopupMenu(&menu, pt);
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
@@ -1672,14 +1672,14 @@ void MyTreeCtrl::OnItemRClick(wxTreeEvent& event)
void MyTreeCtrl::OnRMouseDown(wxMouseEvent& event) void MyTreeCtrl::OnRMouseDown(wxMouseEvent& event)
{ {
wxLogMessage(wxT("Right mouse button down")); wxLogMessage("Right mouse button down");
event.Skip(); event.Skip();
} }
void MyTreeCtrl::OnRMouseUp(wxMouseEvent& event) void MyTreeCtrl::OnRMouseUp(wxMouseEvent& event)
{ {
wxLogMessage(wxT("Right mouse button up")); wxLogMessage("Right mouse button up");
event.Skip(); event.Skip();
} }
@@ -1689,29 +1689,29 @@ void MyTreeCtrl::OnRMouseDClick(wxMouseEvent& event)
wxTreeItemId id = HitTest(event.GetPosition()); wxTreeItemId id = HitTest(event.GetPosition());
if ( !id ) if ( !id )
{ {
wxLogMessage(wxT("No item under mouse")); wxLogMessage("No item under mouse");
} }
else else
{ {
MyTreeItemData *item = (MyTreeItemData *)GetItemData(id); MyTreeItemData *item = (MyTreeItemData *)GetItemData(id);
if ( item ) if ( item )
{ {
wxLogMessage(wxT("Item '%s' under mouse"), item->GetDesc()); wxLogMessage("Item '%s' under mouse", item->GetDesc());
} }
} }
event.Skip(); event.Skip();
} }
static inline const wxChar *Bool2String(bool b) static inline const wxString Bool2String(bool b)
{ {
return b ? wxT("") : wxT("not "); return b ? "" : "not ";
} }
void MyTreeItemData::ShowInfo(wxTreeCtrl *tree) void MyTreeItemData::ShowInfo(wxTreeCtrl *tree)
{ {
wxLogMessage(wxT("Item '%s': %sselected, %sexpanded, %sbold,\n") wxLogMessage("Item '%s': %sselected, %sexpanded, %sbold,\n"
wxT("%u children (%u immediately under this item)."), "%u children (%u immediately under this item).",
m_desc.c_str(), m_desc.c_str(),
Bool2String(tree->IsSelected(GetId())), Bool2String(tree->IsSelected(GetId())),
Bool2String(tree->IsExpanded(GetId())), Bool2String(tree->IsExpanded(GetId())),

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -82,7 +82,7 @@ public:
if ( m_frameStatusBar ) if ( m_frameStatusBar )
{ {
wxSize sz = GetClientSize(); wxSize sz = GetClientSize();
SetStatusText(wxString::Format(wxT("%dx%d"), sz.x, sz.y), 1); SetStatusText(wxString::Format("%dx%d", sz.x, sz.y), 1);
} }
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -118,7 +118,7 @@ public:
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
m_frame->SetStatusText(wxString::Format m_frame->SetStatusText(wxString::Format
( (
wxT("Page size = %d, pos = %d, max = %d"), "Page size = %d, pos = %d, max = %d",
GetScrollThumb(wxVERTICAL), GetScrollThumb(wxVERTICAL),
GetScrollPos(wxVERTICAL), GetScrollPos(wxVERTICAL),
GetScrollRange(wxVERTICAL) GetScrollRange(wxVERTICAL)
@@ -146,7 +146,7 @@ public:
dc.DrawLine(0, y, clientSize.GetWidth(), y); dc.DrawLine(0, y, clientSize.GetWidth(), y);
wxCoord hLine = OnGetRowHeight(line); wxCoord hLine = OnGetRowHeight(line);
dc.DrawText(wxString::Format(wxT("Line %lu"), (unsigned long)line), dc.DrawText(wxString::Format("Line %lu", (unsigned long)line),
2, y + (hLine - hText) / 2); 2, y + (hLine - hText) / 2);
y += hLine; y += hLine;
@@ -215,7 +215,7 @@ public:
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
m_frame->SetStatusText(wxString::Format m_frame->SetStatusText(wxString::Format
( (
wxT("Page size = %d, pos = %d, max = %d"), "Page size = %d, pos = %d, max = %d",
GetScrollThumb(wxVERTICAL), GetScrollThumb(wxVERTICAL),
GetScrollPos(wxVERTICAL), GetScrollPos(wxVERTICAL),
GetScrollRange(wxVERTICAL) GetScrollRange(wxVERTICAL)
@@ -243,7 +243,7 @@ public:
dc.DrawLine(x, 0, x, clientSize.GetHeight()); dc.DrawLine(x, 0, x, clientSize.GetHeight());
wxCoord wLine = OnGetColumnWidth(line); wxCoord wLine = OnGetColumnWidth(line);
dc.DrawRotatedText(wxString::Format(wxT("Line %lu"), (unsigned long)line), dc.DrawRotatedText(wxString::Format("Line %lu", (unsigned long)line),
x + (wLine - hText) / 2, clientSize.GetHeight() - 5, 90); x + (wLine - hText) / 2, clientSize.GetHeight() - 5, 90);
x += wLine; x += wLine;
@@ -315,7 +315,7 @@ public:
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
m_frame->SetStatusText(wxString::Format m_frame->SetStatusText(wxString::Format
( (
wxT("Page size = %d rows %d columns; pos = row: %d, column: %d; max = %d rows, %d columns"), "Page size = %d rows %d columns; pos = row: %d, column: %d; max = %d rows, %d columns",
GetScrollThumb(wxVERTICAL), GetScrollThumb(wxVERTICAL),
GetScrollThumb(wxHORIZONTAL), GetScrollThumb(wxHORIZONTAL),
GetScrollPos(wxVERTICAL), GetScrollPos(wxVERTICAL),
@@ -357,9 +357,9 @@ public:
if ( row == rowFirst ) if ( row == rowFirst )
dc.DrawLine(x, 0, x, clientSize.GetHeight()); dc.DrawLine(x, 0, x, clientSize.GetHeight());
dc.DrawText(wxString::Format(wxT("Row %lu"), (unsigned long)row), dc.DrawText(wxString::Format("Row %lu", (unsigned long)row),
x + 2, y + rowHeight / 2 - hText); x + 2, y + rowHeight / 2 - hText);
dc.DrawText(wxString::Format(wxT("Col %lu"), (unsigned long)col), dc.DrawText(wxString::Format("Col %lu", (unsigned long)col),
x + 2, y + rowHeight / 2); x + 2, y + rowHeight / 2);
x += colWidth; x += colWidth;
@@ -496,7 +496,7 @@ bool VarScrollApp::OnInit()
VarScrollFrame::VarScrollFrame() VarScrollFrame::VarScrollFrame()
: wxFrame(NULL, : wxFrame(NULL,
wxID_ANY, wxID_ANY,
wxT("VScroll wxWidgets Sample"), "VScroll wxWidgets Sample",
wxDefaultPosition, wxDefaultPosition,
wxSize(400, 350)), wxSize(400, 350)),
m_scrollWindow(NULL) m_scrollWindow(NULL)
@@ -512,33 +512,33 @@ VarScrollFrame::VarScrollFrame()
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *menuHelp = new wxMenu; wxMenu *menuHelp = new wxMenu;
menuHelp->Append(VScroll_About, wxT("&About\tF1"), wxT("Show about dialog")); menuHelp->Append(VScroll_About, "&About\tF1", "Show about dialog");
#ifdef wxHAS_RADIO_MENU_ITEMS #ifdef wxHAS_RADIO_MENU_ITEMS
menuMode->AppendRadioItem(VScroll_VScrollMode, wxT("&Vertical\tAlt-V"), menuMode->AppendRadioItem(VScroll_VScrollMode, "&Vertical\tAlt-V",
wxT("Vertical scrolling only")); "Vertical scrolling only");
menuMode->AppendRadioItem(VScroll_HScrollMode, wxT("&Horizontal\tAlt-H"), menuMode->AppendRadioItem(VScroll_HScrollMode, "&Horizontal\tAlt-H",
wxT("Horizontal scrolling only")); "Horizontal scrolling only");
menuMode->AppendRadioItem(VScroll_HVScrollMode, menuMode->AppendRadioItem(VScroll_HVScrollMode,
wxT("Hori&zontal/Vertical\tAlt-Z"), "Hori&zontal/Vertical\tAlt-Z",
wxT("Horizontal and vertical scrolling")); "Horizontal and vertical scrolling");
menuMode->Check(VScroll_VScrollMode, true); menuMode->Check(VScroll_VScrollMode, true);
#else #else
menuMode->Append(VScroll_VScrollMode, wxT("&Vertical\tAlt-V"), menuMode->Append(VScroll_VScrollMode, "&Vertical\tAlt-V",
wxT("Vertical scrolling only")); "Vertical scrolling only");
menuMode->Append(VScroll_HScrollMode, wxT("&Horizontal\tAlt-H"), menuMode->Append(VScroll_HScrollMode, "&Horizontal\tAlt-H",
wxT("Horizontal scrolling only")); "Horizontal scrolling only");
menuMode->Append(VScroll_HVScrollMode, wxT("Hori&zontal/Vertical\tAlt-Z"), menuMode->Append(VScroll_HVScrollMode, "Hori&zontal/Vertical\tAlt-Z",
wxT("Horizontal and vertical scrolling")); "Horizontal and vertical scrolling");
#endif #endif
menuFile->Append(VScroll_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(VScroll_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar; wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(menuMode, wxT("&Mode")); menuBar->Append(menuMode, "&Mode");
menuBar->Append(menuHelp, wxT("&Help")); menuBar->Append(menuHelp, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -547,7 +547,7 @@ VarScrollFrame::VarScrollFrame()
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
int widths[2]; int widths[2];
widths[0] = -1; widths[0] = -1;
widths[1] = 100; widths[1] = 100;
@@ -602,10 +602,10 @@ void VarScrollFrame::OnModeHVScroll(wxCommandEvent& WXUNUSED(event))
void VarScrollFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void VarScrollFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("VScroll shows how to implement scrolling with\n") wxMessageBox("VScroll shows how to implement scrolling with\n"
wxT("variable line widths and heights.\n") "variable line widths and heights.\n"
wxT("(c) 2003 Vadim Zeitlin"), "(c) 2003 Vadim Zeitlin",
wxT("About VScroll"), "About VScroll",
wxOK | wxICON_INFORMATION, wxOK | wxICON_INFORMATION,
this); this);
} }

View File

@@ -314,7 +314,7 @@ WebFrame::WebFrame(const wxString& url) :
m_toolbar_forward = m_toolbar->AddTool(wxID_ANY, _("Forward"), forward); m_toolbar_forward = m_toolbar->AddTool(wxID_ANY, _("Forward"), forward);
m_toolbar_stop = m_toolbar->AddTool(wxID_ANY, _("Stop"), stop); m_toolbar_stop = m_toolbar->AddTool(wxID_ANY, _("Stop"), stop);
m_toolbar_reload = m_toolbar->AddTool(wxID_ANY, _("Reload"), refresh); m_toolbar_reload = m_toolbar->AddTool(wxID_ANY, _("Reload"), refresh);
m_url = new wxTextCtrl(m_toolbar, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(400, -1), wxTE_PROCESS_ENTER ); m_url = new wxTextCtrl(m_toolbar, wxID_ANY, "", wxDefaultPosition, wxSize(400, -1), wxTE_PROCESS_ENTER );
m_toolbar->AddControl(m_url, _("URL")); m_toolbar->AddControl(m_url, _("URL"));
m_toolbar_tools = m_toolbar->AddTool(wxID_ANY, _("Menu"), wxBitmap(wxlogo_xpm)); m_toolbar_tools = m_toolbar->AddTool(wxID_ANY, _("Menu"), wxBitmap(wxlogo_xpm));
@@ -682,12 +682,12 @@ void WebFrame::OnMode(wxCommandEvent& WXUNUSED(evt))
void WebFrame::OnLoadScheme(wxCommandEvent& WXUNUSED(evt)) void WebFrame::OnLoadScheme(wxCommandEvent& WXUNUSED(evt))
{ {
wxPathList pathlist; wxPathList pathlist;
pathlist.Add(wxT(".")); pathlist.Add(".");
pathlist.Add(wxT("..")); pathlist.Add("..");
pathlist.Add(wxT("../help")); pathlist.Add("../help");
pathlist.Add(wxT("../../../samples/help")); pathlist.Add("../../../samples/help");
wxFileName helpfile(pathlist.FindValidPath(wxT("doc.zip"))); wxFileName helpfile(pathlist.FindValidPath("doc.zip"));
helpfile.MakeAbsolute(); helpfile.MakeAbsolute();
wxString path = helpfile.GetFullPath(); wxString path = helpfile.GetFullPath();
//Under MSW we need to flip the slashes //Under MSW we need to flip the slashes

View File

@@ -127,13 +127,13 @@ public:
{ {
m_bitmap = wxBitmap(wiztest2_xpm); m_bitmap = wxBitmap(wiztest2_xpm);
m_checkbox = new wxCheckBox(this, wxID_ANY, wxT("&Check me")); m_checkbox = new wxCheckBox(this, wxID_ANY, "&Check me");
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
mainSizer->Add( mainSizer->Add(
new wxStaticText(this, wxID_ANY, new wxStaticText(this, wxID_ANY,
wxT("You need to check the checkbox\n") "You need to check the checkbox\n"
wxT("below before going to the next page\n")), "below before going to the next page\n"),
0, 0,
wxALL, wxALL,
5 5
@@ -152,7 +152,7 @@ public:
{ {
if ( !m_checkbox->GetValue() ) if ( !m_checkbox->GetValue() )
{ {
wxMessageBox(wxT("Check the checkbox first!"), wxT("No way"), wxMessageBox("Check the checkbox first!", "No way",
wxICON_WARNING | wxOK, this); wxICON_WARNING | wxOK, this);
return false; return false;
@@ -183,12 +183,12 @@ public:
// static wxString choices[] = { "forward", "backward", "both", "neither" }; // static wxString choices[] = { "forward", "backward", "both", "neither" };
// The above syntax can cause an internal compiler error with gcc. // The above syntax can cause an internal compiler error with gcc.
wxString choices[4]; wxString choices[4];
choices[0] = wxT("forward"); choices[0] = "forward";
choices[1] = wxT("backward"); choices[1] = "backward";
choices[2] = wxT("both"); choices[2] = "both";
choices[3] = wxT("neither"); choices[3] = "neither";
m_radio = new wxRadioBox(this, wxID_ANY, wxT("Allow to proceed:"), m_radio = new wxRadioBox(this, wxID_ANY, "Allow to proceed:",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
WXSIZEOF(choices), choices, WXSIZEOF(choices), choices,
1, wxRA_SPECIFY_COLS); 1, wxRA_SPECIFY_COLS);
@@ -208,7 +208,7 @@ public:
// wizard event handlers // wizard event handlers
void OnWizardCancel(wxWizardEvent& event) void OnWizardCancel(wxWizardEvent& event)
{ {
if ( wxMessageBox(wxT("Do you really want to cancel?"), wxT("Question"), if ( wxMessageBox("Do you really want to cancel?", "Question",
wxICON_QUESTION | wxYES_NO, this) != wxYES ) wxICON_QUESTION | wxYES_NO, this) != wxYES )
{ {
// not confirmed // not confirmed
@@ -229,7 +229,7 @@ public:
if ( !event.GetDirection() && sel == Backward ) if ( !event.GetDirection() && sel == Backward )
return; return;
wxMessageBox(wxT("You can't go there"), wxT("Not allowed"), wxMessageBox("You can't go there", "Not allowed",
wxICON_WARNING | wxOK, this); wxICON_WARNING | wxOK, this);
event.Veto(); event.Veto();
@@ -256,14 +256,14 @@ public:
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
mainSizer->Add( mainSizer->Add(
new wxStaticText(this, wxID_ANY, wxT("Try checking the box below and\n") new wxStaticText(this, wxID_ANY, "Try checking the box below and\n"
wxT("then going back and clearing it")), "then going back and clearing it"),
0, // No vertical stretching 0, // No vertical stretching
wxALL, wxALL,
5 // Border width 5 // Border width
); );
m_checkbox = new wxCheckBox(this, wxID_ANY, wxT("&Skip the next page")); m_checkbox = new wxCheckBox(this, wxID_ANY, "&Skip the next page");
mainSizer->Add( mainSizer->Add(
m_checkbox, m_checkbox,
0, // No vertical stretching 0, // No vertical stretching
@@ -272,18 +272,18 @@ public:
); );
#if wxUSE_CHECKLISTBOX #if wxUSE_CHECKLISTBOX
static const wxChar *aszChoices[] = static const wxString aszChoices[] =
{ {
wxT("Zeroth"), "Zeroth",
wxT("First"), "First",
wxT("Second"), "Second",
wxT("Third"), "Third",
wxT("Fourth"), "Fourth",
wxT("Fifth"), "Fifth",
wxT("Sixth"), "Sixth",
wxT("Seventh"), "Seventh",
wxT("Eighth"), "Eighth",
wxT("Nineth") "Nineth"
}; };
m_checklistbox = new wxCheckListBox m_checklistbox = new wxCheckListBox
@@ -367,7 +367,7 @@ bool MyApp::OnInit()
if ( !wxApp::OnInit() ) if ( !wxApp::OnInit() )
return false; return false;
MyFrame *frame = new MyFrame(wxT("wxWizard Sample")); MyFrame *frame = new MyFrame("wxWizard Sample");
// and show it (the frames, unlike simple controls, are not shown when // and show it (the frames, unlike simple controls, are not shown when
// created initially) // created initially)
@@ -385,7 +385,7 @@ MyWizard::MyWizard(wxFrame *frame, bool useSizer)
{ {
SetExtraStyle(wxWIZARD_EX_HELPBUTTON); SetExtraStyle(wxWIZARD_EX_HELPBUTTON);
Create(frame,wxID_ANY,wxT("Absolutely Useless Wizard"), Create(frame,wxID_ANY,"Absolutely Useless Wizard",
wxBitmap(wiztest_xpm),wxDefaultPosition, wxBitmap(wiztest_xpm),wxDefaultPosition,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
@@ -402,9 +402,9 @@ MyWizard::MyWizard(wxFrame *frame, bool useSizer)
m_page1 = new wxWizardPageSimple(this); m_page1 = new wxWizardPageSimple(this);
/* wxStaticText *text = */ new wxStaticText(m_page1, wxID_ANY, /* wxStaticText *text = */ new wxStaticText(m_page1, wxID_ANY,
wxT("This wizard doesn't help you\nto do anything at all.\n") "This wizard doesn't help you\nto do anything at all.\n"
wxT("\n") "\n"
wxT("The next pages will present you\nwith more useless controls."), "The next pages will present you\nwith more useless controls.",
wxPoint(5,5) wxPoint(5,5)
); );
@@ -440,24 +440,24 @@ MyFrame::MyFrame(const wxString& title)
wxDefaultPosition, wxSize(250, 150)) // small frame wxDefaultPosition, wxSize(250, 150)) // small frame
{ {
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(Wizard_RunModal, wxT("&Run wizard modal...\tCtrl-R")); menuFile->Append(Wizard_RunModal, "&Run wizard modal...\tCtrl-R");
menuFile->Append(Wizard_RunNoSizer, wxT("Run wizard &without sizer...")); menuFile->Append(Wizard_RunNoSizer, "Run wizard &without sizer...");
menuFile->Append(Wizard_RunModeless, wxT("Run wizard &modeless...")); menuFile->Append(Wizard_RunModeless, "Run wizard &modeless...");
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(Wizard_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); menuFile->Append(Wizard_Quit, "E&xit\tAlt-X", "Quit this program");
wxMenu *menuOptions = new wxMenu; wxMenu *menuOptions = new wxMenu;
menuOptions->AppendCheckItem(Wizard_LargeWizard, wxT("&Scroll Wizard Pages")); menuOptions->AppendCheckItem(Wizard_LargeWizard, "&Scroll Wizard Pages");
menuOptions->AppendCheckItem(Wizard_ExpandBitmap, wxT("Si&ze Bitmap To Page")); menuOptions->AppendCheckItem(Wizard_ExpandBitmap, "Si&ze Bitmap To Page");
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(Wizard_About, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(Wizard_About, "&About\tF1", "Show about dialog");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, wxT("&File")); menuBar->Append(menuFile, "&File");
menuBar->Append(menuOptions, wxT("&Options")); menuBar->Append(menuOptions, "&Options");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -476,9 +476,9 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("Demo of wxWizard class\n") wxMessageBox("Demo of wxWizard class\n"
wxT("(c) 1999, 2000 Vadim Zeitlin"), "(c) 1999, 2000 Vadim Zeitlin",
wxT("About wxWizard sample"), wxOK | wxICON_INFORMATION, this); "About wxWizard sample", wxOK | wxICON_INFORMATION, this);
} }
void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event))
@@ -504,10 +504,10 @@ void MyFrame::OnRunWizardModeless(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnWizardFinished(wxWizardEvent& WXUNUSED(event)) void MyFrame::OnWizardFinished(wxWizardEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("The wizard finished successfully."), wxT("Wizard notification")); wxMessageBox("The wizard finished successfully.", "Wizard notification");
} }
void MyFrame::OnWizardCancel(wxWizardEvent& WXUNUSED(event)) void MyFrame::OnWizardCancel(wxWizardEvent& WXUNUSED(event))
{ {
wxMessageBox(wxT("The wizard was cancelled."), wxT("Wizard notification")); wxMessageBox("The wizard was cancelled.", "Wizard notification");
} }

View File

@@ -142,7 +142,7 @@ void MyResizableListCtrl::SetColumnWidths()
// This is just a debug message in case you want to watch the // This is just a debug message in case you want to watch the
// events scroll by as you resize. // events scroll by as you resize.
wxLogDebug( wxT("Successfully set column widths") ); wxLogDebug( "Successfully set column widths" );
} }

View File

@@ -56,7 +56,7 @@ public:
const wxSize &size = wxDefaultSize, const wxSize &size = wxDefaultSize,
long style = wxLC_REPORT, long style = wxLC_REPORT,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxT("myResizableListCtrl") const wxString &name = "myResizableListCtrl"
); );
// Destructor. // Destructor.

View File

@@ -52,7 +52,7 @@ wxEND_EVENT_TABLE()
// Constructor (Notice how small and easy it is) // Constructor (Notice how small and easy it is)
PreferencesDialog::PreferencesDialog(wxWindow* parent) PreferencesDialog::PreferencesDialog(wxWindow* parent)
{ {
wxXmlResource::Get()->LoadDialog(this, parent, wxT("derived_dialog")); wxXmlResource::Get()->LoadDialog(this, parent, "derived_dialog");
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -111,19 +111,19 @@ MyFrame::MyFrame(wxWindow* parent)
// since this frame will always be the top window, and thus parentless. // since this frame will always be the top window, and thus parentless.
// However, the current approach has source code that can be recycled // However, the current approach has source code that can be recycled
// for other frames that aren't the top level window.] // for other frames that aren't the top level window.]
wxXmlResource::Get()->LoadFrame(this, parent, wxT("main_frame")); wxXmlResource::Get()->LoadFrame(this, parent, "main_frame");
// Set the icon for the frame. // Set the icon for the frame.
SetIcon(wxICON(sample)); SetIcon(wxICON(sample));
// Load the menubar from XRC and set this frame's menubar to it. // Load the menubar from XRC and set this frame's menubar to it.
SetMenuBar(wxXmlResource::Get()->LoadMenuBar(wxT("main_menu"))); SetMenuBar(wxXmlResource::Get()->LoadMenuBar("main_menu"));
// Load the toolbar from XRC and set this frame's toolbar to it. // Load the toolbar from XRC and set this frame's toolbar to it.
// NOTE: For toolbars you currently should do it exactly like this. // NOTE: For toolbars you currently should do it exactly like this.
// With toolbars, you currently can't create one, and set it later. It // With toolbars, you currently can't create one, and set it later. It
// needs to be all in one step. // needs to be all in one step.
wxSystemOptions::SetOption ( wxT("msw.remap"), 0 ); wxSystemOptions::SetOption ( "msw.remap", 0 );
SetToolBar(wxXmlResource::Get()->LoadToolBar(this, wxT("main_toolbar"))); SetToolBar(wxXmlResource::Get()->LoadToolBar(this, "main_toolbar"));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// Give the frame an optional statusbar. The '1' just means one field. // Give the frame an optional statusbar. The '1' just means one field.
@@ -146,26 +146,26 @@ MyFrame::MyFrame(wxWindow* parent)
void MyFrame::OnUnloadResourceMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnUnloadResourceMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
if ( wxXmlResource::Get()->Unload(wxT("rc/basicdlg.xrc")) ) if ( wxXmlResource::Get()->Unload("rc/basicdlg.xrc") )
{ {
wxLogMessage(wxT("Basic dialog resource has now been unloaded, you ") wxLogMessage("Basic dialog resource has now been unloaded, you "
wxT("won't be able to use it before loading it again")); "won't be able to use it before loading it again");
} }
else else
{ {
wxLogWarning(wxT("Failed to unload basic dialog resource")); wxLogWarning("Failed to unload basic dialog resource");
} }
} }
void MyFrame::OnReloadResourceMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnReloadResourceMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
if ( wxXmlResource::Get()->Load(wxT("rc/basicdlg.xrc")) ) if ( wxXmlResource::Get()->Load("rc/basicdlg.xrc") )
{ {
wxLogStatus(wxT("Basic dialog resource has been loaded.")); wxLogStatus("Basic dialog resource has been loaded.");
} }
else else
{ {
wxLogError(wxT("Failed to load basic dialog resource")); wxLogError("Failed to load basic dialog resource");
} }
} }
@@ -181,7 +181,7 @@ void MyFrame::OnNonDerivedDialogToolOrMenuCommand(wxCommandEvent& WXUNUSED(event
wxDialog dlg; wxDialog dlg;
// "non_derived_dialog" is the name of the wxDialog XRC node that should // "non_derived_dialog" is the name of the wxDialog XRC node that should
// be loaded. // be loaded.
if ( wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("non_derived_dialog")) ) if ( wxXmlResource::Get()->LoadDialog(&dlg, this, "non_derived_dialog") )
dlg.ShowModal(); dlg.ShowModal();
} }
@@ -208,14 +208,14 @@ void MyFrame::OnAnimationCtrlPlay(wxCommandEvent& event)
if (ctrl->IsPlaying()) if (ctrl->IsPlaying())
{ {
ctrl->Stop(); ctrl->Stop();
btn->SetLabel(wxT("Play")); btn->SetLabel("Play");
} }
else else
{ {
if (ctrl->Play()) if (ctrl->Play())
btn->SetLabel(wxT("Stop")); btn->SetLabel("Stop");
else else
wxLogError(wxT("Cannot play the animation...")); wxLogError("Cannot play the animation...");
} }
#endif #endif
} }
@@ -223,7 +223,7 @@ void MyFrame::OnAnimationCtrlPlay(wxCommandEvent& event)
void MyFrame::OnControlsToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnControlsToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
wxDialog dlg; wxDialog dlg;
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("controls_dialog")); wxXmlResource::Get()->LoadDialog(&dlg, this, "controls_dialog");
#if wxUSE_LISTCTRL #if wxUSE_LISTCTRL
// The resource file specifies the columns of the control as they are // The resource file specifies the columns of the control as they are
@@ -273,7 +273,7 @@ void MyFrame::OnControlsToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnUncenteredToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnUncenteredToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
wxDialog dlg; wxDialog dlg;
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("uncentered_dialog")); wxXmlResource::Get()->LoadDialog(&dlg, this, "uncentered_dialog");
dlg.ShowModal(); dlg.ShowModal();
} }
@@ -307,7 +307,7 @@ void MyFrame::OnObjRefToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnCustomClassToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnCustomClassToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
wxDialog dlg; wxDialog dlg;
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("custom_class_dialog")); wxXmlResource::Get()->LoadDialog(&dlg, this, "custom_class_dialog");
// Make an instance of our new custom class. // Make an instance of our new custom class.
MyResizableListCtrl* a_myResizableListCtrl = new MyResizableListCtrl(&dlg, MyResizableListCtrl* a_myResizableListCtrl = new MyResizableListCtrl(&dlg,
@@ -319,7 +319,7 @@ void MyFrame::OnCustomClassToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
// "custom_control_placeholder" is the name of the "unknown" tag in the // "custom_control_placeholder" is the name of the "unknown" tag in the
// custctrl.xrc XRC file. // custctrl.xrc XRC file.
wxXmlResource::Get()->AttachUnknownControl(wxT("custom_control_placeholder"), wxXmlResource::Get()->AttachUnknownControl("custom_control_placeholder",
a_myResizableListCtrl); a_myResizableListCtrl);
dlg.ShowModal(); dlg.ShowModal();
} }
@@ -328,7 +328,7 @@ void MyFrame::OnCustomClassToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnPlatformPropertyToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPlatformPropertyToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
wxDialog dlg; wxDialog dlg;
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("platform_property_dialog")); wxXmlResource::Get()->LoadDialog(&dlg, this, "platform_property_dialog");
dlg.ShowModal(); dlg.ShowModal();
} }
@@ -336,7 +336,7 @@ void MyFrame::OnPlatformPropertyToolOrMenuCommand(wxCommandEvent& WXUNUSED(event
void MyFrame::OnArtProviderToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnArtProviderToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
wxDialog dlg; wxDialog dlg;
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("art_provider_dialog")); wxXmlResource::Get()->LoadDialog(&dlg, this, "art_provider_dialog");
dlg.ShowModal(); dlg.ShowModal();
} }
@@ -344,14 +344,14 @@ void MyFrame::OnArtProviderToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnVariableExpansionToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnVariableExpansionToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
wxDialog dlg; wxDialog dlg;
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("variable_expansion_dialog")); wxXmlResource::Get()->LoadDialog(&dlg, this, "variable_expansion_dialog");
dlg.ShowModal(); dlg.ShowModal();
} }
void MyFrame::OnVariants(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnVariants(wxCommandEvent& WXUNUSED(event))
{ {
wxDialog dlg; wxDialog dlg;
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("variants_dialog")); wxXmlResource::Get()->LoadDialog(&dlg, this, "variants_dialog");
dlg.ShowModal(); dlg.ShowModal();
} }
@@ -400,8 +400,8 @@ void MyFrame::OnRecursiveLoad(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAboutToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAboutToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
wxString msg; wxString msg;
msg.Printf( wxT("This is the about dialog of XML resources demo.\n") msg.Printf( "This is the about dialog of XML resources demo.\n"
wxT("Welcome to %s"), wxVERSION_STRING); "Welcome to %s", wxVERSION_STRING);
wxMessageBox(msg, _("About XML resources demo"), wxOK | wxICON_INFORMATION, this); wxMessageBox(msg, _("About XML resources demo"), wxOK | wxICON_INFORMATION, this);
} }

View File

@@ -42,7 +42,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
ObjrefDialog::ObjrefDialog(wxWindow* parent) ObjrefDialog::ObjrefDialog(wxWindow* parent)
{ {
wxXmlResource::Get()->LoadDialog(this, parent, wxT("objref_dialog")); wxXmlResource::Get()->LoadDialog(this, parent, "objref_dialog");
nb = XRCCTRL(*this, "objref_notebook", wxNotebook); nb = XRCCTRL(*this, "objref_notebook", wxNotebook);
wxCHECK_RET(nb, "failed to find objref_notebook"); wxCHECK_RET(nb, "failed to find objref_notebook");

View File

@@ -102,14 +102,14 @@ void ClassListDialog::CreateControls()
wxBoxSizer* filters = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* filters = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(filters, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); itemBoxSizer2->Add(filters, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
filters->Add(new wxCheckBox(this, ID_SHOW_ONLY_XTI, filters->Add(new wxCheckBox(this, ID_SHOW_ONLY_XTI,
wxT("Show only classes with eXtended infos"))); "Show only classes with eXtended infos"));
filters->AddSpacer(10); filters->AddSpacer(10);
filters->Add(new wxCheckBox(this, ID_SHOW_PROPERTIES_RECURSIVELY, filters->Add(new wxCheckBox(this, ID_SHOW_PROPERTIES_RECURSIVELY,
wxT("Show properties of parent classes"))); "Show properties of parent classes"));
// show how many have we filtered out // show how many have we filtered out
m_pClassCountText = new wxStaticText( this, wxID_STATIC, m_pClassCountText = new wxStaticText( this, wxID_STATIC,
wxT("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
wxDefaultPosition, wxDefaultSize, 0 ); wxDefaultPosition, wxDefaultSize, 0 );
m_pClassCountText->SetFont(wxFontInfo(8).Family(wxFONTFAMILY_SWISS).Bold()); m_pClassCountText->SetFont(wxFontInfo(8).Family(wxFONTFAMILY_SWISS).Bold());
itemBoxSizer2->Add(m_pClassCountText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5); itemBoxSizer2->Add(m_pClassCountText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
@@ -154,7 +154,7 @@ void ClassListDialog::CreateControls()
itemBoxSizer5->Add(m_pChoiceBook, 0, wxGROW|wxALL, 5); itemBoxSizer5->Add(m_pChoiceBook, 0, wxGROW|wxALL, 5);
m_pTextCtrl = new wxTextCtrl( this, ID_TEXTCTRL, wxT(""), wxDefaultPosition, wxSize(500, -1), wxTE_MULTILINE|wxTE_READONLY ); m_pTextCtrl = new wxTextCtrl( this, ID_TEXTCTRL, "", wxDefaultPosition, wxSize(500, -1), wxTE_MULTILINE|wxTE_READONLY );
itemBoxSizer5->Add(m_pTextCtrl, 3, wxGROW|wxALL, 5); itemBoxSizer5->Add(m_pTextCtrl, 3, wxGROW|wxALL, 5);
wxStdDialogButtonSizer* itemStdDialogButtonSizer17 = new wxStdDialogButtonSizer; wxStdDialogButtonSizer* itemStdDialogButtonSizer17 = new wxStdDialogButtonSizer;
@@ -187,7 +187,7 @@ int ClassListDialog::AddClassesWithParent(const wxClassInfo *parent, const wxTre
int ret = AddClassesWithParent(ci, child); int ret = AddClassesWithParent(ci, child);
m_pParentTreeCtrl->SetItemText(child, m_pParentTreeCtrl->SetItemText(child,
m_pParentTreeCtrl->GetItemText(child) + m_pParentTreeCtrl->GetItemText(child) +
wxString::Format(wxT(" [%d]"), ret)); wxString::Format(" [%d]", ret));
count += ret+1; count += ret+1;
} }
@@ -241,12 +241,12 @@ void ClassListDialog::InitControls()
m_pSizeListBox->Append(arr[i]); m_pSizeListBox->Append(arr[i]);
// add root item to parent-mode treectrl // add root item to parent-mode treectrl
wxTreeItemId id = m_pParentTreeCtrl->AddRoot(wxT("wxObject")); wxTreeItemId id = m_pParentTreeCtrl->AddRoot("wxObject");
// recursively add all leaves to the treectrl // recursively add all leaves to the treectrl
int count = AddClassesWithParent(CLASSINFO(wxObject), id); int count = AddClassesWithParent(CLASSINFO(wxObject), id);
m_pParentTreeCtrl->SetItemText(id, m_pParentTreeCtrl->GetItemText(id) + m_pParentTreeCtrl->SetItemText(id, m_pParentTreeCtrl->GetItemText(id) +
wxString::Format(wxT(" [%d]"), count)); wxString::Format(" [%d]", count));
// initially expand the root item // initially expand the root item
m_pParentTreeCtrl->Expand(id); m_pParentTreeCtrl->Expand(id);
@@ -281,13 +281,13 @@ void ClassListDialog::UpdateFilterText()
// how many are we showing // how many are we showing
m_pClassCountText->SetLabel( m_pClassCountText->SetLabel(
wxString::Format( wxString::Format(
wxT("Showing %d classes on a total of %d registered classes in wxXTI."), "Showing %d classes on a total of %d registered classes in wxXTI.",
m_nCount, m_nTotalCount)); m_nCount, m_nTotalCount));
} }
void ClassListDialog::UpdateClassInfo(const wxString &itemName) void ClassListDialog::UpdateClassInfo(const wxString &itemName)
{ {
wxString classname = itemName.BeforeFirst(wxT(' ')); wxString classname = itemName.BeforeFirst(' ');
wxCheckBox *cb = static_cast<wxCheckBox*>(FindWindow(ID_SHOW_PROPERTIES_RECURSIVELY)); wxCheckBox *cb = static_cast<wxCheckBox*>(FindWindow(ID_SHOW_PROPERTIES_RECURSIVELY));
m_pTextCtrl->SetValue( m_pTextCtrl->SetValue(
@@ -367,68 +367,68 @@ void ClassListDialog::OnChoiceBookPageChange( wxChoicebookEvent& event )
wxString DumpStr(const wxString &str) wxString DumpStr(const wxString &str)
{ {
if (str.empty()) if (str.empty())
return wxT("none"); return "none";
return str; return str;
} }
wxString DumpTypeInfo(const wxTypeInfo *ti) wxString DumpTypeInfo(const wxTypeInfo *ti)
{ {
if (!ti) if (!ti)
return wxT("none"); return "none";
return DumpStr(ti->GetTypeName()); return DumpStr(ti->GetTypeName());
} }
wxString DumpPropertyAccessor(const wxPropertyAccessor *acc, int indent) wxString DumpPropertyAccessor(const wxPropertyAccessor *acc, int indent)
{ {
wxString ind = wxT("\n") + wxString(indent, wxT(' ')); wxString ind = "\n" + wxString(indent, ' ');
wxString infostr; wxString infostr;
if (!acc) if (!acc)
return ind + wxT("no property accessors"); return ind + "no property accessors";
if (acc->HasSetter()) if (acc->HasSetter())
infostr << ind << wxT("setter name: ") << acc->GetSetterName(); infostr << ind << "setter name: " << acc->GetSetterName();
if (acc->HasCollectionGetter()) if (acc->HasCollectionGetter())
infostr << ind << wxT("collection getter name: ") << acc->GetCollectionGetterName(); infostr << ind << "collection getter name: " << acc->GetCollectionGetterName();
if (acc->HasGetter()) if (acc->HasGetter())
infostr << ind << wxT("getter name: ") << acc->GetGetterName(); infostr << ind << "getter name: " << acc->GetGetterName();
if (acc->HasAdder()) if (acc->HasAdder())
infostr << ind << wxT("adder name: ") << acc->GetAdderName(); infostr << ind << "adder name: " << acc->GetAdderName();
return infostr; return infostr;
} }
wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent) wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent)
{ {
wxString ind = wxT("\n") + wxString(indent, wxT(' ')); wxString ind = "\n" + wxString(indent, ' ');
wxString infostr; wxString infostr;
if (!prop) if (!prop)
return ind + wxT("none"); return ind + "none";
infostr << ind << wxT("flags: "); infostr << ind << "flags: ";
if (prop->GetFlags() & wxPROP_DEPRECATED) if (prop->GetFlags() & wxPROP_DEPRECATED)
infostr << wxT("wxPROP_DEPRECATED,"); infostr << "wxPROP_DEPRECATED,";
if (prop->GetFlags() & wxPROP_OBJECT_GRAPH) if (prop->GetFlags() & wxPROP_OBJECT_GRAPH)
infostr << wxT("wxPROP_OBJECT_GRAPH,"); infostr << "wxPROP_OBJECT_GRAPH,";
if (prop->GetFlags() & wxPROP_ENUM_STORE_LONG) if (prop->GetFlags() & wxPROP_ENUM_STORE_LONG)
infostr << wxT("wxPROP_ENUM_STORE_LONG,"); infostr << "wxPROP_ENUM_STORE_LONG,";
if (prop->GetFlags() & wxPROP_DONT_STREAM) if (prop->GetFlags() & wxPROP_DONT_STREAM)
infostr << wxT("wxPROP_DONT_STREAM,"); infostr << "wxPROP_DONT_STREAM,";
if (prop->GetFlags() == 0) if (prop->GetFlags() == 0)
infostr << wxT("none"); infostr << "none";
else else
infostr.RemoveLast(); // remove last comma infostr.RemoveLast(); // remove last comma
infostr << ind << wxT("help string: ") << DumpStr(prop->GetHelpString()); infostr << ind << "help string: " << DumpStr(prop->GetHelpString());
infostr << ind << wxT("group string: ") << DumpStr(prop->GetGroupString()); infostr << ind << "group string: " << DumpStr(prop->GetGroupString());
infostr << ind << wxT("collection element type: ") << DumpTypeInfo(prop->GetCollectionElementTypeInfo()); infostr << ind << "collection element type: " << DumpTypeInfo(prop->GetCollectionElementTypeInfo());
infostr << ind << wxT("type: ") << DumpTypeInfo(prop->GetTypeInfo()); infostr << ind << "type: " << DumpTypeInfo(prop->GetTypeInfo());
infostr << ind << wxT("default value: ") << DumpStr(wxAnyGetAsString(prop->GetDefaultValue())); infostr << ind << "default value: " << DumpStr(wxAnyGetAsString(prop->GetDefaultValue()));
infostr << DumpPropertyAccessor(prop->GetAccessor(), indent+1); infostr << DumpPropertyAccessor(prop->GetAccessor(), indent+1);
return infostr; return infostr;
@@ -436,14 +436,14 @@ wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent)
wxString DumpHandlerInfo(const wxHandlerInfo *phdlr, int indent) wxString DumpHandlerInfo(const wxHandlerInfo *phdlr, int indent)
{ {
wxString ind = wxT("\n") + wxString(indent, wxT(' ')); wxString ind = "\n" + wxString(indent, ' ');
wxString infostr; wxString infostr;
if (!phdlr) if (!phdlr)
return ind + wxT("none"); return ind + "none";
infostr << ind << wxT("event class: ") << infostr << ind << "event class: " <<
(phdlr->GetEventClassInfo() ? phdlr->GetEventClassInfo()->GetClassName() : wxT("none")); (phdlr->GetEventClassInfo() ? phdlr->GetEventClassInfo()->GetClassName() : "none");
return infostr; return infostr;
} }
@@ -456,12 +456,12 @@ int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive)
prop; prop;
prop = prop->GetNext(), pcount++) prop = prop->GetNext(), pcount++)
{ {
infostr << wxT("\n\n [") << pcount+1 << wxT("] Property: ") << prop->GetName(); infostr << "\n\n [" << pcount+1 << "] Property: " << prop->GetName();
infostr << DumpPropertyInfo(prop, 4); infostr << DumpPropertyInfo(prop, 4);
} }
if (pcount == 0) if (pcount == 0)
infostr << wxT("\n None"); infostr << "\n None";
if (recursive) if (recursive)
{ {
@@ -474,7 +474,7 @@ int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive)
if (ppcount) if (ppcount)
{ {
pcount += ppcount; pcount += ppcount;
infostr << wxT("\n\n ") << parent[i]->GetClassName() << wxT(" PARENT'S PROPERTIES:"); infostr << "\n\n " << parent[i]->GetClassName() << " PARENT'S PROPERTIES:";
infostr << str; infostr << str;
} }
} }
@@ -491,12 +491,12 @@ int DumpHandlers(const wxClassInfo *info, wxString& infostr, bool recursive)
h; h;
h = h->GetNext(), hcount++) h = h->GetNext(), hcount++)
{ {
infostr << wxT("\n\n [") << hcount+1 << wxT("] Handler: ") << h->GetName(); infostr << "\n\n [" << hcount+1 << "] Handler: " << h->GetName();
infostr << DumpHandlerInfo(h, 4); infostr << DumpHandlerInfo(h, 4);
} }
if (hcount == 0) if (hcount == 0)
infostr << wxT("\n None"); infostr << "\n None";
if (recursive) if (recursive)
{ {
@@ -509,7 +509,7 @@ int DumpHandlers(const wxClassInfo *info, wxString& infostr, bool recursive)
if (hhcount) if (hhcount)
{ {
hcount += hhcount; hcount += hhcount;
infostr << wxT("\n\n ") << parent[i]->GetClassName() << wxT(" PARENT'S HANDLERS:"); infostr << "\n\n " << parent[i]->GetClassName() << " PARENT'S HANDLERS:";
infostr << str; infostr << str;
} }
} }
@@ -527,32 +527,32 @@ wxString DumpClassInfo(const wxClassInfo *info, bool recursive)
// basic stuff: // basic stuff:
infostr << wxT("\n BASIC RTTI INFO ABOUT ") << info->GetClassName(); infostr << "\n BASIC RTTI INFO ABOUT " << info->GetClassName();
infostr << wxT("\n ================================================="); infostr << "\n =================================================";
infostr << wxT("\n Base class #1: ") << DumpStr(info->GetBaseClassName1()); infostr << "\n Base class #1: " << DumpStr(info->GetBaseClassName1());
infostr << wxT("\n Base class #2: ") << DumpStr(info->GetBaseClassName2()); infostr << "\n Base class #2: " << DumpStr(info->GetBaseClassName2());
infostr << wxT("\n Include file: ") << DumpStr(info->GetIncludeName()); infostr << "\n Include file: " << DumpStr(info->GetIncludeName());
infostr << wxT("\n Size: ") << info->GetSize(); infostr << "\n Size: " << info->GetSize();
infostr << wxT("\n Dynamic: ") << (info->IsDynamic() ? wxT("true") : wxT("false")); infostr << "\n Dynamic: " << (info->IsDynamic() ? "true" : "false");
// advanced stuff: // advanced stuff:
infostr << wxT("\n\n\n ADVANCED RTTI INFO ABOUT ") << info->GetClassName(); infostr << "\n\n\n ADVANCED RTTI INFO ABOUT " << info->GetClassName();
infostr << wxT("\n =================================================\n"); infostr << "\n =================================================\n";
infostr << wxT("\n PROPERTIES"); infostr << "\n PROPERTIES";
infostr << wxT("\n -----------------------------------------"); infostr << "\n -----------------------------------------";
int pcount = DumpProperties(info, infostr, recursive); int pcount = DumpProperties(info, infostr, recursive);
infostr << wxT("\n\n HANDLERS"); infostr << "\n\n HANDLERS";
infostr << wxT("\n -----------------------------------------"); infostr << "\n -----------------------------------------";
int hcount = DumpHandlers(info, infostr, recursive); int hcount = DumpHandlers(info, infostr, recursive);
if (pcount+hcount == 0) if (pcount+hcount == 0)
infostr << wxT("\n\n no advanced info\n"); infostr << "\n\n no advanced info\n";
else else
{ {
infostr << wxT("\n\n Total count of properties: ") << pcount; infostr << "\n\n Total count of properties: " << pcount;
infostr << wxT("\n Total count of handlers: ") << hcount << wxT("\n"); infostr << "\n Total count of handlers: " << hcount << "\n";
} }
return infostr; return infostr;

View File

@@ -61,7 +61,7 @@ struct wxObjectCodeReaderCallback::wxObjectCodeReaderCallbackInternal
wxString GetObjectName( int objectID ) wxString GetObjectName( int objectID )
{ {
if ( objectID == wxNullObjectID ) if ( objectID == wxNullObjectID )
return wxT("NULL"); return "NULL";
if ( m_objectNames.find(objectID) == m_objectNames.end() ) if ( m_objectNames.find(objectID) == m_objectNames.end() )
{ {
@@ -95,8 +95,8 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class
m_headerincludes += include; m_headerincludes += include;
} }
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID ); wxString objectName = wxString::Format( "LocalObject_%d", objectID );
m_source += ( wxString::Format( wxT("\t%s *%s = new %s;\n"), m_source += ( wxString::Format( "\t%s *%s = new %s;\n",
classInfo->GetClassName(), classInfo->GetClassName(),
objectName.c_str(), objectName.c_str(),
classInfo->GetClassName()) ); classInfo->GetClassName()) );
@@ -105,7 +105,7 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class
void wxObjectCodeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo)) void wxObjectCodeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo))
{ {
m_source += ( wxString::Format( wxT("\tdelete %s;\n"), m_source += ( wxString::Format( "\tdelete %s;\n",
m_data->GetObjectName( objectID).c_str() ) ); m_data->GetObjectName( objectID).c_str() ) );
} }
@@ -150,7 +150,7 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny &param )
const wxCustomTypeInfo* cti = wx_dynamic_cast(const wxCustomTypeInfo*, type); const wxCustomTypeInfo* cti = wx_dynamic_cast(const wxCustomTypeInfo*, type);
if ( cti ) if ( cti )
{ {
value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(), value.Printf( "%s(%s)", cti->GetTypeName().c_str(),
wxAnyGetAsString(param).c_str() ); wxAnyGetAsString(param).c_str() );
} }
else else
@@ -172,13 +172,13 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny &param )
ci->CallOnAny(param,&cw); ci->CallOnAny(param,&cw);
value.Printf( wxT("%s(%s)"), ctype->GetClassInfo()->GetClassName(), value.Printf( "%s(%s)", ctype->GetClassInfo()->GetClassName(),
cw.GetConstructorString() ); cw.GetConstructorString() );
} }
} }
else else
{ {
value.Printf( wxT("%s"), wxAnyGetAsString(param).c_str() ); value.Printf( "%s", wxAnyGetAsString(param).c_str() );
} }
return value; return value;
@@ -194,26 +194,26 @@ void wxObjectCodeReaderCallback::CreateObject(int objectID,
) )
{ {
int i; int i;
m_source += ( wxString::Format( wxT("\t%s->Create("), m_source += ( wxString::Format( "\t%s->Create(",
m_data->GetObjectName(objectID).c_str() ) ); m_data->GetObjectName(objectID).c_str() ) );
for (i = 0; i < paramCount; i++) for (i = 0; i < paramCount; i++)
{ {
if ( objectIDValues[i] != wxInvalidObjectID ) if ( objectIDValues[i] != wxInvalidObjectID )
{ {
wxString str = wxString str =
wxString::Format( wxT("%s"), wxString::Format( "%s",
m_data->GetObjectName( objectIDValues[i] ).c_str() ); m_data->GetObjectName( objectIDValues[i] ).c_str() );
m_source += ( str ); m_source += ( str );
} }
else else
{ {
m_source += ( m_source += (
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) ); wxString::Format( "%s", ValueAsCode(params[i]).c_str() ) );
} }
if (i < paramCount - 1) if (i < paramCount - 1)
m_source += ( wxT(", ")); m_source += ( ", ");
} }
m_source += ( wxT(");\n") ); m_source += ( ");\n" );
} }
void wxObjectCodeReaderCallback::ConstructObject(int objectID, void wxObjectCodeReaderCallback::ConstructObject(int objectID,
@@ -225,8 +225,8 @@ void wxObjectCodeReaderCallback::ConstructObject(int objectID,
wxStringToAnyHashMap &WXUNUSED(metadata) wxStringToAnyHashMap &WXUNUSED(metadata)
) )
{ {
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID ); wxString objectName = wxString::Format( "LocalObject_%d", objectID );
m_source += ( wxString::Format( wxT("\t%s *%s = new %s("), m_source += ( wxString::Format( "\t%s *%s = new %s(",
classInfo->GetClassName(), classInfo->GetClassName(),
objectName.c_str(), objectName.c_str(),
classInfo->GetClassName()) ); classInfo->GetClassName()) );
@@ -236,17 +236,17 @@ void wxObjectCodeReaderCallback::ConstructObject(int objectID,
for (i = 0; i < paramCount; i++) for (i = 0; i < paramCount; i++)
{ {
if ( objectIDValues[i] != wxInvalidObjectID ) if ( objectIDValues[i] != wxInvalidObjectID )
m_source += ( wxString::Format( wxT("%s"), m_source += ( wxString::Format( "%s",
m_data->GetObjectName( objectIDValues[i] ).c_str() ) ); m_data->GetObjectName( objectIDValues[i] ).c_str() ) );
else else
{ {
m_source += ( m_source += (
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) ); wxString::Format( "%s", ValueAsCode(params[i]).c_str() ) );
} }
if (i < paramCount - 1) if (i < paramCount - 1)
m_source += ( wxT(", ") ); m_source += ( ", " );
} }
m_source += ( wxT(");\n") ); m_source += ( ");\n" );
} }
void wxObjectCodeReaderCallback::SetProperty(int objectID, void wxObjectCodeReaderCallback::SetProperty(int objectID,
@@ -254,7 +254,7 @@ void wxObjectCodeReaderCallback::SetProperty(int objectID,
const wxPropertyInfo* propertyInfo, const wxPropertyInfo* propertyInfo,
const wxAny &value) const wxAny &value)
{ {
m_source += ( wxString::Format( wxT("\t%s->%s(%s);\n"), m_source += ( wxString::Format( "\t%s->%s(%s);\n",
m_data->GetObjectName(objectID).c_str(), m_data->GetObjectName(objectID).c_str(),
propertyInfo->GetAccessor()->GetSetterName().c_str(), propertyInfo->GetAccessor()->GetSetterName().c_str(),
ValueAsCode(value).c_str()) ); ValueAsCode(value).c_str()) );
@@ -266,12 +266,12 @@ void wxObjectCodeReaderCallback::SetPropertyAsObject(int objectID,
int valueObjectId) int valueObjectId)
{ {
if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT ) if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT )
m_source += ( wxString::Format( wxT("\t%s->%s(*%s);\n"), m_source += ( wxString::Format( "\t%s->%s(*%s);\n",
m_data->GetObjectName(objectID).c_str(), m_data->GetObjectName(objectID).c_str(),
propertyInfo->GetAccessor()->GetSetterName().c_str(), propertyInfo->GetAccessor()->GetSetterName().c_str(),
m_data->GetObjectName( valueObjectId).c_str() ) ); m_data->GetObjectName( valueObjectId).c_str() ) );
else else
m_source += ( wxString::Format( wxT("\t%s->%s(%s);\n"), m_source += ( wxString::Format( "\t%s->%s(%s);\n",
m_data->GetObjectName(objectID).c_str(), m_data->GetObjectName(objectID).c_str(),
propertyInfo->GetAccessor()->GetSetterName().c_str(), propertyInfo->GetAccessor()->GetSetterName().c_str(),
m_data->GetObjectName( valueObjectId).c_str() ) ); m_data->GetObjectName( valueObjectId).c_str() ) );
@@ -282,7 +282,7 @@ void wxObjectCodeReaderCallback::AddToPropertyCollection( int objectID,
const wxPropertyInfo* propertyInfo, const wxPropertyInfo* propertyInfo,
const wxAny &value) const wxAny &value)
{ {
m_source += ( wxString::Format( wxT("\t%s->%s(%s);\n"), m_source += ( wxString::Format( "\t%s->%s(%s);\n",
m_data->GetObjectName(objectID).c_str(), m_data->GetObjectName(objectID).c_str(),
propertyInfo->GetAccessor()->GetAdderName().c_str(), propertyInfo->GetAccessor()->GetAdderName().c_str(),
ValueAsCode(value).c_str()) ); ValueAsCode(value).c_str()) );
@@ -317,8 +317,8 @@ void wxObjectCodeReaderCallback::SetConnect(int eventSourceObjectID,
wxString code = wxString code =
wxString::Format( wxString::Format(
wxT("\t%s->Connect( %s->GetId(), %d, ") "\t%s->Connect( %s->GetId(), %d, "
wxT("(wxObjectEventFunction)(wxEventFunction) & %s::%s, NULL, %s );"), "(wxObjectEventFunction)(wxEventFunction) & %s::%s, NULL, %s );",
ehsource.c_str(), ehsource.c_str(), eventType, ehsinkClass.c_str(), ehsource.c_str(), ehsource.c_str(), eventType, ehsinkClass.c_str(),
handlerName.c_str(), ehsink.c_str() ); handlerName.c_str(), ehsink.c_str() );

View File

@@ -140,7 +140,7 @@ bool MyApp::OnInit()
RegisterFrameRTTI(); RegisterFrameRTTI();
// create the main application window // create the main application window
MyFrame *frame = new MyFrame(wxT("Extended RTTI sample")); MyFrame *frame = new MyFrame("Extended RTTI sample");
// and show it (the frames, unlike simple controls, are not shown when // and show it (the frames, unlike simple controls, are not shown when
// created initially) // created initially)
@@ -168,24 +168,24 @@ MyFrame::MyFrame(const wxString& title)
// the "About" item should be in the help menu // the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu; wxMenu *helpMenu = new wxMenu;
helpMenu->Append(Minimal_About, wxT("&About\tF1"), wxT("Show about dialog")); helpMenu->Append(Minimal_About, "&About\tF1", "Show about dialog");
fileMenu->Append(Minimal_Persist, wxT("Persist a wxFrame to XML..."), fileMenu->Append(Minimal_Persist, "Persist a wxFrame to XML...",
wxT("Creates a wxFrame using wxXTI and saves its description as XML")); "Creates a wxFrame using wxXTI and saves its description as XML");
fileMenu->Append(Minimal_Depersist, wxT("Depersist XML file..."), fileMenu->Append(Minimal_Depersist, "Depersist XML file...",
wxT("Loads the description of wxFrame from XML")); "Loads the description of wxFrame from XML");
fileMenu->Append(Minimal_GenerateCode, wxT("Generate code for a wxFrame saved to XML..."), fileMenu->Append(Minimal_GenerateCode, "Generate code for a wxFrame saved to XML...",
wxT("Generates the C++ code which belong to a persisted wxFrame")); "Generates the C++ code which belong to a persisted wxFrame");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(Minimal_DumpClasses, wxT("Dump registered classes..."), fileMenu->Append(Minimal_DumpClasses, "Dump registered classes...",
wxT("Dumps the description of all wxWidgets classes registered in XTI")); "Dumps the description of all wxWidgets classes registered in XTI");
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
fileMenu->Append(Minimal_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); fileMenu->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar... // now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(fileMenu, "&File");
menuBar->Append(helpMenu, wxT("&Help")); menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame // ... and attach this menu bar to the frame
SetMenuBar(menuBar); SetMenuBar(menuBar);
@@ -194,7 +194,7 @@ MyFrame::MyFrame(const wxString& title)
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only) // create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2); CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!")); SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
@@ -280,13 +280,13 @@ public:
// this approach would be used if the handler would not // this approach would be used if the handler would not
// be connected really in the designer, so we have to supply // be connected really in the designer, so we have to supply
// the information // the information
const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty(wxT("Button")) ); const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty("Button") );
if ( object == but && if ( object == but &&
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo(wxT("OnClick")) ) propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo("OnClick") )
{ {
eventSink = m_frame; eventSink = m_frame;
handlerInfo = m_frame->GetClassInfo()-> handlerInfo = m_frame->GetClassInfo()->
FindHandlerInfo(wxT("ButtonClickHandler")); FindHandlerInfo("ButtonClickHandler");
return true; return true;
} }
return false; return false;
@@ -315,16 +315,16 @@ void RegisterFrameRTTI()
// set up the RTTI info for a class (MyXTIFrame) which // set up the RTTI info for a class (MyXTIFrame) which
// is not defined anywhere in this program // is not defined anywhere in this program
wxDynamicClassInfo *dyninfo = wxDynamicClassInfo *dyninfo =
wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass(wxT("MyXTIFrame"))); wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass("MyXTIFrame"));
if ( dyninfo == NULL ) if ( dyninfo == NULL )
{ {
dyninfo = new wxDynamicClassInfo(wxT("myxtiframe.h"), dyninfo = new wxDynamicClassInfo("myxtiframe.h",
wxT("MyXTIFrame"), "MyXTIFrame",
CLASSINFO(wxFrame) ); CLASSINFO(wxFrame) );
// this class has a property named "Button" and the relative handler: // this class has a property named "Button" and the relative handler:
dyninfo->AddProperty(wxT("Button"), wxGetTypeInfo((wxButton**) NULL)); dyninfo->AddProperty("Button", wxGetTypeInfo((wxButton**) NULL));
dyninfo->AddHandler(wxT("ButtonClickHandler"), dyninfo->AddHandler("ButtonClickHandler",
NULL /* no instance of the handler method */, CLASSINFO( wxEvent ) ); NULL /* no instance of the handler method */, CLASSINFO( wxEvent ) );
} }
} }
@@ -337,13 +337,13 @@ wxDynamicObject* CreateFrameRTTI()
// the class is now part of XTI internal table so that we can // the class is now part of XTI internal table so that we can
// get a pointer to it just searching it like any other class: // get a pointer to it just searching it like any other class:
wxFrame* frame; wxFrame* frame;
wxClassInfo *info = wxClassInfo::FindClass(wxT("MyXTIFrame")); wxClassInfo *info = wxClassInfo::FindClass("MyXTIFrame");
wxASSERT( info ); wxASSERT( info );
wxDynamicObject* frameWrapper = wxDynamicObject* frameWrapper =
wx_dynamic_cast(wxDynamicObject*, info->CreateObject() ); wx_dynamic_cast(wxDynamicObject*, info->CreateObject() );
Params[0] = wxAny((wxWindow*)(NULL)); Params[0] = wxAny((wxWindow*)(NULL));
Params[1] = wxAny(wxWindowID(baseID++)); Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("This is a frame created from XTI"))); Params[2] = wxAny(wxString("This is a frame created from XTI"));
Params[3] = wxAny(wxPoint(-1,-1)); Params[3] = wxAny(wxPoint(-1,-1));
Params[4] = wxAny(wxSize(400,300)); Params[4] = wxAny(wxSize(400,300));
Params[5] = wxAny((long)wxDEFAULT_FRAME_STYLE); Params[5] = wxAny((long)wxDEFAULT_FRAME_STYLE);
@@ -374,7 +374,7 @@ wxDynamicObject* CreateFrameRTTI()
Params[2] = wxAny(wxPoint(-1,-1)); Params[2] = wxAny(wxPoint(-1,-1));
Params[3] = wxAny(wxSize(-1,-1)); Params[3] = wxAny(wxSize(-1,-1));
Params[4] = wxAny((long)0); Params[4] = wxAny((long)0);
Params[5] = wxAny(wxString(wxT("Hello"))); Params[5] = wxAny(wxString("Hello"));
wxASSERT( info->Create(panel, 6, Params )); wxASSERT( info->Create(panel, 6, Params ));
notebook->AddPage( panel, "Buttons" ); notebook->AddPage( panel, "Buttons" );
@@ -384,12 +384,12 @@ wxDynamicObject* CreateFrameRTTI()
button = wxDynamicCast( info->CreateObject(), wxButton ); button = wxDynamicCast( info->CreateObject(), wxButton );
Params[0] = wxAny((wxWindow*)(panel)); Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++)); Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("Click Me!"))); Params[2] = wxAny(wxString("Click Me!"));
Params[3] = wxAny(wxPoint( 10, 10 )); Params[3] = wxAny(wxPoint( 10, 10 ));
Params[4] = wxAny(wxSize(-1,-1)); Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0); Params[5] = wxAny((long)0);
wxASSERT( info->Create(button, 6, Params )); wxASSERT( info->Create(button, 6, Params ));
frameWrapper->SetProperty( wxT("Button"), wxAny( button ) ); frameWrapper->SetProperty( "Button", wxAny( button ) );
// other controls page // other controls page
@@ -401,7 +401,7 @@ wxDynamicObject* CreateFrameRTTI()
Params[2] = wxAny(wxPoint(-1,-1)); Params[2] = wxAny(wxPoint(-1,-1));
Params[3] = wxAny(wxSize(-1,-1)); Params[3] = wxAny(wxSize(-1,-1));
Params[4] = wxAny((long)0); Params[4] = wxAny((long)0);
Params[5] = wxAny(wxString(wxT("Hello"))); Params[5] = wxAny(wxString("Hello"));
wxASSERT( info->Create(panel, 6, Params )); wxASSERT( info->Create(panel, 6, Params ));
notebook->AddPage( panel, "Other Standard controls" ); notebook->AddPage( panel, "Other Standard controls" );
@@ -411,7 +411,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl ); control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel)); Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++)); Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Checkbox"))); Params[2] = wxAny(wxString("A Checkbox"));
Params[3] = wxAny(wxPoint( 10, 10 )); Params[3] = wxAny(wxPoint( 10, 10 ));
Params[4] = wxAny(wxSize(-1,-1)); Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0); Params[5] = wxAny((long)0);
@@ -422,7 +422,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl ); control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel)); Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++)); Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Radiobutton"))); Params[2] = wxAny(wxString("A Radiobutton"));
Params[3] = wxAny(wxPoint( 10, 30 )); Params[3] = wxAny(wxPoint( 10, 30 ));
Params[4] = wxAny(wxSize(-1,-1)); Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0); Params[5] = wxAny((long)0);
@@ -430,7 +430,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl ); control = wxDynamicCast( info->CreateObject(), wxControl );
Params[1] = wxAny(wxWindowID(baseID++)); Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("Another One"))); Params[2] = wxAny(wxString("Another One"));
Params[3] = wxAny(wxPoint( 10, 50 )); Params[3] = wxAny(wxPoint( 10, 50 ));
wxASSERT( info->Create(control, 6, Params )); wxASSERT( info->Create(control, 6, Params ));
@@ -439,7 +439,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl ); control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel)); Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++)); Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Static Text!"))); Params[2] = wxAny(wxString("A Static Text!"));
Params[3] = wxAny(wxPoint( 10, 70 )); Params[3] = wxAny(wxPoint( 10, 70 ));
Params[4] = wxAny(wxSize(-1,-1)); Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0); Params[5] = wxAny((long)0);
@@ -450,7 +450,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl ); control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel)); Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++)); Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Static Box"))); Params[2] = wxAny(wxString("A Static Box"));
Params[3] = wxAny(wxPoint( 10, 90 )); Params[3] = wxAny(wxPoint( 10, 90 ));
Params[4] = wxAny(wxSize(100,80)); Params[4] = wxAny(wxSize(100,80));
Params[5] = wxAny((long)0); Params[5] = wxAny((long)0);
@@ -461,7 +461,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl ); control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel)); Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++)); Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Text Control"))); Params[2] = wxAny(wxString("A Text Control"));
Params[3] = wxAny(wxPoint( 10, 200 )); Params[3] = wxAny(wxPoint( 10, 200 ));
Params[4] = wxAny(wxSize(-1,-1)); Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0); Params[5] = wxAny((long)0);
@@ -477,7 +477,7 @@ wxDynamicObject* CreateFrameRTTI()
Params[2] = wxAny(wxPoint(-1,-1)); Params[2] = wxAny(wxPoint(-1,-1));
Params[3] = wxAny(wxSize(-1,-1)); Params[3] = wxAny(wxSize(-1,-1));
Params[4] = wxAny((long)0); Params[4] = wxAny((long)0);
Params[5] = wxAny(wxString(wxT("Hello"))); Params[5] = wxAny(wxString("Hello"));
wxASSERT( info->Create(panel, 6, Params )); wxASSERT( info->Create(panel, 6, Params ));
notebook->AddPage( panel, "Spins and Sliders" ); notebook->AddPage( panel, "Spins and Sliders" );
@@ -619,7 +619,7 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
wxDynamicObject *frame = CreateFrameRTTI(); wxDynamicObject *frame = CreateFrameRTTI();
if (!frame) if (!frame)
{ {
wxLogError(wxT("Cannot create the XTI frame!")); wxLogError("Cannot create the XTI frame!");
return; return;
} }
@@ -628,8 +628,8 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
trueFrame->Show(); trueFrame->Show();
// ask the user where to save it // ask the user where to save it
wxFileDialog dlg(this, wxT("Where should the frame be saved?"), wxFileDialog dlg(this, "Where should the frame be saved?",
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"), wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
wxFD_SAVE); wxFD_SAVE);
if (dlg.ShowModal() == wxID_CANCEL) if (dlg.ShowModal() == wxID_CANCEL)
return; return;
@@ -637,7 +637,7 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
// then save it to a test XML file // then save it to a test XML file
if (!SaveFrameRTTI(dlg.GetPath(), frame)) if (!SaveFrameRTTI(dlg.GetPath(), frame))
{ {
wxLogError(wxT("Cannot save the XTI frame into '%s'"), dlg.GetPath()); wxLogError("Cannot save the XTI frame into '%s'", dlg.GetPath());
return; return;
} }
@@ -648,8 +648,8 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
{ {
// ask the user which file to load // ask the user which file to load
wxFileDialog dlg(this, wxT("Which file contains the frame to depersist?"), wxFileDialog dlg(this, "Which file contains the frame to depersist?",
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"), wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
wxFD_OPEN); wxFD_OPEN);
if (dlg.ShowModal() == wxID_CANCEL) if (dlg.ShowModal() == wxID_CANCEL)
return; return;
@@ -657,7 +657,7 @@ void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
wxObject *frame = LoadFrameRTTI(dlg.GetPath()); wxObject *frame = LoadFrameRTTI(dlg.GetPath());
if (!frame) if (!frame)
{ {
wxLogError(wxT("Could not depersist the wxFrame from '%s'"), dlg.GetPath()); wxLogError("Could not depersist the wxFrame from '%s'", dlg.GetPath());
return; return;
} }
@@ -672,21 +672,21 @@ void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
if ( trueFrame ) if ( trueFrame )
trueFrame->Show(); trueFrame->Show();
else else
wxLogError(wxT("Could not show the frame")); wxLogError("Could not show the frame");
} }
void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
{ {
// ask the user which file to load // ask the user which file to load
wxFileDialog dlg(this, wxT("Which file contains the frame to work on?"), wxFileDialog dlg(this, "Which file contains the frame to work on?",
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"), wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
wxFD_OPEN); wxFD_OPEN);
if (dlg.ShowModal() == wxID_CANCEL) if (dlg.ShowModal() == wxID_CANCEL)
return; return;
// ask the user which file to load // ask the user which file to load
wxFileDialog dlg2(this, wxT("Where should the C++ code be saved?"), wxFileDialog dlg2(this, "Where should the C++ code be saved?",
wxEmptyString, wxT("test.cpp"), wxT("Source files (*.cpp)|*.cpp"), wxEmptyString, "test.cpp", "Source files (*.cpp)|*.cpp",
wxFD_SAVE); wxFD_SAVE);
if (dlg2.ShowModal() == wxID_CANCEL) if (dlg2.ShowModal() == wxID_CANCEL)
return; return;
@@ -694,7 +694,7 @@ void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
// do generate code // do generate code
if (!GenerateFrameRTTICode(dlg.GetPath(), dlg2.GetPath())) if (!GenerateFrameRTTICode(dlg.GetPath(), dlg2.GetPath()))
{ {
wxLogError(wxT("Could not generate the code for the frame!")); wxLogError("Could not generate the code for the frame!");
return; return;
} }
@@ -704,7 +704,7 @@ void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
wxStringOutputStream str; wxStringOutputStream str;
f.Read(str); f.Read(str);
wxDialog dlg(this, wxID_ANY, wxT("Generated code"), wxDialog dlg(this, wxID_ANY, "Generated code",
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE); wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE);
wxPanel *panel = new wxPanel(&dlg); wxPanel *panel = new wxPanel(&dlg);
@@ -734,12 +734,12 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
wxMessageBox(wxString::Format( wxMessageBox(wxString::Format(
wxT("Welcome to %s!\n") "Welcome to %s!\n"
wxT("\n") "\n"
wxT("This sample demonstrates wxWidgets eXtended RTTI (XTI) system."), "This sample demonstrates wxWidgets eXtended RTTI (XTI) system.",
wxVERSION_STRING wxVERSION_STRING
), ),
wxT("About wxWidgets XTI sample"), "About wxWidgets XTI sample",
wxOK | wxICON_INFORMATION, wxOK | wxICON_INFORMATION,
this); this);
} }