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:
parent
e768046774
commit
f58ea62596
@ -174,7 +174,7 @@ bool MyApp::OnInit()
|
||||
wxHelpProvider::Set(new wxSimpleHelpProvider());
|
||||
|
||||
// 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));
|
||||
|
||||
// and show it (the frames, unlike simple controls, are not shown when
|
||||
@ -186,7 +186,7 @@ bool MyApp::OnInit()
|
||||
// application would exit immediately.
|
||||
return true;
|
||||
#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;
|
||||
#endif // wxUSE_ACCESSIBILITY
|
||||
}
|
||||
@ -203,7 +203,7 @@ public:
|
||||
{
|
||||
if (childId == wxACC_SELF)
|
||||
{
|
||||
* name = wxT("Julian's Frame");
|
||||
* name = "Julian's Frame";
|
||||
return wxACC_OK;
|
||||
}
|
||||
else
|
||||
@ -221,7 +221,7 @@ public:
|
||||
{
|
||||
if (childId == wxACC_SELF)
|
||||
{
|
||||
* name = wxT("My scrolled window");
|
||||
* name = "My scrolled window";
|
||||
return wxACC_OK;
|
||||
}
|
||||
else
|
||||
@ -307,9 +307,9 @@ public:
|
||||
// of this object.
|
||||
// Acceptable values:
|
||||
// - a null variant (IsNull() returns true)
|
||||
// - a list variant (GetType() == wxT("list"))
|
||||
// - a list variant (GetType() == "list")
|
||||
// - 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
|
||||
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
|
||||
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->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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -354,7 +354,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
#if 0 // wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
|
||||
@ -362,17 +362,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
splitter->SetAccessible(new SplitterWindowAccessible(splitter));
|
||||
|
||||
wxListBox* listBox = new wxListBox(splitter, wxID_ANY);
|
||||
listBox->Append(wxT("Cabbages"));
|
||||
listBox->Append(wxT("Kings"));
|
||||
listBox->Append(wxT("Sealing wax"));
|
||||
listBox->Append(wxT("Strings"));
|
||||
listBox->Append("Cabbages");
|
||||
listBox->Append("Kings");
|
||||
listBox->Append("Sealing wax");
|
||||
listBox->Append("Strings");
|
||||
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);
|
||||
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);
|
||||
|
||||
@ -394,10 +394,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("This is the About dialog of the AccessTest sample.\n")
|
||||
wxT("Welcome to %s"), wxVERSION_STRING);
|
||||
msg.Printf( "This is the About dialog of the AccessTest sample.\n"
|
||||
"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))
|
||||
@ -407,26 +407,26 @@ void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event))
|
||||
if (S_OK != AccessibleObjectFromWindow((HWND) GetHWND(), (DWORD)OBJID_CLIENT,
|
||||
IID_IAccessible, (void**) & accessibleFrame))
|
||||
{
|
||||
Log(wxT("Could not get object."));
|
||||
Log("Could not get object.");
|
||||
return;
|
||||
}
|
||||
if (accessibleFrame)
|
||||
{
|
||||
//Log(wxT("Got an IAccessible for the frame."));
|
||||
//Log("Got an IAccessible for the frame.");
|
||||
LogObject(0, accessibleFrame);
|
||||
Log(wxT("Checking children using AccessibleChildren()..."));
|
||||
Log("Checking children using AccessibleChildren()...");
|
||||
|
||||
// Now check the AccessibleChildren function works OK
|
||||
long childCount = 0;
|
||||
if (S_OK != accessibleFrame->get_accChildCount(& childCount))
|
||||
{
|
||||
Log(wxT("Could not get number of children."));
|
||||
Log("Could not get number of children.");
|
||||
accessibleFrame->Release();
|
||||
return;
|
||||
}
|
||||
else if (childCount == 0)
|
||||
{
|
||||
Log(wxT("No children."));
|
||||
Log("No children.");
|
||||
accessibleFrame->Release();
|
||||
return;
|
||||
}
|
||||
@ -455,7 +455,7 @@ void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event))
|
||||
wxString name, role;
|
||||
GetInfo(childAccessible, 0, name, role);
|
||||
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);
|
||||
childAccessible->Release();
|
||||
}
|
||||
@ -468,7 +468,7 @@ void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(wxT("AccessibleChildren failed."));
|
||||
Log("AccessibleChildren failed.");
|
||||
}
|
||||
delete[] var;
|
||||
|
||||
@ -483,10 +483,10 @@ void MyFrame::Log(const wxString& text)
|
||||
if (m_textCtrl)
|
||||
{
|
||||
wxString text2(text);
|
||||
text2.Replace(wxT("\n"), wxT(" "));
|
||||
text2.Replace(wxT("\r"), wxT(" "));
|
||||
text2.Replace("\n", " ");
|
||||
text2.Replace("\r", " ");
|
||||
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);
|
||||
|
||||
wxString str;
|
||||
str.Printf(wxT("Name = %s; Role = %s"), name.c_str(), role.c_str());
|
||||
str.Pad(indent, wxT(' '), false);
|
||||
str.Printf("Name = %s; Role = %s", name.c_str(), role.c_str());
|
||||
str.Pad(indent, ' ', false);
|
||||
Log(str);
|
||||
}
|
||||
|
||||
@ -508,10 +508,10 @@ void MyFrame::LogObject(int indent, IAccessible* obj)
|
||||
if (S_OK == obj->get_accChildCount(& childCount))
|
||||
{
|
||||
wxString str;
|
||||
str.Printf(wxT("There are %d children."), (int) childCount);
|
||||
str.Pad(indent, wxT(' '), false);
|
||||
str.Printf("There are %d children.", (int) childCount);
|
||||
str.Pad(indent, ' ', false);
|
||||
Log(str);
|
||||
Log(wxT(""));
|
||||
Log("");
|
||||
}
|
||||
|
||||
int i;
|
||||
@ -520,8 +520,8 @@ void MyFrame::LogObject(int indent, IAccessible* obj)
|
||||
GetInfo(obj, i, name, role);
|
||||
|
||||
wxString str;
|
||||
str.Printf(wxT("%d) Name = %s; Role = %s"), i, name.c_str(), role.c_str());
|
||||
str.Pad(indent, wxT(' '), false);
|
||||
str.Printf("%d) Name = %s; Role = %s", i, name.c_str(), role.c_str());
|
||||
str.Pad(indent, ' ', false);
|
||||
Log(str);
|
||||
|
||||
VARIANT var;
|
||||
@ -533,8 +533,8 @@ void MyFrame::LogObject(int indent, IAccessible* obj)
|
||||
|
||||
if (S_OK == obj->get_accChild(var, & pDisp) && pDisp)
|
||||
{
|
||||
str.Printf(wxT("This is a real object."));
|
||||
str.Pad(indent+4, wxT(' '), false);
|
||||
str.Printf("This is a real object.");
|
||||
str.Pad(indent+4, ' ', false);
|
||||
Log(str);
|
||||
|
||||
if (pDisp->QueryInterface(IID_IAccessible, (LPVOID*) & childObject) == S_OK)
|
||||
@ -546,11 +546,11 @@ void MyFrame::LogObject(int indent, IAccessible* obj)
|
||||
}
|
||||
else
|
||||
{
|
||||
str.Printf(wxT("This is an element."));
|
||||
str.Pad(indent+4, wxT(' '), false);
|
||||
str.Printf("This is an element.");
|
||||
str.Pad(indent+4, ' ', false);
|
||||
Log(str);
|
||||
}
|
||||
// Log(wxT(""));
|
||||
// Log("");
|
||||
}
|
||||
|
||||
}
|
||||
@ -573,7 +573,7 @@ void MyFrame::GetInfo(IAccessible* accessible, int id, wxString& name, wxString&
|
||||
}
|
||||
else
|
||||
{
|
||||
name = wxT("NO NAME");
|
||||
name = "NO NAME";
|
||||
}
|
||||
|
||||
VARIANT varRole;
|
||||
@ -590,7 +590,7 @@ void MyFrame::GetInfo(IAccessible* accessible, int id, wxString& name, wxString&
|
||||
}
|
||||
else
|
||||
{
|
||||
role = wxT("NO ROLE");
|
||||
role = "NO ROLE";
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ wxAccStatus SplitterWindowAccessible::GetName(int childId, wxString* name)
|
||||
{
|
||||
if (childId == wxACC_SELF)
|
||||
{
|
||||
* name = wxT("Splitter window");
|
||||
* name = "Splitter window";
|
||||
return wxACC_OK;
|
||||
}
|
||||
wxSplitterWindow* splitter = wxDynamicCast(GetWindow(), wxSplitterWindow);
|
||||
@ -616,7 +616,7 @@ wxAccStatus SplitterWindowAccessible::GetName(int childId, wxString* name)
|
||||
return wxACC_NOT_IMPLEMENTED;
|
||||
else if (childId == 2)
|
||||
{
|
||||
*name = wxT("Sash");
|
||||
*name = "Sash";
|
||||
return wxACC_OK;
|
||||
}
|
||||
}
|
||||
@ -1101,9 +1101,9 @@ wxAccStatus SplitterWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessi
|
||||
// of this object.
|
||||
// Acceptable values:
|
||||
// - a null variant (IsNull() returns true)
|
||||
// - a list variant (GetType() == wxT("list"))
|
||||
// - a list variant (GetType() == "list")
|
||||
// - 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
|
||||
wxAccStatus SplitterWindowAccessible::GetSelections(wxVariant* WXUNUSED(selections))
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ bool MyApp::OnInit()
|
||||
|
||||
// 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),
|
||||
wxDEFAULT_FRAME_STYLE);
|
||||
frame->Show(true);
|
||||
@ -124,31 +124,31 @@ MyFrame::MyFrame(wxWindow *parent,
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
#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
|
||||
file_menu->Append(wxID_EXIT);
|
||||
|
||||
wxMenu *play_menu = new wxMenu;
|
||||
play_menu->Append(ID_PLAY, wxT("Play\tCtrl+P"), wxT("Play the animation"));
|
||||
play_menu->Append(wxID_STOP, wxT("Stop\tCtrl+S"), wxT("Stop the animation"));
|
||||
play_menu->Append(ID_PLAY, "Play\tCtrl+P", "Play the animation");
|
||||
play_menu->Append(wxID_STOP, "Stop\tCtrl+S", "Stop the animation");
|
||||
play_menu->AppendSeparator();
|
||||
play_menu->Append(ID_SET_NULL_ANIMATION, wxT("Set null animation"),
|
||||
wxT("Sets the empty animation in the control"));
|
||||
play_menu->AppendCheckItem(ID_SET_INACTIVE_BITMAP, wxT("Set inactive bitmap"),
|
||||
wxT("Sets an inactive bitmap for the control"));
|
||||
play_menu->AppendCheckItem(ID_SET_NO_AUTO_RESIZE, wxT("Set no autoresize"),
|
||||
wxT("Tells the control not to resize automatically"));
|
||||
play_menu->Append(ID_SET_BGCOLOR, wxT("Set background colour..."),
|
||||
wxT("Sets the background colour of the control"));
|
||||
play_menu->Append(ID_SET_NULL_ANIMATION, "Set null animation",
|
||||
"Sets the empty animation in the control");
|
||||
play_menu->AppendCheckItem(ID_SET_INACTIVE_BITMAP, "Set inactive bitmap",
|
||||
"Sets an inactive bitmap for the control");
|
||||
play_menu->AppendCheckItem(ID_SET_NO_AUTO_RESIZE, "Set no autoresize",
|
||||
"Tells the control not to resize automatically");
|
||||
play_menu->Append(ID_SET_BGCOLOR, "Set background colour...",
|
||||
"Sets the background colour of the control");
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(wxID_ABOUT);
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(play_menu, wxT("&Animation"));
|
||||
menu_bar->Append(help_menu, wxT("&Help"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(play_menu, "&Animation");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with this frame
|
||||
SetMenuBar(menu_bar);
|
||||
@ -161,11 +161,11 @@ MyFrame::MyFrame(wxWindow *parent,
|
||||
// resize the m_animationCtrl to fill its client area on
|
||||
// user resizes
|
||||
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());
|
||||
|
||||
m_animationCtrl = new wxAnimationCtrl(this, wxID_ANY);
|
||||
if (m_animationCtrl->LoadFile(wxT("throbber.gif")))
|
||||
if (m_animationCtrl->LoadFile("throbber.gif"))
|
||||
m_animationCtrl->Play();
|
||||
|
||||
sz->Add(m_animationCtrl, wxSizerFlags().Centre().Border());
|
||||
@ -180,7 +180,7 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
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))
|
||||
{
|
||||
wxColour clr = wxGetColourFromUser(this, m_animationCtrl->GetBackgroundColour(),
|
||||
wxT("Choose the background colour"));
|
||||
"Choose the background colour");
|
||||
|
||||
if (clr.IsOk())
|
||||
m_animationCtrl->SetBackgroundColour(clr);
|
||||
@ -255,11 +255,11 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
wxAboutDialogInfo info;
|
||||
info.SetName(_("wxAnimationCtrl and wxAnimation sample"));
|
||||
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(wxT("Guillermo Rodriguez Garcia"));
|
||||
info.AddDeveloper(wxT("Francesco Montorsi"));
|
||||
info.AddDeveloper("Julian Smart");
|
||||
info.AddDeveloper("Guillermo Rodriguez Garcia");
|
||||
info.AddDeveloper("Francesco Montorsi");
|
||||
|
||||
wxAboutBox(info, this);
|
||||
}
|
||||
@ -267,8 +267,8 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
#if wxUSE_FILEDLG
|
||||
void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxFileDialog dialog(this, wxT("Please choose an animation"),
|
||||
wxEmptyString, wxEmptyString, wxT("*.gif;*.ani"), wxFD_OPEN);
|
||||
wxFileDialog dialog(this, "Please choose an animation",
|
||||
wxEmptyString, wxEmptyString, "*.gif;*.ani", wxFD_OPEN);
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
{
|
||||
wxString filename(dialog.GetPath());
|
||||
@ -278,13 +278,13 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||
if (m_animationCtrl->LoadFile(filename))
|
||||
m_animationCtrl->Play();
|
||||
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
|
||||
#if 0
|
||||
wxAnimation temp;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -294,14 +294,14 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||
wxFileInputStream stream(filename);
|
||||
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;
|
||||
}
|
||||
|
||||
wxAnimation temp;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ wxBEGIN_EVENT_TABLE(wxArtBrowserDialog, wxDialog)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent)
|
||||
: wxDialog(parent, wxID_ANY, wxT("Art resources browser"),
|
||||
: wxDialog(parent, wxID_ANY, "Art resources browser",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
|
||||
{
|
||||
@ -143,7 +143,7 @@ wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent)
|
||||
FillClients(choice);
|
||||
|
||||
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);
|
||||
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),
|
||||
wxLC_REPORT | wxSUNKEN_BORDER);
|
||||
m_list->AppendColumn(wxT("wxArtID"));
|
||||
m_list->AppendColumn("wxArtID");
|
||||
subsizer->Add(m_list, 1, wxEXPAND | wxRIGHT, 10);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
wxButton *ok = new wxButton(this, wxID_OK, wxT("Close"));
|
||||
wxButton *ok = new wxButton(this, wxID_OK, "Close");
|
||||
ok->SetDefault();
|
||||
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);
|
||||
m_canvas->SetSize(bmp.GetWidth(), bmp.GetHeight());
|
||||
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();
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// create the main application window
|
||||
MyFrame *frame = new MyFrame(wxT("wxArtProvider sample"),
|
||||
MyFrame *frame = new MyFrame("wxArtProvider sample",
|
||||
wxPoint(50, 50), wxSize(450, 340));
|
||||
frame->Show(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
|
||||
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();
|
||||
|
||||
#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
|
||||
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->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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -190,22 +190,22 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
#if wxUSE_LOG
|
||||
void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(wxT("Some information."));
|
||||
wxLogError(wxT("This is an error."));
|
||||
wxLogWarning(wxT("A warning."));
|
||||
wxLogError(wxT("Yet another error."));
|
||||
wxLogMessage("Some information.");
|
||||
wxLogError("This is an error.");
|
||||
wxLogWarning("A warning.");
|
||||
wxLogError("Yet another error.");
|
||||
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
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("This is the about dialog of wxArtProvider sample.\n")
|
||||
wxT("Welcome to %s"), wxVERSION_STRING);
|
||||
msg.Printf( "This is the about dialog of wxArtProvider sample.\n"
|
||||
"Welcome to %s", wxVERSION_STRING);
|
||||
|
||||
wxMessageBox(msg, wxT("About wxArtProvider sample"),
|
||||
wxMessageBox(msg, "About wxArtProvider sample",
|
||||
wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ private:
|
||||
wxString s;
|
||||
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.GetTextExtent(s, &w, &height);
|
||||
@ -219,19 +219,19 @@ private:
|
||||
{
|
||||
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.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.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.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.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);
|
||||
|
||||
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(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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s1->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
//vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(5));
|
||||
|
||||
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(new wxStaticText(this, wxID_ANY, wxT("Sash Size:")));
|
||||
s2->Add(new wxStaticText(this, wxID_ANY, "Sash Size:"));
|
||||
s2->Add(m_sash_size);
|
||||
s2->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s2->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
//vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, FromDIP(5));
|
||||
|
||||
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(new wxStaticText(this, wxID_ANY, wxT("Caption Size:")));
|
||||
s3->Add(new wxStaticText(this, wxID_ANY, "Caption Size:"));
|
||||
s3->Add(m_caption_size);
|
||||
s3->Add(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s3->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -324,7 +324,7 @@ public:
|
||||
wxBoxSizer* s4 = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_background_color = new wxBitmapButton(this, ID_BackgroundColor, b, wxDefaultPosition, FromDIP(wxSize(50,25)));
|
||||
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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s4->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -332,7 +332,7 @@ public:
|
||||
wxBoxSizer* s5 = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_sash_color = new wxBitmapButton(this, ID_SashColor, b, wxDefaultPosition, wxSize(50,25));
|
||||
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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s5->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -340,7 +340,7 @@ public:
|
||||
wxBoxSizer* s6 = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_inactive_caption_color = new wxBitmapButton(this, ID_InactiveCaptionColor, b, wxDefaultPosition, wxSize(50,25));
|
||||
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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s6->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -348,7 +348,7 @@ public:
|
||||
wxBoxSizer* s7 = new wxBoxSizer(wxHORIZONTAL);
|
||||
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(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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s7->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -356,7 +356,7 @@ public:
|
||||
wxBoxSizer* s8 = new wxBoxSizer(wxHORIZONTAL);
|
||||
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(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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s8->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -364,7 +364,7 @@ public:
|
||||
wxBoxSizer* s9 = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_active_caption_color = new wxBitmapButton(this, ID_ActiveCaptionColor, b, wxDefaultPosition, wxSize(50,25));
|
||||
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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s9->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -372,7 +372,7 @@ public:
|
||||
wxBoxSizer* s10 = new wxBoxSizer(wxHORIZONTAL);
|
||||
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(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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s10->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -380,7 +380,7 @@ public:
|
||||
wxBoxSizer* s11 = new wxBoxSizer(wxHORIZONTAL);
|
||||
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(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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s11->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -388,7 +388,7 @@ public:
|
||||
wxBoxSizer* s12 = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_border_color = new wxBitmapButton(this, ID_BorderColor, b, wxDefaultPosition, wxSize(50,25));
|
||||
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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s12->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -396,7 +396,7 @@ public:
|
||||
wxBoxSizer* s13 = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_gripper_color = new wxBitmapButton(this, ID_GripperColor, b, wxDefaultPosition, wxSize(50,25));
|
||||
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(FromDIP(1), FromDIP(1), 1, wxEXPAND);
|
||||
s13->SetItemMinSize((size_t)1, FromDIP(wxSize(180, 20)));
|
||||
@ -567,7 +567,7 @@ bool MyApp::OnInit()
|
||||
|
||||
wxFrame* frame = new MyFrame(NULL,
|
||||
wxID_ANY,
|
||||
wxT("wxAUI Sample Application"),
|
||||
"wxAUI Sample Application",
|
||||
wxDefaultPosition,
|
||||
wxWindow::FromDIP(wxSize(800, 600), NULL));
|
||||
frame->Show();
|
||||
@ -783,12 +783,12 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
wxAuiToolBar* tb1 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW);
|
||||
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->AddTool(ID_SampleItem+2, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION));
|
||||
tb1->AddTool(ID_SampleItem+3, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION));
|
||||
tb1->AddTool(ID_SampleItem+4, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING));
|
||||
tb1->AddTool(ID_SampleItem+5, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
|
||||
tb1->AddTool(ID_SampleItem+2, "Test", wxArtProvider::GetBitmap(wxART_QUESTION));
|
||||
tb1->AddTool(ID_SampleItem+3, "Test", wxArtProvider::GetBitmap(wxART_INFORMATION));
|
||||
tb1->AddTool(ID_SampleItem+4, "Test", wxArtProvider::GetBitmap(wxART_WARNING));
|
||||
tb1->AddTool(ID_SampleItem+5, "Test", wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
|
||||
tb1->SetCustomOverflowItems(prepend_items, append_items);
|
||||
tb1->Realize();
|
||||
|
||||
@ -798,18 +798,18 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
tb2->SetToolBitmapSize(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+7, wxT("Test"), tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+8, wxT("Test"), tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+9, wxT("Test"), tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+6, "Disabled", tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+7, "Test", tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+8, "Test", tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+9, "Test", tb2_bmp1);
|
||||
tb2->AddSeparator();
|
||||
tb2->AddTool(ID_SampleItem+10, wxT("Test"), tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+11, wxT("Test"), tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+10, "Test", tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+11, "Test", tb2_bmp1);
|
||||
tb2->AddSeparator();
|
||||
tb2->AddTool(ID_SampleItem+12, wxT("Test"), tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+13, wxT("Test"), tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+14, wxT("Test"), tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+15, wxT("Test"), tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+12, "Test", tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+13, "Test", tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+14, "Test", tb2_bmp1);
|
||||
tb2->AddTool(ID_SampleItem+15, "Test", tb2_bmp1);
|
||||
tb2->SetCustomOverflowItems(prepend_items, append_items);
|
||||
tb2->EnableTool(ID_SampleItem+6, false);
|
||||
tb2->Realize();
|
||||
@ -819,18 +819,18 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW);
|
||||
tb3->SetToolBitmapSize(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+17, wxT("Check 2"), tb3_bmp1, wxT("Check 2"), wxITEM_CHECK);
|
||||
tb3->AddTool(ID_SampleItem+18, wxT("Check 3"), tb3_bmp1, wxT("Check 3"), wxITEM_CHECK);
|
||||
tb3->AddTool(ID_SampleItem+19, wxT("Check 4"), tb3_bmp1, wxT("Check 4"), wxITEM_CHECK);
|
||||
tb3->AddTool(ID_SampleItem+16, "Check 1", tb3_bmp1, "Check 1", wxITEM_CHECK);
|
||||
tb3->AddTool(ID_SampleItem+17, "Check 2", tb3_bmp1, "Check 2", wxITEM_CHECK);
|
||||
tb3->AddTool(ID_SampleItem+18, "Check 3", tb3_bmp1, "Check 3", wxITEM_CHECK);
|
||||
tb3->AddTool(ID_SampleItem+19, "Check 4", tb3_bmp1, "Check 4", wxITEM_CHECK);
|
||||
tb3->AddSeparator();
|
||||
tb3->AddTool(ID_SampleItem+20, wxT("Radio 1"), tb3_bmp1, wxT("Radio 1"), wxITEM_RADIO);
|
||||
tb3->AddTool(ID_SampleItem+21, wxT("Radio 2"), tb3_bmp1, wxT("Radio 2"), wxITEM_RADIO);
|
||||
tb3->AddTool(ID_SampleItem+22, wxT("Radio 3"), tb3_bmp1, wxT("Radio 3"), wxITEM_RADIO);
|
||||
tb3->AddTool(ID_SampleItem+20, "Radio 1", tb3_bmp1, "Radio 1", wxITEM_RADIO);
|
||||
tb3->AddTool(ID_SampleItem+21, "Radio 2", tb3_bmp1, "Radio 2", wxITEM_RADIO);
|
||||
tb3->AddTool(ID_SampleItem+22, "Radio 3", tb3_bmp1, "Radio 3", wxITEM_RADIO);
|
||||
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+24, wxT("Radio 2 (Group 2)"), tb3_bmp1, wxT("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+23, "Radio 1 (Group 2)", tb3_bmp1, "Radio 1 (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, "Radio 3 (Group 2)", tb3_bmp1, "Radio 3 (Group 2)", wxITEM_RADIO);
|
||||
tb3->SetCustomOverflowItems(prepend_items, append_items);
|
||||
tb3->Realize();
|
||||
|
||||
@ -842,20 +842,20 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
wxAUI_TB_HORZ_TEXT);
|
||||
tb4->SetToolBitmapSize(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_SampleItem+23, wxT("Item 2"), tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+24, wxT("Item 3"), tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+25, wxT("Item 4"), tb4_bmp1);
|
||||
tb4->AddTool(ID_DropDownToolbarItem, "Item 1", tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+23, "Item 2", tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+24, "Item 3", tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+25, "Item 4", tb4_bmp1);
|
||||
tb4->AddSeparator();
|
||||
tb4->AddTool(ID_SampleItem+26, wxT("Item 5"), tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+27, wxT("Item 6"), tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+28, wxT("Item 7"), tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+29, wxT("Item 8"), tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+26, "Item 5", tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+27, "Item 6", tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+28, "Item 7", tb4_bmp1);
|
||||
tb4->AddTool(ID_SampleItem+29, "Item 8", tb4_bmp1);
|
||||
tb4->SetToolDropDown(ID_DropDownToolbarItem, true);
|
||||
tb4->SetCustomOverflowItems(prepend_items, append_items);
|
||||
wxChoice* choice = new wxChoice(tb4, ID_SampleItem+35);
|
||||
choice->AppendString(wxT("One choice"));
|
||||
choice->AppendString(wxT("Another choice"));
|
||||
choice->AppendString("One choice");
|
||||
choice->AppendString("Another choice");
|
||||
tb4->AddControl(choice);
|
||||
tb4->Realize();
|
||||
|
||||
@ -863,60 +863,60 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
wxAuiToolBar* tb5 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_VERTICAL);
|
||||
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->AddTool(ID_SampleItem+31, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION));
|
||||
tb5->AddTool(ID_SampleItem+32, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION));
|
||||
tb5->AddTool(ID_SampleItem+33, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING));
|
||||
tb5->AddTool(ID_SampleItem+34, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
|
||||
tb5->AddTool(ID_SampleItem+31, "Test", wxArtProvider::GetBitmap(wxART_QUESTION));
|
||||
tb5->AddTool(ID_SampleItem+32, "Test", wxArtProvider::GetBitmap(wxART_INFORMATION));
|
||||
tb5->AddTool(ID_SampleItem+33, "Test", wxArtProvider::GetBitmap(wxART_WARNING));
|
||||
tb5->AddTool(ID_SampleItem+34, "Test", wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
|
||||
tb5->SetCustomOverflowItems(prepend_items, append_items);
|
||||
tb5->Realize();
|
||||
|
||||
// add a bunch of panes
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
||||
Name(wxT("test1")).Caption(wxT("Pane Caption")).
|
||||
Name("test1").Caption("Pane Caption").
|
||||
Top());
|
||||
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
||||
Name(wxT("test2")).Caption(wxT("Client Size Reporter")).
|
||||
Name("test2").Caption("Client Size Reporter").
|
||||
Bottom().Position(1).
|
||||
CloseButton(true).MaximizeButton(true));
|
||||
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
||||
Name(wxT("test3")).Caption(wxT("Client Size Reporter")).
|
||||
Name("test3").Caption("Client Size Reporter").
|
||||
Bottom().
|
||||
CloseButton(true).MaximizeButton(true));
|
||||
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
||||
Name(wxT("test4")).Caption(wxT("Pane Caption")).
|
||||
Name("test4").Caption("Pane Caption").
|
||||
Left());
|
||||
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
||||
Name(wxT("test5")).Caption(wxT("No Close Button")).
|
||||
Name("test5").Caption("No Close Button").
|
||||
Right().CloseButton(false));
|
||||
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
||||
Name(wxT("test6")).Caption(wxT("Client Size Reporter")).
|
||||
Name("test6").Caption("Client Size Reporter").
|
||||
Right().Row(1).
|
||||
CloseButton(true).MaximizeButton(true));
|
||||
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
||||
Name(wxT("test7")).Caption(wxT("Client Size Reporter")).
|
||||
Name("test7").Caption("Client Size Reporter").
|
||||
Left().Layer(1).
|
||||
CloseButton(true).MaximizeButton(true));
|
||||
|
||||
m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
|
||||
Name(wxT("test8")).Caption(wxT("Tree Pane")).
|
||||
Name("test8").Caption("Tree Pane").
|
||||
Left().Layer(1).Position(1).
|
||||
CloseButton(true).MaximizeButton(true));
|
||||
|
||||
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))).
|
||||
Bottom().Layer(1).
|
||||
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.
|
||||
int iconSize = m_mgr.GetArtProvider()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE);
|
||||
@ -925,65 +925,65 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
iconSize &= ~1;
|
||||
|
||||
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).
|
||||
Icon(wxArtProvider::GetBitmap(wxART_WARNING,
|
||||
wxART_OTHER,
|
||||
wxSize(iconSize, iconSize))));
|
||||
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
||||
Name(wxT("test11")).Caption(wxT("Fixed Pane")).
|
||||
Name("test11").Caption("Fixed Pane").
|
||||
Bottom().Layer(1).Position(2).Fixed());
|
||||
|
||||
|
||||
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());
|
||||
|
||||
// create some center panes
|
||||
|
||||
m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().Name(wxT("grid_content")).
|
||||
m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().Name("grid_content").
|
||||
CenterPane().Hide());
|
||||
|
||||
m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().Name(wxT("tree_content")).
|
||||
m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().Name("tree_content").
|
||||
CenterPane().Hide());
|
||||
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().Name(wxT("sizereport_content")).
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().Name("sizereport_content").
|
||||
CenterPane().Hide());
|
||||
|
||||
m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().Name(wxT("text_content")).
|
||||
m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().Name("text_content").
|
||||
CenterPane().Hide());
|
||||
|
||||
m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().Name(wxT("html_content")).
|
||||
m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().Name("html_content").
|
||||
CenterPane().Hide());
|
||||
|
||||
m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().Name(wxT("notebook_content")).
|
||||
m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().Name("notebook_content").
|
||||
CenterPane().PaneBorder(false));
|
||||
|
||||
// add the toolbars to the manager
|
||||
m_mgr.AddPane(tb1, wxAuiPaneInfo().
|
||||
Name(wxT("tb1")).Caption(wxT("Big Toolbar")).
|
||||
Name("tb1").Caption("Big Toolbar").
|
||||
ToolbarPane().Top());
|
||||
|
||||
m_mgr.AddPane(tb2, wxAuiPaneInfo().
|
||||
Name(wxT("tb2")).Caption(wxT("Toolbar 2 (Horizontal)")).
|
||||
Name("tb2").Caption("Toolbar 2 (Horizontal)").
|
||||
ToolbarPane().Top().Row(1));
|
||||
|
||||
m_mgr.AddPane(tb3, wxAuiPaneInfo().
|
||||
Name(wxT("tb3")).Caption(wxT("Toolbar 3")).
|
||||
Name("tb3").Caption("Toolbar 3").
|
||||
ToolbarPane().Top().Row(1).Position(1));
|
||||
|
||||
m_mgr.AddPane(tb4, wxAuiPaneInfo().
|
||||
Name(wxT("tb4")).Caption(wxT("Sample Bookmark Toolbar")).
|
||||
Name("tb4").Caption("Sample Bookmark Toolbar").
|
||||
ToolbarPane().Top().Row(2));
|
||||
|
||||
m_mgr.AddPane(tb5, wxAuiPaneInfo().
|
||||
Name(wxT("tb5")).Caption(wxT("Sample Vertical Toolbar")).
|
||||
Name("tb5").Caption("Sample Vertical Toolbar").
|
||||
ToolbarPane().Left().
|
||||
GripperTop());
|
||||
|
||||
m_mgr.AddPane(new wxButton(this, wxID_ANY, _("Test Button")),
|
||||
wxAuiPaneInfo().Name(wxT("tb6")).
|
||||
wxAuiPaneInfo().Name("tb6").
|
||||
ToolbarPane().Top().Row(2).Position(1).
|
||||
LeftDockable(false).RightDockable(false));
|
||||
|
||||
@ -996,11 +996,11 @@ MyFrame::MyFrame(wxWindow* parent,
|
||||
for (i = 0, count = all_panes.GetCount(); i < count; ++i)
|
||||
if (!all_panes.Item(i).IsToolbar())
|
||||
all_panes.Item(i).Hide();
|
||||
m_mgr.GetPane(wxT("tb1")).Hide();
|
||||
m_mgr.GetPane(wxT("tb6")).Hide();
|
||||
m_mgr.GetPane(wxT("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(wxT("notebook_content")).Show();
|
||||
m_mgr.GetPane("tb1").Hide();
|
||||
m_mgr.GetPane("tb6").Hide();
|
||||
m_mgr.GetPane("test8").Show().Left().Layer(0).Row(0).Position(0);
|
||||
m_mgr.GetPane("test10").Show().Bottom().Layer(0).Row(0).Position(0);
|
||||
m_mgr.GetPane("notebook_content").Show();
|
||||
wxString perspective_default = m_mgr.SavePerspective();
|
||||
|
||||
m_perspectives.Add(perspective_default);
|
||||
@ -1038,7 +1038,7 @@ void MyFrame::OnSize(wxSizeEvent& event)
|
||||
void MyFrame::OnSettings(wxCommandEvent& WXUNUSED(evt))
|
||||
{
|
||||
// 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)
|
||||
floating_pane.FloatingPosition(GetStartPosition());
|
||||
@ -1091,7 +1091,7 @@ void MyFrame::OnManagerFlag(wxCommandEvent& event)
|
||||
event.GetId() == ID_TransparentHint ||
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
@ -1312,10 +1312,10 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
|
||||
|
||||
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?"),
|
||||
wxT("wxAUI"),
|
||||
int res = wxMessageBox("Are you sure you want to close/hide this pane?",
|
||||
"wxAUI",
|
||||
wxYES_NO,
|
||||
this);
|
||||
if (res != wxYES)
|
||||
@ -1325,10 +1325,10 @@ void MyFrame::OnPaneClose(wxAuiManagerEvent& evt)
|
||||
|
||||
void MyFrame::OnCreatePerspective(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"),
|
||||
wxT("wxAUI Test"));
|
||||
wxTextEntryDialog dlg(this, "Enter a name for the new perspective:",
|
||||
"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)
|
||||
return;
|
||||
|
||||
@ -1364,8 +1364,8 @@ void MyFrame::OnNotebookPageClose(wxAuiNotebookEvent& evt)
|
||||
wxAuiNotebook* ctrl = (wxAuiNotebook*)evt.GetEventObject();
|
||||
if (ctrl->GetPage(evt.GetSelection())->IsKindOf(CLASSINFO(wxHtmlWindow)))
|
||||
{
|
||||
int res = wxMessageBox(wxT("Are you sure you want to close/hide this notebook page?"),
|
||||
wxT("wxAUI"),
|
||||
int res = wxMessageBox("Are you sure you want to close/hide this notebook page?",
|
||||
"wxAUI",
|
||||
wxYES_NO,
|
||||
this);
|
||||
if (res != wxYES)
|
||||
@ -1405,7 +1405,7 @@ wxPoint MyFrame::GetStartPosition()
|
||||
void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
|
||||
Caption(wxT("Tree Control")).
|
||||
Caption("Tree Control").
|
||||
Float().FloatingPosition(GetStartPosition()).
|
||||
FloatingSize(FromDIP(wxSize(150,300))));
|
||||
m_mgr.Update();
|
||||
@ -1414,7 +1414,7 @@ void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().
|
||||
Caption(wxT("Grid")).
|
||||
Caption("Grid").
|
||||
Float().FloatingPosition(GetStartPosition()).
|
||||
FloatingSize(FromDIP(wxSize(300,200))));
|
||||
m_mgr.Update();
|
||||
@ -1423,7 +1423,7 @@ void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().
|
||||
Caption(wxT("HTML Control")).
|
||||
Caption("HTML Control").
|
||||
Float().FloatingPosition(GetStartPosition()).
|
||||
FloatingSize(FromDIP(wxSize(300,200))));
|
||||
m_mgr.Update();
|
||||
@ -1432,7 +1432,7 @@ void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().
|
||||
Caption(wxT("Notebook")).
|
||||
Caption("Notebook").
|
||||
Float().FloatingPosition(GetStartPosition()).
|
||||
//FloatingSize(FromDIP(wxSize(300,200))).
|
||||
CloseButton(true).MaximizeButton(true));
|
||||
@ -1442,7 +1442,7 @@ void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnCreateText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().
|
||||
Caption(wxT("Text Control")).
|
||||
Caption("Text Control").
|
||||
Float().FloatingPosition(GetStartPosition()));
|
||||
m_mgr.Update();
|
||||
}
|
||||
@ -1450,7 +1450,7 @@ void MyFrame::OnCreateText(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnCreateSizeReport(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
|
||||
Caption(wxT("Client Size Reporter")).
|
||||
Caption("Client Size Reporter").
|
||||
Float().FloatingPosition(GetStartPosition()).
|
||||
CloseButton(true).MaximizeButton(true));
|
||||
m_mgr.Update();
|
||||
@ -1458,12 +1458,12 @@ void MyFrame::OnCreateSizeReport(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnChangeContentPane(wxCommandEvent& evt)
|
||||
{
|
||||
m_mgr.GetPane(wxT("grid_content")).Show(evt.GetId() == ID_GridContent);
|
||||
m_mgr.GetPane(wxT("text_content")).Show(evt.GetId() == ID_TextContent);
|
||||
m_mgr.GetPane(wxT("tree_content")).Show(evt.GetId() == ID_TreeContent);
|
||||
m_mgr.GetPane(wxT("sizereport_content")).Show(evt.GetId() == ID_SizeReportContent);
|
||||
m_mgr.GetPane(wxT("html_content")).Show(evt.GetId() == ID_HTMLContent);
|
||||
m_mgr.GetPane(wxT("notebook_content")).Show(evt.GetId() == ID_NotebookContent);
|
||||
m_mgr.GetPane("grid_content").Show(evt.GetId() == ID_GridContent);
|
||||
m_mgr.GetPane("text_content").Show(evt.GetId() == ID_TextContent);
|
||||
m_mgr.GetPane("tree_content").Show(evt.GetId() == ID_TreeContent);
|
||||
m_mgr.GetPane("sizereport_content").Show(evt.GetId() == ID_SizeReportContent);
|
||||
m_mgr.GetPane("html_content").Show(evt.GetId() == ID_HTMLContent);
|
||||
m_mgr.GetPane("notebook_content").Show(evt.GetId() == ID_NotebookContent);
|
||||
m_mgr.Update();
|
||||
}
|
||||
|
||||
@ -1553,7 +1553,7 @@ wxTextCtrl* MyFrame::CreateTextCtrl(const wxString& ctrl_text)
|
||||
if ( !ctrl_text.empty() )
|
||||
text = ctrl_text;
|
||||
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,
|
||||
wxPoint(0,0), FromDIP(wxSize(150,90)),
|
||||
@ -1584,27 +1584,27 @@ wxTreeCtrl* MyFrame::CreateTreeCtrl()
|
||||
imglist->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, size));
|
||||
tree->AssignImageList(imglist);
|
||||
|
||||
wxTreeItemId root = tree->AddRoot(wxT("wxAUI Project"), 0);
|
||||
wxTreeItemId root = tree->AddRoot("wxAUI Project", 0);
|
||||
wxArrayTreeItemIds items;
|
||||
|
||||
|
||||
|
||||
items.Add(tree->AppendItem(root, wxT("Item 1"), 0));
|
||||
items.Add(tree->AppendItem(root, wxT("Item 2"), 0));
|
||||
items.Add(tree->AppendItem(root, wxT("Item 3"), 0));
|
||||
items.Add(tree->AppendItem(root, wxT("Item 4"), 0));
|
||||
items.Add(tree->AppendItem(root, wxT("Item 5"), 0));
|
||||
items.Add(tree->AppendItem(root, "Item 1", 0));
|
||||
items.Add(tree->AppendItem(root, "Item 2", 0));
|
||||
items.Add(tree->AppendItem(root, "Item 3", 0));
|
||||
items.Add(tree->AppendItem(root, "Item 4", 0));
|
||||
items.Add(tree->AppendItem(root, "Item 5", 0));
|
||||
|
||||
|
||||
int i, count;
|
||||
for (i = 0, count = items.Count(); i < count; ++i)
|
||||
{
|
||||
wxTreeItemId id = items.Item(i);
|
||||
tree->AppendItem(id, wxT("Subitem 1"), 1);
|
||||
tree->AppendItem(id, wxT("Subitem 2"), 1);
|
||||
tree->AppendItem(id, wxT("Subitem 3"), 1);
|
||||
tree->AppendItem(id, wxT("Subitem 4"), 1);
|
||||
tree->AppendItem(id, wxT("Subitem 5"), 1);
|
||||
tree->AppendItem(id, "Subitem 1", 1);
|
||||
tree->AppendItem(id, "Subitem 2", 1);
|
||||
tree->AppendItem(id, "Subitem 3", 1);
|
||||
tree->AppendItem(id, "Subitem 4", 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)));
|
||||
|
||||
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)");
|
||||
|
||||
wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
|
||||
@ -1655,42 +1655,42 @@ wxAuiNotebook* MyFrame::CreateNotebook()
|
||||
flex->AddGrowableRow( 3 );
|
||||
flex->AddGrowableCol( 1 );
|
||||
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 wxTextCtrl( panel, -1, wxT(""), wxDefaultPosition, FromDIP(wxSize(100,-1))),
|
||||
flex->Add( new wxStaticText( panel, -1, "wxTextCtrl:" ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
|
||||
flex->Add( new wxTextCtrl( panel, -1, "", wxDefaultPosition, FromDIP(wxSize(100,-1))),
|
||||
1, wxALL|wxALIGN_CENTRE, FromDIP(5) );
|
||||
flex->Add( new wxStaticText( panel, -1, wxT("wxSpinCtrl:") ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
|
||||
flex->Add( new wxSpinCtrl( panel, -1, wxT("5"), wxDefaultPosition, wxDefaultSize,
|
||||
flex->Add( new wxStaticText( panel, -1, "wxSpinCtrl:" ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
|
||||
flex->Add( new wxSpinCtrl( panel, -1, "5", wxDefaultPosition, wxDefaultSize,
|
||||
wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, FromDIP(5) );
|
||||
flex->Add( FromDIP(5), FromDIP(5) ); flex->Add( FromDIP(5), FromDIP(5) );
|
||||
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"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1"), false, page_bmp );
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some text",
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 1", false, page_bmp );
|
||||
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 2") );
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 2" );
|
||||
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 3") );
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 3" );
|
||||
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 4") );
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 4" );
|
||||
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 5") );
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 5" );
|
||||
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 6") );
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 6" );
|
||||
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 7 (longer title)") );
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 7 (longer title)" );
|
||||
ctrl->SetPageToolTip(ctrl->GetPageCount()-1,
|
||||
"wxTextCtrl 7: and the tooltip message can be even longer!");
|
||||
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 8") );
|
||||
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, "Some more text",
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , "wxTextCtrl 8" );
|
||||
|
||||
ctrl->Thaw();
|
||||
return ctrl;
|
||||
|
@ -375,7 +375,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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)
|
||||
);
|
||||
|
||||
@ -402,12 +402,12 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
|
||||
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->Append(Calendar_File_ClearLog, wxT("&Clear log\tCtrl-L"));
|
||||
menuFile->Append(Calendar_File_ClearLog, "&Clear log\tCtrl-L");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(Calendar_File_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuFile->Append(Calendar_File_Quit, "E&xit\tAlt-X", "Quit this program");
|
||||
menuBar->Append(menuFile, "&File");
|
||||
|
||||
wxMenu *menuCal = new wxMenu;
|
||||
#ifdef wxHAS_NATIVE_CALENDARCTRL
|
||||
@ -416,71 +416,71 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
menuCal->AppendSeparator();
|
||||
#endif // wxHAS_NATIVE_CALENDARCTRL
|
||||
menuCal->AppendRadioItem(Calendar_Cal_AutoWeekday,
|
||||
wxT("Automatic &first weekday\tCtrl-V"));
|
||||
"Automatic &first weekday\tCtrl-V");
|
||||
menuCal->AppendRadioItem(Calendar_Cal_Sunday,
|
||||
wxT("Sunday &first weekday\tCtrl-Z"));
|
||||
"Sunday &first weekday\tCtrl-Z");
|
||||
menuCal->AppendRadioItem(Calendar_Cal_Monday,
|
||||
wxT("Monday &first weekday\tCtrl-F"));
|
||||
menuCal->Append(Calendar_Cal_Holidays, wxT("Show &holidays\tCtrl-H"),
|
||||
wxT("Toggle highlighting the holidays"),
|
||||
"Monday &first weekday\tCtrl-F");
|
||||
menuCal->Append(Calendar_Cal_Holidays, "Show &holidays\tCtrl-H",
|
||||
"Toggle highlighting the holidays",
|
||||
true);
|
||||
menuCal->Append(Calendar_Cal_Special, wxT("Highlight &special dates\tCtrl-S"),
|
||||
wxT("Test custom highlighting"),
|
||||
menuCal->Append(Calendar_Cal_Special, "Highlight &special dates\tCtrl-S",
|
||||
"Test custom highlighting",
|
||||
true);
|
||||
menuCal->Append(Calendar_Cal_SurroundWeeks,
|
||||
wxT("Show s&urrounding weeks\tCtrl-W"),
|
||||
wxT("Show the neighbouring weeks in the prev/next month"),
|
||||
"Show s&urrounding weeks\tCtrl-W",
|
||||
"Show the neighbouring weeks in the prev/next month",
|
||||
true);
|
||||
menuCal->Append(Calendar_Cal_WeekNumbers,
|
||||
wxT("Show &week numbers"),
|
||||
wxT("Toggle week numbers"),
|
||||
"Show &week numbers",
|
||||
"Toggle week numbers",
|
||||
true);
|
||||
menuCal->AppendSeparator();
|
||||
menuCal->Append(Calendar_Cal_SeqMonth,
|
||||
wxT("Toggle month selector st&yle\tCtrl-Y"),
|
||||
wxT("Use another style for the calendar controls"),
|
||||
"Toggle month selector st&yle\tCtrl-Y",
|
||||
"Use another style for the calendar controls",
|
||||
true);
|
||||
menuCal->Append(Calendar_Cal_Month, wxT("&Month can be changed\tCtrl-M"),
|
||||
wxT("Allow changing the month in the calendar"),
|
||||
menuCal->Append(Calendar_Cal_Month, "&Month can be changed\tCtrl-M",
|
||||
"Allow changing the month in the calendar",
|
||||
true);
|
||||
menuCal->AppendCheckItem(Calendar_Cal_LimitDates, wxT("Toggle date ra&nge\tCtrl-N"),
|
||||
wxT("Limit the valid dates"));
|
||||
menuCal->AppendCheckItem(Calendar_Cal_LimitDates, "Toggle date ra&nge\tCtrl-N",
|
||||
"Limit the valid dates");
|
||||
menuCal->AppendSeparator();
|
||||
menuCal->Append(Calendar_Cal_SetDate, wxT("Call &SetDate(2005-12-24)"), wxT("Set date to 2005-12-24."));
|
||||
menuCal->Append(Calendar_Cal_Today, wxT("Call &Today()"), wxT("Set to the current date."));
|
||||
menuCal->Append(Calendar_Cal_SetDate, "Call &SetDate(2005-12-24)", "Set date to 2005-12-24.");
|
||||
menuCal->Append(Calendar_Cal_Today, "Call &Today()", "Set to the current date.");
|
||||
menuCal->Append(Calendar_Cal_BeginDST, "Call SetDate(GetBeginDST())");
|
||||
menuCal->AppendSeparator();
|
||||
menuCal->AppendCheckItem(Calendar_Cal_Resizable, wxT("Make &resizable\tCtrl-R"));
|
||||
menuBar->Append(menuCal, wxT("&Calendar"));
|
||||
menuCal->AppendCheckItem(Calendar_Cal_Resizable, "Make &resizable\tCtrl-R");
|
||||
menuBar->Append(menuCal, "&Calendar");
|
||||
|
||||
#if wxUSE_DATEPICKCTRL
|
||||
wxMenu *menuDate = new wxMenu;
|
||||
menuDate->AppendCheckItem(Calendar_DatePicker_ShowCentury,
|
||||
wxT("Al&ways show century"));
|
||||
"Al&ways show century");
|
||||
menuDate->AppendCheckItem(Calendar_DatePicker_DropDown,
|
||||
wxT("Use &drop down control"));
|
||||
"Use &drop down control");
|
||||
menuDate->AppendCheckItem(Calendar_DatePicker_AllowNone,
|
||||
wxT("Allow &no date"));
|
||||
"Allow &no date");
|
||||
menuDate->AppendCheckItem(Calendar_DatePicker_StartWithNone,
|
||||
wxT("Start &with no date"));
|
||||
"Start &with no date");
|
||||
#if wxUSE_DATEPICKCTRL_GENERIC
|
||||
menuDate->AppendCheckItem(Calendar_DatePicker_Generic,
|
||||
wxT("Use &generic version of the control"));
|
||||
"Use &generic version of the control");
|
||||
#endif // wxUSE_DATEPICKCTRL_GENERIC
|
||||
menuDate->AppendSeparator();
|
||||
menuDate->Append(Calendar_DatePicker_AskDate, wxT("&Choose date...\tCtrl-D"), wxT("Show dialog with wxDatePickerCtrl"));
|
||||
menuBar->Append(menuDate, wxT("&Date picker"));
|
||||
menuDate->Append(Calendar_DatePicker_AskDate, "&Choose date...\tCtrl-D", "Show dialog with wxDatePickerCtrl");
|
||||
menuBar->Append(menuDate, "&Date picker");
|
||||
#endif // wxUSE_DATEPICKCTRL
|
||||
|
||||
#if wxUSE_TIMEPICKCTRL
|
||||
wxMenu *menuTime = new wxMenu;
|
||||
#if wxUSE_TIMEPICKCTRL_GENERIC
|
||||
menuTime->AppendCheckItem(Calendar_TimePicker_Generic,
|
||||
wxT("Use &generic version of the control"));
|
||||
"Use &generic version of the control");
|
||||
menuTime->AppendSeparator();
|
||||
#endif // wxUSE_TIMEPICKCTRL_GENERIC
|
||||
menuTime->Append(Calendar_TimePicker_AskTime, wxT("&Choose time...\tCtrl-T"), wxT("Show dialog with wxTimePickerCtrl"));
|
||||
menuBar->Append(menuTime, wxT("&Time picker"));
|
||||
menuTime->Append(Calendar_TimePicker_AskTime, "&Choose time...\tCtrl-T", "Show dialog with wxTimePickerCtrl");
|
||||
menuBar->Append(menuTime, "&Time picker");
|
||||
#endif // wxUSE_TIMEPICKCTRL
|
||||
|
||||
menuBar->Check(Calendar_Cal_AutoWeekday, true);
|
||||
@ -517,8 +517,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("wxCalendarCtrl sample\n(c) 2000--2008 Vadim Zeitlin"),
|
||||
wxT("About Calendar"), wxOK | wxICON_INFORMATION, this);
|
||||
wxMessageBox("wxCalendarCtrl sample\n(c) 2000--2008 Vadim Zeitlin",
|
||||
"About Calendar", wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
void MyFrame::OnClearLog(wxCommandEvent& WXUNUSED(event))
|
||||
@ -691,16 +691,16 @@ void MyFrame::OnAskDate(wxCommandEvent& WXUNUSED(event))
|
||||
if ( dt.GetDay() == today.GetDay() &&
|
||||
dt.GetMonth() == today.GetMonth() )
|
||||
{
|
||||
wxMessageBox(wxT("Happy birthday!"), wxT("Calendar Sample"));
|
||||
wxMessageBox("Happy birthday!", "Calendar Sample");
|
||||
}
|
||||
|
||||
m_panel->SetDate(dt);
|
||||
|
||||
wxLogStatus(wxT("Changed the date to your input"));
|
||||
wxLogStatus("Changed the date to your input");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(wxT("No date entered"));
|
||||
wxLogStatus("No date entered");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -734,7 +734,7 @@ MyPanel::MyPanel(wxWindow *parent)
|
||||
#endif
|
||||
|
||||
wxString date;
|
||||
date.Printf(wxT("Selected date: %s"),
|
||||
date.Printf("Selected date: %s",
|
||||
wxDateTime::Today().FormatISODate().c_str());
|
||||
m_date = new wxStaticText(this, wxID_ANY, date);
|
||||
m_calendar = DoCreateCalendar(wxDefaultDateTime,
|
||||
@ -760,14 +760,14 @@ void MyPanel::OnCalendar(wxCalendarEvent& event)
|
||||
s_dateLast = event.GetDate();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
void MyPanel::OnCalendarChange(wxCalendarEvent& event)
|
||||
{
|
||||
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);
|
||||
wxLogStatus(s);
|
||||
@ -775,20 +775,20 @@ void MyPanel::OnCalendarChange(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()),
|
||||
event.GetDate().GetYear());
|
||||
}
|
||||
|
||||
void MyPanel::OnCalendarWeekDayClick(wxCalendarEvent& event)
|
||||
{
|
||||
wxLogMessage(wxT("Clicked on %s"),
|
||||
wxLogMessage("Clicked on %s",
|
||||
wxDateTime::GetWeekDayName(event.GetWeekDay()).c_str());
|
||||
}
|
||||
|
||||
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)
|
||||
@ -930,7 +930,7 @@ wxBEGIN_EVENT_TABLE(MyDateDialog, wxDialog)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
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
|
||||
wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent);
|
||||
@ -988,7 +988,7 @@ wxBEGIN_EVENT_TABLE(MyTimeDialog, wxDialog)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
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
|
||||
wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent);
|
||||
|
@ -186,7 +186,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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));
|
||||
|
||||
frame->Show(true);
|
||||
@ -211,17 +211,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
|
||||
menuFile->Append(Caret_SetBlinkTime, wxT("&Blink time...\tCtrl-B"));
|
||||
menuFile->Append(Caret_SetFontSize, wxT("&Font size...\tCtrl-S"));
|
||||
menuFile->Append(Caret_Move, wxT("&Move caret\tCtrl-C"));
|
||||
menuFile->Append(Caret_SetBlinkTime, "&Blink time...\tCtrl-B");
|
||||
menuFile->Append(Caret_SetFontSize, "&Font size...\tCtrl-S");
|
||||
menuFile->Append(Caret_Move, "&Move caret\tCtrl-C");
|
||||
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->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...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -231,7 +231,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
@ -246,8 +246,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("The caret wxWidgets sample.\n(c) 1999 Vadim Zeitlin"),
|
||||
wxT("About Caret"), wxOK | wxICON_INFORMATION, this);
|
||||
wxMessageBox("The caret wxWidgets sample.\n(c) 1999 Vadim Zeitlin",
|
||||
"About Caret", wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
void MyFrame::OnCaretMove(wxCommandEvent& WXUNUSED(event))
|
||||
@ -259,9 +259,9 @@ void MyFrame::OnSetBlinkTime(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long blinkTime = wxGetNumberFromUser
|
||||
(
|
||||
wxT("The caret blink time is the time between two blinks"),
|
||||
wxT("Time in milliseconds:"),
|
||||
wxT("wxCaret sample"),
|
||||
"The caret blink time is the time between two blinks",
|
||||
"Time in milliseconds:",
|
||||
"wxCaret sample",
|
||||
wxCaret::GetBlinkTime(), 0, 10000,
|
||||
this
|
||||
);
|
||||
@ -269,7 +269,7 @@ void MyFrame::OnSetBlinkTime(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxCaret::SetBlinkTime((int)blinkTime);
|
||||
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
|
||||
(
|
||||
wxT("The font size also determines the caret size so\nthis demonstrates resizing the caret."),
|
||||
wxT("Font size (in points):"),
|
||||
wxT("wxCaret sample"),
|
||||
"The font size also determines the caret size so\nthis demonstrates resizing the caret.",
|
||||
"Font size (in points):",
|
||||
"wxCaret sample",
|
||||
12, 1, 100,
|
||||
this
|
||||
);
|
||||
@ -363,7 +363,7 @@ void MyCanvas::MoveCaret(int x, int y)
|
||||
|
||||
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,
|
||||
m_yMargin + m_yCaret * m_heightChar);
|
||||
@ -395,7 +395,7 @@ void MyCanvas::ChangeSize()
|
||||
if ( frame && frame->GetStatusBar() )
|
||||
{
|
||||
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);
|
||||
}
|
||||
#endif // wxUSE_STATUSBAR
|
||||
@ -422,7 +422,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
wxChar ch = CharAt(x, y);
|
||||
if ( !ch )
|
||||
ch = wxT(' ');
|
||||
ch = ' ';
|
||||
#ifdef __WXOSX__
|
||||
dc.DrawText(ch, m_xMargin + x * m_widthChar,
|
||||
m_yMargin + y * m_heightChar );
|
||||
|
@ -171,7 +171,7 @@ wxEND_EVENT_TABLE()
|
||||
|
||||
// My frame constructor
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame(NULL, wxID_ANY, wxT("wxCollapsiblePane sample"),
|
||||
: wxFrame(NULL, wxID_ANY, "wxCollapsiblePane sample",
|
||||
wxDefaultPosition, wxSize(420, 300),
|
||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
{
|
||||
@ -183,12 +183,12 @@ MyFrame::MyFrame()
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *paneMenu = new wxMenu;
|
||||
paneMenu->Append(PANE_COLLAPSE, wxT("Collapse\tCtrl-C"));
|
||||
paneMenu->Append(PANE_EXPAND, wxT("Expand\tCtrl-E"));
|
||||
paneMenu->Append(PANE_COLLAPSE, "Collapse\tCtrl-C");
|
||||
paneMenu->Append(PANE_EXPAND, "Expand\tCtrl-E");
|
||||
paneMenu->AppendSeparator();
|
||||
paneMenu->Append(PANE_SETLABEL, wxT("Set label...\tCtrl-L"));
|
||||
paneMenu->Append(PANE_SETLABEL, "Set label...\tCtrl-L");
|
||||
paneMenu->AppendSeparator();
|
||||
paneMenu->Append(PANE_SHOWDLG, wxT("Show dialog...\tCtrl-S"));
|
||||
paneMenu->Append(PANE_SHOWDLG, "Show dialog...\tCtrl-S");
|
||||
paneMenu->AppendSeparator();
|
||||
paneMenu->Append(PANE_QUIT);
|
||||
|
||||
@ -196,8 +196,8 @@ MyFrame::MyFrame()
|
||||
helpMenu->Append(PANE_ABOUT);
|
||||
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(paneMenu, wxT("&Pane"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(paneMenu, "&Pane");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
m_collPane = new wxCollapsiblePane(this, -1, "This is a wxCollapsiblePane");
|
||||
@ -208,10 +208,10 @@ MyFrame::MyFrame()
|
||||
m_paneSizer->AddSpacer( 20 );
|
||||
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, wxT("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 wxButton(win, PANE_BUTTON, wxT("Press to align right") ), 0, wxALIGN_LEFT | wxALL, 3 );
|
||||
paneSubSizer->Add( new wxStaticText(win, -1, "Static text" ), 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, "Text control", wxDefaultPosition, wxSize(80,-1) ), 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 );
|
||||
|
||||
@ -248,7 +248,7 @@ void MyFrame::OnSetLabel(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxString text = wxGetTextFromUser
|
||||
(
|
||||
wxT("Enter new label"),
|
||||
"Enter new label",
|
||||
wxGetTextFromUserPromptStr,
|
||||
m_collPane->GetLabel()
|
||||
);
|
||||
@ -266,7 +266,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
wxAboutDialogInfo info;
|
||||
info.SetName(_("wxCollapsiblePane sample"));
|
||||
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);
|
||||
}
|
||||
@ -309,20 +309,20 @@ wxBEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
MyDialog::MyDialog(wxFrame *parent)
|
||||
: wxDialog(parent, wxID_ANY, wxT("Test dialog"),
|
||||
: wxDialog(parent, wxID_ANY, "Test dialog",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE )
|
||||
{
|
||||
wxSizer *sz = new wxBoxSizer(wxVERTICAL);
|
||||
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);
|
||||
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);
|
||||
|
||||
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(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->Add(new wxButton(this, wxID_OK), 0, wxALIGN_RIGHT|wxALL, 5);
|
||||
|
||||
@ -330,10 +330,10 @@ MyDialog::MyDialog(wxFrame *parent)
|
||||
wxWindow *win = m_collPane->GetPane();
|
||||
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, wxT("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 wxButton(win, PANE_BUTTON, wxT("Press to align right") ), 0, wxALIGN_LEFT );
|
||||
m_paneSizer->Add( new wxStaticText(win, -1, "Static text" ), 0, wxALIGN_LEFT );
|
||||
m_paneSizer->Add( new wxStaticText(win, -1, "Yet another one!" ), 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, "Press to align right" ), 0, wxALIGN_LEFT );
|
||||
win->SetSizer( m_paneSizer );
|
||||
|
||||
win->SetSizer( m_paneSizer );
|
||||
@ -358,7 +358,7 @@ void MyDialog::OnAlignButton(wxCommandEvent& WXUNUSED(ev))
|
||||
|
||||
void MyDialog::OnPaneChanged(wxCollapsiblePaneEvent& event)
|
||||
{
|
||||
wxLogMessage(wxT("The pane has just been %s by the user"),
|
||||
event.GetCollapsed() ? wxT("collapsed") : wxT("expanded"));
|
||||
wxLogMessage("The pane has just been %s by the user",
|
||||
event.GetCollapsed() ? "collapsed" : "expanded");
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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
|
||||
// created initially)
|
||||
@ -558,7 +558,7 @@ public:
|
||||
dc.DrawRectangle(0,0,bmp.GetWidth(),bmp.GetHeight());
|
||||
|
||||
// Draw text
|
||||
wxString str = wxT("...");
|
||||
wxString str = "...";
|
||||
int w,h;
|
||||
dc.GetTextExtent(str, &w, &h, 0, 0);
|
||||
dc.DrawText(str, (bmp.GetWidth()-w)/2, (bmp.GetHeight()-h)/2);
|
||||
@ -577,10 +577,10 @@ public:
|
||||
// Show standard wxFileDialog on button click
|
||||
|
||||
wxFileDialog dlg(this,
|
||||
wxT("Choose File"),
|
||||
"Choose File",
|
||||
wxEmptyString,
|
||||
GetValue(),
|
||||
wxT("All files (*.*)|*.*"),
|
||||
"All files (*.*)|*.*",
|
||||
wxFD_OPEN);
|
||||
|
||||
if ( dlg.ShowModal() == wxID_OK )
|
||||
@ -623,17 +623,17 @@ MyFrame::MyFrame(const wxString& title)
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
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..."),
|
||||
wxT("Show some wxOwnerDrawnComboBoxes side-by-side with native wxComboBoxes."));
|
||||
fileMenu->Append(ComboCtrl_Compare, "&Compare against wxComboBox...",
|
||||
"Show some wxOwnerDrawnComboBoxes side-by-side with native wxComboBoxes.");
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(fileMenu, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -663,18 +663,18 @@ MyFrame::MyFrame(const wxString& title)
|
||||
wxOwnerDrawnComboBox* odc;
|
||||
|
||||
// Create common strings array
|
||||
m_arrItems.Add( wxT("Solid") );
|
||||
m_arrItems.Add( wxT("Transparent") );
|
||||
m_arrItems.Add( wxT("Dot") );
|
||||
m_arrItems.Add( wxT("Long Dash") );
|
||||
m_arrItems.Add( wxT("Short Dash") );
|
||||
m_arrItems.Add( wxT("Dot Dash") );
|
||||
m_arrItems.Add( wxT("Backward Diagonal Hatch") );
|
||||
m_arrItems.Add( wxT("Cross-diagonal Hatch") );
|
||||
m_arrItems.Add( wxT("Forward Diagonal Hatch") );
|
||||
m_arrItems.Add( wxT("Cross Hatch") );
|
||||
m_arrItems.Add( wxT("Horizontal Hatch") );
|
||||
m_arrItems.Add( wxT("Vertical Hatch") );
|
||||
m_arrItems.Add( "Solid" );
|
||||
m_arrItems.Add( "Transparent" );
|
||||
m_arrItems.Add( "Dot" );
|
||||
m_arrItems.Add( "Long Dash" );
|
||||
m_arrItems.Add( "Short Dash" );
|
||||
m_arrItems.Add( "Dot Dash" );
|
||||
m_arrItems.Add( "Backward Diagonal Hatch" );
|
||||
m_arrItems.Add( "Cross-diagonal Hatch" );
|
||||
m_arrItems.Add( "Forward Diagonal Hatch" );
|
||||
m_arrItems.Add( "Cross Hatch" );
|
||||
m_arrItems.Add( "Horizontal Hatch" );
|
||||
m_arrItems.Add( "Vertical Hatch" );
|
||||
|
||||
|
||||
//
|
||||
@ -682,7 +682,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
//
|
||||
rowSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
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 );
|
||||
colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
@ -713,7 +713,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
//
|
||||
rowSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
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 );
|
||||
colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
@ -755,7 +755,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
wxID_ANY,
|
||||
"List View wxComboCtrl (custom animation):"),
|
||||
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 );
|
||||
colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
@ -778,7 +778,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
|
||||
int 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 );
|
||||
|
||||
@ -800,22 +800,22 @@ MyFrame::MyFrame(const wxString& title)
|
||||
gcc->SetPopupControl(tcPopup);
|
||||
|
||||
// Add items using wxTreeCtrl methods directly
|
||||
wxTreeItemId rootId = tcPopup->AddRoot(wxT("<hidden_root>"));
|
||||
wxTreeItemId rootId = tcPopup->AddRoot("<hidden_root>");
|
||||
|
||||
wxTreeItemId groupId;
|
||||
|
||||
for ( i=0; i<4; i++ )
|
||||
{
|
||||
groupId = tcPopup->AppendItem(rootId,
|
||||
wxString::Format(wxT("Branch %02i"),i));
|
||||
wxString::Format("Branch %02i",i));
|
||||
|
||||
int n;
|
||||
for ( n=0; n<25; n++ )
|
||||
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
|
||||
gcc->SetButtonPosition(-1, // button width
|
||||
@ -837,7 +837,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
//
|
||||
rowSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
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 );
|
||||
|
||||
colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
@ -858,9 +858,9 @@ MyFrame::MyFrame(const wxString& title)
|
||||
);
|
||||
|
||||
// Load images from disk
|
||||
wxImage imgNormal(wxT("dropbutn.png"));
|
||||
wxImage imgPressed(wxT("dropbutp.png"));
|
||||
wxImage imgHover(wxT("dropbuth.png"));
|
||||
wxImage imgNormal("dropbutn.png");
|
||||
wxImage imgPressed("dropbutp.png");
|
||||
wxImage imgHover("dropbuth.png");
|
||||
|
||||
if ( imgNormal.IsOk() && imgPressed.IsOk() && imgHover.IsOk() )
|
||||
{
|
||||
@ -871,7 +871,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
odc2->SetButtonBitmaps(bmpNormal,true,bmpPressed,bmpHover);
|
||||
}
|
||||
else
|
||||
wxLogError(wxT("Dropbutton images not found"));
|
||||
wxLogError("Dropbutton images not found");
|
||||
|
||||
//odc2->SetButtonPosition(0, // width adjustment
|
||||
// 0, // height adjustment
|
||||
@ -890,7 +890,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
//
|
||||
rowSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
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 );
|
||||
|
||||
|
||||
@ -917,7 +917,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
colSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
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 );
|
||||
|
||||
topRowSizer->Add( colSizer, 1, wxEXPAND|wxALL, 2 );
|
||||
@ -940,7 +940,7 @@ void MyFrame::OnComboBoxUpdate( wxCommandEvent& event )
|
||||
|
||||
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 )
|
||||
{
|
||||
@ -969,7 +969,7 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
|
||||
const int border = 4;
|
||||
|
||||
wxDialog* dlg = new wxDialog(this,wxID_ANY,
|
||||
wxT("Compare against wxComboBox"),
|
||||
"Compare against wxComboBox",
|
||||
wxDefaultPosition,wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
|
||||
|
||||
@ -977,11 +977,11 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
rowSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY,wxT(" wxOwnerDrawnComboBox ")),
|
||||
groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY," wxOwnerDrawnComboBox "),
|
||||
wxVERTICAL);
|
||||
|
||||
groupSizer->Add( new wxStaticText(dlg, wxID_ANY,
|
||||
wxT("Writable, with margins, sorted:")),
|
||||
"Writable, with margins, sorted:"),
|
||||
wxSizerFlags().Expand().Border(wxRIGHT, border) );
|
||||
|
||||
odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString,
|
||||
@ -990,9 +990,9 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
|
||||
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);
|
||||
groupSizer->Add( odc, wxSizerFlags().Border(wxALL, border) );
|
||||
groupSizer->AddStretchSpacer();
|
||||
@ -1000,7 +1000,7 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
|
||||
//
|
||||
// Readonly ODComboBox
|
||||
groupSizer->Add( new wxStaticText(dlg, wxID_ANY,
|
||||
wxT("Read-only, big font:")),
|
||||
"Read-only, big font:"),
|
||||
wxSizerFlags().Border(wxRIGHT, border) );
|
||||
|
||||
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->SetValue(wxT("Dot Dash"));
|
||||
odc->SetText(wxT("Dot Dash (Testing SetText)"));
|
||||
odc->SetValue("Dot Dash");
|
||||
odc->SetText("Dot Dash (Testing SetText)");
|
||||
|
||||
groupSizer->Add( odc, 0, wxALL, border );
|
||||
groupSizer->AddStretchSpacer();
|
||||
|
||||
//
|
||||
// Disabled ODComboBox
|
||||
groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Disabled:")),
|
||||
groupSizer->Add( new wxStaticText(dlg,wxID_ANY,"Disabled:"),
|
||||
wxSizerFlags().Border(wxRIGHT, border) );
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
odc->SetValue(wxT("Dot Dash"));
|
||||
odc->SetValue("Dot Dash");
|
||||
odc->Enable(false);
|
||||
|
||||
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 );
|
||||
|
||||
|
||||
groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY,wxT(" wxComboBox ")),
|
||||
groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY," wxComboBox "),
|
||||
wxVERTICAL);
|
||||
|
||||
//
|
||||
// wxComboBox
|
||||
//
|
||||
groupSizer->Add( new wxStaticText(dlg,wxID_ANY,
|
||||
wxT("Writable, with margins, sorted:")),
|
||||
"Writable, with margins, sorted:"),
|
||||
wxSizerFlags().Expand().Border(wxRIGHT, border) );
|
||||
|
||||
cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,
|
||||
@ -1051,9 +1051,9 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
|
||||
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);
|
||||
groupSizer->Add( cb, wxSizerFlags().Border(wxALL, border) );
|
||||
groupSizer->AddStretchSpacer();
|
||||
@ -1061,7 +1061,7 @@ void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
|
||||
//
|
||||
// Readonly wxComboBox
|
||||
groupSizer->Add( new wxStaticText(dlg, wxID_ANY,
|
||||
wxT("Read-only, big font:")),
|
||||
"Read-only, big font:"),
|
||||
wxSizerFlags().Border(wxRIGHT, border) );
|
||||
|
||||
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->SetValue(wxT("Dot Dash"));
|
||||
cb->SetValue("Dot Dash");
|
||||
|
||||
groupSizer->Add( cb, 0, wxALL, border );
|
||||
groupSizer->AddStretchSpacer();
|
||||
|
||||
//
|
||||
// Disabled wxComboBox
|
||||
groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Disabled:")),
|
||||
groupSizer->Add( new wxStaticText(dlg,wxID_ANY,"Disabled:"),
|
||||
wxSizerFlags().Border(wxRIGHT, border) );
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
cb->SetValue(wxT("Dot Dash"));
|
||||
cb->SetValue("Dot Dash");
|
||||
cb->Enable(false);
|
||||
|
||||
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))
|
||||
{
|
||||
wxMessageBox(wxString::Format(
|
||||
wxT("Welcome to %s!\n")
|
||||
wxT("\n")
|
||||
wxT("This is the wxWidgets wxComboCtrl and wxOwnerDrawnComboBox sample\n")
|
||||
wxT("running under %s."),
|
||||
"Welcome to %s!\n"
|
||||
"\n"
|
||||
"This is the wxWidgets wxComboCtrl and wxOwnerDrawnComboBox sample\n"
|
||||
"running under %s.",
|
||||
wxVERSION_STRING,
|
||||
wxGetOsDescription().c_str()
|
||||
),
|
||||
wxT("About wxComboCtrl sample"),
|
||||
"About wxComboCtrl sample",
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
}
|
||||
@ -1141,11 +1141,11 @@ void MyFrame::OnIdle(wxIdleEvent& event)
|
||||
|
||||
if ( curFocus != lastFocus )
|
||||
{
|
||||
const wxChar* className = wxT("<none>");
|
||||
const wxChar* className = "<none>";
|
||||
if ( curFocus )
|
||||
className = curFocus->GetClassInfo()->GetClassName();
|
||||
lastFocus = curFocus;
|
||||
wxLogDebug( wxT("FOCUSED: %s %X"),
|
||||
wxLogDebug( "FOCUSED: %s %X",
|
||||
className,
|
||||
(unsigned int)curFocus);
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ bool MyApp::OnInit()
|
||||
// of the config file/registry key and must be set before the first call
|
||||
// to Get() if you want to override the default values (the application
|
||||
// name is the name of the executable and the vendor name is the same)
|
||||
SetVendorName(wxT("wxWidgets"));
|
||||
SetAppName(wxT("conftest")); // not needed, it's the default value
|
||||
SetVendorName("wxWidgets");
|
||||
SetAppName("conftest"); // not needed, it's the default value
|
||||
|
||||
wxConfigBase *pConfig = wxConfigBase::Get();
|
||||
|
||||
@ -120,11 +120,11 @@ bool MyApp::OnInit()
|
||||
frame->Show(true);
|
||||
|
||||
// use our config object...
|
||||
if ( pConfig->Read(wxT("/Controls/Check"), 1l) != 0 ) {
|
||||
wxMessageBox(wxT("You can disable this message box by unchecking\n")
|
||||
wxT("the checkbox in the main window (of course, a real\n")
|
||||
wxT("program would have a checkbox right here but we\n")
|
||||
wxT("keep it simple)"), wxT("Welcome to wxConfig demo"),
|
||||
if ( pConfig->Read("/Controls/Check", 1l) != 0 ) {
|
||||
wxMessageBox("You can disable this message box by unchecking\n"
|
||||
"the checkbox in the main window (of course, a real\n"
|
||||
"program would have a checkbox right here but we\n"
|
||||
"keep it simple)", "Welcome to wxConfig demo",
|
||||
wxICON_INFORMATION | wxOK);
|
||||
}
|
||||
|
||||
@ -147,20 +147,20 @@ int MyApp::OnExit()
|
||||
|
||||
// main frame ctor
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame((wxFrame *) NULL, wxID_ANY, wxT("wxConfig Demo"))
|
||||
: wxFrame((wxFrame *) NULL, wxID_ANY, "wxConfig Demo")
|
||||
{
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
// menu
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(wxID_DELETE, wxT("&Delete"), wxT("Delete config file"));
|
||||
file_menu->Append(wxID_DELETE, "&Delete", "Delete config file");
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(wxID_ABOUT, wxT("&About\tF1"), wxT("About this sample"));
|
||||
file_menu->Append(wxID_ABOUT, "&About\tF1", "About this sample");
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"), wxT("Exit the program"));
|
||||
file_menu->Append(wxID_EXIT, "E&xit\tAlt-X", "Exit the program");
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
SetMenuBar(menu_bar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
@ -169,9 +169,9 @@ MyFrame::MyFrame()
|
||||
|
||||
// child controls
|
||||
wxPanel *panel = new wxPanel(this);
|
||||
wxStaticText* st = new wxStaticText(panel, wxID_ANY, wxT("These controls remember their values!"));
|
||||
wxStaticText* st = new wxStaticText(panel, wxID_ANY, "These controls remember their values!");
|
||||
m_text = new wxTextCtrl(panel, wxID_ANY);
|
||||
m_check = new wxCheckBox(panel, wxID_ANY, wxT("show welcome message box at startup"));
|
||||
m_check = new wxCheckBox(panel, wxID_ANY, "show welcome message box at startup");
|
||||
|
||||
// put everything in a sizer
|
||||
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
@ -190,31 +190,31 @@ MyFrame::MyFrame()
|
||||
wxConfigBase *pConfig = wxConfigBase::Get();
|
||||
|
||||
// we could write Read("/Controls/Text") as well, it's just to show SetPath()
|
||||
pConfig->SetPath(wxT("/Controls"));
|
||||
pConfig->SetPath("/Controls");
|
||||
|
||||
m_text->SetValue(pConfig->Read(wxT("Text"), wxT("")));
|
||||
m_check->SetValue(pConfig->Read(wxT("Check"), 1l) != 0);
|
||||
m_text->SetValue(pConfig->Read("Text", ""));
|
||||
m_check->SetValue(pConfig->Read("Check", 1l) != 0);
|
||||
|
||||
// SetPath() understands ".."
|
||||
pConfig->SetPath(wxT("../MainFrame"));
|
||||
pConfig->SetPath("../MainFrame");
|
||||
|
||||
// restore frame position and size
|
||||
int x = pConfig->Read(wxT("x"), 50),
|
||||
y = pConfig->Read(wxT("y"), 50),
|
||||
w = pConfig->Read(wxT("w"), 350),
|
||||
h = pConfig->Read(wxT("h"), 200);
|
||||
int x = pConfig->Read("x", 50),
|
||||
y = pConfig->Read("y", 50),
|
||||
w = pConfig->Read("w", 350),
|
||||
h = pConfig->Read("h", 200);
|
||||
Move(x, y);
|
||||
SetClientSize(w, h);
|
||||
|
||||
pConfig->SetPath(wxT("/"));
|
||||
pConfig->SetPath("/");
|
||||
wxString s;
|
||||
if ( pConfig->Read(wxT("TestValue"), &s) )
|
||||
if ( pConfig->Read("TestValue", &s) )
|
||||
{
|
||||
wxLogStatus(this, wxT("TestValue from config is '%s'"), s.c_str());
|
||||
wxLogStatus(this, "TestValue from config is '%s'", s.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(this, wxT("TestValue not found in the config"));
|
||||
wxLogStatus(this, "TestValue not found in the config");
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ void MyFrame::OnQuit(wxCommandEvent&)
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent&)
|
||||
{
|
||||
wxMessageBox(wxT("wxConfig demo\n(c) 1998-2001 Vadim Zeitlin"), wxT("About"),
|
||||
wxMessageBox("wxConfig demo\n(c) 1998-2001 Vadim Zeitlin", "About",
|
||||
wxICON_INFORMATION | wxOK);
|
||||
}
|
||||
|
||||
@ -234,20 +234,20 @@ void MyFrame::OnDelete(wxCommandEvent&)
|
||||
wxConfigBase *pConfig = wxConfigBase::Get();
|
||||
if ( pConfig == NULL )
|
||||
{
|
||||
wxLogError(wxT("No config to delete!"));
|
||||
wxLogError("No config to delete!");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( pConfig->DeleteAll() )
|
||||
{
|
||||
wxLogMessage(wxT("Config file/registry key successfully deleted."));
|
||||
wxLogMessage("Config file/registry key successfully deleted.");
|
||||
|
||||
delete wxConfigBase::Set(NULL);
|
||||
wxConfigBase::DontCreateOnDemand();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError(wxT("Deleting config file/registry key failed."));
|
||||
wxLogError("Deleting config file/registry key failed.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,18 +258,18 @@ MyFrame::~MyFrame()
|
||||
return;
|
||||
|
||||
// save the control's values to the config
|
||||
pConfig->Write(wxT("/Controls/Text"), m_text->GetValue());
|
||||
pConfig->Write(wxT("/Controls/Check"), m_check->GetValue());
|
||||
pConfig->Write("/Controls/Text", m_text->GetValue());
|
||||
pConfig->Write("/Controls/Check", m_check->GetValue());
|
||||
|
||||
// save the frame position
|
||||
int x, y, w, h;
|
||||
GetClientSize(&w, &h);
|
||||
GetPosition(&x, &y);
|
||||
pConfig->Write(wxT("/MainFrame/x"), (long) x);
|
||||
pConfig->Write(wxT("/MainFrame/y"), (long) y);
|
||||
pConfig->Write(wxT("/MainFrame/w"), (long) w);
|
||||
pConfig->Write(wxT("/MainFrame/h"), (long) h);
|
||||
pConfig->Write("/MainFrame/x", (long) x);
|
||||
pConfig->Write("/MainFrame/y", (long) y);
|
||||
pConfig->Write("/MainFrame/w", (long) w);
|
||||
pConfig->Write("/MainFrame/h", (long) h);
|
||||
|
||||
pConfig->Write(wxT("/TestValue"), wxT("A test value"));
|
||||
pConfig->Write("/TestValue", "A test value");
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
|
||||
wxAboutDialogInfo info;
|
||||
info.SetName(_("DataView sample"));
|
||||
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("Francesco Montorsi");
|
||||
|
||||
|
@ -157,9 +157,9 @@ public:
|
||||
virtual wxString GetColumnType( unsigned int col ) const wxOVERRIDE
|
||||
{
|
||||
if (col == 2)
|
||||
return wxT("long");
|
||||
return "long";
|
||||
|
||||
return wxT("string");
|
||||
return "string";
|
||||
}
|
||||
|
||||
virtual void GetValue( wxVariant &variant,
|
||||
@ -229,9 +229,9 @@ public:
|
||||
return wxT( "bool" );
|
||||
|
||||
if (col == Col_IconText)
|
||||
return wxT("wxDataViewIconText");
|
||||
return "wxDataViewIconText";
|
||||
|
||||
return wxT("string");
|
||||
return "string";
|
||||
}
|
||||
|
||||
virtual void GetValueByRow( wxVariant &variant,
|
||||
|
@ -53,9 +53,9 @@ class MyDebugReport : public wxDebugReportUpload
|
||||
public:
|
||||
MyDebugReport() : wxDebugReportUpload
|
||||
(
|
||||
wxT("http://your.url.here/"),
|
||||
wxT("report:file"),
|
||||
wxT("action")
|
||||
"http://your.url.here/",
|
||||
"report:file",
|
||||
"action"
|
||||
)
|
||||
{
|
||||
}
|
||||
@ -68,19 +68,19 @@ protected:
|
||||
{
|
||||
if ( reply.IsEmpty() )
|
||||
{
|
||||
wxLogError(wxT("Didn't receive the expected server reply."));
|
||||
wxLogError("Didn't receive the expected server reply.");
|
||||
return false;
|
||||
}
|
||||
|
||||
wxString s(wxT("Server replied:\n"));
|
||||
wxString s("Server replied:\n");
|
||||
|
||||
const size_t count = reply.GetCount();
|
||||
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;
|
||||
}
|
||||
@ -99,12 +99,12 @@ public:
|
||||
{
|
||||
if ( !wxDebugReportCompress::DoProcess() )
|
||||
return false;
|
||||
wxMailMessage msg(GetReportName() + wxT(" crash report"),
|
||||
wxT("vadim@wxwindows.org"),
|
||||
wxMailMessage msg(GetReportName() + " crash report",
|
||||
"vadim@wxwindows.org",
|
||||
wxEmptyString, // mail body
|
||||
wxEmptyString, // from address
|
||||
GetCompressedFileName(),
|
||||
wxT("crashreport.zip"));
|
||||
"crashreport.zip");
|
||||
|
||||
return wxEmail::Send(msg);
|
||||
}
|
||||
@ -248,7 +248,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
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)
|
||||
{
|
||||
m_numLines = 10;
|
||||
@ -256,30 +256,30 @@ MyFrame::MyFrame()
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
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->Append(DebugRpt_Quit, wxT("E&xit\tAlt-X"));
|
||||
menuFile->Append(DebugRpt_Quit, "E&xit\tAlt-X");
|
||||
|
||||
wxMenu *menuReport = new wxMenu;
|
||||
menuReport->Append(DebugRpt_Crash, wxT("Report for &crash\tCtrl-C"),
|
||||
wxT("Provoke a crash inside the program and create report for it"));
|
||||
menuReport->Append(DebugRpt_Current, wxT("Report for c&urrent context\tCtrl-U"),
|
||||
wxT("Create report for the current program context"));
|
||||
menuReport->Append(DebugRpt_Paint, wxT("Report for &paint handler\tCtrl-P"),
|
||||
wxT("Provoke a repeatable crash in wxEVT_PAINT handler"));
|
||||
menuReport->Append(DebugRpt_Timer, wxT("Report for &timer handler\tCtrl-T"),
|
||||
wxT("Provoke a crash in wxEVT_TIMER handler"));
|
||||
menuReport->Append(DebugRpt_Crash, "Report for &crash\tCtrl-C",
|
||||
"Provoke a crash inside the program and create report for it");
|
||||
menuReport->Append(DebugRpt_Current, "Report for c&urrent context\tCtrl-U",
|
||||
"Create report for the current program context");
|
||||
menuReport->Append(DebugRpt_Paint, "Report for &paint handler\tCtrl-P",
|
||||
"Provoke a repeatable crash in wxEVT_PAINT handler");
|
||||
menuReport->Append(DebugRpt_Timer, "Report for &timer handler\tCtrl-T",
|
||||
"Provoke a crash in wxEVT_TIMER handler");
|
||||
menuReport->AppendSeparator();
|
||||
menuReport->AppendCheckItem(DebugRpt_Upload, wxT("Up&load debug report"),
|
||||
wxT("You need to configure a web server accepting debug report uploads to use this function"));
|
||||
menuReport->AppendCheckItem(DebugRpt_Upload, "Up&load debug report",
|
||||
"You need to configure a web server accepting debug report uploads to use this function");
|
||||
|
||||
wxMenu *menuHelp = new wxMenu;
|
||||
menuHelp->Append(DebugRpt_About, wxT("&About\tF1"));
|
||||
menuHelp->Append(DebugRpt_About, "&About\tF1");
|
||||
|
||||
wxMenuBar *mbar = new wxMenuBar();
|
||||
mbar->Append(menuFile, wxT("&File"));
|
||||
mbar->Append(menuReport, wxT("&Report"));
|
||||
mbar->Append(menuHelp, wxT("&Help"));
|
||||
mbar->Append(menuFile, "&File");
|
||||
mbar->Append(menuReport, "&Report");
|
||||
mbar->Append(menuHelp, "&Help");
|
||||
SetMenuBar(mbar);
|
||||
|
||||
CreateStatusBar();
|
||||
@ -371,8 +371,8 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox
|
||||
(
|
||||
wxT("wxDebugReport sample\n(c) 2005 Vadim Zeitlin <vadim@wxwindows.org>"),
|
||||
wxT("wxWidgets Debug Report Sample"),
|
||||
"wxDebugReport sample\n(c) 2005 Vadim Zeitlin <vadim@wxwindows.org>",
|
||||
"wxWidgets Debug Report Sample",
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this
|
||||
);
|
||||
@ -426,16 +426,16 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx)
|
||||
// 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
|
||||
// file containing the date of the crash
|
||||
wxFileName fn(report->GetDirectory(), wxT("timestamp.my"));
|
||||
wxFFile file(fn.GetFullPath(), wxT("w"));
|
||||
wxFileName fn(report->GetDirectory(), "timestamp.my");
|
||||
wxFFile file(fn.GetFullPath(), "w");
|
||||
if ( file.IsOpened() )
|
||||
{
|
||||
wxDateTime dt = wxDateTime::Now();
|
||||
file.Write(dt.FormatISODate() + wxT(' ') + dt.FormatISOTime());
|
||||
file.Write(dt.FormatISODate() + ' ' + dt.FormatISOTime());
|
||||
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
|
||||
// automatically
|
||||
@ -462,7 +462,7 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx)
|
||||
{
|
||||
if ( m_uploadReport )
|
||||
{
|
||||
wxLogMessage(wxT("Report successfully uploaded."));
|
||||
wxLogMessage("Report successfully uploaded.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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));
|
||||
|
||||
// Show it
|
||||
@ -168,7 +168,7 @@ bool MyApp::OnInit()
|
||||
|
||||
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
|
||||
wxLog::GetActiveTarget()->Flush();
|
||||
@ -181,7 +181,7 @@ bool MyApp::OnInit()
|
||||
}
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? wxT("LAN") : wxT("No LAN"), 2);
|
||||
frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? "LAN" : "No LAN", 2);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
return true;
|
||||
@ -197,18 +197,18 @@ int MyApp::OnExit()
|
||||
|
||||
void MyApp::OnConnected(wxDialUpEvent& event)
|
||||
{
|
||||
const wxChar *msg;
|
||||
wxString msg;
|
||||
if ( event.IsOwnEvent() )
|
||||
{
|
||||
msg = event.IsConnectedEvent() ? wxT("Successfully connected")
|
||||
: wxT("Dialing failed");
|
||||
msg = event.IsConnectedEvent() ? "Successfully connected"
|
||||
: "Dialing failed";
|
||||
|
||||
wxLogStatus(wxEmptyString);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = event.IsConnectedEvent() ? wxT("Just connected!")
|
||||
: wxT("Disconnected");
|
||||
msg = event.IsConnectedEvent() ? "Just connected!"
|
||||
: "Disconnected";
|
||||
}
|
||||
|
||||
wxLogMessage(msg);
|
||||
@ -227,19 +227,19 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
|
||||
menuFile->Append(NetTest_Dial, wxT("&Dial\tCtrl-D"), wxT("Dial default ISP"));
|
||||
menuFile->Append(NetTest_HangUp, wxT("&HangUp\tCtrl-H"), wxT("Hang up modem"));
|
||||
menuFile->Append(NetTest_Dial, "&Dial\tCtrl-D", "Dial default ISP");
|
||||
menuFile->Append(NetTest_HangUp, "&HangUp\tCtrl-H", "Hang up modem");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(NetTest_EnumISP, wxT("&Enumerate ISPs...\tCtrl-E"));
|
||||
menuFile->Append(NetTest_Check, wxT("&Check connection status...\tCtrl-C"));
|
||||
menuFile->Append(NetTest_EnumISP, "&Enumerate ISPs...\tCtrl-E");
|
||||
menuFile->Append(NetTest_Check, "&Check connection status...\tCtrl-C");
|
||||
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->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...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -264,37 +264,37 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("This is the network functions test sample.\n")
|
||||
wxT("(c) 1999 Vadim Zeitlin") );
|
||||
msg.Printf( "This is the network functions test sample.\n"
|
||||
"(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))
|
||||
{
|
||||
if ( wxGetApp().GetDialer()->HangUp() )
|
||||
{
|
||||
wxLogStatus(this, wxT("Connection was successfully terminated."));
|
||||
wxLogStatus(this, "Connection was successfully terminated.");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(this, wxT("Failed to hang up."));
|
||||
wxLogStatus(this, "Failed to hang up.");
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnDial(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogStatus(this, wxT("Preparing to dial..."));
|
||||
wxLogStatus(this, "Preparing to dial...");
|
||||
wxYield();
|
||||
wxBeginBusyCursor();
|
||||
|
||||
if ( wxGetApp().GetDialer()->Dial() )
|
||||
{
|
||||
wxLogStatus(this, wxT("Dialing..."));
|
||||
wxLogStatus(this, "Dialing...");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(this, wxT("Dialing attempt failed."));
|
||||
wxLogStatus(this, "Dialing attempt failed.");
|
||||
}
|
||||
|
||||
wxEndBusyCursor();
|
||||
@ -304,11 +304,11 @@ void MyFrame::OnCheck(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if(wxGetApp().GetDialer()->IsOnline())
|
||||
{
|
||||
wxLogMessage(wxT("Network is online."));
|
||||
wxLogMessage("Network is online.");
|
||||
}
|
||||
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);
|
||||
if ( nCount == 0 )
|
||||
{
|
||||
wxLogWarning(wxT("No ISPs found."));
|
||||
wxLogWarning("No ISPs found.");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString msg = wxT("Known ISPs:\n");
|
||||
wxString msg = "Known ISPs:\n";
|
||||
for ( size_t n = 0; n < nCount; n++ )
|
||||
{
|
||||
msg << names[n] << '\n';
|
||||
@ -348,7 +348,7 @@ void MyFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
|
||||
s_isOnline = isOnline;
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(isOnline ? wxT("Online") : wxT("Offline"), 1);
|
||||
SetStatusText(isOnline ? "Online" : "Offline", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
}
|
||||
|
@ -171,9 +171,9 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
#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__
|
||||
|
||||
@ -254,35 +254,35 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
sizer->AddGrowableCol(1);
|
||||
|
||||
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
|
||||
(
|
||||
page,
|
||||
wxID_ANY,
|
||||
wxString::Format(wxT("(%d, %d)"),
|
||||
wxString::Format("(%d, %d)",
|
||||
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
|
||||
(
|
||||
page,
|
||||
wxID_ANY,
|
||||
wxString::Format(wxT("(%d, %d)"),
|
||||
wxString::Format("(%d, %d)",
|
||||
r.width, r.height)
|
||||
));
|
||||
|
||||
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
|
||||
(
|
||||
page,
|
||||
wxID_ANY,
|
||||
wxString::Format(wxT("(%d, %d)-(%d, %d)"),
|
||||
wxString::Format("(%d, %d)-(%d, %d)",
|
||||
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()));
|
||||
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||
@ -300,22 +300,22 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
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(new wxStaticText(page, wxID_ANY, wxT("Current: ")));
|
||||
sizer->Add(new wxStaticText(page, wxID_ANY, "Current: "));
|
||||
sizer->Add(new wxStaticText(page, Display_CurrentMode,
|
||||
VideoModeToText(display.GetCurrentMode())));
|
||||
|
||||
// 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);
|
||||
#endif // wxUSE_DISPLAY
|
||||
|
||||
page->SetSizer(sizerTop);
|
||||
|
||||
m_book->AddPage(page,
|
||||
wxString::Format(wxT("Display %lu"),
|
||||
wxString::Format("Display %lu",
|
||||
(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 s;
|
||||
s.Printf(wxT("%dx%d"), mode.w, mode.h);
|
||||
s.Printf("%dx%d", mode.w, mode.h);
|
||||
|
||||
if ( mode.bpp )
|
||||
{
|
||||
s += wxString::Format(wxT(", %dbpp"), mode.bpp);
|
||||
s += wxString::Format(", %dbpp", mode.bpp);
|
||||
}
|
||||
|
||||
if ( mode.refresh )
|
||||
{
|
||||
s += wxString::Format(wxT(", %dHz"), mode.refresh);
|
||||
s += wxString::Format(", %dHz", mode.refresh);
|
||||
}
|
||||
|
||||
return s;
|
||||
@ -357,8 +357,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("Demo program for wxDisplay class.\n\n(c) 2003-2006 Vadim Zeitlin"),
|
||||
wxT("About Display Sample"),
|
||||
wxMessageBox("Demo program for wxDisplay class.\n\n(c) 2003-2006 Vadim Zeitlin",
|
||||
"About Display Sample",
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
}
|
||||
@ -366,7 +366,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnFromPoint(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Press the mouse anywhere..."));
|
||||
SetStatusText("Press the mouse anywhere...");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
CaptureMouse();
|
||||
@ -388,7 +388,7 @@ void MyFrame::OnChangeMode(wxCommandEvent& event)
|
||||
wxDynamicCast(event.GetEventObject(), wxChoice)->
|
||||
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);
|
||||
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);
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
void OnDropURL(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxString& text)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
||||
@ -370,12 +370,12 @@ public:
|
||||
const wxColour& col)
|
||||
: DnDShape(pos, size, col)
|
||||
{
|
||||
wxLogMessage(wxT("DnDTriangularShape is being created"));
|
||||
wxLogMessage("DnDTriangularShape is being created");
|
||||
}
|
||||
|
||||
virtual ~DnDTriangularShape()
|
||||
{
|
||||
wxLogMessage(wxT("DnDTriangularShape is being deleted"));
|
||||
wxLogMessage("DnDTriangularShape is being deleted");
|
||||
}
|
||||
|
||||
virtual Kind GetKind() const wxOVERRIDE { return Triangle; }
|
||||
@ -407,12 +407,12 @@ public:
|
||||
const wxColour& col)
|
||||
: DnDShape(pos, size, col)
|
||||
{
|
||||
wxLogMessage(wxT("DnDRectangularShape is being created"));
|
||||
wxLogMessage("DnDRectangularShape is being created");
|
||||
}
|
||||
|
||||
virtual ~DnDRectangularShape()
|
||||
{
|
||||
wxLogMessage(wxT("DnDRectangularShape is being deleted"));
|
||||
wxLogMessage("DnDRectangularShape is being deleted");
|
||||
}
|
||||
|
||||
virtual Kind GetKind() const wxOVERRIDE { return Rectangle; }
|
||||
@ -443,12 +443,12 @@ public:
|
||||
const wxColour& col)
|
||||
: DnDShape(pos, size, col)
|
||||
{
|
||||
wxLogMessage(wxT("DnDEllipticShape is being created"));
|
||||
wxLogMessage("DnDEllipticShape is being created");
|
||||
}
|
||||
|
||||
virtual ~DnDEllipticShape()
|
||||
{
|
||||
wxLogMessage(wxT("DnDEllipticShape is being deleted"));
|
||||
wxLogMessage("DnDEllipticShape is being deleted");
|
||||
}
|
||||
|
||||
virtual Kind GetKind() const wxOVERRIDE { return Ellipse; }
|
||||
@ -467,7 +467,10 @@ public:
|
||||
// A wxDataObject specialisation for the application-specific data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static const wxChar *shapeFormatId = wxT("wxShape");
|
||||
static wxString ShapeFormatId()
|
||||
{
|
||||
return "wxShape";
|
||||
}
|
||||
|
||||
class DnDShapeDataObject : public wxDataObject
|
||||
{
|
||||
@ -495,7 +498,7 @@ public:
|
||||
|
||||
// this string should uniquely identify our format, but is otherwise
|
||||
// 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're asked to do so)
|
||||
@ -586,7 +589,7 @@ public:
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG( m_dobjBitmap.IsSupported(format),
|
||||
wxT("unexpected format") );
|
||||
"unexpected format" );
|
||||
|
||||
if ( !m_hasBitmap )
|
||||
CreateBitmap();
|
||||
@ -615,7 +618,7 @@ public:
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG( m_dobjBitmap.IsSupported(format),
|
||||
wxT("unexpected format") );
|
||||
"unexpected format" );
|
||||
|
||||
if ( !m_hasBitmap )
|
||||
CreateBitmap();
|
||||
@ -755,21 +758,21 @@ public:
|
||||
virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE
|
||||
{
|
||||
#if wxUSE_STATUSBAR
|
||||
m_frame->SetStatusText(wxT("Mouse entered the frame"));
|
||||
m_frame->SetStatusText("Mouse entered the frame");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
return OnDragOver(x, y, def);
|
||||
}
|
||||
virtual void OnLeave() wxOVERRIDE
|
||||
{
|
||||
#if wxUSE_STATUSBAR
|
||||
m_frame->SetStatusText(wxT("Mouse left the frame"));
|
||||
m_frame->SetStatusText("Mouse left the frame");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE
|
||||
{
|
||||
if ( !GetData() )
|
||||
{
|
||||
wxLogError(wxT("Failed to get drag and drop data"));
|
||||
wxLogError("Failed to get drag and drop data");
|
||||
|
||||
return wxDragNone;
|
||||
}
|
||||
@ -909,7 +912,7 @@ bool DnDApp::OnInit()
|
||||
// switch on trace messages
|
||||
#if wxUSE_LOG
|
||||
#if defined(__WXGTK__)
|
||||
wxLog::AddTraceMask(wxT("clipboard"));
|
||||
wxLog::AddTraceMask("clipboard");
|
||||
#elif defined(__WXMSW__)
|
||||
wxLog::AddTraceMask(wxTRACE_OleCalls);
|
||||
#endif
|
||||
@ -924,7 +927,7 @@ bool DnDApp::OnInit()
|
||||
|
||||
return true;
|
||||
#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;
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
}
|
||||
@ -932,9 +935,9 @@ bool DnDApp::OnInit()
|
||||
#if wxUSE_DRAG_AND_DROP || wxUSE_CLIPBOARD
|
||||
|
||||
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)),
|
||||
m_strText(wxT("wxWidgets drag & drop works :-)"))
|
||||
m_strText("wxWidgets drag & drop works :-)")
|
||||
|
||||
{
|
||||
// frame icon and status bar
|
||||
@ -946,54 +949,54 @@ DnDFrame::DnDFrame()
|
||||
|
||||
// construct menu
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
file_menu->Append(Menu_Drag, wxT("&Test drag..."));
|
||||
file_menu->AppendCheckItem(Menu_DragMoveDef, wxT("&Move by default"));
|
||||
file_menu->AppendCheckItem(Menu_DragMoveAllow, wxT("&Allow moving"));
|
||||
file_menu->Append(Menu_Drag, "&Test drag...");
|
||||
file_menu->AppendCheckItem(Menu_DragMoveDef, "&Move by default");
|
||||
file_menu->AppendCheckItem(Menu_DragMoveAllow, "&Allow moving");
|
||||
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->Append(Menu_Quit, wxT("E&xit\tCtrl-Q"));
|
||||
file_menu->Append(Menu_Quit, "E&xit\tCtrl-Q");
|
||||
|
||||
#if wxUSE_LOG
|
||||
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
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(Menu_Help, wxT("&Help..."));
|
||||
help_menu->Append(Menu_Help, "&Help...");
|
||||
help_menu->AppendSeparator();
|
||||
help_menu->Append(Menu_About, wxT("&About"));
|
||||
help_menu->Append(Menu_About, "&About");
|
||||
|
||||
wxMenu *clip_menu = new wxMenu;
|
||||
clip_menu->Append(Menu_Copy, wxT("&Copy text\tCtrl-C"));
|
||||
clip_menu->Append(Menu_Paste, wxT("&Paste text\tCtrl-V"));
|
||||
clip_menu->Append(Menu_Copy, "&Copy text\tCtrl-C");
|
||||
clip_menu->Append(Menu_Paste, "&Paste text\tCtrl-V");
|
||||
clip_menu->AppendSeparator();
|
||||
clip_menu->Append(Menu_CopyBitmap, wxT("Copy &bitmap\tCtrl-Shift-C"));
|
||||
clip_menu->Append(Menu_PasteBitmap, wxT("Paste b&itmap\tCtrl-Shift-V"));
|
||||
clip_menu->Append(Menu_CopyBitmap, "Copy &bitmap\tCtrl-Shift-C");
|
||||
clip_menu->Append(Menu_PasteBitmap, "Paste b&itmap\tCtrl-Shift-V");
|
||||
#if wxUSE_METAFILE
|
||||
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
|
||||
clip_menu->AppendSeparator();
|
||||
clip_menu->Append(Menu_CopyFiles, wxT("Copy &files\tCtrl-F"));
|
||||
clip_menu->Append(Menu_CopyURL, wxT("Copy &URL\tCtrl-U"));
|
||||
clip_menu->Append(Menu_CopyFiles, "Copy &files\tCtrl-F");
|
||||
clip_menu->Append(Menu_CopyURL, "Copy &URL\tCtrl-U");
|
||||
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;
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
#if wxUSE_LOG
|
||||
menu_bar->Append(log_menu, wxT("&Log"));
|
||||
menu_bar->Append(log_menu, "&Log");
|
||||
#endif // wxUSE_LOG
|
||||
menu_bar->Append(clip_menu, wxT("&Clipboard"));
|
||||
menu_bar->Append(help_menu, wxT("&Help"));
|
||||
menu_bar->Append(clip_menu, "&Clipboard");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
SetMenuBar(menu_bar);
|
||||
|
||||
// create the child controls
|
||||
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,
|
||||
wxLB_HSCROLL | wxLB_ALWAYS_SB );
|
||||
@ -1078,7 +1081,7 @@ void DnDFrame::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
|
||||
wxPaintDC dc(this);
|
||||
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)
|
||||
@ -1114,7 +1117,7 @@ void DnDFrame::OnNewFrame(wxCommandEvent& WXUNUSED(event))
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
(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
|
||||
}
|
||||
|
||||
@ -1123,11 +1126,11 @@ void DnDFrame::OnDrag(wxCommandEvent& WXUNUSED(event))
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
wxString strText = wxGetTextFromUser
|
||||
(
|
||||
wxT("After you enter text in this dialog, press any mouse\n")
|
||||
wxT("button in the bottom (empty) part of the frame and \n")
|
||||
wxT("drag it anywhere - you will be in fact dragging the\n")
|
||||
wxT("text object containing this text"),
|
||||
wxT("Please enter some text"), m_strText, this
|
||||
"After you enter text in this dialog, press any mouse\n"
|
||||
"button in the bottom (empty) part of the frame and \n"
|
||||
"drag it anywhere - you will be in fact dragging the\n"
|
||||
"text object containing this text",
|
||||
"Please enter some text", m_strText, this
|
||||
);
|
||||
|
||||
m_strText = strText;
|
||||
@ -1146,10 +1149,10 @@ void DnDFrame::OnDragMoveAllow(wxCommandEvent& 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("Copyright (c) 1998 Vadim Zeitlin"),
|
||||
wxT("About wxDnD"),
|
||||
"Copyright (c) 1998 Vadim Zeitlin",
|
||||
"About wxDnD",
|
||||
wxICON_INFORMATION | wxOK,
|
||||
this);
|
||||
}
|
||||
@ -1157,27 +1160,27 @@ void DnDFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
void DnDFrame::OnHelp(wxCommandEvent& /* event */)
|
||||
{
|
||||
wxMessageDialog dialog(this,
|
||||
wxT("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")
|
||||
wxT("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")
|
||||
wxT("\n")
|
||||
wxT("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")
|
||||
wxT("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")
|
||||
wxT("work with files) and see what changes.\n")
|
||||
wxT("\n")
|
||||
wxT("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")
|
||||
wxT("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")
|
||||
"This small program demonstrates drag & drop support in wxWidgets. The program window\n"
|
||||
"consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n"
|
||||
"going on inside. The top part is split into 2 listboxes, the left one accepts files\n"
|
||||
"and the right one accepts text.\n"
|
||||
"\n"
|
||||
"To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n"
|
||||
"the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n"
|
||||
"Also, try dragging some files (you can select several at once) from Windows Explorer (or \n"
|
||||
"File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n"
|
||||
"work with files) and see what changes.\n"
|
||||
"\n"
|
||||
"To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n"
|
||||
"it to wordpad or any other droptarget accepting text (and of course you can just drag it\n"
|
||||
"to the right pane). Due to a lot of trace messages, the cursor might take some time to \n"
|
||||
"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("\n")
|
||||
wxT("\n")
|
||||
wxT("Please send all questions/bug reports/suggestions &c to \n")
|
||||
"\n"
|
||||
"\n"
|
||||
"Please send all questions/bug reports/suggestions &c to \n"
|
||||
wxT("Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>"),
|
||||
wxT("wxDnD Help"));
|
||||
"wxDnD Help");
|
||||
|
||||
dialog.ShowModal();
|
||||
}
|
||||
@ -1196,18 +1199,18 @@ void DnDFrame::OnLogClear(wxCommandEvent& /* event */ )
|
||||
void DnDFrame::LogDragResult(wxDragResult result)
|
||||
{
|
||||
#if wxUSE_STATUSBAR
|
||||
const wxChar *pc;
|
||||
wxString pc;
|
||||
switch ( result )
|
||||
{
|
||||
case wxDragError: pc = wxT("Error!"); break;
|
||||
case wxDragNone: pc = wxT("Nothing"); break;
|
||||
case wxDragCopy: pc = wxT("Copied"); break;
|
||||
case wxDragMove: pc = wxT("Moved"); break;
|
||||
case wxDragCancel: pc = wxT("Cancelled"); break;
|
||||
default: pc = wxT("Huh?"); break;
|
||||
case wxDragError: pc = "Error!"; break;
|
||||
case wxDragNone: pc = "Nothing"; break;
|
||||
case wxDragCopy: pc = "Copied"; break;
|
||||
case wxDragMove: pc = "Moved"; break;
|
||||
case wxDragCancel: pc = "Cancelled"; break;
|
||||
default: pc = "Huh?"; break;
|
||||
}
|
||||
|
||||
SetStatusText(wxString(wxT("Drag result: ")) + pc);
|
||||
SetStatusText(wxString("Drag result: ") + pc);
|
||||
#else
|
||||
wxUnusedVar(result);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
@ -1240,11 +1243,11 @@ void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(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.Append(Menu_About, wxT("&About"));
|
||||
menu.Append(Menu_About, "&About");
|
||||
|
||||
PopupMenu( &menu, event.GetX(), event.GetY() );
|
||||
}
|
||||
@ -1264,8 +1267,8 @@ void DnDFrame::OnUsePrimary(wxCommandEvent& event)
|
||||
const bool usePrimary = event.IsChecked();
|
||||
wxTheClipboard->UsePrimarySelection(usePrimary);
|
||||
|
||||
wxLogStatus(wxT("Now using %s selection"), usePrimary ? wxT("primary")
|
||||
: wxT("clipboard"));
|
||||
wxLogStatus("Now using %s selection", usePrimary ? "primary"
|
||||
: "clipboard");
|
||||
}
|
||||
|
||||
#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
|
||||
#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
|
||||
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
|
||||
|
||||
if (dialog.ShowModal() != wxID_OK)
|
||||
{
|
||||
wxLogMessage( wxT("Aborted file open") );
|
||||
wxLogMessage( "Aborted file open" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (dialog.GetPath().empty())
|
||||
{
|
||||
wxLogMessage( wxT("Returned empty string.") );
|
||||
wxLogMessage( "Returned empty string." );
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wxFileExists(dialog.GetPath()))
|
||||
{
|
||||
wxLogMessage( wxT("File doesn't exist.") );
|
||||
wxLogMessage( "File doesn't exist." );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1324,33 +1327,33 @@ void DnDFrame::OnCopyBitmap(wxCommandEvent& WXUNUSED(event))
|
||||
);
|
||||
if (!image.IsOk())
|
||||
{
|
||||
wxLogError( wxT("Invalid image file...") );
|
||||
wxLogError( "Invalid image file..." );
|
||||
return;
|
||||
}
|
||||
|
||||
wxLogStatus( wxT("Decoding image file...") );
|
||||
wxLogStatus( "Decoding image file..." );
|
||||
wxYield();
|
||||
|
||||
wxBitmap bitmap( image );
|
||||
|
||||
if ( !wxTheClipboard->Open() )
|
||||
{
|
||||
wxLogError(wxT("Can't open clipboard."));
|
||||
wxLogError("Can't open clipboard.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
wxLogMessage( wxT("Creating wxBitmapDataObject...") );
|
||||
wxLogMessage( "Creating wxBitmapDataObject..." );
|
||||
wxYield();
|
||||
|
||||
if ( !wxTheClipboard->AddData(new wxBitmapDataObject(bitmap)) )
|
||||
{
|
||||
wxLogError(wxT("Can't copy image to the clipboard."));
|
||||
wxLogError("Can't copy image to the clipboard.");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogMessage(wxT("Image has been put on the clipboard.") );
|
||||
wxLogMessage(wxT("You can paste it now and look at it.") );
|
||||
wxLogMessage("Image has been put on the clipboard." );
|
||||
wxLogMessage("You can paste it now and look at it." );
|
||||
}
|
||||
|
||||
wxTheClipboard->Close();
|
||||
@ -1360,14 +1363,14 @@ void DnDFrame::OnPasteBitmap(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( !wxTheClipboard->Open() )
|
||||
{
|
||||
wxLogError(wxT("Can't open clipboard."));
|
||||
wxLogError("Can't open clipboard.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !wxTheClipboard->IsSupported(wxDF_BITMAP) )
|
||||
{
|
||||
wxLogWarning(wxT("No bitmap on clipboard"));
|
||||
wxLogWarning("No bitmap on clipboard");
|
||||
|
||||
wxTheClipboard->Close();
|
||||
return;
|
||||
@ -1376,13 +1379,13 @@ void DnDFrame::OnPasteBitmap(wxCommandEvent& WXUNUSED(event))
|
||||
wxBitmapDataObject data;
|
||||
if ( !wxTheClipboard->GetData(data) )
|
||||
{
|
||||
wxLogError(wxT("Can't paste bitmap from the clipboard"));
|
||||
wxLogError("Can't paste bitmap from the clipboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
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());
|
||||
ShowBitmap(bmp);
|
||||
}
|
||||
@ -1396,27 +1399,27 @@ void DnDFrame::OnPasteMetafile(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( !wxTheClipboard->Open() )
|
||||
{
|
||||
wxLogError(wxT("Can't open clipboard."));
|
||||
wxLogError("Can't open clipboard.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !wxTheClipboard->IsSupported(wxDF_METAFILE) )
|
||||
{
|
||||
wxLogWarning(wxT("No metafile on clipboard"));
|
||||
wxLogWarning("No metafile on clipboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMetaFileDataObject data;
|
||||
if ( !wxTheClipboard->GetData(data) )
|
||||
{
|
||||
wxLogError(wxT("Can't paste metafile from the clipboard"));
|
||||
wxLogError("Can't paste metafile from the clipboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
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());
|
||||
|
||||
ShowMetaFile(mf);
|
||||
@ -1435,7 +1438,7 @@ void DnDFrame::OnPasteMetafile(wxCommandEvent& WXUNUSED(event))
|
||||
void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#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);
|
||||
|
||||
wxArrayString filenames;
|
||||
@ -1456,27 +1459,27 @@ void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event))
|
||||
wxClipboardLocker locker;
|
||||
if ( !locker )
|
||||
{
|
||||
wxLogError(wxT("Can't open clipboard"));
|
||||
wxLogError("Can't open clipboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !wxTheClipboard->AddData(dobj) )
|
||||
{
|
||||
wxLogError(wxT("Can't copy file(s) to the clipboard"));
|
||||
wxLogError("Can't copy file(s) to the clipboard");
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(this, wxT("Aborted"));
|
||||
wxLogStatus(this, "Aborted");
|
||||
}
|
||||
#else // !MSW
|
||||
wxLogError(wxT("Sorry, not implemented"));
|
||||
wxLogError("Sorry, not implemented");
|
||||
#endif // MSW/!MSW
|
||||
}
|
||||
|
||||
@ -1509,18 +1512,18 @@ void DnDFrame::OnCopy(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( !wxTheClipboard->Open() )
|
||||
{
|
||||
wxLogError(wxT("Can't open clipboard."));
|
||||
wxLogError("Can't open clipboard.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
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();
|
||||
@ -1530,14 +1533,14 @@ void DnDFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if ( !wxTheClipboard->Open() )
|
||||
{
|
||||
wxLogError(wxT("Can't open clipboard."));
|
||||
wxLogError("Can't open clipboard.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !wxTheClipboard->IsSupported(wxDF_TEXT) )
|
||||
{
|
||||
wxLogWarning(wxT("No text data on clipboard"));
|
||||
wxLogWarning("No text data on clipboard");
|
||||
|
||||
wxTheClipboard->Close();
|
||||
return;
|
||||
@ -1546,11 +1549,11 @@ void DnDFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
|
||||
wxTextDataObject text;
|
||||
if ( !wxTheClipboard->GetData(text) )
|
||||
{
|
||||
wxLogError(wxT("Can't paste data from the clipboard"));
|
||||
wxLogError("Can't paste data from the clipboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogMessage(wxT("Text '%s' pasted from the clipboard"),
|
||||
wxLogMessage("Text '%s' pasted from the clipboard",
|
||||
text.GetText().c_str());
|
||||
}
|
||||
|
||||
@ -1574,7 +1577,7 @@ bool DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames)
|
||||
{
|
||||
size_t nFiles = filenames.GetCount();
|
||||
wxString str;
|
||||
str.Printf( wxT("%d files dropped"), (int)nFiles);
|
||||
str.Printf( "%d files dropped", (int)nFiles);
|
||||
|
||||
if (m_pOwner != NULL)
|
||||
{
|
||||
@ -1591,7 +1594,7 @@ bool DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
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 ),
|
||||
wxDEFAULT_DIALOG_STYLE | wxRAISED_BORDER | wxRESIZE_BORDER )
|
||||
{
|
||||
@ -1600,47 +1603,47 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape)
|
||||
|
||||
// radio box
|
||||
wxBoxSizer* shapesSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
const wxString choices[] = { wxT("None"), wxT("Triangle"),
|
||||
wxT("Rectangle"), wxT("Ellipse") };
|
||||
const wxString choices[] = { "None", "Triangle",
|
||||
"Rectangle", "Ellipse" };
|
||||
|
||||
m_radio = new wxRadioBox( this, wxID_ANY, wxT("&Shape"),
|
||||
m_radio = new wxRadioBox( this, wxID_ANY, "&Shape",
|
||||
wxDefaultPosition, wxDefaultSize, 4, choices, 4,
|
||||
wxRA_SPECIFY_COLS );
|
||||
shapesSizer->Add( m_radio, 0, wxGROW|wxALL, 5 );
|
||||
topSizer->Add( shapesSizer, 0, wxALL, 2 );
|
||||
|
||||
// attributes
|
||||
wxStaticBox* box = new wxStaticBox( this, wxID_ANY, wxT("&Attributes") );
|
||||
wxStaticBox* box = new wxStaticBox( this, wxID_ANY, "&Attributes" );
|
||||
wxStaticBoxSizer* attrSizer = new wxStaticBoxSizer( box, wxHORIZONTAL );
|
||||
wxFlexGridSizer* xywhSizer = new wxFlexGridSizer( 2 );
|
||||
|
||||
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,
|
||||
wxSize( 30, 20 ) );
|
||||
xywhSizer->Add( st, 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,
|
||||
wxSize( 30, 20 ) );
|
||||
xywhSizer->Add( st, 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,
|
||||
wxSize( 30, 20 ) );
|
||||
xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 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,
|
||||
wxSize( 30, 20 ) );
|
||||
xywhSizer->Add( st, 1, wxALL|wxALIGN_RIGHT, 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( col, 0, wxALL|wxALIGN_CENTRE_VERTICAL, 2 );
|
||||
topSizer->Add( attrSizer, 0, wxGROW|wxALL, 5 );
|
||||
@ -1648,9 +1651,9 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape)
|
||||
// buttons
|
||||
wxBoxSizer* buttonSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxButton* bt;
|
||||
bt = new wxButton( this, wxID_OK, wxT("Ok") );
|
||||
bt = new wxButton( this, wxID_OK, "Ok" );
|
||||
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 );
|
||||
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 )
|
||||
{
|
||||
wxMessageBox(wxT("All sizes and positions should be non null!"),
|
||||
wxT("Invalid shape"), wxICON_HAND | wxOK, this);
|
||||
wxMessageBox("All sizes and positions should be non null!",
|
||||
"Invalid shape", wxICON_HAND | wxOK, this);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1738,30 +1741,30 @@ void DnDShapeDialog::OnColour(wxCommandEvent& WXUNUSED(event))
|
||||
DnDShapeFrame *DnDShapeFrame::ms_lastDropTarget = NULL;
|
||||
|
||||
DnDShapeFrame::DnDShapeFrame(wxFrame *parent)
|
||||
: wxFrame(parent, wxID_ANY, wxT("Shape Frame"))
|
||||
: wxFrame(parent, wxID_ANY, "Shape Frame")
|
||||
{
|
||||
#if wxUSE_STATUSBAR
|
||||
CreateStatusBar();
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
wxMenu *menuShape = new wxMenu;
|
||||
menuShape->Append(Menu_Shape_New, wxT("&New default shape\tCtrl-S"));
|
||||
menuShape->Append(Menu_Shape_Edit, wxT("&Edit shape\tCtrl-E"));
|
||||
menuShape->Append(Menu_Shape_New, "&New default shape\tCtrl-S");
|
||||
menuShape->Append(Menu_Shape_Edit, "&Edit shape\tCtrl-E");
|
||||
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;
|
||||
menuClipboard->Append(Menu_ShapeClipboard_Copy, wxT("&Copy\tCtrl-C"));
|
||||
menuClipboard->Append(Menu_ShapeClipboard_Paste, wxT("&Paste\tCtrl-V"));
|
||||
menuClipboard->Append(Menu_ShapeClipboard_Copy, "&Copy\tCtrl-C");
|
||||
menuClipboard->Append(Menu_ShapeClipboard_Paste, "&Paste\tCtrl-V");
|
||||
|
||||
wxMenuBar *menubar = new wxMenuBar;
|
||||
menubar->Append(menuShape, wxT("&Shape"));
|
||||
menubar->Append(menuClipboard, wxT("&Clipboard"));
|
||||
menubar->Append(menuShape, "&Shape");
|
||||
menubar->Append(menuClipboard, "&Clipboard");
|
||||
|
||||
SetMenuBar(menubar);
|
||||
|
||||
#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
|
||||
|
||||
SetDropTarget(new DnDShapeDropTarget(this));
|
||||
@ -1799,26 +1802,26 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event)
|
||||
DnDShapeDataObject shapeData(m_shape);
|
||||
wxDropSource source(shapeData, this);
|
||||
|
||||
const wxChar *pc = NULL;
|
||||
wxString pc;
|
||||
switch ( source.DoDragDrop(true) )
|
||||
{
|
||||
default:
|
||||
case wxDragError:
|
||||
wxLogError(wxT("An error occurred during drag and drop operation"));
|
||||
wxLogError("An error occurred during drag and drop operation");
|
||||
break;
|
||||
|
||||
case wxDragNone:
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Nothing happened"));
|
||||
SetStatusText("Nothing happened");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
break;
|
||||
|
||||
case wxDragCopy:
|
||||
pc = wxT("copied");
|
||||
pc = "copied";
|
||||
break;
|
||||
|
||||
case wxDragMove:
|
||||
pc = wxT("moved");
|
||||
pc = "moved";
|
||||
if ( ms_lastDropTarget != this )
|
||||
{
|
||||
// don't delete the shape if we dropped it on ourselves!
|
||||
@ -1828,15 +1831,15 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event)
|
||||
|
||||
case wxDragCancel:
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Drag and drop operation cancelled"));
|
||||
SetStatusText("Drag and drop operation cancelled");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
break;
|
||||
}
|
||||
|
||||
if ( pc )
|
||||
if ( pc.length() )
|
||||
{
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxString(wxT("Shape successfully ")) + pc);
|
||||
SetStatusText(wxString("Shape successfully ") + pc);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
//else: status text already set
|
||||
@ -1850,7 +1853,7 @@ void DnDShapeFrame::OnDrop(wxCoord x, wxCoord y, DnDShape *shape)
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
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);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
@ -1868,7 +1871,7 @@ void DnDShapeFrame::OnEditShape(wxCommandEvent& WXUNUSED(event))
|
||||
#if wxUSE_STATUSBAR
|
||||
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
|
||||
}
|
||||
@ -1879,7 +1882,7 @@ void DnDShapeFrame::OnNewShape(wxCommandEvent& WXUNUSED(event))
|
||||
SetShape(new DnDEllipticShape(wxPoint(10, 10), wxSize(80, 60), *wxRED));
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
@ -1895,7 +1898,7 @@ void DnDShapeFrame::OnCopyShape(wxCommandEvent& WXUNUSED(event))
|
||||
wxClipboardLocker clipLocker;
|
||||
if ( !clipLocker )
|
||||
{
|
||||
wxLogError(wxT("Can't open the clipboard"));
|
||||
wxLogError("Can't open the clipboard");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1909,7 +1912,7 @@ void DnDShapeFrame::OnPasteShape(wxCommandEvent& WXUNUSED(event))
|
||||
wxClipboardLocker clipLocker;
|
||||
if ( !clipLocker )
|
||||
{
|
||||
wxLogError(wxT("Can't open the clipboard"));
|
||||
wxLogError("Can't open the clipboard");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1921,7 +1924,7 @@ void DnDShapeFrame::OnPasteShape(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
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)
|
||||
{
|
||||
event.Enable( wxTheClipboard->IsSupported(wxDataFormat(shapeFormatId)) );
|
||||
event.Enable( wxTheClipboard->IsSupported(wxDataFormat(ShapeFormatId())) );
|
||||
}
|
||||
|
||||
void DnDShapeFrame::OnPaint(wxPaintEvent& event)
|
||||
@ -1974,7 +1977,7 @@ DnDShape *DnDShape::New(const void *buf)
|
||||
wxColour(dump.r, dump.g, dump.b));
|
||||
|
||||
default:
|
||||
wxFAIL_MSG(wxT("invalid shape!"));
|
||||
wxFAIL_MSG("invalid shape!");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -2032,7 +2035,7 @@ void DnDShapeDataObject::CreateBitmap() const
|
||||
|
||||
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
|
||||
frame->CreateStatusBar();
|
||||
#endif // wxUSE_STATUSBAR
|
||||
@ -2042,7 +2045,7 @@ static void ShowBitmap(const wxBitmap& bitmap)
|
||||
int w = bitmap.GetWidth(),
|
||||
h = bitmap.GetHeight();
|
||||
#if wxUSE_STATUSBAR
|
||||
frame->SetStatusText(wxString::Format(wxT("%dx%d"), w, h));
|
||||
frame->SetStatusText(wxString::Format("%dx%d", w, h));
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
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)
|
||||
{
|
||||
wxFrame *frame = new wxFrame(NULL, wxID_ANY, wxT("Metafile view"));
|
||||
wxFrame *frame = new wxFrame(NULL, wxID_ANY, "Metafile view");
|
||||
frame->CreateStatusBar();
|
||||
DnDCanvasMetafile *canvas = new DnDCanvasMetafile(frame);
|
||||
canvas->SetMetafile(metafile);
|
||||
|
||||
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,
|
||||
size.y > 100 ? 100 : size.y);
|
||||
|
@ -178,7 +178,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
|
||||
}
|
||||
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;
|
||||
}
|
||||
case SHAPE_DRAG_ICON:
|
||||
@ -313,16 +313,16 @@ wxBEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame( (wxFrame *)NULL, wxID_ANY, wxT("wxDragImage sample"),
|
||||
: wxFrame( (wxFrame *)NULL, wxID_ANY, "wxDragImage sample",
|
||||
wxPoint(20,20), wxSize(470,360) )
|
||||
{
|
||||
wxMenu *file_menu = new wxMenu();
|
||||
file_menu->Append( wxID_ABOUT, wxT("&About"));
|
||||
file_menu->AppendCheckItem( TEST_USE_SCREEN, wxT("&Use whole screen for dragging"), wxT("Use whole screen"));
|
||||
file_menu->Append( wxID_EXIT, wxT("E&xit"));
|
||||
file_menu->Append( wxID_ABOUT, "&About");
|
||||
file_menu->AppendCheckItem( TEST_USE_SCREEN, "&Use whole screen for dragging", "Use whole screen");
|
||||
file_menu->Append( wxID_EXIT, "E&xit");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar();
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
|
||||
SetIcon(wxICON(sample));
|
||||
SetMenuBar( menu_bar );
|
||||
@ -343,9 +343,9 @@ void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
|
||||
|
||||
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
||||
{
|
||||
(void)wxMessageBox( wxT("wxDragImage demo\n")
|
||||
wxT("Julian Smart (c) 2000"),
|
||||
wxT("About wxDragImage Demo"),
|
||||
(void)wxMessageBox( "wxDragImage demo\n"
|
||||
"Julian Smart (c) 2000",
|
||||
"About wxDragImage Demo",
|
||||
wxICON_INFORMATION | wxOK );
|
||||
}
|
||||
|
||||
@ -373,14 +373,14 @@ bool MyApp::OnInit()
|
||||
#endif
|
||||
|
||||
wxImage image;
|
||||
if (image.LoadFile(wxT("backgrnd.png"), wxBITMAP_TYPE_PNG))
|
||||
if (image.LoadFile("backgrnd.png", wxBITMAP_TYPE_PNG))
|
||||
{
|
||||
m_background = wxBitmap(image);
|
||||
}
|
||||
|
||||
MyFrame *frame = new MyFrame();
|
||||
|
||||
wxString rootName(wxT("shape0"));
|
||||
wxString rootName("shape0");
|
||||
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
|
@ -411,12 +411,12 @@ bool MyApp::LoadImages()
|
||||
// special hack for Unix in-tree sample build, don't do this in real
|
||||
// programs, use wxStandardPaths instead
|
||||
pathList.Add(wxFileName(argv[0]).GetPath());
|
||||
pathList.Add(wxT("."));
|
||||
pathList.Add(wxT(".."));
|
||||
pathList.Add(wxT("../drawing"));
|
||||
pathList.Add(wxT("../../../samples/drawing"));
|
||||
pathList.Add(".");
|
||||
pathList.Add("..");
|
||||
pathList.Add("../drawing");
|
||||
pathList.Add("../../../samples/drawing");
|
||||
|
||||
wxString path = pathList.FindValidPath(wxT("pat4.bmp"));
|
||||
wxString path = pathList.FindValidPath("pat4.bmp");
|
||||
if ( !path )
|
||||
return false;
|
||||
|
||||
@ -427,21 +427,21 @@ bool MyApp::LoadImages()
|
||||
wxMask* mask4 = new wxMask(*gs_bmp4_mono, *wxBLACK);
|
||||
gs_bmp4_mono->SetMask(mask4);
|
||||
|
||||
path = pathList.FindValidPath(wxT("pat36.bmp"));
|
||||
path = pathList.FindValidPath("pat36.bmp");
|
||||
if ( !path )
|
||||
return false;
|
||||
gs_bmp36->LoadFile(path, wxBITMAP_TYPE_BMP);
|
||||
wxMask* mask36 = new wxMask(*gs_bmp36, *wxBLACK);
|
||||
gs_bmp36->SetMask(mask36);
|
||||
|
||||
path = pathList.FindValidPath(wxT("image.bmp"));
|
||||
path = pathList.FindValidPath("image.bmp");
|
||||
if ( !path )
|
||||
return false;
|
||||
gs_bmpNoMask->LoadFile(path, wxBITMAP_TYPE_BMP);
|
||||
gs_bmpWithMask->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 )
|
||||
return false;
|
||||
gs_bmpMask->LoadFile(path, wxBITMAP_TYPE_BMP);
|
||||
@ -462,7 +462,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// Create the main application window
|
||||
MyFrame *frame = new MyFrame(wxT("Drawing sample"),
|
||||
MyFrame *frame = new MyFrame("Drawing sample",
|
||||
wxDefaultPosition, wxSize(550, 840));
|
||||
|
||||
// Show it
|
||||
@ -470,9 +470,9 @@ bool MyApp::OnInit()
|
||||
|
||||
if ( !LoadImages() )
|
||||
{
|
||||
wxLogError(wxT("Can't load one of the bitmap files needed ")
|
||||
wxT("for this sample from the current or parent ")
|
||||
wxT("directory, please copy them there."));
|
||||
wxLogError("Can't load one of the bitmap files needed "
|
||||
"for this sample from the current or parent "
|
||||
"directory, please copy them there.");
|
||||
|
||||
// still continue, the sample can be used without images too if they're
|
||||
// missing for whatever reason
|
||||
@ -539,37 +539,37 @@ void MyCanvas::DrawTestBrushes(wxDC& dc)
|
||||
|
||||
dc.SetBrush(*wxGREEN_BRUSH);
|
||||
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;
|
||||
dc.SetBrush(wxBrush(*wxRED, wxBRUSHSTYLE_CROSSDIAG_HATCH));
|
||||
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;
|
||||
dc.SetBrush(wxBrush(*wxBLUE, wxBRUSHSTYLE_CROSS_HATCH));
|
||||
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;
|
||||
dc.SetBrush(wxBrush(*wxCYAN, wxBRUSHSTYLE_VERTICAL_HATCH));
|
||||
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;
|
||||
dc.SetBrush(wxBrush(*wxBLACK, wxBRUSHSTYLE_HORIZONTAL_HATCH));
|
||||
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;
|
||||
dc.SetBrush(wxBrush(*gs_bmpMask));
|
||||
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;
|
||||
dc.SetBrush(wxBrush(*gs_bmpNoMask));
|
||||
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)
|
||||
@ -584,11 +584,11 @@ void MyCanvas::DrawTestPoly(wxDC& dc)
|
||||
star[3] = wxPoint(40, 100);
|
||||
star[4] = wxPoint(140, 150);
|
||||
|
||||
dc.DrawText(wxT("You should see two (irregular) stars below, the left one ")
|
||||
wxT("hatched"), 10, 10);
|
||||
dc.DrawText(wxT("except for the central region and the right ")
|
||||
wxT("one entirely hatched"), 10, 30);
|
||||
dc.DrawText(wxT("The third star only has a hatched outline"), 10, 50);
|
||||
dc.DrawText("You should see two (irregular) stars below, the left one "
|
||||
"hatched", 10, 10);
|
||||
dc.DrawText("except for the central region and the right "
|
||||
"one entirely hatched", 10, 30);
|
||||
dc.DrawText("The third star only has a hatched outline", 10, 50);
|
||||
|
||||
dc.DrawPolygon(WXSIZEOF(star), star, 0, 30);
|
||||
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.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.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.DrawLine( x+20, y+20, 100, y+20 );
|
||||
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.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.DrawLine( x+20, y+70, 100, y+70 );
|
||||
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.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 );
|
||||
wxDash dash1[6];
|
||||
dash1[0] = 8; // Long dash <---------+
|
||||
@ -887,8 +887,8 @@ void MyCanvas::DrawText(wxDC& dc)
|
||||
{
|
||||
// set underlined font for testing
|
||||
dc.SetFont( wxFontInfo(12).Family(wxFONTFAMILY_MODERN).Underlined() );
|
||||
dc.DrawText( wxT("This is text"), 110, 10 );
|
||||
dc.DrawRotatedText( wxT("That is text"), 20, 10, -45 );
|
||||
dc.DrawText( "This is text", 110, 10 );
|
||||
dc.DrawRotatedText( "That is text", 20, 10, -45 );
|
||||
|
||||
// use wxSWISS_FONT and not wxNORMAL_FONT as the latter can't be rotated
|
||||
// under MSW (it is not TrueType)
|
||||
@ -899,22 +899,22 @@ void MyCanvas::DrawText(wxDC& dc)
|
||||
|
||||
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.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 height;
|
||||
wxCoord descent;
|
||||
dc.GetTextExtent( wxT("This is Swiss 18pt text."), &length, &height, &descent );
|
||||
text.Printf( wxT("Dimensions are length %d, height %d, descent %d"), length, height, descent );
|
||||
dc.GetTextExtent( "This is Swiss 18pt text.", &length, &height, &descent );
|
||||
text.Printf( "Dimensions are length %d, height %d, descent %d", length, height, descent );
|
||||
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.DrawRectangle( 100, 40, 4, height );
|
||||
@ -923,19 +923,19 @@ void MyCanvas::DrawText(wxDC& dc)
|
||||
wxCoord y = 150;
|
||||
dc.SetLogicalFunction(wxINVERT);
|
||||
// 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 );
|
||||
|
||||
y += height;
|
||||
dc.DrawText( wxT("Visible text"), 110, y );
|
||||
dc.DrawText( "Visible text", 110, y );
|
||||
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.SetLogicalFunction(wxCOPY);
|
||||
|
||||
y += height;
|
||||
dc.DrawRectangle( 110, y, 100, height );
|
||||
dc.DrawText( wxT("Another visible text"), 110, y );
|
||||
dc.DrawText( "Another visible text", 110, y );
|
||||
|
||||
y += height;
|
||||
dc.DrawText("And\nmore\ntext on\nmultiple\nlines", 110, y);
|
||||
@ -947,36 +947,36 @@ void MyCanvas::DrawText(wxDC& dc)
|
||||
|
||||
static const struct
|
||||
{
|
||||
const wxChar *name;
|
||||
wxString name;
|
||||
wxRasterOperationMode rop;
|
||||
} rasterOperations[] =
|
||||
{
|
||||
{ wxT("wxAND"), wxAND },
|
||||
{ wxT("wxAND_INVERT"), wxAND_INVERT },
|
||||
{ wxT("wxAND_REVERSE"), wxAND_REVERSE },
|
||||
{ wxT("wxCLEAR"), wxCLEAR },
|
||||
{ wxT("wxCOPY"), wxCOPY },
|
||||
{ wxT("wxEQUIV"), wxEQUIV },
|
||||
{ wxT("wxINVERT"), wxINVERT },
|
||||
{ wxT("wxNAND"), wxNAND },
|
||||
{ wxT("wxNO_OP"), wxNO_OP },
|
||||
{ wxT("wxOR"), wxOR },
|
||||
{ wxT("wxOR_INVERT"), wxOR_INVERT },
|
||||
{ wxT("wxOR_REVERSE"), wxOR_REVERSE },
|
||||
{ wxT("wxSET"), wxSET },
|
||||
{ wxT("wxSRC_INVERT"), wxSRC_INVERT },
|
||||
{ wxT("wxXOR"), wxXOR },
|
||||
{ "wxAND", wxAND },
|
||||
{ "wxAND_INVERT", wxAND_INVERT },
|
||||
{ "wxAND_REVERSE", wxAND_REVERSE },
|
||||
{ "wxCLEAR", wxCLEAR },
|
||||
{ "wxCOPY", wxCOPY },
|
||||
{ "wxEQUIV", wxEQUIV },
|
||||
{ "wxINVERT", wxINVERT },
|
||||
{ "wxNAND", wxNAND },
|
||||
{ "wxNO_OP", wxNO_OP },
|
||||
{ "wxOR", wxOR },
|
||||
{ "wxOR_INVERT", wxOR_INVERT },
|
||||
{ "wxOR_REVERSE", wxOR_REVERSE },
|
||||
{ "wxSET", wxSET },
|
||||
{ "wxSRC_INVERT", wxSRC_INVERT },
|
||||
{ "wxXOR", wxXOR },
|
||||
};
|
||||
|
||||
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.DrawText(wxT("with colour mask"), 0, 100);
|
||||
dc.DrawText("with colour mask", 0, 100);
|
||||
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.DrawText(wxT("masked image"), 0, 300);
|
||||
dc.DrawText("masked image", 0, 300);
|
||||
dc.DrawBitmap(*gs_bmpWithMask, 0, 320, true);
|
||||
|
||||
int cx = gs_bmpWithColMask->GetWidth(),
|
||||
@ -1073,7 +1073,7 @@ void MyCanvas::DrawAlpha(wxDC& dc)
|
||||
dc.SetTextBackground( wxColour(160, 192, 160, 160) );
|
||||
dc.SetTextForeground( wxColour(255, 128, 128, 128) );
|
||||
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
|
||||
|
||||
@ -1225,19 +1225,19 @@ void MyCanvas::DrawCircles(wxDC& dc)
|
||||
dc.SetPen( *wxRED_PEN );
|
||||
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 + 2*r, y, r);
|
||||
dc.DrawCircle(x + 4*r, y, 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 + 3*r, y, 2*r, 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 + 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);
|
||||
@ -1254,19 +1254,19 @@ void MyCanvas::DrawCircles(wxDC& dc)
|
||||
dc.SetBrush( *wxTRANSPARENT_BRUSH );
|
||||
|
||||
y += 2*r;
|
||||
dc.DrawText(wxT("Some circles"), 0, y);
|
||||
dc.DrawText("Some circles", 0, y);
|
||||
dc.DrawCircle(x, y, r);
|
||||
dc.DrawCircle(x + 2*r, y, r);
|
||||
dc.DrawCircle(x + 4*r, y, 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 + 3*r, y, 2*r, 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 + 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);
|
||||
@ -1282,7 +1282,7 @@ void MyCanvas::DrawCircles(wxDC& dc)
|
||||
void MyCanvas::DrawSplines(wxDC& dc)
|
||||
{
|
||||
#if wxUSE_SPLINES
|
||||
dc.DrawText(wxT("Some splines"), 10, 5);
|
||||
dc.DrawText("Some splines", 10, 5);
|
||||
|
||||
// values are hardcoded rather than randomly generated
|
||||
// so the output can be compared between native
|
||||
@ -1363,7 +1363,7 @@ void MyCanvas::DrawSplines(wxDC& dc)
|
||||
}
|
||||
|
||||
#else
|
||||
dc.DrawText(wxT("Splines not supported."), 10, 5);
|
||||
dc.DrawText("Splines not supported.", 10, 5);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1373,22 +1373,22 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
||||
|
||||
// LHS: linear
|
||||
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);
|
||||
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxRIGHT);
|
||||
|
||||
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);
|
||||
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxLEFT);
|
||||
|
||||
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);
|
||||
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxDOWN);
|
||||
|
||||
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);
|
||||
dc.GradientFillLinear(r, *wxWHITE, *wxBLUE, wxUP);
|
||||
|
||||
@ -1396,22 +1396,22 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
||||
|
||||
// RHS: concentric
|
||||
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);
|
||||
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE);
|
||||
|
||||
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);
|
||||
dc.GradientFillConcentric(r, *wxWHITE, *wxBLUE);
|
||||
|
||||
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);
|
||||
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE, wxPoint(0, 0));
|
||||
|
||||
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);
|
||||
dc.GradientFillConcentric(r, *wxBLUE, *wxWHITE, wxPoint(r.width, r.height));
|
||||
|
||||
@ -1456,7 +1456,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
||||
double boxX, boxY, boxWidth, boxHeight;
|
||||
|
||||
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);
|
||||
|
||||
stops = wxGraphicsGradientStops(*wxRED, *wxBLUE);
|
||||
@ -1480,7 +1480,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
||||
wxGraphicsGradientStops simpleStops(*wxRED, *wxBLUE);
|
||||
|
||||
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.Offset(0, TEXT_HEIGHT);
|
||||
|
||||
@ -1503,7 +1503,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
||||
dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight));
|
||||
|
||||
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.Offset(0, TEXT_HEIGHT);
|
||||
|
||||
@ -1525,7 +1525,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
||||
dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight));
|
||||
|
||||
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);
|
||||
|
||||
stops = wxGraphicsGradientStops(*wxRED, *wxBLUE);
|
||||
@ -1549,7 +1549,7 @@ void MyCanvas::DrawGradients(wxDC& dc)
|
||||
dc.CalcBoundingBox(wxRound(boxX+boxWidth), wxRound(boxY+boxHeight));
|
||||
|
||||
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);
|
||||
|
||||
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));
|
||||
|
||||
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);
|
||||
|
||||
stops = wxGraphicsGradientStops(*wxRED, wxTransparentColour);
|
||||
@ -1685,12 +1685,12 @@ void MyCanvas::DrawSystemColours(wxDC& dc)
|
||||
|
||||
void MyCanvas::DrawRegions(wxDC& dc)
|
||||
{
|
||||
dc.DrawText(wxT("You should see a red rect partly covered by a cyan one ")
|
||||
wxT("on the left"), 10, 5);
|
||||
dc.DrawText(wxT("and 5 smileys from which 4 are partially clipped on the right"),
|
||||
dc.DrawText("You should see a red rect partly covered by a cyan one "
|
||||
"on the left", 10, 5);
|
||||
dc.DrawText("and 5 smileys from which 4 are partially clipped on the right",
|
||||
10, 5 + dc.GetCharHeight());
|
||||
dc.DrawText(wxT("The second copy should be identical but right part of it ")
|
||||
wxT("should be offset by 10 pixels."),
|
||||
dc.DrawText("The second copy should be identical but right part of it "
|
||||
"should be offset by 10 pixels.",
|
||||
10, 5 + 2*dc.GetCharHeight());
|
||||
|
||||
DrawRegionsHelper(dc, 10, true);
|
||||
@ -1941,7 +1941,7 @@ void MyCanvas::OnMouseMove(wxMouseEvent &event)
|
||||
long x = dc.DeviceToLogicalX( pos.x );
|
||||
long y = dc.DeviceToLogicalY( pos.y );
|
||||
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 );
|
||||
}
|
||||
|
||||
@ -2083,25 +2083,25 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
wxMenu *menuScreen = new wxMenu;
|
||||
menuScreen->Append(File_ShowDefault, wxT("&Default screen\tF1"));
|
||||
menuScreen->Append(File_ShowText, wxT("&Text screen\tF2"));
|
||||
menuScreen->Append(File_ShowLines, wxT("&Lines screen\tF3"));
|
||||
menuScreen->Append(File_ShowBrushes, wxT("&Brushes screen\tF4"));
|
||||
menuScreen->Append(File_ShowPolygons, wxT("&Polygons screen\tF5"));
|
||||
menuScreen->Append(File_ShowMask, wxT("&Mask screen\tF6"));
|
||||
menuScreen->Append(File_ShowMaskStretch, wxT("1/&2 scaled mask\tShift-F6"));
|
||||
menuScreen->Append(File_ShowOps, wxT("&Raster operations screen\tF7"));
|
||||
menuScreen->Append(File_ShowRegions, wxT("Re&gions screen\tF8"));
|
||||
menuScreen->Append(File_ShowCircles, wxT("&Circles screen\tF9"));
|
||||
menuScreen->Append(File_ShowDefault, "&Default screen\tF1");
|
||||
menuScreen->Append(File_ShowText, "&Text screen\tF2");
|
||||
menuScreen->Append(File_ShowLines, "&Lines screen\tF3");
|
||||
menuScreen->Append(File_ShowBrushes, "&Brushes screen\tF4");
|
||||
menuScreen->Append(File_ShowPolygons, "&Polygons screen\tF5");
|
||||
menuScreen->Append(File_ShowMask, "&Mask screen\tF6");
|
||||
menuScreen->Append(File_ShowMaskStretch, "1/&2 scaled mask\tShift-F6");
|
||||
menuScreen->Append(File_ShowOps, "&Raster operations screen\tF7");
|
||||
menuScreen->Append(File_ShowRegions, "Re&gions screen\tF8");
|
||||
menuScreen->Append(File_ShowCircles, "&Circles screen\tF9");
|
||||
#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
|
||||
menuScreen->Append(File_ShowSplines, wxT("Spl&ines screen\tF11"));
|
||||
menuScreen->Append(File_ShowGradients, wxT("&Gradients screen\tF12"));
|
||||
menuScreen->Append(File_ShowSplines, "Spl&ines screen\tF11");
|
||||
menuScreen->Append(File_ShowGradients, "&Gradients screen\tF12");
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
menuScreen->Append(File_ShowGraphics, wxT("&Graphics screen"));
|
||||
menuScreen->Append(File_ShowGraphics, "&Graphics screen");
|
||||
#endif
|
||||
menuScreen->Append(File_ShowSystemColours, wxT("System &colours"));
|
||||
menuScreen->Append(File_ShowSystemColours, "System &colours");
|
||||
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
@ -2122,71 +2122,71 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->AppendCheckItem(File_BBox, wxS("Show bounding box\tCtrl-E"),
|
||||
wxS("Show extents used in drawing operations"));
|
||||
menuFile->AppendCheckItem(File_Clip, wxT("&Clip\tCtrl-C"), wxT("Clip/unclip drawing"));
|
||||
menuFile->AppendCheckItem(File_Buffer, wxT("&Use wx&BufferedPaintDC\tCtrl-Z"), wxT("Buffer painting"));
|
||||
menuFile->AppendCheckItem(File_Clip, "&Clip\tCtrl-C", "Clip/unclip drawing");
|
||||
menuFile->AppendCheckItem(File_Buffer, "&Use wx&BufferedPaintDC\tCtrl-Z", "Buffer painting");
|
||||
menuFile->AppendSeparator();
|
||||
#if wxUSE_METAFILE && defined(wxMETAFILE_IS_ENH)
|
||||
menuFile->Append(File_Copy, wxT("Copy to clipboard"));
|
||||
menuFile->Append(File_Copy, "Copy to clipboard");
|
||||
#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->Append(File_About, wxT("&About\tCtrl-A"), wxT("Show about dialog"));
|
||||
menuFile->Append(File_About, "&About\tCtrl-A", "Show about dialog");
|
||||
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;
|
||||
menuMapMode->Append( MapMode_Text, wxT("&TEXT map mode") );
|
||||
menuMapMode->Append( MapMode_Lometric, wxT("&LOMETRIC map mode") );
|
||||
menuMapMode->Append( MapMode_Twips, wxT("T&WIPS map mode") );
|
||||
menuMapMode->Append( MapMode_Points, wxT("&POINTS map mode") );
|
||||
menuMapMode->Append( MapMode_Metric, wxT("&METRIC map mode") );
|
||||
menuMapMode->Append( MapMode_Text, "&TEXT map mode" );
|
||||
menuMapMode->Append( MapMode_Lometric, "&LOMETRIC map mode" );
|
||||
menuMapMode->Append( MapMode_Twips, "T&WIPS map mode" );
|
||||
menuMapMode->Append( MapMode_Points, "&POINTS map mode" );
|
||||
menuMapMode->Append( MapMode_Metric, "&METRIC map mode" );
|
||||
|
||||
wxMenu *menuUserScale = new wxMenu;
|
||||
menuUserScale->Append( UserScale_StretchHoriz, wxT("Stretch &horizontally\tCtrl-H") );
|
||||
menuUserScale->Append( UserScale_ShrinkHoriz, wxT("Shrin&k horizontally\tCtrl-G") );
|
||||
menuUserScale->Append( UserScale_StretchVertic, wxT("Stretch &vertically\tCtrl-V") );
|
||||
menuUserScale->Append( UserScale_ShrinkVertic, wxT("&Shrink vertically\tCtrl-W") );
|
||||
menuUserScale->Append( UserScale_StretchHoriz, "Stretch &horizontally\tCtrl-H" );
|
||||
menuUserScale->Append( UserScale_ShrinkHoriz, "Shrin&k horizontally\tCtrl-G" );
|
||||
menuUserScale->Append( UserScale_StretchVertic, "Stretch &vertically\tCtrl-V" );
|
||||
menuUserScale->Append( UserScale_ShrinkVertic, "&Shrink vertically\tCtrl-W" );
|
||||
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;
|
||||
menuAxis->AppendCheckItem( AxisMirror_Horiz, wxT("Mirror horizontally\tCtrl-M") );
|
||||
menuAxis->AppendCheckItem( AxisMirror_Vertic, wxT("Mirror vertically\tCtrl-N") );
|
||||
menuAxis->AppendCheckItem( AxisMirror_Horiz, "Mirror horizontally\tCtrl-M" );
|
||||
menuAxis->AppendCheckItem( AxisMirror_Vertic, "Mirror vertically\tCtrl-N" );
|
||||
|
||||
wxMenu *menuLogical = new wxMenu;
|
||||
menuLogical->Append( LogicalOrigin_MoveDown, wxT("Move &down\tCtrl-D") );
|
||||
menuLogical->Append( LogicalOrigin_MoveUp, wxT("Move &up\tCtrl-U") );
|
||||
menuLogical->Append( LogicalOrigin_MoveLeft, wxT("Move &right\tCtrl-L") );
|
||||
menuLogical->Append( LogicalOrigin_MoveRight, wxT("Move &left\tCtrl-R") );
|
||||
menuLogical->Append( LogicalOrigin_MoveDown, "Move &down\tCtrl-D" );
|
||||
menuLogical->Append( LogicalOrigin_MoveUp, "Move &up\tCtrl-U" );
|
||||
menuLogical->Append( LogicalOrigin_MoveLeft, "Move &right\tCtrl-L" );
|
||||
menuLogical->Append( LogicalOrigin_MoveRight, "Move &left\tCtrl-R" );
|
||||
menuLogical->AppendSeparator();
|
||||
menuLogical->Append( LogicalOrigin_Set, wxT("Set to (&100, 100)\tShift-Ctrl-1") );
|
||||
menuLogical->Append( LogicalOrigin_Restore, wxT("&Restore to normal\tShift-Ctrl-0") );
|
||||
menuLogical->Append( LogicalOrigin_Set, "Set to (&100, 100)\tShift-Ctrl-1" );
|
||||
menuLogical->Append( LogicalOrigin_Restore, "&Restore to normal\tShift-Ctrl-0" );
|
||||
|
||||
wxMenu *menuColour = new wxMenu;
|
||||
#if wxUSE_COLOURDLG
|
||||
menuColour->Append( Colour_TextForeground, wxT("Text &foreground...") );
|
||||
menuColour->Append( Colour_TextBackground, wxT("Text &background...") );
|
||||
menuColour->Append( Colour_Background, wxT("Background &colour...") );
|
||||
menuColour->Append( Colour_TextForeground, "Text &foreground..." );
|
||||
menuColour->Append( Colour_TextBackground, "Text &background..." );
|
||||
menuColour->Append( Colour_Background, "Background &colour..." );
|
||||
#endif // wxUSE_COLOURDLG
|
||||
menuColour->AppendCheckItem( Colour_BackgroundMode, wxT("&Opaque/transparent\tCtrl-B") );
|
||||
menuColour->AppendCheckItem( Colour_TextureBackgound, wxT("Draw textured back&ground\tCtrl-T") );
|
||||
menuColour->AppendCheckItem( Colour_BackgroundMode, "&Opaque/transparent\tCtrl-B" );
|
||||
menuColour->AppendCheckItem( Colour_TextureBackgound, "Draw textured back&ground\tCtrl-T" );
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, wxT("&Drawing"));
|
||||
menuBar->Append(menuScreen, wxT("Scree&n"));
|
||||
menuBar->Append(menuMapMode, wxT("&Mode"));
|
||||
menuBar->Append(menuUserScale, wxT("&Scale"));
|
||||
menuBar->Append(menuAxis, wxT("&Axis"));
|
||||
menuBar->Append(menuLogical, wxT("&Origin"));
|
||||
menuBar->Append(menuColour, wxT("&Colours"));
|
||||
menuBar->Append(menuFile, "&Drawing");
|
||||
menuBar->Append(menuScreen, "Scree&n");
|
||||
menuBar->Append(menuMapMode, "&Mode");
|
||||
menuBar->Append(menuUserScale, "&Scale");
|
||||
menuBar->Append(menuAxis, "&Axis");
|
||||
menuBar->Append(menuLogical, "&Origin");
|
||||
menuBar->Append(menuColour, "&Colours");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
m_mapMode = wxMM_TEXT;
|
||||
@ -2216,13 +2216,13 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("This is the about dialog of the drawing sample.\n")
|
||||
wxT("This sample tests various primitive drawing functions\n")
|
||||
wxT("(without any attempts to prevent flicker).\n")
|
||||
wxT("Copyright (c) Robert Roebling 1999")
|
||||
msg.Printf( "This is the about dialog of the drawing sample.\n"
|
||||
"This sample tests various primitive drawing functions\n"
|
||||
"(without any attempts to prevent flicker).\n"
|
||||
"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)
|
||||
@ -2263,7 +2263,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
|
||||
wildCard.Append(wxS("|PostScript file (*.ps)|*.ps;*.PS"));
|
||||
#endif
|
||||
|
||||
wxFileDialog dlg(this, wxT("Save as bitmap"), wxEmptyString, wxEmptyString,
|
||||
wxFileDialog dlg(this, "Save as bitmap", wxEmptyString, wxEmptyString,
|
||||
wildCard,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
@ -2273,7 +2273,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
|
||||
wxFileName fn(dlg.GetPath());
|
||||
wxString ext = fn.GetExt().Lower();
|
||||
#if wxUSE_SVG
|
||||
if (ext == wxT("svg"))
|
||||
if (ext == "svg")
|
||||
{
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
// Graphics screen can only be drawn using GraphicsContext
|
||||
@ -2284,7 +2284,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
|
||||
wxGraphicsRenderer* tempRenderer = m_canvas->GetRenderer();
|
||||
m_canvas->UseGraphicRenderer(NULL);
|
||||
#endif
|
||||
wxSVGFileDC svgdc(dlg.GetPath(), width, height, 72, wxT("Drawing sample"));
|
||||
wxSVGFileDC svgdc(dlg.GetPath(), width, height, 72, "Drawing sample");
|
||||
svgdc.SetBitmapHandler(new wxSVGBitmapEmbedHandler());
|
||||
m_canvas->Draw(svgdc);
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
|
@ -196,7 +196,7 @@ public:
|
||||
|
||||
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:
|
||||
// try commenting out this line and see what changes
|
||||
@ -298,7 +298,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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));
|
||||
|
||||
// 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
|
||||
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->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;
|
||||
menuEvent->AppendCheckItem(Event_Bind, "&Bind\tCtrl-B",
|
||||
"Bind or unbind a dynamic event handler");
|
||||
menuEvent->AppendCheckItem(Event_Connect, wxT("&Connect\tCtrl-C"),
|
||||
wxT("Connect or disconnect the dynamic event handler"));
|
||||
menuEvent->Append(Event_Dynamic, wxT("&Dynamic event\tCtrl-D"),
|
||||
wxT("Dynamic event sample - only works after Connect"));
|
||||
menuEvent->AppendCheckItem(Event_Connect, "&Connect\tCtrl-C",
|
||||
"Connect or disconnect the dynamic event handler");
|
||||
menuEvent->Append(Event_Dynamic, "&Dynamic event\tCtrl-D",
|
||||
"Dynamic event sample - only works after Connect");
|
||||
menuEvent->AppendSeparator();
|
||||
menuEvent->Append(Event_Push, wxT("&Push event handler\tCtrl-P"),
|
||||
wxT("Push event handler for test event"));
|
||||
menuEvent->Append(Event_Pop, wxT("P&op event handler\tCtrl-O"),
|
||||
wxT("Pop event handler for test event"));
|
||||
menuEvent->Append(Event_Test, wxT("Test event\tCtrl-T"),
|
||||
wxT("Test event processed by pushed event handler"));
|
||||
menuEvent->Append(Event_Push, "&Push event handler\tCtrl-P",
|
||||
"Push event handler for test event");
|
||||
menuEvent->Append(Event_Pop, "P&op event handler\tCtrl-O",
|
||||
"Pop event handler for test event");
|
||||
menuEvent->Append(Event_Test, "Test event\tCtrl-T",
|
||||
"Test event processed by pushed event handler");
|
||||
menuEvent->AppendSeparator();
|
||||
menuEvent->Append(Event_Custom, wxT("Fire c&ustom event\tCtrl-U"),
|
||||
wxT("Generate a custom event"));
|
||||
menuEvent->Append(Event_Gesture, wxT("&Gesture events\tCtrl-G"),
|
||||
wxT("Gesture event"));
|
||||
menuEvent->Append(Event_Custom, "Fire c&ustom event\tCtrl-U",
|
||||
"Generate a custom event");
|
||||
menuEvent->Append(Event_Gesture, "&Gesture events\tCtrl-G",
|
||||
"Gesture event");
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuEvent, wxT("&Event"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(menuEvent, "&Event");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
CreateStatusBar(3);
|
||||
SetStatusText(wxT("Welcome to wxWidgets event sample"));
|
||||
SetStatusText(wxT("Dynamic: off"), Status_Dynamic);
|
||||
SetStatusText(wxT("Push count: 0"), Status_Push);
|
||||
SetStatusText("Welcome to wxWidgets event sample");
|
||||
SetStatusText("Dynamic: off", Status_Dynamic);
|
||||
SetStatusText("Push count: 0", Status_Push);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
wxPanel * const panel = new wxPanel(this);
|
||||
@ -562,19 +562,19 @@ void MyFrame::OnPushEventHandler(wxCommandEvent& WXUNUSED(event))
|
||||
PushEventHandler(new MyEvtHandler(++m_nPush));
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
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 */);
|
||||
m_nPush--;
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
@ -593,7 +593,7 @@ void MyFrame::OnGesture(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)
|
||||
@ -614,5 +614,5 @@ void MyFrame::OnFireCustom(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnProcessCustom(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(wxT("Got a custom event!"));
|
||||
wxLogMessage("Got a custom event!");
|
||||
}
|
||||
|
@ -302,11 +302,11 @@ bool MyApp::OnExceptionInMainLoop()
|
||||
}
|
||||
catch ( int i )
|
||||
{
|
||||
wxLogWarning(wxT("Caught an int %d in MyApp."), i);
|
||||
wxLogWarning("Caught an int %d in MyApp.", i);
|
||||
}
|
||||
catch ( MyException& e )
|
||||
{
|
||||
wxLogWarning(wxT("Caught MyException(%s) in MyApp."), e.what());
|
||||
wxLogWarning("Caught MyException(%s) in MyApp.", e.what());
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
@ -364,15 +364,15 @@ void MyApp::OnUnhandledException()
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
wxMessageBox(wxT("Unhandled exception caught, program will terminate."),
|
||||
wxT("wxExcept Sample"), wxOK | wxICON_ERROR);
|
||||
wxMessageBox("Unhandled exception caught, program will terminate.",
|
||||
"wxExcept Sample", wxOK | wxICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
void MyApp::OnFatalException()
|
||||
{
|
||||
wxMessageBox(wxT("Program has crashed and will terminate."),
|
||||
wxT("wxExcept Sample"), wxOK | wxICON_ERROR);
|
||||
wxMessageBox("Program has crashed and will terminate.",
|
||||
"wxExcept Sample", wxOK | wxICON_ERROR);
|
||||
}
|
||||
|
||||
void MyApp::OnAssertFailure(const wxChar *file,
|
||||
@ -403,7 +403,7 @@ void MyApp::OnAssertFailure(const wxChar *file,
|
||||
|
||||
// frame constructor
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame(NULL, wxID_ANY, wxT("Except wxWidgets App"),
|
||||
: wxFrame(NULL, wxID_ANY, "Except wxWidgets App",
|
||||
wxPoint(50, 50), wxSize(450, 340))
|
||||
{
|
||||
// set the frame icon
|
||||
@ -412,38 +412,38 @@ MyFrame::MyFrame()
|
||||
#if wxUSE_MENUS
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
menuFile->Append(Except_Dialog, wxT("Show &dialog\tCtrl-D"));
|
||||
menuFile->Append(Except_Dialog, "Show &dialog\tCtrl-D");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(Except_ThrowInt, wxT("Throw an &int\tCtrl-I"));
|
||||
menuFile->Append(Except_ThrowString, wxT("Throw a &string\tCtrl-S"));
|
||||
menuFile->Append(Except_ThrowObject, wxT("Throw an &object\tCtrl-O"));
|
||||
menuFile->Append(Except_ThrowInt, "Throw an &int\tCtrl-I");
|
||||
menuFile->Append(Except_ThrowString, "Throw a &string\tCtrl-S");
|
||||
menuFile->Append(Except_ThrowObject, "Throw an &object\tCtrl-O");
|
||||
menuFile->Append(Except_ThrowUnhandled,
|
||||
wxT("Throw &unhandled exception\tCtrl-U"));
|
||||
"Throw &unhandled exception\tCtrl-U");
|
||||
menuFile->Append(Except_ThrowFromYield,
|
||||
wxT("Throw from wx&Yield()\tCtrl-Y"));
|
||||
menuFile->Append(Except_Crash, wxT("&Crash\tCtrl-C"));
|
||||
"Throw from wx&Yield()\tCtrl-Y");
|
||||
menuFile->Append(Except_Crash, "&Crash\tCtrl-C");
|
||||
menuFile->Append(Except_Trap, "&Trap\tCtrl-T",
|
||||
"Break into the debugger (if one is running)");
|
||||
menuFile->AppendSeparator();
|
||||
#if wxUSE_ON_FATAL_EXCEPTION
|
||||
menuFile->AppendCheckItem(Except_HandleCrash, wxT("&Handle crashes\tCtrl-H"));
|
||||
menuFile->AppendCheckItem(Except_HandleCrash, "&Handle crashes\tCtrl-H");
|
||||
menuFile->AppendSeparator();
|
||||
#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
|
||||
menuFile->Append(Except_ShowAssertInThread,
|
||||
wxT("Assert failure in &thread\tShift-Ctrl-A"));
|
||||
"Assert failure in &thread\tShift-Ctrl-A");
|
||||
#endif // wxUSE_THREADS
|
||||
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;
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -452,7 +452,7 @@ MyFrame::MyFrame()
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
@ -490,7 +490,7 @@ void MyFrame::OnDialog(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
wxLogWarning(wxT("An exception in MyDialog"));
|
||||
wxLogWarning("An exception in MyDialog");
|
||||
|
||||
Destroy();
|
||||
throw;
|
||||
@ -504,12 +504,12 @@ void MyFrame::OnThrowInt(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))
|
||||
{
|
||||
throw MyException(wxT("Exception thrown from MyFrame"));
|
||||
throw MyException("Exception thrown from MyFrame");
|
||||
}
|
||||
|
||||
void MyFrame::OnThrowUnhandled(wxCommandEvent& WXUNUSED(event))
|
||||
@ -602,10 +602,10 @@ void MyFrame::OnShowAssertInThread(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("This is the About dialog of the except sample.\n")
|
||||
wxT("Welcome to %s"), wxVERSION_STRING);
|
||||
msg.Printf( "This is the About dialog of the except sample.\n"
|
||||
"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)
|
||||
: wxDialog(parent, wxID_ANY, wxString(wxT("Throw exception dialog")))
|
||||
: wxDialog(parent, wxID_ANY, wxString("Throw exception dialog"))
|
||||
{
|
||||
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);
|
||||
sizerTop->Add(new wxButton(this, Except_ThrowObject, wxT("Throw &object")),
|
||||
sizerTop->Add(new wxButton(this, Except_ThrowObject, "Throw &object"),
|
||||
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);
|
||||
sizerTop->Add(new wxButton(this, Except_Crash, wxT("&Crash")),
|
||||
sizerTop->Add(new wxButton(this, Except_Crash, "&Crash"),
|
||||
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);
|
||||
|
||||
SetSizerAndFit(sizerTop);
|
||||
@ -638,7 +638,7 @@ void MyDialog::OnThrowInt(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))
|
||||
|
@ -218,7 +218,7 @@ protected:
|
||||
void DoSend()
|
||||
{
|
||||
wxString s(m_textOut->GetValue());
|
||||
s += wxT('\n');
|
||||
s += '\n';
|
||||
m_out.Write(s.c_str(), s.length());
|
||||
m_textOut->Clear();
|
||||
|
||||
@ -343,7 +343,10 @@ enum
|
||||
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
|
||||
@ -420,7 +423,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// Create the main application window
|
||||
MyFrame *frame = new MyFrame(wxT("Exec wxWidgets sample"),
|
||||
MyFrame *frame = new MyFrame("Exec wxWidgets sample",
|
||||
wxDefaultPosition, wxSize(500, 140));
|
||||
|
||||
// Show it
|
||||
@ -458,26 +461,26 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
|
||||
menuFile->Append(Exec_Kill, wxT("&Kill process...\tCtrl-K"),
|
||||
wxT("Kill a process by PID"));
|
||||
menuFile->Append(Exec_Kill, "&Kill process...\tCtrl-K",
|
||||
"Kill a process by PID");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(Exec_OpenFile, wxT("Open &file...\tCtrl-F"),
|
||||
wxT("Launch the command to open this kind of files"));
|
||||
menuFile->Append(Exec_OpenFile, "Open &file...\tCtrl-F",
|
||||
"Launch the command to open this kind of files");
|
||||
menuFile->Append(Exec_ShowCommandForExt,
|
||||
"Show association for extension...\tShift-Ctrl-A",
|
||||
"Show the command associated with the given extension");
|
||||
menuFile->Append(Exec_LaunchFile, wxT("La&unch file...\tShift-Ctrl-F"),
|
||||
wxT("Launch the default application associated with the file"));
|
||||
menuFile->Append(Exec_OpenURL, wxT("Open &URL...\tCtrl-U"),
|
||||
wxT("Launch the default browser with the given URL"));
|
||||
menuFile->Append(Exec_LaunchFile, "La&unch file...\tShift-Ctrl-F",
|
||||
"Launch the default application associated with the file");
|
||||
menuFile->Append(Exec_OpenURL, "Open &URL...\tCtrl-U",
|
||||
"Launch the default browser with the given URL");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(Exec_BeginBusyCursor, wxT("Show &busy cursor\tCtrl-C"));
|
||||
menuFile->Append(Exec_EndBusyCursor, wxT("Show &normal cursor\tShift-Ctrl-C"));
|
||||
menuFile->Append(Exec_BeginBusyCursor, "Show &busy cursor\tCtrl-C");
|
||||
menuFile->Append(Exec_EndBusyCursor, "Show &normal cursor\tShift-Ctrl-C");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(Exec_ClearLog, wxT("&Clear log\tCtrl-L"),
|
||||
wxT("Clear the log window"));
|
||||
menuFile->Append(Exec_ClearLog, "&Clear log\tCtrl-L",
|
||||
"Clear the log window");
|
||||
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;
|
||||
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;
|
||||
execMenu->AppendSubMenu(flagsMenu, "Execution flags");
|
||||
execMenu->AppendSeparator();
|
||||
execMenu->Append(Exec_SyncExec, wxT("Sync &execution...\tCtrl-E"),
|
||||
wxT("Launch a program and return when it terminates"));
|
||||
execMenu->Append(Exec_AsyncExec, wxT("&Async execution...\tCtrl-A"),
|
||||
wxT("Launch a program and return immediately"));
|
||||
execMenu->Append(Exec_Shell, wxT("Execute &shell command...\tCtrl-S"),
|
||||
wxT("Launch a shell and execute a command in it"));
|
||||
execMenu->Append(Exec_SyncExec, "Sync &execution...\tCtrl-E",
|
||||
"Launch a program and return when it terminates");
|
||||
execMenu->Append(Exec_AsyncExec, "&Async execution...\tCtrl-A",
|
||||
"Launch a program and return immediately");
|
||||
execMenu->Append(Exec_Shell, "Execute &shell command...\tCtrl-S",
|
||||
"Launch a shell and execute a command in it");
|
||||
execMenu->AppendSeparator();
|
||||
execMenu->Append(Exec_Redirect, wxT("Capture command &output...\tCtrl-O"),
|
||||
wxT("Launch a program and capture its output"));
|
||||
execMenu->Append(Exec_Pipe, wxT("&Pipe through command..."),
|
||||
wxT("Pipe a string through a filter"));
|
||||
execMenu->Append(Exec_POpen, wxT("&Open a pipe to a command...\tCtrl-P"),
|
||||
wxT("Open a pipe to and from another program"));
|
||||
execMenu->Append(Exec_Redirect, "Capture command &output...\tCtrl-O",
|
||||
"Launch a program and capture its output");
|
||||
execMenu->Append(Exec_Pipe, "&Pipe through command...",
|
||||
"Pipe a string through a filter");
|
||||
execMenu->Append(Exec_POpen, "&Open a pipe to a command...\tCtrl-P",
|
||||
"Open a pipe to and from another program");
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
execMenu->AppendSeparator();
|
||||
execMenu->Append(Exec_DDEExec, wxT("Execute command via &DDE...\tCtrl-D"));
|
||||
execMenu->Append(Exec_DDERequest, wxT("Send DDE &request...\tCtrl-R"));
|
||||
execMenu->Append(Exec_DDEExec, "Execute command via &DDE...\tCtrl-D");
|
||||
execMenu->Append(Exec_DDERequest, "Send DDE &request...\tCtrl-R");
|
||||
#endif
|
||||
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(execMenu, wxT("&Exec"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(execMenu, "&Exec");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -529,7 +532,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets exec sample!"));
|
||||
SetStatusText("Welcome to wxWidgets exec sample!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
m_timerBg.Start(1000);
|
||||
@ -573,15 +576,15 @@ void MyFrame::OnEndBusyCursor(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("Exec wxWidgets Sample\n(c) 2000-2002 Vadim Zeitlin"),
|
||||
wxT("About Exec"), wxOK | wxICON_INFORMATION, this);
|
||||
wxMessageBox("Exec wxWidgets Sample\n(c) 2000-2002 Vadim Zeitlin",
|
||||
"About Exec", wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long pid = wxGetNumberFromUser(wxT("Please specify the process to kill"),
|
||||
wxT("Enter PID:"),
|
||||
wxT("Exec question"),
|
||||
long pid = wxGetNumberFromUser("Please specify the process to kill",
|
||||
"Enter PID:",
|
||||
"Exec question",
|
||||
m_pidLast,
|
||||
// we need the full unsigned int range
|
||||
-INT_MAX, INT_MAX,
|
||||
@ -596,34 +599,34 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
static const wxString signalNames[] =
|
||||
{
|
||||
wxT("Just test (SIGNONE)"),
|
||||
wxT("Hangup (SIGHUP)"),
|
||||
wxT("Interrupt (SIGINT)"),
|
||||
wxT("Quit (SIGQUIT)"),
|
||||
wxT("Illegal instruction (SIGILL)"),
|
||||
wxT("Trap (SIGTRAP)"),
|
||||
wxT("Abort (SIGABRT)"),
|
||||
wxT("Emulated trap (SIGEMT)"),
|
||||
wxT("FP exception (SIGFPE)"),
|
||||
wxT("Kill (SIGKILL)"),
|
||||
wxT("Bus (SIGBUS)"),
|
||||
wxT("Segment violation (SIGSEGV)"),
|
||||
wxT("System (SIGSYS)"),
|
||||
wxT("Broken pipe (SIGPIPE)"),
|
||||
wxT("Alarm (SIGALRM)"),
|
||||
wxT("Terminate (SIGTERM)"),
|
||||
"Just test (SIGNONE)",
|
||||
"Hangup (SIGHUP)",
|
||||
"Interrupt (SIGINT)",
|
||||
"Quit (SIGQUIT)",
|
||||
"Illegal instruction (SIGILL)",
|
||||
"Trap (SIGTRAP)",
|
||||
"Abort (SIGABRT)",
|
||||
"Emulated trap (SIGEMT)",
|
||||
"FP exception (SIGFPE)",
|
||||
"Kill (SIGKILL)",
|
||||
"Bus (SIGBUS)",
|
||||
"Segment violation (SIGSEGV)",
|
||||
"System (SIGSYS)",
|
||||
"Broken pipe (SIGPIPE)",
|
||||
"Alarm (SIGALRM)",
|
||||
"Terminate (SIGTERM)",
|
||||
};
|
||||
|
||||
static int s_sigLast = wxSIGNONE;
|
||||
int sig = wxGetSingleChoiceIndex(wxT("How to kill the process?"),
|
||||
wxT("Exec question"),
|
||||
int sig = wxGetSingleChoiceIndex("How to kill the process?",
|
||||
"Exec question",
|
||||
WXSIZEOF(signalNames), signalNames,
|
||||
s_sigLast,
|
||||
this);
|
||||
switch ( sig )
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG( wxT("unexpected return value") );
|
||||
wxFAIL_MSG( "unexpected return value" );
|
||||
// fall through
|
||||
|
||||
case -1:
|
||||
@ -656,11 +659,11 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
|
||||
// This simply calls Kill(wxSIGNONE) but using it is more convenient.
|
||||
if ( wxProcess::Exists(pid) )
|
||||
{
|
||||
wxLogStatus(wxT("Process %ld is running."), pid);
|
||||
wxLogStatus("Process %ld is running.", pid);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(wxT("No process with pid = %ld."), pid);
|
||||
wxLogStatus("No process with pid = %ld.", pid);
|
||||
}
|
||||
}
|
||||
else // not SIGNONE
|
||||
@ -668,20 +671,18 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
|
||||
wxKillError rc = wxProcess::Kill(pid, (wxSignal)sig);
|
||||
if ( rc == wxKILL_OK )
|
||||
{
|
||||
wxLogStatus(wxT("Process %ld killed with signal %d."), pid, sig);
|
||||
wxLogStatus("Process %ld killed with signal %d.", pid, sig);
|
||||
}
|
||||
else
|
||||
{
|
||||
static const wxChar *errorText[] =
|
||||
{
|
||||
wxT(""), // no error
|
||||
wxT("signal not supported"),
|
||||
wxT("permission denied"),
|
||||
wxT("no such process"),
|
||||
wxT("unspecified error"),
|
||||
};
|
||||
wxArrayString errorText;
|
||||
errorText.push_back(""); // no error
|
||||
errorText.push_back("signal not supported");
|
||||
errorText.push_back("permission denied");
|
||||
errorText.push_back("no such process");
|
||||
errorText.push_back("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]);
|
||||
}
|
||||
}
|
||||
@ -741,7 +742,7 @@ wxBEGIN_EVENT_TABLE(ExecQueryDialog, wxDialog)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
ExecQueryDialog::ExecQueryDialog(const wxString& cmd)
|
||||
: wxDialog(NULL, wxID_ANY, DIALOG_TITLE,
|
||||
: wxDialog(NULL, wxID_ANY, DIALOG_TITLE(),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
{
|
||||
@ -854,13 +855,13 @@ void MyFrame::DoAsyncExec(const wxString& cmd)
|
||||
m_pidLast = wxExecute(cmd, wxEXEC_ASYNC | GetExecFlags(), process);
|
||||
if ( !m_pidLast )
|
||||
{
|
||||
wxLogError(wxT("Execution of '%s' failed."), cmd.c_str());
|
||||
wxLogError("Execution of '%s' failed.", cmd.c_str());
|
||||
|
||||
delete process;
|
||||
}
|
||||
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;
|
||||
|
||||
@ -877,11 +878,11 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event))
|
||||
if ( !QueryExec(cmd, env) )
|
||||
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);
|
||||
|
||||
wxLogStatus(wxT("Process '%s' terminated with exit code %d."),
|
||||
wxLogStatus("Process '%s' terminated with exit code %d.",
|
||||
cmd.c_str(), code);
|
||||
|
||||
m_cmdLast = cmd;
|
||||
@ -889,8 +890,8 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString cmd = wxGetTextFromUser(wxT("Enter the command: "),
|
||||
DIALOG_TITLE,
|
||||
wxString cmd = wxGetTextFromUser("Enter the command: ",
|
||||
DIALOG_TITLE(),
|
||||
m_cmdLast);
|
||||
|
||||
if ( !cmd )
|
||||
@ -901,15 +902,15 @@ void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnShell(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString cmd = wxGetTextFromUser(wxT("Enter the command: "),
|
||||
DIALOG_TITLE,
|
||||
wxString cmd = wxGetTextFromUser("Enter the command: ",
|
||||
DIALOG_TITLE(),
|
||||
m_cmdLast);
|
||||
|
||||
if ( !cmd )
|
||||
return;
|
||||
|
||||
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);
|
||||
m_cmdLast = cmd;
|
||||
}
|
||||
@ -925,16 +926,16 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event))
|
||||
#endif
|
||||
}
|
||||
|
||||
wxString cmd = wxGetTextFromUser(wxT("Enter the command: "),
|
||||
DIALOG_TITLE,
|
||||
wxString cmd = wxGetTextFromUser("Enter the command: ",
|
||||
DIALOG_TITLE(),
|
||||
m_cmdLast);
|
||||
|
||||
if ( !cmd )
|
||||
return;
|
||||
|
||||
bool sync;
|
||||
switch ( wxMessageBox(wxT("Execute it synchronously?"),
|
||||
wxT("Exec question"),
|
||||
switch ( wxMessageBox("Execute it synchronously?",
|
||||
"Exec question",
|
||||
wxYES_NO | wxCANCEL | wxICON_QUESTION, this) )
|
||||
{
|
||||
case wxYES:
|
||||
@ -961,15 +962,15 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event))
|
||||
wxLogStatus("Command \"%s\" terminated after %ldms; exit code %d.",
|
||||
cmd, sw.Time(), code);
|
||||
|
||||
ShowOutput(cmd, output, wxT("Output"));
|
||||
ShowOutput(cmd, errors, wxT("Errors"));
|
||||
ShowOutput(cmd, output, "Output");
|
||||
ShowOutput(cmd, errors, "Errors");
|
||||
}
|
||||
else // async exec
|
||||
{
|
||||
MyPipedProcess *process = new MyPipedProcess(this, cmd);
|
||||
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;
|
||||
}
|
||||
@ -985,17 +986,17 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
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: "),
|
||||
DIALOG_TITLE,
|
||||
wxString cmd = wxGetTextFromUser("Enter the command: ",
|
||||
DIALOG_TITLE(),
|
||||
m_cmdLast);
|
||||
|
||||
if ( !cmd )
|
||||
return;
|
||||
|
||||
wxString input = wxGetTextFromUser(wxT("Enter the string to send to it: "),
|
||||
DIALOG_TITLE);
|
||||
wxString input = wxGetTextFromUser("Enter the string to send to it: ",
|
||||
DIALOG_TITLE());
|
||||
if ( !input )
|
||||
return;
|
||||
|
||||
@ -1004,13 +1005,13 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
|
||||
long pid = wxExecute(cmd, wxEXEC_ASYNC, process);
|
||||
if ( pid )
|
||||
{
|
||||
wxLogStatus(wxT("Process %ld (%s) launched."), pid, cmd.c_str());
|
||||
wxLogStatus("Process %ld (%s) launched.", pid, cmd.c_str());
|
||||
|
||||
AddPipedProcess(process);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogError(wxT("Execution of '%s' failed."), cmd.c_str());
|
||||
wxLogError("Execution of '%s' failed.", cmd.c_str());
|
||||
|
||||
delete process;
|
||||
}
|
||||
@ -1020,8 +1021,8 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnPOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString cmd = wxGetTextFromUser(wxT("Enter the command to launch: "),
|
||||
DIALOG_TITLE,
|
||||
wxString cmd = wxGetTextFromUser("Enter the command to launch: ",
|
||||
DIALOG_TITLE(),
|
||||
m_cmdLast);
|
||||
if ( cmd.empty() )
|
||||
return;
|
||||
@ -1029,23 +1030,23 @@ void MyFrame::OnPOpen(wxCommandEvent& WXUNUSED(event))
|
||||
wxProcess *process = wxProcess::Open(cmd);
|
||||
if ( !process )
|
||||
{
|
||||
wxLogError(wxT("Failed to launch the command."));
|
||||
wxLogError("Failed to launch the command.");
|
||||
return;
|
||||
}
|
||||
|
||||
wxLogVerbose(wxT("PID of the new process: %ld"), process->GetPid());
|
||||
wxLogVerbose("PID of the new process: %ld", process->GetPid());
|
||||
|
||||
wxOutputStream *out = process->GetOutputStream();
|
||||
if ( !out )
|
||||
{
|
||||
wxLogError(wxT("Failed to connect to child stdin"));
|
||||
wxLogError("Failed to connect to child stdin");
|
||||
return;
|
||||
}
|
||||
|
||||
wxInputStream *in = process->GetInputStream();
|
||||
if ( !in )
|
||||
{
|
||||
wxLogError(wxT("Failed to connect to child stdout"));
|
||||
wxLogError("Failed to connect to child stdout");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1059,9 +1060,9 @@ static bool AskUserForFileName()
|
||||
wxString filename;
|
||||
|
||||
#if wxUSE_FILEDLG
|
||||
filename = wxLoadFileSelector(wxT("any"), wxEmptyString, gs_lastFile);
|
||||
filename = wxLoadFileSelector("any", wxEmptyString, gs_lastFile);
|
||||
#else // !wxUSE_FILEDLG
|
||||
filename = wxGetTextFromUser(wxT("Enter the file name"), wxT("exec sample"),
|
||||
filename = wxGetTextFromUser("Enter the file name", "exec sample",
|
||||
gs_lastFile);
|
||||
#endif // wxUSE_FILEDLG/!wxUSE_FILEDLG
|
||||
|
||||
@ -1082,7 +1083,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event))
|
||||
wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);
|
||||
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());
|
||||
return;
|
||||
}
|
||||
@ -1092,7 +1093,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event))
|
||||
const wxFileType::MessageParameters params(gs_lastFile);
|
||||
#ifdef __WXMSW__
|
||||
// try editor, for instance Notepad if extension is .xml
|
||||
cmd = ft->GetExpandedCommand(wxT("edit"), params);
|
||||
cmd = ft->GetExpandedCommand("edit", params);
|
||||
ok = !cmd.empty();
|
||||
#endif
|
||||
if (!ok) // else try viewer
|
||||
@ -1100,7 +1101,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event))
|
||||
delete ft;
|
||||
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());
|
||||
return;
|
||||
}
|
||||
@ -1156,12 +1157,12 @@ void MyFrame::OnFileLaunch(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
|
||||
(
|
||||
wxT("Enter the URL"),
|
||||
wxT("exec sample"),
|
||||
"Enter the URL",
|
||||
"exec sample",
|
||||
s_url,
|
||||
this
|
||||
);
|
||||
@ -1185,20 +1186,20 @@ void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
bool MyFrame::GetDDEServer()
|
||||
{
|
||||
wxString server = wxGetTextFromUser(wxT("Server to connect to:"),
|
||||
DIALOG_TITLE, m_server);
|
||||
wxString server = wxGetTextFromUser("Server to connect to:",
|
||||
DIALOG_TITLE(), m_server);
|
||||
if ( !server )
|
||||
return false;
|
||||
|
||||
m_server = server;
|
||||
|
||||
wxString topic = wxGetTextFromUser(wxT("DDE topic:"), DIALOG_TITLE, m_topic);
|
||||
wxString topic = wxGetTextFromUser("DDE topic:", DIALOG_TITLE(), m_topic);
|
||||
if ( !topic )
|
||||
return false;
|
||||
|
||||
m_topic = topic;
|
||||
|
||||
wxString cmd = wxGetTextFromUser(wxT("DDE command:"), DIALOG_TITLE, m_cmdDde);
|
||||
wxString cmd = wxGetTextFromUser("DDE command:", DIALOG_TITLE(), m_cmdDde);
|
||||
if ( !cmd )
|
||||
return false;
|
||||
|
||||
@ -1216,19 +1217,19 @@ void MyFrame::OnDDEExec(wxCommandEvent& WXUNUSED(event))
|
||||
wxConnectionBase *conn = client.MakeConnection(wxEmptyString, m_server, m_topic);
|
||||
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());
|
||||
}
|
||||
else
|
||||
{
|
||||
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());
|
||||
}
|
||||
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);
|
||||
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());
|
||||
}
|
||||
else
|
||||
{
|
||||
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());
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(wxT("Successfully sent DDE request."));
|
||||
wxLogStatus("Successfully sent DDE request.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1335,7 +1336,7 @@ void MyFrame::ShowOutput(const wxString& cmd,
|
||||
if ( !count )
|
||||
return;
|
||||
|
||||
m_lbox->Append(wxString::Format(wxT("--- %s of '%s' ---"),
|
||||
m_lbox->Append(wxString::Format("--- %s of '%s' ---",
|
||||
title.c_str(), cmd.c_str()));
|
||||
|
||||
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(wxString::Format(wxT("--- End of %s ---"),
|
||||
m_lbox->Append(wxString::Format("--- End of %s ---",
|
||||
title.Lower().c_str()));
|
||||
}
|
||||
|
||||
@ -1353,7 +1354,7 @@ void MyFrame::ShowOutput(const wxString& cmd,
|
||||
|
||||
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);
|
||||
|
||||
m_parent->OnAsyncTermination(this);
|
||||
@ -1373,7 +1374,7 @@ bool MyPipedProcess::HasInput()
|
||||
|
||||
// this assumes that the output is always line buffered
|
||||
wxString msg;
|
||||
msg << m_cmd << wxT(" (stdout): ") << tis.ReadLine();
|
||||
msg << m_cmd << " (stdout): " << tis.ReadLine();
|
||||
|
||||
m_parent->GetLogListBox()->Append(msg);
|
||||
|
||||
@ -1386,7 +1387,7 @@ bool MyPipedProcess::HasInput()
|
||||
|
||||
// this assumes that the output is always line buffered
|
||||
wxString msg;
|
||||
msg << m_cmd << wxT(" (stderr): ") << tis.ReadLine();
|
||||
msg << m_cmd << " (stderr): " << tis.ReadLine();
|
||||
|
||||
m_parent->GetLogListBox()->Append(msg);
|
||||
|
||||
@ -1463,13 +1464,13 @@ MyPipeFrame::MyPipeFrame(wxFrame *parent,
|
||||
|
||||
wxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL);
|
||||
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->
|
||||
Add(new wxButton(panel, Exec_Btn_SendFile, wxT("&File...")), 0, wxALL, 5);
|
||||
Add(new wxButton(panel, Exec_Btn_SendFile, "&File..."), 0, wxALL, 5);
|
||||
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->
|
||||
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(m_textIn, 1, wxGROW | wxALL, 5);
|
||||
@ -1484,11 +1485,11 @@ MyPipeFrame::MyPipeFrame(wxFrame *parent,
|
||||
void MyPipeFrame::OnBtnSendFile(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#if wxUSE_FILEDLG
|
||||
wxFileDialog filedlg(this, wxT("Select file to send"));
|
||||
wxFileDialog filedlg(this, "Select file to send");
|
||||
if ( filedlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
wxFFile file(filedlg.GetFilename(), wxT("r"));
|
||||
wxFFile file(filedlg.GetFilename(), "r");
|
||||
wxString data;
|
||||
if ( !file.IsOpened() || !file.ReadAll(&data) )
|
||||
return;
|
||||
@ -1575,7 +1576,7 @@ void MyPipeFrame::OnProcessTerm(wxProcessEvent& WXUNUSED(event))
|
||||
|
||||
wxDELETE(m_process);
|
||||
|
||||
wxLogWarning(wxT("The other process has terminated, closing"));
|
||||
wxLogWarning("The other process has terminated, closing");
|
||||
|
||||
DisableInput();
|
||||
DisableOutput();
|
||||
|
@ -45,7 +45,10 @@
|
||||
#endif
|
||||
|
||||
// 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
|
||||
@ -415,80 +418,80 @@ MyFrame::MyFrame()
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
|
||||
menuFile->Append(Font_TestTextValue, wxT("&Test text value"),
|
||||
wxT("Verify that getting and setting text value doesn't change it"));
|
||||
menuFile->Append(Font_ViewMsg, wxT("&View...\tCtrl-V"),
|
||||
wxT("View an email message file"));
|
||||
menuFile->Append(Font_TestTextValue, "&Test text value",
|
||||
"Verify that getting and setting text value doesn't change it");
|
||||
menuFile->Append(Font_ViewMsg, "&View...\tCtrl-V",
|
||||
"View an email message file");
|
||||
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->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;
|
||||
menuFont->Append(Font_IncSize, wxT("&Increase font size by 2 points\tCtrl-I"));
|
||||
menuFont->Append(Font_DecSize, wxT("&Decrease font size by 2 points\tCtrl-D"));
|
||||
menuFont->Append(Font_GetBaseFont, wxT("Use &base version of the font\tCtrl-0"));
|
||||
menuFont->Append(Font_IncSize, "&Increase font size by 2 points\tCtrl-I");
|
||||
menuFont->Append(Font_DecSize, "&Decrease font size by 2 points\tCtrl-D");
|
||||
menuFont->Append(Font_GetBaseFont, "Use &base version of the font\tCtrl-0");
|
||||
menuFont->AppendSeparator();
|
||||
menuFont->AppendCheckItem(Font_Bold, wxT("&Bold\tCtrl-B"), wxT("Toggle bold state"));
|
||||
menuFont->AppendCheckItem(Font_Light, wxT("&Light\tCtrl-L"), wxT("Toggle light state"));
|
||||
menuFont->AppendCheckItem(Font_Bold, "&Bold\tCtrl-B", "Toggle bold state");
|
||||
menuFont->AppendCheckItem(Font_Light, "&Light\tCtrl-L", "Toggle light state");
|
||||
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__
|
||||
// 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
|
||||
menuFont->AppendSeparator();
|
||||
menuFont->AppendCheckItem(Font_Underlined, wxT("&Underlined\tCtrl-U"),
|
||||
wxT("Toggle underlined state"));
|
||||
menuFont->AppendCheckItem(Font_Strikethrough, wxT("&Strikethrough"),
|
||||
wxT("Toggle strikethrough state"));
|
||||
menuFont->AppendCheckItem(Font_Underlined, "&Underlined\tCtrl-U",
|
||||
"Toggle underlined state");
|
||||
menuFont->AppendCheckItem(Font_Strikethrough, "&Strikethrough",
|
||||
"Toggle strikethrough state");
|
||||
|
||||
menuFont->AppendSeparator();
|
||||
menuFont->Append(Font_SetNativeDesc,
|
||||
wxT("Set native font &description\tShift-Ctrl-D"));
|
||||
"Set native font &description\tShift-Ctrl-D");
|
||||
menuFont->Append(Font_SetNativeUserDesc,
|
||||
wxT("Set &user font description\tShift-Ctrl-U"));
|
||||
"Set &user font description\tShift-Ctrl-U");
|
||||
menuFont->AppendSeparator();
|
||||
menuFont->Append(Font_SetFamily, wxT("Set font family"));
|
||||
menuFont->Append(Font_SetFaceName, wxT("Set font face name"));
|
||||
menuFont->Append(Font_SetEncoding, wxT("Set font &encoding\tShift-Ctrl-E"));
|
||||
menuFont->Append(Font_SetFamily, "Set font family");
|
||||
menuFont->Append(Font_SetFaceName, "Set font face name");
|
||||
menuFont->Append(Font_SetEncoding, "Set font &encoding\tShift-Ctrl-E");
|
||||
|
||||
wxMenu *menuSelect = new wxMenu;
|
||||
menuSelect->Append(Font_Choose, wxT("&Select font...\tCtrl-S"),
|
||||
wxT("Select a standard font"));
|
||||
menuSelect->Append(Font_Choose, "&Select font...\tCtrl-S",
|
||||
"Select a standard font");
|
||||
|
||||
wxMenu *menuStdFonts = new wxMenu;
|
||||
menuStdFonts->Append(Font_wxNORMAL_FONT, wxT("wxNORMAL_FONT"), wxT("Normal font used by wxWidgets"));
|
||||
menuStdFonts->Append(Font_wxSMALL_FONT, wxT("wxSMALL_FONT"), wxT("Small font used by wxWidgets"));
|
||||
menuStdFonts->Append(Font_wxITALIC_FONT, wxT("wxITALIC_FONT"), wxT("Italic font used by wxWidgets"));
|
||||
menuStdFonts->Append(Font_wxSWISS_FONT, wxT("wxSWISS_FONT"), wxT("Swiss font used by wxWidgets"));
|
||||
menuStdFonts->Append(Font_wxFont_Default, wxT("wxFont()"), wxT("wxFont constructed from default wxFontInfo"));
|
||||
menuSelect->Append(Font_Standard, wxT("Standar&d fonts"), menuStdFonts);
|
||||
menuStdFonts->Append(Font_wxNORMAL_FONT, "wxNORMAL_FONT", "Normal font used by wxWidgets");
|
||||
menuStdFonts->Append(Font_wxSMALL_FONT, "wxSMALL_FONT", "Small font used by wxWidgets");
|
||||
menuStdFonts->Append(Font_wxITALIC_FONT, "wxITALIC_FONT", "Italic font used by wxWidgets");
|
||||
menuStdFonts->Append(Font_wxSWISS_FONT, "wxSWISS_FONT", "Swiss font used by wxWidgets");
|
||||
menuStdFonts->Append(Font_wxFont_Default, "wxFont()", "wxFont constructed from default wxFontInfo");
|
||||
menuSelect->Append(Font_Standard, "Standar&d fonts", menuStdFonts);
|
||||
|
||||
wxMenu *menuSettingFonts = new wxMenu;
|
||||
menuSettingFonts->Append(Font_wxSYS_OEM_FIXED_FONT, wxT("wxSYS_OEM_FIXED_FONT"),
|
||||
wxT("Original equipment manufacturer dependent fixed-pitch font."));
|
||||
menuSettingFonts->Append(Font_wxSYS_ANSI_FIXED_FONT, wxT("wxSYS_ANSI_FIXED_FONT"),
|
||||
wxT("Windows fixed-pitch (monospaced) font. "));
|
||||
menuSettingFonts->Append(Font_wxSYS_ANSI_VAR_FONT, wxT("wxSYS_ANSI_VAR_FONT"),
|
||||
wxT("Windows variable-pitch (proportional) font."));
|
||||
menuSettingFonts->Append(Font_wxSYS_SYSTEM_FONT, wxT("wxSYS_SYSTEM_FONT"),
|
||||
wxT("System font."));
|
||||
menuSettingFonts->Append(Font_wxSYS_DEVICE_DEFAULT_FONT, wxT("wxSYS_DEVICE_DEFAULT_FONT"),
|
||||
wxT("Device-dependent font."));
|
||||
menuSettingFonts->Append(Font_wxSYS_DEFAULT_GUI_FONT, wxT("wxSYS_DEFAULT_GUI_FONT"),
|
||||
wxT("Default font for user interface objects such as menus and dialog boxes. "));
|
||||
menuSelect->Append(Font_SystemSettings, wxT("System fonts"), menuSettingFonts);
|
||||
menuSettingFonts->Append(Font_wxSYS_OEM_FIXED_FONT, "wxSYS_OEM_FIXED_FONT",
|
||||
"Original equipment manufacturer dependent fixed-pitch font.");
|
||||
menuSettingFonts->Append(Font_wxSYS_ANSI_FIXED_FONT, "wxSYS_ANSI_FIXED_FONT",
|
||||
"Windows fixed-pitch (monospaced) font. ");
|
||||
menuSettingFonts->Append(Font_wxSYS_ANSI_VAR_FONT, "wxSYS_ANSI_VAR_FONT",
|
||||
"Windows variable-pitch (proportional) font.");
|
||||
menuSettingFonts->Append(Font_wxSYS_SYSTEM_FONT, "wxSYS_SYSTEM_FONT",
|
||||
"System font.");
|
||||
menuSettingFonts->Append(Font_wxSYS_DEVICE_DEFAULT_FONT, "wxSYS_DEVICE_DEFAULT_FONT",
|
||||
"Device-dependent font.");
|
||||
menuSettingFonts->Append(Font_wxSYS_DEFAULT_GUI_FONT, "wxSYS_DEFAULT_GUI_FONT",
|
||||
"Default font for user interface objects such as menus and dialog boxes. ");
|
||||
menuSelect->Append(Font_SystemSettings, "System fonts", menuSettingFonts);
|
||||
|
||||
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,
|
||||
wxT("Enumerate fi&xed font families\tCtrl-X"));
|
||||
"Enumerate fi&xed font families\tCtrl-X");
|
||||
menuSelect->Append(Font_EnumEncodings,
|
||||
wxT("Enumerate &encodings\tCtrl-E"));
|
||||
"Enumerate &encodings\tCtrl-E");
|
||||
menuSelect->Append(Font_EnumFamiliesForEncoding,
|
||||
wxT("Find font for en&coding...\tCtrl-C"),
|
||||
wxT("Find font families for given encoding"));
|
||||
"Find font for en&coding...\tCtrl-C",
|
||||
"Find font families for given encoding");
|
||||
|
||||
#if wxUSE_PRIVATE_FONTS
|
||||
// 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...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuFont, wxT("F&ont"));
|
||||
menuBar->Append(menuSelect, wxT("&Select"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(menuFont, "F&ont");
|
||||
menuBar->Append(menuSelect, "&Select");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -545,7 +548,7 @@ MyFrame::MyFrame()
|
||||
m_fontWindow->Bind(wxEVT_BUTTON, &MyFrame::OnFontPanelApply, this);
|
||||
|
||||
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,
|
||||
wxSize(-1, 6*GetCharHeight()),
|
||||
wxTE_MULTILINE);
|
||||
@ -555,7 +558,7 @@ MyFrame::MyFrame()
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar();
|
||||
SetStatusText(wxT("Welcome to wxWidgets font demo!"));
|
||||
SetStatusText("Welcome to wxWidgets font demo!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
SetClientSize(splitter->GetBestSize());
|
||||
@ -578,7 +581,7 @@ protected:
|
||||
const wxString& encoding) wxOVERRIDE
|
||||
{
|
||||
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());
|
||||
m_text += text;
|
||||
return true;
|
||||
@ -595,7 +598,7 @@ void MyFrame::OnEnumerateEncodings(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
fontEnumerator.EnumerateEncodings();
|
||||
|
||||
wxLogMessage(wxT("Enumerating all available encodings:\n%s"),
|
||||
wxLogMessage("Enumerating all available encodings:\n%s",
|
||||
fontEnumerator.GetText().c_str());
|
||||
}
|
||||
|
||||
@ -634,8 +637,8 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
|
||||
int nFacenames = fontEnumerator.GetFacenames().GetCount();
|
||||
if ( !silent )
|
||||
{
|
||||
wxLogStatus(this, wxT("Found %d %sfonts"),
|
||||
nFacenames, fixedWidthOnly ? wxT("fixed width ") : wxT(""));
|
||||
wxLogStatus(this, "Found %d %sfonts",
|
||||
nFacenames, fixedWidthOnly ? "fixed width " : "");
|
||||
}
|
||||
|
||||
wxString facename;
|
||||
@ -655,8 +658,8 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
|
||||
|
||||
n = wxGetSingleChoiceIndex
|
||||
(
|
||||
wxT("Choose a facename"),
|
||||
SAMPLE_TITLE,
|
||||
"Choose a facename",
|
||||
SAMPLE_TITLE(),
|
||||
nFacenames,
|
||||
facenames,
|
||||
this
|
||||
@ -679,7 +682,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
|
||||
}
|
||||
else if ( !silent )
|
||||
{
|
||||
wxLogWarning(wxT("No such fonts found."));
|
||||
wxLogWarning("No such fonts found.");
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -698,8 +701,8 @@ void MyFrame::OnSetNativeDesc(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString fontInfo = wxGetTextFromUser
|
||||
(
|
||||
wxT("Enter native font string"),
|
||||
wxT("Input font description"),
|
||||
"Enter native font string",
|
||||
"Input font description",
|
||||
m_fontWindow->GetTextFont().GetNativeFontInfoDesc(),
|
||||
this
|
||||
);
|
||||
@ -722,8 +725,8 @@ void MyFrame::OnSetNativeUserDesc(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString fontdesc = m_fontWindow->GetTextFont().GetNativeFontInfoUserDesc();
|
||||
wxString fontUserInfo = wxGetTextFromUser(
|
||||
wxT("Here you can edit current font description"),
|
||||
wxT("Input font description"), fontdesc,
|
||||
"Here you can edit current font description",
|
||||
"Input font description", fontdesc,
|
||||
this);
|
||||
if (fontUserInfo.IsEmpty())
|
||||
return; // user clicked "Cancel" - do nothing
|
||||
@ -731,13 +734,13 @@ void MyFrame::OnSetNativeUserDesc(wxCommandEvent& WXUNUSED(event))
|
||||
wxFont font;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG(!font.IsOk(), wxT("The font should now be invalid"));
|
||||
wxMessageBox(wxT("Error trying to create a font with such description..."));
|
||||
wxASSERT_MSG(!font.IsOk(), "The font should now be invalid");
|
||||
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 newFaceName = wxGetTextFromUser(
|
||||
wxT("Here you can edit current font face name."),
|
||||
wxT("Input font facename"), facename,
|
||||
"Here you can edit current font face name.",
|
||||
"Input font facename", facename,
|
||||
this);
|
||||
if (newFaceName.IsEmpty())
|
||||
return; // user clicked "Cancel" - do nothing
|
||||
@ -763,14 +766,14 @@ void MyFrame::OnSetFaceName(wxCommandEvent& WXUNUSED(event))
|
||||
wxFont font(m_fontWindow->GetTextFont());
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG(!font.IsOk(), wxT("The font should now be invalid"));
|
||||
wxMessageBox(wxT("There is no font with such face name..."),
|
||||
wxT("Invalid face name"), wxOK|wxICON_ERROR, this);
|
||||
wxASSERT_MSG(!font.IsOk(), "The font should now be invalid");
|
||||
wxMessageBox("There is no font with such face name...",
|
||||
"Invalid face name", wxOK|wxICON_ERROR, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -803,8 +806,8 @@ wxFontEncoding MyFrame::GetEncodingFromUser()
|
||||
|
||||
int i = wxGetSingleChoiceIndex
|
||||
(
|
||||
wxT("Choose the encoding"),
|
||||
SAMPLE_TITLE,
|
||||
"Choose the encoding",
|
||||
SAMPLE_TITLE(),
|
||||
names,
|
||||
this
|
||||
);
|
||||
@ -833,8 +836,8 @@ wxFontFamily MyFrame::GetFamilyFromUser()
|
||||
|
||||
int i = wxGetSingleChoiceIndex
|
||||
(
|
||||
wxT("Choose the family"),
|
||||
SAMPLE_TITLE,
|
||||
"Choose the family",
|
||||
SAMPLE_TITLE(),
|
||||
names,
|
||||
this
|
||||
);
|
||||
@ -920,7 +923,7 @@ void MyFrame::OnwxPointerFont(wxCommandEvent& event)
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxT("unknown standard font") );
|
||||
wxFAIL_MSG( "unknown standard font" );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -963,7 +966,7 @@ void MyFrame::OnwxSystemSettingsFont(wxCommandEvent& event)
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxT("unknown standard font") );
|
||||
wxFAIL_MSG( "unknown standard font" );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1018,7 +1021,7 @@ void MyFrame::OnPrivateFont(wxCommandEvent& WXUNUSED(event))
|
||||
wxFont font(m_fontWindow->GetTextFont());
|
||||
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);
|
||||
}
|
||||
else
|
||||
@ -1039,7 +1042,7 @@ void MyFrame::OnTestTextValue(wxCommandEvent& WXUNUSED(event))
|
||||
m_textctrl->SetValue(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
|
||||
// first, choose the 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);
|
||||
if ( dialog.ShowModal() != wxID_OK )
|
||||
return;
|
||||
@ -1066,7 +1069,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
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);
|
||||
|
||||
size_t n, count = file.GetLineCount();
|
||||
@ -1099,7 +1102,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
if ( !charset )
|
||||
{
|
||||
wxLogError(wxT("The file '%s' doesn't contain charset information."),
|
||||
wxLogError("The file '%s' doesn't contain charset information.",
|
||||
filename.c_str());
|
||||
|
||||
return;
|
||||
@ -1109,7 +1112,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
||||
wxFontEncoding fontenc = wxFontMapper::Get()->CharsetToEncoding(charset);
|
||||
if ( fontenc == wxFONTENCODING_SYSTEM )
|
||||
{
|
||||
wxLogError(wxT("Charset '%s' is unsupported."), charset.c_str());
|
||||
wxLogError("Charset '%s' is unsupported.", charset.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1131,13 +1134,13 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogWarning(wxT("Cannot convert from '%s' to '%s'."),
|
||||
wxLogWarning("Cannot convert from '%s' to '%s'.",
|
||||
wxFontMapper::GetEncodingDescription(fontenc).c_str(),
|
||||
wxFontMapper::GetEncodingDescription(encAlt).c_str());
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
@ -1151,7 +1154,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
@ -1160,9 +1163,9 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("wxWidgets font sample\n")
|
||||
wxT("(c) 1999-2006 Vadim Zeitlin"),
|
||||
wxString(wxT("About ")) + SAMPLE_TITLE,
|
||||
wxMessageBox("wxWidgets font sample\n"
|
||||
"(c) 1999-2006 Vadim Zeitlin",
|
||||
wxString("About ") + SAMPLE_TITLE(),
|
||||
wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
@ -1496,7 +1499,7 @@ void FontCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
|
||||
// the size of one cell (Normally biggest char + small margin)
|
||||
wxCoord maxCharWidth, maxCharHeight;
|
||||
dc.GetTextExtent(wxT("W"), &maxCharWidth, &maxCharHeight);
|
||||
dc.GetTextExtent("W", &maxCharWidth, &maxCharHeight);
|
||||
int w = maxCharWidth + 5,
|
||||
h = maxCharHeight + 4;
|
||||
|
||||
|
@ -243,16 +243,16 @@ wxEND_EVENT_TABLE()
|
||||
|
||||
|
||||
GridFrame::GridFrame()
|
||||
: wxFrame( (wxFrame *)NULL, wxID_ANY, wxT("wxWidgets grid class demo"),
|
||||
: wxFrame( (wxFrame *)NULL, wxID_ANY, "wxWidgets grid class demo",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize )
|
||||
{
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
wxMenu *fileMenu = new wxMenu;
|
||||
fileMenu->Append( ID_VTABLE, wxT("&Virtual table test\tCtrl-V"));
|
||||
fileMenu->Append( ID_BUGS_TABLE, wxT("&Bugs table test\tCtrl-B"));
|
||||
fileMenu->Append( ID_TABULAR_TABLE, wxT("&Tabular table test\tCtrl-T"));
|
||||
fileMenu->Append( ID_VTABLE, "&Virtual table test\tCtrl-V");
|
||||
fileMenu->Append( ID_BUGS_TABLE, "&Bugs table test\tCtrl-B");
|
||||
fileMenu->Append( ID_TABULAR_TABLE, "&Tabular table test\tCtrl-T");
|
||||
fileMenu->AppendSeparator();
|
||||
|
||||
wxMenu* setupMenu = new wxMenu;
|
||||
@ -286,7 +286,7 @@ GridFrame::GridFrame()
|
||||
fileMenu->Append( ID_RENDER_COORDS, "Render G5:P30" );
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append( wxID_EXIT, wxT("E&xit\tAlt-X") );
|
||||
fileMenu->Append( wxID_EXIT, "E&xit\tAlt-X" );
|
||||
|
||||
wxMenu *viewMenu = new wxMenu;
|
||||
viewMenu->AppendCheckItem(ID_TOGGLEROWLABELS, "&Row labels");
|
||||
@ -309,41 +309,41 @@ GridFrame::GridFrame()
|
||||
viewMenu->Append(ID_SHOWROW, "&Show row 2");
|
||||
wxMenu *rowLabelMenu = new wxMenu;
|
||||
|
||||
viewMenu->Append( ID_ROWLABELALIGN, wxT("R&ow label alignment"),
|
||||
viewMenu->Append( ID_ROWLABELALIGN, "R&ow label alignment",
|
||||
rowLabelMenu,
|
||||
wxT("Change alignment of row labels") );
|
||||
"Change alignment of row labels" );
|
||||
|
||||
rowLabelMenu->AppendRadioItem( ID_ROWLABELHORIZALIGN, wxT("&Horizontal") );
|
||||
rowLabelMenu->AppendRadioItem( ID_ROWLABELVERTALIGN, wxT("&Vertical") );
|
||||
rowLabelMenu->AppendRadioItem( ID_ROWLABELHORIZALIGN, "&Horizontal" );
|
||||
rowLabelMenu->AppendRadioItem( ID_ROWLABELVERTALIGN, "&Vertical" );
|
||||
|
||||
wxMenu *colLabelMenu = new wxMenu;
|
||||
|
||||
viewMenu->Append( ID_COLLABELALIGN, wxT("Col l&abel alignment"),
|
||||
viewMenu->Append( ID_COLLABELALIGN, "Col l&abel alignment",
|
||||
colLabelMenu,
|
||||
wxT("Change alignment of col labels") );
|
||||
"Change alignment of col labels" );
|
||||
|
||||
colLabelMenu->AppendRadioItem( ID_COLLABELHORIZALIGN, wxT("&Horizontal") );
|
||||
colLabelMenu->AppendRadioItem( ID_COLLABELVERTALIGN, wxT("&Vertical") );
|
||||
colLabelMenu->AppendRadioItem( ID_COLLABELHORIZALIGN, "&Horizontal" );
|
||||
colLabelMenu->AppendRadioItem( ID_COLLABELVERTALIGN, "&Vertical" );
|
||||
|
||||
wxMenu *cornerLabelMenu = new wxMenu;
|
||||
viewMenu->Append( ID_CORNERLABELALIGN, wxT("Corner label alignment"),
|
||||
viewMenu->Append( ID_CORNERLABELALIGN, "Corner label alignment",
|
||||
cornerLabelMenu,
|
||||
wxT("Change alignment of corner label") );
|
||||
"Change alignment of corner label" );
|
||||
|
||||
cornerLabelMenu->AppendRadioItem( ID_CORNERLABELHORIZALIGN, wxT("&Horizontal") );
|
||||
cornerLabelMenu->AppendRadioItem( ID_CORNERLABELVERTALIGN, wxT("&Vertical") );
|
||||
cornerLabelMenu->AppendRadioItem( ID_CORNERLABELHORIZALIGN, "&Horizontal" );
|
||||
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;
|
||||
|
||||
viewMenu->Append( ID_ROWLABELALIGN, wxT("Col header style"),
|
||||
viewMenu->Append( ID_ROWLABELALIGN, "Col header style",
|
||||
colHeaderMenu,
|
||||
wxT("Change style of col header") );
|
||||
"Change style of col header" );
|
||||
|
||||
colHeaderMenu->AppendRadioItem( ID_COLDEFAULTHEADER, wxT("&Default") );
|
||||
colHeaderMenu->AppendRadioItem( ID_COLNATIVEHEADER, wxT("&Native") );
|
||||
colHeaderMenu->AppendRadioItem( ID_COLCUSTOMHEADER, wxT("&Custom") );
|
||||
colHeaderMenu->AppendRadioItem( ID_COLDEFAULTHEADER, "&Default" );
|
||||
colHeaderMenu->AppendRadioItem( ID_COLNATIVEHEADER, "&Native" );
|
||||
colHeaderMenu->AppendRadioItem( ID_COLCUSTOMHEADER, "&Custom" );
|
||||
|
||||
wxMenu *tabBehaviourMenu = new wxMenu;
|
||||
tabBehaviourMenu->AppendRadioItem(ID_TAB_STOP, "&Stop at the boundary");
|
||||
@ -353,67 +353,67 @@ GridFrame::GridFrame()
|
||||
viewMenu->AppendSubMenu(tabBehaviourMenu, "&Tab behaviour");
|
||||
|
||||
wxMenu *colMenu = new wxMenu;
|
||||
colMenu->Append( ID_SETLABELCOLOUR, wxT("Set &label colour...") );
|
||||
colMenu->Append( ID_SETLABELTEXTCOLOUR, wxT("Set label &text colour...") );
|
||||
colMenu->Append( ID_SETLABEL_FONT, wxT("Set label fo&nt...") );
|
||||
colMenu->Append( ID_GRIDLINECOLOUR, wxT("&Grid line colour...") );
|
||||
colMenu->Append( ID_SET_CELL_FG_COLOUR, wxT("Set cell &foreground colour...") );
|
||||
colMenu->Append( ID_SET_CELL_BG_COLOUR, wxT("Set cell &background colour...") );
|
||||
colMenu->Append( ID_SETLABELCOLOUR, "Set &label colour..." );
|
||||
colMenu->Append( ID_SETLABELTEXTCOLOUR, "Set label &text colour..." );
|
||||
colMenu->Append( ID_SETLABEL_FONT, "Set label fo&nt..." );
|
||||
colMenu->Append( ID_GRIDLINECOLOUR, "&Grid line colour..." );
|
||||
colMenu->Append( ID_SET_CELL_FG_COLOUR, "Set cell &foreground colour..." );
|
||||
colMenu->Append( ID_SET_CELL_BG_COLOUR, "Set cell &background colour..." );
|
||||
|
||||
wxMenu *editMenu = new wxMenu;
|
||||
editMenu->Append( ID_INSERTROW, wxT("Insert &row") );
|
||||
editMenu->Append( ID_INSERTCOL, wxT("Insert &column") );
|
||||
editMenu->Append( ID_DELETEROW, wxT("Delete selected ro&ws") );
|
||||
editMenu->Append( ID_DELETECOL, wxT("Delete selected co&ls") );
|
||||
editMenu->Append( ID_CLEARGRID, wxT("Cl&ear grid cell contents") );
|
||||
editMenu->Append( ID_SETCORNERLABEL, wxT("&Set corner label...") );
|
||||
editMenu->Append( ID_INSERTROW, "Insert &row" );
|
||||
editMenu->Append( ID_INSERTCOL, "Insert &column" );
|
||||
editMenu->Append( ID_DELETEROW, "Delete selected ro&ws" );
|
||||
editMenu->Append( ID_DELETECOL, "Delete selected co&ls" );
|
||||
editMenu->Append( ID_CLEARGRID, "Cl&ear grid cell contents" );
|
||||
editMenu->Append( ID_SETCORNERLABEL, "&Set corner label..." );
|
||||
|
||||
wxMenu *selectMenu = new wxMenu;
|
||||
selectMenu->Append( ID_SELECT_UNSELECT, wxT("Add new cells to the selection"),
|
||||
wxT("When off, old selection is deselected before ")
|
||||
wxT("selecting the new cells"), wxITEM_CHECK );
|
||||
selectMenu->Append( ID_SELECT_UNSELECT, "Add new cells to the selection",
|
||||
"When off, old selection is deselected before "
|
||||
"selecting the new cells", wxITEM_CHECK );
|
||||
selectMenu->AppendSeparator();
|
||||
selectMenu->Append( ID_SELECT_ALL, wxT("Select all"));
|
||||
selectMenu->Append( ID_SELECT_ROW, wxT("Select row 2"));
|
||||
selectMenu->Append( ID_SELECT_COL, wxT("Select col 2"));
|
||||
selectMenu->Append( ID_SELECT_CELL, wxT("Select cell (3, 1)"));
|
||||
selectMenu->Append( ID_SELECT_ALL, "Select all");
|
||||
selectMenu->Append( ID_SELECT_ROW, "Select row 2");
|
||||
selectMenu->Append( ID_SELECT_COL, "Select col 2");
|
||||
selectMenu->Append( ID_SELECT_CELL, "Select cell (3, 1)");
|
||||
selectMenu->AppendSeparator();
|
||||
selectMenu->Append( ID_DESELECT_ALL, wxT("Deselect all"));
|
||||
selectMenu->Append( ID_DESELECT_ROW, wxT("Deselect row 2"));
|
||||
selectMenu->Append( ID_DESELECT_COL, wxT("Deselect col 2"));
|
||||
selectMenu->Append( ID_DESELECT_CELL, wxT("Deselect cell (3, 1)"));
|
||||
selectMenu->Append( ID_DESELECT_ALL, "Deselect all");
|
||||
selectMenu->Append( ID_DESELECT_ROW, "Deselect row 2");
|
||||
selectMenu->Append( ID_DESELECT_COL, "Deselect col 2");
|
||||
selectMenu->Append( ID_DESELECT_CELL, "Deselect cell (3, 1)");
|
||||
selectMenu->AppendSeparator();
|
||||
wxMenu *selectionMenu = new wxMenu;
|
||||
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,
|
||||
wxT("Change selection mode") );
|
||||
"Change selection mode" );
|
||||
|
||||
selectionMenu->Append( ID_SELCELLS, wxT("Select &cells") );
|
||||
selectionMenu->Append( ID_SELROWS, wxT("Select &rows") );
|
||||
selectionMenu->Append( ID_SELCOLS, wxT("Select col&umns") );
|
||||
selectionMenu->Append( ID_SELROWSORCOLS, wxT("Select rows &or columns") );
|
||||
selectionMenu->Append( ID_SELCELLS, "Select &cells" );
|
||||
selectionMenu->Append( ID_SELROWS, "Select &rows" );
|
||||
selectionMenu->Append( ID_SELCOLS, "Select col&umns" );
|
||||
selectionMenu->Append( ID_SELROWSORCOLS, "Select rows &or columns" );
|
||||
|
||||
wxMenu *autosizeMenu = new wxMenu;
|
||||
autosizeMenu->Append( ID_SIZE_ROW, wxT("Selected &row data") );
|
||||
autosizeMenu->Append( ID_SIZE_COL, wxT("Selected &column data") );
|
||||
autosizeMenu->Append( ID_SIZE_ROW_LABEL, wxT("Selected row la&bel") );
|
||||
autosizeMenu->Append( ID_SIZE_COL_LABEL, wxT("Selected column &label") );
|
||||
autosizeMenu->Append( ID_SIZE_LABELS_COL, wxT("Column la&bels") );
|
||||
autosizeMenu->Append( ID_SIZE_LABELS_ROW, wxT("Row label&s") );
|
||||
autosizeMenu->Append( ID_SIZE_GRID, wxT("Entire &grid") );
|
||||
autosizeMenu->Append( ID_SIZE_ROW, "Selected &row data" );
|
||||
autosizeMenu->Append( ID_SIZE_COL, "Selected &column data" );
|
||||
autosizeMenu->Append( ID_SIZE_ROW_LABEL, "Selected row la&bel" );
|
||||
autosizeMenu->Append( ID_SIZE_COL_LABEL, "Selected column &label" );
|
||||
autosizeMenu->Append( ID_SIZE_LABELS_COL, "Column la&bels" );
|
||||
autosizeMenu->Append( ID_SIZE_LABELS_ROW, "Row label&s" );
|
||||
autosizeMenu->Append( ID_SIZE_GRID, "Entire &grid" );
|
||||
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append( wxID_ABOUT, wxT("&About wxGrid demo") );
|
||||
helpMenu->Append( wxID_ABOUT, "&About wxGrid demo" );
|
||||
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append( fileMenu, wxT("&File") );
|
||||
menuBar->Append( viewMenu, wxT("&Grid") );
|
||||
menuBar->Append( colMenu, wxT("&Colours") );
|
||||
menuBar->Append( editMenu, wxT("&Edit") );
|
||||
menuBar->Append( selectMenu, wxT("&Select") );
|
||||
menuBar->Append( autosizeMenu, wxT("&Autosize") );
|
||||
menuBar->Append( helpMenu, wxT("&Help") );
|
||||
menuBar->Append( fileMenu, "&File" );
|
||||
menuBar->Append( viewMenu, "&Grid" );
|
||||
menuBar->Append( colMenu, "&Colours" );
|
||||
menuBar->Append( editMenu, "&Edit" );
|
||||
menuBar->Append( selectMenu, "&Select" );
|
||||
menuBar->Append( autosizeMenu, "&Autosize" );
|
||||
menuBar->Append( helpMenu, "&Help" );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
|
||||
@ -455,55 +455,55 @@ GridFrame::GridFrame()
|
||||
grid->AppendRows(ir);
|
||||
|
||||
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->SetCellEditor( 0, 1 , new wxGridCellAutoWrapStringEditor);
|
||||
|
||||
grid->SetCellValue( 0, 2, wxT("Blah") );
|
||||
grid->SetCellValue( 0, 3, wxT("Read only") );
|
||||
grid->SetCellValue( 0, 2, "Blah" );
|
||||
grid->SetCellValue( 0, 3, "Read only" );
|
||||
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);
|
||||
wxString longtext = wxT("abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\n");
|
||||
longtext += wxT("With tabs :\n");
|
||||
longtext += wxT("Home,\t\thome\t\t\tagain\n");
|
||||
longtext += wxT("Long word at start :\n");
|
||||
longtext += wxT("ILikeToBeHereWhen I can\n");
|
||||
longtext += wxT("Long word in the middle :\n");
|
||||
longtext += wxT("When IComeHome,ColdAnd tired\n");
|
||||
longtext += wxT("Long last word :\n");
|
||||
longtext += wxT("It's GoodToWarmMyBonesBesideTheFire");
|
||||
wxString longtext = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\n";
|
||||
longtext += "With tabs :\n";
|
||||
longtext += "Home,\t\thome\t\t\tagain\n";
|
||||
longtext += "Long word at start :\n";
|
||||
longtext += "ILikeToBeHereWhen I can\n";
|
||||
longtext += "Long word in the middle :\n";
|
||||
longtext += "When IComeHome,ColdAnd tired\n";
|
||||
longtext += "Long last word :\n";
|
||||
longtext += "It's GoodToWarmMyBonesBesideTheFire";
|
||||
grid->SetCellValue( 0, 10, longtext );
|
||||
grid->SetCellRenderer(0 , 10, new wxGridCellAutoWrapStringRenderer);
|
||||
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->SetCellValue(98, 98, "Test background colour setting");
|
||||
grid->SetCellBackgroundColour(98, 99, 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( 1, 0, wxT("This default cell will overflow into neighboring cells, but not if you turn overflow off."));
|
||||
grid->SetCellValue( 99, 99, "Ctrl+End\nwill go to\nthis cell" );
|
||||
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->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->SetCellValue(3, 3, wxT("green on grey"));
|
||||
grid->SetCellValue(3, 3, "green on grey");
|
||||
grid->SetCellTextColour(3, 3, *wxGREEN);
|
||||
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->SetCellRenderer(4, 4, new MyGridCellRenderer);
|
||||
|
||||
@ -519,33 +519,33 @@ GridFrame::GridFrame()
|
||||
attr->SetBackgroundColour(*wxRED);
|
||||
grid->SetRowAttr(5, attr);
|
||||
|
||||
grid->SetCellValue(2, 4, wxT("a wider column"));
|
||||
grid->SetCellValue(2, 4, "a wider column");
|
||||
grid->SetColSize(4, 120);
|
||||
grid->SetColMinimalWidth(4, 120);
|
||||
|
||||
grid->SetCellTextColour(5, 8, *wxGREEN);
|
||||
grid->SetCellValue(5, 8, wxT("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, 8, "Bg from row attr\nText col from cell attr");
|
||||
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.
|
||||
grid->SetColFormatFloat(6);
|
||||
grid->SetCellValue(0, 6, "Default\nfloat format");
|
||||
grid->SetCellValue(1, 6, wxString::Format(wxT("%g"), 3.1415));
|
||||
grid->SetCellValue(2, 6, wxString::Format(wxT("%g"), 1415.0));
|
||||
grid->SetCellValue(3, 6, wxString::Format(wxT("%g"), 12345.67890));
|
||||
grid->SetCellValue(1, 6, wxString::Format("%g", 3.1415));
|
||||
grid->SetCellValue(2, 6, wxString::Format("%g", 1415.0));
|
||||
grid->SetCellValue(3, 6, wxString::Format("%g", 12345.67890));
|
||||
|
||||
grid->SetColFormatFloat(7, 6, 2);
|
||||
grid->SetCellValue(0, 7, "Width 6\nprecision 2");
|
||||
grid->SetCellValue(1, 7, wxString::Format(wxT("%g"), 3.1415));
|
||||
grid->SetCellValue(2, 7, wxString::Format(wxT("%g"), 1415.0));
|
||||
grid->SetCellValue(3, 7, wxString::Format(wxT("%g"), 12345.67890));
|
||||
grid->SetCellValue(1, 7, wxString::Format("%g", 3.1415));
|
||||
grid->SetCellValue(2, 7, wxString::Format("%g", 1415.0));
|
||||
grid->SetCellValue(3, 7, wxString::Format("%g", 12345.67890));
|
||||
|
||||
grid->SetColFormatCustom(8,
|
||||
wxString::Format("%s:%i,%i,%s", wxGRID_VALUE_FLOAT, -1, 4, "g"));
|
||||
grid->SetCellValue(0, 8, "Compact\nformat");
|
||||
grid->SetCellValue(1, 8, wxT("31415e-4"));
|
||||
grid->SetCellValue(2, 8, wxT("1415"));
|
||||
grid->SetCellValue(3, 8, wxT("123456789e-4"));
|
||||
grid->SetCellValue(1, 8, "31415e-4");
|
||||
grid->SetCellValue(2, 8, "1415");
|
||||
grid->SetCellValue(3, 8, "123456789e-4");
|
||||
|
||||
grid->SetColFormatNumber(9);
|
||||
grid->SetCellValue(0, 9, "Integer\ncolumn");
|
||||
@ -557,9 +557,9 @@ GridFrame::GridFrame()
|
||||
|
||||
const wxString choices[] =
|
||||
{
|
||||
wxT("Please select a choice"),
|
||||
wxT("This takes two cells"),
|
||||
wxT("Another choice"),
|
||||
"Please select a choice",
|
||||
"This takes two cells",
|
||||
"Another choice",
|
||||
};
|
||||
grid->SetCellEditor(4, 0, new wxGridCellChoiceEditor(WXSIZEOF(choices), choices));
|
||||
grid->SetCellSize(4, 0, 1, 2);
|
||||
@ -568,7 +568,7 @@ GridFrame::GridFrame()
|
||||
|
||||
grid->SetCellSize(7, 1, 3, 4);
|
||||
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
|
||||
grid->DisableRowResize(10);
|
||||
@ -755,10 +755,10 @@ void GridFrame::ToggleGridLines( 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:"),
|
||||
wxT("Pen Width"), 11, choices);
|
||||
wxSingleChoiceDialog dlg(this, "Choose the thickness of the highlight pen:",
|
||||
"Pen Width", 11, choices);
|
||||
|
||||
int current = grid->GetCellHighlightPenWidth();
|
||||
dlg.SetSelection(current);
|
||||
@ -769,10 +769,10 @@ void GridFrame::OnSetHighlightWidth( 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:"),
|
||||
wxT("Pen Width"), 11, choices);
|
||||
wxSingleChoiceDialog dlg(this, "Choose the thickness of the highlight pen:",
|
||||
"Pen Width", 11, choices);
|
||||
|
||||
int current = grid->GetCellHighlightROPenWidth();
|
||||
dlg.SetSelection(current);
|
||||
@ -1260,22 +1260,22 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
|
||||
wxString logBuf;
|
||||
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 )
|
||||
{
|
||||
logBuf << wxT("Left click on col label ") << ev.GetCol();
|
||||
logBuf << "Left click on col label " << ev.GetCol();
|
||||
}
|
||||
else
|
||||
{
|
||||
logBuf << wxT("Left click on corner label");
|
||||
logBuf << "Left click on corner label";
|
||||
}
|
||||
|
||||
if ( ev.ShiftDown() )
|
||||
logBuf << wxT(" (shift down)");
|
||||
logBuf << " (shift down)";
|
||||
if ( ev.ControlDown() )
|
||||
logBuf << wxT(" (control down)");
|
||||
wxLogMessage( wxT("%s"), logBuf.c_str() );
|
||||
logBuf << " (control down)";
|
||||
wxLogMessage( "%s", logBuf.c_str() );
|
||||
|
||||
// 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 )
|
||||
{
|
||||
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
|
||||
// (cell highlighting etc.)
|
||||
@ -1335,21 +1335,21 @@ void GridFrame::OnSelectCell( wxGridEvent& ev )
|
||||
{
|
||||
wxString logBuf;
|
||||
if ( ev.Selecting() )
|
||||
logBuf << wxT("Selected ");
|
||||
logBuf << "Selected ";
|
||||
else
|
||||
logBuf << wxT("Deselected ");
|
||||
logBuf << wxT("cell at row ") << ev.GetRow()
|
||||
<< wxT(" col ") << ev.GetCol()
|
||||
<< wxT(" ( ControlDown: ")<< (ev.ControlDown() ? 'T':'F')
|
||||
<< wxT(", ShiftDown: ")<< (ev.ShiftDown() ? 'T':'F')
|
||||
<< wxT(", AltDown: ")<< (ev.AltDown() ? 'T':'F')
|
||||
<< wxT(", MetaDown: ")<< (ev.MetaDown() ? 'T':'F') << wxT(" )");
|
||||
logBuf << "Deselected ";
|
||||
logBuf << "cell at row " << ev.GetRow()
|
||||
<< " col " << ev.GetCol()
|
||||
<< " ( ControlDown: "<< (ev.ControlDown() ? 'T':'F')
|
||||
<< ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F')
|
||||
<< ", AltDown: "<< (ev.AltDown() ? 'T':'F')
|
||||
<< ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )";
|
||||
|
||||
//Indicate whether this column was moved
|
||||
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
|
||||
// to occur in wxGrid
|
||||
@ -1360,18 +1360,18 @@ void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev )
|
||||
{
|
||||
wxString logBuf;
|
||||
if ( ev.Selecting() )
|
||||
logBuf << wxT("Selected ");
|
||||
logBuf << "Selected ";
|
||||
else
|
||||
logBuf << wxT("Deselected ");
|
||||
logBuf << wxT("cells from row ") << ev.GetTopRow()
|
||||
<< wxT(" col ") << ev.GetLeftCol()
|
||||
<< wxT(" to row ") << ev.GetBottomRow()
|
||||
<< wxT(" col ") << ev.GetRightCol()
|
||||
<< wxT(" ( ControlDown: ")<< (ev.ControlDown() ? 'T':'F')
|
||||
<< wxT(", ShiftDown: ")<< (ev.ShiftDown() ? 'T':'F')
|
||||
<< wxT(", AltDown: ")<< (ev.AltDown() ? 'T':'F')
|
||||
<< wxT(", MetaDown: ")<< (ev.MetaDown() ? 'T':'F') << wxT(" )");
|
||||
wxLogMessage( wxT("%s"), logBuf.c_str() );
|
||||
logBuf << "Deselected ";
|
||||
logBuf << "cells from row " << ev.GetTopRow()
|
||||
<< " col " << ev.GetLeftCol()
|
||||
<< " to row " << ev.GetBottomRow()
|
||||
<< " col " << ev.GetRightCol()
|
||||
<< " ( ControlDown: "<< (ev.ControlDown() ? 'T':'F')
|
||||
<< ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F')
|
||||
<< ", AltDown: "<< (ev.AltDown() ? 'T':'F')
|
||||
<< ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )";
|
||||
wxLogMessage( "%s", logBuf.c_str() );
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
@ -1412,7 +1412,7 @@ void GridFrame::OnCellValueChanged( 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.Skip();
|
||||
@ -1423,14 +1423,14 @@ void GridFrame::OnEditorShown( wxGridEvent& ev )
|
||||
|
||||
if ( (ev.GetCol() == 4) &&
|
||||
(ev.GetRow() == 0) &&
|
||||
(wxMessageBox(wxT("Are you sure you wish to edit this cell"),
|
||||
wxT("Checking"),wxYES_NO) == wxNO ) ) {
|
||||
(wxMessageBox("Are you sure you wish to edit this cell",
|
||||
"Checking",wxYES_NO) == wxNO ) ) {
|
||||
|
||||
ev.Veto();
|
||||
return;
|
||||
}
|
||||
|
||||
wxLogMessage( wxT("Cell editor shown.") );
|
||||
wxLogMessage( "Cell editor shown." );
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
@ -1440,14 +1440,14 @@ void GridFrame::OnEditorHidden( wxGridEvent& ev )
|
||||
|
||||
if ( (ev.GetCol() == 4) &&
|
||||
(ev.GetRow() == 0) &&
|
||||
(wxMessageBox(wxT("Are you sure you wish to finish editing this cell"),
|
||||
wxT("Checking"),wxYES_NO) == wxNO ) ) {
|
||||
(wxMessageBox("Are you sure you wish to finish editing this cell",
|
||||
"Checking",wxYES_NO) == wxNO ) ) {
|
||||
|
||||
ev.Veto();
|
||||
return;
|
||||
}
|
||||
|
||||
wxLogMessage( wxT("Cell editor hidden.") );
|
||||
wxLogMessage( "Cell editor hidden." );
|
||||
|
||||
ev.Skip();
|
||||
}
|
||||
@ -1455,18 +1455,18 @@ void GridFrame::OnEditorHidden( wxGridEvent& ev )
|
||||
void GridFrame::About( wxCommandEvent& WXUNUSED(ev) )
|
||||
{
|
||||
wxAboutDialogInfo aboutInfo;
|
||||
aboutInfo.SetName(wxT("wxGrid demo"));
|
||||
aboutInfo.SetName("wxGrid demo");
|
||||
aboutInfo.SetDescription(_("wxGrid sample program"));
|
||||
aboutInfo.AddDeveloper(wxT("Michael Bedward"));
|
||||
aboutInfo.AddDeveloper(wxT("Julian Smart"));
|
||||
aboutInfo.AddDeveloper(wxT("Vadim Zeitlin"));
|
||||
aboutInfo.AddDeveloper("Michael Bedward");
|
||||
aboutInfo.AddDeveloper("Julian Smart");
|
||||
aboutInfo.AddDeveloper("Vadim Zeitlin");
|
||||
|
||||
// this is just to force the generic version of the about
|
||||
// dialog under wxMSW so that it's easy to test if the grid
|
||||
// repaints correctly when it has lost focus and a dialog
|
||||
// (different from the Windows standard message box -- it doesn't
|
||||
// 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);
|
||||
}
|
||||
@ -1529,9 +1529,9 @@ void GridFrame::OnVTable(wxCommandEvent& )
|
||||
{
|
||||
static long s_sizeGrid = 10000;
|
||||
|
||||
s_sizeGrid = wxGetNumberFromUser(wxT("Size of the table to create"),
|
||||
wxT("Size: "),
|
||||
wxT("wxGridDemo question"),
|
||||
s_sizeGrid = wxGetNumberFromUser("Size of the table to create",
|
||||
"Size: ",
|
||||
"wxGridDemo question",
|
||||
s_sizeGrid,
|
||||
0, 32000, this);
|
||||
|
||||
@ -1568,7 +1568,7 @@ void MyGridCellRenderer::Draw(wxGrid& grid,
|
||||
// ============================================================================
|
||||
|
||||
BigGridFrame::BigGridFrame(long sizeGrid)
|
||||
: wxFrame(NULL, wxID_ANY, wxT("Plugin Virtual Table"),
|
||||
: wxFrame(NULL, wxID_ANY, "Plugin Virtual Table",
|
||||
wxDefaultPosition, wxSize(500, 450))
|
||||
{
|
||||
m_grid = new wxGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
@ -1619,37 +1619,27 @@ enum Severity
|
||||
|
||||
static const wxString severities[] =
|
||||
{
|
||||
wxT("wishlist"),
|
||||
wxT("minor"),
|
||||
wxT("normal"),
|
||||
wxT("major"),
|
||||
wxT("critical"),
|
||||
"wishlist",
|
||||
"minor",
|
||||
"normal",
|
||||
"major",
|
||||
"critical",
|
||||
};
|
||||
|
||||
static struct BugsGridData
|
||||
{
|
||||
int id;
|
||||
wxChar summary[80];
|
||||
wxString summary;
|
||||
Severity severity;
|
||||
int prio;
|
||||
wxChar platform[12];
|
||||
wxString platform;
|
||||
bool opened;
|
||||
} gs_dataBugsGrid [] =
|
||||
{
|
||||
{ 18, wxT("foo doesn't work"), Sev_Major, 1, wxT("wxMSW"), true },
|
||||
{ 27, wxT("bar crashes"), Sev_Critical, 1, wxT("all"), false },
|
||||
{ 45, wxT("printing is slow"), Sev_Minor, 3, wxT("wxMSW"), true },
|
||||
{ 68, wxT("Rectangle() fails"), Sev_Normal, 1, wxT("wxMSW"), false },
|
||||
};
|
||||
|
||||
static const wxChar *headers[Col_Max] =
|
||||
{
|
||||
wxT("Id"),
|
||||
wxT("Summary"),
|
||||
wxT("Severity"),
|
||||
wxT("Priority"),
|
||||
wxT("Platform"),
|
||||
wxT("Opened?"),
|
||||
{ 18, "foo doesn't work", Sev_Major, 1, "wxMSW", true },
|
||||
{ 27, "bar crashes", Sev_Critical, 1, "all", false },
|
||||
{ 45, "printing is slow", Sev_Minor, 3, "wxMSW", true },
|
||||
{ 68, "Rectangle() fails", Sev_Normal, 1, "wxMSW", false },
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1668,16 +1658,16 @@ wxString BugsGridTable::GetTypeName(int WXUNUSED(row), int col)
|
||||
// fall thorugh (TODO should be a list)
|
||||
|
||||
case Col_Summary:
|
||||
return wxString::Format(wxT("%s:80"), wxGRID_VALUE_STRING);
|
||||
return wxString::Format("%s:80", wxGRID_VALUE_STRING);
|
||||
|
||||
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:
|
||||
return wxGRID_VALUE_BOOL;
|
||||
}
|
||||
|
||||
wxFAIL_MSG(wxT("unknown column"));
|
||||
wxFAIL_MSG("unknown column");
|
||||
|
||||
return wxEmptyString;
|
||||
}
|
||||
@ -1704,13 +1694,13 @@ wxString BugsGridTable::GetValue( int row, int col )
|
||||
switch ( col )
|
||||
{
|
||||
case Col_Id:
|
||||
return wxString::Format(wxT("%d"), gd.id);
|
||||
return wxString::Format("%d", gd.id);
|
||||
|
||||
case Col_Priority:
|
||||
return wxString::Format(wxT("%d"), gd.prio);
|
||||
return wxString::Format("%d", gd.prio);
|
||||
|
||||
case Col_Opened:
|
||||
return gd.opened ? wxT("1") : wxT("0");
|
||||
return gd.opened ? "1" : "0";
|
||||
|
||||
case Col_Severity:
|
||||
return severities[gd.severity];
|
||||
@ -1734,7 +1724,7 @@ void BugsGridTable::SetValue( int row, int col, const wxString& value )
|
||||
case Col_Id:
|
||||
case Col_Priority:
|
||||
case Col_Opened:
|
||||
wxFAIL_MSG(wxT("unexpected column"));
|
||||
wxFAIL_MSG("unexpected column");
|
||||
break;
|
||||
|
||||
case Col_Severity:
|
||||
@ -1751,7 +1741,7 @@ void BugsGridTable::SetValue( int row, int col, const wxString& value )
|
||||
|
||||
if ( n == WXSIZEOF(severities) )
|
||||
{
|
||||
wxLogWarning(wxT("Invalid severity value '%s'."),
|
||||
wxLogWarning("Invalid severity value '%s'.",
|
||||
value.c_str());
|
||||
gd.severity = Sev_Normal;
|
||||
}
|
||||
@ -1759,11 +1749,11 @@ void BugsGridTable::SetValue( int row, int col, const wxString& value )
|
||||
break;
|
||||
|
||||
case Col_Summary:
|
||||
wxStrncpy(gd.summary, value, WXSIZEOF(gd.summary));
|
||||
gd.summary = value;
|
||||
break;
|
||||
|
||||
case Col_Platform:
|
||||
wxStrncpy(gd.platform, value, WXSIZEOF(gd.platform));
|
||||
gd.platform = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1812,7 +1802,7 @@ long BugsGridTable::GetValueAsLong( int row, int col )
|
||||
return gd.severity;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG(wxT("unexpected column"));
|
||||
wxFAIL_MSG("unexpected column");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1825,7 +1815,7 @@ bool BugsGridTable::GetValueAsBool( int row, int col )
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFAIL_MSG(wxT("unexpected column"));
|
||||
wxFAIL_MSG("unexpected column");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1842,7 +1832,7 @@ void BugsGridTable::SetValueAsLong( int row, int col, long value )
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG(wxT("unexpected column"));
|
||||
wxFAIL_MSG("unexpected column");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1854,12 +1844,19 @@ void BugsGridTable::SetValueAsBool( int row, int col, bool value )
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFAIL_MSG(wxT("unexpected column"));
|
||||
wxFAIL_MSG("unexpected column");
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
@ -1868,7 +1865,7 @@ wxString BugsGridTable::GetColLabelValue( int col )
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
BugsGridFrame::BugsGridFrame()
|
||||
: wxFrame(NULL, wxID_ANY, wxT("Bugs table"))
|
||||
: wxFrame(NULL, wxID_ANY, "Bugs table")
|
||||
{
|
||||
wxGrid *grid = new wxGrid(this, wxID_ANY);
|
||||
wxGridTableBase *table = new BugsGridTable();
|
||||
|
@ -256,7 +256,7 @@ public:
|
||||
int GetNumberCols() wxOVERRIDE { return m_sizeGrid; }
|
||||
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 */ }
|
||||
|
@ -311,7 +311,7 @@ bool MyApp::OnInit()
|
||||
#endif // wxUSE_HTML
|
||||
|
||||
// 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));
|
||||
|
||||
#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
|
||||
// Windows and that the HTML docs are in the subdirectory doc for platforms
|
||||
// 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;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
#if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
|
||||
// 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
|
||||
|
||||
#if USE_HTML_HELP
|
||||
// initialise the advanced HTML help system: this means that the HTML docs are in .htb
|
||||
// (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;
|
||||
}
|
||||
@ -363,7 +363,7 @@ bool MyApp::OnInit()
|
||||
#if 0
|
||||
// defined(__WXMSW__) && wxUSE_MS_HTML_HELP
|
||||
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.");
|
||||
|
||||
@ -399,51 +399,51 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
|
||||
menuFile->Append(HelpDemo_Help_Index, wxT("&Help Index..."));
|
||||
menuFile->Append(HelpDemo_Help_Classes, wxT("&Help on Classes..."));
|
||||
menuFile->Append(HelpDemo_Help_Functions, wxT("&Help on Functions..."));
|
||||
menuFile->Append(HelpDemo_Help_ContextHelp, wxT("&Context Help..."));
|
||||
menuFile->Append(HelpDemo_Help_DialogContextHelp, wxT("&Dialog Context Help...\tCtrl-H"));
|
||||
menuFile->Append(HelpDemo_Help_Help, wxT("&About Help Demo..."));
|
||||
menuFile->Append(HelpDemo_Help_Search, wxT("&Search help..."));
|
||||
menuFile->Append(HelpDemo_Help_Index, "&Help Index...");
|
||||
menuFile->Append(HelpDemo_Help_Classes, "&Help on Classes...");
|
||||
menuFile->Append(HelpDemo_Help_Functions, "&Help on Functions...");
|
||||
menuFile->Append(HelpDemo_Help_ContextHelp, "&Context Help...");
|
||||
menuFile->Append(HelpDemo_Help_DialogContextHelp, "&Dialog Context Help...\tCtrl-H");
|
||||
menuFile->Append(HelpDemo_Help_Help, "&About Help Demo...");
|
||||
menuFile->Append(HelpDemo_Help_Search, "&Search help...");
|
||||
#if USE_HTML_HELP
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Index, wxT("Advanced HTML &Help Index..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Classes, wxT("Advanced HTML &Help on Classes..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Functions, wxT("Advanced HTML &Help on Functions..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Help, wxT("Advanced HTML &About Help Demo..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Search, wxT("Advanced HTML &Search help..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Modal, wxT("Advanced HTML Help &Modal Dialog..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Index, "Advanced HTML &Help Index...");
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Classes, "Advanced HTML &Help on Classes...");
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Functions, "Advanced HTML &Help on Functions...");
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Help, "Advanced HTML &About Help Demo...");
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Search, "Advanced HTML &Search help...");
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Modal, "Advanced HTML Help &Modal Dialog...");
|
||||
#endif
|
||||
|
||||
#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Index, wxT("MS HTML &Help Index..."));
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Classes, wxT("MS HTML &Help on Classes..."));
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Functions, wxT("MS HTML &Help on Functions..."));
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Help, wxT("MS HTML &About Help Demo..."));
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Search, wxT("MS HTML &Search help..."));
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Index, "MS HTML &Help Index...");
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Classes, "MS HTML &Help on Classes...");
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Functions, "MS HTML &Help on Functions...");
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Help, "MS HTML &About Help Demo...");
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Search, "MS HTML &Search help...");
|
||||
#endif
|
||||
|
||||
#if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(HelpDemo_Best_Help_Index, wxT("Best &Help Index..."));
|
||||
menuFile->Append(HelpDemo_Best_Help_Index, "Best &Help Index...");
|
||||
#endif
|
||||
|
||||
#ifndef __WXMSW__
|
||||
#if !wxUSE_HTML
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(HelpDemo_Help_KDE, wxT("Use &KDE"));
|
||||
menuFile->Append(HelpDemo_Help_GNOME, wxT("Use &GNOME"));
|
||||
menuFile->Append(HelpDemo_Help_Netscape, wxT("Use &Netscape"));
|
||||
menuFile->Append(HelpDemo_Help_KDE, "Use &KDE");
|
||||
menuFile->Append(HelpDemo_Help_GNOME, "Use &GNOME");
|
||||
menuFile->Append(HelpDemo_Help_Netscape, "Use &Netscape");
|
||||
#endif
|
||||
#endif
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -451,7 +451,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar();
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
#if USE_HTML_HELP
|
||||
@ -463,8 +463,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
m_embeddedHelpWindow->Create(this,
|
||||
wxID_ANY, wxDefaultPosition, GetClientSize(), wxTAB_TRAVERSAL|wxNO_BORDER, wxHF_DEFAULT_STYLE);
|
||||
|
||||
m_embeddedHtmlHelp.AddBook(wxFileName(wxT("doc.zip")));
|
||||
m_embeddedHtmlHelp.Display(wxT("Introduction"));
|
||||
m_embeddedHtmlHelp.AddBook(wxFileName("doc.zip"));
|
||||
m_embeddedHtmlHelp.Display("Introduction");
|
||||
#else
|
||||
// now create some controls
|
||||
|
||||
@ -475,7 +475,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
//panel->SetHelpText(wxContextId(300));
|
||||
|
||||
// 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."));
|
||||
#endif
|
||||
}
|
||||
@ -531,7 +531,7 @@ void MyFrame::OnBestHelp(wxCommandEvent& event)
|
||||
#if USE_HTML_HELP
|
||||
void MyFrame::OnModalHtmlHelp(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxHtmlModalHelp(this, wxT("doc.zip"), wxT("Introduction"));
|
||||
wxHtmlModalHelp(this, "doc.zip", "Introduction");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -638,8 +638,8 @@ void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController)
|
||||
case HelpDemo_MS_Html_Help_Search:
|
||||
case HelpDemo_Best_Help_Search:
|
||||
{
|
||||
wxString key = wxGetTextFromUser(wxT("Search for?"),
|
||||
wxT("Search help for keyword"),
|
||||
wxString key = wxGetTextFromUser("Search for?",
|
||||
"Search help for keyword",
|
||||
wxEmptyString,
|
||||
this);
|
||||
if(! key.IsEmpty())
|
||||
@ -658,13 +658,13 @@ void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController)
|
||||
// These three calls are only used by wxExtHelpController
|
||||
|
||||
case HelpDemo_Help_KDE:
|
||||
helpController.SetViewer(wxT("kdehelp"));
|
||||
helpController.SetViewer("kdehelp");
|
||||
break;
|
||||
case HelpDemo_Help_GNOME:
|
||||
helpController.SetViewer(wxT("gnome-help-browser"));
|
||||
helpController.SetViewer("gnome-help-browser");
|
||||
break;
|
||||
case HelpDemo_Help_Netscape:
|
||||
helpController.SetViewer(wxT("netscape"), wxHELP_NETSCAPE);
|
||||
helpController.SetViewer("netscape", wxHELP_NETSCAPE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -678,7 +678,7 @@ wxBEGIN_EVENT_TABLE(MyModalDialog, wxDialog)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
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
|
||||
// which support it (currently MSW only)
|
||||
@ -688,10 +688,10 @@ MyModalDialog::MyModalDialog(wxWindow *parent)
|
||||
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||
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."));
|
||||
|
||||
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."));
|
||||
|
||||
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);
|
||||
#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),
|
||||
wxTE_MULTILINE);
|
||||
text->SetHelpText(_("Type text here if you have got nothing more interesting to do"));
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
void OnLboxSelect(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);
|
||||
@ -236,7 +236,7 @@ wxIMPLEMENT_APP(MyApp);
|
||||
|
||||
// frame constructor
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame(NULL, wxID_ANY, wxT("HtmlLbox wxWidgets Sample"),
|
||||
: wxFrame(NULL, wxID_ANY, "HtmlLbox wxWidgets Sample",
|
||||
wxDefaultPosition, wxSize(500, 500))
|
||||
{
|
||||
// set the frame icon
|
||||
@ -245,48 +245,48 @@ MyFrame::MyFrame()
|
||||
#if wxUSE_MENUS
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
menuFile->AppendRadioItem(HtmlLbox_CustomBox, wxT("Use custom box"),
|
||||
wxT("Use a wxHtmlListBox virtual class control"));
|
||||
menuFile->AppendRadioItem(HtmlLbox_SimpleBox, wxT("Use simple box"),
|
||||
wxT("Use a wxSimpleHtmlListBox control"));
|
||||
menuFile->AppendRadioItem(HtmlLbox_CustomBox, "Use custom box",
|
||||
"Use a wxHtmlListBox virtual class control");
|
||||
menuFile->AppendRadioItem(HtmlLbox_SimpleBox, "Use simple box",
|
||||
"Use a wxSimpleHtmlListBox control");
|
||||
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
|
||||
wxMenu *menuHLbox = new wxMenu;
|
||||
menuHLbox->Append(HtmlLbox_SetMargins,
|
||||
wxT("Set &margins...\tCtrl-G"),
|
||||
wxT("Change the margins around the items"));
|
||||
"Set &margins...\tCtrl-G",
|
||||
"Change the margins around the items");
|
||||
menuHLbox->AppendCheckItem(HtmlLbox_DrawSeparator,
|
||||
wxT("&Draw separators\tCtrl-D"),
|
||||
wxT("Toggle drawing separators between cells"));
|
||||
"&Draw separators\tCtrl-D",
|
||||
"Toggle drawing separators between cells");
|
||||
menuHLbox->AppendSeparator();
|
||||
menuHLbox->AppendCheckItem(HtmlLbox_ToggleMulti,
|
||||
wxT("&Multiple selection\tCtrl-M"),
|
||||
wxT("Toggle multiple selection on/off"));
|
||||
"&Multiple selection\tCtrl-M",
|
||||
"Toggle multiple selection on/off");
|
||||
menuHLbox->AppendSeparator();
|
||||
menuHLbox->Append(HtmlLbox_SelectAll, wxT("Select &all items\tCtrl-A"));
|
||||
menuHLbox->Append(HtmlLbox_UpdateItem, wxT("Update &first item\tCtrl-U"));
|
||||
menuHLbox->Append(HtmlLbox_GetItemRect, wxT("Show &rectangle of item #10\tCtrl-R"));
|
||||
menuHLbox->Append(HtmlLbox_SelectAll, "Select &all items\tCtrl-A");
|
||||
menuHLbox->Append(HtmlLbox_UpdateItem, "Update &first item\tCtrl-U");
|
||||
menuHLbox->Append(HtmlLbox_GetItemRect, "Show &rectangle of item #10\tCtrl-R");
|
||||
menuHLbox->AppendSeparator();
|
||||
menuHLbox->Append(HtmlLbox_SetBgCol, wxT("Set &background...\tCtrl-B"));
|
||||
menuHLbox->Append(HtmlLbox_SetBgCol, "Set &background...\tCtrl-B");
|
||||
menuHLbox->Append(HtmlLbox_SetSelBgCol,
|
||||
wxT("Set &selection background...\tCtrl-S"));
|
||||
"Set &selection background...\tCtrl-S");
|
||||
menuHLbox->AppendCheckItem(HtmlLbox_SetSelFgCol,
|
||||
wxT("Keep &foreground in selection\tCtrl-F"));
|
||||
"Keep &foreground in selection\tCtrl-F");
|
||||
|
||||
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
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuHLbox, wxT("&Listbox"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(menuHLbox, "&Listbox");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
menuBar->Check(HtmlLbox_DrawSeparator, true);
|
||||
|
||||
@ -297,12 +297,12 @@ MyFrame::MyFrame()
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
// create the child controls
|
||||
CreateBox();
|
||||
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxT(""),
|
||||
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, "",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE);
|
||||
delete wxLog::SetActiveTarget(new wxLogTextCtrl(text));
|
||||
@ -344,9 +344,9 @@ void MyFrame::CreateBox()
|
||||
(unsigned char)(abs((int)n - 128) % 256));
|
||||
int level = n % 6 + 1;
|
||||
|
||||
wxString label = wxString::Format(wxT("<h%d><font color=%s>")
|
||||
wxT("Item</font> <b>%lu</b>")
|
||||
wxT("</h%d>"),
|
||||
wxString label = wxString::Format("<h%d><font color=%s>"
|
||||
"Item</font> <b>%lu</b>"
|
||||
"</h%d>",
|
||||
level,
|
||||
clr.GetAsString(wxC2S_HTML_SYNTAX).c_str(),
|
||||
(unsigned long)n, level);
|
||||
@ -383,10 +383,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("This sample shows wxHtmlListBox class.\n")
|
||||
wxT("\n")
|
||||
wxT("(c) 2003 Vadim Zeitlin"),
|
||||
wxT("About HtmlLbox"),
|
||||
wxMessageBox("This sample shows wxHtmlListBox class.\n"
|
||||
"\n"
|
||||
"(c) 2003 Vadim Zeitlin",
|
||||
"About HtmlLbox",
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
}
|
||||
@ -395,9 +395,9 @@ void MyFrame::OnSetMargins(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
long margin = wxGetNumberFromUser
|
||||
(
|
||||
wxT("Enter the margins to use for the listbox items."),
|
||||
wxT("Margin: "),
|
||||
wxT("HtmlLbox: Set the margins"),
|
||||
"Enter the margins to use for the listbox items.",
|
||||
"Margin: ",
|
||||
"HtmlLbox: Set the margins",
|
||||
0, 0, 20,
|
||||
this
|
||||
);
|
||||
@ -454,7 +454,7 @@ void MyFrame::OnSetBgCol(wxCommandEvent& WXUNUSED(event))
|
||||
m_hlbox->Refresh();
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Background colour changed."));
|
||||
SetStatusText("Background colour changed.");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
}
|
||||
@ -468,7 +468,7 @@ void MyFrame::OnSetSelBgCol(wxCommandEvent& WXUNUSED(event))
|
||||
m_hlbox->Refresh();
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Selection background colour changed."));
|
||||
SetStatusText("Selection background colour changed.");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
}
|
||||
@ -489,7 +489,7 @@ void MyFrame::OnClear(wxCommandEvent& WXUNUSED(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())
|
||||
{
|
||||
@ -500,13 +500,13 @@ void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// 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)
|
||||
{
|
||||
wxLogMessage(wxT("Listbox selection is now %d."), event.GetInt());
|
||||
wxLogMessage("Listbox selection is now %d.", event.GetInt());
|
||||
|
||||
if ( m_hlbox->HasMultipleSelection() )
|
||||
{
|
||||
@ -534,20 +534,20 @@ void MyFrame::OnLboxSelect(wxCommandEvent& event)
|
||||
if ( first )
|
||||
first = false;
|
||||
else
|
||||
s << wxT(", ");
|
||||
s << ", ";
|
||||
|
||||
s << item;
|
||||
}
|
||||
|
||||
if ( !s.empty() )
|
||||
{
|
||||
wxLogMessage(wxT("Selected items: %s"), s.c_str());
|
||||
wxLogMessage("Selected items: %s", s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxString::Format(
|
||||
wxT("# items selected = %lu"),
|
||||
"# items selected = %lu",
|
||||
(unsigned long)m_hlbox->GetSelectedCount()
|
||||
));
|
||||
#endif // wxUSE_STATUSBAR
|
||||
@ -571,9 +571,9 @@ MyHtmlListBox::MyHtmlListBox(wxWindow *parent, bool multi)
|
||||
SetMargins(5, 5);
|
||||
|
||||
#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
|
||||
{
|
||||
@ -601,7 +601,7 @@ wxString MyHtmlListBox::OnGetItem(size_t n) const
|
||||
{
|
||||
if ( !n && m_firstItemUpdated )
|
||||
{
|
||||
return wxT("<h1><b>Just updated</b></h1>");
|
||||
return "<h1><b>Just updated</b></h1>";
|
||||
}
|
||||
|
||||
#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 - 128) % 256));
|
||||
|
||||
wxString label = wxString::Format(wxT("<h%d><font color=%s>")
|
||||
wxT("Item</font> <b>%lu</b>")
|
||||
wxT("</h%d>"),
|
||||
wxString label = wxString::Format("<h%d><font color=%s>"
|
||||
"Item</font> <b>%lu</b>"
|
||||
"</h%d>",
|
||||
level,
|
||||
clr.GetAsString(wxC2S_HTML_SYNTAX).c_str(),
|
||||
(unsigned long)n, level);
|
||||
if ( n == 1 )
|
||||
{
|
||||
if ( !m_linkClicked )
|
||||
label += wxT("<a href='1'>Click here...</a>");
|
||||
label += "<a href='1'>Click here...</a>";
|
||||
else
|
||||
label += wxT("<font color='#9999ff'>Clicked here...</font>");
|
||||
label += "<font color='#9999ff'>Clicked here...</font>";
|
||||
}
|
||||
|
||||
return label;
|
||||
|
@ -154,7 +154,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
|
||||
html -> SetBorders(0);
|
||||
html -> LoadPage(wxT("data/about.htm"));
|
||||
html -> LoadPage("data/about.htm");
|
||||
html -> SetInitialSize(wxSize(html -> GetInternalRepresentation() -> GetWidth(),
|
||||
html -> GetInternalRepresentation() -> GetHeight()));
|
||||
|
||||
|
@ -119,8 +119,8 @@ bool MyApp::OnInit()
|
||||
#if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
|
||||
wxFileSystem::AddHandler(new wxZipFSHandler);
|
||||
#endif
|
||||
SetVendorName(wxT("wxWidgets"));
|
||||
SetAppName(wxT("wxHTMLHelp"));
|
||||
SetVendorName("wxWidgets");
|
||||
SetAppName("wxHTMLHelp");
|
||||
|
||||
// Create the main application window
|
||||
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());
|
||||
bool ret;
|
||||
help.SetTempDir(wxT("."));
|
||||
help.SetTempDir(".");
|
||||
|
||||
wxPathList pathlist;
|
||||
pathlist.Add(wxT("./helpfiles"));
|
||||
pathlist.Add(wxT("../helpfiles"));
|
||||
pathlist.Add(wxT("../../html/help/helpfiles"));
|
||||
pathlist.Add("./helpfiles");
|
||||
pathlist.Add("../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)
|
||||
wxMessageBox(wxT("Failed adding book helpfiles/testing.hhp"));
|
||||
ret = help.AddBook(wxFileName(pathlist.FindValidPath(wxT("another.hhp")), wxPATH_UNIX));
|
||||
wxMessageBox("Failed adding book helpfiles/testing.hhp");
|
||||
ret = help.AddBook(wxFileName(pathlist.FindValidPath("another.hhp"), wxPATH_UNIX));
|
||||
if (! ret)
|
||||
wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
|
||||
}
|
||||
@ -188,7 +188,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
help.Display(wxT("Test HELPFILE"));
|
||||
help.Display("Test HELPFILE");
|
||||
}
|
||||
|
||||
void MyFrame::OnClose(wxCloseEvent& event)
|
||||
|
@ -66,15 +66,15 @@ bool MyApp::OnInit()
|
||||
wxInitAllImageHandlers();
|
||||
wxFileSystem::AddHandler(new wxZipFSHandler);
|
||||
|
||||
SetVendorName(wxT("wxWidgets"));
|
||||
SetAppName(wxT("wxHTMLHelp"));
|
||||
SetVendorName("wxWidgets");
|
||||
SetAppName("wxHTMLHelp");
|
||||
wxConfig::Get(); // create an instance
|
||||
|
||||
help = new wxHtmlHelpController;
|
||||
|
||||
if (argc < 2) {
|
||||
wxLogError(wxT("Usage : helpview <helpfile> [<more helpfiles>]"));
|
||||
wxLogError(wxT(" helpfile may be .hhp, .zip or .htb"));
|
||||
wxLogError("Usage : helpview <helpfile> [<more helpfiles>]");
|
||||
wxLogError(" helpfile may be .hhp, .zip or .htb");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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
|
||||
// created initially)
|
||||
@ -183,7 +183,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
wxButton* btnReload = new wxButton(myToolbar, ID_RELOAD, _("Reload"));
|
||||
myToolbar->AddControl(btnReload);
|
||||
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->AddSeparator();
|
||||
myToolbar->Realize();
|
||||
@ -195,7 +195,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
|
||||
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);
|
||||
|
||||
@ -203,7 +203,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
SetSizer(frameSizer);
|
||||
frameSizer->Add(panel, 1, wxEXPAND);
|
||||
#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
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
@ -274,7 +274,7 @@ void MyFrame::OnSetSource(wxCommandEvent& WXUNUSED(myEvent))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -205,15 +205,15 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#if wxUSE_STATUSBAR
|
||||
m_Html -> SetRelatedStatusBar(0);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
m_Name = wxT("test.htm");
|
||||
m_Name = "test.htm";
|
||||
m_Html -> LoadPage(m_Name);
|
||||
|
||||
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,
|
||||
// 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
|
||||
@ -258,13 +258,13 @@ void MyFrame::OnPreview(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)
|
||||
{
|
||||
m_Name = dialog.GetPath();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,10 +113,10 @@ public:
|
||||
virtual wxString Process(const wxString& s) const wxOVERRIDE
|
||||
{
|
||||
wxString r(s);
|
||||
r.Replace(wxT("<b>"), wxEmptyString);
|
||||
r.Replace(wxT("<B>"), wxEmptyString);
|
||||
r.Replace(wxT("</b>"), wxEmptyString);
|
||||
r.Replace(wxT("</B>"), wxEmptyString);
|
||||
r.Replace("<b>", wxEmptyString);
|
||||
r.Replace("<B>", wxEmptyString);
|
||||
r.Replace("</b>", wxEmptyString);
|
||||
r.Replace("</B>", wxEmptyString);
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -175,7 +175,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
#if wxUSE_SYSTEM_OPTIONS
|
||||
wxSystemOptions::SetOption(wxT("no-maskblt"), 1);
|
||||
wxSystemOptions::SetOption("no-maskblt", 1);
|
||||
#endif
|
||||
|
||||
wxInitAllImageHandlers();
|
||||
@ -183,8 +183,8 @@ bool MyApp::OnInit()
|
||||
wxFileSystem::AddHandler(new wxInternetFSHandler);
|
||||
#endif
|
||||
|
||||
SetVendorName(wxT("wxWidgets"));
|
||||
SetAppName(wxT("wxHtmlTest"));
|
||||
SetVendorName("wxWidgets");
|
||||
SetAppName("wxHtmlTest");
|
||||
// the following call to wxConfig::Get will use it to create an object...
|
||||
|
||||
// Create the main application window
|
||||
@ -203,7 +203,7 @@ bool MyApp::OnInit()
|
||||
// frame constructor
|
||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& 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
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
@ -254,10 +254,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
m_Html->SetRelatedStatusBar(1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
m_Html->ReadCustomization(wxConfig::Get());
|
||||
m_Html->LoadFile(wxFileName(wxT("test.htm")));
|
||||
m_Html->LoadFile(wxFileName("test.htm"));
|
||||
m_Html->AddProcessor(m_Processor);
|
||||
|
||||
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxT(""),
|
||||
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, "",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE);
|
||||
|
||||
@ -285,7 +285,7 @@ void MyFrame::OnPageOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#if wxUSE_FILEDLG
|
||||
wxString p = wxFileSelector(_("Open HTML document"), wxEmptyString,
|
||||
wxEmptyString, wxEmptyString, wxT("HTML files|*.htm;*.html"));
|
||||
wxEmptyString, wxEmptyString, "HTML files|*.htm;*.html");
|
||||
|
||||
if (!p.empty())
|
||||
{
|
||||
@ -314,7 +314,7 @@ void MyFrame::OnDefaultWebBrowser(wxCommandEvent& WXUNUSED(event))
|
||||
wxString page = m_Html->GetOpenedPage();
|
||||
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)
|
||||
{
|
||||
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)
|
||||
// will happen...
|
||||
@ -356,13 +356,13 @@ void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// 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,
|
||||
wxString *WXUNUSED(redirect)) const
|
||||
{
|
||||
GetRelatedFrame()->SetStatusText(url + wxT(" lately opened"),1);
|
||||
GetRelatedFrame()->SetStatusText(url + " lately opened",1);
|
||||
return wxHTML_OPEN;
|
||||
}
|
||||
|
||||
@ -397,17 +397,17 @@ void MyHtmlWindow::OnClipboardEvent(wxClipboardTextEvent& WXUNUSED(event))
|
||||
const wxString text = data.GetText();
|
||||
const size_t maxTextLength = 100;
|
||||
|
||||
wxLogStatus(wxString::Format(wxT("Clipboard: '%s%s'"),
|
||||
wxLogStatus(wxString::Format("Clipboard: '%s%s'",
|
||||
wxString(text, maxTextLength).c_str(),
|
||||
(text.length() > maxTextLength) ? wxT("...")
|
||||
: wxT("")));
|
||||
(text.length() > maxTextLength) ? "..."
|
||||
: ""));
|
||||
wxTheClipboard->Close();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
wxLogStatus(wxT("Clipboard: nothing"));
|
||||
wxLogStatus("Clipboard: nothing");
|
||||
}
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
bool MyVFS::CanOpen(const wxString& location)
|
||||
{
|
||||
return (GetProtocol(location) == wxT("myVFS"));
|
||||
return (GetProtocol(location) == "myVFS");
|
||||
}
|
||||
|
||||
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
|
||||
// time.
|
||||
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;
|
||||
}
|
||||
@ -216,7 +216,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#if wxUSE_STATUSBAR
|
||||
html -> SetRelatedStatusBar(1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
html -> LoadPage(wxT("start.htm"));
|
||||
html -> LoadPage("start.htm");
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,16 +40,16 @@ TAG_HANDLER_PROC(tag)
|
||||
int ax, ay;
|
||||
int fl = 0;
|
||||
|
||||
tag.ScanParam(wxT("X"), wxT("%i"), &ax);
|
||||
tag.ScanParam(wxT("Y"), wxT("%i"), &ay);
|
||||
tag.ScanParam("X", "%i", &ax);
|
||||
tag.ScanParam("Y", "%i", &ay);
|
||||
|
||||
if (tag.HasParam(wxT("FLOAT"))) fl = ax;
|
||||
if (tag.HasParam("FLOAT")) fl = ax;
|
||||
|
||||
wnd = new wxTextCtrl
|
||||
(
|
||||
m_WParser->GetWindowInterface()->GetHTMLWindow(),
|
||||
wxID_ANY,
|
||||
tag.GetParam(wxT("NAME")),
|
||||
tag.GetParam("NAME"),
|
||||
wxPoint(0,0),
|
||||
wxSize(ax, ay),
|
||||
wxTE_MULTILINE
|
||||
@ -209,7 +209,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#if wxUSE_STATUSBAR
|
||||
html -> SetRelatedStatusBar(1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
html -> LoadPage(wxT("start.htm"));
|
||||
html -> LoadPage("start.htm");
|
||||
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#if wxUSE_STATUSBAR
|
||||
html -> SetRelatedStatusBar(0);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
html -> LoadPage(wxT("start.htm"));
|
||||
html -> LoadPage("start.htm");
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,40 +71,40 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
// try to find the directory with our images
|
||||
wxString dir;
|
||||
if ( wxFile::Exists(wxT("./horse.png")) )
|
||||
dir = wxT("./");
|
||||
else if ( wxFile::Exists(wxT("../horse.png")) )
|
||||
dir = wxT("../");
|
||||
if ( wxFile::Exists("./horse.png") )
|
||||
dir = "./";
|
||||
else if ( wxFile::Exists("../horse.png") )
|
||||
dir = "../";
|
||||
else
|
||||
wxLogWarning(wxT("Can't find image files in either '.' or '..'!"));
|
||||
wxLogWarning("Can't find image files in either '.' or '..'!");
|
||||
|
||||
wxImage image = bitmap.ConvertToImage();
|
||||
|
||||
#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();
|
||||
|
||||
if ( image.LoadFile( dir + wxT("test.png") ) )
|
||||
if ( image.LoadFile( dir + "test.png" ) )
|
||||
my_square = wxBitmap( image );
|
||||
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -125,9 +125,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_LIBJPEG
|
||||
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
|
||||
{
|
||||
@ -140,9 +140,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
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
|
||||
{
|
||||
@ -155,7 +155,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
if ( !image.LoadFile( dir + wxT("horse.gif" )) )
|
||||
{
|
||||
wxLogError(wxT("Can't load GIF image"));
|
||||
wxLogError("Can't load GIF image");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -166,9 +166,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_PCX
|
||||
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
|
||||
{
|
||||
@ -178,9 +178,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
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
|
||||
{
|
||||
@ -190,27 +190,27 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_XPM
|
||||
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
|
||||
{
|
||||
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
|
||||
|
||||
#if wxUSE_PNM
|
||||
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
|
||||
{
|
||||
@ -219,9 +219,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
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
|
||||
{
|
||||
@ -230,9 +230,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
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
|
||||
{
|
||||
@ -243,9 +243,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_LIBTIFF
|
||||
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
|
||||
{
|
||||
@ -256,9 +256,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
#if wxUSE_TGA
|
||||
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
|
||||
{
|
||||
@ -273,14 +273,14 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
// demonstrates XPM automatically using the mask when saving
|
||||
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
|
||||
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
|
||||
{
|
||||
@ -289,9 +289,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
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
|
||||
{
|
||||
@ -300,9 +300,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
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
|
||||
{
|
||||
@ -311,9 +311,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
|
||||
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
|
||||
{
|
||||
@ -322,10 +322,10 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
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)
|
||||
{
|
||||
wxLogError(wxT("No ANI-format images found"));
|
||||
wxLogError("No ANI-format images found");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -336,9 +336,9 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
for (i=0; i < m_ani_images; i++)
|
||||
{
|
||||
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 ;
|
||||
wxLogError(tmp);
|
||||
}
|
||||
@ -351,7 +351,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
image.Destroy();
|
||||
|
||||
// test image loading from stream
|
||||
wxFile file(dir + wxT("horse.bmp"));
|
||||
wxFile file(dir + "horse.bmp");
|
||||
if ( file.IsOpened() )
|
||||
{
|
||||
wxFileOffset len = file.Length();
|
||||
@ -359,14 +359,14 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
||||
void *data = malloc(dataSize);
|
||||
if ( file.Read(data, dataSize) != len )
|
||||
{
|
||||
wxLogError(wxT("Reading bitmap file failed"));
|
||||
wxLogError("Reading bitmap file failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMemoryInputStream mis(data, dataSize);
|
||||
if ( !image.LoadFile(mis) )
|
||||
{
|
||||
wxLogError(wxT("Can't load BMP image from stream"));
|
||||
wxLogError("Can't load BMP image from stream");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -401,11 +401,11 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
wxPaintDC dc( this );
|
||||
PrepareDC( dc );
|
||||
|
||||
dc.DrawText( wxT("Loaded image"), 30, 10 );
|
||||
dc.DrawText( "Loaded image", 30, 10 );
|
||||
if (my_square.IsOk())
|
||||
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.SetPen( *wxBLACK_PEN );
|
||||
dc.DrawRectangle( 150, 30, 100, 100 );
|
||||
@ -415,65 +415,65 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
if (my_anti.IsOk())
|
||||
dc.DrawBitmap( my_anti, 280, 30 );
|
||||
|
||||
dc.DrawText( wxT("PNG handler"), 30, 135 );
|
||||
dc.DrawText( "PNG handler", 30, 135 );
|
||||
if (my_horse_png.IsOk())
|
||||
{
|
||||
dc.DrawBitmap( my_horse_png, 30, 150 );
|
||||
wxRect rect(0,0,100,100);
|
||||
wxBitmap sub( my_horse_png.GetSubBitmap(rect) );
|
||||
dc.DrawText( wxT("GetSubBitmap()"), 280, 175 );
|
||||
dc.DrawText( "GetSubBitmap()", 280, 175 );
|
||||
dc.DrawBitmap( sub, 280, 195 );
|
||||
}
|
||||
|
||||
dc.DrawText( wxT("JPEG handler"), 30, 365 );
|
||||
dc.DrawText( "JPEG handler", 30, 365 );
|
||||
if (my_horse_jpeg.IsOk())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
dc.DrawBitmap( my_horse_xpm, 30, 2000 );
|
||||
|
||||
@ -481,36 +481,36 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
y += yy;
|
||||
dc.DrawText(wxT("Blured"), x+50, y);
|
||||
dc.DrawText("Blured", x+50, y);
|
||||
dc.DrawBitmap(my_toucan_blur, x, y+15, true);
|
||||
}
|
||||
|
||||
@ -518,16 +518,16 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
int x = 300, y = 1800;
|
||||
|
||||
dc.DrawText( wxT("XBM bitmap"), x, y );
|
||||
dc.DrawText( wxT("(green on red)"), x, y + 15 );
|
||||
dc.SetTextForeground( wxT("GREEN") );
|
||||
dc.SetTextBackground( wxT("RED") );
|
||||
dc.DrawText( "XBM bitmap", x, y );
|
||||
dc.DrawText( "(green on red)", x, y + 15 );
|
||||
dc.SetTextForeground( "GREEN" );
|
||||
dc.SetTextBackground( "RED" );
|
||||
dc.DrawBitmap( my_smile_xbm, x, y + 30 );
|
||||
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
dc.DrawText( wxT("After wxImage conversion"), x + 120, y );
|
||||
dc.DrawText( wxT("(red on white)"), x + 120, y + 15 );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.DrawText( "After wxImage conversion", x + 120, y );
|
||||
dc.DrawText( "(red on white)", x + 120, y + 15 );
|
||||
dc.SetTextForeground( "RED" );
|
||||
wxImage i = my_smile_xbm.ConvertToImage();
|
||||
i.SetMaskColour( 255, 255, 255 );
|
||||
i.Replace( 0, 0, 0,
|
||||
@ -548,7 +548,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
memdc.SetTextForeground( *wxBLACK );
|
||||
#ifndef __WXGTK20__
|
||||
// I cannot convince GTK2 to draw into mono bitmaps
|
||||
memdc.DrawText( wxT("Hi!"), 5, 5 );
|
||||
memdc.DrawText( "Hi!", 5, 5 );
|
||||
#endif
|
||||
memdc.SetBrush( *wxBLACK_BRUSH );
|
||||
memdc.DrawRectangle( 33,5,20,20 );
|
||||
@ -560,16 +560,16 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
{
|
||||
int x = 300, y = 1900;
|
||||
|
||||
dc.DrawText( wxT("Mono bitmap"), x, y );
|
||||
dc.DrawText( wxT("(red on green)"), x, y + 15 );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.SetTextBackground( wxT("GREEN") );
|
||||
dc.DrawText( "Mono bitmap", x, y );
|
||||
dc.DrawText( "(red on green)", x, y + 15 );
|
||||
dc.SetTextForeground( "RED" );
|
||||
dc.SetTextBackground( "GREEN" );
|
||||
dc.DrawBitmap( mono, x, y + 30 );
|
||||
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
dc.DrawText( wxT("After wxImage conversion"), x + 120, y );
|
||||
dc.DrawText( wxT("(red on white)"), x + 120, y + 15 );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.DrawText( "After wxImage conversion", x + 120, y );
|
||||
dc.DrawText( "(red on white)", x + 120, y + 15 );
|
||||
dc.SetTextForeground( "RED" );
|
||||
wxImage i = mono.ConvertToImage();
|
||||
i.SetMaskColour( 255,255,255 );
|
||||
i.Replace( 0,0,0,
|
||||
@ -584,11 +584,11 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
dc.SetBrush( *wxRED_BRUSH );
|
||||
dc.DrawRectangle( 20, 2220, 560, 68 );
|
||||
|
||||
dc.DrawText(wxT("XPM bitmap"), 30, 2230 );
|
||||
dc.DrawText("XPM bitmap", 30, 2230 );
|
||||
if ( m_bmpSmileXpm.IsOk() )
|
||||
dc.DrawBitmap(m_bmpSmileXpm, 30, 2250, true);
|
||||
|
||||
dc.DrawText(wxT("XPM icon"), 110, 2230 );
|
||||
dc.DrawText("XPM icon", 110, 2230 );
|
||||
if ( m_iconSmileXpm.IsOk() )
|
||||
dc.DrawIcon(m_iconSmileXpm, 110, 2250);
|
||||
|
||||
@ -596,19 +596,19 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
wxBitmap to_blit( m_iconSmileXpm );
|
||||
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) );
|
||||
if (sub.IsOk())
|
||||
dc.DrawBitmap( sub, 170, 2250, true );
|
||||
|
||||
dc.DrawText( wxT("Enlarged"), 250, 2230 );
|
||||
dc.DrawText( "Enlarged", 250, 2230 );
|
||||
dc.SetUserScale( 1.5, 1.5 );
|
||||
dc.DrawBitmap( to_blit, (int)(250/1.5), (int)(2250/1.5), true );
|
||||
dc.SetUserScale( 2, 2 );
|
||||
dc.DrawBitmap( to_blit, (int)(300/2), (int)(2250/2), true );
|
||||
dc.SetUserScale( 1.0, 1.0 );
|
||||
|
||||
dc.DrawText( wxT("Blit"), 400, 2230);
|
||||
dc.DrawText( "Blit", 400, 2230);
|
||||
wxMemoryDC blit_dc;
|
||||
blit_dc.SelectObject( to_blit );
|
||||
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.DrawText( wxT("ICO handler (1st image)"), 30, 2290 );
|
||||
dc.DrawText( "ICO handler (1st image)", 30, 2290 );
|
||||
if (my_horse_ico32.IsOk())
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
{
|
||||
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.DrawText( wxT("ANI handler"), 230, 2390 );
|
||||
dc.DrawText( "ANI handler", 230, 2390 );
|
||||
for ( int i=0; i < m_ani_images; i++ )
|
||||
{
|
||||
if (my_horse_ani[i].IsOk())
|
||||
@ -667,9 +667,9 @@ void MyCanvas::CreateAntiAliasedBitmap()
|
||||
dc.Clear();
|
||||
|
||||
dc.SetFont( wxFontInfo(24).Family(wxFONTFAMILY_DECORATIVE) );
|
||||
dc.SetTextForeground( wxT("RED") );
|
||||
dc.DrawText( wxT("This is anti-aliased Text."), 20, 5 );
|
||||
dc.DrawText( wxT("And a Rectangle."), 20, 45 );
|
||||
dc.SetTextForeground( "RED" );
|
||||
dc.DrawText( "This is anti-aliased Text.", 20, 5 );
|
||||
dc.DrawText( "And a Rectangle.", 20, 45 );
|
||||
|
||||
dc.SetBrush( *wxRED_BRUSH );
|
||||
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||
|
@ -143,7 +143,7 @@ private:
|
||||
int numImages = 1)
|
||||
{
|
||||
if ( !wxFrame::Create(parent, wxID_ANY,
|
||||
wxString::Format(wxT("Image from %s"), desc),
|
||||
wxString::Format("Image from %s", desc),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE) )
|
||||
return false;
|
||||
@ -154,19 +154,19 @@ private:
|
||||
wxMenu *menu = new wxMenu;
|
||||
menu->Append(wxID_SAVEAS);
|
||||
menu->AppendSeparator();
|
||||
menu->AppendCheckItem(ID_PAINT_BG, wxT("&Paint background"),
|
||||
menu->AppendCheckItem(ID_PAINT_BG, "&Paint background",
|
||||
"Uncheck this for transparent images");
|
||||
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_OUT, "Zoom &out\tCtrl--");
|
||||
menu->Append(wxID_ZOOM_100, "Reset zoom to &100%\tCtrl-1");
|
||||
menu->AppendSeparator();
|
||||
menu->Append(ID_ROTATE_LEFT, wxT("Rotate &left\tCtrl-L"));
|
||||
menu->Append(ID_ROTATE_RIGHT, wxT("Rotate &right\tCtrl-R"));
|
||||
menu->Append(ID_ROTATE_LEFT, "Rotate &left\tCtrl-L");
|
||||
menu->Append(ID_ROTATE_RIGHT, "Rotate &right\tCtrl-R");
|
||||
|
||||
wxMenuBar *mbar = new wxMenuBar;
|
||||
mbar->Append(menu, wxT("&Image"));
|
||||
mbar->Append(menu, "&Image");
|
||||
SetMenuBar(mbar);
|
||||
|
||||
mbar->Check(ID_PAINT_BG, true);
|
||||
@ -213,31 +213,31 @@ private:
|
||||
#if wxUSE_FILEDLG
|
||||
wxImage image = m_bitmap.ConvertToImage();
|
||||
|
||||
wxString savefilename = wxFileSelector( wxT("Save Image"),
|
||||
wxString savefilename = wxFileSelector( "Save Image",
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxT("BMP files (*.bmp)|*.bmp|")
|
||||
"BMP files (*.bmp)|*.bmp|"
|
||||
#if wxUSE_LIBPNG
|
||||
wxT("PNG files (*.png)|*.png|")
|
||||
"PNG files (*.png)|*.png|"
|
||||
#endif
|
||||
#if wxUSE_LIBJPEG
|
||||
wxT("JPEG files (*.jpg)|*.jpg|")
|
||||
"JPEG files (*.jpg)|*.jpg|"
|
||||
#endif
|
||||
#if wxUSE_GIF
|
||||
wxT("GIF files (*.gif)|*.gif|")
|
||||
"GIF files (*.gif)|*.gif|"
|
||||
#endif
|
||||
#if wxUSE_LIBTIFF
|
||||
wxT("TIFF files (*.tif)|*.tif|")
|
||||
"TIFF files (*.tif)|*.tif|"
|
||||
#endif
|
||||
#if wxUSE_PCX
|
||||
wxT("PCX files (*.pcx)|*.pcx|")
|
||||
"PCX files (*.pcx)|*.pcx|"
|
||||
#endif
|
||||
#if wxUSE_XPM
|
||||
wxT("X PixMap files (*.xpm)|*.xpm|")
|
||||
"X PixMap files (*.xpm)|*.xpm|"
|
||||
#endif
|
||||
wxT("ICO files (*.ico)|*.ico|")
|
||||
wxT("CUR files (*.cur)|*.cur"),
|
||||
"ICO files (*.ico)|*.ico|"
|
||||
"CUR files (*.cur)|*.cur",
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
|
||||
this);
|
||||
|
||||
@ -248,7 +248,7 @@ private:
|
||||
wxFileName::SplitPath(savefilename, NULL, NULL, &extension);
|
||||
|
||||
bool saved = false;
|
||||
if ( extension == wxT("bmp") )
|
||||
if ( extension == "bmp" )
|
||||
{
|
||||
static const int bppvalues[] =
|
||||
{
|
||||
@ -264,18 +264,18 @@ private:
|
||||
|
||||
const wxString bppchoices[] =
|
||||
{
|
||||
wxT("1 bpp color"),
|
||||
wxT("1 bpp B&W"),
|
||||
wxT("4 bpp color"),
|
||||
wxT("8 bpp color"),
|
||||
wxT("8 bpp greyscale"),
|
||||
wxT("8 bpp red"),
|
||||
wxT("8 bpp own palette"),
|
||||
wxT("24 bpp")
|
||||
"1 bpp color",
|
||||
"1 bpp B&W",
|
||||
"4 bpp color",
|
||||
"8 bpp color",
|
||||
"8 bpp greyscale",
|
||||
"8 bpp red",
|
||||
"8 bpp own palette",
|
||||
"24 bpp"
|
||||
};
|
||||
|
||||
int bppselection = wxGetSingleChoiceIndex(wxT("Set BMP BPP"),
|
||||
wxT("Image sample: save file"),
|
||||
int bppselection = wxGetSingleChoiceIndex("Set BMP BPP",
|
||||
"Image sample: save file",
|
||||
WXSIZEOF(bppchoices),
|
||||
bppchoices,
|
||||
this);
|
||||
@ -296,7 +296,7 @@ private:
|
||||
}
|
||||
}
|
||||
#if wxUSE_LIBPNG
|
||||
else if ( extension == wxT("png") )
|
||||
else if ( extension == "png" )
|
||||
{
|
||||
static const int pngvalues[] =
|
||||
{
|
||||
@ -310,16 +310,16 @@ private:
|
||||
|
||||
const wxString pngchoices[] =
|
||||
{
|
||||
wxT("Colour 8bpp"),
|
||||
wxT("Colour 16bpp"),
|
||||
wxT("Grey 8bpp"),
|
||||
wxT("Grey 16bpp"),
|
||||
wxT("Grey red 8bpp"),
|
||||
wxT("Grey red 16bpp"),
|
||||
"Colour 8bpp",
|
||||
"Colour 16bpp",
|
||||
"Grey 8bpp",
|
||||
"Grey 16bpp",
|
||||
"Grey red 8bpp",
|
||||
"Grey red 16bpp",
|
||||
};
|
||||
|
||||
int sel = wxGetSingleChoiceIndex(wxT("Set PNG format"),
|
||||
wxT("Image sample: save file"),
|
||||
int sel = wxGetSingleChoiceIndex("Set PNG format",
|
||||
"Image sample: save file",
|
||||
WXSIZEOF(pngchoices),
|
||||
pngchoices,
|
||||
this);
|
||||
@ -331,22 +331,22 @@ private:
|
||||
// these values are taken from OptiPNG with -o3 switch
|
||||
const wxString compressionChoices[] =
|
||||
{
|
||||
wxT("compression = 9, memory = 8, strategy = 0, filter = 0"),
|
||||
wxT("compression = 9, memory = 9, strategy = 0, filter = 0"),
|
||||
wxT("compression = 9, memory = 8, strategy = 1, filter = 0"),
|
||||
wxT("compression = 9, memory = 9, strategy = 1, filter = 0"),
|
||||
wxT("compression = 1, memory = 8, strategy = 2, filter = 0"),
|
||||
wxT("compression = 1, memory = 9, strategy = 2, filter = 0"),
|
||||
wxT("compression = 9, memory = 8, strategy = 0, filter = 5"),
|
||||
wxT("compression = 9, memory = 9, strategy = 0, filter = 5"),
|
||||
wxT("compression = 9, memory = 8, strategy = 1, filter = 5"),
|
||||
wxT("compression = 9, memory = 9, strategy = 1, filter = 5"),
|
||||
wxT("compression = 1, memory = 8, strategy = 2, filter = 5"),
|
||||
wxT("compression = 1, memory = 9, strategy = 2, filter = 5"),
|
||||
"compression = 9, memory = 8, strategy = 0, filter = 0",
|
||||
"compression = 9, memory = 9, strategy = 0, filter = 0",
|
||||
"compression = 9, memory = 8, strategy = 1, filter = 0",
|
||||
"compression = 9, memory = 9, strategy = 1, filter = 0",
|
||||
"compression = 1, memory = 8, strategy = 2, filter = 0",
|
||||
"compression = 1, memory = 9, strategy = 2, filter = 0",
|
||||
"compression = 9, memory = 8, strategy = 0, filter = 5",
|
||||
"compression = 9, memory = 9, strategy = 0, filter = 5",
|
||||
"compression = 9, memory = 8, strategy = 1, filter = 5",
|
||||
"compression = 9, memory = 9, strategy = 1, filter = 5",
|
||||
"compression = 1, memory = 8, strategy = 2, filter = 5",
|
||||
"compression = 1, memory = 9, strategy = 2, filter = 5",
|
||||
};
|
||||
|
||||
sel = wxGetSingleChoiceIndex(wxT("Select compression option (Cancel to use default)\n"),
|
||||
wxT("PNG Compression Options"),
|
||||
sel = wxGetSingleChoiceIndex("Select compression option (Cancel to use default)\n",
|
||||
"PNG Compression Options",
|
||||
WXSIZEOF(compressionChoices),
|
||||
compressionChoices,
|
||||
this);
|
||||
@ -367,7 +367,7 @@ private:
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_LIBPNG
|
||||
else if ( extension == wxT("cur") )
|
||||
else if ( extension == "cur" )
|
||||
{
|
||||
image.Rescale(32,32);
|
||||
image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, 0);
|
||||
@ -419,7 +419,7 @@ private:
|
||||
img = img.Rotate(angle, wxPoint(img.GetWidth() / 2, img.GetHeight() / 2));
|
||||
if ( !img.IsOk() )
|
||||
{
|
||||
wxLogWarning(wxT("Rotation failed"));
|
||||
wxLogWarning("Rotation failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ private:
|
||||
|
||||
void UpdateStatusBar()
|
||||
{
|
||||
wxLogStatus(this, wxT("Image size: (%d, %d), zoom %.2f"),
|
||||
wxLogStatus(this, "Image size: (%d, %d), zoom %.2f",
|
||||
m_bitmap.GetWidth(),
|
||||
m_bitmap.GetHeight(),
|
||||
m_zoom);
|
||||
@ -458,7 +458,7 @@ public:
|
||||
};
|
||||
|
||||
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_alphaBitmap(SIZE, SIZE, 32)
|
||||
{
|
||||
@ -476,7 +476,7 @@ public:
|
||||
wxAlphaPixelData data( m_alphaBitmap, wxPoint(0,0), wxSize(SIZE, SIZE) );
|
||||
if ( !data )
|
||||
{
|
||||
wxLogError(wxT("Failed to gain raw access to bitmap data"));
|
||||
wxLogError("Failed to gain raw access to bitmap data");
|
||||
return;
|
||||
}
|
||||
wxAlphaPixelData::Iterator p(data);
|
||||
@ -498,7 +498,7 @@ public:
|
||||
wxSize(REAL_SIZE, REAL_SIZE));
|
||||
if ( !data )
|
||||
{
|
||||
wxLogError(wxT("Failed to gain raw access to bitmap data"));
|
||||
wxLogError("Failed to gain raw access to bitmap data");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ public:
|
||||
wxNativePixelData data(m_bitmap);
|
||||
if ( !data )
|
||||
{
|
||||
wxLogError(wxT("Failed to gain raw access to bitmap data"));
|
||||
wxLogError("Failed to gain raw access to bitmap data");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -564,12 +564,12 @@ public:
|
||||
void OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPaintDC dc( this );
|
||||
dc.DrawText(wxT("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(wxT("This is alpha and raw bitmap test"), 0, SIZE - 2*BORDER);
|
||||
dc.DrawText("This is alpha and raw bitmap test", 0, BORDER);
|
||||
dc.DrawText("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.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());
|
||||
}
|
||||
|
||||
@ -654,7 +654,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame( (wxFrame *)NULL, wxID_ANY, wxT("wxImage sample"),
|
||||
: wxFrame( (wxFrame *)NULL, wxID_ANY, "wxImage sample",
|
||||
wxPoint(20, 20), wxSize(950, 700) )
|
||||
{
|
||||
SetIcon(wxICON(sample));
|
||||
@ -662,31 +662,31 @@ MyFrame::MyFrame()
|
||||
wxMenuBar *menu_bar = new wxMenuBar();
|
||||
|
||||
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_INFO, wxT("Show image &information...\tCtrl-I"));
|
||||
menuImage->Append( ID_INFO, "Show image &information...\tCtrl-I");
|
||||
#ifdef wxHAVE_RAW_BITMAP
|
||||
menuImage->AppendSeparator();
|
||||
menuImage->Append( ID_SHOWRAW, wxT("Test &raw bitmap...\tCtrl-R"));
|
||||
menuImage->Append( ID_SHOWRAW, "Test &raw bitmap...\tCtrl-R");
|
||||
#endif
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
menuImage->AppendSeparator();
|
||||
menuImage->Append(ID_GRAPHICS, "Test &graphics context...\tCtrl-G");
|
||||
#endif // wxUSE_GRAPHICS_CONTEXT
|
||||
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)");
|
||||
menuImage->AppendSeparator();
|
||||
menuImage->Append( ID_ABOUT, wxT("&About\tF1"));
|
||||
menuImage->Append( ID_ABOUT, "&About\tF1");
|
||||
menuImage->AppendSeparator();
|
||||
menuImage->Append( ID_QUIT, wxT("E&xit\tCtrl-Q"));
|
||||
menu_bar->Append(menuImage, wxT("&Image"));
|
||||
menuImage->Append( ID_QUIT, "E&xit\tCtrl-Q");
|
||||
menu_bar->Append(menuImage, "&Image");
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
wxMenu *menuClipboard = new wxMenu;
|
||||
menuClipboard->Append(wxID_COPY, wxT("&Copy test image\tCtrl-C"));
|
||||
menuClipboard->Append(wxID_PASTE, wxT("&Paste image\tCtrl-V"));
|
||||
menu_bar->Append(menuClipboard, wxT("&Clipboard"));
|
||||
menuClipboard->Append(wxID_COPY, "&Copy test image\tCtrl-C");
|
||||
menuClipboard->Append(wxID_PASTE, "&Paste image\tCtrl-V");
|
||||
menu_bar->Append(menuClipboard, "&Clipboard");
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
SetMenuBar( menu_bar );
|
||||
@ -747,12 +747,12 @@ wxString MyFrame::LoadUserImage(wxImage& image)
|
||||
wxString filename;
|
||||
|
||||
#if wxUSE_FILEDLG
|
||||
filename = wxLoadFileSelector(wxT("image"), wxEmptyString);
|
||||
filename = wxLoadFileSelector("image", wxEmptyString);
|
||||
if ( !filename.empty() )
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -921,7 +921,7 @@ void MyFrame::OnCopy(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
if ( !wxTheClipboard->SetData(dobjBmp) )
|
||||
{
|
||||
wxLogError(wxT("Failed to copy bitmap to clipboard"));
|
||||
wxLogError("Failed to copy bitmap to clipboard");
|
||||
}
|
||||
|
||||
wxTheClipboard->Close();
|
||||
@ -934,11 +934,11 @@ void MyFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
|
||||
wxTheClipboard->Open();
|
||||
if ( !wxTheClipboard->GetData(dobjBmp) )
|
||||
{
|
||||
wxLogMessage(wxT("No bitmap data in the clipboard"));
|
||||
wxLogMessage("No bitmap data in the clipboard");
|
||||
}
|
||||
else
|
||||
{
|
||||
new MyImageFrame(this, wxT("Clipboard"), dobjBmp.GetBitmap());
|
||||
new MyImageFrame(this, "Clipboard", dobjBmp.GetBitmap());
|
||||
}
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
@ -948,7 +948,7 @@ void MyFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnThumbnail( wxCommandEvent &WXUNUSED(event) )
|
||||
{
|
||||
#if wxUSE_FILEDLG
|
||||
wxString filename = wxLoadFileSelector(wxT("image"), wxEmptyString, wxEmptyString, this);
|
||||
wxString filename = wxLoadFileSelector("image", wxEmptyString, wxEmptyString, this);
|
||||
if ( filename.empty() )
|
||||
return;
|
||||
|
||||
@ -962,7 +962,7 @@ void MyFrame::OnThumbnail( wxCommandEvent &WXUNUSED(event) )
|
||||
wxStopWatch sw;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -975,7 +975,7 @@ void MyFrame::OnThumbnail( wxCommandEvent &WXUNUSED(event) )
|
||||
wxLogStatus(frame, "Loaded \"%s\" in %ldms; original size was (%d, %d)",
|
||||
filename, loadTime, origWidth, origHeight);
|
||||
#else
|
||||
wxLogError( wxT("Couldn't create file selector dialog") );
|
||||
wxLogError( "Couldn't create file selector dialog" );
|
||||
return;
|
||||
#endif // wxUSE_FILEDLG
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// this message is not translated (not in catalog) because we used wxT()
|
||||
// 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 )
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// Create the main frame window
|
||||
m_frame = new MyFrame(NULL, wxT("Client"));
|
||||
m_frame = new MyFrame(NULL, "Client");
|
||||
m_frame->Show(true);
|
||||
|
||||
return true;
|
||||
@ -101,11 +101,11 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(wxID_EXIT, wxT("&Quit\tCtrl-Q"));
|
||||
file_menu->Append(wxID_EXIT, "&Quit\tCtrl-Q");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
SetMenuBar(menu_bar);
|
||||
@ -116,15 +116,15 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
// add the controls to the frame
|
||||
wxString strs4[] =
|
||||
{
|
||||
IPC_SERVICE, wxT("...")
|
||||
IPC_SERVICE, "..."
|
||||
};
|
||||
wxString strs5[] =
|
||||
{
|
||||
IPC_HOST, wxT("...")
|
||||
IPC_HOST, "..."
|
||||
};
|
||||
wxString strs6[] =
|
||||
{
|
||||
IPC_TOPIC, wxT("...")
|
||||
IPC_TOPIC, "..."
|
||||
};
|
||||
|
||||
wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
|
||||
@ -133,7 +133,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
|
||||
wxGridSizer *item2 = new wxGridSizer( 4, 0, 0 );
|
||||
|
||||
wxButton *item3 = new wxButton( this, ID_START, wxT("Connect to server"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton *item3 = new wxButton( this, ID_START, "Connect to server", wxDefaultPosition, wxDefaultSize, 0 );
|
||||
item2->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxChoice *item5 = new wxChoice( this, ID_HOSTNAME, wxDefaultPosition, wxSize(100,-1), 2, strs5, 0 );
|
||||
@ -145,7 +145,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
wxChoice *item6 = new wxChoice( this, ID_TOPIC, wxDefaultPosition, wxSize(100,-1), 2, strs6, 0 );
|
||||
item2->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
wxButton *item7 = new wxButton( this, ID_DISCONNECT, wxT("Disconnect "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton *item7 = new wxButton( this, ID_DISCONNECT, "Disconnect ", wxDefaultPosition, wxDefaultSize, 0 );
|
||||
item2->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
@ -154,17 +154,17 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
|
||||
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
wxButton *item8 = new wxButton( this, ID_STARTADVISE, wxT("StartAdvise"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton *item8 = new wxButton( this, ID_STARTADVISE, "StartAdvise", wxDefaultPosition, wxDefaultSize, 0 );
|
||||
item2->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxButton *item9 = new wxButton( this, ID_STOPADVISE, wxT("StopAdvise"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton *item9 = new wxButton( this, ID_STOPADVISE, "StopAdvise", wxDefaultPosition, wxDefaultSize, 0 );
|
||||
item2->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
wxButton *item10 = new wxButton( this, ID_EXECUTE, wxT("Execute"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton *item10 = new wxButton( this, ID_EXECUTE, "Execute", wxDefaultPosition, wxDefaultSize, 0 );
|
||||
item2->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
@ -173,7 +173,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
|
||||
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
wxButton *item11 = new wxButton( this, ID_POKE, wxT("Poke"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton *item11 = new wxButton( this, ID_POKE, "Poke", wxDefaultPosition, wxDefaultSize, 0 );
|
||||
item2->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
@ -182,7 +182,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
|
||||
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
|
||||
wxButton *item12 = new wxButton( this, ID_REQUEST, wxT("Request"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton *item12 = new wxButton( this, ID_REQUEST, "Request", wxDefaultPosition, wxDefaultSize, 0 );
|
||||
item2->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
|
||||
@ -191,7 +191,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
|
||||
item0->Add( item1, wxSizerFlags().Expand().Border(wxALL, 5) );
|
||||
|
||||
wxStaticBox *item14 = new wxStaticBox( this, -1, wxT("Client log") );
|
||||
wxStaticBox *item14 = new wxStaticBox( this, -1, "Client log" );
|
||||
wxStaticBoxSizer *item13 = new wxStaticBoxSizer( item14, wxVERTICAL );
|
||||
|
||||
wxTextCtrl *item15 = new wxTextCtrl( this, ID_LOG, wxEmptyString, wxDefaultPosition, wxSize(500,140), wxTE_MULTILINE );
|
||||
@ -209,7 +209,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
||||
GetTopic()->SetSelection(0);
|
||||
wxLogTextCtrl *logWindow = new wxLogTextCtrl(GetLog());
|
||||
delete wxLog::SetActiveTarget(logWindow);
|
||||
wxLogMessage(wxT("Click on Connect to connect to the server"));
|
||||
wxLogMessage("Click on Connect to connect to the server");
|
||||
EnableControls();
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ void MyFrame::OnStart(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
wxLogMessage(wxT("Client host=\"%s\" port=\"%s\" topic=\"%s\" %s"),
|
||||
hostname.c_str(), servername.c_str(), topic.c_str(),
|
||||
retval ? wxT("connected") : wxT("failed to connect"));
|
||||
retval ? "connected" : "failed to connect");
|
||||
|
||||
if (!retval)
|
||||
{
|
||||
@ -264,10 +264,10 @@ void MyFrame::OnStart(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnServername( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (GetServername()->GetStringSelection() == wxT("..."))
|
||||
if (GetServername()->GetStringSelection() == "...")
|
||||
{
|
||||
wxString s = wxGetTextFromUser(wxT("Specify the name of the server"),
|
||||
wxT("Server Name"), wxEmptyString, this);
|
||||
wxString s = wxGetTextFromUser("Specify the name of the server",
|
||||
"Server Name", wxEmptyString, this);
|
||||
if (!s.IsEmpty() && s != IPC_SERVICE)
|
||||
{
|
||||
GetServername()->Insert(s, 0);
|
||||
@ -278,10 +278,10 @@ void MyFrame::OnServername( wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
void MyFrame::OnHostname( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (GetHostname()->GetStringSelection() == wxT("..."))
|
||||
if (GetHostname()->GetStringSelection() == "...")
|
||||
{
|
||||
wxString s = wxGetTextFromUser(wxT("Specify the name of the host (ignored under DDE)"),
|
||||
wxT("Host Name"), wxEmptyString, this);
|
||||
wxString s = wxGetTextFromUser("Specify the name of the host (ignored under DDE)",
|
||||
"Host Name", wxEmptyString, this);
|
||||
if (!s.IsEmpty() && s != IPC_HOST)
|
||||
{
|
||||
GetHostname()->Insert(s, 0);
|
||||
@ -292,10 +292,10 @@ void MyFrame::OnHostname( wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
void MyFrame::OnTopic( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (GetTopic()->GetStringSelection() == wxT("..."))
|
||||
if (GetTopic()->GetStringSelection() == "...")
|
||||
{
|
||||
wxString s = wxGetTextFromUser(wxT("Specify the name of the topic"),
|
||||
wxT("Topic Name"), wxEmptyString, this);
|
||||
wxString s = wxGetTextFromUser("Specify the name of the topic",
|
||||
"Topic Name", wxEmptyString, this);
|
||||
if (!s.IsEmpty() && s != IPC_TOPIC)
|
||||
{
|
||||
GetTopic()->Insert(s, 0);
|
||||
@ -317,19 +317,19 @@ void MyFrame::Disconnect()
|
||||
|
||||
void MyFrame::OnStartAdvise(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_client->GetConnection()->StartAdvise(wxT("something"));
|
||||
m_client->GetConnection()->StartAdvise("something");
|
||||
}
|
||||
|
||||
void MyFrame::OnStopAdvise(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_client->GetConnection()->StopAdvise(wxT("something"));
|
||||
m_client->GetConnection()->StopAdvise("something");
|
||||
}
|
||||
|
||||
void MyFrame::OnExecute(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (m_client->IsConnected())
|
||||
{
|
||||
wxString s = wxT("Date");
|
||||
wxString s = "Date";
|
||||
|
||||
m_client->GetConnection()->Execute(s);
|
||||
m_client->GetConnection()->Execute((const char *)s.c_str(), s.length() + 1);
|
||||
@ -346,12 +346,12 @@ void MyFrame::OnPoke(wxCommandEvent& WXUNUSED(event))
|
||||
if (m_client->IsConnected())
|
||||
{
|
||||
wxString s = wxDateTime::Now().Format();
|
||||
m_client->GetConnection()->Poke(wxT("Date"), s);
|
||||
s = wxDateTime::Now().FormatTime() + wxT(" ") + wxDateTime::Now().FormatDate();
|
||||
m_client->GetConnection()->Poke(wxT("Date"), (const char *)s.c_str(), s.length() + 1);
|
||||
m_client->GetConnection()->Poke("Date", s);
|
||||
s = wxDateTime::Now().FormatTime() + " " + wxDateTime::Now().FormatDate();
|
||||
m_client->GetConnection()->Poke("Date", (const char *)s.c_str(), s.length() + 1);
|
||||
char bytes[3];
|
||||
bytes[0] = '1'; bytes[1] = '2'; bytes[2] = '3';
|
||||
m_client->GetConnection()->Poke(wxT("bytes[3]"), bytes, 3, wxIPC_PRIVATE);
|
||||
m_client->GetConnection()->Poke("bytes[3]", bytes, 3, wxIPC_PRIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,9 +360,9 @@ void MyFrame::OnRequest(wxCommandEvent& WXUNUSED(event))
|
||||
if (m_client->IsConnected())
|
||||
{
|
||||
size_t size;
|
||||
m_client->GetConnection()->Request(wxT("Date"));
|
||||
m_client->GetConnection()->Request(wxT("Date+len"), &size);
|
||||
m_client->GetConnection()->Request(wxT("bytes[3]"), &size, wxIPC_PRIVATE);
|
||||
m_client->GetConnection()->Request("Date");
|
||||
m_client->GetConnection()->Request("Date+len", &size);
|
||||
m_client->GetConnection()->Request("bytes[3]", &size, wxIPC_PRIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -395,7 +395,7 @@ void MyClient::Disconnect()
|
||||
m_connection->Disconnect();
|
||||
wxDELETE(m_connection);
|
||||
wxGetApp().GetFrame()->EnableControls();
|
||||
wxLogMessage(wxT("Client disconnected from server"));
|
||||
wxLogMessage("Client disconnected from server");
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,24 +411,24 @@ MyClient::~MyClient()
|
||||
bool MyConnection::OnAdvise(const wxString& topic, const wxString& item, const void *data,
|
||||
size_t size, wxIPCFormat format)
|
||||
{
|
||||
Log(wxT("OnAdvise"), topic, item, data, size, format);
|
||||
Log("OnAdvise", topic, item, data, size, format);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MyConnection::OnDisconnect()
|
||||
{
|
||||
wxLogMessage(wxT("OnDisconnect()"));
|
||||
wxLogMessage("OnDisconnect()");
|
||||
wxGetApp().GetFrame()->Disconnect();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MyConnection::DoExecute(const void *data, size_t size, wxIPCFormat format)
|
||||
{
|
||||
Log(wxT("Execute"), wxEmptyString, wxEmptyString, data, size, format);
|
||||
Log("Execute", wxEmptyString, wxEmptyString, data, size, format);
|
||||
bool retval = wxConnection::DoExecute(data, size, format);
|
||||
if (!retval)
|
||||
{
|
||||
wxLogMessage(wxT("Execute failed!"));
|
||||
wxLogMessage("Execute failed!");
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@ -436,12 +436,12 @@ bool MyConnection::DoExecute(const void *data, size_t size, wxIPCFormat format)
|
||||
const void *MyConnection::Request(const wxString& item, size_t *size, wxIPCFormat format)
|
||||
{
|
||||
const void *data = wxConnection::Request(item, size, format);
|
||||
Log(wxT("Request"), wxEmptyString, item, data, size ? *size : wxNO_LEN, format);
|
||||
Log("Request", wxEmptyString, item, data, size ? *size : wxNO_LEN, format);
|
||||
return data;
|
||||
}
|
||||
|
||||
bool MyConnection::DoPoke(const wxString& item, const void *data, size_t size, wxIPCFormat format)
|
||||
{
|
||||
Log(wxT("Poke"), wxEmptyString, item, data, size, format);
|
||||
Log("Poke", wxEmptyString, item, data, size, format);
|
||||
return wxConnection::DoPoke(item, data, size, format);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
// the default service name
|
||||
#define IPC_SERVICE "4242"
|
||||
//#define IPC_SERVICE wxT("/tmp/wxsrv424")
|
||||
//#define IPC_SERVICE "/tmp/wxsrv424"
|
||||
|
||||
// the hostname
|
||||
#define IPC_HOST "localhost"
|
||||
|
@ -54,12 +54,12 @@ bool MyApp::OnInit()
|
||||
wxJoystick stick(wxJOYSTICK1);
|
||||
if (!stick.IsOk())
|
||||
{
|
||||
wxMessageBox(wxT("No joystick detected!"));
|
||||
wxMessageBox("No joystick detected!");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if wxUSE_SOUND
|
||||
m_fire.Create(wxT("buttonpress.wav"));
|
||||
m_fire.Create("buttonpress.wav");
|
||||
#endif // wxUSE_SOUND
|
||||
|
||||
m_minX = stick.GetXMin();
|
||||
@ -69,7 +69,7 @@ bool MyApp::OnInit()
|
||||
|
||||
// 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);
|
||||
|
||||
frame->SetIcon(wxICON(sample));
|
||||
@ -77,18 +77,18 @@ bool MyApp::OnInit()
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(JOYTEST_QUIT, wxT("&Exit"));
|
||||
file_menu->Append(JOYTEST_QUIT, "&Exit");
|
||||
|
||||
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
|
||||
frame->SetMenuBar(menu_bar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
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
|
||||
|
||||
frame->CenterOnScreen();
|
||||
@ -159,15 +159,15 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event)
|
||||
#if wxUSE_STATUSBAR
|
||||
wxString buf;
|
||||
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
|
||||
buf.Printf(wxT("Joystick (%ld, %ld) "), xpos, ypos);
|
||||
buf.Printf("Joystick (%ld, %ld) ", xpos, ypos);
|
||||
|
||||
/*
|
||||
for(int i = 0; i < nButtons; ++i)
|
||||
{
|
||||
buf += wxString(wxT("[")) +
|
||||
((event.GetButtonState() & (1 << i)) ? wxT("Y") : wxT("N")) + wxString(wxT("]"));
|
||||
buf += wxString("[") +
|
||||
((event.GetButtonState() & (1 << i)) ? "Y" : "N") + wxString("]");
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -77,38 +77,38 @@ wxEND_EVENT_TABLE()
|
||||
|
||||
// Define my frame constructor
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame(NULL, wxID_ANY, wxT("wxWidgets Layout Demo"))
|
||||
: wxFrame(NULL, wxID_ANY, "wxWidgets Layout Demo")
|
||||
{
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(LAYOUT_TEST_PROPORTIONS, wxT("&Proportions demo...\tF1"));
|
||||
file_menu->Append(LAYOUT_TEST_SIZER, wxT("Test wx&FlexSizer...\tF2"));
|
||||
file_menu->Append(LAYOUT_TEST_NB_SIZER, wxT("Test ¬ebook sizers...\tF3"));
|
||||
file_menu->Append(LAYOUT_TEST_GB_SIZER, wxT("Test &gridbag sizer...\tF4"));
|
||||
file_menu->Append(LAYOUT_TEST_SET_MINIMAL, wxT("Test Set&ItemMinSize...\tF5"));
|
||||
file_menu->Append(LAYOUT_TEST_NESTED, wxT("Test nested sizer in a wxPanel...\tF6"));
|
||||
file_menu->Append(LAYOUT_TEST_WRAP, wxT("Test wrap sizers...\tF7"));
|
||||
file_menu->Append(LAYOUT_TEST_PROPORTIONS, "&Proportions demo...\tF1");
|
||||
file_menu->Append(LAYOUT_TEST_SIZER, "Test wx&FlexSizer...\tF2");
|
||||
file_menu->Append(LAYOUT_TEST_NB_SIZER, "Test ¬ebook sizers...\tF3");
|
||||
file_menu->Append(LAYOUT_TEST_GB_SIZER, "Test &gridbag sizer...\tF4");
|
||||
file_menu->Append(LAYOUT_TEST_SET_MINIMAL, "Test Set&ItemMinSize...\tF5");
|
||||
file_menu->Append(LAYOUT_TEST_NESTED, "Test nested sizer in a wxPanel...\tF6");
|
||||
file_menu->Append(LAYOUT_TEST_WRAP, "Test wrap sizers...\tF7");
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(help_menu, wxT("&Help"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
SetMenuBar(menu_bar);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("wxWidgets layout demo"));
|
||||
SetStatusText("wxWidgets layout demo");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
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
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
|
||||
// 2) top: create wxTextCtrl with minimum size (100x60)
|
||||
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));
|
||||
|
||||
// 2.5) Gratuitous test of wxStaticBoxSizers
|
||||
wxBoxSizer *statsizer = new wxStaticBoxSizer(
|
||||
new wxStaticBox(p, wxID_ANY, wxT("A wxStaticBoxSizer")), wxVERTICAL );
|
||||
new wxStaticBox(p, wxID_ANY, "A wxStaticBoxSizer"), wxVERTICAL );
|
||||
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));
|
||||
topsizer->Add(
|
||||
statsizer,
|
||||
@ -147,17 +147,17 @@ MyFrame::MyFrame()
|
||||
|
||||
// 2.7) And a test of wxGridSizer
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
topsizer->Add(
|
||||
gridsizer,
|
||||
@ -175,10 +175,10 @@ MyFrame::MyFrame()
|
||||
// 4) bottom: create two centred wxButtons
|
||||
wxBoxSizer *button_box = new wxBoxSizer( wxHORIZONTAL );
|
||||
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));
|
||||
button_box->Add(
|
||||
new wxButton( p, wxID_ANY, wxT("(wxCENTER)") ),
|
||||
new wxButton( p, wxID_ANY, "(wxCENTER)" ),
|
||||
wxSizerFlags().Border(wxALL, 7));
|
||||
|
||||
topsizer->Add(button_box, wxSizerFlags().Center());
|
||||
@ -207,7 +207,7 @@ void MyFrame::TestFlexSizers(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();
|
||||
}
|
||||
@ -230,8 +230,8 @@ void MyFrame::TestWrap(wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
(void)wxMessageBox(wxT("wxWidgets GUI library layout demo\n"),
|
||||
wxT("About Layout Demo"), wxOK|wxICON_INFORMATION);
|
||||
(void)wxMessageBox("wxWidgets GUI library layout demo\n",
|
||||
"About Layout Demo", wxOK|wxICON_INFORMATION);
|
||||
}
|
||||
|
||||
void MyFrame::TestGridBagSizer(wxCommandEvent& WXUNUSED(event) )
|
||||
@ -244,7 +244,7 @@ void MyFrame::TestGridBagSizer(wxCommandEvent& WXUNUSED(event) )
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
MyProportionsFrame::MyProportionsFrame(wxFrame *parent)
|
||||
: wxFrame(parent, wxID_ANY, wxT("Box Sizer Proportions Demo"))
|
||||
: wxFrame(parent, wxID_ANY, "Box Sizer Proportions Demo")
|
||||
{
|
||||
size_t n;
|
||||
|
||||
@ -258,7 +258,7 @@ MyProportionsFrame::MyProportionsFrame(wxFrame *parent)
|
||||
|
||||
// lay them out
|
||||
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++ )
|
||||
m_sizer->Add(m_spins[n], wxSizerFlags().Border());
|
||||
|
||||
@ -326,24 +326,24 @@ MyFlexSizerFrame::MyFlexSizerFrame(wxFrame* parent)
|
||||
|
||||
// consttuct the first column
|
||||
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));
|
||||
InitFlexSizer(sizerFlex, p);
|
||||
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));
|
||||
InitFlexSizer(sizerFlex, p);
|
||||
sizerFlex->AddGrowableCol(1);
|
||||
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));
|
||||
InitFlexSizer(sizerFlex, p);
|
||||
sizerFlex->AddGrowableRow(1);
|
||||
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));
|
||||
InitFlexSizer(sizerFlex, p);
|
||||
sizerFlex->AddGrowableCol(0, 1);
|
||||
@ -353,14 +353,14 @@ MyFlexSizerFrame::MyFlexSizerFrame(wxFrame* parent)
|
||||
|
||||
// the second one
|
||||
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));
|
||||
InitFlexSizer(sizerFlex, p);
|
||||
sizerFlex->AddGrowableCol(1);
|
||||
sizerFlex->AddGrowableRow(1);
|
||||
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));
|
||||
InitFlexSizer(sizerFlex, p);
|
||||
sizerFlex->AddGrowableCol(1);
|
||||
@ -410,24 +410,24 @@ MySizerDialog::MySizerDialog(wxWindow *parent, const wxString &title)
|
||||
wxNotebook *notebook = new wxNotebook( this, wxID_ANY );
|
||||
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 );
|
||||
|
||||
// First page: one big text ctrl
|
||||
wxTextCtrl *multi = new wxTextCtrl( notebook, wxID_ANY, wxT("TextCtrl."), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
notebook->AddPage( multi, wxT("Page One") );
|
||||
wxTextCtrl *multi = new wxTextCtrl( notebook, wxID_ANY, "TextCtrl.", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
notebook->AddPage( multi, "Page One" );
|
||||
|
||||
// Second page: a text ctrl and a button
|
||||
wxPanel *panel = new wxPanel( notebook, wxID_ANY );
|
||||
notebook->AddPage( panel, wxT("Page Two") );
|
||||
notebook->AddPage( panel, "Page Two" );
|
||||
|
||||
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 );
|
||||
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 );
|
||||
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 );
|
||||
|
||||
panel->SetSizer( panelsizer );
|
||||
@ -499,19 +499,19 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(wxFrame* parent)
|
||||
//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_moveBtn2 = new wxButton(p, GBS_MOVE_BTN2, 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, "Move this to (3,6)");
|
||||
m_gbs->Add( m_moveBtn1, POS(10,2) );
|
||||
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_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));
|
||||
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_showBtn->Disable();
|
||||
|
||||
@ -551,7 +551,7 @@ void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent& event)
|
||||
if (curPos == wxGBPosition(3,6))
|
||||
{
|
||||
m_gbs->SetItemPosition(btn, m_lastPos);
|
||||
btn->SetLabel(wxT("Move this to (3,6)"));
|
||||
btn->SetLabel("Move this to (3,6)");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -559,12 +559,12 @@ void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent& event)
|
||||
wxMessageBox(
|
||||
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\
|
||||
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)) )
|
||||
{
|
||||
m_lastPos = curPos;
|
||||
btn->SetLabel(wxT("Move it back"));
|
||||
btn->SetLabel("Move it back");
|
||||
}
|
||||
}
|
||||
m_gbs->Layout();
|
||||
@ -590,11 +590,11 @@ MySimpleSizerFrame::MySimpleSizerFrame(wxFrame* parent)
|
||||
{
|
||||
wxMenu *menu = new wxMenu;
|
||||
|
||||
menu->Append(ID_SET_SMALL, wxT("Make text control small\tF4"));
|
||||
menu->Append(ID_SET_BIG, wxT("Make text control big\tF5"));
|
||||
menu->Append(ID_SET_SMALL, "Make text control small\tF4");
|
||||
menu->Append(ID_SET_BIG, "Make text control big\tF5");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
menu_bar->Append(menu, wxT("&File"));
|
||||
menu_bar->Append(menu, "&File");
|
||||
|
||||
SetMenuBar( menu_bar );
|
||||
|
||||
@ -603,7 +603,7 @@ MySimpleSizerFrame::MySimpleSizerFrame(wxFrame* parent)
|
||||
m_target = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, wxDefaultCoord ) );
|
||||
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);
|
||||
|
||||
@ -636,30 +636,30 @@ MyNestedSizerFrame::MyNestedSizerFrame(wxFrame* parent)
|
||||
{
|
||||
wxMenu *menu = new wxMenu;
|
||||
|
||||
menu->Append(wxID_ABOUT, wxT("Do nothing"));
|
||||
menu->Append(wxID_ABOUT, "Do nothing");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
menu_bar->Append(menu, wxT("&File"));
|
||||
menu_bar->Append(menu, "&File");
|
||||
|
||||
SetMenuBar( menu_bar );
|
||||
|
||||
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, wxT("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, 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, "Hello outside" ), 0, wxALIGN_CENTER );
|
||||
main_sizer->Add( new wxStaticText( this, -1, "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,
|
||||
wxTAB_TRAVERSAL | wxSUNKEN_BORDER );
|
||||
main_sizer->Add( panel, 0, wxALIGN_CENTER );
|
||||
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
|
||||
panel->SetSizer( panel_sizer );
|
||||
panel_sizer->Add( new wxStaticText( panel, -1, wxT("Hello inside") ) );
|
||||
panel_sizer->Add( new wxStaticText( panel, -1, wxT("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, "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 ) );
|
||||
main_sizer->Add( m_target, 1, wxALL|wxGROW, 5 );
|
||||
|
@ -307,7 +307,7 @@ public:
|
||||
kNewItem.SetData(new wxString(szString));
|
||||
|
||||
this->InsertItem(kNewItem);
|
||||
this->SetItem(nID, 0, wxT("*"));
|
||||
this->SetItem(nID, 0, "*");
|
||||
this->SetItem(nID, 1, wxFileName(szString).GetName());
|
||||
|
||||
if (nID % 2)
|
||||
@ -381,17 +381,17 @@ public:
|
||||
// Converts a wxMediaCtrl state into something useful that we can display
|
||||
// to the user
|
||||
// ----------------------------------------------------------------------------
|
||||
const wxChar* wxGetMediaStateText(int nState)
|
||||
const wxString wxGetMediaStateText(int nState)
|
||||
{
|
||||
switch(nState)
|
||||
{
|
||||
case wxMEDIASTATE_PLAYING:
|
||||
return wxT("Playing");
|
||||
return "Playing";
|
||||
case wxMEDIASTATE_STOPPED:
|
||||
return wxT("Stopped");
|
||||
return "Stopped";
|
||||
///case wxMEDIASTATE_PAUSED:
|
||||
default:
|
||||
return wxT("Paused");
|
||||
return "Paused";
|
||||
}
|
||||
}
|
||||
|
||||
@ -456,10 +456,10 @@ bool wxMediaPlayerApp::OnInit()
|
||||
return false;
|
||||
|
||||
// SetAppName() lets wxConfig and others know where to write
|
||||
SetAppName(wxT("wxMediaPlayer"));
|
||||
SetAppName("wxMediaPlayer");
|
||||
|
||||
wxMediaPlayerFrame *frame =
|
||||
new wxMediaPlayerFrame(wxT("MediaPlayer wxWidgets Sample"));
|
||||
new wxMediaPlayerFrame("MediaPlayer wxWidgets Sample");
|
||||
frame->Show(true);
|
||||
|
||||
#if wxUSE_CMDLINE_PARSER
|
||||
@ -516,50 +516,50 @@ wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title)
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
wxMenu *debugMenu = new wxMenu;
|
||||
|
||||
fileMenu->Append(wxID_OPENFILESAMEPAGE, wxT("&Open File\tCtrl-Shift-O"),
|
||||
wxT("Open a File in the current notebook page"));
|
||||
fileMenu->Append(wxID_OPENFILENEWPAGE, wxT("&Open File in a new page"),
|
||||
wxT("Open a File in a new notebook page"));
|
||||
fileMenu->Append(wxID_OPENURLSAMEPAGE, wxT("&Open URL"),
|
||||
wxT("Open a URL in the current notebook page"));
|
||||
fileMenu->Append(wxID_OPENURLNEWPAGE, wxT("&Open URL in a new page"),
|
||||
wxT("Open a URL in a new notebook page"));
|
||||
fileMenu->Append(wxID_OPENFILESAMEPAGE, "&Open File\tCtrl-Shift-O",
|
||||
"Open a File in the current notebook page");
|
||||
fileMenu->Append(wxID_OPENFILENEWPAGE, "&Open File in a new page",
|
||||
"Open a File in a new notebook page");
|
||||
fileMenu->Append(wxID_OPENURLSAMEPAGE, "&Open URL",
|
||||
"Open a URL in the current notebook page");
|
||||
fileMenu->Append(wxID_OPENURLNEWPAGE, "&Open URL in a new page",
|
||||
"Open a URL in a new notebook page");
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append(wxID_CLOSECURRENTPAGE, wxT("&Close Current Page\tCtrl-C"),
|
||||
wxT("Close current notebook page"));
|
||||
fileMenu->Append(wxID_CLOSECURRENTPAGE, "&Close Current Page\tCtrl-C",
|
||||
"Close current notebook page");
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append(wxID_EXIT,
|
||||
wxT("E&xit\tAlt-X"),
|
||||
wxT("Quit this program"));
|
||||
"E&xit\tAlt-X",
|
||||
"Quit this program");
|
||||
|
||||
controlsMenu->Append(wxID_PLAY, wxT("&Play/Pause\tCtrl-P"), wxT("Resume/Pause playback"));
|
||||
controlsMenu->Append(wxID_STOP, wxT("&Stop\tCtrl-S"), wxT("Stop playback"));
|
||||
controlsMenu->Append(wxID_PLAY, "&Play/Pause\tCtrl-P", "Resume/Pause playback");
|
||||
controlsMenu->Append(wxID_STOP, "&Stop\tCtrl-S", "Stop playback");
|
||||
controlsMenu->AppendSeparator();
|
||||
controlsMenu->Append(wxID_PREV, wxT("&Previous\tCtrl-B"), wxT("Go to previous track"));
|
||||
controlsMenu->Append(wxID_NEXT, wxT("&Next\tCtrl-N"), wxT("Skip to next track"));
|
||||
controlsMenu->Append(wxID_PREV, "&Previous\tCtrl-B", "Go to previous track");
|
||||
controlsMenu->Append(wxID_NEXT, "&Next\tCtrl-N", "Skip to next track");
|
||||
|
||||
optionsMenu->AppendCheckItem(wxID_LOOP,
|
||||
wxT("&Loop\tCtrl-L"),
|
||||
wxT("Loop Selected Media"));
|
||||
"&Loop\tCtrl-L",
|
||||
"Loop Selected Media");
|
||||
optionsMenu->AppendCheckItem(wxID_SHOWINTERFACE,
|
||||
wxT("&Show Interface\tCtrl-I"),
|
||||
wxT("Show wxMediaCtrl native controls"));
|
||||
"&Show Interface\tCtrl-I",
|
||||
"Show wxMediaCtrl native controls");
|
||||
|
||||
debugMenu->Append(wxID_SELECTBACKEND,
|
||||
wxT("&Select Backend...\tCtrl-D"),
|
||||
wxT("Select a backend manually"));
|
||||
"&Select Backend...\tCtrl-D",
|
||||
"Select a backend manually");
|
||||
|
||||
helpMenu->Append(wxID_ABOUT,
|
||||
wxT("&About\tF1"),
|
||||
wxT("Show about dialog"));
|
||||
"&About\tF1",
|
||||
"Show about dialog");
|
||||
|
||||
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(fileMenu, wxT("&File"));
|
||||
menuBar->Append(controlsMenu, wxT("&Controls"));
|
||||
menuBar->Append(optionsMenu, wxT("&Options"));
|
||||
menuBar->Append(debugMenu, wxT("&Debug"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
menuBar->Append(controlsMenu, "&Controls");
|
||||
menuBar->Append(optionsMenu, "&Options");
|
||||
menuBar->Append(debugMenu, "&Debug");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
//
|
||||
@ -633,7 +633,7 @@ wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title)
|
||||
wxMediaPlayerNotebookPage* page =
|
||||
new wxMediaPlayerNotebookPage(this, m_notebook);
|
||||
m_notebook->AddPage(page,
|
||||
wxT(""),
|
||||
"",
|
||||
true);
|
||||
|
||||
|
||||
@ -760,24 +760,24 @@ void wxMediaPlayerFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void wxMediaPlayerFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
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, ")
|
||||
wxT("which you can change by dragging and releasing it.\n")
|
||||
"The top slider shows the current the current position, "
|
||||
"which you can change by dragging and releasing it.\n"
|
||||
|
||||
wxT("The gauge (progress bar) shows the progress in ")
|
||||
wxT("downloading data of the current file - it may always be ")
|
||||
wxT("empty due to lack of support from the current backend.\n")
|
||||
"The gauge (progress bar) shows the progress in "
|
||||
"downloading data of the current file - it may always be "
|
||||
"empty due to lack of support from the current backend.\n"
|
||||
|
||||
wxT("The lower-left slider controls the volume and the lower-")
|
||||
wxT("right slider controls the playback rate/speed of the ")
|
||||
wxT("media\n\n")
|
||||
"The lower-left slider controls the volume and the lower-"
|
||||
"right slider controls the playback rate/speed of the "
|
||||
"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);
|
||||
}
|
||||
|
||||
@ -816,9 +816,9 @@ void wxMediaPlayerFrame::OnShowInterface(wxCommandEvent& event)
|
||||
pSIItem->Check(!event.IsChecked());
|
||||
|
||||
if(event.IsChecked())
|
||||
wxMessageBox(wxT("Could not show player controls"));
|
||||
wxMessageBox("Could not show player controls");
|
||||
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));
|
||||
|
||||
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());
|
||||
|
||||
if (nID % 2)
|
||||
@ -931,12 +931,12 @@ void wxMediaPlayerFrame::DoPlayFile(const wxString& path)
|
||||
if(currentpage->m_mediactrl->GetState() == wxMEDIASTATE_PLAYING)
|
||||
{
|
||||
if( !currentpage->m_mediactrl->Pause() )
|
||||
wxMessageBox(wxT("Couldn't pause movie!"));
|
||||
wxMessageBox("Couldn't pause movie!");
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !currentpage->m_mediactrl->Play() )
|
||||
wxMessageBox(wxT("Couldn't play movie!"));
|
||||
wxMessageBox("Couldn't play movie!");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -948,31 +948,31 @@ void wxMediaPlayerFrame::DoPlayFile(const wxString& path)
|
||||
|
||||
if(currentpage->m_nLastFileId != -1)
|
||||
currentpage->m_playlist->SetItem(
|
||||
currentpage->m_nLastFileId, 0, wxT("*"));
|
||||
currentpage->m_nLastFileId, 0, "*");
|
||||
|
||||
wxURI uripath(path);
|
||||
if( uripath.IsReference() )
|
||||
{
|
||||
if( !currentpage->m_mediactrl->Load(path) )
|
||||
{
|
||||
wxMessageBox(wxT("Couldn't load file!"));
|
||||
currentpage->m_playlist->SetItem(nNewId, 0, wxT("E"));
|
||||
wxMessageBox("Couldn't load file!");
|
||||
currentpage->m_playlist->SetItem(nNewId, 0, "E");
|
||||
}
|
||||
else
|
||||
{
|
||||
currentpage->m_playlist->SetItem(nNewId, 0, wxT("O"));
|
||||
currentpage->m_playlist->SetItem(nNewId, 0, "O");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !currentpage->m_mediactrl->Load(uripath) )
|
||||
{
|
||||
wxMessageBox(wxT("Couldn't load URL!"));
|
||||
currentpage->m_playlist->SetItem(nNewId, 0, wxT("E"));
|
||||
wxMessageBox("Couldn't load URL!");
|
||||
currentpage->m_playlist->SetItem(nNewId, 0, "E");
|
||||
}
|
||||
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,
|
||||
1, wxFileName(path).GetName());
|
||||
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() )
|
||||
{
|
||||
wxMessageBox(wxT("Couldn't play movie!"));
|
||||
currentpage->m_playlist->SetItem(currentpage->m_nLastFileId, 0, wxT("E"));
|
||||
wxMessageBox("Couldn't play movie!");
|
||||
currentpage->m_playlist->SetItem(currentpage->m_nLastFileId, 0, "E");
|
||||
}
|
||||
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))
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -1031,7 +1031,7 @@ void wxMediaPlayerFrame::OnSelectBackend(wxCommandEvent& WXUNUSED(evt))
|
||||
|
||||
m_notebook->AddPage(new wxMediaPlayerNotebookPage(this, m_notebook,
|
||||
sBackend
|
||||
), wxT(""), true);
|
||||
), "", true);
|
||||
|
||||
DoOpenFile(
|
||||
((wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage())->m_szFile,
|
||||
@ -1070,7 +1070,7 @@ void wxMediaPlayerFrame::OnOpenURLNewPage(wxCommandEvent& WXUNUSED(event))
|
||||
void wxMediaPlayerFrame::OpenURL(bool bNewPage)
|
||||
{
|
||||
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
|
||||
@ -1101,7 +1101,7 @@ void wxMediaPlayerFrame::OnCloseCurrentPage(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
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)
|
||||
{
|
||||
// no items in list
|
||||
wxMessageBox(wxT("No items in playlist!"));
|
||||
wxMessageBox("No items in playlist!");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1194,10 +1194,10 @@ void wxMediaPlayerFrame::OnStop(wxCommandEvent& WXUNUSED(evt))
|
||||
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
|
||||
|
||||
if( !currentpage->m_mediactrl->Stop() )
|
||||
wxMessageBox(wxT("Couldn't stop movie!"));
|
||||
wxMessageBox("Couldn't stop movie!");
|
||||
else
|
||||
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())
|
||||
DoPlayFile((*((wxString*) listitem.GetData())));
|
||||
else
|
||||
wxMessageBox(wxT("No selected item!"));
|
||||
wxMessageBox("No selected item!");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1385,7 +1385,7 @@ void wxMediaPlayerTimer::Notify()
|
||||
|
||||
// Duration string (i.e. MM:SS)
|
||||
wxString sDuration;
|
||||
sDuration.Printf(wxT("%2i:%02i"), nMinutes, nSeconds);
|
||||
sDuration.Printf("%2i:%02i", nMinutes, nSeconds);
|
||||
|
||||
|
||||
// Number of minutes/seconds total
|
||||
@ -1395,7 +1395,7 @@ void wxMediaPlayerTimer::Notify()
|
||||
|
||||
// Position string (i.e. MM:SS)
|
||||
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
|
||||
@ -1433,9 +1433,9 @@ void wxMediaPlayerTimer::Notify()
|
||||
// hold various metadata about the media
|
||||
#if wxUSE_STATUSBAR
|
||||
m_frame->SetStatusText(wxString::Format(
|
||||
wxT("Size(x,y):%i,%i ")
|
||||
wxT("Position:%s/%s Speed:%1.1fx ")
|
||||
wxT("State:%s Loops:%i D/T:[%i]/[%i] V:%i%%"),
|
||||
"Size(x,y):%i,%i "
|
||||
"Position:%s/%s Speed:%1.1fx "
|
||||
"State:%s Loops:%i D/T:[%i]/[%i] V:%i%%",
|
||||
videoSize.x,
|
||||
videoSize.y,
|
||||
sPosition.c_str(),
|
||||
@ -1498,13 +1498,13 @@ wxMediaPlayerNotebookPage::wxMediaPlayerNotebookPage(wxMediaPlayerFrame* parentF
|
||||
wxDefaultPosition, wxDefaultSize, 0,
|
||||
// you could specify a macro backend here like
|
||||
// wxMEDIABACKEND_WMP10);
|
||||
// wxT("wxPDFMediaBackend"));
|
||||
// "wxPDFMediaBackend");
|
||||
szBackend);
|
||||
// you could change the cursor here like
|
||||
// m_mediactrl->SetCursor(wxCURSOR_BLANK);
|
||||
// note that this may not effect it if SetPlayerControls
|
||||
// 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);
|
||||
|
||||
sizer->Add(m_mediactrl, wxSizerFlags().Expand().Border());
|
||||
@ -1561,17 +1561,17 @@ wxMediaPlayerNotebookPage::wxMediaPlayerNotebookPage(wxMediaPlayerFrame* parentF
|
||||
m_vdButton = new wxButton();
|
||||
m_vuButton = new wxButton();
|
||||
|
||||
m_prevButton->Create(this, wxID_BUTTONPREV, wxT("|<"));
|
||||
m_prevButton->Create(this, wxID_BUTTONPREV, "|<");
|
||||
m_prevButton->SetToolTip("Previous");
|
||||
m_playButton->Create(this, wxID_BUTTONPLAY, wxT(">"));
|
||||
m_playButton->Create(this, wxID_BUTTONPLAY, ">");
|
||||
m_playButton->SetToolTip("Play");
|
||||
m_stopButton->Create(this, wxID_BUTTONSTOP, wxT("[]"));
|
||||
m_stopButton->Create(this, wxID_BUTTONSTOP, "[]");
|
||||
m_stopButton->SetToolTip("Stop");
|
||||
m_nextButton->Create(this, wxID_BUTTONNEXT, wxT(">|"));
|
||||
m_nextButton->Create(this, wxID_BUTTONNEXT, ">|");
|
||||
m_nextButton->SetToolTip("Next");
|
||||
m_vdButton->Create(this, wxID_BUTTONVD, wxT("(("));
|
||||
m_vdButton->Create(this, wxID_BUTTONVD, "((");
|
||||
m_vdButton->SetToolTip("Volume down");
|
||||
m_vuButton->Create(this, wxID_BUTTONVU, wxT("))"));
|
||||
m_vuButton->Create(this, wxID_BUTTONVU, "))");
|
||||
m_vuButton->SetToolTip("Volume up");
|
||||
|
||||
vertsizer->Add(m_prevButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
@ -1699,7 +1699,7 @@ void wxMediaPlayerNotebookPage::OnEndSeek(wxScrollEvent& WXUNUSED(event))
|
||||
if( m_mediactrl->Seek(
|
||||
m_slider->GetValue() * 1000
|
||||
) == wxInvalidOffset )
|
||||
wxMessageBox(wxT("Couldn't seek in movie!"));
|
||||
wxMessageBox("Couldn't seek in movie!");
|
||||
|
||||
m_bIsBeingDragged = false;
|
||||
}
|
||||
@ -1724,7 +1724,7 @@ void wxMediaPlayerNotebookPage::OnVolChange(wxScrollEvent& WXUNUSED(event))
|
||||
if( m_mediactrl->SetVolume(
|
||||
m_volSlider->GetValue() / 100.0
|
||||
) == 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(
|
||||
m_pbSlider->GetValue() * .25
|
||||
) == 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))
|
||||
{
|
||||
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))
|
||||
{
|
||||
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))
|
||||
{
|
||||
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() )
|
||||
{
|
||||
wxMessageBox(wxT("Couldn't loop movie!"));
|
||||
m_playlist->SetItem(m_nLastFileId, 0, wxT("E"));
|
||||
wxMessageBox("Couldn't loop movie!");
|
||||
m_playlist->SetItem(m_nLastFileId, 0, "E");
|
||||
}
|
||||
else
|
||||
++m_nLoops;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_playlist->SetItem(m_nLastFileId, 0, wxT("[]"));
|
||||
m_playlist->SetItem(m_nLastFileId, 0, "[]");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,15 +67,15 @@ bool MyApp::OnInit(void)
|
||||
// Make a menubar
|
||||
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;
|
||||
menu_bar->Append(file_menu, wxT("File"));
|
||||
menu_bar->Append(file_menu, "File");
|
||||
frame->SetMenuBar(menu_bar);
|
||||
|
||||
// Make a panel with a message
|
||||
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
|
||||
frame->Show(true);
|
||||
@ -126,7 +126,7 @@ wxEND_EVENT_TABLE()
|
||||
|
||||
// My frame constructor
|
||||
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
|
||||
|
@ -140,19 +140,19 @@ protected:
|
||||
void OnMenuOpen(wxMenuEvent& event)
|
||||
{
|
||||
#if USE_LOG_WINDOW
|
||||
LogMenuOpenCloseOrHighlight(event, wxT("opened")); event.Skip();
|
||||
LogMenuOpenCloseOrHighlight(event, "opened"); event.Skip();
|
||||
#endif
|
||||
}
|
||||
void OnMenuClose(wxMenuEvent& event)
|
||||
{
|
||||
#if USE_LOG_WINDOW
|
||||
LogMenuOpenCloseOrHighlight(event, wxT("closed")); event.Skip();
|
||||
LogMenuOpenCloseOrHighlight(event, "closed"); event.Skip();
|
||||
#endif
|
||||
}
|
||||
void OnMenuHighlight(wxMenuEvent& event)
|
||||
{
|
||||
#if USE_LOG_WINDOW
|
||||
LogMenuOpenCloseOrHighlight(event, wxT("highlighted")); event.Skip();
|
||||
LogMenuOpenCloseOrHighlight(event, "highlighted"); event.Skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ protected:
|
||||
|
||||
private:
|
||||
#if USE_LOG_WINDOW
|
||||
void LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxChar *what);
|
||||
void LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxString& what);
|
||||
#endif
|
||||
void ShowContextMenu(const wxPoint& pos);
|
||||
|
||||
@ -202,25 +202,25 @@ public:
|
||||
void OnMenuOpen(wxMenuEvent& event)
|
||||
{
|
||||
#if USE_LOG_WINDOW
|
||||
LogMenuOpenCloseOrHighlight(event, wxT("opened")); event.Skip();
|
||||
LogMenuOpenCloseOrHighlight(event, "opened"); event.Skip();
|
||||
#endif
|
||||
}
|
||||
void OnMenuClose(wxMenuEvent& event)
|
||||
{
|
||||
#if USE_LOG_WINDOW
|
||||
LogMenuOpenCloseOrHighlight(event, wxT("closed")); event.Skip();
|
||||
LogMenuOpenCloseOrHighlight(event, "closed"); event.Skip();
|
||||
#endif
|
||||
}
|
||||
void OnMenuHighlight(wxMenuEvent& event)
|
||||
{
|
||||
#if USE_LOG_WINDOW
|
||||
LogMenuOpenCloseOrHighlight(event, wxT("highlighted")); event.Skip();
|
||||
LogMenuOpenCloseOrHighlight(event, "highlighted"); event.Skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
#if USE_LOG_WINDOW
|
||||
void LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxChar *what);
|
||||
void LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxString& what);
|
||||
#endif
|
||||
void ShowContextMenu(const wxPoint& pos);
|
||||
|
||||
@ -429,7 +429,7 @@ bool MyApp::OnInit()
|
||||
frame->Show(true);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
frame->SetStatusText(wxT("Welcome to wxWidgets menu sample"));
|
||||
frame->SetStatusText("Welcome to wxWidgets menu sample");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
return true;
|
||||
@ -441,7 +441,7 @@ bool MyApp::OnInit()
|
||||
|
||||
// Define my frame constructor
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame((wxFrame *)NULL, wxID_ANY, wxT("wxWidgets menu sample"))
|
||||
: wxFrame((wxFrame *)NULL, wxID_ANY, "wxWidgets menu sample")
|
||||
{
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
@ -528,87 +528,87 @@ MyFrame::MyFrame()
|
||||
stockSubMenu->Append(wxID_ZOOM_FIT);
|
||||
stockSubMenu->Append(wxID_ZOOM_IN);
|
||||
stockSubMenu->Append(wxID_ZOOM_OUT);
|
||||
fileMenu->AppendSubMenu(stockSubMenu, wxT("&Standard items demo"));
|
||||
fileMenu->AppendSubMenu(stockSubMenu, "&Standard items demo");
|
||||
|
||||
#if USE_LOG_WINDOW
|
||||
wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog,
|
||||
wxT("Clear &log\tCtrl-L"));
|
||||
"Clear &log\tCtrl-L");
|
||||
item->SetBitmap(copy_xpm);
|
||||
fileMenu->Append(item);
|
||||
fileMenu->AppendSeparator();
|
||||
#endif // USE_LOG_WINDOW
|
||||
|
||||
fileMenu->Append(Menu_File_ShowDialog, wxT("Show &Dialog\tCtrl-D"),
|
||||
wxT("Show a dialog"));
|
||||
fileMenu->Append(Menu_File_ShowDialog, "Show &Dialog\tCtrl-D",
|
||||
"Show a dialog");
|
||||
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;
|
||||
menubarMenu->Append(Menu_MenuBar_Append, wxT("&Append menu\tCtrl-A"),
|
||||
wxT("Append a menu to the menubar"));
|
||||
menubarMenu->Append(Menu_MenuBar_Insert, wxT("&Insert menu\tCtrl-I"),
|
||||
wxT("Insert a menu into the menubar"));
|
||||
menubarMenu->Append(Menu_MenuBar_Delete, wxT("&Delete menu\tCtrl-D"),
|
||||
wxT("Delete the last menu from the menubar"));
|
||||
menubarMenu->Append(Menu_MenuBar_Toggle, wxT("&Toggle menu\tCtrl-T"),
|
||||
wxT("Toggle the first menu in the menubar"), true);
|
||||
menubarMenu->Append(Menu_MenuBar_Append, "&Append menu\tCtrl-A",
|
||||
"Append a menu to the menubar");
|
||||
menubarMenu->Append(Menu_MenuBar_Insert, "&Insert menu\tCtrl-I",
|
||||
"Insert a menu into the menubar");
|
||||
menubarMenu->Append(Menu_MenuBar_Delete, "&Delete menu\tCtrl-D",
|
||||
"Delete the last menu from the menubar");
|
||||
menubarMenu->Append(Menu_MenuBar_Toggle, "&Toggle menu\tCtrl-T",
|
||||
"Toggle the first menu in the menubar", true);
|
||||
menubarMenu->AppendSeparator();
|
||||
menubarMenu->Append(Menu_MenuBar_Enable, wxT("&Enable menu\tCtrl-E"),
|
||||
wxT("Enable or disable the last menu"), true);
|
||||
menubarMenu->Append(Menu_MenuBar_Enable, "&Enable menu\tCtrl-E",
|
||||
"Enable or disable the last menu", true);
|
||||
menubarMenu->AppendSeparator();
|
||||
menubarMenu->Append(Menu_MenuBar_GetLabel, wxT("&Get menu label\tCtrl-G"),
|
||||
wxT("Get the label of the last menu"));
|
||||
menubarMenu->Append(Menu_MenuBar_GetLabel, "&Get menu label\tCtrl-G",
|
||||
"Get the label of the last menu");
|
||||
#if wxUSE_TEXTDLG
|
||||
menubarMenu->Append(Menu_MenuBar_SetLabel, wxT("&Set menu label\tCtrl-S"),
|
||||
wxT("Change the label of the last menu"));
|
||||
menubarMenu->Append(Menu_MenuBar_SetLabel, "&Set menu label\tCtrl-S",
|
||||
"Change the label of the last menu");
|
||||
menubarMenu->AppendSeparator();
|
||||
menubarMenu->Append(Menu_MenuBar_FindMenu, wxT("&Find menu from label\tCtrl-F"),
|
||||
wxT("Find a menu by searching for its label"));
|
||||
menubarMenu->Append(Menu_MenuBar_FindMenu, "&Find menu from label\tCtrl-F",
|
||||
"Find a menu by searching for its label");
|
||||
#endif
|
||||
|
||||
wxMenu* subMenu = new wxMenu;
|
||||
subMenu->Append(Menu_SubMenu_Normal, wxT("&Normal submenu item"), wxT("Disabled submenu item"));
|
||||
subMenu->AppendCheckItem(Menu_SubMenu_Check, wxT("&Check submenu item"), wxT("Check submenu item"));
|
||||
subMenu->AppendRadioItem(Menu_SubMenu_Radio1, wxT("Radio item &1"), wxT("Radio item"));
|
||||
subMenu->AppendRadioItem(Menu_SubMenu_Radio2, wxT("Radio item &2"), wxT("Radio item"));
|
||||
subMenu->AppendRadioItem(Menu_SubMenu_Radio3, wxT("Radio item &3"), wxT("Radio item"));
|
||||
subMenu->Append(Menu_SubMenu_Normal, "&Normal submenu item", "Disabled submenu item");
|
||||
subMenu->AppendCheckItem(Menu_SubMenu_Check, "&Check submenu item", "Check submenu item");
|
||||
subMenu->AppendRadioItem(Menu_SubMenu_Radio1, "Radio item &1", "Radio item");
|
||||
subMenu->AppendRadioItem(Menu_SubMenu_Radio2, "Radio item &2", "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;
|
||||
menuMenu->Append(Menu_Menu_Append, wxT("&Append menu item\tAlt-A"),
|
||||
wxT("Append a menu item to the 'Test' menu"));
|
||||
menuMenu->Append(Menu_Menu_AppendSub, wxT("&Append sub menu\tAlt-S"),
|
||||
wxT("Append a sub menu to the 'Test' menu"));
|
||||
menuMenu->Append(Menu_Menu_Insert, wxT("&Insert menu item\tAlt-I"),
|
||||
wxT("Insert a menu item in head of the 'Test' menu"));
|
||||
menuMenu->Append(Menu_Menu_Delete, wxT("&Delete menu item\tAlt-D"),
|
||||
wxT("Delete the last menu item from the 'Test' menu"));
|
||||
menuMenu->Append(Menu_Menu_DeleteSub, wxT("Delete last &submenu\tAlt-K"),
|
||||
wxT("Delete the last submenu from the 'Test' menu"));
|
||||
menuMenu->Append(Menu_Menu_Append, "&Append menu item\tAlt-A",
|
||||
"Append a menu item to the 'Test' menu");
|
||||
menuMenu->Append(Menu_Menu_AppendSub, "&Append sub menu\tAlt-S",
|
||||
"Append a sub menu to the 'Test' menu");
|
||||
menuMenu->Append(Menu_Menu_Insert, "&Insert menu item\tAlt-I",
|
||||
"Insert a menu item in head of the 'Test' menu");
|
||||
menuMenu->Append(Menu_Menu_Delete, "&Delete menu item\tAlt-D",
|
||||
"Delete the last menu item from the 'Test' menu");
|
||||
menuMenu->Append(Menu_Menu_DeleteSub, "Delete last &submenu\tAlt-K",
|
||||
"Delete the last submenu from the 'Test' menu");
|
||||
menuMenu->AppendSeparator();
|
||||
menuMenu->Append(Menu_Menu_Enable, wxT("&Enable menu item\tAlt-E"),
|
||||
wxT("Enable or disable the last menu item"), true);
|
||||
menuMenu->Append(Menu_Menu_Check, wxT("&Check menu item\tAlt-C"),
|
||||
wxT("Check or uncheck the last menu item"), true);
|
||||
menuMenu->Append(Menu_Menu_Enable, "&Enable menu item\tAlt-E",
|
||||
"Enable or disable the last menu item", true);
|
||||
menuMenu->Append(Menu_Menu_Check, "&Check menu item\tAlt-C",
|
||||
"Check or uncheck the last menu item", true);
|
||||
menuMenu->AppendSeparator();
|
||||
menuMenu->Append(Menu_Menu_GetInfo, wxT("Get menu item in&fo\tAlt-F"),
|
||||
wxT("Show the state of the last menu item"));
|
||||
menuMenu->Append(Menu_Menu_GetInfo, "Get menu item in&fo\tAlt-F",
|
||||
"Show the state of the last menu item");
|
||||
#if wxUSE_TEXTDLG
|
||||
menuMenu->Append(Menu_Menu_SetLabel, wxT("Set menu item label\tAlt-L"),
|
||||
wxT("Set the label of a menu item"));
|
||||
menuMenu->Append(Menu_Menu_SetLabel, "Set menu item label\tAlt-L",
|
||||
"Set the label of a menu item");
|
||||
#endif
|
||||
#if wxUSE_TEXTDLG
|
||||
menuMenu->AppendSeparator();
|
||||
menuMenu->Append(Menu_Menu_FindItem, wxT("Find menu item from label"),
|
||||
wxT("Find a menu item by searching for its label"));
|
||||
menuMenu->Append(Menu_Menu_FindItem, "Find menu item from label",
|
||||
"Find a menu item by searching for its label");
|
||||
#endif
|
||||
|
||||
wxMenu *testMenu = new wxMenu;
|
||||
testMenu->Append(Menu_Test_Normal, wxT("&Normal item"));
|
||||
testMenu->Append(Menu_Test_Normal, "&Normal item");
|
||||
testMenu->AppendSeparator();
|
||||
testMenu->AppendCheckItem(Menu_Test_Check, wxT("&Check item"));
|
||||
testMenu->AppendCheckItem(Menu_Test_Check, "&Check item");
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#if wxUSE_IMAGE
|
||||
@ -637,20 +637,20 @@ MyFrame::MyFrame()
|
||||
#endif
|
||||
|
||||
testMenu->AppendSeparator();
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio1, wxT("Radio item &1"));
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio2, wxT("Radio item &2"));
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio3, wxT("Radio item &3"));
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio1, "Radio item &1");
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio2, "Radio item &2");
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio3, "Radio item &3");
|
||||
|
||||
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 );
|
||||
|
||||
menuBar->Append(fileMenu, wxT("&File"));
|
||||
menuBar->Append(menubarMenu, wxT("Menu&bar"));
|
||||
menuBar->Append(menuMenu, wxT("&Menu"));
|
||||
menuBar->Append(testMenu, wxT("&Test"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
menuBar->Append(menubarMenu, "Menu&bar");
|
||||
menuBar->Append(menuMenu, "&Menu");
|
||||
menuBar->Append(testMenu, "&Test");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// these items should be initially checked
|
||||
menuBar->Check(Menu_MenuBar_Toggle, true);
|
||||
@ -677,8 +677,8 @@ MyFrame::MyFrame()
|
||||
wxLogMessage(wxT("Brief explanations: the commands in the \"Menu\" menu ")
|
||||
wxT("append/insert/delete items to/from the \"Test\" menu.\n")
|
||||
wxT("The commands in the \"Menubar\" menu work with the ")
|
||||
wxT("menubar itself.\n\n")
|
||||
wxT("Right click the band below to test popup menus.\n"));
|
||||
"menubar itself.\n\n"
|
||||
"Right click the band below to test popup menus.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -698,13 +698,13 @@ MyFrame::~MyFrame()
|
||||
wxMenu *MyFrame::CreateDummyMenu(wxString *title)
|
||||
{
|
||||
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->AppendCheckItem(Menu_Dummy_Second, wxT("&Second item\tCtrl-F2"));
|
||||
menu->AppendCheckItem(Menu_Dummy_Second, "&Second item\tCtrl-F2");
|
||||
|
||||
if ( title )
|
||||
{
|
||||
title->Printf(wxT("Dummy menu &%u"), (unsigned)++m_countDummy);
|
||||
title->Printf("Dummy menu &%u", (unsigned)++m_countDummy);
|
||||
}
|
||||
|
||||
return menu;
|
||||
@ -714,12 +714,12 @@ wxMenuItem *MyFrame::GetLastMenuItem() const
|
||||
{
|
||||
wxMenuBar *menubar = GetMenuBar();
|
||||
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();
|
||||
if ( !node )
|
||||
{
|
||||
wxLogWarning(wxT("No last item in the 'Test' menu!"));
|
||||
wxLogWarning("No last item in the 'Test' menu!");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -733,15 +733,15 @@ void MyFrame::LogMenuEvent(const wxCommandEvent& event)
|
||||
{
|
||||
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
|
||||
// menu
|
||||
wxMenuItem *item = GetMenuBar()->FindItem(id);
|
||||
if ( (item && item->IsCheckable()) || id == Menu_Popup_ToBeChecked )
|
||||
{
|
||||
msg += wxString::Format(wxT(" (the item is currently %schecked)"),
|
||||
event.IsChecked() ? wxT("") : wxT("not "));
|
||||
msg += wxString::Format(" (the item is currently %schecked)",
|
||||
event.IsChecked() ? "" : "not ");
|
||||
}
|
||||
|
||||
wxLogMessage(msg);
|
||||
@ -781,8 +781,8 @@ void MyFrame::OnShowDialog(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
(void)wxMessageBox(wxT("wxWidgets menu sample\n(c) 1999-2001 Vadim Zeitlin"),
|
||||
wxT("About wxWidgets menu sample"),
|
||||
(void)wxMessageBox("wxWidgets menu sample\n(c) 1999-2001 Vadim Zeitlin",
|
||||
"About wxWidgets menu sample",
|
||||
wxOK | wxICON_INFORMATION);
|
||||
}
|
||||
|
||||
@ -794,7 +794,7 @@ void MyFrame::OnDeleteMenu(wxCommandEvent& WXUNUSED(event))
|
||||
if ( count == 4 )
|
||||
{
|
||||
// don't let delete the first 4 menus
|
||||
wxLogError(wxT("Can't delete any more menus"));
|
||||
wxLogError("Can't delete any more menus");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -829,7 +829,7 @@ void MyFrame::OnToggleMenu(wxCommandEvent& WXUNUSED(event))
|
||||
else
|
||||
{
|
||||
// restore it
|
||||
mbar->Insert(0, m_menu, wxT("&File"));
|
||||
mbar->Insert(0, m_menu, "&File");
|
||||
m_menu = NULL;
|
||||
}
|
||||
}
|
||||
@ -847,9 +847,9 @@ void MyFrame::OnGetLabelMenu(wxCommandEvent& WXUNUSED(event))
|
||||
wxMenuBar *mbar = GetMenuBar();
|
||||
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());
|
||||
}
|
||||
|
||||
@ -859,12 +859,12 @@ void MyFrame::OnSetLabelMenu(wxCommandEvent& WXUNUSED(event))
|
||||
wxMenuBar *mbar = GetMenuBar();
|
||||
size_t count = mbar->GetMenuCount();
|
||||
|
||||
wxCHECK_RET( count, wxT("no last menu?") );
|
||||
wxCHECK_RET( count, "no last menu?" );
|
||||
|
||||
wxString label = wxGetTextFromUser
|
||||
(
|
||||
wxT("Enter new label: "),
|
||||
wxT("Change last menu text"),
|
||||
"Enter new label: ",
|
||||
"Change last menu text",
|
||||
mbar->GetMenuLabel(count - 1),
|
||||
this
|
||||
);
|
||||
@ -880,12 +880,12 @@ void MyFrame::OnFindMenu(wxCommandEvent& WXUNUSED(event))
|
||||
wxMenuBar *mbar = GetMenuBar();
|
||||
size_t count = mbar->GetMenuCount();
|
||||
|
||||
wxCHECK_RET( count, wxT("no last menu?") );
|
||||
wxCHECK_RET( count, "no last menu?" );
|
||||
|
||||
wxString label = wxGetTextFromUser
|
||||
(
|
||||
wxT("Enter label to search for: "),
|
||||
wxT("Find menu"),
|
||||
"Enter label to search for: ",
|
||||
"Find menu",
|
||||
wxEmptyString,
|
||||
this
|
||||
);
|
||||
@ -896,11 +896,11 @@ void MyFrame::OnFindMenu(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
if (index == wxNOT_FOUND)
|
||||
{
|
||||
wxLogWarning(wxT("No menu with label '%s'"), label.c_str());
|
||||
wxLogWarning("No menu with label '%s'", label.c_str());
|
||||
}
|
||||
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)
|
||||
{
|
||||
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))
|
||||
{
|
||||
wxMenuBar *menubar = GetMenuBar();
|
||||
wxMenu *menu = menubar->GetMenu(menubar->FindMenu("Test"));
|
||||
wxCHECK_RET( menu, wxT("no 'Test' menu?") );
|
||||
wxCHECK_RET( menu, "no 'Test' menu?" );
|
||||
|
||||
menu->AppendSeparator();
|
||||
menu->Append(Menu_Dummy_Third, wxT("&Third dummy item\tCtrl-F3"),
|
||||
wxT("Checkable item"), true);
|
||||
menu->Append(Menu_Dummy_Third, "&Third dummy item\tCtrl-F3",
|
||||
"Checkable item", true);
|
||||
}
|
||||
|
||||
void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMenuBar *menubar = GetMenuBar();
|
||||
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"),
|
||||
CreateDummyMenu(NULL), wxT("Dummy sub menu help"));
|
||||
menu->Append(Menu_Dummy_Last, "&Dummy sub menu",
|
||||
CreateDummyMenu(NULL), "Dummy sub menu help");
|
||||
}
|
||||
|
||||
void MyFrame::OnDeleteMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMenuBar *menubar = GetMenuBar();
|
||||
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();
|
||||
if ( !count )
|
||||
{
|
||||
wxLogWarning(wxT("No items to delete!"));
|
||||
wxLogWarning("No items to delete!");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -953,7 +953,7 @@ void MyFrame::OnDeleteSubMenu(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMenuBar *menubar = GetMenuBar();
|
||||
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 )
|
||||
{
|
||||
@ -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))
|
||||
{
|
||||
wxMenuBar *menubar = GetMenuBar();
|
||||
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,
|
||||
wxT("Fourth dummy item\tCtrl-F4")));
|
||||
"Fourth dummy item\tCtrl-F4"));
|
||||
menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR));
|
||||
}
|
||||
|
||||
@ -1015,7 +1015,7 @@ void MyFrame::OnGetLabelMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
if ( item )
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
@ -1029,12 +1029,12 @@ void MyFrame::OnSetLabelMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString label = wxGetTextFromUser
|
||||
(
|
||||
wxT("Enter new label: "),
|
||||
wxT("Change last menu item text"),
|
||||
"Enter new label: ",
|
||||
"Change last menu item text",
|
||||
item->GetItemLabel(),
|
||||
this
|
||||
);
|
||||
label.Replace( wxT("\\t"), wxT("\t") );
|
||||
label.Replace( "\\t", "\t" );
|
||||
|
||||
if ( !label.empty() )
|
||||
{
|
||||
@ -1051,29 +1051,29 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
|
||||
if ( item )
|
||||
{
|
||||
wxString msg;
|
||||
msg << wxT("The item is ") << (item->IsEnabled() ? wxT("enabled")
|
||||
: wxT("disabled"))
|
||||
<< wxT('\n');
|
||||
msg << "The item is " << (item->IsEnabled() ? "enabled"
|
||||
: "disabled")
|
||||
<< '\n';
|
||||
|
||||
if ( item->IsCheckable() )
|
||||
{
|
||||
msg << wxT("It is checkable and ") << (item->IsChecked() ? wxT("") : wxT("un"))
|
||||
<< wxT("checked\n");
|
||||
msg << "It is checkable and " << (item->IsChecked() ? "" : "un")
|
||||
<< "checked\n";
|
||||
}
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
wxAcceleratorEntry *accel = item->GetAccel();
|
||||
if ( accel )
|
||||
{
|
||||
msg << wxT("Its accelerator is ");
|
||||
msg << "Its accelerator is ";
|
||||
|
||||
int flags = accel->GetFlags();
|
||||
if ( flags & wxACCEL_ALT )
|
||||
msg << wxT("Alt-");
|
||||
msg << "Alt-";
|
||||
if ( flags & wxACCEL_CTRL )
|
||||
msg << wxT("Ctrl-");
|
||||
msg << "Ctrl-";
|
||||
if ( flags & wxACCEL_SHIFT )
|
||||
msg << wxT("Shift-");
|
||||
msg << "Shift-";
|
||||
|
||||
int code = accel->GetKeyCode();
|
||||
switch ( code )
|
||||
@ -1090,7 +1090,7 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
|
||||
case WXK_F10:
|
||||
case WXK_F11:
|
||||
case WXK_F12:
|
||||
msg << wxT('F') << code - WXK_F1 + 1;
|
||||
msg << 'F' << code - WXK_F1 + 1;
|
||||
break;
|
||||
|
||||
// if there are any other keys wxGetAccelFromString() may return,
|
||||
@ -1104,14 +1104,14 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
|
||||
break;
|
||||
}
|
||||
|
||||
wxFAIL_MSG( wxT("unknown keyboard accel") );
|
||||
wxFAIL_MSG( "unknown keyboard accel" );
|
||||
}
|
||||
|
||||
delete accel;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg << wxT("It doesn't have an accelerator");
|
||||
msg << "It doesn't have an accelerator";
|
||||
}
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
@ -1125,12 +1125,12 @@ void MyFrame::OnFindMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
wxMenuBar *mbar = GetMenuBar();
|
||||
size_t count = mbar->GetMenuCount();
|
||||
|
||||
wxCHECK_RET( count, wxT("no last menu?") );
|
||||
wxCHECK_RET( count, "no last menu?" );
|
||||
|
||||
wxString label = wxGetTextFromUser
|
||||
(
|
||||
wxT("Enter label to search for: "),
|
||||
wxT("Find menu item"),
|
||||
"Enter label to search for: ",
|
||||
"Find menu item",
|
||||
wxEmptyString,
|
||||
this
|
||||
);
|
||||
@ -1146,11 +1146,11 @@ void MyFrame::OnFindMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
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
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
@ -1183,14 +1183,14 @@ void MyFrame::ShowContextMenu(const wxPoint& pos)
|
||||
}
|
||||
else // normal case, shift not pressed
|
||||
{
|
||||
menu.Append(Menu_Help_About, wxT("&About"));
|
||||
menu.Append(Menu_Popup_Submenu, wxT("&Submenu"), CreateDummyMenu(NULL));
|
||||
menu.Append(Menu_Popup_ToBeDeleted, wxT("To be &deleted"));
|
||||
menu.AppendCheckItem(Menu_Popup_ToBeChecked, wxT("To be &checked"));
|
||||
menu.Append(Menu_Popup_ToBeGreyed, wxT("To be &greyed"),
|
||||
wxT("This menu item should be initially greyed out"));
|
||||
menu.Append(Menu_Help_About, "&About");
|
||||
menu.Append(Menu_Popup_Submenu, "&Submenu", CreateDummyMenu(NULL));
|
||||
menu.Append(Menu_Popup_ToBeDeleted, "To be &deleted");
|
||||
menu.AppendCheckItem(Menu_Popup_ToBeChecked, "To be &checked");
|
||||
menu.Append(Menu_Popup_ToBeGreyed, "To be &greyed",
|
||||
"This menu item should be initially greyed out");
|
||||
menu.AppendSeparator();
|
||||
menu.Append(Menu_File_Quit, wxT("E&xit"));
|
||||
menu.Append(Menu_File_Quit, "E&xit");
|
||||
|
||||
menu.Delete(Menu_Popup_ToBeDeleted);
|
||||
menu.Check(Menu_Popup_ToBeChecked, true);
|
||||
@ -1209,33 +1209,33 @@ void MyFrame::ShowContextMenu(const wxPoint& pos)
|
||||
|
||||
void MyFrame::OnTestNormal(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(wxT("Normal item selected"));
|
||||
wxLogMessage("Normal item selected");
|
||||
}
|
||||
|
||||
void MyFrame::OnTestCheck(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage(wxT("Check item %schecked"),
|
||||
event.IsChecked() ? wxT("") : wxT("un"));
|
||||
wxLogMessage("Check item %schecked",
|
||||
event.IsChecked() ? "" : "un");
|
||||
}
|
||||
|
||||
void MyFrame::OnTestRadio(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage(wxT("Radio item %d selected"),
|
||||
wxLogMessage("Radio item %d selected",
|
||||
event.GetId() - Menu_Test_Radio1 + 1);
|
||||
}
|
||||
|
||||
#if USE_LOG_WINDOW
|
||||
void MyFrame::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxChar *what)
|
||||
void MyFrame::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxString& what)
|
||||
{
|
||||
wxString msg;
|
||||
msg << wxT("A ")
|
||||
<< ( event.IsPopup() ? wxT("popup ") : wxT("") )
|
||||
<< wxT("menu has been ")
|
||||
msg << "A "
|
||||
<< ( event.IsPopup() ? "popup " : "" )
|
||||
<< "menu has been "
|
||||
<< what;
|
||||
|
||||
if ( event.GetEventType() == wxEVT_MENU_HIGHLIGHT )
|
||||
{
|
||||
msg << wxT(" (id=") << event.GetId() << wxT(")");
|
||||
msg << " (id=" << event.GetId() << ")";
|
||||
}
|
||||
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());
|
||||
}
|
||||
@ -1324,24 +1324,24 @@ MyDialog::MyDialog(wxWindow* parent)
|
||||
wxTE_MULTILINE);
|
||||
m_textctrl->SetEditable(false);
|
||||
|
||||
m_textctrl->AppendText(wxT("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"));
|
||||
m_textctrl->AppendText("Dialogs do not have menus, but popup menus should function the same\n\n"
|
||||
"Right click this text ctrl to test popup menus.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#if USE_LOG_WINDOW
|
||||
void MyDialog::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxChar *what)
|
||||
void MyDialog::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxString& what)
|
||||
{
|
||||
wxString msg;
|
||||
msg << wxT("A ")
|
||||
<< ( event.IsPopup() ? wxT("popup ") : wxT("") )
|
||||
<< wxT("menu has been ")
|
||||
msg << "A "
|
||||
<< ( event.IsPopup() ? "popup " : "" )
|
||||
<< "menu has been "
|
||||
<< what;
|
||||
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);
|
||||
}
|
||||
@ -1366,13 +1366,13 @@ void MyDialog::ShowContextMenu(const wxPoint& pos)
|
||||
{
|
||||
wxMenu menu;
|
||||
|
||||
menu.Append(Menu_Help_About, wxT("&About"));
|
||||
menu.Append(Menu_Popup_ToBeDeleted, wxT("To be &deleted"));
|
||||
menu.AppendCheckItem(Menu_Popup_ToBeChecked, wxT("To be &checked"));
|
||||
menu.Append(Menu_Popup_ToBeGreyed, wxT("To be &greyed"),
|
||||
wxT("This menu item should be initially greyed out"));
|
||||
menu.Append(Menu_Help_About, "&About");
|
||||
menu.Append(Menu_Popup_ToBeDeleted, "To be &deleted");
|
||||
menu.AppendCheckItem(Menu_Popup_ToBeChecked, "To be &checked");
|
||||
menu.Append(Menu_Popup_ToBeGreyed, "To be &greyed",
|
||||
"This menu item should be initially greyed out");
|
||||
menu.AppendSeparator();
|
||||
menu.Append(Menu_File_Quit, wxT("E&xit"));
|
||||
menu.Append(Menu_File_Quit, "E&xit");
|
||||
|
||||
menu.Delete(Menu_Popup_ToBeDeleted);
|
||||
menu.Check(Menu_Popup_ToBeChecked, true);
|
||||
|
@ -176,9 +176,9 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, char *, int)
|
||||
|
||||
CMainWindow::CMainWindow()
|
||||
{
|
||||
LoadAccelTable( wxT("MainAccelTable") );
|
||||
Create( NULL, wxT("Hello Foundation Application"),
|
||||
WS_OVERLAPPEDWINDOW, rectDefault, NULL, wxT("MainMenu") );
|
||||
LoadAccelTable( "MainAccelTable" );
|
||||
Create( NULL, "Hello Foundation Application",
|
||||
WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" );
|
||||
|
||||
// Create a container representing the MFC window in wxWidgets window
|
||||
// hierarchy.
|
||||
@ -195,7 +195,7 @@ CMainWindow::CMainWindow()
|
||||
|
||||
void CMainWindow::OnPaint()
|
||||
{
|
||||
CString s = wxT("Hello, Windows!");
|
||||
CString s = "Hello, Windows!";
|
||||
CPaintDC dc( this );
|
||||
CRect rect;
|
||||
|
||||
@ -209,13 +209,13 @@ void CMainWindow::OnPaint()
|
||||
|
||||
void CMainWindow::OnAbout()
|
||||
{
|
||||
CDialog about( wxT("AboutBox"), this );
|
||||
CDialog about( "AboutBox", this );
|
||||
about.DoModal();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@ -254,10 +254,10 @@ bool MyApp::OnInit()
|
||||
|
||||
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);
|
||||
|
||||
subframe->SetTitle(wxT("wxWidgets canvas frame"));
|
||||
subframe->SetTitle("wxWidgets canvas frame");
|
||||
|
||||
// Give it a status line
|
||||
subframe->CreateStatusBar();
|
||||
@ -265,12 +265,12 @@ wxFrame *MyApp::CreateFrame()
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(HELLO_NEW, wxT("&New MFC Window"));
|
||||
file_menu->Append(HELLO_QUIT, wxT("&Close"));
|
||||
file_menu->Append(HELLO_NEW, "&New MFC Window");
|
||||
file_menu->Append(HELLO_QUIT, "&Close");
|
||||
|
||||
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
|
||||
subframe->SetMenuBar(menu_bar);
|
||||
@ -315,7 +315,7 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
|
||||
dc.DrawEllipse(250, 250, 100, 50);
|
||||
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
|
||||
|
@ -42,7 +42,7 @@ bool MyApp::OnInit(void)
|
||||
return false;
|
||||
|
||||
// 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
|
||||
// Give it a status line
|
||||
@ -52,18 +52,18 @@ bool MyApp::OnInit(void)
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(RESOURCE_TEST1, wxT("&Dialog box test"), wxT("Test dialog box resource"));
|
||||
file_menu->Append(RESOURCE_QUIT, wxT("E&xit"), wxT("Quit program"));
|
||||
file_menu->Append(RESOURCE_TEST1, "&Dialog box test", "Test dialog box resource");
|
||||
file_menu->Append(RESOURCE_QUIT, "E&xit", "Quit program");
|
||||
|
||||
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
|
||||
frame->SetMenuBar(menu_bar);
|
||||
|
||||
// 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);
|
||||
|
||||
return true;
|
||||
@ -92,12 +92,12 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||
MyDialog dialog;
|
||||
if (dialog.LoadNativeDialog(this, wxT("dialog1")))
|
||||
if (dialog.LoadNativeDialog(this, "dialog1"))
|
||||
{
|
||||
dialog.ShowModal();
|
||||
}
|
||||
#else
|
||||
wxMessageBox(wxT("No native dialog support"),wxT("Platform limitation"));
|
||||
wxMessageBox("No native dialog support","Platform limitation");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent)
|
||||
panel->SetHelpText( wxT( "Panel with a Button" ) );
|
||||
#endif
|
||||
|
||||
(void) new wxButton( panel, wxID_ANY, wxT("Button"),
|
||||
(void) new wxButton( panel, wxID_ANY, "Button",
|
||||
wxPoint(10, 10), wxDefaultSize );
|
||||
|
||||
return panel;
|
||||
@ -88,18 +88,18 @@ wxPanel *CreateRadioButtonsPage(wxBookCtrlBase *parent)
|
||||
#endif
|
||||
|
||||
wxString animals[] =
|
||||
{ wxT("Fox"), wxT("Hare"), wxT("Rabbit"),
|
||||
wxT("Sabre-toothed tiger"), wxT("T Rex") };
|
||||
{ "Fox", "Hare", "Rabbit",
|
||||
"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);
|
||||
|
||||
wxString computers[] =
|
||||
{ wxT("Amiga"), wxT("Commodore 64"), wxT("PET"),
|
||||
wxT("Another") };
|
||||
{ "Amiga", "Commodore 64", "PET",
|
||||
"Another" };
|
||||
|
||||
wxRadioBox *radiobox2 = new wxRadioBox(panel, wxID_ANY,
|
||||
wxT("Choose your favourite"), wxDefaultPosition, wxDefaultSize,
|
||||
"Choose your favourite", wxDefaultPosition, wxDefaultSize,
|
||||
4, computers, 0, wxRA_SPECIFY_COLS);
|
||||
|
||||
wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL);
|
||||
@ -119,7 +119,7 @@ wxPanel *CreateVetoPage(wxBookCtrlBase *parent)
|
||||
#endif
|
||||
|
||||
(void) new wxStaticText( panel, wxID_ANY,
|
||||
wxT("This page intentionally left blank"),
|
||||
"This page intentionally left blank",
|
||||
wxPoint(10, 10) );
|
||||
|
||||
return panel;
|
||||
@ -133,7 +133,7 @@ wxPanel *CreateBigButtonPage(wxBookCtrlBase *parent)
|
||||
panel->SetHelpText( wxT( "Panel with a maximized button" ) );
|
||||
#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);
|
||||
sizerPanel->Add(buttonBig, 1, wxEXPAND);
|
||||
@ -150,9 +150,9 @@ wxPanel *CreateInsertPage(wxBookCtrlBase *parent)
|
||||
panel->SetHelpText( wxT( "Maroon panel" ) );
|
||||
#endif
|
||||
|
||||
panel->SetBackgroundColour( wxColour( wxT("MAROON") ) );
|
||||
panel->SetBackgroundColour( wxColour( "MAROON" ) );
|
||||
(void) new wxStaticText( panel, wxID_ANY,
|
||||
wxT("This page has been inserted, not added."),
|
||||
"This page has been inserted, not added.",
|
||||
wxPoint(10, 10) );
|
||||
|
||||
return panel;
|
||||
@ -211,7 +211,7 @@ wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName)
|
||||
if ( pageName == MAXIMIZED_BUTTON_PAGE_NAME )
|
||||
return CreateBigButtonPage(parent);
|
||||
|
||||
wxFAIL_MSG( wxT("unknown page name") );
|
||||
wxFAIL_MSG( "unknown page name" );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -282,7 +282,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame(NULL, wxID_ANY, wxString(wxT("wxWidgets book controls sample")))
|
||||
: wxFrame(NULL, wxID_ANY, wxString("wxWidgets book controls sample"))
|
||||
{
|
||||
#if wxUSE_HELP
|
||||
SetExtraStyle(wxFRAME_EX_CONTEXTHELP);
|
||||
@ -317,83 +317,83 @@ MyFrame::MyFrame()
|
||||
// menu of the sample
|
||||
wxMenu *menuType = new wxMenu;
|
||||
#if wxUSE_NOTEBOOK
|
||||
menuType->AppendRadioItem(ID_BOOK_NOTEBOOK, wxT("&Notebook\tCtrl-1"));
|
||||
menuType->AppendRadioItem(ID_BOOK_NOTEBOOK, "&Notebook\tCtrl-1");
|
||||
#endif
|
||||
#if wxUSE_LISTBOOK
|
||||
menuType->AppendRadioItem(ID_BOOK_LISTBOOK, wxT("&Listbook\tCtrl-2"));
|
||||
menuType->AppendRadioItem(ID_BOOK_LISTBOOK, "&Listbook\tCtrl-2");
|
||||
#endif
|
||||
#if wxUSE_CHOICEBOOK
|
||||
menuType->AppendRadioItem(ID_BOOK_CHOICEBOOK, wxT("&Choicebook\tCtrl-3"));
|
||||
menuType->AppendRadioItem(ID_BOOK_CHOICEBOOK, "&Choicebook\tCtrl-3");
|
||||
#endif
|
||||
#if wxUSE_TREEBOOK
|
||||
menuType->AppendRadioItem(ID_BOOK_TREEBOOK, wxT("&Treebook\tCtrl-4"));
|
||||
menuType->AppendRadioItem(ID_BOOK_TREEBOOK, "&Treebook\tCtrl-4");
|
||||
#endif
|
||||
#if wxUSE_TOOLBOOK
|
||||
menuType->AppendRadioItem(ID_BOOK_TOOLBOOK, wxT("T&oolbook\tCtrl-5"));
|
||||
menuType->AppendRadioItem(ID_BOOK_TOOLBOOK, "T&oolbook\tCtrl-5");
|
||||
#endif
|
||||
#if wxUSE_AUI
|
||||
menuType->AppendRadioItem(ID_BOOK_AUINOTEBOOK, wxT("&AuiNotebook\tCtrl-6"));
|
||||
menuType->AppendRadioItem(ID_BOOK_AUINOTEBOOK, "&AuiNotebook\tCtrl-6");
|
||||
#endif
|
||||
menuType->AppendRadioItem(ID_BOOK_SIMPLEBOOK, "&Simple book\tCtrl-7");
|
||||
|
||||
menuType->Check(ID_BOOK_NOTEBOOK + m_type, true);
|
||||
|
||||
wxMenu *menuOrient = new wxMenu;
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_DEFAULT, wxT("&Default\tAlt-0"));
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_TOP, wxT("&Top\tAlt-1"));
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_BOTTOM, wxT("&Bottom\tAlt-2"));
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_LEFT, wxT("&Left\tAlt-3"));
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_RIGHT, wxT("&Right\tAlt-4"));
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_DEFAULT, "&Default\tAlt-0");
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_TOP, "&Top\tAlt-1");
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_BOTTOM, "&Bottom\tAlt-2");
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_LEFT, "&Left\tAlt-3");
|
||||
menuOrient->AppendRadioItem(ID_ORIENT_RIGHT, "&Right\tAlt-4");
|
||||
|
||||
wxMenu *menuStyle = new wxMenu;
|
||||
#if wxUSE_NOTEBOOK
|
||||
menuStyle->AppendCheckItem(ID_FIXEDWIDTH, wxT("&Fixed Width (wxNotebook)"));
|
||||
menuStyle->AppendCheckItem(ID_MULTI, wxT("&Multiple lines (wxNotebook)"));
|
||||
menuStyle->AppendCheckItem(ID_NOPAGETHEME, wxT("&No Page Theme (wxNotebook)"));
|
||||
menuStyle->AppendCheckItem(ID_FIXEDWIDTH, "&Fixed Width (wxNotebook)");
|
||||
menuStyle->AppendCheckItem(ID_MULTI, "&Multiple lines (wxNotebook)");
|
||||
menuStyle->AppendCheckItem(ID_NOPAGETHEME, "&No Page Theme (wxNotebook)");
|
||||
#endif
|
||||
#if wxUSE_TOOLBOOK
|
||||
menuStyle->AppendCheckItem(ID_BUTTONBAR, wxT("&Button Bar (wxToolbook)"));
|
||||
menuStyle->AppendCheckItem(ID_HORZ_LAYOUT, wxT("&Horizontal layout (wxToolbook)"));
|
||||
menuStyle->AppendCheckItem(ID_BUTTONBAR, "&Button Bar (wxToolbook)");
|
||||
menuStyle->AppendCheckItem(ID_HORZ_LAYOUT, "&Horizontal layout (wxToolbook)");
|
||||
#endif
|
||||
|
||||
wxMenu *menuPageOperations = new wxMenu;
|
||||
menuPageOperations->Append(ID_ADD_PAGE, wxT("&Add page\tAlt-A"));
|
||||
menuPageOperations->Append(ID_ADD_PAGE_NO_SELECT, wxT("&Add page (don't select)\tAlt-B"));
|
||||
menuPageOperations->Append(ID_INSERT_PAGE, wxT("&Insert page\tAlt-I"));
|
||||
menuPageOperations->Append(ID_DELETE_CUR_PAGE, wxT("&Delete current page\tAlt-D"));
|
||||
menuPageOperations->Append(ID_DELETE_LAST_PAGE, wxT("D&elete last page\tAlt-L"));
|
||||
menuPageOperations->Append(ID_NEXT_PAGE, wxT("&Next page\tAlt-N"));
|
||||
menuPageOperations->Append(ID_ADD_PAGE, "&Add page\tAlt-A");
|
||||
menuPageOperations->Append(ID_ADD_PAGE_NO_SELECT, "&Add page (don't select)\tAlt-B");
|
||||
menuPageOperations->Append(ID_INSERT_PAGE, "&Insert page\tAlt-I");
|
||||
menuPageOperations->Append(ID_DELETE_CUR_PAGE, "&Delete current page\tAlt-D");
|
||||
menuPageOperations->Append(ID_DELETE_LAST_PAGE, "D&elete last page\tAlt-L");
|
||||
menuPageOperations->Append(ID_NEXT_PAGE, "&Next page\tAlt-N");
|
||||
#if wxUSE_TREEBOOK
|
||||
menuPageOperations->AppendSeparator();
|
||||
menuPageOperations->Append(ID_ADD_PAGE_BEFORE, wxT("Insert page &before\tAlt-B"));
|
||||
menuPageOperations->Append(ID_ADD_SUB_PAGE, wxT("Add s&ub page\tAlt-U"));
|
||||
menuPageOperations->Append(ID_ADD_PAGE_BEFORE, "Insert page &before\tAlt-B");
|
||||
menuPageOperations->Append(ID_ADD_SUB_PAGE, "Add s&ub page\tAlt-U");
|
||||
#endif
|
||||
menuPageOperations->AppendSeparator();
|
||||
menuPageOperations->Append(ID_CHANGE_SELECTION, wxT("&Change selection to 0\tCtrl-0"));
|
||||
menuPageOperations->Append(ID_SET_SELECTION, wxT("&Set selection to 0\tShift-Ctrl-0"));
|
||||
menuPageOperations->Append(ID_CHANGE_SELECTION, "&Change selection to 0\tCtrl-0");
|
||||
menuPageOperations->Append(ID_SET_SELECTION, "&Set selection to 0\tShift-Ctrl-0");
|
||||
menuPageOperations->AppendSeparator();
|
||||
menuPageOperations->Append(ID_GET_PAGE_SIZE, "Sho&w page size");
|
||||
menuPageOperations->Append(ID_SET_PAGE_SIZE, "Set &page size");
|
||||
|
||||
wxMenu *menuOperations = new wxMenu;
|
||||
#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
|
||||
menuOperations->Append(ID_HITTEST, wxT("&Hit test\tCtrl-H"));
|
||||
menuOperations->Append(ID_HITTEST, "&Hit test\tCtrl-H");
|
||||
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
menuFile->Append(wxID_ANY, wxT("&Type"), menuType, wxT("Type of control"));
|
||||
menuFile->Append(wxID_ANY, wxT("&Orientation"), menuOrient, wxT("Orientation of control"));
|
||||
menuFile->AppendCheckItem(ID_SHOW_IMAGES, wxT("&Show images\tAlt-S"));
|
||||
menuFile->Append(wxID_ANY, wxT("&Style"), menuStyle, wxT("Style of control"));
|
||||
menuFile->Append(wxID_ANY, "&Type", menuType, "Type of control");
|
||||
menuFile->Append(wxID_ANY, "&Orientation", menuOrient, "Orientation of control");
|
||||
menuFile->AppendCheckItem(ID_SHOW_IMAGES, "&Show images\tAlt-S");
|
||||
menuFile->Append(wxID_ANY, "&Style", menuStyle, "Style of control");
|
||||
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);
|
||||
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuPageOperations, wxT("&Pages"));
|
||||
menuBar->Append(menuOperations, wxT("&Operations"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(menuPageOperations, "&Pages");
|
||||
menuBar->Append(menuOperations, "&Operations");
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
// books creation
|
||||
@ -503,7 +503,7 @@ MyFrame::~MyFrame()
|
||||
CASE_SIMPLEBOOK(before sb after) \
|
||||
\
|
||||
default: \
|
||||
wxFAIL_MSG( wxT("unknown book control type") ); \
|
||||
wxFAIL_MSG( "unknown book control type" ); \
|
||||
}
|
||||
|
||||
void MyFrame::RecreateBook()
|
||||
@ -627,12 +627,12 @@ void MyFrame::RecreateBook()
|
||||
}
|
||||
|
||||
void MyFrame::AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag,
|
||||
const wxChar * flagName) const
|
||||
const wxString& flagName) const
|
||||
{
|
||||
if( (flags & flag) == flag )
|
||||
{
|
||||
if( !flagStr.empty() )
|
||||
flagStr += wxT(" | ");
|
||||
flagStr += " | ";
|
||||
flagStr += flagName;
|
||||
}
|
||||
}
|
||||
@ -645,8 +645,8 @@ wxPanel *MyFrame::CreateNewPage() const
|
||||
panel->SetHelpText( wxT( "Panel with \"First\" and \"Second\" buttons" ) );
|
||||
#endif
|
||||
|
||||
(void) new wxButton(panel, wxID_ANY, wxT("First button"), wxPoint(10, 30));
|
||||
(void) new wxButton(panel, wxID_ANY, wxT("Second button"), wxPoint(150, 30));
|
||||
(void) new wxButton(panel, wxID_ANY, "First button", wxPoint(10, 30));
|
||||
(void) new wxButton(panel, wxID_ANY, "Second button", wxPoint(150, 30));
|
||||
|
||||
return panel;
|
||||
}
|
||||
@ -676,13 +676,13 @@ void MyFrame::OnHitTest(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
wxString flagsStr;
|
||||
|
||||
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_NOWHERE, wxT("wxBK_HITTEST_NOWHERE") );
|
||||
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONICON, wxT("wxBK_HITTEST_ONICON") );
|
||||
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONLABEL, wxT("wxBK_HITTEST_ONLABEL") );
|
||||
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONITEM, wxT("wxBK_HITTEST_ONITEM") );
|
||||
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONPAGE, wxT("wxBK_HITTEST_ONPAGE") );
|
||||
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_NOWHERE, "wxBK_HITTEST_NOWHERE" );
|
||||
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONICON, "wxBK_HITTEST_ONICON" );
|
||||
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONLABEL, "wxBK_HITTEST_ONLABEL" );
|
||||
AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONITEM, "wxBK_HITTEST_ONITEM" );
|
||||
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.y,
|
||||
pagePos,
|
||||
@ -754,7 +754,7 @@ void MyFrame::OnAddPage(wxCommandEvent& WXUNUSED(event))
|
||||
currBook->AddPage(CreateNewPage(),
|
||||
wxString::Format
|
||||
(
|
||||
ADDED_PAGE_NAME wxT("%u"),
|
||||
ADDED_PAGE_NAME "%u",
|
||||
++s_pageAdded
|
||||
),
|
||||
true,
|
||||
@ -772,7 +772,7 @@ void MyFrame::OnAddPageNoSelect(wxCommandEvent& WXUNUSED(event))
|
||||
currBook->AddPage(CreateNewPage(),
|
||||
wxString::Format
|
||||
(
|
||||
ADDED_PAGE_NAME wxT("%u"),
|
||||
ADDED_PAGE_NAME "%u",
|
||||
++s_pageAdded
|
||||
),
|
||||
false,
|
||||
@ -789,7 +789,7 @@ void MyFrame::OnAddSubPage(wxCommandEvent& WXUNUSED(event))
|
||||
const int selPos = currBook->GetSelection();
|
||||
if ( selPos == wxNOT_FOUND )
|
||||
{
|
||||
wxLogError(wxT("Select the parent page first!"));
|
||||
wxLogError("Select the parent page first!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -800,7 +800,7 @@ void MyFrame::OnAddSubPage(wxCommandEvent& WXUNUSED(event))
|
||||
CreateNewPage(),
|
||||
wxString::Format
|
||||
(
|
||||
ADDED_SUB_PAGE_NAME wxT("%u"),
|
||||
ADDED_SUB_PAGE_NAME "%u",
|
||||
++s_subPageAdded
|
||||
),
|
||||
true,
|
||||
@ -817,7 +817,7 @@ void MyFrame::OnAddPageBefore(wxCommandEvent& WXUNUSED(event))
|
||||
const int selPos = currBook->GetSelection();
|
||||
if ( selPos == wxNOT_FOUND )
|
||||
{
|
||||
wxLogError(wxT("Select the parent page first!"));
|
||||
wxLogError("Select the parent page first!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -826,7 +826,7 @@ void MyFrame::OnAddPageBefore(wxCommandEvent& WXUNUSED(event))
|
||||
CreateNewPage(),
|
||||
wxString::Format
|
||||
(
|
||||
ADDED_PAGE_NAME_BEFORE wxT("%u"),
|
||||
ADDED_PAGE_NAME_BEFORE "%u",
|
||||
++s_subPageAdded
|
||||
),
|
||||
true,
|
||||
@ -846,7 +846,7 @@ void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event))
|
||||
wxPanel *panel = CreateUserCreatedPage( currBook );
|
||||
|
||||
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) );
|
||||
|
||||
currBook->SetSelection(0);
|
||||
@ -955,12 +955,12 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
|
||||
|
||||
wxString selection;
|
||||
if ( nSel == wxNOT_FOUND )
|
||||
selection << wxT("not found");
|
||||
selection << "not found";
|
||||
else
|
||||
selection << nSel;
|
||||
|
||||
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);
|
||||
}
|
||||
@ -972,49 +972,49 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
|
||||
{
|
||||
wxEventType typeChanged,
|
||||
typeChanging;
|
||||
const wxChar *name;
|
||||
const wxString name;
|
||||
} events[] =
|
||||
{
|
||||
#if wxUSE_NOTEBOOK
|
||||
{
|
||||
wxEVT_NOTEBOOK_PAGE_CHANGED,
|
||||
wxEVT_NOTEBOOK_PAGE_CHANGING,
|
||||
wxT("wxNotebook")
|
||||
"wxNotebook"
|
||||
},
|
||||
#endif // wxUSE_NOTEBOOK
|
||||
#if wxUSE_LISTBOOK
|
||||
{
|
||||
wxEVT_LISTBOOK_PAGE_CHANGED,
|
||||
wxEVT_LISTBOOK_PAGE_CHANGING,
|
||||
wxT("wxListbook")
|
||||
"wxListbook"
|
||||
},
|
||||
#endif // wxUSE_LISTBOOK
|
||||
#if wxUSE_CHOICEBOOK
|
||||
{
|
||||
wxEVT_CHOICEBOOK_PAGE_CHANGED,
|
||||
wxEVT_CHOICEBOOK_PAGE_CHANGING,
|
||||
wxT("wxChoicebook")
|
||||
"wxChoicebook"
|
||||
},
|
||||
#endif // wxUSE_CHOICEBOOK
|
||||
#if wxUSE_TREEBOOK
|
||||
{
|
||||
wxEVT_TREEBOOK_PAGE_CHANGED,
|
||||
wxEVT_TREEBOOK_PAGE_CHANGING,
|
||||
wxT("wxTreebook")
|
||||
"wxTreebook"
|
||||
},
|
||||
#endif // wxUSE_TREEBOOK
|
||||
#if wxUSE_TOOLBOOK
|
||||
{
|
||||
wxEVT_TOOLBOOK_PAGE_CHANGED,
|
||||
wxEVT_TOOLBOOK_PAGE_CHANGING,
|
||||
wxT("wxToolbook")
|
||||
"wxToolbook"
|
||||
},
|
||||
#endif // wxUSE_TOOLBOOK
|
||||
#if wxUSE_AUI
|
||||
{
|
||||
wxEVT_AUINOTEBOOK_PAGE_CHANGED,
|
||||
wxEVT_AUINOTEBOOK_PAGE_CHANGING,
|
||||
wxT("wxAuiNotebook")
|
||||
"wxAuiNotebook"
|
||||
},
|
||||
#endif // wxUSE_AUI
|
||||
};
|
||||
@ -1035,7 +1035,7 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
|
||||
const EventInfo& ei = events[n];
|
||||
if ( eventType == ei.typeChanged )
|
||||
{
|
||||
nameEvent = wxT("Changed");
|
||||
nameEvent = "Changed";
|
||||
}
|
||||
else if ( eventType == ei.typeChanging )
|
||||
{
|
||||
@ -1046,19 +1046,19 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
|
||||
{
|
||||
if ( wxMessageBox
|
||||
(
|
||||
wxT("Are you sure you want to leave this page?\n")
|
||||
wxT("(This demonstrates veto-ing)"),
|
||||
wxT("Notebook sample"),
|
||||
"Are you sure you want to leave this page?\n"
|
||||
"(This demonstrates veto-ing)",
|
||||
"Notebook sample",
|
||||
wxICON_QUESTION | wxYES_NO,
|
||||
this
|
||||
) != wxYES )
|
||||
{
|
||||
event.Veto();
|
||||
veto = wxT(" (vetoed)");
|
||||
veto = " (vetoed)";
|
||||
}
|
||||
}
|
||||
|
||||
nameEvent = wxT("Changing");
|
||||
nameEvent = "Changing";
|
||||
}
|
||||
else // skip end of the loop
|
||||
{
|
||||
@ -1071,7 +1071,7 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
|
||||
|
||||
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,
|
||||
nameControl.c_str(),
|
||||
nameEvent.c_str(),
|
||||
|
@ -97,7 +97,7 @@ private:
|
||||
|
||||
void RecreateBook();
|
||||
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
|
||||
enum BookType
|
||||
@ -186,15 +186,15 @@ enum ID_COMMANDS
|
||||
to decide what type of page it is.
|
||||
*/
|
||||
|
||||
#define I_WAS_INSERTED_PAGE_NAME wxT("Inserted")
|
||||
#define RADIOBUTTONS_PAGE_NAME wxT("Radiobuttons")
|
||||
#define VETO_PAGE_NAME wxT("Veto")
|
||||
#define MAXIMIZED_BUTTON_PAGE_NAME wxT("Maximized button")
|
||||
#define I_WAS_INSERTED_PAGE_NAME "Inserted"
|
||||
#define RADIOBUTTONS_PAGE_NAME "Radiobuttons"
|
||||
#define VETO_PAGE_NAME "Veto"
|
||||
#define MAXIMIZED_BUTTON_PAGE_NAME "Maximized button"
|
||||
|
||||
// Pages that can be added by the user
|
||||
#define INSERTED_PAGE_NAME wxT("Inserted ")
|
||||
#define ADDED_PAGE_NAME wxT("Added ")
|
||||
#define ADDED_PAGE_NAME_BEFORE wxT(" Inserted before ")
|
||||
#define ADDED_SUB_PAGE_NAME wxT(" Inserted sub-page ")
|
||||
#define INSERTED_PAGE_NAME "Inserted "
|
||||
#define ADDED_PAGE_NAME "Added "
|
||||
#define ADDED_PAGE_NAME_BEFORE " Inserted before "
|
||||
#define ADDED_SUB_PAGE_NAME " Inserted sub-page "
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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));
|
||||
|
||||
// Show it
|
||||
@ -154,14 +154,14 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
|
||||
menuFile->Append(OleAuto_Test, wxT("&Test Excel Automation..."));
|
||||
menuFile->Append(OleAuto_About, wxT("&About"));
|
||||
menuFile->Append(OleAuto_Test, "&Test Excel Automation...");
|
||||
menuFile->Append(OleAuto_About, "&About");
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -169,7 +169,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
@ -184,8 +184,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("This is an OLE Automation sample"),
|
||||
wxT("About OleAuto"), wxOK | wxICON_INFORMATION, this);
|
||||
wxMessageBox("This is an OLE Automation sample",
|
||||
"About OleAuto", wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
/* 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))
|
||||
{
|
||||
wxMessageBox(wxT("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."),
|
||||
wxT("Excel start"));
|
||||
wxMessageBox("Excel will be started if it is not running after you have pressed OK button."
|
||||
"\nThe active cell should then say 'wxWidgets automation test!' in bold.",
|
||||
"Excel start");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// 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())
|
||||
{
|
||||
wxLogError(wxT("Could not get workbooks count"));
|
||||
wxLogError("Could not get workbooks count");
|
||||
return;
|
||||
}
|
||||
const long workbooksCount = workbooksCountVariant;
|
||||
if (workbooksCount == 0)
|
||||
{
|
||||
const wxVariant workbook = excelObject.CallMethod(wxT("Workbooks.Add"));
|
||||
const wxVariant workbook = excelObject.CallMethod("Workbooks.Add");
|
||||
if (workbook.IsNull())
|
||||
{
|
||||
wxLogError(wxT("Could not create new Workbook"));
|
||||
wxLogError("Could not create new Workbook");
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -66,20 +66,20 @@ static void CheckGLError()
|
||||
// so check that we get a different error than the last time
|
||||
if ( err == errLast )
|
||||
{
|
||||
wxLogError(wxT("OpenGL error state couldn't be reset."));
|
||||
wxLogError("OpenGL error state couldn't be reset.");
|
||||
return;
|
||||
}
|
||||
|
||||
errLast = err;
|
||||
|
||||
wxLogError(wxT("OpenGL error %d"), err);
|
||||
wxLogError("OpenGL error %d", err);
|
||||
}
|
||||
}
|
||||
|
||||
// function to draw the texture for cube faces
|
||||
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 gap = 5*size/32; // gap between dots
|
||||
@ -459,7 +459,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
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 };
|
||||
|
||||
@ -474,7 +474,7 @@ MyFrame::MyFrame( bool stereoWindow )
|
||||
menu->AppendSeparator();
|
||||
menu->Append(wxID_CLOSE);
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menu, wxT("&Cube"));
|
||||
menuBar->Append(menu, "&Cube");
|
||||
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
|
@ -56,7 +56,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// Create the main frame window
|
||||
new MyFrame(NULL, wxT("wxWidgets OpenGL Isosurf Sample"));
|
||||
new MyFrame(NULL, "wxWidgets OpenGL Isosurf Sample");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -102,9 +102,9 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
|
||||
// Make a menubar
|
||||
wxMenu *fileMenu = new wxMenu;
|
||||
|
||||
fileMenu->Append(wxID_EXIT, wxT("E&xit"));
|
||||
fileMenu->Append(wxID_EXIT, "E&xit");
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(fileMenu, wxT("&File"));
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
|
||||
@ -225,7 +225,7 @@ void TestGLCanvas::LoadSurface(const wxString& filename)
|
||||
|
||||
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());
|
||||
|
||||
// NOTE: for some reason under wxGTK the following is required to avoid that
|
||||
|
@ -388,7 +388,7 @@ bool DXFRenderer::ParseHeader(wxInputStream& stream)
|
||||
while (stream.CanRead())
|
||||
{
|
||||
GetLines(text, line1, line2);
|
||||
if (line1 == wxT("0") && line2 == wxT("ENDSEC"))
|
||||
if (line1 == "0" && line2 == "ENDSEC")
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -404,7 +404,7 @@ bool DXFRenderer::ParseTables(wxInputStream& stream)
|
||||
while (stream.CanRead())
|
||||
{
|
||||
GetLines(text, line1, line2);
|
||||
if (line1 == wxT("0") && inlayer)
|
||||
if (line1 == "0" && inlayer)
|
||||
{
|
||||
// flush layer
|
||||
if (!layer.name.IsEmpty() && layer.colour != -1)
|
||||
@ -417,15 +417,15 @@ bool DXFRenderer::ParseTables(wxInputStream& stream)
|
||||
layer = DXFLayer();
|
||||
inlayer = false;
|
||||
}
|
||||
if (line1 == wxT("0") && line2 == wxT("ENDSEC"))
|
||||
if (line1 == "0" && line2 == "ENDSEC")
|
||||
return true;
|
||||
else if (line1 == wxT("0") && line2 == wxT("LAYER"))
|
||||
else if (line1 == "0" && line2 == "LAYER")
|
||||
inlayer = true;
|
||||
else if (inlayer)
|
||||
{
|
||||
if (line1 == wxT("2")) // layer name
|
||||
if (line1 == "2") // layer name
|
||||
layer.name = line2;
|
||||
else if (line1 == wxT("62")) // ACI colour
|
||||
else if (line1 == "62") // ACI colour
|
||||
{
|
||||
long l;
|
||||
line2.ToLong(&l);
|
||||
@ -464,7 +464,7 @@ bool DXFRenderer::ParseEntities(wxInputStream& stream)
|
||||
while (stream.CanRead())
|
||||
{
|
||||
GetLines(text, line1, line2);
|
||||
if (line1 == wxT("0") && state > 0)
|
||||
if (line1 == "0" && state > 0)
|
||||
{
|
||||
// flush entity
|
||||
if (state == 1) // 3DFACE
|
||||
@ -499,43 +499,43 @@ bool DXFRenderer::ParseEntities(wxInputStream& stream)
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
if (line1 == wxT("0") && line2 == wxT("ENDSEC"))
|
||||
if (line1 == "0" && line2 == "ENDSEC")
|
||||
return true;
|
||||
else if (line1 == wxT("0") && line2 == wxT("3DFACE"))
|
||||
else if (line1 == "0" && line2 == "3DFACE")
|
||||
state = 1;
|
||||
else if (line1 == wxT("0") && line2 == wxT("LINE"))
|
||||
else if (line1 == "0" && line2 == "LINE")
|
||||
state = 2;
|
||||
else if (state > 0)
|
||||
{
|
||||
const double d=ToDouble(line2);
|
||||
|
||||
if (line1 == wxT("10"))
|
||||
if (line1 == "10")
|
||||
v[0].x = d;
|
||||
else if (line1 == wxT("20"))
|
||||
else if (line1 == "20")
|
||||
v[0].y = d;
|
||||
else if (line1 == wxT("30"))
|
||||
else if (line1 == "30")
|
||||
v[0].z = d;
|
||||
else if (line1 == wxT("11"))
|
||||
else if (line1 == "11")
|
||||
v[1].x = d;
|
||||
else if (line1 == wxT("21"))
|
||||
else if (line1 == "21")
|
||||
v[1].y = d;
|
||||
else if (line1 == wxT("31"))
|
||||
else if (line1 == "31")
|
||||
v[1].z = d;
|
||||
else if (line1 == wxT("12"))
|
||||
else if (line1 == "12")
|
||||
v[2].x = d;
|
||||
else if (line1 == wxT("22"))
|
||||
else if (line1 == "22")
|
||||
v[2].y = d;
|
||||
else if (line1 == wxT("32"))
|
||||
else if (line1 == "32")
|
||||
v[2].z = d;
|
||||
else if (line1 == wxT("13"))
|
||||
else if (line1 == "13")
|
||||
v[3].x = d;
|
||||
else if (line1 == wxT("23"))
|
||||
else if (line1 == "23")
|
||||
v[3].y = d;
|
||||
else if (line1 == wxT("33"))
|
||||
else if (line1 == "33")
|
||||
v[3].z = d;
|
||||
else if (line1 == wxT("8")) // layer
|
||||
else if (line1 == "8") // layer
|
||||
layer = line2;
|
||||
else if (line1 == wxT("62")) // colour
|
||||
else if (line1 == "62") // colour
|
||||
{
|
||||
long l;
|
||||
line2.ToLong(&l);
|
||||
@ -557,24 +557,24 @@ bool DXFRenderer::Load(wxInputStream& stream)
|
||||
while (stream.CanRead())
|
||||
{
|
||||
GetLines(text, line1, line2);
|
||||
if (line1 == wxT("999")) // comment
|
||||
if (line1 == "999") // comment
|
||||
continue;
|
||||
else if (line1 == wxT("0") && line2 == wxT("SECTION"))
|
||||
else if (line1 == "0" && line2 == "SECTION")
|
||||
{
|
||||
GetLines(text, line1, line2);
|
||||
if (line1 == wxT("2"))
|
||||
if (line1 == "2")
|
||||
{
|
||||
if (line2 == wxT("HEADER"))
|
||||
if (line2 == "HEADER")
|
||||
{
|
||||
if (!ParseHeader(stream))
|
||||
return false;
|
||||
}
|
||||
else if (line2 == wxT("TABLES"))
|
||||
else if (line2 == "TABLES")
|
||||
{
|
||||
if (!ParseTables(stream))
|
||||
return false;
|
||||
}
|
||||
else if (line2 == wxT("ENTITIES"))
|
||||
else if (line2 == "ENTITIES")
|
||||
{
|
||||
if (!ParseEntities(stream))
|
||||
return false;
|
||||
|
@ -43,15 +43,15 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// Create the main frame window
|
||||
MyFrame *frame = new MyFrame(NULL, wxT("wxWidgets Penguin Sample"),
|
||||
MyFrame *frame = new MyFrame(NULL, "wxWidgets Penguin Sample",
|
||||
wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
#if wxUSE_ZLIB
|
||||
if (wxFileExists(wxT("penguin.dxf.gz")))
|
||||
frame->GetCanvas()->LoadDXF(wxT("penguin.dxf.gz"));
|
||||
if (wxFileExists("penguin.dxf.gz"))
|
||||
frame->GetCanvas()->LoadDXF("penguin.dxf.gz");
|
||||
#else
|
||||
if (wxFileExists(wxT("penguin.dxf")))
|
||||
frame->GetCanvas()->LoadDXF(wxT("penguin.dxf"));
|
||||
if (wxFileExists("penguin.dxf"))
|
||||
frame->GetCanvas()->LoadDXF("penguin.dxf");
|
||||
#endif
|
||||
|
||||
/* Show the frame */
|
||||
@ -81,16 +81,16 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
|
||||
|
||||
// Make the "File" menu
|
||||
wxMenu *fileMenu = new wxMenu;
|
||||
fileMenu->Append(wxID_OPEN, wxT("&Open..."));
|
||||
fileMenu->Append(wxID_OPEN, "&Open...");
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append(wxID_EXIT, wxT("E&xit\tALT-X"));
|
||||
fileMenu->Append(wxID_EXIT, "E&xit\tALT-X");
|
||||
// Make the "Help" menu
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(wxID_HELP, wxT("&About"));
|
||||
helpMenu->Append(wxID_HELP, "&About");
|
||||
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(fileMenu, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
Show(true);
|
||||
@ -102,11 +102,11 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
|
||||
// File|Open... command
|
||||
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
|
||||
wxT("DXF Drawing (*.dxf;*.dxf.gz)|*.dxf;*.dxf.gz|All files (*.*)|*.*"),
|
||||
"DXF Drawing (*.dxf;*.dxf.gz)|*.dxf;*.dxf.gz|All files (*.*)|*.*",
|
||||
#else
|
||||
wxT("DXF Drawing (*.dxf)|*.dxf)|All files (*.*)|*.*"),
|
||||
"DXF Drawing (*.dxf)|*.dxf)|All files (*.*)|*.*",
|
||||
#endif
|
||||
wxFD_OPEN);
|
||||
if (!filename.IsEmpty())
|
||||
@ -126,7 +126,7 @@ void MyFrame::OnMenuFileExit( wxCommandEvent& WXUNUSED(event) )
|
||||
// Help|About command
|
||||
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 wxUSE_ZLIB
|
||||
{
|
||||
if (filename.Right(3).Lower() == wxT(".gz"))
|
||||
if (filename.Right(3).Lower() == ".gz")
|
||||
{
|
||||
wxZlibInputStream zstream(stream);
|
||||
m_renderer.Load(zstream);
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
TestGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxString& name = wxT("TestGLCanvas"));
|
||||
const wxString& name = "TestGLCanvas");
|
||||
|
||||
virtual ~TestGLCanvas();
|
||||
|
||||
|
@ -115,75 +115,75 @@ void OwnerDrawnFrame::InitMenu()
|
||||
fontBmp(wxFontInfo(14));
|
||||
|
||||
// sorry for my artistic skills...
|
||||
wxBitmap bmpBell(wxT("bell")),
|
||||
bmpSound(wxT("sound")),
|
||||
bmpNoSound(wxT("nosound")),
|
||||
bmpInfo(wxT("info")),
|
||||
bmpInfo_mono(wxT("info_mono"));
|
||||
wxBitmap bmpBell("bell"),
|
||||
bmpSound("sound"),
|
||||
bmpNoSound("nosound"),
|
||||
bmpInfo("info"),
|
||||
bmpInfo_mono("info_mono");
|
||||
|
||||
// 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);
|
||||
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);
|
||||
pItem->SetFont(fontItalic);
|
||||
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);
|
||||
pItem->SetFont(fontUlined);
|
||||
sub_menu->Append(pItem);
|
||||
|
||||
// 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->SetTextColour(wxColor(255, 0, 0));
|
||||
file_menu->Append(pItem);
|
||||
|
||||
pItem = new wxMenuItem(file_menu, Menu_Test2, wxT("&Checkable"),
|
||||
wxT("checkable item"), wxITEM_CHECK);
|
||||
pItem = new wxMenuItem(file_menu, Menu_Test2, "&Checkable",
|
||||
"checkable item", wxITEM_CHECK);
|
||||
pItem->SetFont(*wxSMALL_FONT);
|
||||
file_menu->Append(pItem);
|
||||
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);
|
||||
file_menu->Append(pItem);
|
||||
file_menu->Enable(Menu_Test3, false);
|
||||
|
||||
file_menu->AppendSeparator();
|
||||
|
||||
pItem = new wxMenuItem(file_menu, Menu_Bitmap, wxT("&Bell"),
|
||||
wxT("check/uncheck me!"), wxITEM_CHECK);
|
||||
pItem = new wxMenuItem(file_menu, Menu_Bitmap, "&Bell",
|
||||
"check/uncheck me!", wxITEM_CHECK);
|
||||
pItem->SetFont(fontBmp);
|
||||
pItem->SetBitmaps(bmpBell);
|
||||
file_menu->Append(pItem);
|
||||
|
||||
pItem = new wxMenuItem(file_menu, Menu_Bitmap2, wxT("So&und"),
|
||||
wxT("icon changes!"), wxITEM_CHECK);
|
||||
pItem = new wxMenuItem(file_menu, Menu_Bitmap2, "So&und",
|
||||
"icon changes!", wxITEM_CHECK);
|
||||
pItem->SetFont(fontBmp);
|
||||
pItem->SetBitmaps(bmpSound, bmpNoSound);
|
||||
file_menu->Append(pItem);
|
||||
|
||||
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);
|
||||
pItem->SetFont(*wxSWISS_FONT);
|
||||
file_menu->Append(pItem);
|
||||
|
||||
file_menu->AppendSeparator();
|
||||
pItem = new wxMenuItem(file_menu, Menu_Toggle, wxT("&Disable/Enable\tCtrl+D"),
|
||||
wxT("enables/disables the About-Item"), wxITEM_NORMAL);
|
||||
pItem = new wxMenuItem(file_menu, Menu_Toggle, "&Disable/Enable\tCtrl+D",
|
||||
"enables/disables the About-Item", wxITEM_NORMAL);
|
||||
pItem->SetFont(*wxNORMAL_FONT);
|
||||
file_menu->Append(pItem);
|
||||
|
||||
// Of course Ctrl+RatherLongAccel will not work in this example:
|
||||
pAboutItem = new wxMenuItem(file_menu, Menu_About, wxT("&About\tCtrl+RatherLongAccel"),
|
||||
wxT("display program information"), wxITEM_NORMAL);
|
||||
pAboutItem = new wxMenuItem(file_menu, Menu_About, "&About\tCtrl+RatherLongAccel",
|
||||
"display program information", wxITEM_NORMAL);
|
||||
pAboutItem->SetBitmap(bmpInfo);
|
||||
pAboutItem->SetDisabledBitmap(bmpInfo_mono);
|
||||
file_menu->Append(pAboutItem);
|
||||
@ -191,66 +191,66 @@ void OwnerDrawnFrame::InitMenu()
|
||||
file_menu->AppendSeparator();
|
||||
#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);
|
||||
file_menu->Append(pItem);
|
||||
|
||||
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->AppendSeparator();
|
||||
|
||||
pItem = new wxMenuItem(drawn_menu, Menu_Drawn2, wxT("&Checked item"),
|
||||
wxT("check/uncheck me!"), wxITEM_CHECK);
|
||||
pItem = new wxMenuItem(drawn_menu, Menu_Drawn2, "&Checked item",
|
||||
"check/uncheck me!", wxITEM_CHECK);
|
||||
drawn_menu->Append(pItem);
|
||||
drawn_menu->Check(Menu_Drawn2, true);
|
||||
|
||||
pItem = new wxMenuItem(drawn_menu, Menu_Drawn3, wxT("&Radio item"),
|
||||
wxT("check/uncheck me!"), wxITEM_RADIO);
|
||||
pItem = new wxMenuItem(drawn_menu, Menu_Drawn3, "&Radio item",
|
||||
"check/uncheck me!", wxITEM_RADIO);
|
||||
drawn_menu->Append(pItem);
|
||||
|
||||
drawn_menu->AppendSeparator();
|
||||
|
||||
pItem = new wxMenuItem(drawn_menu, Menu_Drawn4, wxT("&Disabled item\tCtrl+RatherLongAccel"),
|
||||
wxT("disabled item"));
|
||||
pItem = new wxMenuItem(drawn_menu, Menu_Drawn4, "&Disabled item\tCtrl+RatherLongAccel",
|
||||
"disabled item");
|
||||
pItem->Enable(false);
|
||||
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);
|
||||
drawn_menu->Append(pItem);
|
||||
|
||||
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->AppendSeparator();
|
||||
|
||||
pItem = new wxMenuItem(native_menu, Menu_Native2, wxT("&Checked item"),
|
||||
wxT("check/uncheck me!"), wxITEM_CHECK);
|
||||
pItem = new wxMenuItem(native_menu, Menu_Native2, "&Checked item",
|
||||
"check/uncheck me!", wxITEM_CHECK);
|
||||
native_menu->Append(pItem);
|
||||
native_menu->Check(Menu_Native2, true);
|
||||
|
||||
pItem = new wxMenuItem(native_menu, Menu_Native3, wxT("&Radio item"),
|
||||
wxT("check/uncheck me!"), wxITEM_RADIO);
|
||||
pItem = new wxMenuItem(native_menu, Menu_Native3, "&Radio item",
|
||||
"check/uncheck me!", wxITEM_RADIO);
|
||||
native_menu->Append(pItem);
|
||||
|
||||
native_menu->AppendSeparator();
|
||||
|
||||
pItem = new wxMenuItem(native_menu, Menu_Native4, wxT("&Disabled item\tCtrl+RatherLongAccel"),
|
||||
wxT("disabled item"));
|
||||
pItem = new wxMenuItem(native_menu, Menu_Native4, "&Disabled item\tCtrl+RatherLongAccel",
|
||||
"disabled item");
|
||||
pItem->Enable(false);
|
||||
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);
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(drawn_menu, wxT("&Drawn"));
|
||||
menu_bar->Append(native_menu, wxT("&Native"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(drawn_menu, "&Drawn");
|
||||
menu_bar->Append(native_menu, "&Native");
|
||||
SetMenuBar(menu_bar);
|
||||
}
|
||||
|
||||
@ -270,16 +270,16 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, const wxString& title,
|
||||
const int widths[] = { -1, 60 };
|
||||
CreateStatusBar(2);
|
||||
SetStatusWidths(2, widths);
|
||||
SetStatusText(wxT("no selection"), 0);
|
||||
SetStatusText("no selection", 0);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
// make a panel with some controls
|
||||
wxPanel *pPanel = new wxPanel(this);
|
||||
|
||||
// check list box
|
||||
static const wxChar* aszChoices[] = { wxT("Hello"), wxT("world"), wxT("and"),
|
||||
wxT("goodbye"), wxT("cruel"), wxT("world"),
|
||||
wxT("-------"), wxT("owner-drawn"), wxT("listbox") };
|
||||
static const wxString aszChoices[] = { "Hello", "world", "and",
|
||||
"goodbye", "cruel", "world",
|
||||
"-------", "owner-drawn", "listbox" };
|
||||
|
||||
wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
|
||||
unsigned int ui;
|
||||
@ -308,9 +308,9 @@ OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, const wxString& title,
|
||||
m_pListBox->Check(2);
|
||||
|
||||
// normal (but owner-drawn) listbox
|
||||
static const wxChar* aszColors[] = { wxT("Red"), wxT("Blue"), wxT("Pink"),
|
||||
wxT("Green"), wxT("Yellow"),
|
||||
wxT("Black"), wxT("Violet") };
|
||||
static const wxString aszColors[] = { "Red", "Blue", "Pink",
|
||||
"Green", "Yellow",
|
||||
"Black", "Violet" };
|
||||
|
||||
astrChoices = new wxString[WXSIZEOF(aszColors)];
|
||||
|
||||
@ -376,8 +376,8 @@ void OwnerDrawnFrame::OnMenuToggle(wxCommandEvent& WXUNUSED(event))
|
||||
void OwnerDrawnFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageDialog dialog(this,
|
||||
wxT("Demo of owner-drawn controls\n"),
|
||||
wxT("About wxOwnerDrawn"), wxYES_NO | wxCANCEL);
|
||||
"Demo of owner-drawn controls\n",
|
||||
"About wxOwnerDrawn", wxYES_NO | wxCANCEL);
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
@ -386,8 +386,8 @@ void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
|
||||
#if wxUSE_STATUSBAR
|
||||
wxString strSelection;
|
||||
unsigned int nSel = event.GetSelection();
|
||||
strSelection.Printf(wxT("item %d selected (%schecked)"), nSel,
|
||||
m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not "));
|
||||
strSelection.Printf("item %d selected (%schecked)", nSel,
|
||||
m_pListBox->IsChecked(nSel) ? "" : "not ");
|
||||
SetStatusText(strSelection);
|
||||
#else
|
||||
wxUnusedVar(event);
|
||||
@ -397,7 +397,7 @@ void OwnerDrawnFrame::OnListboxSelect(wxCommandEvent& event)
|
||||
void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString strSelection;
|
||||
strSelection.Printf(wxT("item %d double clicked"),
|
||||
strSelection.Printf("item %d double clicked",
|
||||
m_pListBox->GetSelection());
|
||||
wxMessageDialog dialog(this, strSelection);
|
||||
dialog.ShowModal();
|
||||
@ -408,8 +408,8 @@ void OwnerDrawnFrame::OnCheckboxToggle(wxCommandEvent& event)
|
||||
#if wxUSE_STATUSBAR
|
||||
wxString strSelection;
|
||||
unsigned int nItem = event.GetInt();
|
||||
strSelection.Printf(wxT("item %d was %schecked"), nItem,
|
||||
m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un"));
|
||||
strSelection.Printf("item %d was %schecked", nItem,
|
||||
m_pListBox->IsChecked(nItem) ? "" : "un");
|
||||
SetStatusText(strSelection);
|
||||
#else
|
||||
wxUnusedVar(event);
|
||||
|
@ -119,17 +119,17 @@ SimpleTransientPopup::SimpleTransientPopup( wxWindow *parent, bool scrolled )
|
||||
m_panel->Bind(wxEVT_MOTION, &SimpleTransientPopup::OnMouse, this);
|
||||
|
||||
wxStaticText *text = new wxStaticText( m_panel, wxID_ANY,
|
||||
wxT("wxPopupTransientWindow is a\n")
|
||||
wxT("wxPopupWindow which disappears\n")
|
||||
wxT("automatically when the user\n")
|
||||
wxT("clicks the mouse outside it or if it\n")
|
||||
wxT("(or its first child) loses focus in \n")
|
||||
wxT("any other way.") );
|
||||
"wxPopupTransientWindow is a\n"
|
||||
"wxPopupWindow which disappears\n"
|
||||
"automatically when the user\n"
|
||||
"clicks the mouse outside it or if it\n"
|
||||
"(or its first child) loses focus in \n"
|
||||
"any other way." );
|
||||
|
||||
m_button = new wxButton(m_panel, Minimal_PopupButton, wxT("Press Me"));
|
||||
m_spinCtrl = new wxSpinCtrl(m_panel, Minimal_PopupSpinctrl, wxT("Hello"));
|
||||
m_button = new wxButton(m_panel, Minimal_PopupButton, "Press Me");
|
||||
m_spinCtrl = new wxSpinCtrl(m_panel, Minimal_PopupSpinctrl, "Hello");
|
||||
m_mouseText = new wxStaticText(m_panel, wxID_ANY,
|
||||
wxT("<- Test Mouse ->"));
|
||||
"<- Test Mouse ->");
|
||||
|
||||
wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
|
||||
topSizer->Add( text, 0, wxALL, 5 );
|
||||
@ -235,10 +235,10 @@ void SimpleTransientPopup::OnButton(wxCommandEvent& event)
|
||||
wxLogMessage( "%p SimpleTransientPopup::OnButton ID %d", this, event.GetId());
|
||||
|
||||
wxButton *button = wxDynamicCast(event.GetEventObject(), wxButton);
|
||||
if (button->GetLabel() == wxT("Press Me"))
|
||||
button->SetLabel(wxT("Pressed"));
|
||||
if (button->GetLabel() == "Press Me")
|
||||
button->SetLabel("Pressed");
|
||||
else
|
||||
button->SetLabel(wxT("Press Me"));
|
||||
button->SetLabel("Press Me");
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
@ -311,7 +311,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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
|
||||
// created initially)
|
||||
@ -348,15 +348,15 @@ MyFrame::MyFrame(const wxString& title)
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
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_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));
|
||||
menuFile->Append(Minimal_TestDialog, "&Test dialog\tAlt-T", "Test dialog");
|
||||
menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -365,12 +365,12 @@ MyFrame::MyFrame(const wxString& title)
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
wxPanel *panel = new wxPanel(this, -1);
|
||||
wxButton *button1 = new wxButton( panel, Minimal_StartSimplePopup, wxT("Show simple popup"), wxPoint(20,20) );
|
||||
wxButton *button2 = new wxButton( panel, Minimal_StartScrolledPopup, wxT("Show scrolled popup"), wxPoint(20,70) );
|
||||
wxButton *button1 = new wxButton( panel, Minimal_StartSimplePopup, "Show simple popup", wxPoint(20,20) );
|
||||
wxButton *button2 = new wxButton( panel, Minimal_StartScrolledPopup, "Show scrolled popup", wxPoint(20,70) );
|
||||
|
||||
m_logWin = new wxTextCtrl( panel, wxID_ANY, wxEmptyString, wxDefaultPosition,
|
||||
wxDefaultSize, wxTE_MULTILINE );
|
||||
@ -398,12 +398,12 @@ MyFrame::~MyFrame()
|
||||
|
||||
void MyFrame::OnActivate(wxActivateEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage( wxT("In activate...") );
|
||||
wxLogMessage( "In activate..." );
|
||||
}
|
||||
|
||||
void MyFrame::OnStartSimplePopup(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage( wxT("================================================") );
|
||||
wxLogMessage( "================================================" );
|
||||
delete m_simplePopup;
|
||||
m_simplePopup = new SimpleTransientPopup( this, false );
|
||||
wxWindow *btn = (wxWindow*) event.GetEventObject();
|
||||
@ -416,7 +416,7 @@ void MyFrame::OnStartSimplePopup(wxCommandEvent& event)
|
||||
|
||||
void MyFrame::OnStartScrolledPopup(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage( wxT("================================================") );
|
||||
wxLogMessage( "================================================" );
|
||||
delete m_scrolledPopup;
|
||||
m_scrolledPopup = new SimpleTransientPopup( this, true );
|
||||
wxWindow *btn = (wxWindow*) event.GetEventObject();
|
||||
@ -429,7 +429,7 @@ void MyFrame::OnStartScrolledPopup(wxCommandEvent& event)
|
||||
|
||||
void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
MyDialog dialog( wxT("Test") );
|
||||
MyDialog dialog( "Test" );
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
@ -442,10 +442,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("This is the About dialog of the popup sample.\n")
|
||||
wxT("Welcome to %s"), wxVERSION_STRING);
|
||||
msg.Printf( "This is the About dialog of the popup sample.\n"
|
||||
"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;
|
||||
wxPanel *panel = new wxPanel(this, -1);
|
||||
|
||||
wxButton *button1 = new wxButton( panel, Minimal_StartSimplePopup, wxT("Show simple popup"), wxPoint(20,20) );
|
||||
wxButton *button2 = new wxButton( panel, Minimal_StartScrolledPopup, wxT("Show scrolled popup"), wxPoint(20,60) );
|
||||
wxButton *button1 = new wxButton( panel, Minimal_StartSimplePopup, "Show simple popup", wxPoint(20,20) );
|
||||
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 );
|
||||
topSizer->Add( button1, 0, wxALL, 5 );
|
||||
@ -479,7 +479,7 @@ MyDialog::MyDialog(const wxString& title)
|
||||
|
||||
void MyDialog::OnStartSimplePopup(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage( wxT("================================================") );
|
||||
wxLogMessage( "================================================" );
|
||||
delete m_simplePopup;
|
||||
m_simplePopup = new SimpleTransientPopup( this, false );
|
||||
wxWindow *btn = (wxWindow*) event.GetEventObject();
|
||||
@ -492,7 +492,7 @@ void MyDialog::OnStartSimplePopup(wxCommandEvent& event)
|
||||
|
||||
void MyDialog::OnStartScrolledPopup(wxCommandEvent& event)
|
||||
{
|
||||
wxLogMessage( wxT("================================================") );
|
||||
wxLogMessage( "================================================" );
|
||||
delete m_scrolledPopup;
|
||||
m_scrolledPopup = new SimpleTransientPopup( this, true );
|
||||
wxWindow *btn = (wxWindow*) event.GetEventObject();
|
||||
|
@ -46,7 +46,7 @@ class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
MyFrame()
|
||||
: wxFrame(NULL, wxID_ANY, wxT("wxWidgets Power Management Sample"),
|
||||
: wxFrame(NULL, wxID_ANY, "wxWidgets Power Management Sample",
|
||||
wxDefaultPosition, wxSize(500, 200))
|
||||
{
|
||||
m_powerResourceBlocker = NULL;
|
||||
@ -56,10 +56,10 @@ public:
|
||||
fileMenu->Append(wxID_ABORT, "Stop long running task");
|
||||
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
menuBar->Append(fileMenu, wxT("&Task"));
|
||||
menuBar->Append(fileMenu, "&Task");
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxT(""),
|
||||
wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, "",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE | wxTE_READONLY);
|
||||
m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(text));
|
||||
@ -101,28 +101,28 @@ private:
|
||||
#ifdef wxHAS_POWER_EVENTS
|
||||
void OnSuspending(wxPowerEvent& event)
|
||||
{
|
||||
wxLogMessage(wxT("System suspend starting..."));
|
||||
if ( wxMessageBox(wxT("Veto suspend?"), wxT("Please answer"),
|
||||
wxLogMessage("System suspend starting...");
|
||||
if ( wxMessageBox("Veto suspend?", "Please answer",
|
||||
wxYES_NO, this) == wxYES )
|
||||
{
|
||||
event.Veto();
|
||||
wxLogMessage(wxT("Vetoed suspend."));
|
||||
wxLogMessage("Vetoed suspend.");
|
||||
}
|
||||
}
|
||||
|
||||
void OnSuspended(wxPowerEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(wxT("System is going to suspend."));
|
||||
wxLogMessage("System is going to suspend.");
|
||||
}
|
||||
|
||||
void OnSuspendCancel(wxPowerEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(wxT("System suspend was cancelled."));
|
||||
wxLogMessage("System suspend was cancelled.");
|
||||
}
|
||||
|
||||
void OnResume(wxPowerEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(wxT("System resumed from suspend."));
|
||||
wxLogMessage("System resumed from suspend.");
|
||||
}
|
||||
#endif // wxHAS_POWER_EVENTS
|
||||
|
||||
@ -133,19 +133,19 @@ private:
|
||||
switch ( m_powerType = powerType )
|
||||
{
|
||||
case wxPOWER_SOCKET:
|
||||
powerStr = wxT("wall");
|
||||
powerStr = "wall";
|
||||
break;
|
||||
|
||||
case wxPOWER_BATTERY:
|
||||
powerStr = wxT("battery");
|
||||
powerStr = "battery";
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG(wxT("unknown wxPowerType value"));
|
||||
wxFAIL_MSG("unknown wxPowerType value");
|
||||
// fall through
|
||||
|
||||
case wxPOWER_UNKNOWN:
|
||||
powerStr = wxT("psychic");
|
||||
powerStr = "psychic";
|
||||
break;
|
||||
}
|
||||
|
||||
@ -153,32 +153,32 @@ private:
|
||||
switch ( m_batteryState = batteryState )
|
||||
{
|
||||
case wxBATTERY_NORMAL_STATE:
|
||||
batteryStr = wxT("charged");
|
||||
batteryStr = "charged";
|
||||
break;
|
||||
|
||||
case wxBATTERY_LOW_STATE:
|
||||
batteryStr = wxT("low");
|
||||
batteryStr = "low";
|
||||
break;
|
||||
|
||||
case wxBATTERY_CRITICAL_STATE:
|
||||
batteryStr = wxT("critical");
|
||||
batteryStr = "critical";
|
||||
break;
|
||||
|
||||
case wxBATTERY_SHUTDOWN_STATE:
|
||||
batteryStr = wxT("empty");
|
||||
batteryStr = "empty";
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG(wxT("unknown wxBatteryState value"));
|
||||
wxFAIL_MSG("unknown wxBatteryState value");
|
||||
// fall through
|
||||
|
||||
case wxBATTERY_UNKNOWN_STATE:
|
||||
batteryStr = wxT("unknown");
|
||||
batteryStr = "unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
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(),
|
||||
batteryStr.c_str()));
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ bool MyApp::OnInit(void)
|
||||
// ----------------------
|
||||
|
||||
#if 0
|
||||
wxImage image( wxT("test.jpg") );
|
||||
wxImage image( "test.jpg" );
|
||||
image.SetAlpha();
|
||||
int i,j;
|
||||
for (i = 0; i < image.GetWidth(); i++)
|
||||
@ -112,7 +112,7 @@ bool MyApp::OnInit(void)
|
||||
// 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));
|
||||
|
||||
frame->Centre(wxBOTH);
|
||||
@ -154,13 +154,13 @@ void MyApp::Draw(wxDC&dc)
|
||||
|
||||
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.DrawEllipse(50, 140, 100, 50);
|
||||
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);
|
||||
|
||||
@ -204,11 +204,11 @@ void MyApp::Draw(wxDC&dc)
|
||||
|
||||
wxString str;
|
||||
int i = 0;
|
||||
str.Printf( wxT("---- Text at angle %d ----"), i );
|
||||
str.Printf( "---- Text at angle %d ----", i );
|
||||
dc.DrawRotatedText( str, 100, 300, i );
|
||||
|
||||
i = m_angle;
|
||||
str.Printf( wxT("---- Text at angle %d ----"), i );
|
||||
str.Printf( "---- Text at angle %d ----", i );
|
||||
dc.DrawRotatedText( str, 100, 300, i );
|
||||
|
||||
wxIcon my_icon = wxICON(sample);
|
||||
@ -290,7 +290,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const
|
||||
#if wxUSE_STATUSBAR
|
||||
// Give us a status line
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Printing demo"));
|
||||
SetStatusText("Printing demo");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
// Load icon and bitmap
|
||||
@ -299,12 +299,12 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(wxID_PRINT, wxT("&Print..."), wxT("Print"));
|
||||
file_menu->Append(WXPRINT_PAGE_SETUP, wxT("Page Set&up..."), wxT("Page setup"));
|
||||
file_menu->Append(wxID_PRINT, "&Print...", "Print");
|
||||
file_menu->Append(WXPRINT_PAGE_SETUP, "Page Set&up...", "Page setup");
|
||||
#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
|
||||
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;
|
||||
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
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(WXPRINT_PRINT_PS, wxT("Print PostScript..."), wxT("Print (PostScript)"));
|
||||
file_menu->Append(WXPRINT_PAGE_SETUP_PS, wxT("Page Setup PostScript..."), wxT("Page setup (PostScript)"));
|
||||
file_menu->Append(WXPRINT_PREVIEW_PS, wxT("Print Preview PostScript"), wxT("Preview (PostScript)"));
|
||||
file_menu->Append(WXPRINT_PRINT_PS, "Print PostScript...", "Print (PostScript)");
|
||||
file_menu->Append(WXPRINT_PAGE_SETUP_PS, "Page Setup PostScript...", "Page setup (PostScript)");
|
||||
file_menu->Append(WXPRINT_PREVIEW_PS, "Print Preview PostScript", "Preview (PostScript)");
|
||||
#endif
|
||||
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(WXPRINT_ANGLEUP, wxT("Angle up\tAlt-U"), wxT("Raise rotated text angle"));
|
||||
file_menu->Append(WXPRINT_ANGLEDOWN, wxT("Angle down\tAlt-D"), wxT("Lower rotated text angle"));
|
||||
file_menu->Append(WXPRINT_ANGLEUP, "Angle up\tAlt-U", "Raise rotated text angle");
|
||||
file_menu->Append(WXPRINT_ANGLEDOWN, "Angle down\tAlt-D", "Lower rotated text angle");
|
||||
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;
|
||||
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;
|
||||
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(help_menu, wxT("&Help"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
SetMenuBar(menu_bar);
|
||||
@ -364,16 +364,16 @@ void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
|
||||
wxPrintDialogData printDialogData(* g_printData);
|
||||
|
||||
wxPrinter printer(&printDialogData);
|
||||
MyPrintout printout(this, wxT("My printout"));
|
||||
MyPrintout printout(this, "My printout");
|
||||
if (!printer.Print(this, &printout, true /*prompt*/))
|
||||
{
|
||||
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
|
||||
{
|
||||
wxLogMessage(wxT("You canceled printing"));
|
||||
wxLogMessage("You canceled printing");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -391,12 +391,12 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
|
||||
if (!preview->IsOk())
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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->InitializeWithModality(m_previewModality);
|
||||
frame->Show();
|
||||
@ -419,7 +419,7 @@ void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
|
||||
wxPrintDialogData printDialogData(* g_printData);
|
||||
|
||||
wxPostScriptPrinter printer(&printDialogData);
|
||||
MyPrintout printout(this, wxT("My printout"));
|
||||
MyPrintout printout(this, "My printout");
|
||||
printer.Print(this, &printout, true/*prompt*/);
|
||||
|
||||
(*g_printData) = printer.GetPrintDialogData().GetPrintData();
|
||||
@ -431,7 +431,7 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
|
||||
wxPrintDialogData printDialogData(* g_printData);
|
||||
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout(this), new MyPrintout(this), &printDialogData);
|
||||
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->Initialize();
|
||||
frame->Show();
|
||||
@ -464,8 +464,8 @@ void MyFrame::OnPageMargins(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
(void)wxMessageBox(wxT("wxWidgets printing demo\nAuthor: Julian Smart"),
|
||||
wxT("About wxWidgets printing demo"), wxOK|wxCENTRE);
|
||||
(void)wxMessageBox("wxWidgets printing demo\nAuthor: Julian Smart",
|
||||
"About wxWidgets printing demo", wxOK|wxCENTRE);
|
||||
}
|
||||
|
||||
void MyFrame::OnAngleUp(wxCommandEvent& WXUNUSED(event))
|
||||
@ -527,7 +527,7 @@ bool MyPrintout::OnPrintPage(int page)
|
||||
// screen size of text matches paper size.
|
||||
MapScreenSizeToPage();
|
||||
|
||||
dc->DrawText(wxString::Format(wxT("PAGE %d"), page), 0, 0);
|
||||
dc->DrawText(wxString::Format("PAGE %d", page), 0, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -683,8 +683,8 @@ void MyPrintout::DrawPageTwo()
|
||||
dc->SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
|
||||
{ // GetTextExtent demo:
|
||||
wxString words[7] = { wxT("This "), wxT("is "), wxT("GetTextExtent "),
|
||||
wxT("testing "), wxT("string. "), wxT("Enjoy "), wxT("it!") };
|
||||
wxString words[7] = { "This ", "is ", "GetTextExtent ",
|
||||
"testing ", "string. ", "Enjoy ", "it!" };
|
||||
long x = 200, y= 250;
|
||||
|
||||
dc->SetFont(wxFontInfo(15).Family(wxFONTFAMILY_SWISS));
|
||||
@ -705,7 +705,7 @@ void MyPrintout::DrawPageTwo()
|
||||
|
||||
dc->SetFont(wxGetApp().GetTestFont());
|
||||
|
||||
dc->DrawText(wxT("Some test text"), 200, 300 );
|
||||
dc->DrawText("Some test text", 200, 300 );
|
||||
|
||||
// TESTING
|
||||
|
||||
@ -728,7 +728,7 @@ void MyPrintout::DrawPageTwo()
|
||||
dc->DrawLine( (long)leftMarginLogical, (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.
|
||||
|
@ -86,7 +86,7 @@ private:
|
||||
class MyPrintout: public wxPrintout
|
||||
{
|
||||
public:
|
||||
MyPrintout(MyFrame* frame, const wxString &title = wxT("My printout"))
|
||||
MyPrintout(MyFrame* frame, const wxString &title = "My printout")
|
||||
: wxPrintout(title) { m_frame=frame; }
|
||||
|
||||
virtual bool OnPrintPage(int page) wxOVERRIDE;
|
||||
|
@ -135,7 +135,7 @@ private:
|
||||
void Refresh();
|
||||
bool DeleteChild(TreeNode *child);
|
||||
void DestroyChildren();
|
||||
const wxChar *FullName() const;
|
||||
const wxString FullName() const;
|
||||
void SetRegistryView(wxRegKey::WOW64ViewMode viewMode);
|
||||
|
||||
// get the associated key: make sure the pointer is !NULL
|
||||
@ -186,7 +186,7 @@ class RegFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
// 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();
|
||||
|
||||
// callbacks
|
||||
@ -304,38 +304,38 @@ wxEND_EVENT_TABLE()
|
||||
wxMenu *CreateRegistryMenu()
|
||||
{
|
||||
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->Append(Menu_NewText, wxT("&Text value"), wxT("Create a new text value"));
|
||||
pMenuNew->Append(Menu_NewBinary, wxT("&Binary value"), wxT("Create a new binary value"));
|
||||
pMenuNew->Append(Menu_NewText, "&Text value", "Create a new text value");
|
||||
pMenuNew->Append(Menu_NewBinary, "&Binary value", "Create a new binary value");
|
||||
|
||||
wxMenu *pMenuView = new wxMenu;
|
||||
pMenuView->AppendRadioItem(
|
||||
Menu_ViewDefault,
|
||||
wxT("&Default"),
|
||||
wxT("Default registry view for the program environment."));
|
||||
"&Default",
|
||||
"Default registry view for the program environment.");
|
||||
pMenuView->AppendRadioItem(
|
||||
Menu_View32,
|
||||
wxT("32-bit Registry"),
|
||||
wxT("View 32-bit registry."));
|
||||
"32-bit Registry",
|
||||
"View 32-bit registry.");
|
||||
pMenuView->AppendRadioItem(
|
||||
Menu_View64,
|
||||
wxT("64-bit Registry"),
|
||||
wxT("View 64-bit registry."));
|
||||
"64-bit Registry",
|
||||
"View 64-bit registry.");
|
||||
|
||||
wxMenu *pMenuReg = new wxMenu;
|
||||
pMenuReg->Append(Menu_New, wxT("&New"), pMenuNew);
|
||||
pMenuReg->Append(Menu_Delete, wxT("&Delete..."), wxT("Delete selected key/value"));
|
||||
pMenuReg->Append(Menu_New, "&New", pMenuNew);
|
||||
pMenuReg->Append(Menu_Delete, "&Delete...", "Delete selected key/value");
|
||||
pMenuReg->AppendSeparator();
|
||||
pMenuReg->Append(Menu_GoTo, wxT("&Go to...\tCtrl-G"), wxT("Go to registry key"));
|
||||
pMenuReg->Append(Menu_Expand, wxT("&Expand"), wxT("Expand current key"));
|
||||
pMenuReg->Append(Menu_Collapse, wxT("&Collapse"), wxT("Collapse current key"));
|
||||
pMenuReg->Append(Menu_Toggle, wxT("&Toggle"), wxT("Toggle current key"));
|
||||
pMenuReg->Append(Menu_GoTo, "&Go to...\tCtrl-G", "Go to registry key");
|
||||
pMenuReg->Append(Menu_Expand, "&Expand", "Expand current key");
|
||||
pMenuReg->Append(Menu_Collapse, "&Collapse", "Collapse current key");
|
||||
pMenuReg->Append(Menu_Toggle, "&Toggle", "Toggle current key");
|
||||
pMenuReg->AppendSeparator();
|
||||
pMenuReg->Append(Menu_Refresh, wxT("&Refresh"), wxT("Refresh the subtree"));
|
||||
pMenuReg->Append(Menu_View, wxT("&View"), pMenuView);
|
||||
pMenuReg->Append(Menu_Refresh, "&Refresh", "Refresh the subtree");
|
||||
pMenuReg->Append(Menu_View, "&View", pMenuView);
|
||||
pMenuReg->AppendSeparator();
|
||||
pMenuReg->Append(Menu_Info, wxT("&Properties"),wxT("Information about current selection"));
|
||||
pMenuReg->Append(Menu_Info, "&Properties","Information about current selection");
|
||||
|
||||
return pMenuReg;
|
||||
}
|
||||
@ -352,7 +352,7 @@ bool RegApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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);
|
||||
|
||||
return true;
|
||||
@ -362,7 +362,7 @@ bool RegApp::OnInit()
|
||||
// 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))
|
||||
{
|
||||
// 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
|
||||
// ------------
|
||||
SetIcon(wxIcon(wxT("app_icon")));
|
||||
SetIcon(wxIcon("app_icon"));
|
||||
|
||||
// create menu
|
||||
// -----------
|
||||
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->Append(Menu_About, wxT("&About"), wxT("Show an extraordinarily beautiful dialog"));
|
||||
pMenuFile->Append(Menu_About, "&About", "Show an extraordinarily beautiful dialog");
|
||||
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;
|
||||
pMenu->Append(pMenuFile, wxT("&File"));
|
||||
pMenu->Append(CreateRegistryMenu(), wxT("&Registry"));
|
||||
pMenu->Append(pMenuFile, "&File");
|
||||
pMenu->Append(CreateRegistryMenu(), "&Registry");
|
||||
SetMenuBar(pMenu);
|
||||
|
||||
#if DO_REGTEST
|
||||
@ -415,9 +415,9 @@ void RegFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void RegFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageDialog dialog(this,
|
||||
wxT("wxRegistry sample\n")
|
||||
wxT("(c) 1998, 2000 Vadim Zeitlin"),
|
||||
wxT("About wxRegTest"), wxOK);
|
||||
"wxRegistry sample\n"
|
||||
"(c) 1998, 2000 Vadim Zeitlin",
|
||||
"About wxRegTest", wxOK);
|
||||
|
||||
dialog.ShowModal();
|
||||
}
|
||||
@ -431,11 +431,11 @@ void RegFrame::OnTest(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(
|
||||
wxT("Enter the location to go to:"),
|
||||
wxT("wxRegTest question"),
|
||||
"Enter the location to go to:",
|
||||
"wxRegTest question",
|
||||
s_location,
|
||||
this);
|
||||
|
||||
@ -489,7 +489,7 @@ void RegFrame::OnNewKey(wxCommandEvent& WXUNUSED(event))
|
||||
if ( m_treeCtrl->IsKeySelected() )
|
||||
{
|
||||
m_treeCtrl->CreateNewKey(
|
||||
wxGetTextFromUser(wxT("Enter the name of the new key")));
|
||||
wxGetTextFromUser("Enter the name of the new key"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -500,7 +500,7 @@ void RegFrame::OnNewText(wxCommandEvent& WXUNUSED(event))
|
||||
if ( m_treeCtrl->IsKeySelected() )
|
||||
{
|
||||
m_treeCtrl->CreateNewTextValue(
|
||||
wxGetTextFromUser(wxT("Enter the name for the new text value")));
|
||||
wxGetTextFromUser("Enter the name for the new text value"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -511,7 +511,7 @@ void RegFrame::OnNewBinary(wxCommandEvent& WXUNUSED(event))
|
||||
if ( m_treeCtrl->IsKeySelected() )
|
||||
{
|
||||
m_treeCtrl->CreateNewBinaryValue(
|
||||
wxGetTextFromUser(wxT("Enter the name for the new binary value")));
|
||||
wxGetTextFromUser("Enter the name for the new binary value"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -556,8 +556,8 @@ void RegFrame::OnViewChange(wxCommandEvent& event)
|
||||
RegImageList::RegImageList() : wxImageList(16, 16, true)
|
||||
{
|
||||
// should be in sync with enum RegImageList::RegIcon
|
||||
static const wxChar *aszIcons[] = { wxT("key1"),wxT("key2"),wxT("key3"),wxT("value1"),wxT("value2") };
|
||||
wxString str = wxT("icon_");
|
||||
static const wxString aszIcons[] = { "key1","key2","key3","value1","value2" };
|
||||
wxString str = "icon_";
|
||||
for ( unsigned int n = 0; n < WXSIZEOF(aszIcons); n++ )
|
||||
{
|
||||
Add(wxIcon(str + aszIcons[n], wxBITMAP_TYPE_ICO_RESOURCE));
|
||||
@ -597,7 +597,7 @@ RegTreeCtrl::TreeNode *RegTreeCtrl::InsertNewTreeNode(
|
||||
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
|
||||
SetItemData(pNewNode->m_id, pNewNode);
|
||||
@ -643,7 +643,7 @@ RegTreeCtrl::RegTreeCtrl(wxWindow *parent, wxWindowID id)
|
||||
m_pRoot =
|
||||
InsertNewTreeNode(
|
||||
NULL,
|
||||
wxT("Registry Root"),
|
||||
"Registry Root",
|
||||
RegImageList::Root,
|
||||
NULL,
|
||||
m_viewMode);
|
||||
@ -682,7 +682,7 @@ void RegTreeCtrl::OnIdle(wxIdleEvent& WXUNUSED(event))
|
||||
if ( m_restoreStatus )
|
||||
{
|
||||
// restore it after OnItemExpanding()
|
||||
wxLogStatus(wxT("Ok"));
|
||||
wxLogStatus("Ok");
|
||||
wxSetCursor(*wxSTANDARD_CURSOR);
|
||||
|
||||
m_restoreStatus = false;
|
||||
@ -714,40 +714,40 @@ void RegTreeCtrl::OnMenuTest()
|
||||
wxTreeItemId lId = GetSelection();
|
||||
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() )
|
||||
{
|
||||
wxLogError(wxT("Can't create a subkey under the root key."));
|
||||
wxLogError("Can't create a subkey under the root key.");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !pNode->IsKey() )
|
||||
{
|
||||
wxLogError(wxT("Can't create a subkey under a value!"));
|
||||
wxLogError("Can't create a subkey under a value!");
|
||||
return;
|
||||
}
|
||||
|
||||
wxRegKey key1(pNode->Key(), wxT("key1"));
|
||||
wxRegKey key1(pNode->Key(), "key1");
|
||||
if ( key1.Create() )
|
||||
{
|
||||
wxRegKey key2a(key1, wxT("key2a")), key2b(key1, wxT("key2b"));
|
||||
wxRegKey key2a(key1, "key2a"), key2b(key1, "key2b");
|
||||
if ( key2a.Create() && key2b.Create() )
|
||||
{
|
||||
// put some values under the newly created keys
|
||||
key1.SetValue(wxT("first_term"), wxT("10"));
|
||||
key1.SetValue(wxT("second_term"), wxT("7"));
|
||||
key2a = wxT("this is the unnamed value");
|
||||
key2b.SetValue(wxT("sum"), 17);
|
||||
key1.SetValue("first_term", "10");
|
||||
key1.SetValue("second_term", "7");
|
||||
key2a = "this is the unnamed value";
|
||||
key2b.SetValue("sum", 17);
|
||||
|
||||
// refresh tree
|
||||
pNode->Refresh();
|
||||
wxLogStatus(wxT("Test keys successfully added."));
|
||||
wxLogStatus("Test keys successfully added.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
wxLogError(wxT("Creation of test keys failed."));
|
||||
wxLogError("Creation of test keys failed.");
|
||||
}
|
||||
|
||||
void RegTreeCtrl::OnChar(wxKeyEvent& event)
|
||||
@ -787,7 +787,7 @@ void RegTreeCtrl::OnItemExpanding(wxTreeEvent& event)
|
||||
|
||||
// expansion might take some time
|
||||
wxSetCursor(*wxHOURGLASS_CURSOR);
|
||||
wxLogStatus(wxT("Working..."));
|
||||
wxLogStatus("Working...");
|
||||
wxYield(); // to give the status line a chance to refresh itself
|
||||
m_restoreStatus = true; // some time later...
|
||||
|
||||
@ -812,7 +812,7 @@ void RegTreeCtrl::OnBeginEdit(wxTreeEvent& event)
|
||||
TreeNode *pNode = GetNode(event);
|
||||
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();
|
||||
}
|
||||
@ -844,7 +844,7 @@ void RegTreeCtrl::OnEndEdit(wxTreeEvent& event)
|
||||
|
||||
if ( !ok )
|
||||
{
|
||||
wxLogError(wxT("Failed to rename '%s' to '%s'."),
|
||||
wxLogError("Failed to rename '%s' to '%s'.",
|
||||
m_nameOld.c_str(), name.c_str());
|
||||
}
|
||||
#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);
|
||||
if ( pNode->IsRoot() || pNode->Parent()->IsRoot() )
|
||||
{
|
||||
wxLogStatus(wxT("This registry key can't be %s."),
|
||||
m_copyOnDrop ? wxT("copied") : wxT("moved"));
|
||||
wxLogStatus("This registry key can't be %s.",
|
||||
m_copyOnDrop ? "copied" : "moved");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(wxT("%s item %s..."),
|
||||
m_copyOnDrop ? wxT("Copying") : wxT("Moving"),
|
||||
wxLogStatus("%s item %s...",
|
||||
m_copyOnDrop ? "Copying" : "Moving",
|
||||
pNode->FullName());
|
||||
|
||||
m_draggedItem = pNode;
|
||||
@ -879,7 +879,7 @@ void RegTreeCtrl::OnBeginDrag(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
|
||||
TreeNode *src = m_draggedItem;
|
||||
@ -895,7 +895,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
|
||||
|
||||
if ( !dst || dst->IsRoot() )
|
||||
{
|
||||
wxLogError(wxT("Can't create a key here."));
|
||||
wxLogError("Can't create a key here.");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -903,7 +903,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
|
||||
bool isKey = src->IsKey();
|
||||
if ( (isKey && (src == dst)) ||
|
||||
(!isKey && (dst->Parent() == src)) ) {
|
||||
wxLogStatus(wxT("Can't copy something on itself"));
|
||||
wxLogStatus("Can't copy something on itself");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -914,18 +914,18 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
|
||||
nameDst << wxString(dst->FullName()).AfterFirst('\\') << '\\'
|
||||
<< wxString(src->FullName()).AfterLast('\\');
|
||||
|
||||
wxString verb = m_copyOnDrop ? wxT("copy") : wxT("move");
|
||||
wxString what = isKey ? wxT("key") : wxT("value");
|
||||
wxString verb = m_copyOnDrop ? "copy" : "move";
|
||||
wxString what = isKey ? "key" : "value";
|
||||
|
||||
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(),
|
||||
what.c_str(),
|
||||
nameSrc.c_str(),
|
||||
nameDst.c_str()
|
||||
),
|
||||
wxT("RegTest Confirm"),
|
||||
"RegTest Confirm",
|
||||
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) {
|
||||
return;
|
||||
}
|
||||
@ -938,7 +938,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
|
||||
ok = keyDst.Create(false);
|
||||
if ( !ok )
|
||||
{
|
||||
wxLogError(wxT("Key '%s' already exists"), keyDst.GetName().c_str());
|
||||
wxLogError("Key '%s' already exists", keyDst.GetName().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -968,7 +968,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
|
||||
|
||||
if ( !ok )
|
||||
{
|
||||
wxLogError(wxT("Failed to %s registry %s."),
|
||||
wxLogError("Failed to %s registry %s.",
|
||||
verb.c_str(), what.c_str());
|
||||
}
|
||||
else
|
||||
@ -1009,7 +1009,7 @@ bool RegTreeCtrl::TreeNode::OnExpand()
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1043,10 +1043,10 @@ bool RegTreeCtrl::TreeNode::OnExpand()
|
||||
{
|
||||
wxString strItem;
|
||||
if (str.empty())
|
||||
strItem = wxT("<default>");
|
||||
strItem = "<default>";
|
||||
else
|
||||
strItem = str;
|
||||
strItem += wxT(" = ");
|
||||
strItem += " = ";
|
||||
|
||||
// determine the appropriate icon
|
||||
RegImageList::Icon icon;
|
||||
@ -1131,7 +1131,7 @@ bool RegTreeCtrl::TreeNode::DeleteChild(TreeNode *child)
|
||||
{
|
||||
int index = m_aChildren.Index(child);
|
||||
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);
|
||||
|
||||
@ -1177,20 +1177,20 @@ RegTreeCtrl::TreeNode::~TreeNode()
|
||||
delete m_pKey;
|
||||
}
|
||||
|
||||
const wxChar *RegTreeCtrl::TreeNode::FullName() const
|
||||
const wxString RegTreeCtrl::TreeNode::FullName() const
|
||||
{
|
||||
static wxString s_strName;
|
||||
|
||||
if ( IsRoot() )
|
||||
{
|
||||
return wxT("Registry Root");
|
||||
return "Registry Root";
|
||||
}
|
||||
else
|
||||
{
|
||||
// our own registry key might not (yet) exist or we might be a value,
|
||||
// so just use the parent's and concatenate
|
||||
s_strName = Parent()->FullName();
|
||||
s_strName << wxT('\\') << m_strName;
|
||||
s_strName << '\\' << m_strName;
|
||||
|
||||
return s_strName.t_str();
|
||||
}
|
||||
@ -1212,7 +1212,7 @@ void RegTreeCtrl::TreeNode::SetRegistryView(wxRegKey::WOW64ViewMode viewMode)
|
||||
|
||||
void RegTreeCtrl::GoTo(const wxString& location)
|
||||
{
|
||||
wxStringTokenizer tk(location, wxT("\\"));
|
||||
wxStringTokenizer tk(location, "\\");
|
||||
|
||||
wxTreeItemId id = GetRootItem();
|
||||
|
||||
@ -1255,7 +1255,7 @@ void RegTreeCtrl::GoTo(const wxString& location)
|
||||
|
||||
if ( !id.IsOk() )
|
||||
{
|
||||
wxLogError(wxT("No such key '%s'."), location.c_str());
|
||||
wxLogError("No such key '%s'.", location.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1272,28 +1272,28 @@ void RegTreeCtrl::DeleteSelected()
|
||||
|
||||
if ( lParent == GetRootItem() )
|
||||
{
|
||||
wxLogError(wxT("Can't delete root key."));
|
||||
wxLogError("Can't delete root key.");
|
||||
return;
|
||||
}
|
||||
|
||||
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent),
|
||||
*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() )
|
||||
{
|
||||
wxLogError(wxT("Can't delete standard key."));
|
||||
wxLogError("Can't delete standard key.");
|
||||
return;
|
||||
}
|
||||
|
||||
wxString what = pCurrent->IsKey() ? wxT("key") : wxT("value");
|
||||
wxString what = pCurrent->IsKey() ? "key" : "value";
|
||||
if ( wxMessageBox(wxString::Format
|
||||
(
|
||||
wxT("Do you really want to delete this %s?"),
|
||||
"Do you really want to delete this %s?",
|
||||
what.c_str()
|
||||
),
|
||||
wxT("Confirmation"),
|
||||
"Confirmation",
|
||||
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES )
|
||||
{
|
||||
return;
|
||||
@ -1307,13 +1307,13 @@ void RegTreeCtrl::CreateNewKey(const wxString& strName)
|
||||
wxTreeItemId lCurrent = GetSelection();
|
||||
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
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1327,13 +1327,13 @@ void RegTreeCtrl::CreateNewTextValue(const wxString& strName)
|
||||
wxTreeItemId lCurrent = GetSelection();
|
||||
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
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1346,13 +1346,13 @@ void RegTreeCtrl::CreateNewBinaryValue(const wxString& strName)
|
||||
wxTreeItemId lCurrent = GetSelection();
|
||||
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
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1374,7 +1374,7 @@ void RegTreeCtrl::ShowProperties()
|
||||
|
||||
if ( !pCurrent || pCurrent->IsRoot() )
|
||||
{
|
||||
wxLogStatus(wxT("No properties"));
|
||||
wxLogStatus("No properties");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1385,27 +1385,27 @@ void RegTreeCtrl::ShowProperties()
|
||||
size_t nSubKeys, nValues;
|
||||
if ( !key.GetKeyInfo(&nSubKeys, NULL, &nValues, NULL) )
|
||||
{
|
||||
wxLogError(wxT("Couldn't get key info"));
|
||||
wxLogError("Couldn't get key info");
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
else // it's a value
|
||||
{
|
||||
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 wxChar *value = pCurrent->m_strName.c_str();
|
||||
wxLogMessage(wxT("Value '%s' under the key '%s' is of type ")
|
||||
wxT("%d (%s)."),
|
||||
wxLogMessage("Value '%s' under the key '%s' is of type "
|
||||
"%d (%s).",
|
||||
value,
|
||||
parent->m_strName.c_str(),
|
||||
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);
|
||||
|
||||
wxCHECK_RET( pNode != NULL, wxT("tree item without data?") );
|
||||
wxCHECK_RET( pNode != NULL, "tree item without data?" );
|
||||
|
||||
pNode->Refresh();
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ public:
|
||||
#if 0 // just for debugging
|
||||
MyDllRenderer()
|
||||
{
|
||||
wxMessageBox(wxT("Creating MyDllRenderer"), wxT("Renderer Sample"));
|
||||
wxMessageBox("Creating MyDllRenderer", "Renderer Sample");
|
||||
}
|
||||
|
||||
virtual ~MyDllRenderer()
|
||||
{
|
||||
wxMessageBox(wxT("Deleting MyDllRenderer"), wxT("Renderer Sample"));
|
||||
wxMessageBox("Deleting MyDllRenderer", "Renderer Sample");
|
||||
}
|
||||
#endif // 0
|
||||
};
|
||||
|
@ -436,7 +436,7 @@ bool MyApp::OnInit()
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame(NULL,
|
||||
wxID_ANY,
|
||||
wxT("Render wxWidgets Sample"))
|
||||
"Render wxWidgets Sample")
|
||||
{
|
||||
// set the frame icon
|
||||
SetIcon(wxICON(sample));
|
||||
@ -471,8 +471,8 @@ MyFrame::MyFrame()
|
||||
|
||||
menuFile->AppendCheckItem(Render_UseGeneric, "Use &generic renderer\tCtrl-G");
|
||||
#if wxUSE_DYNLIB_CLASS
|
||||
menuFile->Append(Render_Load, wxT("&Load renderer...\tCtrl-L"));
|
||||
menuFile->Append(Render_Unload, wxT("&Unload renderer\tCtrl-U"));
|
||||
menuFile->Append(Render_Load, "&Load renderer...\tCtrl-L");
|
||||
menuFile->Append(Render_Unload, "&Unload renderer\tCtrl-U");
|
||||
menuFile->AppendSeparator();
|
||||
#endif // wxUSE_DYNLIB_CLASS
|
||||
menuFile->Append(Render_Quit);
|
||||
@ -483,8 +483,8 @@ MyFrame::MyFrame()
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -497,7 +497,7 @@ MyFrame::MyFrame()
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
Show();
|
||||
@ -551,12 +551,12 @@ void MyFrame::OnUseGeneric(wxCommandEvent& event)
|
||||
|
||||
void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
static wxString s_name = wxT("renddll");
|
||||
static wxString s_name = "renddll";
|
||||
|
||||
wxString name = wxGetTextFromUser
|
||||
(
|
||||
wxT("Name of the renderer to load:"),
|
||||
wxT("Render wxWidgets Sample"),
|
||||
"Name of the renderer to load:",
|
||||
"Render wxWidgets Sample",
|
||||
s_name,
|
||||
this
|
||||
);
|
||||
@ -593,11 +593,11 @@ void MyFrame::OnUnload(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
m_panel->Refresh();
|
||||
|
||||
wxLogStatus(this, wxT("Unloaded the previously loaded renderer."));
|
||||
wxLogStatus(this, "Unloaded the previously loaded renderer.");
|
||||
}
|
||||
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))
|
||||
{
|
||||
wxMessageBox(wxT("Render sample shows how to use custom renderers.\n")
|
||||
wxT("\n")
|
||||
wxT("(c) 2003 Vadim Zeitlin"),
|
||||
wxT("About Render wxWidgets Sample"),
|
||||
wxMessageBox("Render sample shows how to use custom renderers.\n"
|
||||
"\n"
|
||||
"(c) 2003 Vadim Zeitlin",
|
||||
"About Render wxWidgets Sample",
|
||||
wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ wxEND_EVENT_TABLE()
|
||||
#include "triangle.xpm"
|
||||
|
||||
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
|
||||
| wxRIBBON_BAR_SHOW_PAGE_LABELS
|
||||
@ -298,8 +298,8 @@ MyFrame::MyFrame()
|
||||
);
|
||||
|
||||
{
|
||||
wxRibbonPage* home = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Examples"), ribbon_xpm);
|
||||
wxRibbonPanel *toolbar_panel = new wxRibbonPanel(home, wxID_ANY, wxT("Toolbar"),
|
||||
wxRibbonPage* home = new wxRibbonPage(m_ribbon, wxID_ANY, "Examples", ribbon_xpm);
|
||||
wxRibbonPanel *toolbar_panel = new wxRibbonPanel(home, wxID_ANY, "Toolbar",
|
||||
wxNullBitmap, wxDefaultPosition, wxDefaultSize,
|
||||
wxRIBBON_PANEL_NO_AUTO_MINIMISE |
|
||||
wxRIBBON_PANEL_EXT_BUTTON);
|
||||
@ -331,24 +331,24 @@ MyFrame::MyFrame()
|
||||
"This is the Print button tooltip\ndemonstrating a tooltip");
|
||||
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);
|
||||
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");
|
||||
selection->AddButton(ID_SELECTION_EXPAND_H, wxT("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_EXPAND_H, "Expand Horizontally", wxBitmap(expand_selection_h_xpm), wxEmptyString);
|
||||
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);
|
||||
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,
|
||||
"This is a tooltip for the circle button\ndemonstrating another tooltip");
|
||||
shapes->AddButton(ID_CROSS, wxT("Cross"), wxBitmap(cross_xpm), wxEmptyString);
|
||||
shapes->AddHybridButton(ID_TRIANGLE, wxT("Triangle"), wxBitmap(triangle_xpm));
|
||||
shapes->AddButton(ID_SQUARE, wxT("Square"), wxBitmap(square_xpm), wxEmptyString);
|
||||
shapes->AddDropdownButton(ID_POLYGON, wxT("Other Polygon"), wxBitmap(hexagon_xpm), wxEmptyString);
|
||||
shapes->AddButton(ID_CROSS, "Cross", wxBitmap(cross_xpm), wxEmptyString);
|
||||
shapes->AddHybridButton(ID_TRIANGLE, "Triangle", wxBitmap(triangle_xpm));
|
||||
shapes->AddButton(ID_SQUARE, "Square", wxBitmap(square_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,
|
||||
wxRIBBON_PANEL_DEFAULT_STYLE);
|
||||
|
||||
@ -371,8 +371,8 @@ MyFrame::MyFrame()
|
||||
sizer_panelcombo2->SetMinSize(wxSize(150, -1));
|
||||
|
||||
wxRibbonButtonBar* bar = new wxRibbonButtonBar(sizer_panel, wxID_ANY);
|
||||
bar->AddButton(ID_BUTTON_XX, wxT("xx"), ribbon_xpm);
|
||||
bar->AddButton(ID_BUTTON_XY, wxT("xy"), ribbon_xpm);
|
||||
bar->AddButton(ID_BUTTON_XX, "xx", ribbon_xpm);
|
||||
bar->AddButton(ID_BUTTON_XY, "xy", ribbon_xpm);
|
||||
// This prevents ribbon buttons in panels with sizer from collapsing.
|
||||
bar->SetButtonMinSizeClass(ID_BUTTON_XX, 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());
|
||||
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_default_secondary, &m_default_tertiary);
|
||||
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);
|
||||
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)));
|
||||
provider_bar->AddButton(ID_AUI_PROVIDER, wxT("AUI Provider"), aui_style_xpm);
|
||||
provider_bar->AddButton(ID_MSW_PROVIDER, wxT("MSW Provider"), msw_style_xpm);
|
||||
provider_bar->AddButton(ID_AUI_PROVIDER, "AUI Provider", aui_style_xpm);
|
||||
provider_bar->AddButton(ID_MSW_PROVIDER, "MSW Provider", msw_style_xpm);
|
||||
wxRibbonPanel *primary_panel = new wxRibbonPanel(scheme, wxID_ANY,
|
||||
wxT("Primary Colour"), colours_xpm);
|
||||
"Primary Colour", colours_xpm);
|
||||
m_primary_gallery = PopulateColoursPanel(primary_panel,
|
||||
m_default_primary, ID_PRIMARY_COLOUR);
|
||||
wxRibbonPanel *secondary_panel = new wxRibbonPanel(scheme, wxID_ANY,
|
||||
wxT("Secondary Colour"), colours_xpm);
|
||||
"Secondary Colour", colours_xpm);
|
||||
m_secondary_gallery = PopulateColoursPanel(secondary_panel,
|
||||
m_default_secondary, ID_SECONDARY_COLOUR);
|
||||
}
|
||||
{
|
||||
wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("UI Updated"), ribbon_xpm);
|
||||
wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, wxT("Enable/Disable"), ribbon_xpm);
|
||||
wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, "UI Updated", ribbon_xpm);
|
||||
wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, "Enable/Disable", ribbon_xpm);
|
||||
wxRibbonButtonBar *bar = new wxRibbonButtonBar(panel, wxID_ANY);
|
||||
bar->AddButton(ID_DISABLED, wxT("Disabled"), ribbon_xpm);
|
||||
bar->AddButton(ID_ENABLE, wxT("Enable"), ribbon_xpm);
|
||||
bar->AddButton(ID_DISABLE, wxT("Disable"), ribbon_xpm);
|
||||
bar->AddButton(ID_UI_ENABLE_UPDATED, wxT("Enable UI updated"), ribbon_xpm);
|
||||
bar->AddButton(ID_DISABLED, "Disabled", ribbon_xpm);
|
||||
bar->AddButton(ID_ENABLE, "Enable", ribbon_xpm);
|
||||
bar->AddButton(ID_DISABLE, "Disable", ribbon_xpm);
|
||||
bar->AddButton(ID_UI_ENABLE_UPDATED, "Enable UI updated", ribbon_xpm);
|
||||
bar->EnableButton(ID_DISABLED, false);
|
||||
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->AddButton(ID_CHECK, wxT("Toggle"), ribbon_xpm);
|
||||
bar->AddToggleButton(ID_UI_CHECK_UPDATED, wxT("Toggled UI updated"), ribbon_xpm);
|
||||
bar->AddButton(ID_CHECK, "Toggle", ribbon_xpm);
|
||||
bar->AddToggleButton(ID_UI_CHECK_UPDATED, "Toggled UI updated", ribbon_xpm);
|
||||
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->AddButton(ID_CHANGE_TEXT1, wxT("One"), ribbon_xpm);
|
||||
bar->AddButton(ID_CHANGE_TEXT2, wxT("Two"), ribbon_xpm);
|
||||
bar->AddButton(ID_UI_CHANGE_TEXT_UPDATED, wxT("Zero"), ribbon_xpm);
|
||||
bar->AddButton(ID_CHANGE_TEXT1, "One", ribbon_xpm);
|
||||
bar->AddButton(ID_CHANGE_TEXT2, "Two", ribbon_xpm);
|
||||
bar->AddButton(ID_UI_CHANGE_TEXT_UPDATED, "Zero", ribbon_xpm);
|
||||
|
||||
//Also set the general disabled text colour:
|
||||
wxRibbonArtProvider* artProvider = m_ribbon->GetArtProvider();
|
||||
wxColour tColour = artProvider->GetColor(wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR);
|
||||
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);
|
||||
wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, wxT("Page manipulation"), ribbon_xpm);
|
||||
wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, "Another Page", empty_xpm);
|
||||
wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, "Page manipulation", ribbon_xpm);
|
||||
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_HIDE_PAGES, wxT("Hide Pages"), ribbon_xpm);
|
||||
bar->AddButton(ID_SHOW_PAGES, wxT("Show Pages"), ribbon_xpm);
|
||||
bar->AddButton(ID_REMOVE_PAGE, "Remove", wxArtProvider::GetBitmap(wxART_DELETE, wxART_OTHER, wxSize(24, 24)));
|
||||
bar->AddButton(ID_HIDE_PAGES, "Hide 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->AddButton(ID_PLUS_MINUS, wxT("+/-"),
|
||||
m_mutable_button_bar->AddButton(ID_PLUS_MINUS, "+/-",
|
||||
wxArtProvider::GetBitmap(wxART_PLUS, wxART_OTHER, wxSize(24, 24)));
|
||||
m_plus_minus_state = false;
|
||||
m_mutable_button_bar->AddButton(ID_CHANGE_LABEL, wxT("short"), ribbon_xpm);
|
||||
m_mutable_button_bar->SetButtonTextMinWidth(ID_CHANGE_LABEL, wxT("some long text"));
|
||||
m_mutable_button_bar->AddButton(ID_CHANGE_LABEL, "short", ribbon_xpm);
|
||||
m_mutable_button_bar->SetButtonTextMinWidth(ID_CHANGE_LABEL, "some long text");
|
||||
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->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->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->AddButton(ID_SMALL_BUTTON_3, wxT("Button 3"), ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_4, wxT("Button 4"), ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_5, wxT("Button 5"), ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_3, "Button 3", ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_4, "Button 4", ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_5, "Button 5", ribbon_xpm);
|
||||
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);
|
||||
}
|
||||
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);
|
||||
|
||||
{
|
||||
wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Advanced"), empty_xpm);
|
||||
wxRibbonPanel* panel = new wxRibbonPanel(page, wxID_ANY, wxT("Button bar manipulation"), ribbon_xpm);
|
||||
wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, "Advanced", empty_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->AddButton(ID_PLUS_MINUS, wxT("+/-"),
|
||||
m_mutable_button_bar->AddButton(ID_PLUS_MINUS, "+/-",
|
||||
wxArtProvider::GetBitmap(wxART_PLUS, wxART_OTHER, wxSize(24, 24)));
|
||||
m_plus_minus_state = false;
|
||||
m_mutable_button_bar->AddButton(ID_CHANGE_LABEL, wxT("short"), ribbon_xpm);
|
||||
m_mutable_button_bar->SetButtonTextMinWidth(ID_CHANGE_LABEL, wxT("some long text"));
|
||||
m_mutable_button_bar->AddButton(ID_CHANGE_LABEL, "short", ribbon_xpm);
|
||||
m_mutable_button_bar->SetButtonTextMinWidth(ID_CHANGE_LABEL, "some long text");
|
||||
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);
|
||||
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->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->AddButton(ID_SMALL_BUTTON_3, wxT("Button 3"), ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_4, wxT("Button 4"), ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_5, wxT("Button 5"), ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_3, "Button 3", ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_4, "Button 4", ribbon_xpm);
|
||||
bar->AddButton(ID_SMALL_BUTTON_5, "Button 5", ribbon_xpm);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -567,45 +567,45 @@ wxRibbonGallery* MyFrame::PopulateColoursPanel(wxWindow* panel,
|
||||
gallery = new wxRibbonGallery(panel, gallery_id);
|
||||
wxMemoryDC& dc = m_bitmap_creation_dc;
|
||||
wxRibbonGalleryItem *def_item =
|
||||
AddColourToGallery(gallery, wxT("Default"), dc, &def);
|
||||
AddColourToGallery(gallery, "Default", dc, &def);
|
||||
gallery->SetSelection(def_item);
|
||||
AddColourToGallery(gallery, wxT("BLUE"), dc);
|
||||
AddColourToGallery(gallery, wxT("BLUE VIOLET"), dc);
|
||||
AddColourToGallery(gallery, wxT("BROWN"), dc);
|
||||
AddColourToGallery(gallery, wxT("CADET BLUE"), dc);
|
||||
AddColourToGallery(gallery, wxT("CORAL"), dc);
|
||||
AddColourToGallery(gallery, wxT("CYAN"), dc);
|
||||
AddColourToGallery(gallery, wxT("DARK GREEN"), dc);
|
||||
AddColourToGallery(gallery, wxT("DARK ORCHID"), dc);
|
||||
AddColourToGallery(gallery, wxT("FIREBRICK"), dc);
|
||||
AddColourToGallery(gallery, wxT("GOLD"), dc);
|
||||
AddColourToGallery(gallery, wxT("GOLDENROD"), dc);
|
||||
AddColourToGallery(gallery, wxT("GREEN"), dc);
|
||||
AddColourToGallery(gallery, wxT("INDIAN RED"), dc);
|
||||
AddColourToGallery(gallery, wxT("KHAKI"), dc);
|
||||
AddColourToGallery(gallery, wxT("LIGHT BLUE"), dc);
|
||||
AddColourToGallery(gallery, wxT("LIME GREEN"), dc);
|
||||
AddColourToGallery(gallery, wxT("MAGENTA"), dc);
|
||||
AddColourToGallery(gallery, wxT("MAROON"), dc);
|
||||
AddColourToGallery(gallery, wxT("NAVY"), dc);
|
||||
AddColourToGallery(gallery, wxT("ORANGE"), dc);
|
||||
AddColourToGallery(gallery, wxT("ORCHID"), dc);
|
||||
AddColourToGallery(gallery, wxT("PINK"), dc);
|
||||
AddColourToGallery(gallery, wxT("PLUM"), dc);
|
||||
AddColourToGallery(gallery, wxT("PURPLE"), dc);
|
||||
AddColourToGallery(gallery, wxT("RED"), dc);
|
||||
AddColourToGallery(gallery, wxT("SALMON"), dc);
|
||||
AddColourToGallery(gallery, wxT("SEA GREEN"), dc);
|
||||
AddColourToGallery(gallery, wxT("SIENNA"), dc);
|
||||
AddColourToGallery(gallery, wxT("SKY BLUE"), dc);
|
||||
AddColourToGallery(gallery, wxT("TAN"), dc);
|
||||
AddColourToGallery(gallery, wxT("THISTLE"), dc);
|
||||
AddColourToGallery(gallery, wxT("TURQUOISE"), dc);
|
||||
AddColourToGallery(gallery, wxT("VIOLET"), dc);
|
||||
AddColourToGallery(gallery, wxT("VIOLET RED"), dc);
|
||||
AddColourToGallery(gallery, wxT("WHEAT"), dc);
|
||||
AddColourToGallery(gallery, wxT("WHITE"), dc);
|
||||
AddColourToGallery(gallery, wxT("YELLOW"), dc);
|
||||
AddColourToGallery(gallery, "BLUE", dc);
|
||||
AddColourToGallery(gallery, "BLUE VIOLET", dc);
|
||||
AddColourToGallery(gallery, "BROWN", dc);
|
||||
AddColourToGallery(gallery, "CADET BLUE", dc);
|
||||
AddColourToGallery(gallery, "CORAL", dc);
|
||||
AddColourToGallery(gallery, "CYAN", dc);
|
||||
AddColourToGallery(gallery, "DARK GREEN", dc);
|
||||
AddColourToGallery(gallery, "DARK ORCHID", dc);
|
||||
AddColourToGallery(gallery, "FIREBRICK", dc);
|
||||
AddColourToGallery(gallery, "GOLD", dc);
|
||||
AddColourToGallery(gallery, "GOLDENROD", dc);
|
||||
AddColourToGallery(gallery, "GREEN", dc);
|
||||
AddColourToGallery(gallery, "INDIAN RED", dc);
|
||||
AddColourToGallery(gallery, "KHAKI", dc);
|
||||
AddColourToGallery(gallery, "LIGHT BLUE", dc);
|
||||
AddColourToGallery(gallery, "LIME GREEN", dc);
|
||||
AddColourToGallery(gallery, "MAGENTA", dc);
|
||||
AddColourToGallery(gallery, "MAROON", dc);
|
||||
AddColourToGallery(gallery, "NAVY", dc);
|
||||
AddColourToGallery(gallery, "ORANGE", dc);
|
||||
AddColourToGallery(gallery, "ORCHID", dc);
|
||||
AddColourToGallery(gallery, "PINK", dc);
|
||||
AddColourToGallery(gallery, "PLUM", dc);
|
||||
AddColourToGallery(gallery, "PURPLE", dc);
|
||||
AddColourToGallery(gallery, "RED", dc);
|
||||
AddColourToGallery(gallery, "SALMON", dc);
|
||||
AddColourToGallery(gallery, "SEA GREEN", dc);
|
||||
AddColourToGallery(gallery, "SIENNA", dc);
|
||||
AddColourToGallery(gallery, "SKY BLUE", dc);
|
||||
AddColourToGallery(gallery, "TAN", dc);
|
||||
AddColourToGallery(gallery, "THISTLE", dc);
|
||||
AddColourToGallery(gallery, "TURQUOISE", dc);
|
||||
AddColourToGallery(gallery, "VIOLET", dc);
|
||||
AddColourToGallery(gallery, "VIOLET RED", dc);
|
||||
AddColourToGallery(gallery, "WHEAT", dc);
|
||||
AddColourToGallery(gallery, "WHITE", dc);
|
||||
AddColourToGallery(gallery, "YELLOW", dc);
|
||||
|
||||
return gallery;
|
||||
}
|
||||
@ -687,12 +687,12 @@ void MyFrame::ResetGalleryArtProviders()
|
||||
|
||||
void MyFrame::OnChangeText1(wxRibbonButtonBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
m_new_text = wxT("One");
|
||||
m_new_text = "One";
|
||||
}
|
||||
|
||||
void MyFrame::OnChangeText2(wxRibbonButtonBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
m_new_text = wxT("Two");
|
||||
m_new_text = "Two";
|
||||
}
|
||||
|
||||
void MyFrame::OnEnable(wxRibbonButtonBarEvent& WXUNUSED(evt))
|
||||
@ -735,64 +735,64 @@ void MyFrame::OnChangeTextUpdateUI(wxUpdateUIEvent& evt)
|
||||
if ( !m_new_text.IsEmpty() )
|
||||
{
|
||||
evt.SetText(m_new_text);
|
||||
m_new_text = wxT("");
|
||||
m_new_text = "";
|
||||
}
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
AddText(wxT("Expand selection vertically button clicked."));
|
||||
AddText("Expand selection vertically button clicked.");
|
||||
}
|
||||
|
||||
void MyFrame::OnSelectionContractButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
AddText(wxT("Contract selection button clicked."));
|
||||
AddText("Contract selection button clicked.");
|
||||
}
|
||||
|
||||
void MyFrame::OnCircleButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
AddText(wxT("Circle button clicked."));
|
||||
AddText("Circle button clicked.");
|
||||
}
|
||||
|
||||
void MyFrame::OnCrossButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
AddText(wxT("Cross button clicked."));
|
||||
AddText("Cross button clicked.");
|
||||
}
|
||||
|
||||
void MyFrame::OnTriangleButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
AddText(wxT("Triangle button clicked."));
|
||||
AddText("Triangle button clicked.");
|
||||
}
|
||||
|
||||
void MyFrame::OnTriangleDropdown(wxRibbonButtonBarEvent& evt)
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append(wxID_ANY, wxT("Equilateral"));
|
||||
menu.Append(wxID_ANY, wxT("Isosceles"));
|
||||
menu.Append(wxID_ANY, wxT("Scalene"));
|
||||
menu.Append(wxID_ANY, "Equilateral");
|
||||
menu.Append(wxID_ANY, "Isosceles");
|
||||
menu.Append(wxID_ANY, "Scalene");
|
||||
|
||||
evt.PopupMenu(&menu);
|
||||
}
|
||||
|
||||
void MyFrame::OnSquareButton(wxRibbonButtonBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
AddText(wxT("Square button clicked."));
|
||||
AddText("Square button clicked.");
|
||||
}
|
||||
|
||||
void MyFrame::OnPolygonDropdown(wxRibbonButtonBarEvent& evt)
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append(wxID_ANY, wxT("Pentagon (5 sided)"));
|
||||
menu.Append(wxID_ANY, wxT("Hexagon (6 sided)"));
|
||||
menu.Append(wxID_ANY, wxT("Heptagon (7 sided)"));
|
||||
menu.Append(wxID_ANY, wxT("Octogon (8 sided)"));
|
||||
menu.Append(wxID_ANY, wxT("Nonagon (9 sided)"));
|
||||
menu.Append(wxID_ANY, wxT("Decagon (10 sided)"));
|
||||
menu.Append(wxID_ANY, "Pentagon (5 sided)");
|
||||
menu.Append(wxID_ANY, "Hexagon (6 sided)");
|
||||
menu.Append(wxID_ANY, "Heptagon (7 sided)");
|
||||
menu.Append(wxID_ANY, "Octogon (8 sided)");
|
||||
menu.Append(wxID_ANY, "Nonagon (9 sided)");
|
||||
menu.Append(wxID_ANY, "Decagon (10 sided)");
|
||||
|
||||
evt.PopupMenu(&menu);
|
||||
}
|
||||
@ -833,30 +833,30 @@ void MyFrame::OnJustifyUpdateUI(wxUpdateUIEvent& evt)
|
||||
|
||||
void MyFrame::OnNew(wxRibbonToolBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
AddText(wxT("New button clicked."));
|
||||
AddText("New button clicked.");
|
||||
}
|
||||
|
||||
void MyFrame::OnNewDropdown(wxRibbonToolBarEvent& evt)
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append(wxID_ANY, wxT("New Document"));
|
||||
menu.Append(wxID_ANY, wxT("New Template"));
|
||||
menu.Append(wxID_ANY, wxT("New Mail"));
|
||||
menu.Append(wxID_ANY, "New Document");
|
||||
menu.Append(wxID_ANY, "New Template");
|
||||
menu.Append(wxID_ANY, "New Mail");
|
||||
|
||||
evt.PopupMenu(&menu);
|
||||
}
|
||||
|
||||
void MyFrame::OnPrint(wxRibbonToolBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
AddText(wxT("Print button clicked."));
|
||||
AddText("Print button clicked.");
|
||||
}
|
||||
|
||||
void MyFrame::OnPrintDropdown(wxRibbonToolBarEvent& evt)
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append(wxID_ANY, wxT("Print"));
|
||||
menu.Append(wxID_ANY, wxT("Preview"));
|
||||
menu.Append(wxID_ANY, wxT("Options"));
|
||||
menu.Append(wxID_ANY, "Print");
|
||||
menu.Append(wxID_ANY, "Preview");
|
||||
menu.Append(wxID_ANY, "Options");
|
||||
|
||||
evt.PopupMenu(&menu);
|
||||
}
|
||||
@ -864,9 +864,9 @@ void MyFrame::OnPrintDropdown(wxRibbonToolBarEvent& evt)
|
||||
void MyFrame::OnRedoDropdown(wxRibbonToolBarEvent& evt)
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append(wxID_ANY, wxT("Redo E"));
|
||||
menu.Append(wxID_ANY, wxT("Redo F"));
|
||||
menu.Append(wxID_ANY, wxT("Redo G"));
|
||||
menu.Append(wxID_ANY, "Redo E");
|
||||
menu.Append(wxID_ANY, "Redo F");
|
||||
menu.Append(wxID_ANY, "Redo G");
|
||||
|
||||
evt.PopupMenu(&menu);
|
||||
}
|
||||
@ -874,9 +874,9 @@ void MyFrame::OnRedoDropdown(wxRibbonToolBarEvent& evt)
|
||||
void MyFrame::OnUndoDropdown(wxRibbonToolBarEvent& evt)
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append(wxID_ANY, wxT("Undo C"));
|
||||
menu.Append(wxID_ANY, wxT("Undo B"));
|
||||
menu.Append(wxID_ANY, wxT("Undo A"));
|
||||
menu.Append(wxID_ANY, "Undo C");
|
||||
menu.Append(wxID_ANY, "Undo B");
|
||||
menu.Append(wxID_ANY, "Undo A");
|
||||
|
||||
evt.PopupMenu(&menu);
|
||||
}
|
||||
@ -922,9 +922,9 @@ void MyFrame::OnPositionTop(wxRibbonToolBarEvent& evt)
|
||||
void MyFrame::OnPositionTopDropdown(wxRibbonToolBarEvent& evt)
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append(ID_POSITION_TOP, wxT("Top with Labels"));
|
||||
menu.Append(ID_POSITION_TOP_ICONS, wxT("Top with Icons"));
|
||||
menu.Append(ID_POSITION_TOP_BOTH, wxT("Top with Both"));
|
||||
menu.Append(ID_POSITION_TOP, "Top with Labels");
|
||||
menu.Append(ID_POSITION_TOP_ICONS, "Top with Icons");
|
||||
menu.Append(ID_POSITION_TOP_BOTH, "Top with Both");
|
||||
evt.PopupMenu(&menu);
|
||||
}
|
||||
|
||||
@ -936,9 +936,9 @@ void MyFrame::OnPositionLeft(wxRibbonToolBarEvent& evt)
|
||||
void MyFrame::OnPositionLeftDropdown(wxRibbonToolBarEvent& evt)
|
||||
{
|
||||
wxMenu menu;
|
||||
menu.Append(ID_POSITION_LEFT, wxT("Left with Icons"));
|
||||
menu.Append(ID_POSITION_LEFT_LABELS, wxT("Left with Labels"));
|
||||
menu.Append(ID_POSITION_LEFT_BOTH, wxT("Left with Both"));
|
||||
menu.Append(ID_POSITION_LEFT, "Left with Icons");
|
||||
menu.Append(ID_POSITION_LEFT_LABELS, "Left with Labels");
|
||||
menu.Append(ID_POSITION_LEFT_BOTH, "Left with Both");
|
||||
evt.PopupMenu(&menu);
|
||||
}
|
||||
|
||||
@ -955,7 +955,7 @@ void MyFrame::OnExtButton(wxRibbonPanelEvent& WXUNUSED(evt))
|
||||
void MyFrame::AddText(wxString msg)
|
||||
{
|
||||
m_logwindow->AppendText(msg);
|
||||
m_logwindow->AppendText(wxT("\n"));
|
||||
m_logwindow->AppendText("\n");
|
||||
m_ribbon->DismissExpandedPanel();
|
||||
}
|
||||
|
||||
@ -965,7 +965,7 @@ wxRibbonGalleryItem* MyFrame::AddColourToGallery(wxRibbonGallery *gallery,
|
||||
{
|
||||
wxRibbonGalleryItem* item = NULL;
|
||||
wxColour c;
|
||||
if (colour != wxT("Default"))
|
||||
if (colour != "Default")
|
||||
c = wxColour(colour);
|
||||
if (!c.IsOk())
|
||||
c = *value;
|
||||
@ -1132,12 +1132,12 @@ void MyFrame::OnChangeLabel(wxRibbonButtonBarEvent& WXUNUSED(evt))
|
||||
{
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
virtual bool EditProperties(wxRichTextField* WXUNUSED(obj), wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) wxOVERRIDE
|
||||
{
|
||||
wxString label = GetLabel();
|
||||
wxMessageBox(wxString::Format(wxT("Editing %s"), label.c_str()));
|
||||
wxMessageBox(wxString::Format("Editing %s", label.c_str()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -523,10 +523,10 @@ bool MyApp::OnInit()
|
||||
|
||||
m_styleSheet = new wxRichTextStyleSheet;
|
||||
#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(wxT("Page @PAGENUM@"), wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_RIGHT);
|
||||
m_printing->SetFooterText("@TITLE@", wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_CENTRE);
|
||||
m_printing->SetFooterText("Page @PAGENUM@", wxRICHTEXT_PAGE_ALL, wxRICHTEXT_PAGE_RIGHT);
|
||||
#endif
|
||||
|
||||
CreateStyles();
|
||||
@ -539,21 +539,21 @@ bool MyApp::OnInit()
|
||||
|
||||
// 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);
|
||||
|
||||
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);
|
||||
|
||||
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(s2);
|
||||
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);
|
||||
|
||||
// Add image handlers
|
||||
@ -576,7 +576,7 @@ bool MyApp::OnInit()
|
||||
// create the main application window
|
||||
wxSize size = wxGetDisplaySize();
|
||||
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
|
||||
m_printing->SetParentWindow(frame);
|
||||
@ -609,7 +609,7 @@ void MyApp::CreateStyles()
|
||||
wxFont romanFont(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN));
|
||||
wxFont swissFont(wxFontInfo(12).Family(wxFONTFAMILY_SWISS));
|
||||
|
||||
wxRichTextParagraphStyleDefinition* normalPara = new wxRichTextParagraphStyleDefinition(wxT("Normal"));
|
||||
wxRichTextParagraphStyleDefinition* normalPara = new wxRichTextParagraphStyleDefinition("Normal");
|
||||
wxRichTextAttr normalAttr;
|
||||
normalAttr.SetFontFaceName(romanFont.GetFaceName());
|
||||
normalAttr.SetFontSize(12);
|
||||
@ -621,7 +621,7 @@ void MyApp::CreateStyles()
|
||||
|
||||
m_styleSheet->AddParagraphStyle(normalPara);
|
||||
|
||||
wxRichTextParagraphStyleDefinition* indentedPara = new wxRichTextParagraphStyleDefinition(wxT("Indented"));
|
||||
wxRichTextParagraphStyleDefinition* indentedPara = new wxRichTextParagraphStyleDefinition("Indented");
|
||||
wxRichTextAttr indentedAttr;
|
||||
indentedAttr.SetFontFaceName(romanFont.GetFaceName());
|
||||
indentedAttr.SetFontSize(12);
|
||||
@ -632,7 +632,7 @@ void MyApp::CreateStyles()
|
||||
|
||||
m_styleSheet->AddParagraphStyle(indentedPara);
|
||||
|
||||
wxRichTextParagraphStyleDefinition* indentedPara2 = new wxRichTextParagraphStyleDefinition(wxT("Red Bold Indented"));
|
||||
wxRichTextParagraphStyleDefinition* indentedPara2 = new wxRichTextParagraphStyleDefinition("Red Bold Indented");
|
||||
wxRichTextAttr indentedAttr2;
|
||||
indentedAttr2.SetFontFaceName(romanFont.GetFaceName());
|
||||
indentedAttr2.SetFontSize(12);
|
||||
@ -646,7 +646,7 @@ void MyApp::CreateStyles()
|
||||
|
||||
m_styleSheet->AddParagraphStyle(indentedPara2);
|
||||
|
||||
wxRichTextParagraphStyleDefinition* flIndentedPara = new wxRichTextParagraphStyleDefinition(wxT("First Line Indented"));
|
||||
wxRichTextParagraphStyleDefinition* flIndentedPara = new wxRichTextParagraphStyleDefinition("First Line Indented");
|
||||
wxRichTextAttr flIndentedAttr;
|
||||
flIndentedAttr.SetFontFaceName(swissFont.GetFaceName());
|
||||
flIndentedAttr.SetFontSize(12);
|
||||
@ -659,7 +659,7 @@ void MyApp::CreateStyles()
|
||||
|
||||
// Character styles
|
||||
|
||||
wxRichTextCharacterStyleDefinition* boldDef = new wxRichTextCharacterStyleDefinition(wxT("Bold"));
|
||||
wxRichTextCharacterStyleDefinition* boldDef = new wxRichTextCharacterStyleDefinition("Bold");
|
||||
wxRichTextAttr boldAttr;
|
||||
boldAttr.SetFontFaceName(romanFont.GetFaceName());
|
||||
boldAttr.SetFontSize(12);
|
||||
@ -670,7 +670,7 @@ void MyApp::CreateStyles()
|
||||
|
||||
m_styleSheet->AddCharacterStyle(boldDef);
|
||||
|
||||
wxRichTextCharacterStyleDefinition* italicDef = new wxRichTextCharacterStyleDefinition(wxT("Italic"));
|
||||
wxRichTextCharacterStyleDefinition* italicDef = new wxRichTextCharacterStyleDefinition("Italic");
|
||||
wxRichTextAttr italicAttr;
|
||||
italicAttr.SetFontFaceName(romanFont.GetFaceName());
|
||||
italicAttr.SetFontSize(12);
|
||||
@ -681,7 +681,7 @@ void MyApp::CreateStyles()
|
||||
|
||||
m_styleSheet->AddCharacterStyle(italicDef);
|
||||
|
||||
wxRichTextCharacterStyleDefinition* redDef = new wxRichTextCharacterStyleDefinition(wxT("Red Bold"));
|
||||
wxRichTextCharacterStyleDefinition* redDef = new wxRichTextCharacterStyleDefinition("Red Bold");
|
||||
wxRichTextAttr redAttr;
|
||||
redAttr.SetFontFaceName(romanFont.GetFaceName());
|
||||
redAttr.SetFontSize(12);
|
||||
@ -693,28 +693,28 @@ void MyApp::CreateStyles()
|
||||
|
||||
m_styleSheet->AddCharacterStyle(redDef);
|
||||
|
||||
wxRichTextListStyleDefinition* bulletList = new wxRichTextListStyleDefinition(wxT("Bullet List 1"));
|
||||
wxRichTextListStyleDefinition* bulletList = new wxRichTextListStyleDefinition("Bullet List 1");
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
wxString bulletText;
|
||||
if (i == 0)
|
||||
bulletText = wxT("standard/circle");
|
||||
bulletText = "standard/circle";
|
||||
else if (i == 1)
|
||||
bulletText = wxT("standard/square");
|
||||
bulletText = "standard/square";
|
||||
else if (i == 2)
|
||||
bulletText = wxT("standard/circle");
|
||||
bulletText = "standard/circle";
|
||||
else if (i == 3)
|
||||
bulletText = wxT("standard/square");
|
||||
bulletText = "standard/square";
|
||||
else
|
||||
bulletText = wxT("standard/circle");
|
||||
bulletText = "standard/circle";
|
||||
|
||||
bulletList->SetAttributes(i, (i+1)*60, 60, wxTEXT_ATTR_BULLET_STYLE_STANDARD, bulletText);
|
||||
}
|
||||
|
||||
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++)
|
||||
{
|
||||
long numberStyle;
|
||||
@ -736,7 +736,7 @@ void MyApp::CreateStyles()
|
||||
|
||||
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++)
|
||||
{
|
||||
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
|
||||
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_SAVE, wxT("&Save\tCtrl+S"), wxT("Save a file"));
|
||||
fileMenu->Append(wxID_SAVEAS, wxT("&Save As...\tF12"), wxT("Save to a new file"));
|
||||
fileMenu->Append(wxID_OPEN, "&Open\tCtrl+O", "Open a file");
|
||||
fileMenu->Append(wxID_SAVE, "&Save\tCtrl+S", "Save a file");
|
||||
fileMenu->Append(wxID_SAVEAS, "&Save As...\tF12", "Save to a new file");
|
||||
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->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
|
||||
fileMenu->Append(ID_PRINT, wxT("&Print...\tCtrl+P"), wxT("Print"));
|
||||
fileMenu->Append(ID_PREVIEW, wxT("Print Pre&view"), wxT("Print preview"));
|
||||
fileMenu->Append(ID_PRINT, "&Print...\tCtrl+P", "Print");
|
||||
fileMenu->Append(ID_PREVIEW, "Print Pre&view", "Print preview");
|
||||
#endif
|
||||
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->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;
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(fileMenu, wxT("&File"));
|
||||
menuBar->Append(editMenu, wxT("&Edit"));
|
||||
menuBar->Append(formatMenu, wxT("F&ormat"));
|
||||
menuBar->Append(listsMenu, wxT("&Lists"));
|
||||
menuBar->Append(tableMenu, wxT("&Tables"));
|
||||
menuBar->Append(insertMenu, wxT("&Insert"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
menuBar->Append(editMenu, "&Edit");
|
||||
menuBar->Append(formatMenu, "F&ormat");
|
||||
menuBar->Append(listsMenu, "&Lists");
|
||||
menuBar->Append(tableMenu, "&Tables");
|
||||
menuBar->Append(insertMenu, "&Insert");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -877,7 +877,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
|
||||
if ( !is_pda )
|
||||
{
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxRichTextCtrl!"));
|
||||
SetStatusText("Welcome to wxRichTextCtrl!");
|
||||
}
|
||||
#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
|
||||
// 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,
|
||||
wxNO_BORDER|wxTB_FLAT|wxTB_NODIVIDER|wxTB_NOALIGN);
|
||||
@ -995,11 +995,11 @@ void MyFrame::WriteInitialText()
|
||||
|
||||
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.BeginItalic();
|
||||
r.WriteText(wxT("by Julian Smart"));
|
||||
r.WriteText("by Julian Smart");
|
||||
r.EndItalic();
|
||||
|
||||
r.EndBold();
|
||||
@ -1014,7 +1014,7 @@ void MyFrame::WriteInitialText()
|
||||
|
||||
#if 0
|
||||
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.EndAlignment();
|
||||
#endif
|
||||
@ -1022,98 +1022,98 @@ void MyFrame::WriteInitialText()
|
||||
r.BeginAlignment(wxTEXT_ALIGNMENT_LEFT);
|
||||
wxRichTextAttr imageAttr;
|
||||
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);
|
||||
|
||||
imageAttr.GetTextBoxAttr().GetTop().SetValue(200);
|
||||
imageAttr.GetTextBoxAttr().GetTop().SetUnits(wxTEXT_ATTR_UNITS_PIXELS);
|
||||
imageAttr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_RIGHT);
|
||||
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.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.WriteText(wxT(" Well, you can change text "));
|
||||
r.WriteText(" Well, you can change text ");
|
||||
|
||||
r.BeginTextColour(*wxRED);
|
||||
r.WriteText(wxT("colour, like this red bit."));
|
||||
r.WriteText("colour, like this red bit.");
|
||||
r.EndTextColour();
|
||||
|
||||
wxRichTextAttr backgroundColourAttr;
|
||||
backgroundColourAttr.SetBackgroundColour(*wxGREEN);
|
||||
backgroundColourAttr.SetTextColour(*wxBLUE);
|
||||
r.BeginStyle(backgroundColourAttr);
|
||||
r.WriteText(wxT(" And this blue on green bit."));
|
||||
r.WriteText(" And this blue on green bit.");
|
||||
r.EndStyle();
|
||||
|
||||
r.WriteText(wxT(" Naturally you can make things "));
|
||||
r.WriteText(" Naturally you can make things ");
|
||||
r.BeginBold();
|
||||
r.WriteText(wxT("bold "));
|
||||
r.WriteText("bold ");
|
||||
r.EndBold();
|
||||
r.BeginItalic();
|
||||
r.WriteText(wxT("or italic "));
|
||||
r.WriteText("or italic ");
|
||||
r.EndItalic();
|
||||
r.BeginUnderline();
|
||||
r.WriteText(wxT("or underlined."));
|
||||
r.WriteText("or underlined.");
|
||||
r.EndUnderline();
|
||||
|
||||
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.WriteText(wxT(" Next we'll show an indented paragraph."));
|
||||
r.WriteText(" Next we'll show an indented paragraph.");
|
||||
|
||||
r.Newline();
|
||||
|
||||
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.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.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.EndLeftIndent();
|
||||
|
||||
r.WriteText(wxT("Numbered bullets are possible, again using subindents:"));
|
||||
r.WriteText("Numbered bullets are possible, again using subindents:");
|
||||
r.Newline();
|
||||
|
||||
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.EndNumberedBullet();
|
||||
|
||||
r.BeginNumberedBullet(2, 100, 60);
|
||||
r.WriteText(wxT("This is my second item."));
|
||||
r.WriteText("This is my second item.");
|
||||
r.Newline();
|
||||
r.EndNumberedBullet();
|
||||
|
||||
r.WriteText(wxT("The following paragraph is right-indented:"));
|
||||
r.WriteText("The following paragraph is right-indented:");
|
||||
r.Newline();
|
||||
|
||||
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.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.BeginAlignment(wxTEXT_ALIGNMENT_RIGHT);
|
||||
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.EndLineSpacing();
|
||||
r.EndAlignment();
|
||||
@ -1128,44 +1128,44 @@ void MyFrame::WriteInitialText()
|
||||
attr.SetTabs(tabs);
|
||||
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.WriteText(wxT("Other notable features of wxRichTextCtrl include:"));
|
||||
r.WriteText("Other notable features of wxRichTextCtrl include:");
|
||||
r.Newline();
|
||||
|
||||
r.BeginSymbolBullet(wxT('*'), 100, 60);
|
||||
r.WriteText(wxT("Compatibility with wxTextCtrl API"));
|
||||
r.BeginSymbolBullet('*', 100, 60);
|
||||
r.WriteText("Compatibility with wxTextCtrl API");
|
||||
r.Newline();
|
||||
r.EndSymbolBullet();
|
||||
|
||||
r.BeginSymbolBullet(wxT('*'), 100, 60);
|
||||
r.WriteText(wxT("Easy stack-based BeginXXX()...EndXXX() style setting in addition to SetStyle()"));
|
||||
r.BeginSymbolBullet('*', 100, 60);
|
||||
r.WriteText("Easy stack-based BeginXXX()...EndXXX() style setting in addition to SetStyle()");
|
||||
r.Newline();
|
||||
r.EndSymbolBullet();
|
||||
|
||||
r.BeginSymbolBullet(wxT('*'), 100, 60);
|
||||
r.WriteText(wxT("XML loading and saving"));
|
||||
r.BeginSymbolBullet('*', 100, 60);
|
||||
r.WriteText("XML loading and saving");
|
||||
r.Newline();
|
||||
r.EndSymbolBullet();
|
||||
|
||||
r.BeginSymbolBullet(wxT('*'), 100, 60);
|
||||
r.WriteText(wxT("Undo/Redo, with batching option and Undo suppressing"));
|
||||
r.BeginSymbolBullet('*', 100, 60);
|
||||
r.WriteText("Undo/Redo, with batching option and Undo suppressing");
|
||||
r.Newline();
|
||||
r.EndSymbolBullet();
|
||||
|
||||
r.BeginSymbolBullet(wxT('*'), 100, 60);
|
||||
r.WriteText(wxT("Clipboard copy and paste"));
|
||||
r.BeginSymbolBullet('*', 100, 60);
|
||||
r.WriteText("Clipboard copy and paste");
|
||||
r.Newline();
|
||||
r.EndSymbolBullet();
|
||||
|
||||
r.BeginSymbolBullet(wxT('*'), 100, 60);
|
||||
r.WriteText(wxT("wxRichTextStyleSheet with named character and paragraph styles, and control for applying named styles"));
|
||||
r.BeginSymbolBullet('*', 100, 60);
|
||||
r.WriteText("wxRichTextStyleSheet with named character and paragraph styles, and control for applying named styles");
|
||||
r.Newline();
|
||||
r.EndSymbolBullet();
|
||||
|
||||
r.BeginSymbolBullet(wxT('*'), 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.BeginSymbolBullet('*', 100, 60);
|
||||
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.EndSymbolBullet();
|
||||
|
||||
@ -1174,17 +1174,17 @@ void MyFrame::WriteInitialText()
|
||||
urlStyle.SetTextColour(*wxBLUE);
|
||||
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.BeginURL(wxT("http://www.wxwidgets.org"));
|
||||
r.WriteText(wxT("The wxWidgets Web Site"));
|
||||
r.BeginURL("http://www.wxwidgets.org");
|
||||
r.WriteText("The wxWidgets Web Site");
|
||||
r.EndURL();
|
||||
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.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();
|
||||
|
||||
@ -1207,7 +1207,7 @@ void MyFrame::WriteInitialText()
|
||||
wxRichTextBox* textBox = r.WriteTextBox(attr);
|
||||
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.SetInsertionPointEnd();
|
||||
@ -1242,7 +1242,7 @@ void MyFrame::WriteInitialText()
|
||||
{
|
||||
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.WriteText(msg);
|
||||
}
|
||||
@ -1276,18 +1276,18 @@ void MyFrame::WriteInitialText()
|
||||
r.Newline(); r.Newline();
|
||||
|
||||
wxRichTextProperties properties;
|
||||
r.WriteText(wxT("This is a rectangle field: "));
|
||||
r.WriteField(wxT("rectangle"), properties);
|
||||
r.WriteText(wxT(" and a begin section field: "));
|
||||
r.WriteField(wxT("begin-section"), properties);
|
||||
r.WriteText(wxT("This is text between the two tags."));
|
||||
r.WriteField(wxT("end-section"), properties);
|
||||
r.WriteText(wxT(" Now a bitmap. "));
|
||||
r.WriteField(wxT("bitmap"), properties);
|
||||
r.WriteText(wxT(" Before we go, here's a composite field: ***"));
|
||||
wxRichTextField* field = r.WriteField(wxT("composite"), properties);
|
||||
r.WriteText("This is a rectangle field: ");
|
||||
r.WriteField("rectangle", properties);
|
||||
r.WriteText(" and a begin section field: ");
|
||||
r.WriteField("begin-section", properties);
|
||||
r.WriteText("This is text between the two tags.");
|
||||
r.WriteField("end-section", properties);
|
||||
r.WriteText(" Now a bitmap. ");
|
||||
r.WriteField("bitmap", properties);
|
||||
r.WriteText(" Before we go, here's a composite field: ***");
|
||||
wxRichTextField* field = r.WriteField("composite", properties);
|
||||
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.EndSuppressUndo();
|
||||
@ -1295,13 +1295,13 @@ void MyFrame::WriteInitialText()
|
||||
// Add some locked content first - needs Undo to be enabled
|
||||
{
|
||||
r.BeginLock();
|
||||
r.WriteText(wxString(wxT("This is a locked object.")));
|
||||
r.WriteText(wxString("This is a locked object."));
|
||||
r.EndLock();
|
||||
|
||||
r.WriteText(wxString(wxT(" This is unlocked text. ")));
|
||||
r.WriteText(wxString(" This is unlocked text. "));
|
||||
|
||||
r.BeginLock();
|
||||
r.WriteText(wxString(wxT("More locked content.")));
|
||||
r.WriteText(wxString("More locked content."));
|
||||
r.EndLock();
|
||||
r.Newline();
|
||||
|
||||
@ -1323,8 +1323,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("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);
|
||||
msg.Printf( "This is a demo for wxRichTextCtrl, a control for editing styled text.\n(c) Julian Smart, 2005");
|
||||
wxMessageBox(msg, "About wxRichTextCtrl Sample", wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
// 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);
|
||||
if (!filter.empty())
|
||||
filter += wxT("|");
|
||||
filter += wxT("All files (*.*)|*.*");
|
||||
filter += "|";
|
||||
filter += "All files (*.*)|*.*";
|
||||
|
||||
wxFileDialog dialog(this,
|
||||
_("Choose a filename"),
|
||||
@ -1434,8 +1434,8 @@ void MyFrame::OnSaveAs(wxCommandEvent& WXUNUSED(event))
|
||||
m_richTextCtrl->SaveFile(path);
|
||||
|
||||
long t = stopwatch.Time();
|
||||
wxLogDebug(wxT("Saving took %ldms"), t);
|
||||
wxMessageBox(wxString::Format(wxT("Saving took %ldms"), t));
|
||||
wxLogDebug("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);
|
||||
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);
|
||||
|
||||
wxString text;
|
||||
@ -1891,7 +1891,7 @@ void MyFrame::OnInsertSymbol(wxCommandEvent& WXUNUSED(event))
|
||||
// 'normal text', i.e. the current font) but do tell the dialog
|
||||
// what 'normal text' is.
|
||||
|
||||
wxSymbolPickerDialog dlg(wxT("*"), wxEmptyString, currentFontName, this);
|
||||
wxSymbolPickerDialog dlg("*", wxEmptyString, currentFontName, this);
|
||||
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
@ -1917,7 +1917,7 @@ void MyFrame::OnNumberList(wxCommandEvent& WXUNUSED(event))
|
||||
if (m_richTextCtrl->HasSelection())
|
||||
{
|
||||
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())
|
||||
{
|
||||
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))
|
||||
{
|
||||
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));
|
||||
wxPanel* panel = 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);
|
||||
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);
|
||||
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();
|
||||
|
||||
@ -2131,24 +2131,24 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnSetFontScale(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString value = wxString::Format(wxT("%g"), m_richTextCtrl->GetFontScale());
|
||||
wxString text = wxGetTextFromUser(wxT("Enter a text scale factor:"), wxT("Text Scale Factor"), value, wxGetTopLevelParent(this));
|
||||
wxString value = wxString::Format("%g", m_richTextCtrl->GetFontScale());
|
||||
wxString text = wxGetTextFromUser("Enter a text scale factor:", "Text Scale Factor", value, wxGetTopLevelParent(this));
|
||||
if (!text.IsEmpty() && value != text)
|
||||
{
|
||||
double scale = 1.0;
|
||||
wxSscanf(text, wxT("%lf"), & scale);
|
||||
wxSscanf(text, "%lf", & scale);
|
||||
m_richTextCtrl->SetFontScale(scale, true);
|
||||
}
|
||||
}
|
||||
|
||||
void MyFrame::OnSetDimensionScale(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString value = wxString::Format(wxT("%g"), m_richTextCtrl->GetDimensionScale());
|
||||
wxString text = wxGetTextFromUser(wxT("Enter a dimension scale factor:"), wxT("Dimension Scale Factor"), value, wxGetTopLevelParent(this));
|
||||
wxString value = wxString::Format("%g", m_richTextCtrl->GetDimensionScale());
|
||||
wxString text = wxGetTextFromUser("Enter a dimension scale factor:", "Dimension Scale Factor", value, wxGetTopLevelParent(this));
|
||||
if (!text.IsEmpty() && value != text)
|
||||
{
|
||||
double scale = 1.0;
|
||||
wxSscanf(text, wxT("%lf"), & scale);
|
||||
wxSscanf(text, "%lf", & scale);
|
||||
m_richTextCtrl->SetDimensionScale(scale, true);
|
||||
}
|
||||
}
|
||||
@ -2168,7 +2168,7 @@ void MyRichTextCtrl::PrepareContent(wxRichTextParagraphLayoutBox& container)
|
||||
while (childNode)
|
||||
{
|
||||
wxRichTextObject* obj = childNode->GetData();
|
||||
obj->GetProperties().SetProperty(wxT("Lock"), m_lockId);
|
||||
obj->GetProperties().SetProperty("Lock", m_lockId);
|
||||
|
||||
childNode = childNode->GetNext();
|
||||
}
|
||||
@ -2184,7 +2184,7 @@ bool MyRichTextCtrl::CanDeleteRange(wxRichTextParagraphLayoutBox& container, con
|
||||
for (i = range.GetStart(); i < range.GetEnd(); i++)
|
||||
{
|
||||
wxRichTextObject* obj = container.GetLeafObjectAtPosition(i);
|
||||
if (obj && obj->GetProperties().HasProperty(wxT("Lock")))
|
||||
if (obj && obj->GetProperties().HasProperty("Lock"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -2199,10 +2199,10 @@ bool MyRichTextCtrl::CanInsertContent(wxRichTextParagraphLayoutBox& container, l
|
||||
|
||||
long lock1 = -1, lock2 = -1;
|
||||
|
||||
if (child1 && child1->GetProperties().HasProperty(wxT("Lock")))
|
||||
lock1 = child1->GetProperties().GetPropertyLong(wxT("Lock"));
|
||||
if (child2 && child2->GetProperties().HasProperty(wxT("Lock")))
|
||||
lock2 = child2->GetProperties().GetPropertyLong(wxT("Lock"));
|
||||
if (child1 && child1->GetProperties().HasProperty("Lock"))
|
||||
lock1 = child1->GetProperties().GetPropertyLong("Lock");
|
||||
if (child2 && child2->GetProperties().HasProperty("Lock"))
|
||||
lock2 = child2->GetProperties().GetPropertyLong("Lock");
|
||||
|
||||
if (lock1 != -1 && lock1 == lock2)
|
||||
return false;
|
||||
@ -2220,7 +2220,7 @@ class wxRichTextEnhancedDrawingHandler: public wxRichTextDrawingHandler
|
||||
public:
|
||||
wxRichTextEnhancedDrawingHandler()
|
||||
{
|
||||
SetName(wxT("enhanceddrawing"));
|
||||
SetName("enhanceddrawing");
|
||||
m_lockBackgroundColour = wxColour(220, 220, 220);
|
||||
}
|
||||
|
||||
@ -2264,12 +2264,12 @@ public:
|
||||
|
||||
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
|
||||
{
|
||||
if (obj->GetProperties().HasProperty(wxT("Lock")))
|
||||
if (obj->GetProperties().HasProperty("Lock"))
|
||||
{
|
||||
attr.SetBackgroundColour(m_lockBackgroundColour);
|
||||
return true;
|
||||
|
@ -44,30 +44,30 @@ bool MyApp::OnInit(void)
|
||||
|
||||
// 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 |
|
||||
wxNO_FULL_REPAINT_ON_RESIZE |
|
||||
wxHSCROLL | wxVSCROLL);
|
||||
|
||||
// Give it an icon (this is ignored in MDI mode: uses resources)
|
||||
#ifdef __WXMSW__
|
||||
frame->SetIcon(wxIcon(wxT("sashtest_icn")));
|
||||
frame->SetIcon(wxIcon("sashtest_icn"));
|
||||
#endif
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(SASHTEST_NEW_WINDOW, wxT("&New window"));
|
||||
file_menu->Append(SASHTEST_TOGGLE_WINDOW, wxT("&Toggle window"));
|
||||
file_menu->Append(SASHTEST_QUIT, wxT("&Exit"));
|
||||
file_menu->Append(SASHTEST_NEW_WINDOW, "&New window");
|
||||
file_menu->Append(SASHTEST_TOGGLE_WINDOW, "&Toggle window");
|
||||
file_menu->Append(SASHTEST_QUIT, "&Exit");
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(SASHTEST_ABOUT, wxT("&About"));
|
||||
help_menu->Append(SASHTEST_ABOUT, "&About");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(help_menu, wxT("&Help"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
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,
|
||||
wxTE_MULTILINE|wxSUNKEN_BORDER);
|
||||
// wxTE_MULTILINE|wxNO_BORDER);
|
||||
textWindow->SetValue(wxT("A help window"));
|
||||
textWindow->SetValue("A help window");
|
||||
|
||||
m_leftWindow1 = win;
|
||||
|
||||
@ -162,7 +162,7 @@ void MyFrame::OnQuit(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))
|
||||
@ -222,17 +222,17 @@ void MyFrame::OnSashDrag(wxSashEvent& event)
|
||||
void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// 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),
|
||||
wxDEFAULT_FRAME_STYLE |
|
||||
wxNO_FULL_REPAINT_ON_RESIZE);
|
||||
|
||||
subframe->SetTitle(wxString::Format(wxT("Canvas Frame %d"), winNumber));
|
||||
subframe->SetTitle(wxString::Format("Canvas Frame %d", winNumber));
|
||||
winNumber ++;
|
||||
|
||||
// Give it an icon (this is ignored in MDI mode: uses resources)
|
||||
#ifdef __WXMSW__
|
||||
subframe->SetIcon(wxIcon(wxT("sashtest_icn")));
|
||||
subframe->SetIcon(wxIcon("sashtest_icn"));
|
||||
#endif
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
@ -243,23 +243,23 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event))
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(SASHTEST_NEW_WINDOW, wxT("&New window"));
|
||||
file_menu->Append(SASHTEST_CHILD_QUIT, wxT("&Close child"));
|
||||
file_menu->Append(SASHTEST_QUIT, wxT("&Exit"));
|
||||
file_menu->Append(SASHTEST_NEW_WINDOW, "&New window");
|
||||
file_menu->Append(SASHTEST_CHILD_QUIT, "&Close child");
|
||||
file_menu->Append(SASHTEST_QUIT, "&Exit");
|
||||
|
||||
wxMenu *option_menu = new wxMenu;
|
||||
|
||||
// Dummy option
|
||||
option_menu->Append(SASHTEST_REFRESH, wxT("&Refresh picture"));
|
||||
option_menu->Append(SASHTEST_REFRESH, "&Refresh picture");
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(SASHTEST_ABOUT, wxT("&About"));
|
||||
help_menu->Append(SASHTEST_ABOUT, "&About");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(option_menu, wxT("&Options"));
|
||||
menu_bar->Append(help_menu, wxT("&Help"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(option_menu, "&Options");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
subframe->SetMenuBar(menu_bar);
|
||||
@ -306,7 +306,7 @@ void MyCanvas::OnDraw(wxDC& dc)
|
||||
dc.DrawSpline(50, 200, 50, 100, 200, 10);
|
||||
#endif // wxUSE_SPLINES
|
||||
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];
|
||||
points[0].x = 200; points[0].y = 300;
|
||||
|
@ -387,9 +387,9 @@ ShapedFrame::ShapedFrame(wxFrame *parent)
|
||||
)
|
||||
{
|
||||
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()));
|
||||
SetToolTip(wxT("Right-click to close, double click to cycle shape"));
|
||||
SetToolTip("Right-click to close, double click to cycle shape");
|
||||
SetWindowShape();
|
||||
}
|
||||
|
||||
|
@ -173,20 +173,20 @@ WX_DEFINE_LIST(EList);
|
||||
wxString
|
||||
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
|
||||
Client::OnInitCmdLine(wxCmdLineParser& pParser)
|
||||
{
|
||||
wxApp::OnInitCmdLine(pParser);
|
||||
pParser.AddSwitch(wxT("e"),wxT("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(wxT("r"),wxT("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(wxT("f"),wxT("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(wxT("s"),wxT("stress"),_("stress test with <num> concurrent connections"),wxCMD_LINE_VAL_NUMBER,wxCMD_LINE_PARAM_OPTIONAL);
|
||||
pParser.AddSwitch("e","event",_("Use event based worker (default)"),wxCMD_LINE_PARAM_OPTIONAL);
|
||||
pParser.AddSwitch("t","thread",_("Use thread based worker"),wxCMD_LINE_PARAM_OPTIONAL);
|
||||
pParser.AddSwitch("r","random",_("Send random data (default)"),wxCMD_LINE_PARAM_OPTIONAL);
|
||||
pParser.AddOption("m","message",_("Send message from <str>"),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("H","hostname",_("IP or name of host to connect to"),wxCMD_LINE_VAL_STRING,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")))
|
||||
{
|
||||
wxLog::AddTraceMask(wxT("wxSocket"));
|
||||
wxLog::AddTraceMask(wxT("epolldispatcher"));
|
||||
wxLog::AddTraceMask(wxT("selectdispatcher"));
|
||||
wxLog::AddTraceMask(wxT("thread"));
|
||||
wxLog::AddTraceMask(wxT("events"));
|
||||
wxLog::AddTraceMask("wxSocket");
|
||||
wxLog::AddTraceMask("epolldispatcher");
|
||||
wxLog::AddTraceMask("selectdispatcher");
|
||||
wxLog::AddTraceMask("thread");
|
||||
wxLog::AddTraceMask("events");
|
||||
}
|
||||
|
||||
if (pParser.Found(wxT("t")))
|
||||
if (pParser.Found("t"))
|
||||
m_workMode = THREADS;
|
||||
m_sendType = SEND_RANDOM;
|
||||
|
||||
if (pParser.Found(wxT("m"),&m_message))
|
||||
if (pParser.Found("m",&m_message))
|
||||
m_sendType = SEND_MESSAGE;
|
||||
else if (pParser.Found(wxT("f"),&fname))
|
||||
else if (pParser.Found("f",&fname))
|
||||
{
|
||||
wxFFile file(fname);
|
||||
if (!file.IsOpened()) {
|
||||
wxLogError(wxT("Cannot open file %s"),fname.c_str());
|
||||
wxLogError("Cannot open file %s",fname.c_str());
|
||||
return false;
|
||||
};
|
||||
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;
|
||||
};
|
||||
m_sendType = SEND_MESSAGE;
|
||||
};
|
||||
|
||||
if (pParser.Found(wxT("s"),&m_stressWorkers))
|
||||
if (pParser.Found("s",&m_stressWorkers))
|
||||
m_sendType = STRESS_TEST;
|
||||
|
||||
m_host = wxT("127.0.0.1");
|
||||
pParser.Found(wxT("H"),&m_host);
|
||||
m_host = "127.0.0.1";
|
||||
pParser.Found("H",&m_host);
|
||||
return wxApp::OnCmdLineParsed(pParser);
|
||||
};
|
||||
|
||||
@ -352,7 +352,7 @@ Client::StartWorker(workMode pMode) {
|
||||
if (pMode == THREADS) {
|
||||
ThreadWorker* c = new ThreadWorker(m_host,buf,msgsize+2);
|
||||
if (c->Create() != wxTHREAD_NO_ERROR) {
|
||||
wxLogError(wxT("Cannot create more threads"));
|
||||
wxLogError("Cannot create more threads");
|
||||
} else {
|
||||
c->Run();
|
||||
m_threadWorkers.Append(c);
|
||||
@ -377,7 +377,7 @@ Client::StartWorker(workMode pMode, const wxString& pMessage) {
|
||||
if (pMode == THREADS) {
|
||||
ThreadWorker* c = new ThreadWorker(m_host,buf,msgsize+2);
|
||||
if (c->Create() != wxTHREAD_NO_ERROR) {
|
||||
wxLogError(wxT("Cannot create more threads"));
|
||||
wxLogError("Cannot create more threads");
|
||||
} else {
|
||||
c->Run();
|
||||
m_threadWorkers.Append(c);
|
||||
@ -476,7 +476,7 @@ void
|
||||
Client::RemoveEventWorker(EventWorker* p_worker) {
|
||||
for(EList::compatibility_iterator it = m_eventWorkers.GetFirst(); it ; it = it->GetNext()) {
|
||||
if (it->GetData() == p_worker) {
|
||||
//wxLogDebug(wxT("Deleting event worker"));
|
||||
//wxLogDebug("Deleting event worker");
|
||||
delete it->GetData();
|
||||
m_eventWorkers.DeleteNode(it);
|
||||
return;
|
||||
@ -496,7 +496,7 @@ Client::dumpStatistics() {
|
||||
m_statFailed
|
||||
));
|
||||
|
||||
wxLogMessage(wxT("Current status:\n%s\n"),msg.c_str());
|
||||
wxLogMessage("Current status:\n%s\n",msg.c_str());
|
||||
}
|
||||
|
||||
void
|
||||
@ -533,7 +533,7 @@ EventWorker::Run() {
|
||||
m_clientSocket->Notify(true);
|
||||
m_currentType = WorkerEvent::CONNECTING;
|
||||
m_doneSent = false;
|
||||
//wxLogMessage(wxT("EventWorker: Connecting....."));
|
||||
//wxLogMessage("EventWorker: Connecting.....");
|
||||
m_clientSocket->Connect(ca,false);
|
||||
}
|
||||
|
||||
@ -541,7 +541,7 @@ void
|
||||
EventWorker::OnSocketEvent(wxSocketEvent& pEvent) {
|
||||
switch(pEvent.GetSocketEvent()) {
|
||||
case wxSOCKET_INPUT:
|
||||
//wxLogDebug(wxT("EventWorker: INPUT"));
|
||||
//wxLogDebug("EventWorker: INPUT");
|
||||
do {
|
||||
if (m_readed == m_insize)
|
||||
return; //event already posted
|
||||
@ -550,74 +550,74 @@ EventWorker::OnSocketEvent(wxSocketEvent& pEvent) {
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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 (!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);
|
||||
}
|
||||
m_currentType = WorkerEvent::DISCONNECTING;
|
||||
wxLogDebug(wxT("%s: DISCONNECTING"),CreateIdent(m_localaddr).c_str());
|
||||
wxLogDebug("%s: DISCONNECTING",CreateIdent(m_localaddr).c_str());
|
||||
SendEvent(false);
|
||||
|
||||
//wxLogDebug(wxT("EventWorker %p closing"),this);
|
||||
//wxLogDebug("EventWorker %p closing",this);
|
||||
m_clientSocket->Close();
|
||||
|
||||
m_currentType = WorkerEvent::DONE;
|
||||
wxLogDebug(wxT("%s: DONE"),CreateIdent(m_localaddr).c_str());
|
||||
wxLogDebug("%s: DONE",CreateIdent(m_localaddr).c_str());
|
||||
SendEvent(false);
|
||||
}
|
||||
} while (!m_clientSocket->Error());
|
||||
break;
|
||||
case wxSOCKET_OUTPUT:
|
||||
//wxLogDebug(wxT("EventWorker: OUTPUT"));
|
||||
//wxLogDebug("EventWorker: OUTPUT");
|
||||
do {
|
||||
if (m_written == m_outsize)
|
||||
return;
|
||||
if (m_written == 0)
|
||||
{
|
||||
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);
|
||||
if (m_clientSocket->Error())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
m_written += m_clientSocket->LastCount();
|
||||
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
|
||||
{
|
||||
//wxLogDebug(wxT("EventWorker %p SENDING->RECEIVING"),this);
|
||||
//wxLogDebug("EventWorker %p SENDING->RECEIVING",this);
|
||||
m_currentType = WorkerEvent::RECEIVING;
|
||||
wxLogDebug(wxT("%s: RECEIVING"),CreateIdent(m_localaddr).c_str());
|
||||
wxLogDebug("%s: RECEIVING",CreateIdent(m_localaddr).c_str());
|
||||
SendEvent(false);
|
||||
}
|
||||
} while(!m_clientSocket->Error());
|
||||
break;
|
||||
case wxSOCKET_CONNECTION:
|
||||
{
|
||||
//wxLogMessage(wxT("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("EventWorker: got connection");
|
||||
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))
|
||||
{
|
||||
wxLogError(_("Cannot get peer data for socket %p"),m_clientSocket);
|
||||
}
|
||||
m_currentType = WorkerEvent::SENDING;
|
||||
wxLogDebug(wxT("%s: CONNECTING"),CreateIdent(m_localaddr).c_str());
|
||||
wxLogDebug("%s: CONNECTING",CreateIdent(m_localaddr).c_str());
|
||||
SendEvent(false);
|
||||
}
|
||||
break;
|
||||
@ -667,15 +667,15 @@ wxThread::ExitCode ThreadWorker::Entry()
|
||||
wxIPV4address ca;
|
||||
ca.Hostname(m_host);
|
||||
ca.Service(5678);
|
||||
//wxLogDebug(wxT("ThreadWorker: Connecting....."));
|
||||
//wxLogDebug("ThreadWorker: Connecting.....");
|
||||
m_clientSocket->SetTimeout(60);
|
||||
bool failed = false;
|
||||
WorkerEvent::evt_type etype = WorkerEvent::CONNECTING;
|
||||
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;
|
||||
} 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;
|
||||
WorkerEvent e(this,etype);
|
||||
wxGetApp().AddPendingEvent(e);
|
||||
@ -683,11 +683,11 @@ wxThread::ExitCode ThreadWorker::Entry()
|
||||
do {
|
||||
m_clientSocket->Write(m_outbuf,m_outsize);
|
||||
if (m_clientSocket->Error()) {
|
||||
wxLogError(wxT("ThreadWorker: Write error"));
|
||||
wxLogError("ThreadWorker: Write error");
|
||||
failed = true;
|
||||
}
|
||||
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);
|
||||
|
||||
if (!failed) {
|
||||
@ -698,23 +698,23 @@ wxThread::ExitCode ThreadWorker::Entry()
|
||||
do {
|
||||
m_clientSocket->Read(m_inbuf,m_insize);
|
||||
if (m_clientSocket->Error()) {
|
||||
wxLogError(wxT("ThreadWorker: Read error"));
|
||||
wxLogError("ThreadWorker: Read error");
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
char* outdat = (char*)m_outbuf+2;
|
||||
if (!failed && (memcmp(m_inbuf,outdat,m_insize) != 0))
|
||||
{
|
||||
wxLogError(wxT("Data mismatch"));
|
||||
wxLogError("Data mismatch");
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
//wxLogDebug(wxT("ThreadWorker: Finished"));
|
||||
//wxLogDebug("ThreadWorker: Finished");
|
||||
if (!failed) {
|
||||
etype = WorkerEvent::DISCONNECTING;
|
||||
WorkerEvent e(this,etype);
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "../sample.xpm"
|
||||
#endif
|
||||
|
||||
#define WAV_FILE wxT("doggrowl.wav")
|
||||
#define WAV_FILE "doggrowl.wav"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
@ -166,7 +166,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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
|
||||
// created initially)
|
||||
@ -194,32 +194,32 @@ MyFrame::MyFrame(const wxString& title)
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
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__
|
||||
menuFile->Append(Sound_SelectResource, wxT("Select WAV &resource...\tCtrl-R"), wxT("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_SelectResource, "Select WAV &resource...\tCtrl-R", "Select a new resource to play");
|
||||
menuFile->Append(Sound_SelectMemory, "Select WAV &data\tCtrl-M", "Choose to play from memory buffer");
|
||||
#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;
|
||||
playMenu->Append(Sound_PlaySync, wxT("Play sound &synchronously\tCtrl-S"));
|
||||
playMenu->Append(Sound_PlayAsync, wxT("Play sound &asynchronously\tCtrl-A"));
|
||||
playMenu->Append(Sound_PlayAsyncOnStack, wxT("Play sound asynchronously (&object on stack)\tCtrl-K"));
|
||||
playMenu->Append(Sound_PlayLoop, wxT("&Loop sound\tCtrl-L"));
|
||||
playMenu->Append(Sound_PlaySync, "Play sound &synchronously\tCtrl-S");
|
||||
playMenu->Append(Sound_PlayAsync, "Play sound &asynchronously\tCtrl-A");
|
||||
playMenu->Append(Sound_PlayAsyncOnStack, "Play sound asynchronously (&object on stack)\tCtrl-K");
|
||||
playMenu->Append(Sound_PlayLoop, "&Loop sound\tCtrl-L");
|
||||
playMenu->AppendSeparator();
|
||||
playMenu->Append(Sound_Stop, wxT("&Stop playing\tCtrl-T"));
|
||||
playMenu->Append(Sound_Stop, "&Stop playing\tCtrl-T");
|
||||
playMenu->AppendSeparator();
|
||||
playMenu->Append(Sound_PlayBell, wxT("Play system bell"));
|
||||
playMenu->Append(Sound_PlayBell, "Play system bell");
|
||||
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(playMenu, wxT("&Play"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(playMenu, "&Play");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -991,7 +991,7 @@ wxSound* MyFrame::TryCreateSound() const
|
||||
void MyFrame::NotifyUsingFile(const wxString& name)
|
||||
{
|
||||
wxString msg;
|
||||
msg << wxT("Using sound file: ") << name << wxT("\n");
|
||||
msg << "Using sound file: " << name << "\n";
|
||||
m_tc->AppendText(msg);
|
||||
}
|
||||
|
||||
@ -1002,7 +1002,7 @@ void MyFrame::NotifyUsingFile(const wxString& name)
|
||||
void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#if wxUSE_FILEDLG
|
||||
wxFileDialog dlg(this, wxT("Choose a sound file"),
|
||||
wxFileDialog dlg(this, "Choose a sound file",
|
||||
wxEmptyString, wxEmptyString,
|
||||
wxString::Format
|
||||
(
|
||||
@ -1031,9 +1031,9 @@ void MyFrame::OnSelectResource(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_soundRes = wxGetTextFromUser
|
||||
(
|
||||
wxT("Enter resource name:"),
|
||||
wxT("wxWidgets Sound Sample"),
|
||||
wxT("FromResource"),
|
||||
"Enter resource name:",
|
||||
"wxWidgets Sound Sample",
|
||||
"FromResource",
|
||||
this
|
||||
);
|
||||
if ( m_soundRes.empty() )
|
||||
@ -1044,7 +1044,7 @@ void MyFrame::OnSelectResource(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
wxDELETE(m_sound);
|
||||
|
||||
NotifyUsingFile(wxT("Windows WAV resource"));
|
||||
NotifyUsingFile("Windows WAV resource");
|
||||
}
|
||||
|
||||
#endif // __WXMSW__
|
||||
@ -1053,7 +1053,7 @@ void MyFrame::OnSelectMemory(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_useMemory = true;
|
||||
|
||||
NotifyUsingFile(wxT("embedded sound fragment"));
|
||||
NotifyUsingFile("embedded sound fragment");
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
@ -1109,10 +1109,10 @@ void MyFrame::OnPlayBell(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("This is the About dialog of the sound sample.\n")
|
||||
wxT("Welcome to %s"), wxVERSION_STRING);
|
||||
msg.Printf( "This is the About dialog of the sound sample.\n"
|
||||
"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))
|
||||
|
@ -128,7 +128,7 @@ bool MyApp::OnInit()
|
||||
wxImage::AddHandler(new wxPNGHandler);
|
||||
|
||||
// create the main application window
|
||||
MyFrame *frame = new MyFrame(wxT("wxSplashScreen sample application"));
|
||||
MyFrame *frame = new MyFrame("wxSplashScreen sample application");
|
||||
|
||||
wxBitmap bitmap;
|
||||
|
||||
@ -137,7 +137,7 @@ bool MyApp::OnInit()
|
||||
|
||||
bool ok = frame->m_isPda
|
||||
? bitmap.IsOk()
|
||||
: bitmap.LoadFile(wxT("splash.png"), wxBITMAP_TYPE_PNG);
|
||||
: bitmap.LoadFile("splash.png", wxBITMAP_TYPE_PNG);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
@ -181,14 +181,14 @@ MyFrame::MyFrame(const wxString& title)
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -197,7 +197,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
bool ok = m_isPda
|
||||
? bitmap.IsOk()
|
||||
: bitmap.LoadFile(wxT("splash.png"), wxBITMAP_TYPE_PNG);
|
||||
: bitmap.LoadFile("splash.png", wxBITMAP_TYPE_PNG);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
@ -236,12 +236,12 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
wxWindow *win = splash->GetSplashWindow();
|
||||
#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();
|
||||
#else
|
||||
wxStaticText *text = new wxStaticText( win,
|
||||
wxID_EXIT,
|
||||
wxT("click somewhere\non this image"),
|
||||
"click somewhere\non this image",
|
||||
wxPoint(m_isPda ? 0 : 13,
|
||||
m_isPda ? 0 : 11)
|
||||
);
|
||||
|
@ -213,7 +213,7 @@ wxEND_EVENT_TABLE()
|
||||
|
||||
// My frame constructor
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame(NULL, wxID_ANY, wxT("wxSplitterWindow sample"),
|
||||
: wxFrame(NULL, wxID_ANY, "wxSplitterWindow sample",
|
||||
wxDefaultPosition, wxSize(420, 300),
|
||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
{
|
||||
@ -226,58 +226,58 @@ MyFrame::MyFrame()
|
||||
// Make a menubar
|
||||
wxMenu *splitMenu = new wxMenu;
|
||||
splitMenu->Append(SPLIT_VERTICAL,
|
||||
wxT("Split &Vertically\tCtrl-V"),
|
||||
wxT("Split vertically"));
|
||||
"Split &Vertically\tCtrl-V",
|
||||
"Split vertically");
|
||||
splitMenu->Append(SPLIT_HORIZONTAL,
|
||||
wxT("Split &Horizontally\tCtrl-H"),
|
||||
wxT("Split horizontally"));
|
||||
"Split &Horizontally\tCtrl-H",
|
||||
"Split horizontally");
|
||||
splitMenu->Append(SPLIT_UNSPLIT,
|
||||
wxT("&Unsplit\tCtrl-U"),
|
||||
wxT("Unsplit"));
|
||||
"&Unsplit\tCtrl-U",
|
||||
"Unsplit");
|
||||
splitMenu->AppendCheckItem(SPLIT_INVISIBLE,
|
||||
wxT("Toggle sash &invisibility\tCtrl-I"),
|
||||
wxT("Toggle sash invisibility"));
|
||||
"Toggle sash &invisibility\tCtrl-I",
|
||||
"Toggle sash invisibility");
|
||||
splitMenu->AppendSeparator();
|
||||
|
||||
splitMenu->AppendCheckItem(SPLIT_LIVE,
|
||||
wxT("&Live update\tCtrl-L"),
|
||||
wxT("Toggle live update mode"));
|
||||
"&Live update\tCtrl-L",
|
||||
"Toggle live update mode");
|
||||
splitMenu->AppendCheckItem(SPLIT_BORDER,
|
||||
wxT("3D &Border"),
|
||||
wxT("Toggle wxSP_BORDER flag"));
|
||||
"3D &Border",
|
||||
"Toggle wxSP_BORDER flag");
|
||||
splitMenu->Check(SPLIT_BORDER, true);
|
||||
splitMenu->AppendCheckItem(SPLIT_3DSASH,
|
||||
wxT("&3D Sash"),
|
||||
wxT("Toggle wxSP_3DSASH flag"));
|
||||
"&3D Sash",
|
||||
"Toggle wxSP_3DSASH flag");
|
||||
splitMenu->Check(SPLIT_3DSASH, true);
|
||||
#ifdef __WXMSW__
|
||||
splitMenu->AppendCheckItem(SPLIT_NOTHEME,
|
||||
wxT("Disable XP &theme"),
|
||||
wxT("Toggle wxSP_NO_XP_THEME flag"));
|
||||
"Disable XP &theme",
|
||||
"Toggle wxSP_NO_XP_THEME flag");
|
||||
#endif
|
||||
splitMenu->AppendCheckItem(SPLIT_CUSTOM_COLOUR,
|
||||
wxT("Use custom &colour"),
|
||||
wxT("Toggle custom colour"));
|
||||
"Use custom &colour",
|
||||
"Toggle custom colour");
|
||||
splitMenu->Append(SPLIT_SETPOSITION,
|
||||
wxT("Set splitter &position\tCtrl-P"),
|
||||
wxT("Set the splitter position"));
|
||||
"Set splitter &position\tCtrl-P",
|
||||
"Set the splitter position");
|
||||
splitMenu->Append(SPLIT_SETMINSIZE,
|
||||
wxT("Set &min size\tCtrl-M"),
|
||||
wxT("Set minimum pane size"));
|
||||
"Set &min size\tCtrl-M",
|
||||
"Set minimum pane size");
|
||||
splitMenu->Append(SPLIT_SETGRAVITY,
|
||||
wxT("Set &gravity\tCtrl-G"),
|
||||
wxT("Set gravity of sash"));
|
||||
"Set &gravity\tCtrl-G",
|
||||
"Set gravity of sash");
|
||||
splitMenu->AppendSeparator();
|
||||
|
||||
splitMenu->Append(SPLIT_REPLACE,
|
||||
wxT("&Replace right window"),
|
||||
wxT("Replace right window"));
|
||||
"&Replace right window",
|
||||
"Replace right window");
|
||||
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;
|
||||
menuBar->Append(splitMenu, wxT("&Splitter"));
|
||||
menuBar->Append(splitMenu, "&Splitter");
|
||||
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
@ -300,8 +300,8 @@ MyFrame::MyFrame()
|
||||
m_right = new MyCanvas(m_splitter, false);
|
||||
m_right->SetBackgroundColour(*wxCYAN);
|
||||
#else // for testing kbd navigation inside the splitter
|
||||
m_left = new wxTextCtrl(m_splitter, wxID_ANY, wxT("first text"));
|
||||
m_right = new wxTextCtrl(m_splitter, wxID_ANY, wxT("second text"));
|
||||
m_left = new wxTextCtrl(m_splitter, wxID_ANY, "first text");
|
||||
m_right = new wxTextCtrl(m_splitter, wxID_ANY, "second text");
|
||||
#endif
|
||||
|
||||
// you can also do this to start with a single window
|
||||
@ -314,7 +314,7 @@ MyFrame::MyFrame()
|
||||
#endif
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Min pane size = 0"), 1);
|
||||
SetStatusText("Min pane size = 0", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
m_replacewindow = NULL;
|
||||
@ -344,7 +344,7 @@ void MyFrame::OnSplitHorizontal(wxCommandEvent& WXUNUSED(event) )
|
||||
m_replacewindow = NULL;
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Splitter split horizontally"), 1);
|
||||
SetStatusText("Splitter split horizontally", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
@ -358,7 +358,7 @@ void MyFrame::OnSplitVertical(wxCommandEvent& WXUNUSED(event) )
|
||||
m_replacewindow = NULL;
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Splitter split vertically"), 1);
|
||||
SetStatusText("Splitter split vertically", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
@ -367,7 +367,7 @@ void MyFrame::OnUnsplit(wxCommandEvent& WXUNUSED(event) )
|
||||
if ( m_splitter->IsSplit() )
|
||||
m_splitter->Unsplit();
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("No splitter"));
|
||||
SetStatusText("No splitter");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
@ -390,9 +390,9 @@ void MyFrame::ToggleFlag(int flag, bool enable)
|
||||
void MyFrame::OnSetPosition(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxString str;
|
||||
str.Printf( wxT("%d"), m_splitter->GetSashPosition());
|
||||
str.Printf( "%d", m_splitter->GetSashPosition());
|
||||
#if wxUSE_TEXTDLG
|
||||
str = wxGetTextFromUser(wxT("Enter splitter position:"), wxT(""), str, this);
|
||||
str = wxGetTextFromUser("Enter splitter position:", "", str, this);
|
||||
#endif
|
||||
if ( str.empty() )
|
||||
return;
|
||||
@ -400,21 +400,21 @@ void MyFrame::OnSetPosition(wxCommandEvent& WXUNUSED(event) )
|
||||
long pos;
|
||||
if ( !str.ToLong(&pos) )
|
||||
{
|
||||
wxLogError(wxT("The splitter position should be an integer."));
|
||||
wxLogError("The splitter position should be an integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
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) )
|
||||
{
|
||||
wxString str;
|
||||
str.Printf( wxT("%d"), m_splitter->GetMinimumPaneSize());
|
||||
str.Printf( "%d", m_splitter->GetMinimumPaneSize());
|
||||
#if wxUSE_TEXTDLG
|
||||
str = wxGetTextFromUser(wxT("Enter minimal size for panes:"), wxT(""), str, this);
|
||||
str = wxGetTextFromUser("Enter minimal size for panes:", "", str, this);
|
||||
#endif
|
||||
if ( str.empty() )
|
||||
return;
|
||||
@ -422,7 +422,7 @@ void MyFrame::OnSetMinSize(wxCommandEvent& WXUNUSED(event) )
|
||||
int minsize = wxStrtol( str, (wxChar**)NULL, 10 );
|
||||
m_splitter->SetMinimumPaneSize(minsize);
|
||||
#if wxUSE_STATUSBAR
|
||||
str.Printf( wxT("Min pane size = %d"), minsize);
|
||||
str.Printf( "Min pane size = %d", minsize);
|
||||
SetStatusText(str, 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
@ -430,9 +430,9 @@ void MyFrame::OnSetMinSize(wxCommandEvent& WXUNUSED(event) )
|
||||
void MyFrame::OnSetGravity(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxString str;
|
||||
str.Printf( wxT("%g"), m_splitter->GetSashGravity());
|
||||
str.Printf( "%g", m_splitter->GetSashGravity());
|
||||
#if wxUSE_TEXTDLG
|
||||
str = wxGetTextFromUser(wxT("Enter sash gravity (0,1):"), wxT(""), str, this);
|
||||
str = wxGetTextFromUser("Enter sash gravity (0,1):", "", str, this);
|
||||
#endif
|
||||
if ( str.empty() )
|
||||
return;
|
||||
@ -440,7 +440,7 @@ void MyFrame::OnSetGravity(wxCommandEvent& WXUNUSED(event) )
|
||||
double gravity = wxStrtod( str, (wxChar**)NULL);
|
||||
m_splitter->SetSashGravity(gravity);
|
||||
#if wxUSE_STATUSBAR
|
||||
str.Printf( wxT("Gravity = %g"), gravity);
|
||||
str.Printf( "Gravity = %g", gravity);
|
||||
SetStatusText(str, 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
@ -513,7 +513,7 @@ MySplitterWindow::MySplitterWindow(wxFrame *parent)
|
||||
|
||||
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.Skip();
|
||||
@ -521,7 +521,7 @@ void MySplitterWindow::OnPositionChanged(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.Skip();
|
||||
@ -530,7 +530,7 @@ void MySplitterWindow::OnPositionChanging(wxSplitterEvent& event)
|
||||
void MySplitterWindow::OnDClick(wxSplitterEvent& event)
|
||||
{
|
||||
#if wxUSE_STATUSBAR
|
||||
m_frame->SetStatusText(wxT("Splitter double clicked"), 1);
|
||||
m_frame->SetStatusText("Splitter double clicked", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
event.Skip();
|
||||
@ -539,7 +539,7 @@ void MySplitterWindow::OnDClick(wxSplitterEvent& event)
|
||||
void MySplitterWindow::OnUnsplitEvent(wxSplitterEvent& event)
|
||||
{
|
||||
#if wxUSE_STATUSBAR
|
||||
m_frame->SetStatusText(wxT("Splitter unsplit"), 1);
|
||||
m_frame->SetStatusText("Splitter unsplit", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
event.Skip();
|
||||
@ -565,7 +565,7 @@ void MyCanvas::OnDraw(wxDC& dcOrig)
|
||||
dc.DrawLine(0, 0, 100, 200);
|
||||
|
||||
dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
|
||||
dc.DrawText(wxT("Testing"), 50, 50);
|
||||
dc.DrawText("Testing", 50, 50);
|
||||
|
||||
dc.SetPen(*wxRED_PEN);
|
||||
dc.SetBrush(*wxGREEN_BRUSH);
|
||||
|
@ -306,7 +306,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// create the main application window
|
||||
MyFrame *frame = new MyFrame(wxT("wxStatusBar sample"),
|
||||
MyFrame *frame = new MyFrame("wxStatusBar sample",
|
||||
wxPoint(50, 50), wxSize(450, 340));
|
||||
|
||||
// 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
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
menuFile->Append(StatusBar_Quit, wxT("E&xit\tAlt-X"),
|
||||
wxT("Quit this program"));
|
||||
menuFile->Append(StatusBar_Quit, "E&xit\tAlt-X",
|
||||
"Quit this program");
|
||||
|
||||
wxMenu *statbarMenu = new wxMenu;
|
||||
|
||||
wxMenu *statbarStyleMenu = new wxMenu;
|
||||
statbarStyleMenu->Append(StatusBar_SetStyleSizeGrip, wxT("wxSTB_SIZE_GRIP"),
|
||||
wxT("Toggles the wxSTB_SIZE_GRIP style"), true);
|
||||
statbarStyleMenu->Append(StatusBar_SetStyleShowTips, wxT("wxSTB_SHOW_TIPS"),
|
||||
wxT("Toggles the wxSTB_SHOW_TIPS style"), true);
|
||||
statbarStyleMenu->Append(StatusBar_SetStyleSizeGrip, "wxSTB_SIZE_GRIP",
|
||||
"Toggles the wxSTB_SIZE_GRIP style", true);
|
||||
statbarStyleMenu->Append(StatusBar_SetStyleShowTips, "wxSTB_SHOW_TIPS",
|
||||
"Toggles the wxSTB_SHOW_TIPS style", true);
|
||||
statbarStyleMenu->AppendSeparator();
|
||||
statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeStart,
|
||||
wxT("wxSTB_ELLIPSIZE_START"),
|
||||
wxT("Toggle wxSTB_ELLIPSIZE_START style"));
|
||||
"wxSTB_ELLIPSIZE_START",
|
||||
"Toggle wxSTB_ELLIPSIZE_START style");
|
||||
statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeMiddle,
|
||||
wxT("wxSTB_ELLIPSIZE_MIDDLE"),
|
||||
wxT("Toggle wxSTB_ELLIPSIZE_MIDDLE style"));
|
||||
"wxSTB_ELLIPSIZE_MIDDLE",
|
||||
"Toggle wxSTB_ELLIPSIZE_MIDDLE style");
|
||||
statbarStyleMenu->AppendCheckItem(StatusBar_SetStyleEllipsizeEnd,
|
||||
wxT("wxSTB_ELLIPSIZE_END"),
|
||||
wxT("Toggle wxSTB_ELLIPSIZE_END style"));
|
||||
statbarMenu->Append(StatusBar_SetPaneStyle, wxT("Status bar style"),
|
||||
"wxSTB_ELLIPSIZE_END",
|
||||
"Toggle wxSTB_ELLIPSIZE_END style");
|
||||
statbarMenu->Append(StatusBar_SetPaneStyle, "Status bar style",
|
||||
statbarStyleMenu);
|
||||
statbarMenu->AppendSeparator();
|
||||
|
||||
statbarMenu->Append(StatusBar_SetField, "Set active field &number\tCtrl-N",
|
||||
"Set the number of field used by the next commands.");
|
||||
statbarMenu->Append(StatusBar_SetText, wxT("Set field &text\tCtrl-T"),
|
||||
wxT("Set the text of the selected field."));
|
||||
statbarMenu->Append(StatusBar_SetText, "Set field &text\tCtrl-T",
|
||||
"Set the text of the selected field.");
|
||||
statbarMenu->Append(StatusBar_PushText, "P&ush field text\tCtrl-P",
|
||||
"Push a message on top the selected field.");
|
||||
statbarMenu->Append(StatusBar_PopText, "&Pop field text\tShift-Ctrl-P",
|
||||
"Restore the previous contents of the selected field.");
|
||||
statbarMenu->AppendSeparator();
|
||||
|
||||
statbarMenu->Append(StatusBar_SetFields, wxT("&Set field count\tCtrl-C"),
|
||||
wxT("Set the number of status bar fields"));
|
||||
statbarMenu->Append(StatusBar_SetFont, wxT("&Set field font\tCtrl-F"),
|
||||
wxT("Set the font to use for status bar fields"));
|
||||
statbarMenu->Append(StatusBar_SetFields, "&Set field count\tCtrl-C",
|
||||
"Set the number of status bar fields");
|
||||
statbarMenu->Append(StatusBar_SetFont, "&Set field font\tCtrl-F",
|
||||
"Set the font to use for status bar fields");
|
||||
|
||||
wxMenu *statbarPaneStyleMenu = new wxMenu;
|
||||
statbarPaneStyleMenu->AppendCheckItem
|
||||
(
|
||||
StatusBar_SetPaneStyleNormal,
|
||||
wxT("&Normal"),
|
||||
wxT("Sets the style of the first field to normal (sunken) look")
|
||||
"&Normal",
|
||||
"Sets the style of the first field to normal (sunken) look"
|
||||
);
|
||||
statbarPaneStyleMenu->AppendCheckItem
|
||||
(
|
||||
StatusBar_SetPaneStyleFlat,
|
||||
wxT("&Flat"),
|
||||
wxT("Sets the style of the first field to flat look")
|
||||
"&Flat",
|
||||
"Sets the style of the first field to flat look"
|
||||
);
|
||||
statbarPaneStyleMenu->AppendCheckItem
|
||||
(
|
||||
StatusBar_SetPaneStyleRaised,
|
||||
wxT("&Raised"),
|
||||
wxT("Sets the style of the first field to raised look")
|
||||
"&Raised",
|
||||
"Sets the style of the first field to raised look"
|
||||
);
|
||||
statbarPaneStyleMenu->AppendCheckItem
|
||||
(
|
||||
StatusBar_SetPaneStyleSunken,
|
||||
wxT("&Sunken"),
|
||||
wxT("Sets the style of the first field to sunken look")
|
||||
"&Sunken",
|
||||
"Sets the style of the first field to sunken look"
|
||||
);
|
||||
statbarMenu->Append(StatusBar_SetPaneStyle, wxT("Field style"),
|
||||
statbarMenu->Append(StatusBar_SetPaneStyle, "Field style",
|
||||
statbarPaneStyleMenu);
|
||||
|
||||
statbarMenu->Append(StatusBar_ResetFieldsWidth, wxT("Reset field widths"),
|
||||
wxT("Sets all fields to the same width"));
|
||||
statbarMenu->Append(StatusBar_ResetFieldsWidth, "Reset field widths",
|
||||
"Sets all fields to the same width");
|
||||
statbarMenu->Append(StatusBar_ShowFieldsRect,
|
||||
wxT("Sho&w field rectangles\tCtrl-W"),
|
||||
wxT("Visually show field rectangles"));
|
||||
"Sho&w field rectangles\tCtrl-W",
|
||||
"Visually show field rectangles");
|
||||
statbarMenu->AppendSeparator();
|
||||
|
||||
statbarMenu->AppendCheckItem(StatusBar_Toggle, wxT("&Toggle Status Bar"),
|
||||
wxT("Toggle the status bar display"));
|
||||
statbarMenu->Append(StatusBar_Recreate, wxT("&Recreate\tCtrl-R"),
|
||||
wxT("Toggle status bar format"));
|
||||
statbarMenu->AppendCheckItem(StatusBar_Toggle, "&Toggle Status Bar",
|
||||
"Toggle the status bar display");
|
||||
statbarMenu->Append(StatusBar_Recreate, "&Recreate\tCtrl-R",
|
||||
"Toggle status bar format");
|
||||
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(StatusBar_About, wxT("&About\tCtrl-A"),
|
||||
wxT("Show about dialog"));
|
||||
helpMenu->Append(StatusBar_About, "&About\tCtrl-A",
|
||||
"Show about dialog");
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(statbarMenu, wxT("&Status bar"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(statbarMenu, "&Status bar");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
// create default status bar to start with
|
||||
DoCreateStatusBar(StatBar_Default, wxSTB_DEFAULT_STYLE);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
}
|
||||
|
||||
void MyFrame::DoCreateStatusBar(MyFrame::StatusBarKind kind, long style)
|
||||
@ -457,7 +457,7 @@ void MyFrame::DoCreateStatusBar(MyFrame::StatusBarKind kind, long style)
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG(wxT("unknown status bar kind"));
|
||||
wxFAIL_MSG("unknown status bar kind");
|
||||
}
|
||||
|
||||
SetStatusBar(statbarNew);
|
||||
@ -591,8 +591,8 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
long nFields = wxGetNumberFromUser
|
||||
(
|
||||
wxT("Select the number of fields in the status bar"),
|
||||
wxT("Fields:"),
|
||||
"Select the number of fields in the status bar",
|
||||
"Fields:",
|
||||
SAMPLE_DIALOGS_TITLE,
|
||||
sb->GetFieldsCount(),
|
||||
1, 5,
|
||||
@ -625,13 +625,13 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event))
|
||||
if ( widths )
|
||||
{
|
||||
if ( widths[n] > 0 )
|
||||
s.Printf(wxT("fixed (%d)"), widths[n]);
|
||||
s.Printf("fixed (%d)", widths[n]);
|
||||
else
|
||||
s.Printf(wxT("variable (*%d)"), -widths[n]);
|
||||
s.Printf("variable (*%d)", -widths[n]);
|
||||
}
|
||||
else
|
||||
{
|
||||
s = wxT("default");
|
||||
s = "default";
|
||||
}
|
||||
|
||||
SetStatusText(s, n);
|
||||
@ -642,7 +642,7 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(this, wxT("Cancelled"));
|
||||
wxLogStatus(this, "Cancelled");
|
||||
}
|
||||
}
|
||||
|
||||
@ -849,28 +849,28 @@ void MyFrame::OnSetStyle(wxCommandEvent& event)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
MyAboutDialog::MyAboutDialog(wxWindow *parent)
|
||||
: wxDialog(parent, wxID_ANY, wxString(wxT("About statbar")),
|
||||
: wxDialog(parent, wxID_ANY, wxString("About statbar"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
{
|
||||
wxStaticText *text = new wxStaticText(this, wxID_ANY,
|
||||
wxT("wxStatusBar sample\n")
|
||||
wxT("(c) 2000 Vadim Zeitlin"));
|
||||
"wxStatusBar sample\n"
|
||||
"(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),
|
||||
// otherwise it looks weird
|
||||
wxStatusBar *statbarTop = new wxStatusBar(this, wxID_ANY, 0);
|
||||
statbarTop->SetFieldsCount(3);
|
||||
statbarTop->SetStatusText(wxT("This is a top status bar"), 0);
|
||||
statbarTop->SetStatusText(wxT("in a dialog"), 1);
|
||||
statbarTop->SetStatusText(wxT("Great, isn't it?"), 2);
|
||||
statbarTop->SetStatusText("This is a top status bar", 0);
|
||||
statbarTop->SetStatusText("in a dialog", 1);
|
||||
statbarTop->SetStatusText("Great, isn't it?", 2);
|
||||
|
||||
wxStatusBar *statbarBottom = new wxStatusBar(this, wxID_ANY);
|
||||
statbarBottom->SetFieldsCount(2);
|
||||
statbarBottom->SetStatusText(wxT("This is a bottom status bar"), 0);
|
||||
statbarBottom->SetStatusText(wxT("in a dialog"), 1);
|
||||
statbarBottom->SetStatusText("This is a bottom status bar", 0);
|
||||
statbarBottom->SetStatusText("in a dialog", 1);
|
||||
|
||||
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||
sizerTop->Add(statbarTop, 0, wxGROW);
|
||||
@ -922,7 +922,7 @@ MyStatusBar::MyStatusBar(wxWindow *parent, long style)
|
||||
SetStatusWidths(Field_Max, widths);
|
||||
|
||||
#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);
|
||||
#endif
|
||||
|
||||
|
@ -139,7 +139,7 @@ bool MyApp::OnInit()
|
||||
{
|
||||
// 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));
|
||||
|
||||
frame->Show(true);
|
||||
@ -174,8 +174,8 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title,
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(help_menu, wxT("&Help"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
SetMenuBar(menu_bar);
|
||||
@ -198,12 +198,12 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
(void)wxMessageBox(wxT("wxWidgets SVG sample\n")
|
||||
wxT("Authors:\n")
|
||||
wxT(" Chris Elliott (c) 2002-2009\n")
|
||||
wxT(" Prashant Kumar Nirmal (c) 2017\n")
|
||||
wxT("Usage: click File|Save to Save the Selected SVG Test"),
|
||||
wxT("About SVG Test"));
|
||||
(void)wxMessageBox("wxWidgets SVG sample\n"
|
||||
"Authors:\n"
|
||||
" Chris Elliott (c) 2002-2009\n"
|
||||
" Prashant Kumar Nirmal (c) 2017\n"
|
||||
"Usage: click File|Save to Save the Selected SVG Test",
|
||||
"About SVG Test");
|
||||
}
|
||||
|
||||
void MyFrame::FileSavePicture(wxCommandEvent& WXUNUSED(event))
|
||||
@ -211,9 +211,9 @@ void MyFrame::FileSavePicture(wxCommandEvent& WXUNUSED(event))
|
||||
#if wxUSE_FILEDLG
|
||||
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()),
|
||||
wxT("SVG vector picture files (*.svg)|*.svg"),
|
||||
"SVG vector picture files (*.svg)|*.svg",
|
||||
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
@ -280,10 +280,10 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
dc.SetBrush(*wxCYAN_BRUSH);
|
||||
dc.SetPen(*wxRED_PEN);
|
||||
dc.DrawRectangle(10, 10, 100, 70);
|
||||
wB = wxBrush (wxT("DARK ORCHID"), wxBRUSHSTYLE_TRANSPARENT);
|
||||
wB = wxBrush ("DARK ORCHID", wxBRUSHSTYLE_TRANSPARENT);
|
||||
dc.SetBrush (wB);
|
||||
dc.DrawRoundedRectangle(50, 50, 100, 70, 20);
|
||||
dc.SetBrush (wxBrush(wxT("GOLDENROD")) );
|
||||
dc.SetBrush (wxBrush("GOLDENROD") );
|
||||
dc.DrawEllipse(100, 100, 100, 50);
|
||||
|
||||
points[0].x = 100; points[0].y = 200;
|
||||
@ -301,21 +301,21 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
// draw text in Arial or similar font
|
||||
dc.DrawLine(50,25,50,35);
|
||||
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();
|
||||
dc.SetTextForeground (wxT("FIREBRICK"));
|
||||
dc.SetTextForeground ("FIREBRICK");
|
||||
|
||||
// no effect in msw ??
|
||||
dc.SetTextBackground (wxT("WHEAT"));
|
||||
dc.DrawText(wxT("This is a Red string"), 50, 200);
|
||||
dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45);
|
||||
dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90);
|
||||
dc.SetTextBackground ("WHEAT");
|
||||
dc.DrawText("This is a Red string", 50, 200);
|
||||
dc.DrawRotatedText("This is a 45 deg string", 50, 200, 45);
|
||||
dc.DrawRotatedText("This is a 90 deg string", 50, 200, 90);
|
||||
dc.SetFont(wxFontInfo(18)
|
||||
.FaceName("Times New Roman")
|
||||
.Family(wxFONTFAMILY_ROMAN)
|
||||
.Italic().Bold());
|
||||
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;
|
||||
|
||||
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.SetDeviceOrigin(0,0);
|
||||
|
||||
wP.SetColour (wxT("CADET BLUE"));
|
||||
wP.SetColour ("CADET BLUE");
|
||||
dc.SetPen(wP);
|
||||
dc.DrawArc ( 75,125, 110, 40, 75, 75 );
|
||||
|
||||
wP.SetColour (wxT("SALMON"));
|
||||
wP.SetColour ("SALMON");
|
||||
dc.SetPen(wP);
|
||||
dc.SetBrush(*wxRED_BRUSH);
|
||||
//top left corner, width and height, start and end angle
|
||||
@ -343,7 +343,7 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
wP.SetWidth(3);
|
||||
dc.SetPen(wP);
|
||||
//wxTRANSPARENT));
|
||||
dc.SetBrush (wxBrush (wxT("SALMON")));
|
||||
dc.SetBrush (wxBrush ("SALMON"));
|
||||
dc.DrawEllipticArc(300, 0,200,100, 0.0,145.0);
|
||||
//same end point
|
||||
dc.DrawEllipticArc(300, 50,200,100,90.0,145.0);
|
||||
@ -353,7 +353,7 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
|
||||
case Page_Checkmarks:
|
||||
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.DrawRectangle ( 80,50,75,75);
|
||||
break;
|
||||
@ -365,7 +365,7 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
.Italic().Bold());
|
||||
dc.DrawLine(0, 0, 200, 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
|
||||
wP = *wxCYAN_PEN;
|
||||
@ -374,10 +374,10 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
dc.SetDeviceOrigin(200,0);
|
||||
dc.DrawLine(0, 0, 200, 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.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;
|
||||
dc.SetPen(wP);
|
||||
@ -386,7 +386,7 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
dc.SetMapMode (wxMM_METRIC); //svg ignores this
|
||||
dc.DrawLine(0, 0, 200, 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;
|
||||
|
||||
case Page_Bitmaps:
|
||||
@ -395,15 +395,15 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
break;
|
||||
|
||||
case Page_Clipping:
|
||||
dc.SetTextForeground(wxT("RED"));
|
||||
dc.DrawText(wxT("Red = Clipping Off"), 30, 5);
|
||||
dc.SetTextForeground(wxT("GREEN"));
|
||||
dc.DrawText(wxT("Green = Clipping On"), 30, 25);
|
||||
dc.SetTextForeground("RED");
|
||||
dc.DrawText("Red = Clipping Off", 30, 5);
|
||||
dc.SetTextForeground("GREEN");
|
||||
dc.DrawText("Green = Clipping On", 30, 25);
|
||||
|
||||
dc.SetTextForeground(wxT("BLACK"));
|
||||
dc.SetTextForeground("BLACK");
|
||||
|
||||
dc.SetPen(*wxRED_PEN);
|
||||
dc.SetBrush (wxBrush (wxT("SALMON"),wxBRUSHSTYLE_TRANSPARENT));
|
||||
dc.SetBrush (wxBrush ("SALMON",wxBRUSHSTYLE_TRANSPARENT));
|
||||
dc.DrawCheckMark ( 80,50,75,75);
|
||||
dc.DrawRectangle ( 80,50,75,75);
|
||||
|
||||
@ -464,7 +464,7 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
//dc.SetTextBackground(*wxBLUE);
|
||||
|
||||
// Horizontal text
|
||||
txtStr = wxT("Horizontal string");
|
||||
txtStr = "Horizontal string";
|
||||
dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL);
|
||||
txtX = 50;
|
||||
txtY = 300;
|
||||
@ -472,7 +472,7 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
dc.DrawText(txtStr, txtX + txtPad, txtY + txtPad);
|
||||
|
||||
// Vertical text
|
||||
txtStr = wxT("Vertical string");
|
||||
txtStr = "Vertical string";
|
||||
dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL);
|
||||
txtX = 50;
|
||||
txtY = 250;
|
||||
@ -480,7 +480,7 @@ void MyPage::OnDraw(wxDC& dc)
|
||||
dc.DrawRotatedText(txtStr, txtX + txtPad, txtY - txtPad, 90);
|
||||
|
||||
// 45 degree text
|
||||
txtStr = wxT("45 deg string");
|
||||
txtStr = "45 deg string";
|
||||
dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL);
|
||||
double lenW = (double)(txtW + 2*txtPad) / sqrt(2.0);
|
||||
double lenH = (double)(txtH + 2*txtPad) / sqrt(2.0);
|
||||
|
@ -100,11 +100,11 @@ private:
|
||||
{
|
||||
if ( m_panel->NavigateIn(flags) )
|
||||
{
|
||||
wxLogStatus(this, wxT("Navigation event processed"));
|
||||
wxLogStatus(this, "Navigation event processed");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogStatus(this, wxT("Navigation event ignored"));
|
||||
wxLogStatus(this, "Navigation event ignored");
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,8 +143,8 @@ private:
|
||||
if ( event.GetKeyCode() == WXK_TAB &&
|
||||
wxMessageBox
|
||||
(
|
||||
wxT("Let the Tab be used for navigation?"),
|
||||
wxT("wxWidgets TabOrder sample: Tab key pressed"),
|
||||
"Let the Tab be used for navigation?",
|
||||
"wxWidgets TabOrder sample: Tab key pressed",
|
||||
wxICON_QUESTION | wxYES_NO,
|
||||
this
|
||||
) != wxYES )
|
||||
@ -194,7 +194,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame(NULL, wxID_ANY, wxT("TabOrder wxWidgets Sample"),
|
||||
: wxFrame(NULL, wxID_ANY, "TabOrder wxWidgets Sample",
|
||||
wxDefaultPosition, wxSize(700, 450))
|
||||
{
|
||||
SetIcon(wxICON(sample));
|
||||
@ -205,14 +205,14 @@ MyFrame::MyFrame()
|
||||
menuFile->Append(TabOrder_Quit);
|
||||
|
||||
wxMenu *menuNav = new wxMenu;
|
||||
menuNav->Append(TabOrder_TabForward, wxT("Tab &forward\tCtrl-F"),
|
||||
wxT("Emulate a <Tab> press"));
|
||||
menuNav->Append(TabOrder_TabBackward, wxT("Tab &backward\tCtrl-B"),
|
||||
wxT("Emulate a <Shift-Tab> press"));
|
||||
menuNav->Append(TabOrder_TabForward, "Tab &forward\tCtrl-F",
|
||||
"Emulate a <Tab> press");
|
||||
menuNav->Append(TabOrder_TabBackward, "Tab &backward\tCtrl-B",
|
||||
"Emulate a <Shift-Tab> press");
|
||||
|
||||
wxMenuBar *mbar = new wxMenuBar;
|
||||
mbar->Append(menuFile, wxT("&File"));
|
||||
mbar->Append(menuNav, wxT("&Navigate"));
|
||||
mbar->Append(menuFile, "&File");
|
||||
mbar->Append(menuNav, "&Navigate");
|
||||
|
||||
SetMenuBar(mbar);
|
||||
|
||||
@ -228,8 +228,8 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("Tab navigation sample\n(c) 2007 Vadim Zeitlin"),
|
||||
wxT("About TabOrder wxWidgets Sample"), wxOK, this);
|
||||
wxMessageBox("Tab navigation sample\n(c) 2007 Vadim Zeitlin",
|
||||
"About TabOrder wxWidgets Sample", wxOK, this);
|
||||
}
|
||||
|
||||
void MyFrame::OnTabForward(wxCommandEvent& WXUNUSED(event))
|
||||
@ -254,11 +254,11 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
|
||||
wxString msg;
|
||||
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
|
||||
{
|
||||
msg = wxT("No focus");
|
||||
msg = "No focus";
|
||||
}
|
||||
|
||||
SetStatusText(msg, StatusPane_Focus);
|
||||
@ -273,16 +273,16 @@ MyPanel::MyPanel(wxWindow *parent)
|
||||
: wxPanel(parent, wxID_ANY)
|
||||
{
|
||||
wxNotebook *notebook = new wxNotebook(this, wxID_ANY);
|
||||
notebook->AddPage(CreateButtonPage(notebook), wxT("Button"));
|
||||
notebook->AddPage(CreateTextPage(notebook), wxT("Text"));
|
||||
notebook->AddPage(CreateButtonPage(notebook), "Button");
|
||||
notebook->AddPage(CreateTextPage(notebook), "Text");
|
||||
|
||||
wxSizer *sizerV = new wxBoxSizer(wxVERTICAL);
|
||||
sizerV->Add(notebook, wxSizerFlags(1).Expand());
|
||||
|
||||
wxListBox *lbox = new wxListBox(this, wxID_ANY);
|
||||
lbox->AppendString(wxT("Just a"));
|
||||
lbox->AppendString(wxT("simple"));
|
||||
lbox->AppendString(wxT("listbox"));
|
||||
lbox->AppendString("Just a");
|
||||
lbox->AppendString("simple");
|
||||
lbox->AppendString("listbox");
|
||||
sizerV->Add(lbox, wxSizerFlags(1).Expand());
|
||||
|
||||
SetSizerAndFit(sizerV);
|
||||
@ -294,10 +294,10 @@ wxWindow *MyPanel::CreateButtonPage(wxWindow *parent)
|
||||
|
||||
wxPanel *page = new wxPanel(parent);
|
||||
wxSizer *sizerPage = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizerPage->Add(new wxButton(page, wxID_ANY, wxT("&First")), flagsBorder);
|
||||
sizerPage->Add(new wxStaticText(page, wxID_ANY, wxT("[st&atic]")),
|
||||
sizerPage->Add(new wxButton(page, wxID_ANY, "&First"), flagsBorder);
|
||||
sizerPage->Add(new wxStaticText(page, wxID_ANY, "[st&atic]"),
|
||||
flagsBorder);
|
||||
sizerPage->Add(new wxButton(page, wxID_ANY, wxT("&Second")), flagsBorder);
|
||||
sizerPage->Add(new wxButton(page, wxID_ANY, "&Second"), flagsBorder);
|
||||
|
||||
page->SetSizer(sizerPage);
|
||||
|
||||
@ -312,14 +312,14 @@ wxWindow *MyPanel::CreateTextPage(wxWindow *parent)
|
||||
wxPanel *page = new wxPanel(parent);
|
||||
|
||||
wxSizer *sizerH = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizerH->Add(new wxStaticText(page, wxID_ANY, wxT("&Label:")), flagsBorder);
|
||||
sizerH->Add(new MyTabTextCtrl(page, wxT("TAB ignored here")), flagsBorder);
|
||||
sizerH->Add(new wxStaticText(page, wxID_ANY, "&Label:"), flagsBorder);
|
||||
sizerH->Add(new MyTabTextCtrl(page, "TAB ignored here"), flagsBorder);
|
||||
sizerPage->Add(sizerH, wxSizerFlags(1).Expand());
|
||||
|
||||
sizerH = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizerH->Add(new wxStaticText(page, wxID_ANY, wxT("&Another one:")),
|
||||
sizerH->Add(new wxStaticText(page, wxID_ANY, "&Another one:"),
|
||||
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);
|
||||
sizerPage->Add(sizerH, wxSizerFlags(1).Expand());
|
||||
|
||||
|
@ -70,7 +70,7 @@ bool MyApp::OnInit()
|
||||
}
|
||||
|
||||
// Create the main window
|
||||
gs_dialog = new MyDialog(wxT("wxTaskBarIcon Test Dialog"));
|
||||
gs_dialog = new MyDialog("wxTaskBarIcon Test Dialog");
|
||||
|
||||
gs_dialog->Show(true);
|
||||
|
||||
@ -102,22 +102,22 @@ MyDialog::MyDialog(const wxString& title)
|
||||
(
|
||||
this,
|
||||
wxID_ANY,
|
||||
wxT("Press 'Hide me' to hide this window, Exit to quit.")
|
||||
"Press 'Hide me' to hide this window, Exit to quit."
|
||||
), flags);
|
||||
|
||||
sizerTop->Add(new wxStaticText
|
||||
(
|
||||
this,
|
||||
wxID_ANY,
|
||||
wxT("Double-click on the taskbar icon to show me again.")
|
||||
"Double-click on the taskbar icon to show me again."
|
||||
), flags);
|
||||
|
||||
sizerTop->AddStretchSpacer()->SetMinSize(200, 50);
|
||||
|
||||
wxSizer * const sizerBtns = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizerBtns->Add(new wxButton(this, wxID_ABOUT, wxT("&About")), flags);
|
||||
sizerBtns->Add(new wxButton(this, wxID_OK, wxT("&Hide")), flags);
|
||||
sizerBtns->Add(new wxButton(this, wxID_EXIT, wxT("E&xit")), flags);
|
||||
sizerBtns->Add(new wxButton(this, wxID_ABOUT, "&About"), flags);
|
||||
sizerBtns->Add(new wxButton(this, wxID_OK, "&Hide"), flags);
|
||||
sizerBtns->Add(new wxButton(this, wxID_EXIT, "E&xit"), flags);
|
||||
|
||||
sizerTop->Add(sizerBtns, flags.Align(wxALIGN_CENTER_HORIZONTAL));
|
||||
SetSizerAndFit(sizerTop);
|
||||
@ -132,14 +132,14 @@ MyDialog::MyDialog(const wxString& title)
|
||||
"long tooltip whose length is\n"
|
||||
"greater than 64 characters.") )
|
||||
{
|
||||
wxLogError(wxT("Could not set icon."));
|
||||
wxLogError("Could not set icon.");
|
||||
}
|
||||
|
||||
#if defined(__WXOSX__) && wxOSX_USE_COCOA
|
||||
m_dockIcon = new MyTaskBarIcon(wxTBI_DOCK);
|
||||
if ( !m_dockIcon->SetIcon(wxICON(sample)) )
|
||||
{
|
||||
wxLogError(wxT("Could not set icon."));
|
||||
wxLogError("Could not set icon.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -234,37 +234,37 @@ void MyTaskBarIcon::OnMenuSetNewIcon(wxCommandEvent&)
|
||||
{
|
||||
wxIcon icon(smile_xpm);
|
||||
|
||||
if (!SetIcon(icon, wxT("wxTaskBarIcon Sample - a different icon")))
|
||||
wxMessageBox(wxT("Could not set new icon."));
|
||||
if (!SetIcon(icon, "wxTaskBarIcon Sample - a different icon"))
|
||||
wxMessageBox("Could not set new icon.");
|
||||
}
|
||||
|
||||
void MyTaskBarIcon::OnMenuSub(wxCommandEvent&)
|
||||
{
|
||||
wxMessageBox(wxT("You clicked on a submenu!"));
|
||||
wxMessageBox("You clicked on a submenu!");
|
||||
}
|
||||
|
||||
// Overridables
|
||||
wxMenu *MyTaskBarIcon::CreatePopupMenu()
|
||||
{
|
||||
wxMenu *menu = new wxMenu;
|
||||
menu->Append(PU_RESTORE, wxT("&Restore main window"));
|
||||
menu->Append(PU_RESTORE, "&Restore main window");
|
||||
menu->AppendSeparator();
|
||||
menu->Append(PU_NEW_ICON, wxT("&Set New Icon"));
|
||||
menu->Append(PU_NEW_ICON, "&Set New Icon");
|
||||
menu->AppendSeparator();
|
||||
menu->AppendCheckItem(PU_CHECKMARK, wxT("Test &check mark"));
|
||||
menu->AppendCheckItem(PU_CHECKMARK, "Test &check mark");
|
||||
menu->AppendSeparator();
|
||||
wxMenu *submenu = new wxMenu;
|
||||
submenu->Append(PU_SUB1, wxT("One submenu"));
|
||||
submenu->Append(PU_SUB1, "One submenu");
|
||||
submenu->AppendSeparator();
|
||||
submenu->Append(PU_SUB2, wxT("Another submenu"));
|
||||
menu->Append(PU_SUBMAIN, wxT("Submenu"), submenu);
|
||||
submenu->Append(PU_SUB2, "Another submenu");
|
||||
menu->Append(PU_SUBMAIN, "Submenu", submenu);
|
||||
/* OSX has built-in quit menu for the dock menu, but not for the status item */
|
||||
#ifdef __WXOSX__
|
||||
if ( OSXIsStatusItem() )
|
||||
#endif
|
||||
{
|
||||
menu->AppendSeparator();
|
||||
menu->Append(PU_EXIT, wxT("E&xit"));
|
||||
menu->Append(PU_EXIT, "E&xit");
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
@ -140,19 +140,19 @@ bool MyApp::OnInit()
|
||||
wxTaskBarJumpListItem *item1 = new wxTaskBarJumpListItem(
|
||||
NULL,
|
||||
wxTASKBAR_JUMP_LIST_TASK,
|
||||
wxT("Task 1"),
|
||||
"Task 1",
|
||||
wxStandardPaths::Get().GetExecutablePath(),
|
||||
wxEmptyString,
|
||||
wxT("Test Task"),
|
||||
"Test Task",
|
||||
wxStandardPaths::Get().GetExecutablePath(),
|
||||
0);
|
||||
wxTaskBarJumpListItem *item2 = new wxTaskBarJumpListItem(
|
||||
NULL,
|
||||
wxTASKBAR_JUMP_LIST_TASK,
|
||||
wxT("Task 2"),
|
||||
"Task 2",
|
||||
wxStandardPaths::Get().GetExecutablePath(),
|
||||
wxEmptyString,
|
||||
wxT("Test Task"),
|
||||
"Test Task",
|
||||
wxStandardPaths::Get().GetExecutablePath(),
|
||||
0);
|
||||
jumpList.GetTasks().Append(item1);
|
||||
@ -163,14 +163,14 @@ bool MyApp::OnInit()
|
||||
jumpList.ShowFrequentCategory();
|
||||
|
||||
wxTaskBarJumpListCategory* customCategory =
|
||||
new wxTaskBarJumpListCategory(&jumpList, wxT("Custom"));
|
||||
new wxTaskBarJumpListCategory(&jumpList, "Custom");
|
||||
wxTaskBarJumpListItem* item3 = new wxTaskBarJumpListItem(
|
||||
customCategory,
|
||||
wxTASKBAR_JUMP_LIST_DESTINATION,
|
||||
wxT("Help"),
|
||||
"Help",
|
||||
wxStandardPaths::Get().GetExecutablePath(),
|
||||
wxT("--help"),
|
||||
wxT("wxTaskBarButton help."),
|
||||
"--help",
|
||||
"wxTaskBarButton help.",
|
||||
wxStandardPaths::Get().GetExecutablePath(),
|
||||
0);
|
||||
customCategory->Append(item3);
|
||||
@ -213,7 +213,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
|
||||
// SetProgressValue section.
|
||||
wxStaticBoxSizer *spvSizer =
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetProgressValue"));
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, "SetProgressValue");
|
||||
int flags = wxSL_MIN_MAX_LABELS | wxSL_VALUE_LABEL | wxSL_AUTOTICKS;
|
||||
m_slider = new wxSlider(spvSizer->GetStaticBox(), ProgressValueSlider,
|
||||
0, 0, 100,
|
||||
@ -234,15 +234,15 @@ MyFrame::MyFrame(const wxString& title)
|
||||
1, wxRA_SPECIFY_ROWS);
|
||||
// SetThumbnailTooltip section.
|
||||
wxStaticBoxSizer *sttSizer =
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetThumbnailTooltip"));
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, "SetThumbnailTooltip");
|
||||
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(btn, 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
// SetProgressState section.
|
||||
wxStaticBoxSizer *spsSizer =
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetProgressState"));
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, "SetProgressState");
|
||||
const wxString choices[] =
|
||||
{
|
||||
"wxNoProgress",
|
||||
@ -258,33 +258,33 @@ MyFrame::MyFrame(const wxString& title)
|
||||
|
||||
// SetOverlayIcon section.
|
||||
wxStaticBoxSizer *soiSizer =
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetOverlayIcon"));
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, "SetOverlayIcon");
|
||||
wxButton *setOverlayIconBtn =
|
||||
new wxButton(panel, SetOverlayIconBtn, wxT("Set Overlay Icon"));
|
||||
new wxButton(panel, SetOverlayIconBtn, "Set Overlay Icon");
|
||||
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(clearOverlayIconBtn, 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
// SetThumbnailClip section.
|
||||
wxStaticBoxSizer *stcSizer =
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("SetThumbnailClip"));
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, "SetThumbnailClip");
|
||||
wxButton *setThumbnailClipBtn =
|
||||
new wxButton(panel, SetThumbnailClipBtn, wxT("Set Thumbnail Clip"));
|
||||
new wxButton(panel, SetThumbnailClipBtn, "Set Thumbnail Clip");
|
||||
wxButton *restoreThumbnailClipBtn =
|
||||
new wxButton(panel, RestoreThumbnailClipBtn,
|
||||
wxT("Restore Thumbnail Clip"));
|
||||
"Restore Thumbnail Clip");
|
||||
stcSizer->Add(setThumbnailClipBtn, 1, wxEXPAND | wxALL, 2);
|
||||
stcSizer->Add(restoreThumbnailClipBtn, 1, wxEXPAND | wxALL, 2);
|
||||
|
||||
// Thumbnail Toolbar Buttons section.
|
||||
wxStaticBoxSizer *ttbSizer =
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, wxT("ThumbBar Buttons"));
|
||||
new wxStaticBoxSizer(wxVERTICAL, panel, "ThumbBar Buttons");
|
||||
wxButton *addThumbBarButtonBtn =
|
||||
new wxButton(panel, AddThumbBarButtonBtn, wxT("Add ThumbBar Button"));
|
||||
new wxButton(panel, AddThumbBarButtonBtn, "Add ThumbBar Button");
|
||||
wxButton *showThumbnailToolbarBtn =
|
||||
new wxButton(panel, RemoveThumbBarButtonBtn,
|
||||
wxT("Remove Last ThumbBar Button"));
|
||||
"Remove Last ThumbBar Button");
|
||||
ttbSizer->Add(addThumbBarButtonBtn, 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);
|
||||
|
||||
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(gs);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -356,29 +356,29 @@ MyFrame::MyFrame(const wxString& title)
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
menuFile->Append(THREAD_CLEAR, wxT("&Clear log\tCtrl-L"));
|
||||
menuFile->Append(THREAD_CLEAR, "&Clear log\tCtrl-L");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(THREAD_QUIT, wxT("E&xit\tAlt-X"));
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuFile->Append(THREAD_QUIT, "E&xit\tAlt-X");
|
||||
menuBar->Append(menuFile, "&File");
|
||||
|
||||
wxMenu *menuThread = new wxMenu;
|
||||
menuThread->Append(THREAD_START_THREAD, wxT("&Start a new thread\tCtrl-N"));
|
||||
menuThread->Append(THREAD_START_THREADS, wxT("Start &many threads at once"));
|
||||
menuThread->Append(THREAD_STOP_THREAD, wxT("S&top the last spawned thread\tCtrl-S"));
|
||||
menuThread->Append(THREAD_START_THREAD, "&Start a new thread\tCtrl-N");
|
||||
menuThread->Append(THREAD_START_THREADS, "Start &many threads at once");
|
||||
menuThread->Append(THREAD_STOP_THREAD, "S&top the last spawned thread\tCtrl-S");
|
||||
menuThread->AppendSeparator();
|
||||
menuThread->Append(THREAD_PAUSE_THREAD, wxT("&Pause the last spawned running thread\tCtrl-P"));
|
||||
menuThread->Append(THREAD_RESUME_THREAD, wxT("&Resume the first suspended thread\tCtrl-R"));
|
||||
menuThread->Append(THREAD_PAUSE_THREAD, "&Pause the last spawned running thread\tCtrl-P");
|
||||
menuThread->Append(THREAD_RESUME_THREAD, "&Resume the first suspended thread\tCtrl-R");
|
||||
menuThread->AppendSeparator();
|
||||
menuThread->Append(THREAD_START_WORKER, wxT("Start a &worker thread\tCtrl-W"));
|
||||
menuThread->Append(THREAD_EXEC_MAIN, wxT("&Launch a program from main thread\tF5"));
|
||||
menuThread->Append(THREAD_START_GUI_THREAD, wxT("Launch a &GUI thread\tF6"));
|
||||
menuBar->Append(menuThread, wxT("&Thread"));
|
||||
menuThread->Append(THREAD_START_WORKER, "Start a &worker thread\tCtrl-W");
|
||||
menuThread->Append(THREAD_EXEC_MAIN, "&Launch a program from main thread\tF5");
|
||||
menuThread->Append(THREAD_START_GUI_THREAD, "Launch a &GUI thread\tF6");
|
||||
menuBar->Append(menuThread, "&Thread");
|
||||
|
||||
wxMenu *menuHelp = new wxMenu;
|
||||
menuHelp->Append(THREAD_SHOWCPUS, wxT("&Show CPU count"));
|
||||
menuHelp->Append(THREAD_SHOWCPUS, "&Show CPU count");
|
||||
menuHelp->AppendSeparator();
|
||||
menuHelp->Append(THREAD_ABOUT, wxT("&About"));
|
||||
menuBar->Append(menuHelp, wxT("&Help"));
|
||||
menuHelp->Append(THREAD_ABOUT, "&About");
|
||||
menuBar->Append(menuHelp, "&Help");
|
||||
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
@ -488,7 +488,7 @@ MyThread *MyFrame::CreateThread()
|
||||
|
||||
if ( thread->Create() != wxTHREAD_NO_ERROR )
|
||||
{
|
||||
wxLogError(wxT("Can't create thread!"));
|
||||
wxLogError("Can't create thread!");
|
||||
}
|
||||
|
||||
wxCriticalSectionLocker enter(wxGetApp().m_critsect);
|
||||
@ -515,7 +515,7 @@ void MyFrame::UpdateThreadStatus()
|
||||
m_nRunning = nRunning;
|
||||
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
|
||||
}
|
||||
@ -535,8 +535,8 @@ void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
static long s_num;
|
||||
|
||||
s_num = wxGetNumberFromUser(wxT("How many threads to start: "), wxT(""),
|
||||
wxT("wxThread sample"), s_num, 1, 10000, this);
|
||||
s_num = wxGetNumberFromUser("How many threads to start: ", "",
|
||||
"wxThread sample", s_num, 1, 10000, this);
|
||||
if ( s_num == -1 )
|
||||
{
|
||||
s_num = 10;
|
||||
@ -568,7 +568,7 @@ void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
wxString msg;
|
||||
msg.Printf(wxT("%d new threads created."), count);
|
||||
msg.Printf("%d new threads created.", count);
|
||||
SetStatusText(msg, 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
@ -585,11 +585,11 @@ void MyFrame::OnStartThread(wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
if ( thread->Run() != wxTHREAD_NO_ERROR )
|
||||
{
|
||||
wxLogError(wxT("Can't start thread!"));
|
||||
wxLogError("Can't start thread!");
|
||||
}
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("New thread started."), 1);
|
||||
SetStatusText("New thread started.", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
@ -602,7 +602,7 @@ void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) )
|
||||
// stop the last thread
|
||||
if ( wxGetApp().m_threads.IsEmpty() )
|
||||
{
|
||||
wxLogError(wxT("No thread to stop!"));
|
||||
wxLogError("No thread to stop!");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -617,7 +617,7 @@ void MyFrame::OnStopThread(wxCommandEvent& WXUNUSED(event) )
|
||||
toDelete->Delete();
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Last thread stopped."), 1);
|
||||
SetStatusText("Last thread stopped.", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
}
|
||||
@ -633,14 +633,14 @@ void MyFrame::OnResumeThread(wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
if ( n == count )
|
||||
{
|
||||
wxLogError(wxT("No thread to resume!"));
|
||||
wxLogError("No thread to resume!");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxGetApp().m_threads[n]->Resume();
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Thread resumed."), 1);
|
||||
SetStatusText("Thread resumed.", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
}
|
||||
@ -656,14 +656,14 @@ void MyFrame::OnPauseThread(wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
if ( n < 0 )
|
||||
{
|
||||
wxLogError(wxT("No thread to pause!"));
|
||||
wxLogError("No thread to pause!");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxGetApp().m_threads[n]->Pause();
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
SetStatusText(wxT("Thread paused."), 1);
|
||||
SetStatusText("Thread paused.", 1);
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
}
|
||||
@ -693,7 +693,7 @@ void MyFrame::OnExecMain(wxCommandEvent& WXUNUSED(event))
|
||||
if (cmd.IsEmpty())
|
||||
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));
|
||||
}
|
||||
|
||||
@ -705,19 +705,19 @@ void MyFrame::OnShowCPUs(wxCommandEvent& WXUNUSED(event))
|
||||
switch ( nCPUs )
|
||||
{
|
||||
case -1:
|
||||
msg = wxT("Unknown number of CPUs");
|
||||
msg = "Unknown number of CPUs";
|
||||
break;
|
||||
|
||||
case 0:
|
||||
msg = wxT("WARNING: you're running without any CPUs!");
|
||||
msg = "WARNING: you're running without any CPUs!";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
msg = wxT("This system only has one CPU.");
|
||||
msg = "This system only has one CPU.";
|
||||
break;
|
||||
|
||||
default:
|
||||
msg.Printf(wxT("This system has %d CPUs"), nCPUs);
|
||||
msg.Printf("This system has %d CPUs", nCPUs);
|
||||
}
|
||||
|
||||
wxLogMessage(msg);
|
||||
@ -726,11 +726,11 @@ void MyFrame::OnShowCPUs(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxMessageDialog dialog(this,
|
||||
wxT("wxWidgets multithreaded application sample\n")
|
||||
wxT("(c) 1998 Julian Smart, Guilhem Lavaux\n")
|
||||
wxT("(c) 2000 Robert Roebling\n")
|
||||
wxT("(c) 1999,2009 Vadim Zeitlin"),
|
||||
wxT("About wxThread sample"),
|
||||
"wxWidgets multithreaded application sample\n"
|
||||
"(c) 1998 Julian Smart, Guilhem Lavaux\n"
|
||||
"(c) 2000 Robert Roebling\n"
|
||||
"(c) 1999,2009 Vadim Zeitlin",
|
||||
"About wxThread sample",
|
||||
wxOK | wxICON_INFORMATION);
|
||||
|
||||
dialog.ShowModal();
|
||||
@ -752,14 +752,14 @@ void MyFrame::OnStartWorker(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
if ( thread->Create() != wxTHREAD_NO_ERROR )
|
||||
{
|
||||
wxLogError(wxT("Can't create thread!"));
|
||||
wxLogError("Can't create thread!");
|
||||
return;
|
||||
}
|
||||
|
||||
m_dlgProgress = new wxProgressDialog
|
||||
(
|
||||
wxT("Progress dialog"),
|
||||
wxT("Wait until the thread terminates or press [Cancel]"),
|
||||
"Progress dialog",
|
||||
"Wait until the thread terminates or press [Cancel]",
|
||||
100,
|
||||
this,
|
||||
wxPD_CAN_ABORT |
|
||||
@ -848,7 +848,7 @@ MyImageDialog::MyImageDialog(wxFrame *parent)
|
||||
if ( m_thread.Create() != wxTHREAD_NO_ERROR ||
|
||||
m_thread.Run() != wxTHREAD_NO_ERROR )
|
||||
{
|
||||
wxLogError(wxT("Can't create/run thread!"));
|
||||
wxLogError("Can't create/run thread!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class MyFrame: public wxFrame
|
||||
public:
|
||||
MyFrame(wxFrame *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& title = wxT("wxToolBar Sample"),
|
||||
const wxString& title = "wxToolBar Sample",
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE);
|
||||
@ -306,13 +306,13 @@ bool MyApp::OnInit()
|
||||
|
||||
// Create the main frame window
|
||||
MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY,
|
||||
wxT("wxToolBar Sample"),
|
||||
"wxToolBar Sample",
|
||||
wxPoint(100, 100), wxSize(650, 350));
|
||||
|
||||
frame->Show(true);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
frame->SetStatusText(wxT("Hello, wxWidgets"));
|
||||
frame->SetStatusText("Hello, wxWidgets");
|
||||
#endif
|
||||
|
||||
wxInitAllImageHandlers();
|
||||
@ -421,41 +421,41 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
|
||||
// size to fit the biggest icon used anyhow but it doesn't hurt neither
|
||||
toolBar->SetToolBitmapSize(wxSize(w, h));
|
||||
|
||||
toolBar->AddTool(wxID_NEW, wxT("New"),
|
||||
toolBar->AddTool(wxID_NEW, "New",
|
||||
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;
|
||||
menu->Append(wxID_ANY, wxT("&First dummy item"));
|
||||
menu->Append(wxID_ANY, wxT("&Second dummy item"));
|
||||
menu->Append(wxID_ANY, "&First dummy item");
|
||||
menu->Append(wxID_ANY, "&Second dummy item");
|
||||
menu->AppendSeparator();
|
||||
menu->Append(wxID_EXIT, wxT("Exit"));
|
||||
menu->Append(wxID_EXIT, "Exit");
|
||||
toolBar->SetDropdownMenu(wxID_NEW, menu);
|
||||
|
||||
toolBar->AddTool(wxID_OPEN, wxT("Open"),
|
||||
toolBar->AddTool(wxID_OPEN, "Open",
|
||||
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
|
||||
// adding a combo to a vertical toolbar is not very smart
|
||||
if ( !toolBar->IsVertical() )
|
||||
{
|
||||
wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, wxSize(100,-1) );
|
||||
combo->Append(wxT("This"));
|
||||
combo->Append(wxT("is a"));
|
||||
combo->Append(wxT("combobox"));
|
||||
combo->Append(wxT("in a"));
|
||||
combo->Append(wxT("toolbar"));
|
||||
toolBar->AddControl(combo, wxT("Combo Label"));
|
||||
combo->Append("This");
|
||||
combo->Append("is a");
|
||||
combo->Append("combobox");
|
||||
combo->Append("in a");
|
||||
combo->Append("toolbar");
|
||||
toolBar->AddControl(combo, "Combo Label");
|
||||
}
|
||||
#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->AddTool(wxID_COPY, wxT("Copy"), toolBarBitmaps[Tool_copy], wxT("Toggle button 2"), wxITEM_CHECK);
|
||||
toolBar->AddTool(wxID_CUT, wxT("Cut"), toolBarBitmaps[Tool_cut], wxT("Toggle/Untoggle help button"));
|
||||
toolBar->AddTool(wxID_PASTE, wxT("Paste"), toolBarBitmaps[Tool_paste], wxT("Paste"));
|
||||
toolBar->AddTool(wxID_COPY, "Copy", toolBarBitmaps[Tool_copy], "Toggle button 2", wxITEM_CHECK);
|
||||
toolBar->AddTool(wxID_CUT, "Cut", toolBarBitmaps[Tool_cut], "Toggle/Untoggle help button");
|
||||
toolBar->AddTool(wxID_PASTE, "Paste", toolBarBitmaps[Tool_paste], "Paste");
|
||||
toolBar->AddSeparator();
|
||||
|
||||
if ( m_useCustomDisabled )
|
||||
@ -471,13 +471,13 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
|
||||
dc.DrawLine(0, 0, w, h);
|
||||
}
|
||||
|
||||
toolBar->AddTool(wxID_PRINT, wxT("Print"), toolBarBitmaps[Tool_print],
|
||||
toolBar->AddTool(wxID_PRINT, "Print", toolBarBitmaps[Tool_print],
|
||||
bmpDisabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
toolBar->AddTool(wxID_PRINT, wxT("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."));
|
||||
toolBar->AddTool(wxID_PRINT, "Print", toolBarBitmaps[Tool_print],
|
||||
"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;
|
||||
@ -485,7 +485,7 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
|
||||
// add a stretchable space before the "Help" button to make it
|
||||
// right-aligned
|
||||
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() )
|
||||
{
|
||||
@ -497,7 +497,7 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar)
|
||||
img = img.GetSubImage(wxRect(0, 0, w, h));
|
||||
|
||||
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
|
||||
wxMenu *tbarMenu = new wxMenu;
|
||||
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_TOOLBAR,
|
||||
wxT("Toggle &toolbar\tCtrl-Z"),
|
||||
wxT("Show or hide the toolbar"));
|
||||
"Toggle &toolbar\tCtrl-Z",
|
||||
"Show or hide the toolbar");
|
||||
|
||||
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
|
||||
wxT("Toggle &another toolbar\tCtrl-A"),
|
||||
wxT("Show/hide another test toolbar"));
|
||||
"Toggle &another toolbar\tCtrl-A",
|
||||
"Show/hide another test toolbar");
|
||||
|
||||
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLE_HORIZONTAL_TEXT,
|
||||
wxT("Toggle hori&zontal text\tCtrl-H"),
|
||||
wxT("Show text under/alongside the icon"));
|
||||
"Toggle hori&zontal text\tCtrl-H",
|
||||
"Show text under/alongside the icon");
|
||||
|
||||
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARSIZE,
|
||||
wxT("&Toggle toolbar size\tCtrl-S"),
|
||||
wxT("Toggle between big/small toolbar"));
|
||||
"&Toggle toolbar size\tCtrl-S",
|
||||
"Toggle between big/small toolbar");
|
||||
|
||||
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLBARROWS,
|
||||
wxT("Toggle number of &rows\tCtrl-R"),
|
||||
wxT("Toggle number of toolbar rows between 1 and 2"));
|
||||
"Toggle number of &rows\tCtrl-R",
|
||||
"Toggle number of toolbar rows between 1 and 2");
|
||||
|
||||
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLETOOLTIPS,
|
||||
wxT("Show &tooltips\tCtrl-L"),
|
||||
wxT("Show tooltips for the toolbar tools"));
|
||||
"Show &tooltips\tCtrl-L",
|
||||
"Show tooltips for the toolbar tools");
|
||||
|
||||
tbarMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLECUSTOMDISABLED,
|
||||
wxT("Use c&ustom disabled images\tCtrl-U"),
|
||||
wxT("Switch between using system-generated and custom disabled images"));
|
||||
"Use c&ustom disabled images\tCtrl-U",
|
||||
"Switch between using system-generated and custom disabled images");
|
||||
|
||||
|
||||
tbarMenu->AppendSeparator();
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_TOP_ORIENTATION,
|
||||
wxT("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",
|
||||
"Set toolbar at the top of the window");
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_LEFT_ORIENTATION,
|
||||
wxT("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",
|
||||
"Set toolbar at the left of the window");
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_BOTTOM_ORIENTATION,
|
||||
wxT("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",
|
||||
"Set toolbar at the bottom of the window");
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_RIGHT_ORIENTATION,
|
||||
wxT("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",
|
||||
"Set toolbar at the right edge of the window");
|
||||
tbarMenu->AppendSeparator();
|
||||
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_TEXT, wxT("Show &text\tCtrl-Alt-T"));
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_ICONS, wxT("Show &icons\tCtrl-Alt-I"));
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, wxT("Show &both\tCtrl-Alt-B"));
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_TEXT, "Show &text\tCtrl-Alt-T");
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_ICONS, "Show &icons\tCtrl-Alt-I");
|
||||
tbarMenu->AppendRadioItem(IDM_TOOLBAR_SHOW_BOTH, "Show &both\tCtrl-Alt-B");
|
||||
tbarMenu->AppendSeparator();
|
||||
tbarMenu->Append(IDM_TOOLBAR_BG_COL, wxT("Choose bac&kground colour..."));
|
||||
tbarMenu->Append(IDM_TOOLBAR_CUSTOM_PATH, wxT("Custom &bitmap...\tCtrl-B"));
|
||||
tbarMenu->Append(IDM_TOOLBAR_BG_COL, "Choose bac&kground colour...");
|
||||
tbarMenu->Append(IDM_TOOLBAR_CUSTOM_PATH, "Custom &bitmap...\tCtrl-B");
|
||||
|
||||
wxMenu *toolMenu = new wxMenu;
|
||||
toolMenu->Append(IDM_TOOLBAR_ENABLEPRINT, wxT("&Enable print button\tCtrl-E"));
|
||||
toolMenu->Append(IDM_TOOLBAR_DELETEPRINT, wxT("&Delete print button\tCtrl-D"));
|
||||
toolMenu->Append(IDM_TOOLBAR_INSERTPRINT, wxT("&Insert print button\tCtrl-I"));
|
||||
toolMenu->Append(IDM_TOOLBAR_TOGGLEHELP, wxT("Toggle &help button\tCtrl-T"));
|
||||
toolMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLESEARCH, wxT("Toggle &search field\tCtrl-F"));
|
||||
toolMenu->Append(IDM_TOOLBAR_ENABLEPRINT, "&Enable print button\tCtrl-E");
|
||||
toolMenu->Append(IDM_TOOLBAR_DELETEPRINT, "&Delete print button\tCtrl-D");
|
||||
toolMenu->Append(IDM_TOOLBAR_INSERTPRINT, "&Insert print button\tCtrl-I");
|
||||
toolMenu->Append(IDM_TOOLBAR_TOGGLEHELP, "Toggle &help button\tCtrl-T");
|
||||
toolMenu->AppendCheckItem(IDM_TOOLBAR_TOGGLESEARCH, "Toggle &search field\tCtrl-F");
|
||||
toolMenu->AppendSeparator();
|
||||
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN1, wxT("Toggle &1st radio button\tCtrl-1"));
|
||||
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN2, wxT("Toggle &2nd radio button\tCtrl-2"));
|
||||
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN3, wxT("Toggle &3rd radio button\tCtrl-3"));
|
||||
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN1, "Toggle &1st radio button\tCtrl-1");
|
||||
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN2, "Toggle &2nd radio button\tCtrl-2");
|
||||
toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN3, "Toggle &3rd radio button\tCtrl-3");
|
||||
toolMenu->AppendSeparator();
|
||||
toolMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, wxT("Change tooltip of \"New\""));
|
||||
toolMenu->AppendSeparator();
|
||||
toolMenu->Append(IDM_TOOLBAR_INC_TOOL_SPACING, wxT("Increase spacing\tCtrl-+"));
|
||||
toolMenu->Append(IDM_TOOLBAR_DEC_TOOL_SPACING, wxT("Decrease spacing\tCtrl--"));
|
||||
toolMenu->Append(IDM_TOOLBAR_INC_TOOL_SPACING, "Increase spacing\tCtrl-+");
|
||||
toolMenu->Append(IDM_TOOLBAR_DEC_TOOL_SPACING, "Decrease spacing\tCtrl--");
|
||||
|
||||
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;
|
||||
helpMenu->Append(wxID_HELP, wxT("&About"), wxT("About toolbar sample"));
|
||||
helpMenu->Append(wxID_HELP, "&About", "About toolbar sample");
|
||||
|
||||
wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE );
|
||||
|
||||
menuBar->Append(fileMenu, wxT("&File"));
|
||||
menuBar->Append(tbarMenu, wxT("&Toolbar"));
|
||||
menuBar->Append(toolMenu, wxT("Tool&s"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
menuBar->Append(tbarMenu, "&Toolbar");
|
||||
menuBar->Append(toolMenu, "Tool&s");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -740,12 +740,12 @@ void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
m_tbar->SetMargins(4, 4);
|
||||
|
||||
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_1, wxT("First"), wxBITMAP(new));
|
||||
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_2, wxT("Second"), wxBITMAP(open));
|
||||
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_3, wxT("Third"), wxBITMAP(save));
|
||||
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_1, "First", wxBITMAP(new));
|
||||
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_2, "Second", wxBITMAP(open));
|
||||
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_3, "Third", wxBITMAP(save));
|
||||
m_tbar->AddSeparator();
|
||||
m_tbar->AddTool(wxID_HELP, wxT("Help"), wxBITMAP(help));
|
||||
m_tbar->AddTool(IDM_TOOLBAR_OTHER_4, wxT("Disabled"), wxBITMAP(cut), wxBITMAP(paste));
|
||||
m_tbar->AddTool(wxID_HELP, "Help", wxBITMAP(help));
|
||||
m_tbar->AddTool(IDM_TOOLBAR_OTHER_4, "Disabled", wxBITMAP(cut), wxBITMAP(paste));
|
||||
m_tbar->EnableTool(IDM_TOOLBAR_OTHER_4, false);
|
||||
|
||||
m_tbar->Realize();
|
||||
@ -815,17 +815,17 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& event)
|
||||
{
|
||||
if ( event.IsChecked() )
|
||||
m_textWindow->AppendText( wxT("Help button down now.\n") );
|
||||
m_textWindow->AppendText( "Help button down now.\n" );
|
||||
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)
|
||||
{
|
||||
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 );
|
||||
|
||||
if (event.GetId() == wxID_COPY)
|
||||
@ -847,13 +847,13 @@ void MyFrame::OnToolLeftClick(wxCommandEvent& event)
|
||||
void MyFrame::OnToolRightClick(wxCommandEvent& event)
|
||||
{
|
||||
m_textWindow->AppendText(
|
||||
wxString::Format(wxT("Tool %d right clicked.\n"),
|
||||
wxString::Format("Tool %d right clicked.\n",
|
||||
(int) event.GetInt()));
|
||||
}
|
||||
|
||||
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()
|
||||
@ -928,7 +928,7 @@ void MyFrame::OnUpdateToggleHorzText(wxUpdateUIEvent& 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))
|
||||
@ -992,11 +992,11 @@ void MyFrame::OnInsertPrint(wxCommandEvent& WXUNUSED(event))
|
||||
m_nPrint++;
|
||||
|
||||
wxToolBarBase *tb = GetToolBar();
|
||||
tb->InsertTool(0, wxID_PRINT, wxT("New print"),
|
||||
tb->InsertTool(0, wxID_PRINT, "New print",
|
||||
wxBITMAP(print), wxNullBitmap,
|
||||
wxITEM_NORMAL,
|
||||
wxT("Delete this tool"),
|
||||
wxT("This button was inserted into the toolbar"));
|
||||
"Delete this tool",
|
||||
"This button was inserted into the toolbar");
|
||||
|
||||
// must call Realize() after adding a new button
|
||||
tb->Realize();
|
||||
@ -1014,7 +1014,7 @@ void MyFrame::OnToggleRadioBtn(wxCommandEvent& event)
|
||||
void MyFrame::OnToolDropdown(wxCommandEvent& event)
|
||||
{
|
||||
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 );
|
||||
|
||||
event.Skip();
|
||||
|
@ -62,8 +62,8 @@ static const int NUM_LEVELS = 2;
|
||||
|
||||
// verify that the item is ok and insult the user if it is not
|
||||
#define CHECK_ITEM( item ) if ( !item.IsOk() ) { \
|
||||
wxMessageBox(wxT("Please select some item first!"), \
|
||||
wxT("Tree sample error"), \
|
||||
wxMessageBox("Please select some item first!", \
|
||||
"Tree sample error", \
|
||||
wxOK | wxICON_EXCLAMATION, \
|
||||
this); \
|
||||
return; \
|
||||
@ -196,7 +196,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// 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
|
||||
frame->Show(true);
|
||||
@ -229,84 +229,84 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
||||
*item_menu = new wxMenu;
|
||||
|
||||
#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();
|
||||
#endif // wxUSE_LOG
|
||||
file_menu->Append(TreeTest_About, wxT("&About"));
|
||||
file_menu->Append(TreeTest_About, "&About");
|
||||
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_TogTwist, wxT("Toggle &twister buttons"));
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleButtons, wxT("Toggle image &buttons"));
|
||||
style_menu->AppendCheckItem(TreeTest_TogButtons, "Toggle &normal buttons");
|
||||
style_menu->AppendCheckItem(TreeTest_TogTwist, "Toggle &twister buttons");
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleButtons, "Toggle image &buttons");
|
||||
style_menu->AppendSeparator();
|
||||
style_menu->AppendCheckItem(TreeTest_TogLines, wxT("Toggle &no lines"));
|
||||
style_menu->AppendCheckItem(TreeTest_TogRootLines, wxT("Toggle &lines at root"));
|
||||
style_menu->AppendCheckItem(TreeTest_TogHideRoot, wxT("Toggle &hidden root"));
|
||||
style_menu->AppendCheckItem(TreeTest_TogBorder, wxT("Toggle &item border"));
|
||||
style_menu->AppendCheckItem(TreeTest_TogFullHighlight, wxT("Toggle &full row highlight"));
|
||||
style_menu->AppendCheckItem(TreeTest_TogEdit, wxT("Toggle &edit mode"));
|
||||
style_menu->AppendCheckItem(TreeTest_TogLines, "Toggle &no lines");
|
||||
style_menu->AppendCheckItem(TreeTest_TogRootLines, "Toggle &lines at root");
|
||||
style_menu->AppendCheckItem(TreeTest_TogHideRoot, "Toggle &hidden root");
|
||||
style_menu->AppendCheckItem(TreeTest_TogBorder, "Toggle &item border");
|
||||
style_menu->AppendCheckItem(TreeTest_TogFullHighlight, "Toggle &full row highlight");
|
||||
style_menu->AppendCheckItem(TreeTest_TogEdit, "Toggle &edit mode");
|
||||
#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
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleImages, wxT("Toggle show ima&ges"));
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleStates, wxT("Toggle show st&ates"));
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleBell, wxT("Toggle &bell on no match"));
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleAlternateImages, wxT("Toggle alternate images"));
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleAlternateStates, wxT("Toggle alternate state images"));
|
||||
style_menu->Append(TreeTest_SetImageSize, wxT("Set image si&ze..."));
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleImages, "Toggle show ima&ges");
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleStates, "Toggle show st&ates");
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleBell, "Toggle &bell on no match");
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleAlternateImages, "Toggle alternate images");
|
||||
style_menu->AppendCheckItem(TreeTest_ToggleAlternateStates, "Toggle alternate state images");
|
||||
style_menu->Append(TreeTest_SetImageSize, "Set image si&ze...");
|
||||
style_menu->AppendSeparator();
|
||||
style_menu->Append(TreeTest_SetFgColour, wxT("Set &foreground colour..."));
|
||||
style_menu->Append(TreeTest_SetBgColour, wxT("Set &background colour..."));
|
||||
style_menu->Append(TreeTest_SetFgColour, "Set &foreground colour...");
|
||||
style_menu->Append(TreeTest_SetBgColour, "Set &background colour...");
|
||||
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_CollapseAndReset, wxT("C&ollapse and reset"));
|
||||
tree_menu->Append(TreeTest_Recreate, "&Recreate the tree");
|
||||
tree_menu->Append(TreeTest_CollapseAndReset, "C&ollapse and reset");
|
||||
tree_menu->AppendSeparator();
|
||||
tree_menu->Append(TreeTest_AddItem, wxT("Append a &new item"));
|
||||
tree_menu->Append(TreeTest_AddManyItems, wxT("Appends &many items"));
|
||||
tree_menu->Append(TreeTest_InsertItem, wxT("&Insert a new item"));
|
||||
tree_menu->Append(TreeTest_Delete, wxT("&Delete this item"));
|
||||
tree_menu->Append(TreeTest_DeleteChildren, wxT("Delete &children"));
|
||||
tree_menu->Append(TreeTest_DeleteAll, wxT("Delete &all items"));
|
||||
tree_menu->Append(TreeTest_SelectRoot, wxT("Select root item"));
|
||||
tree_menu->Append(TreeTest_AddItem, "Append a &new item");
|
||||
tree_menu->Append(TreeTest_AddManyItems, "Appends &many items");
|
||||
tree_menu->Append(TreeTest_InsertItem, "&Insert a new item");
|
||||
tree_menu->Append(TreeTest_Delete, "&Delete this item");
|
||||
tree_menu->Append(TreeTest_DeleteChildren, "Delete &children");
|
||||
tree_menu->Append(TreeTest_DeleteAll, "Delete &all items");
|
||||
tree_menu->Append(TreeTest_SelectRoot, "Select root item");
|
||||
tree_menu->AppendSeparator();
|
||||
tree_menu->Append(TreeTest_SetFocusedRoot, wxT("Set focus to root item"));
|
||||
tree_menu->Append(TreeTest_ClearFocused, wxT("Reset focus"));
|
||||
tree_menu->Append(TreeTest_SetFocusedRoot, "Set focus to root item");
|
||||
tree_menu->Append(TreeTest_ClearFocused, "Reset focus");
|
||||
|
||||
tree_menu->AppendSeparator();
|
||||
tree_menu->Append(TreeTest_Count, wxT("Count children of current item"));
|
||||
tree_menu->Append(TreeTest_CountRec, wxT("Recursively count children of current item"));
|
||||
tree_menu->Append(TreeTest_Count, "Count children of current item");
|
||||
tree_menu->Append(TreeTest_CountRec, "Recursively count children of current item");
|
||||
tree_menu->AppendSeparator();
|
||||
tree_menu->Append(TreeTest_Sort, wxT("Sort children of current item"));
|
||||
tree_menu->Append(TreeTest_SortRev, wxT("Sort in reversed order"));
|
||||
tree_menu->Append(TreeTest_Sort, "Sort children of current item");
|
||||
tree_menu->Append(TreeTest_SortRev, "Sort in reversed order");
|
||||
tree_menu->AppendSeparator();
|
||||
tree_menu->Append(TreeTest_EnsureVisible, wxT("Make the last item &visible"));
|
||||
tree_menu->Append(TreeTest_SetFocus, wxT("Set &focus to the tree"));
|
||||
tree_menu->Append(TreeTest_EnsureVisible, "Make the last item &visible");
|
||||
tree_menu->Append(TreeTest_SetFocus, "Set &focus to the tree");
|
||||
tree_menu->AppendSeparator();
|
||||
tree_menu->Append(TreeTest_IncIndent, wxT("Add 5 points to indentation\tAlt-I"));
|
||||
tree_menu->Append(TreeTest_DecIndent, wxT("Reduce indentation by 5 points\tAlt-R"));
|
||||
tree_menu->Append(TreeTest_IncIndent, "Add 5 points to indentation\tAlt-I");
|
||||
tree_menu->Append(TreeTest_DecIndent, "Reduce indentation by 5 points\tAlt-R");
|
||||
tree_menu->AppendSeparator();
|
||||
tree_menu->Append(TreeTest_IncSpacing, wxT("Add 5 points to spacing\tCtrl-I"));
|
||||
tree_menu->Append(TreeTest_DecSpacing, wxT("Reduce spacing by 5 points\tCtrl-R"));
|
||||
tree_menu->Append(TreeTest_IncSpacing, "Add 5 points to spacing\tCtrl-I");
|
||||
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_Rename, wxT("&Rename item..."));
|
||||
item_menu->Append(TreeTest_Dump, "&Dump item children");
|
||||
item_menu->Append(TreeTest_Rename, "&Rename item...");
|
||||
|
||||
item_menu->AppendSeparator();
|
||||
item_menu->Append(TreeTest_SetBold, wxT("Make item &bold"));
|
||||
item_menu->Append(TreeTest_ClearBold, wxT("Make item ¬ bold"));
|
||||
item_menu->Append(TreeTest_SetBold, "Make item &bold");
|
||||
item_menu->Append(TreeTest_ClearBold, "Make item ¬ bold");
|
||||
item_menu->AppendSeparator();
|
||||
item_menu->Append(TreeTest_ToggleIcon, wxT("Toggle the item's &icon"));
|
||||
item_menu->Append(TreeTest_ToggleState, wxT("Toggle the item's &state"));
|
||||
item_menu->Append(TreeTest_ToggleIcon, "Toggle the item's &icon");
|
||||
item_menu->Append(TreeTest_ToggleState, "Toggle the item's &state");
|
||||
item_menu->AppendSeparator();
|
||||
item_menu->Append(TreeTest_ShowFirstVisible, wxT("Show &first visible"));
|
||||
item_menu->Append(TreeTest_ShowFirstVisible, "Show &first 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
|
||||
item_menu->Append(TreeTest_ShowNextVisible, wxT("Show &next visible"));
|
||||
item_menu->Append(TreeTest_ShowPrevVisible, wxT("Show &previous visible"));
|
||||
item_menu->Append(TreeTest_ShowNextVisible, "Show &next visible");
|
||||
item_menu->Append(TreeTest_ShowPrevVisible, "Show &previous visible");
|
||||
item_menu->AppendSeparator();
|
||||
item_menu->Append(TreeTest_ShowParent, "Show pa&rent");
|
||||
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
|
||||
item_menu->AppendSeparator();
|
||||
item_menu->Append(TreeTest_DumpSelected, wxT("Dump selected items\tAlt-D"));
|
||||
item_menu->Append(TreeTest_Select, wxT("Select current item\tAlt-S"));
|
||||
item_menu->Append(TreeTest_Unselect, wxT("Unselect everything\tAlt-U"));
|
||||
item_menu->Append(TreeTest_SelectChildren, wxT("Select all children\tCtrl-A"));
|
||||
item_menu->Append(TreeTest_DumpSelected, "Dump selected items\tAlt-D");
|
||||
item_menu->Append(TreeTest_Select, "Select current item\tAlt-S");
|
||||
item_menu->Append(TreeTest_Unselect, "Unselect everything\tAlt-U");
|
||||
item_menu->Append(TreeTest_SelectChildren, "Select all children\tCtrl-A");
|
||||
#endif // NO_MULTIPLE_SELECTION
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(style_menu, wxT("&Style"));
|
||||
menu_bar->Append(tree_menu, wxT("&Tree"));
|
||||
menu_bar->Append(item_menu, wxT("&Item"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(style_menu, "&Style");
|
||||
menu_bar->Append(tree_menu, "&Tree");
|
||||
menu_bar->Append(item_menu, "&Item");
|
||||
SetMenuBar(menu_bar);
|
||||
#endif // wxUSE_MENUS
|
||||
|
||||
@ -337,7 +337,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
||||
|
||||
#if wxUSE_LOG
|
||||
// create the controls
|
||||
m_textCtrl = new wxTextCtrl(m_panel, wxID_ANY, wxT(""),
|
||||
m_textCtrl = new wxTextCtrl(m_panel, wxID_ANY, "",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE | wxSUNKEN_BORDER);
|
||||
|
||||
@ -433,13 +433,13 @@ void MyFrame::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
wxTreeItemId idLast = m_treeCtrl->GetLastTreeITem();
|
||||
status = wxString::Format(
|
||||
wxT("Root/last item is %svisible/%svisible"),
|
||||
m_treeCtrl->IsVisible(idRoot) ? wxT("") : wxT("not "),
|
||||
"Root/last item is %svisible/%svisible",
|
||||
m_treeCtrl->IsVisible(idRoot) ? "" : "not ",
|
||||
idLast.IsOk() && m_treeCtrl->IsVisible(idLast)
|
||||
? wxT("") : wxT("not "));
|
||||
? "" : "not ");
|
||||
}
|
||||
else
|
||||
status = wxT("No root item");
|
||||
status = "No root item";
|
||||
|
||||
SetStatusText(status, 1);
|
||||
}
|
||||
@ -480,9 +480,9 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("Tree test sample\n")
|
||||
wxT("(c) Julian Smart 1997, Vadim Zeitlin 1998"),
|
||||
wxT("About tree test"),
|
||||
wxMessageBox("Tree test sample\n"
|
||||
"(c) Julian Smart 1997, Vadim Zeitlin 1998",
|
||||
"About tree test",
|
||||
wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ void MyFrame::OnRename(wxCommandEvent& WXUNUSED(event))
|
||||
// old code - now we edit in place
|
||||
#if 0
|
||||
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);
|
||||
if ( !s_text.empty() )
|
||||
{
|
||||
@ -520,7 +520,7 @@ void MyFrame::OnCount(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
int i = m_treeCtrl->GetChildrenCount( item, false );
|
||||
|
||||
wxLogMessage(wxT("%d children"), i);
|
||||
wxLogMessage("%d children", i);
|
||||
}
|
||||
|
||||
void MyFrame::OnCountRec(wxCommandEvent& WXUNUSED(event))
|
||||
@ -531,7 +531,7 @@ void MyFrame::OnCountRec(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
int i = m_treeCtrl->GetChildrenCount( item );
|
||||
|
||||
wxLogMessage(wxT("%d children"), i);
|
||||
wxLogMessage("%d children", i);
|
||||
}
|
||||
|
||||
void MyFrame::DoSort(bool reverse)
|
||||
@ -552,7 +552,7 @@ void MyFrame::OnHighlight(wxCommandEvent& WXUNUSED(event))
|
||||
wxRect r;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -584,11 +584,11 @@ void MyFrame::OnDumpSelected(wxCommandEvent& WXUNUSED(event))
|
||||
wxArrayTreeItemIds 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++ )
|
||||
{
|
||||
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))
|
||||
{
|
||||
int size = wxGetNumberFromUser(wxT("Enter the size for the images to use"),
|
||||
wxT("Size: "),
|
||||
wxT("TreeCtrl sample"),
|
||||
int size = wxGetNumberFromUser("Enter the size for the images to use",
|
||||
"Size: ",
|
||||
"TreeCtrl sample",
|
||||
m_treeCtrl->ImageSize());
|
||||
if ( size == -1 )
|
||||
return;
|
||||
@ -776,7 +776,7 @@ void MyFrame::OnSetFocus(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnInsertItem(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
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))
|
||||
@ -784,7 +784,7 @@ void MyFrame::OnAddItem(wxCommandEvent& WXUNUSED(event))
|
||||
static int s_num = 0;
|
||||
|
||||
wxString text;
|
||||
text.Printf(wxT("Item #%d"), ++s_num);
|
||||
text.Printf("Item #%d", ++s_num);
|
||||
|
||||
m_treeCtrl->AppendItem(m_treeCtrl->GetRootItem(),
|
||||
text /*,
|
||||
@ -1136,9 +1136,9 @@ void MyTreeCtrl::AddItemsRecursively(const wxTreeItemId& idParent,
|
||||
{
|
||||
// at depth 1 elements won't have any more children
|
||||
if ( hasChildren )
|
||||
str.Printf(wxT("%s child %u"), wxT("Folder"), unsigned(n + 1));
|
||||
str.Printf("%s child %u", "Folder", unsigned(n + 1));
|
||||
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
|
||||
// suppose that selected image follows the normal one in the enum)
|
||||
@ -1175,9 +1175,9 @@ void MyTreeCtrl::AddTestItemsToTree(size_t numChildren,
|
||||
size_t depth)
|
||||
{
|
||||
int image = wxGetApp().ShowImages() ? MyTreeCtrl::TreeCtrlIcon_Folder : -1;
|
||||
wxTreeItemId rootId = AddRoot(wxT("Root"),
|
||||
wxTreeItemId rootId = AddRoot("Root",
|
||||
image, image,
|
||||
new MyTreeItemData(wxT("Root item")));
|
||||
new MyTreeItemData("Root item"));
|
||||
if ( !HasFlag(wxTR_HIDE_ROOT) && image != -1 )
|
||||
{
|
||||
SetItemImage(rootId, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded);
|
||||
@ -1305,8 +1305,8 @@ void MyTreeCtrl::LogEvent(const wxChar *name, const wxTreeEvent& event)
|
||||
if ( item.IsOk() )
|
||||
text << wxT('"') << GetItemText(item).c_str() << wxT('"');
|
||||
else
|
||||
text = wxT("invalid item");
|
||||
wxLogMessage(wxT("%s(%s)"), name, text.c_str());
|
||||
text = "invalid item";
|
||||
wxLogMessage("%s(%s)", name, text.c_str());
|
||||
}
|
||||
|
||||
// avoid repetition
|
||||
@ -1329,153 +1329,153 @@ TREE_EVENT_HANDLER(OnSelChanging)
|
||||
|
||||
#undef TREE_EVENT_HANDLER
|
||||
|
||||
void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
|
||||
void LogKeyEvent(const wxString& name, const wxKeyEvent& event)
|
||||
{
|
||||
wxString key;
|
||||
long keycode = event.GetKeyCode();
|
||||
{
|
||||
switch ( keycode )
|
||||
{
|
||||
case WXK_BACK: key = wxT("BACK"); break;
|
||||
case WXK_TAB: key = wxT("TAB"); break;
|
||||
case WXK_RETURN: key = wxT("RETURN"); break;
|
||||
case WXK_ESCAPE: key = wxT("ESCAPE"); break;
|
||||
case WXK_SPACE: key = wxT("SPACE"); break;
|
||||
case WXK_DELETE: key = wxT("DELETE"); break;
|
||||
case WXK_START: key = wxT("START"); break;
|
||||
case WXK_LBUTTON: key = wxT("LBUTTON"); break;
|
||||
case WXK_RBUTTON: key = wxT("RBUTTON"); break;
|
||||
case WXK_CANCEL: key = wxT("CANCEL"); break;
|
||||
case WXK_MBUTTON: key = wxT("MBUTTON"); break;
|
||||
case WXK_CLEAR: key = wxT("CLEAR"); break;
|
||||
case WXK_SHIFT: key = wxT("SHIFT"); break;
|
||||
case WXK_ALT: key = wxT("ALT"); break;
|
||||
case WXK_CONTROL: key = wxT("CONTROL"); break;
|
||||
case WXK_MENU: key = wxT("MENU"); break;
|
||||
case WXK_PAUSE: key = wxT("PAUSE"); break;
|
||||
case WXK_CAPITAL: key = wxT("CAPITAL"); break;
|
||||
case WXK_END: key = wxT("END"); break;
|
||||
case WXK_HOME: key = wxT("HOME"); break;
|
||||
case WXK_LEFT: key = wxT("LEFT"); break;
|
||||
case WXK_UP: key = wxT("UP"); break;
|
||||
case WXK_RIGHT: key = wxT("RIGHT"); break;
|
||||
case WXK_DOWN: key = wxT("DOWN"); break;
|
||||
case WXK_SELECT: key = wxT("SELECT"); break;
|
||||
case WXK_PRINT: key = wxT("PRINT"); break;
|
||||
case WXK_EXECUTE: key = wxT("EXECUTE"); break;
|
||||
case WXK_SNAPSHOT: key = wxT("SNAPSHOT"); break;
|
||||
case WXK_INSERT: key = wxT("INSERT"); break;
|
||||
case WXK_HELP: key = wxT("HELP"); break;
|
||||
case WXK_NUMPAD0: key = wxT("NUMPAD0"); break;
|
||||
case WXK_NUMPAD1: key = wxT("NUMPAD1"); break;
|
||||
case WXK_NUMPAD2: key = wxT("NUMPAD2"); break;
|
||||
case WXK_NUMPAD3: key = wxT("NUMPAD3"); break;
|
||||
case WXK_NUMPAD4: key = wxT("NUMPAD4"); break;
|
||||
case WXK_NUMPAD5: key = wxT("NUMPAD5"); break;
|
||||
case WXK_NUMPAD6: key = wxT("NUMPAD6"); break;
|
||||
case WXK_NUMPAD7: key = wxT("NUMPAD7"); break;
|
||||
case WXK_NUMPAD8: key = wxT("NUMPAD8"); break;
|
||||
case WXK_NUMPAD9: key = wxT("NUMPAD9"); break;
|
||||
case WXK_MULTIPLY: key = wxT("MULTIPLY"); break;
|
||||
case WXK_ADD: key = wxT("ADD"); break;
|
||||
case WXK_SEPARATOR: key = wxT("SEPARATOR"); break;
|
||||
case WXK_SUBTRACT: key = wxT("SUBTRACT"); break;
|
||||
case WXK_DECIMAL: key = wxT("DECIMAL"); break;
|
||||
case WXK_DIVIDE: key = wxT("DIVIDE"); break;
|
||||
case WXK_F1: key = wxT("F1"); break;
|
||||
case WXK_F2: key = wxT("F2"); break;
|
||||
case WXK_F3: key = wxT("F3"); break;
|
||||
case WXK_F4: key = wxT("F4"); break;
|
||||
case WXK_F5: key = wxT("F5"); break;
|
||||
case WXK_F6: key = wxT("F6"); break;
|
||||
case WXK_F7: key = wxT("F7"); break;
|
||||
case WXK_F8: key = wxT("F8"); break;
|
||||
case WXK_F9: key = wxT("F9"); break;
|
||||
case WXK_F10: key = wxT("F10"); break;
|
||||
case WXK_F11: key = wxT("F11"); break;
|
||||
case WXK_F12: key = wxT("F12"); break;
|
||||
case WXK_F13: key = wxT("F13"); break;
|
||||
case WXK_F14: key = wxT("F14"); break;
|
||||
case WXK_F15: key = wxT("F15"); break;
|
||||
case WXK_F16: key = wxT("F16"); break;
|
||||
case WXK_F17: key = wxT("F17"); break;
|
||||
case WXK_F18: key = wxT("F18"); break;
|
||||
case WXK_F19: key = wxT("F19"); break;
|
||||
case WXK_F20: key = wxT("F20"); break;
|
||||
case WXK_F21: key = wxT("F21"); break;
|
||||
case WXK_F22: key = wxT("F22"); break;
|
||||
case WXK_F23: key = wxT("F23"); break;
|
||||
case WXK_F24: key = wxT("F24"); break;
|
||||
case WXK_NUMLOCK: key = wxT("NUMLOCK"); break;
|
||||
case WXK_SCROLL: key = wxT("SCROLL"); break;
|
||||
case WXK_PAGEUP: key = wxT("PAGEUP"); break;
|
||||
case WXK_PAGEDOWN: key = wxT("PAGEDOWN"); break;
|
||||
case WXK_NUMPAD_SPACE: key = wxT("NUMPAD_SPACE"); break;
|
||||
case WXK_NUMPAD_TAB: key = wxT("NUMPAD_TAB"); break;
|
||||
case WXK_NUMPAD_ENTER: key = wxT("NUMPAD_ENTER"); break;
|
||||
case WXK_NUMPAD_F1: key = wxT("NUMPAD_F1"); break;
|
||||
case WXK_NUMPAD_F2: key = wxT("NUMPAD_F2"); break;
|
||||
case WXK_NUMPAD_F3: key = wxT("NUMPAD_F3"); break;
|
||||
case WXK_NUMPAD_F4: key = wxT("NUMPAD_F4"); break;
|
||||
case WXK_NUMPAD_HOME: key = wxT("NUMPAD_HOME"); break;
|
||||
case WXK_NUMPAD_LEFT: key = wxT("NUMPAD_LEFT"); break;
|
||||
case WXK_NUMPAD_UP: key = wxT("NUMPAD_UP"); break;
|
||||
case WXK_NUMPAD_RIGHT: key = wxT("NUMPAD_RIGHT"); break;
|
||||
case WXK_NUMPAD_DOWN: key = wxT("NUMPAD_DOWN"); break;
|
||||
case WXK_NUMPAD_PAGEUP: key = wxT("NUMPAD_PAGEUP"); break;
|
||||
case WXK_NUMPAD_PAGEDOWN: key = wxT("NUMPAD_PAGEDOWN"); break;
|
||||
case WXK_NUMPAD_END: key = wxT("NUMPAD_END"); break;
|
||||
case WXK_NUMPAD_BEGIN: key = wxT("NUMPAD_BEGIN"); break;
|
||||
case WXK_NUMPAD_INSERT: key = wxT("NUMPAD_INSERT"); break;
|
||||
case WXK_NUMPAD_DELETE: key = wxT("NUMPAD_DELETE"); break;
|
||||
case WXK_NUMPAD_EQUAL: key = wxT("NUMPAD_EQUAL"); break;
|
||||
case WXK_NUMPAD_MULTIPLY: key = wxT("NUMPAD_MULTIPLY"); break;
|
||||
case WXK_NUMPAD_ADD: key = wxT("NUMPAD_ADD"); break;
|
||||
case WXK_NUMPAD_SEPARATOR: key = wxT("NUMPAD_SEPARATOR"); break;
|
||||
case WXK_NUMPAD_SUBTRACT: key = wxT("NUMPAD_SUBTRACT"); break;
|
||||
case WXK_NUMPAD_DECIMAL: key = wxT("NUMPAD_DECIMAL"); break;
|
||||
case WXK_BROWSER_BACK: key = wxT("BROWSER_BACK"); break;
|
||||
case WXK_BROWSER_FORWARD: key = wxT("BROWSER_FORWARD"); break;
|
||||
case WXK_BROWSER_REFRESH: key = wxT("BROWSER_REFRESH"); break;
|
||||
case WXK_BROWSER_STOP: key = wxT("BROWSER_STOP"); break;
|
||||
case WXK_BROWSER_SEARCH: key = wxT("BROWSER_SEARCH"); break;
|
||||
case WXK_BROWSER_FAVORITES: key = wxT("BROWSER_FAVORITES"); break;
|
||||
case WXK_BROWSER_HOME: key = wxT("BROWSER_HOME"); break;
|
||||
case WXK_VOLUME_MUTE: key = wxT("VOLUME_MUTE"); break;
|
||||
case WXK_VOLUME_DOWN: key = wxT("VOLUME_DOWN"); break;
|
||||
case WXK_VOLUME_UP: key = wxT("VOLUME_UP"); break;
|
||||
case WXK_MEDIA_NEXT_TRACK: key = wxT("MEDIA_NEXT_TRACK"); break;
|
||||
case WXK_MEDIA_PREV_TRACK: key = wxT("MEDIA_PREV_TRACK"); break;
|
||||
case WXK_MEDIA_STOP: key = wxT("MEDIA_STOP"); break;
|
||||
case WXK_MEDIA_PLAY_PAUSE: key = wxT("MEDIA_PLAY_PAUSE"); break;
|
||||
case WXK_LAUNCH_MAIL: key = wxT("LAUNCH_MAIL"); break;
|
||||
case WXK_LAUNCH_APP1: key = wxT("LAUNCH_APP1"); break;
|
||||
case WXK_LAUNCH_APP2: key = wxT("LAUNCH_APP2"); break;
|
||||
case WXK_BACK: key = "BACK"; break;
|
||||
case WXK_TAB: key = "TAB"; break;
|
||||
case WXK_RETURN: key = "RETURN"; break;
|
||||
case WXK_ESCAPE: key = "ESCAPE"; break;
|
||||
case WXK_SPACE: key = "SPACE"; break;
|
||||
case WXK_DELETE: key = "DELETE"; break;
|
||||
case WXK_START: key = "START"; break;
|
||||
case WXK_LBUTTON: key = "LBUTTON"; break;
|
||||
case WXK_RBUTTON: key = "RBUTTON"; break;
|
||||
case WXK_CANCEL: key = "CANCEL"; break;
|
||||
case WXK_MBUTTON: key = "MBUTTON"; break;
|
||||
case WXK_CLEAR: key = "CLEAR"; break;
|
||||
case WXK_SHIFT: key = "SHIFT"; break;
|
||||
case WXK_ALT: key = "ALT"; break;
|
||||
case WXK_CONTROL: key = "CONTROL"; break;
|
||||
case WXK_MENU: key = "MENU"; break;
|
||||
case WXK_PAUSE: key = "PAUSE"; break;
|
||||
case WXK_CAPITAL: key = "CAPITAL"; break;
|
||||
case WXK_END: key = "END"; break;
|
||||
case WXK_HOME: key = "HOME"; break;
|
||||
case WXK_LEFT: key = "LEFT"; break;
|
||||
case WXK_UP: key = "UP"; break;
|
||||
case WXK_RIGHT: key = "RIGHT"; break;
|
||||
case WXK_DOWN: key = "DOWN"; break;
|
||||
case WXK_SELECT: key = "SELECT"; break;
|
||||
case WXK_PRINT: key = "PRINT"; break;
|
||||
case WXK_EXECUTE: key = "EXECUTE"; break;
|
||||
case WXK_SNAPSHOT: key = "SNAPSHOT"; break;
|
||||
case WXK_INSERT: key = "INSERT"; break;
|
||||
case WXK_HELP: key = "HELP"; break;
|
||||
case WXK_NUMPAD0: key = "NUMPAD0"; break;
|
||||
case WXK_NUMPAD1: key = "NUMPAD1"; break;
|
||||
case WXK_NUMPAD2: key = "NUMPAD2"; break;
|
||||
case WXK_NUMPAD3: key = "NUMPAD3"; break;
|
||||
case WXK_NUMPAD4: key = "NUMPAD4"; break;
|
||||
case WXK_NUMPAD5: key = "NUMPAD5"; break;
|
||||
case WXK_NUMPAD6: key = "NUMPAD6"; break;
|
||||
case WXK_NUMPAD7: key = "NUMPAD7"; break;
|
||||
case WXK_NUMPAD8: key = "NUMPAD8"; break;
|
||||
case WXK_NUMPAD9: key = "NUMPAD9"; break;
|
||||
case WXK_MULTIPLY: key = "MULTIPLY"; break;
|
||||
case WXK_ADD: key = "ADD"; break;
|
||||
case WXK_SEPARATOR: key = "SEPARATOR"; break;
|
||||
case WXK_SUBTRACT: key = "SUBTRACT"; break;
|
||||
case WXK_DECIMAL: key = "DECIMAL"; break;
|
||||
case WXK_DIVIDE: key = "DIVIDE"; break;
|
||||
case WXK_F1: key = "F1"; break;
|
||||
case WXK_F2: key = "F2"; break;
|
||||
case WXK_F3: key = "F3"; break;
|
||||
case WXK_F4: key = "F4"; break;
|
||||
case WXK_F5: key = "F5"; break;
|
||||
case WXK_F6: key = "F6"; break;
|
||||
case WXK_F7: key = "F7"; break;
|
||||
case WXK_F8: key = "F8"; break;
|
||||
case WXK_F9: key = "F9"; break;
|
||||
case WXK_F10: key = "F10"; break;
|
||||
case WXK_F11: key = "F11"; break;
|
||||
case WXK_F12: key = "F12"; break;
|
||||
case WXK_F13: key = "F13"; break;
|
||||
case WXK_F14: key = "F14"; break;
|
||||
case WXK_F15: key = "F15"; break;
|
||||
case WXK_F16: key = "F16"; break;
|
||||
case WXK_F17: key = "F17"; break;
|
||||
case WXK_F18: key = "F18"; break;
|
||||
case WXK_F19: key = "F19"; break;
|
||||
case WXK_F20: key = "F20"; break;
|
||||
case WXK_F21: key = "F21"; break;
|
||||
case WXK_F22: key = "F22"; break;
|
||||
case WXK_F23: key = "F23"; break;
|
||||
case WXK_F24: key = "F24"; break;
|
||||
case WXK_NUMLOCK: key = "NUMLOCK"; break;
|
||||
case WXK_SCROLL: key = "SCROLL"; break;
|
||||
case WXK_PAGEUP: key = "PAGEUP"; break;
|
||||
case WXK_PAGEDOWN: key = "PAGEDOWN"; break;
|
||||
case WXK_NUMPAD_SPACE: key = "NUMPAD_SPACE"; break;
|
||||
case WXK_NUMPAD_TAB: key = "NUMPAD_TAB"; break;
|
||||
case WXK_NUMPAD_ENTER: key = "NUMPAD_ENTER"; break;
|
||||
case WXK_NUMPAD_F1: key = "NUMPAD_F1"; break;
|
||||
case WXK_NUMPAD_F2: key = "NUMPAD_F2"; break;
|
||||
case WXK_NUMPAD_F3: key = "NUMPAD_F3"; break;
|
||||
case WXK_NUMPAD_F4: key = "NUMPAD_F4"; break;
|
||||
case WXK_NUMPAD_HOME: key = "NUMPAD_HOME"; break;
|
||||
case WXK_NUMPAD_LEFT: key = "NUMPAD_LEFT"; break;
|
||||
case WXK_NUMPAD_UP: key = "NUMPAD_UP"; break;
|
||||
case WXK_NUMPAD_RIGHT: key = "NUMPAD_RIGHT"; break;
|
||||
case WXK_NUMPAD_DOWN: key = "NUMPAD_DOWN"; break;
|
||||
case WXK_NUMPAD_PAGEUP: key = "NUMPAD_PAGEUP"; break;
|
||||
case WXK_NUMPAD_PAGEDOWN: key = "NUMPAD_PAGEDOWN"; break;
|
||||
case WXK_NUMPAD_END: key = "NUMPAD_END"; break;
|
||||
case WXK_NUMPAD_BEGIN: key = "NUMPAD_BEGIN"; break;
|
||||
case WXK_NUMPAD_INSERT: key = "NUMPAD_INSERT"; break;
|
||||
case WXK_NUMPAD_DELETE: key = "NUMPAD_DELETE"; break;
|
||||
case WXK_NUMPAD_EQUAL: key = "NUMPAD_EQUAL"; break;
|
||||
case WXK_NUMPAD_MULTIPLY: key = "NUMPAD_MULTIPLY"; break;
|
||||
case WXK_NUMPAD_ADD: key = "NUMPAD_ADD"; break;
|
||||
case WXK_NUMPAD_SEPARATOR: key = "NUMPAD_SEPARATOR"; break;
|
||||
case WXK_NUMPAD_SUBTRACT: key = "NUMPAD_SUBTRACT"; break;
|
||||
case WXK_NUMPAD_DECIMAL: key = "NUMPAD_DECIMAL"; break;
|
||||
case WXK_BROWSER_BACK: key = "BROWSER_BACK"; break;
|
||||
case WXK_BROWSER_FORWARD: key = "BROWSER_FORWARD"; break;
|
||||
case WXK_BROWSER_REFRESH: key = "BROWSER_REFRESH"; break;
|
||||
case WXK_BROWSER_STOP: key = "BROWSER_STOP"; break;
|
||||
case WXK_BROWSER_SEARCH: key = "BROWSER_SEARCH"; break;
|
||||
case WXK_BROWSER_FAVORITES: key = "BROWSER_FAVORITES"; break;
|
||||
case WXK_BROWSER_HOME: key = "BROWSER_HOME"; break;
|
||||
case WXK_VOLUME_MUTE: key = "VOLUME_MUTE"; break;
|
||||
case WXK_VOLUME_DOWN: key = "VOLUME_DOWN"; break;
|
||||
case WXK_VOLUME_UP: key = "VOLUME_UP"; break;
|
||||
case WXK_MEDIA_NEXT_TRACK: key = "MEDIA_NEXT_TRACK"; break;
|
||||
case WXK_MEDIA_PREV_TRACK: key = "MEDIA_PREV_TRACK"; break;
|
||||
case WXK_MEDIA_STOP: key = "MEDIA_STOP"; break;
|
||||
case WXK_MEDIA_PLAY_PAUSE: key = "MEDIA_PLAY_PAUSE"; break;
|
||||
case WXK_LAUNCH_MAIL: key = "LAUNCH_MAIL"; break;
|
||||
case WXK_LAUNCH_APP1: key = "LAUNCH_APP1"; break;
|
||||
case WXK_LAUNCH_APP2: key = "LAUNCH_APP2"; break;
|
||||
|
||||
default:
|
||||
{
|
||||
if ( keycode < 128 && wxIsprint((int)keycode) )
|
||||
key.Printf(wxT("'%c'"), (char)keycode);
|
||||
key.Printf("'%c'", (char)keycode);
|
||||
else if ( keycode > 0 && keycode < 27 )
|
||||
key.Printf(_("Ctrl-%c"), wxT('A') + keycode - 1);
|
||||
key.Printf("Ctrl-%c", 'A' + keycode - 1);
|
||||
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,
|
||||
key.c_str(),
|
||||
event.ControlDown() ? wxT('C') : wxT('-'),
|
||||
event.AltDown() ? wxT('A') : wxT('-'),
|
||||
event.ShiftDown() ? wxT('S') : wxT('-'),
|
||||
event.MetaDown() ? wxT('M') : wxT('-'));
|
||||
event.ControlDown() ? 'C' : '-',
|
||||
event.AltDown() ? 'A' : '-',
|
||||
event.ShiftDown() ? 'S' : '-',
|
||||
event.MetaDown() ? 'M' : '-');
|
||||
}
|
||||
|
||||
void MyTreeCtrl::OnTreeKeyDown(wxTreeEvent& event)
|
||||
{
|
||||
LogKeyEvent(wxT("Tree key down "), event.GetKeyEvent());
|
||||
LogKeyEvent("Tree key down ", event.GetKeyEvent());
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
@ -1490,7 +1490,7 @@ void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event)
|
||||
wxPoint clientpt = event.GetPoint();
|
||||
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(),
|
||||
screenpt.x, screenpt.y);
|
||||
|
||||
@ -1498,7 +1498,7 @@ void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event)
|
||||
}
|
||||
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() )
|
||||
{
|
||||
wxLogMessage(wxT("OnEndDrag: can't drop here."));
|
||||
wxLogMessage("OnEndDrag: can't drop here.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
wxString text = GetItemText(itemSrc);
|
||||
wxLogMessage(wxT("OnEndDrag: '%s' copied to '%s'."),
|
||||
wxLogMessage("OnEndDrag: '%s' copied to '%s'.",
|
||||
text.c_str(), GetItemText(itemDst).c_str());
|
||||
|
||||
// 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)
|
||||
{
|
||||
wxLogMessage(wxT("OnBeginLabelEdit"));
|
||||
wxLogMessage("OnBeginLabelEdit");
|
||||
|
||||
// for testing, prevent this item's label editing
|
||||
wxTreeItemId itemId = event.GetItem();
|
||||
if ( IsTestItem(itemId) )
|
||||
{
|
||||
wxMessageBox(wxT("You can't edit this item."));
|
||||
wxMessageBox("You can't edit this item.");
|
||||
|
||||
event.Veto();
|
||||
}
|
||||
else if ( itemId == GetRootItem() )
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
wxLogMessage(wxT("OnEndLabelEdit"));
|
||||
wxLogMessage("OnEndLabelEdit");
|
||||
|
||||
// don't allow anything except letters in the labels
|
||||
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();
|
||||
}
|
||||
@ -1574,13 +1574,13 @@ void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event)
|
||||
|
||||
void MyTreeCtrl::OnItemCollapsing(wxTreeEvent& event)
|
||||
{
|
||||
wxLogMessage(wxT("OnItemCollapsing"));
|
||||
wxLogMessage("OnItemCollapsing");
|
||||
|
||||
// for testing, prevent the user from collapsing the first child folder
|
||||
wxTreeItemId itemId = event.GetItem();
|
||||
if ( IsTestItem(itemId) )
|
||||
{
|
||||
wxMessageBox(wxT("You can't collapse this item."));
|
||||
wxMessageBox("You can't collapse this item.");
|
||||
|
||||
event.Veto();
|
||||
}
|
||||
@ -1597,7 +1597,7 @@ void MyTreeCtrl::OnItemActivated(wxTreeEvent& event)
|
||||
item->ShowInfo(this);
|
||||
}
|
||||
|
||||
wxLogMessage(wxT("OnItemActivated"));
|
||||
wxLogMessage("OnItemActivated");
|
||||
}
|
||||
|
||||
void MyTreeCtrl::OnItemStateClick(wxTreeEvent& event)
|
||||
@ -1630,7 +1630,7 @@ void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event)
|
||||
{
|
||||
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();
|
||||
}
|
||||
@ -1640,19 +1640,19 @@ void MyTreeCtrl::ShowMenu(wxTreeItemId id, const wxPoint& pt)
|
||||
wxString title;
|
||||
if ( id.IsOk() )
|
||||
{
|
||||
title << wxT("Menu for ") << GetItemText(id);
|
||||
title << "Menu for " << GetItemText(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
title = wxT("Menu for no particular item");
|
||||
title = "Menu for no particular item";
|
||||
}
|
||||
|
||||
#if wxUSE_MENUS
|
||||
wxMenu menu(title);
|
||||
menu.Append(TreeTest_About, wxT("&About"));
|
||||
menu.Append(TreeTest_About, "&About");
|
||||
menu.AppendSeparator();
|
||||
menu.Append(TreeTest_Highlight, wxT("&Highlight item"));
|
||||
menu.Append(TreeTest_Dump, wxT("&Dump"));
|
||||
menu.Append(TreeTest_Highlight, "&Highlight item");
|
||||
menu.Append(TreeTest_Dump, "&Dump");
|
||||
|
||||
PopupMenu(&menu, pt);
|
||||
#endif // wxUSE_MENUS
|
||||
@ -1672,14 +1672,14 @@ void MyTreeCtrl::OnItemRClick(wxTreeEvent& event)
|
||||
|
||||
void MyTreeCtrl::OnRMouseDown(wxMouseEvent& event)
|
||||
{
|
||||
wxLogMessage(wxT("Right mouse button down"));
|
||||
wxLogMessage("Right mouse button down");
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void MyTreeCtrl::OnRMouseUp(wxMouseEvent& event)
|
||||
{
|
||||
wxLogMessage(wxT("Right mouse button up"));
|
||||
wxLogMessage("Right mouse button up");
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
@ -1689,29 +1689,29 @@ void MyTreeCtrl::OnRMouseDClick(wxMouseEvent& event)
|
||||
wxTreeItemId id = HitTest(event.GetPosition());
|
||||
if ( !id )
|
||||
{
|
||||
wxLogMessage(wxT("No item under mouse"));
|
||||
wxLogMessage("No item under mouse");
|
||||
}
|
||||
else
|
||||
{
|
||||
MyTreeItemData *item = (MyTreeItemData *)GetItemData(id);
|
||||
if ( item )
|
||||
{
|
||||
wxLogMessage(wxT("Item '%s' under mouse"), item->GetDesc());
|
||||
wxLogMessage("Item '%s' under mouse", item->GetDesc());
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
wxLogMessage(wxT("Item '%s': %sselected, %sexpanded, %sbold,\n")
|
||||
wxT("%u children (%u immediately under this item)."),
|
||||
wxLogMessage("Item '%s': %sselected, %sexpanded, %sbold,\n"
|
||||
"%u children (%u immediately under this item).",
|
||||
m_desc.c_str(),
|
||||
Bool2String(tree->IsSelected(GetId())),
|
||||
Bool2String(tree->IsExpanded(GetId())),
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -43,13 +43,13 @@
|
||||
MyData g_data;
|
||||
|
||||
wxString g_listbox_choices[] =
|
||||
{wxT("one"), wxT("two"), wxT("three")};
|
||||
{"one", "two", "three"};
|
||||
|
||||
wxString g_combobox_choices[] =
|
||||
{wxT("yes"), wxT("no (doesn't validate)"), wxT("maybe (doesn't validate)")};
|
||||
{"yes", "no (doesn't validate)", "maybe (doesn't validate)"};
|
||||
|
||||
wxString g_radiobox_choices[] =
|
||||
{wxT("green"), wxT("yellow"), wxT("red")};
|
||||
{"green", "yellow", "red"};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MyData
|
||||
@ -60,7 +60,7 @@ MyData::MyData()
|
||||
// This string will be passed to an alpha-only validator, which
|
||||
// will complain because spaces aren't alpha. Note that validation
|
||||
// is performed only when 'OK' is pressed.
|
||||
m_string = wxT("Spaces are invalid here");
|
||||
m_string = "Spaces are invalid here";
|
||||
m_string2 = "Valid text";
|
||||
m_listbox_choices.Add(0);
|
||||
m_intValue = 0;
|
||||
@ -137,7 +137,7 @@ bool MyApp::OnInit()
|
||||
return false;
|
||||
|
||||
// Create and display the main frame window.
|
||||
MyFrame *frame = new MyFrame((wxFrame *) NULL, wxT("Validator Test"),
|
||||
MyFrame *frame = new MyFrame((wxFrame *) NULL, "Validator Test",
|
||||
50, 50, 300, 250);
|
||||
frame->Show(true);
|
||||
|
||||
@ -162,17 +162,17 @@ MyFrame::MyFrame(wxFrame *frame, const wxString&title, int x, int y, int w, int
|
||||
|
||||
// Create a listbox to display the validated data.
|
||||
m_listbox = new wxListBox(this, wxID_ANY);
|
||||
m_listbox->Append(wxString(wxT("Try 'File|Test' to see how validators work.")));
|
||||
m_listbox->Append(wxString("Try 'File|Test' to see how validators work."));
|
||||
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(VALIDATE_TEST_DIALOG, wxT("&Test dialog...\tCtrl-T"), wxT("Demonstrate validators"));
|
||||
file_menu->AppendCheckItem(VALIDATE_TOGGLE_BELL, wxT("&Bell on error"), wxT("Toggle bell on error"));
|
||||
file_menu->Append(VALIDATE_TEST_DIALOG, "&Test dialog...\tCtrl-T", "Demonstrate validators");
|
||||
file_menu->AppendCheckItem(VALIDATE_TOGGLE_BELL, "&Bell on error", "Toggle bell on error");
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(wxID_EXIT, wxT("E&xit"));
|
||||
file_menu->Append(wxID_EXIT, "E&xit");
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
menu_bar->Append(file_menu, wxT("&File"));
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
SetMenuBar(menu_bar);
|
||||
|
||||
// All validators share a common (static) flag that controls
|
||||
@ -196,7 +196,7 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event))
|
||||
// and variables together. Values are transferred between them behind
|
||||
// the scenes, so here we don't have to query the controls for their
|
||||
// values.
|
||||
MyDialog dialog(this, wxT("Validator demonstration"));
|
||||
MyDialog dialog(this, "Validator demonstration");
|
||||
|
||||
// When the dialog is displayed, validators automatically transfer
|
||||
// data from variables to their corresponding controls.
|
||||
@ -206,19 +206,19 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event))
|
||||
// automatically transferred to the variables we specified
|
||||
// when we created the validators.
|
||||
m_listbox->Clear();
|
||||
m_listbox->Append(wxString(wxT("string: ")) + g_data.m_string);
|
||||
m_listbox->Append(wxString(wxT("string #2: ")) + g_data.m_string2);
|
||||
m_listbox->Append(wxString("string: ") + g_data.m_string);
|
||||
m_listbox->Append(wxString("string #2: ") + g_data.m_string2);
|
||||
|
||||
for(unsigned int i = 0; i < g_data.m_listbox_choices.GetCount(); ++i)
|
||||
{
|
||||
int j = g_data.m_listbox_choices[i];
|
||||
m_listbox->Append(wxString(wxT("listbox choice(s): ")) + g_listbox_choices[j]);
|
||||
m_listbox->Append(wxString("listbox choice(s): ") + g_listbox_choices[j]);
|
||||
}
|
||||
|
||||
wxString checkbox_state(g_data.m_checkbox_state ? wxT("checked") : wxT("unchecked"));
|
||||
m_listbox->Append(wxString(wxT("checkbox: ")) + checkbox_state);
|
||||
m_listbox->Append(wxString(wxT("combobox: ")) + g_data.m_combobox_choice);
|
||||
m_listbox->Append(wxString(wxT("radiobox: ")) + g_radiobox_choices[g_data.m_radiobox_choice]);
|
||||
wxString checkbox_state(g_data.m_checkbox_state ? "checked" : "unchecked");
|
||||
m_listbox->Append(wxString("checkbox: ") + checkbox_state);
|
||||
m_listbox->Append(wxString("combobox: ") + g_data.m_combobox_choice);
|
||||
m_listbox->Append(wxString("radiobox: ") + g_radiobox_choices[g_data.m_radiobox_choice]);
|
||||
|
||||
m_listbox->Append(wxString::Format("integer value: %d", g_data.m_intValue));
|
||||
m_listbox->Append(wxString::Format("small int value: %u", g_data.m_smallIntValue));
|
||||
@ -287,7 +287,7 @@ MyDialog::MyDialog( wxWindow *parent, const wxString& title,
|
||||
// because we don't use it elsewhere--it can be anonymous.
|
||||
// We don't need any such pointer to query its state, which
|
||||
// can be gotten directly from g_data.
|
||||
flexgridsizer->Add(new wxCheckBox(this, VALIDATE_CHECK, wxT("Sample checkbox"),
|
||||
flexgridsizer->Add(new wxCheckBox(this, VALIDATE_CHECK, "Sample checkbox",
|
||||
wxDefaultPosition, wxDefaultSize, 0,
|
||||
wxGenericValidator(&g_data.m_checkbox_state)),
|
||||
1, wxALIGN_CENTER|wxALL, 15);
|
||||
@ -375,7 +375,7 @@ MyDialog::MyDialog( wxWindow *parent, const wxString& title,
|
||||
|
||||
mainsizer->Add(flexgridsizer, 1, wxGROW | wxALL, 10);
|
||||
|
||||
mainsizer->Add(new wxRadioBox((wxWindow*)this, VALIDATE_RADIO, wxT("Pick a color"),
|
||||
mainsizer->Add(new wxRadioBox((wxWindow*)this, VALIDATE_RADIO, "Pick a color",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
3, g_radiobox_choices, 1, wxRA_SPECIFY_ROWS,
|
||||
wxGenericValidator(&g_data.m_radiobox_choice)),
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
if ( m_frameStatusBar )
|
||||
{
|
||||
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
|
||||
|
||||
@ -118,7 +118,7 @@ public:
|
||||
#if wxUSE_STATUSBAR
|
||||
m_frame->SetStatusText(wxString::Format
|
||||
(
|
||||
wxT("Page size = %d, pos = %d, max = %d"),
|
||||
"Page size = %d, pos = %d, max = %d",
|
||||
GetScrollThumb(wxVERTICAL),
|
||||
GetScrollPos(wxVERTICAL),
|
||||
GetScrollRange(wxVERTICAL)
|
||||
@ -146,7 +146,7 @@ public:
|
||||
dc.DrawLine(0, y, clientSize.GetWidth(), y);
|
||||
|
||||
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);
|
||||
|
||||
y += hLine;
|
||||
@ -215,7 +215,7 @@ public:
|
||||
#if wxUSE_STATUSBAR
|
||||
m_frame->SetStatusText(wxString::Format
|
||||
(
|
||||
wxT("Page size = %d, pos = %d, max = %d"),
|
||||
"Page size = %d, pos = %d, max = %d",
|
||||
GetScrollThumb(wxVERTICAL),
|
||||
GetScrollPos(wxVERTICAL),
|
||||
GetScrollRange(wxVERTICAL)
|
||||
@ -243,7 +243,7 @@ public:
|
||||
dc.DrawLine(x, 0, x, clientSize.GetHeight());
|
||||
|
||||
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;
|
||||
@ -315,7 +315,7 @@ public:
|
||||
#if wxUSE_STATUSBAR
|
||||
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(wxHORIZONTAL),
|
||||
GetScrollPos(wxVERTICAL),
|
||||
@ -357,9 +357,9 @@ public:
|
||||
if ( row == rowFirst )
|
||||
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);
|
||||
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 += colWidth;
|
||||
@ -496,7 +496,7 @@ bool VarScrollApp::OnInit()
|
||||
VarScrollFrame::VarScrollFrame()
|
||||
: wxFrame(NULL,
|
||||
wxID_ANY,
|
||||
wxT("VScroll wxWidgets Sample"),
|
||||
"VScroll wxWidgets Sample",
|
||||
wxDefaultPosition,
|
||||
wxSize(400, 350)),
|
||||
m_scrollWindow(NULL)
|
||||
@ -512,33 +512,33 @@ VarScrollFrame::VarScrollFrame()
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
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
|
||||
menuMode->AppendRadioItem(VScroll_VScrollMode, wxT("&Vertical\tAlt-V"),
|
||||
wxT("Vertical scrolling only"));
|
||||
menuMode->AppendRadioItem(VScroll_HScrollMode, wxT("&Horizontal\tAlt-H"),
|
||||
wxT("Horizontal scrolling only"));
|
||||
menuMode->AppendRadioItem(VScroll_VScrollMode, "&Vertical\tAlt-V",
|
||||
"Vertical scrolling only");
|
||||
menuMode->AppendRadioItem(VScroll_HScrollMode, "&Horizontal\tAlt-H",
|
||||
"Horizontal scrolling only");
|
||||
menuMode->AppendRadioItem(VScroll_HVScrollMode,
|
||||
wxT("Hori&zontal/Vertical\tAlt-Z"),
|
||||
wxT("Horizontal and vertical scrolling"));
|
||||
"Hori&zontal/Vertical\tAlt-Z",
|
||||
"Horizontal and vertical scrolling");
|
||||
menuMode->Check(VScroll_VScrollMode, true);
|
||||
#else
|
||||
menuMode->Append(VScroll_VScrollMode, wxT("&Vertical\tAlt-V"),
|
||||
wxT("Vertical scrolling only"));
|
||||
menuMode->Append(VScroll_HScrollMode, wxT("&Horizontal\tAlt-H"),
|
||||
wxT("Horizontal scrolling only"));
|
||||
menuMode->Append(VScroll_HVScrollMode, wxT("Hori&zontal/Vertical\tAlt-Z"),
|
||||
wxT("Horizontal and vertical scrolling"));
|
||||
menuMode->Append(VScroll_VScrollMode, "&Vertical\tAlt-V",
|
||||
"Vertical scrolling only");
|
||||
menuMode->Append(VScroll_HScrollMode, "&Horizontal\tAlt-H",
|
||||
"Horizontal scrolling only");
|
||||
menuMode->Append(VScroll_HVScrollMode, "Hori&zontal/Vertical\tAlt-Z",
|
||||
"Horizontal and vertical scrolling");
|
||||
#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...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuMode, wxT("&Mode"));
|
||||
menuBar->Append(menuHelp, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(menuMode, "&Mode");
|
||||
menuBar->Append(menuHelp, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -547,7 +547,7 @@ VarScrollFrame::VarScrollFrame()
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
int widths[2];
|
||||
widths[0] = -1;
|
||||
widths[1] = 100;
|
||||
@ -602,10 +602,10 @@ void VarScrollFrame::OnModeHVScroll(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void VarScrollFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("VScroll shows how to implement scrolling with\n")
|
||||
wxT("variable line widths and heights.\n")
|
||||
wxT("(c) 2003 Vadim Zeitlin"),
|
||||
wxT("About VScroll"),
|
||||
wxMessageBox("VScroll shows how to implement scrolling with\n"
|
||||
"variable line widths and heights.\n"
|
||||
"(c) 2003 Vadim Zeitlin",
|
||||
"About VScroll",
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ WebFrame::WebFrame(const wxString& url) :
|
||||
m_toolbar_forward = m_toolbar->AddTool(wxID_ANY, _("Forward"), forward);
|
||||
m_toolbar_stop = m_toolbar->AddTool(wxID_ANY, _("Stop"), stop);
|
||||
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_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))
|
||||
{
|
||||
wxPathList pathlist;
|
||||
pathlist.Add(wxT("."));
|
||||
pathlist.Add(wxT(".."));
|
||||
pathlist.Add(wxT("../help"));
|
||||
pathlist.Add(wxT("../../../samples/help"));
|
||||
pathlist.Add(".");
|
||||
pathlist.Add("..");
|
||||
pathlist.Add("../help");
|
||||
pathlist.Add("../../../samples/help");
|
||||
|
||||
wxFileName helpfile(pathlist.FindValidPath(wxT("doc.zip")));
|
||||
wxFileName helpfile(pathlist.FindValidPath("doc.zip"));
|
||||
helpfile.MakeAbsolute();
|
||||
wxString path = helpfile.GetFullPath();
|
||||
//Under MSW we need to flip the slashes
|
||||
|
@ -127,13 +127,13 @@ public:
|
||||
{
|
||||
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);
|
||||
mainSizer->Add(
|
||||
new wxStaticText(this, wxID_ANY,
|
||||
wxT("You need to check the checkbox\n")
|
||||
wxT("below before going to the next page\n")),
|
||||
"You need to check the checkbox\n"
|
||||
"below before going to the next page\n"),
|
||||
0,
|
||||
wxALL,
|
||||
5
|
||||
@ -152,7 +152,7 @@ public:
|
||||
{
|
||||
if ( !m_checkbox->GetValue() )
|
||||
{
|
||||
wxMessageBox(wxT("Check the checkbox first!"), wxT("No way"),
|
||||
wxMessageBox("Check the checkbox first!", "No way",
|
||||
wxICON_WARNING | wxOK, this);
|
||||
|
||||
return false;
|
||||
@ -183,12 +183,12 @@ public:
|
||||
// static wxString choices[] = { "forward", "backward", "both", "neither" };
|
||||
// The above syntax can cause an internal compiler error with gcc.
|
||||
wxString choices[4];
|
||||
choices[0] = wxT("forward");
|
||||
choices[1] = wxT("backward");
|
||||
choices[2] = wxT("both");
|
||||
choices[3] = wxT("neither");
|
||||
choices[0] = "forward";
|
||||
choices[1] = "backward";
|
||||
choices[2] = "both";
|
||||
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,
|
||||
WXSIZEOF(choices), choices,
|
||||
1, wxRA_SPECIFY_COLS);
|
||||
@ -208,7 +208,7 @@ public:
|
||||
// wizard event handlers
|
||||
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 )
|
||||
{
|
||||
// not confirmed
|
||||
@ -229,7 +229,7 @@ public:
|
||||
if ( !event.GetDirection() && sel == Backward )
|
||||
return;
|
||||
|
||||
wxMessageBox(wxT("You can't go there"), wxT("Not allowed"),
|
||||
wxMessageBox("You can't go there", "Not allowed",
|
||||
wxICON_WARNING | wxOK, this);
|
||||
|
||||
event.Veto();
|
||||
@ -256,14 +256,14 @@ public:
|
||||
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
mainSizer->Add(
|
||||
new wxStaticText(this, wxID_ANY, wxT("Try checking the box below and\n")
|
||||
wxT("then going back and clearing it")),
|
||||
new wxStaticText(this, wxID_ANY, "Try checking the box below and\n"
|
||||
"then going back and clearing it"),
|
||||
0, // No vertical stretching
|
||||
wxALL,
|
||||
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(
|
||||
m_checkbox,
|
||||
0, // No vertical stretching
|
||||
@ -272,18 +272,18 @@ public:
|
||||
);
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
static const wxChar *aszChoices[] =
|
||||
static const wxString aszChoices[] =
|
||||
{
|
||||
wxT("Zeroth"),
|
||||
wxT("First"),
|
||||
wxT("Second"),
|
||||
wxT("Third"),
|
||||
wxT("Fourth"),
|
||||
wxT("Fifth"),
|
||||
wxT("Sixth"),
|
||||
wxT("Seventh"),
|
||||
wxT("Eighth"),
|
||||
wxT("Nineth")
|
||||
"Zeroth",
|
||||
"First",
|
||||
"Second",
|
||||
"Third",
|
||||
"Fourth",
|
||||
"Fifth",
|
||||
"Sixth",
|
||||
"Seventh",
|
||||
"Eighth",
|
||||
"Nineth"
|
||||
};
|
||||
|
||||
m_checklistbox = new wxCheckListBox
|
||||
@ -367,7 +367,7 @@ bool MyApp::OnInit()
|
||||
if ( !wxApp::OnInit() )
|
||||
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
|
||||
// created initially)
|
||||
@ -385,7 +385,7 @@ MyWizard::MyWizard(wxFrame *frame, bool useSizer)
|
||||
{
|
||||
SetExtraStyle(wxWIZARD_EX_HELPBUTTON);
|
||||
|
||||
Create(frame,wxID_ANY,wxT("Absolutely Useless Wizard"),
|
||||
Create(frame,wxID_ANY,"Absolutely Useless Wizard",
|
||||
wxBitmap(wiztest_xpm),wxDefaultPosition,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
|
||||
SetIcon(wxICON(sample));
|
||||
@ -402,9 +402,9 @@ MyWizard::MyWizard(wxFrame *frame, bool useSizer)
|
||||
m_page1 = new wxWizardPageSimple(this);
|
||||
|
||||
/* wxStaticText *text = */ new wxStaticText(m_page1, wxID_ANY,
|
||||
wxT("This wizard doesn't help you\nto do anything at all.\n")
|
||||
wxT("\n")
|
||||
wxT("The next pages will present you\nwith more useless controls."),
|
||||
"This wizard doesn't help you\nto do anything at all.\n"
|
||||
"\n"
|
||||
"The next pages will present you\nwith more useless controls.",
|
||||
wxPoint(5,5)
|
||||
);
|
||||
|
||||
@ -440,24 +440,24 @@ MyFrame::MyFrame(const wxString& title)
|
||||
wxDefaultPosition, wxSize(250, 150)) // small frame
|
||||
{
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
menuFile->Append(Wizard_RunModal, wxT("&Run wizard modal...\tCtrl-R"));
|
||||
menuFile->Append(Wizard_RunNoSizer, wxT("Run wizard &without sizer..."));
|
||||
menuFile->Append(Wizard_RunModeless, wxT("Run wizard &modeless..."));
|
||||
menuFile->Append(Wizard_RunModal, "&Run wizard modal...\tCtrl-R");
|
||||
menuFile->Append(Wizard_RunNoSizer, "Run wizard &without sizer...");
|
||||
menuFile->Append(Wizard_RunModeless, "Run wizard &modeless...");
|
||||
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;
|
||||
menuOptions->AppendCheckItem(Wizard_LargeWizard, wxT("&Scroll Wizard Pages"));
|
||||
menuOptions->AppendCheckItem(Wizard_ExpandBitmap, wxT("Si&ze Bitmap To Page"));
|
||||
menuOptions->AppendCheckItem(Wizard_LargeWizard, "&Scroll Wizard Pages");
|
||||
menuOptions->AppendCheckItem(Wizard_ExpandBitmap, "Si&ze Bitmap To Page");
|
||||
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, wxT("&File"));
|
||||
menuBar->Append(menuOptions, wxT("&Options"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(menuOptions, "&Options");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -476,9 +476,9 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxT("Demo of wxWizard class\n")
|
||||
wxT("(c) 1999, 2000 Vadim Zeitlin"),
|
||||
wxT("About wxWizard sample"), wxOK | wxICON_INFORMATION, this);
|
||||
wxMessageBox("Demo of wxWizard class\n"
|
||||
"(c) 1999, 2000 Vadim Zeitlin",
|
||||
"About wxWizard sample", wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event))
|
||||
@ -504,10 +504,10 @@ void MyFrame::OnRunWizardModeless(wxCommandEvent& 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))
|
||||
{
|
||||
wxMessageBox(wxT("The wizard was cancelled."), wxT("Wizard notification"));
|
||||
wxMessageBox("The wizard was cancelled.", "Wizard notification");
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ void MyResizableListCtrl::SetColumnWidths()
|
||||
|
||||
// This is just a debug message in case you want to watch the
|
||||
// events scroll by as you resize.
|
||||
wxLogDebug( wxT("Successfully set column widths") );
|
||||
wxLogDebug( "Successfully set column widths" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxLC_REPORT,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString &name = wxT("myResizableListCtrl")
|
||||
const wxString &name = "myResizableListCtrl"
|
||||
);
|
||||
|
||||
// Destructor.
|
||||
|
@ -52,7 +52,7 @@ wxEND_EVENT_TABLE()
|
||||
// Constructor (Notice how small and easy it is)
|
||||
PreferencesDialog::PreferencesDialog(wxWindow* parent)
|
||||
{
|
||||
wxXmlResource::Get()->LoadDialog(this, parent, wxT("derived_dialog"));
|
||||
wxXmlResource::Get()->LoadDialog(this, parent, "derived_dialog");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -111,19 +111,19 @@ MyFrame::MyFrame(wxWindow* parent)
|
||||
// since this frame will always be the top window, and thus parentless.
|
||||
// However, the current approach has source code that can be recycled
|
||||
// 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.
|
||||
SetIcon(wxICON(sample));
|
||||
|
||||
// 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.
|
||||
// NOTE: For toolbars you currently should do it exactly like this.
|
||||
// With toolbars, you currently can't create one, and set it later. It
|
||||
// needs to be all in one step.
|
||||
wxSystemOptions::SetOption ( wxT("msw.remap"), 0 );
|
||||
SetToolBar(wxXmlResource::Get()->LoadToolBar(this, wxT("main_toolbar")));
|
||||
wxSystemOptions::SetOption ( "msw.remap", 0 );
|
||||
SetToolBar(wxXmlResource::Get()->LoadToolBar(this, "main_toolbar"));
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
// 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))
|
||||
{
|
||||
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 ")
|
||||
wxT("won't be able to use it before loading it again"));
|
||||
wxLogMessage("Basic dialog resource has now been unloaded, you "
|
||||
"won't be able to use it before loading it again");
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogWarning(wxT("Failed to unload basic dialog resource"));
|
||||
wxLogWarning("Failed to unload basic dialog resource");
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
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;
|
||||
// "non_derived_dialog" is the name of the wxDialog XRC node that should
|
||||
// be loaded.
|
||||
if ( wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("non_derived_dialog")) )
|
||||
if ( wxXmlResource::Get()->LoadDialog(&dlg, this, "non_derived_dialog") )
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
@ -208,14 +208,14 @@ void MyFrame::OnAnimationCtrlPlay(wxCommandEvent& event)
|
||||
if (ctrl->IsPlaying())
|
||||
{
|
||||
ctrl->Stop();
|
||||
btn->SetLabel(wxT("Play"));
|
||||
btn->SetLabel("Play");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ctrl->Play())
|
||||
btn->SetLabel(wxT("Stop"));
|
||||
btn->SetLabel("Stop");
|
||||
else
|
||||
wxLogError(wxT("Cannot play the animation..."));
|
||||
wxLogError("Cannot play the animation...");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -223,7 +223,7 @@ void MyFrame::OnAnimationCtrlPlay(wxCommandEvent& event)
|
||||
void MyFrame::OnControlsToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxDialog dlg;
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("controls_dialog"));
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, "controls_dialog");
|
||||
|
||||
#if wxUSE_LISTCTRL
|
||||
// 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))
|
||||
{
|
||||
wxDialog dlg;
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("uncentered_dialog"));
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, "uncentered_dialog");
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
@ -307,7 +307,7 @@ void MyFrame::OnObjRefToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnCustomClassToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
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.
|
||||
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
|
||||
// custctrl.xrc XRC file.
|
||||
wxXmlResource::Get()->AttachUnknownControl(wxT("custom_control_placeholder"),
|
||||
wxXmlResource::Get()->AttachUnknownControl("custom_control_placeholder",
|
||||
a_myResizableListCtrl);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
@ -328,7 +328,7 @@ void MyFrame::OnCustomClassToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnPlatformPropertyToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxDialog dlg;
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("platform_property_dialog"));
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, "platform_property_dialog");
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ void MyFrame::OnPlatformPropertyToolOrMenuCommand(wxCommandEvent& WXUNUSED(event
|
||||
void MyFrame::OnArtProviderToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxDialog dlg;
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("art_provider_dialog"));
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, "art_provider_dialog");
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
@ -344,14 +344,14 @@ void MyFrame::OnArtProviderToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnVariableExpansionToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxDialog dlg;
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("variable_expansion_dialog"));
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, "variable_expansion_dialog");
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
void MyFrame::OnVariants(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxDialog dlg;
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, wxT("variants_dialog"));
|
||||
wxXmlResource::Get()->LoadDialog(&dlg, this, "variants_dialog");
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
@ -400,8 +400,8 @@ void MyFrame::OnRecursiveLoad(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAboutToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( wxT("This is the about dialog of XML resources demo.\n")
|
||||
wxT("Welcome to %s"), wxVERSION_STRING);
|
||||
msg.Printf( "This is the about dialog of XML resources demo.\n"
|
||||
"Welcome to %s", wxVERSION_STRING);
|
||||
|
||||
wxMessageBox(msg, _("About XML resources demo"), wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
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);
|
||||
wxCHECK_RET(nb, "failed to find objref_notebook");
|
||||
|
@ -102,14 +102,14 @@ void ClassListDialog::CreateControls()
|
||||
wxBoxSizer* filters = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemBoxSizer2->Add(filters, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
||||
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->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
|
||||
m_pClassCountText = new wxStaticText( this, wxID_STATIC,
|
||||
wxT("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pClassCountText->SetFont(wxFontInfo(8).Family(wxFONTFAMILY_SWISS).Bold());
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
wxStdDialogButtonSizer* itemStdDialogButtonSizer17 = new wxStdDialogButtonSizer;
|
||||
@ -187,7 +187,7 @@ int ClassListDialog::AddClassesWithParent(const wxClassInfo *parent, const wxTre
|
||||
int ret = AddClassesWithParent(ci, child);
|
||||
m_pParentTreeCtrl->SetItemText(child,
|
||||
m_pParentTreeCtrl->GetItemText(child) +
|
||||
wxString::Format(wxT(" [%d]"), ret));
|
||||
wxString::Format(" [%d]", ret));
|
||||
count += ret+1;
|
||||
}
|
||||
|
||||
@ -241,12 +241,12 @@ void ClassListDialog::InitControls()
|
||||
m_pSizeListBox->Append(arr[i]);
|
||||
|
||||
// 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
|
||||
int count = AddClassesWithParent(CLASSINFO(wxObject), id);
|
||||
m_pParentTreeCtrl->SetItemText(id, m_pParentTreeCtrl->GetItemText(id) +
|
||||
wxString::Format(wxT(" [%d]"), count));
|
||||
wxString::Format(" [%d]", count));
|
||||
|
||||
// initially expand the root item
|
||||
m_pParentTreeCtrl->Expand(id);
|
||||
@ -281,13 +281,13 @@ void ClassListDialog::UpdateFilterText()
|
||||
// how many are we showing
|
||||
m_pClassCountText->SetLabel(
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
m_pTextCtrl->SetValue(
|
||||
@ -367,68 +367,68 @@ void ClassListDialog::OnChoiceBookPageChange( wxChoicebookEvent& event )
|
||||
wxString DumpStr(const wxString &str)
|
||||
{
|
||||
if (str.empty())
|
||||
return wxT("none");
|
||||
return "none";
|
||||
return str;
|
||||
}
|
||||
|
||||
wxString DumpTypeInfo(const wxTypeInfo *ti)
|
||||
{
|
||||
if (!ti)
|
||||
return wxT("none");
|
||||
return "none";
|
||||
|
||||
return DumpStr(ti->GetTypeName());
|
||||
}
|
||||
|
||||
wxString DumpPropertyAccessor(const wxPropertyAccessor *acc, int indent)
|
||||
{
|
||||
wxString ind = wxT("\n") + wxString(indent, wxT(' '));
|
||||
wxString ind = "\n" + wxString(indent, ' ');
|
||||
wxString infostr;
|
||||
|
||||
if (!acc)
|
||||
return ind + wxT("no property accessors");
|
||||
return ind + "no property accessors";
|
||||
|
||||
if (acc->HasSetter())
|
||||
infostr << ind << wxT("setter name: ") << acc->GetSetterName();
|
||||
infostr << ind << "setter name: " << acc->GetSetterName();
|
||||
if (acc->HasCollectionGetter())
|
||||
infostr << ind << wxT("collection getter name: ") << acc->GetCollectionGetterName();
|
||||
infostr << ind << "collection getter name: " << acc->GetCollectionGetterName();
|
||||
if (acc->HasGetter())
|
||||
infostr << ind << wxT("getter name: ") << acc->GetGetterName();
|
||||
infostr << ind << "getter name: " << acc->GetGetterName();
|
||||
if (acc->HasAdder())
|
||||
infostr << ind << wxT("adder name: ") << acc->GetAdderName();
|
||||
infostr << ind << "adder name: " << acc->GetAdderName();
|
||||
|
||||
return infostr;
|
||||
}
|
||||
|
||||
wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent)
|
||||
{
|
||||
wxString ind = wxT("\n") + wxString(indent, wxT(' '));
|
||||
wxString ind = "\n" + wxString(indent, ' ');
|
||||
wxString infostr;
|
||||
|
||||
if (!prop)
|
||||
return ind + wxT("none");
|
||||
return ind + "none";
|
||||
|
||||
infostr << ind << wxT("flags: ");
|
||||
infostr << ind << "flags: ";
|
||||
if (prop->GetFlags() & wxPROP_DEPRECATED)
|
||||
infostr << wxT("wxPROP_DEPRECATED,");
|
||||
infostr << "wxPROP_DEPRECATED,";
|
||||
if (prop->GetFlags() & wxPROP_OBJECT_GRAPH)
|
||||
infostr << wxT("wxPROP_OBJECT_GRAPH,");
|
||||
infostr << "wxPROP_OBJECT_GRAPH,";
|
||||
if (prop->GetFlags() & wxPROP_ENUM_STORE_LONG)
|
||||
infostr << wxT("wxPROP_ENUM_STORE_LONG,");
|
||||
infostr << "wxPROP_ENUM_STORE_LONG,";
|
||||
if (prop->GetFlags() & wxPROP_DONT_STREAM)
|
||||
infostr << wxT("wxPROP_DONT_STREAM,");
|
||||
infostr << "wxPROP_DONT_STREAM,";
|
||||
|
||||
if (prop->GetFlags() == 0)
|
||||
infostr << wxT("none");
|
||||
infostr << "none";
|
||||
else
|
||||
infostr.RemoveLast(); // remove last comma
|
||||
|
||||
infostr << ind << wxT("help string: ") << DumpStr(prop->GetHelpString());
|
||||
infostr << ind << wxT("group string: ") << DumpStr(prop->GetGroupString());
|
||||
infostr << ind << "help string: " << DumpStr(prop->GetHelpString());
|
||||
infostr << ind << "group string: " << DumpStr(prop->GetGroupString());
|
||||
|
||||
infostr << ind << wxT("collection element type: ") << DumpTypeInfo(prop->GetCollectionElementTypeInfo());
|
||||
infostr << ind << wxT("type: ") << DumpTypeInfo(prop->GetTypeInfo());
|
||||
infostr << ind << "collection element type: " << DumpTypeInfo(prop->GetCollectionElementTypeInfo());
|
||||
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);
|
||||
|
||||
return infostr;
|
||||
@ -436,14 +436,14 @@ wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent)
|
||||
|
||||
wxString DumpHandlerInfo(const wxHandlerInfo *phdlr, int indent)
|
||||
{
|
||||
wxString ind = wxT("\n") + wxString(indent, wxT(' '));
|
||||
wxString ind = "\n" + wxString(indent, ' ');
|
||||
wxString infostr;
|
||||
|
||||
if (!phdlr)
|
||||
return ind + wxT("none");
|
||||
return ind + "none";
|
||||
|
||||
infostr << ind << wxT("event class: ") <<
|
||||
(phdlr->GetEventClassInfo() ? phdlr->GetEventClassInfo()->GetClassName() : wxT("none"));
|
||||
infostr << ind << "event class: " <<
|
||||
(phdlr->GetEventClassInfo() ? phdlr->GetEventClassInfo()->GetClassName() : "none");
|
||||
|
||||
return infostr;
|
||||
}
|
||||
@ -456,12 +456,12 @@ int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive)
|
||||
prop;
|
||||
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);
|
||||
}
|
||||
|
||||
if (pcount == 0)
|
||||
infostr << wxT("\n None");
|
||||
infostr << "\n None";
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
@ -474,7 +474,7 @@ int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive)
|
||||
if (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;
|
||||
}
|
||||
}
|
||||
@ -491,12 +491,12 @@ int DumpHandlers(const wxClassInfo *info, wxString& infostr, bool recursive)
|
||||
h;
|
||||
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);
|
||||
}
|
||||
|
||||
if (hcount == 0)
|
||||
infostr << wxT("\n None");
|
||||
infostr << "\n None";
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
@ -509,7 +509,7 @@ int DumpHandlers(const wxClassInfo *info, wxString& infostr, bool recursive)
|
||||
if (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;
|
||||
}
|
||||
}
|
||||
@ -527,32 +527,32 @@ wxString DumpClassInfo(const wxClassInfo *info, bool recursive)
|
||||
|
||||
// basic stuff:
|
||||
|
||||
infostr << wxT("\n BASIC RTTI INFO ABOUT ") << info->GetClassName();
|
||||
infostr << wxT("\n =================================================");
|
||||
infostr << wxT("\n Base class #1: ") << DumpStr(info->GetBaseClassName1());
|
||||
infostr << wxT("\n Base class #2: ") << DumpStr(info->GetBaseClassName2());
|
||||
infostr << wxT("\n Include file: ") << DumpStr(info->GetIncludeName());
|
||||
infostr << wxT("\n Size: ") << info->GetSize();
|
||||
infostr << wxT("\n Dynamic: ") << (info->IsDynamic() ? wxT("true") : wxT("false"));
|
||||
infostr << "\n BASIC RTTI INFO ABOUT " << info->GetClassName();
|
||||
infostr << "\n =================================================";
|
||||
infostr << "\n Base class #1: " << DumpStr(info->GetBaseClassName1());
|
||||
infostr << "\n Base class #2: " << DumpStr(info->GetBaseClassName2());
|
||||
infostr << "\n Include file: " << DumpStr(info->GetIncludeName());
|
||||
infostr << "\n Size: " << info->GetSize();
|
||||
infostr << "\n Dynamic: " << (info->IsDynamic() ? "true" : "false");
|
||||
|
||||
|
||||
// advanced stuff:
|
||||
|
||||
infostr << wxT("\n\n\n ADVANCED RTTI INFO ABOUT ") << info->GetClassName();
|
||||
infostr << wxT("\n =================================================\n");
|
||||
infostr << wxT("\n PROPERTIES");
|
||||
infostr << wxT("\n -----------------------------------------");
|
||||
infostr << "\n\n\n ADVANCED RTTI INFO ABOUT " << info->GetClassName();
|
||||
infostr << "\n =================================================\n";
|
||||
infostr << "\n PROPERTIES";
|
||||
infostr << "\n -----------------------------------------";
|
||||
int pcount = DumpProperties(info, infostr, recursive);
|
||||
infostr << wxT("\n\n HANDLERS");
|
||||
infostr << wxT("\n -----------------------------------------");
|
||||
infostr << "\n\n HANDLERS";
|
||||
infostr << "\n -----------------------------------------";
|
||||
int hcount = DumpHandlers(info, infostr, recursive);
|
||||
|
||||
if (pcount+hcount == 0)
|
||||
infostr << wxT("\n\n no advanced info\n");
|
||||
infostr << "\n\n no advanced info\n";
|
||||
else
|
||||
{
|
||||
infostr << wxT("\n\n Total count of properties: ") << pcount;
|
||||
infostr << wxT("\n Total count of handlers: ") << hcount << wxT("\n");
|
||||
infostr << "\n\n Total count of properties: " << pcount;
|
||||
infostr << "\n Total count of handlers: " << hcount << "\n";
|
||||
}
|
||||
|
||||
return infostr;
|
||||
|
@ -61,7 +61,7 @@ struct wxObjectCodeReaderCallback::wxObjectCodeReaderCallbackInternal
|
||||
wxString GetObjectName( int objectID )
|
||||
{
|
||||
if ( objectID == wxNullObjectID )
|
||||
return wxT("NULL");
|
||||
return "NULL";
|
||||
|
||||
if ( m_objectNames.find(objectID) == m_objectNames.end() )
|
||||
{
|
||||
@ -95,8 +95,8 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class
|
||||
m_headerincludes += include;
|
||||
}
|
||||
|
||||
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
|
||||
m_source += ( wxString::Format( wxT("\t%s *%s = new %s;\n"),
|
||||
wxString objectName = wxString::Format( "LocalObject_%d", objectID );
|
||||
m_source += ( wxString::Format( "\t%s *%s = new %s;\n",
|
||||
classInfo->GetClassName(),
|
||||
objectName.c_str(),
|
||||
classInfo->GetClassName()) );
|
||||
@ -105,7 +105,7 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class
|
||||
|
||||
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() ) );
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny ¶m )
|
||||
const wxCustomTypeInfo* cti = wx_dynamic_cast(const wxCustomTypeInfo*, type);
|
||||
if ( cti )
|
||||
{
|
||||
value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(),
|
||||
value.Printf( "%s(%s)", cti->GetTypeName().c_str(),
|
||||
wxAnyGetAsString(param).c_str() );
|
||||
}
|
||||
else
|
||||
@ -172,13 +172,13 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny ¶m )
|
||||
|
||||
ci->CallOnAny(param,&cw);
|
||||
|
||||
value.Printf( wxT("%s(%s)"), ctype->GetClassInfo()->GetClassName(),
|
||||
value.Printf( "%s(%s)", ctype->GetClassInfo()->GetClassName(),
|
||||
cw.GetConstructorString() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value.Printf( wxT("%s"), wxAnyGetAsString(param).c_str() );
|
||||
value.Printf( "%s", wxAnyGetAsString(param).c_str() );
|
||||
}
|
||||
|
||||
return value;
|
||||
@ -194,26 +194,26 @@ void wxObjectCodeReaderCallback::CreateObject(int objectID,
|
||||
)
|
||||
{
|
||||
int i;
|
||||
m_source += ( wxString::Format( wxT("\t%s->Create("),
|
||||
m_source += ( wxString::Format( "\t%s->Create(",
|
||||
m_data->GetObjectName(objectID).c_str() ) );
|
||||
for (i = 0; i < paramCount; i++)
|
||||
{
|
||||
if ( objectIDValues[i] != wxInvalidObjectID )
|
||||
{
|
||||
wxString str =
|
||||
wxString::Format( wxT("%s"),
|
||||
wxString::Format( "%s",
|
||||
m_data->GetObjectName( objectIDValues[i] ).c_str() );
|
||||
m_source += ( str );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_source += (
|
||||
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
|
||||
wxString::Format( "%s", ValueAsCode(params[i]).c_str() ) );
|
||||
}
|
||||
if (i < paramCount - 1)
|
||||
m_source += ( wxT(", "));
|
||||
m_source += ( ", ");
|
||||
}
|
||||
m_source += ( wxT(");\n") );
|
||||
m_source += ( ");\n" );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::ConstructObject(int objectID,
|
||||
@ -225,8 +225,8 @@ void wxObjectCodeReaderCallback::ConstructObject(int objectID,
|
||||
wxStringToAnyHashMap &WXUNUSED(metadata)
|
||||
)
|
||||
{
|
||||
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
|
||||
m_source += ( wxString::Format( wxT("\t%s *%s = new %s("),
|
||||
wxString objectName = wxString::Format( "LocalObject_%d", objectID );
|
||||
m_source += ( wxString::Format( "\t%s *%s = new %s(",
|
||||
classInfo->GetClassName(),
|
||||
objectName.c_str(),
|
||||
classInfo->GetClassName()) );
|
||||
@ -236,17 +236,17 @@ void wxObjectCodeReaderCallback::ConstructObject(int objectID,
|
||||
for (i = 0; i < paramCount; i++)
|
||||
{
|
||||
if ( objectIDValues[i] != wxInvalidObjectID )
|
||||
m_source += ( wxString::Format( wxT("%s"),
|
||||
m_source += ( wxString::Format( "%s",
|
||||
m_data->GetObjectName( objectIDValues[i] ).c_str() ) );
|
||||
else
|
||||
{
|
||||
m_source += (
|
||||
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
|
||||
wxString::Format( "%s", ValueAsCode(params[i]).c_str() ) );
|
||||
}
|
||||
if (i < paramCount - 1)
|
||||
m_source += ( wxT(", ") );
|
||||
m_source += ( ", " );
|
||||
}
|
||||
m_source += ( wxT(");\n") );
|
||||
m_source += ( ");\n" );
|
||||
}
|
||||
|
||||
void wxObjectCodeReaderCallback::SetProperty(int objectID,
|
||||
@ -254,7 +254,7 @@ void wxObjectCodeReaderCallback::SetProperty(int objectID,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
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(),
|
||||
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
||||
ValueAsCode(value).c_str()) );
|
||||
@ -266,12 +266,12 @@ void wxObjectCodeReaderCallback::SetPropertyAsObject(int objectID,
|
||||
int valueObjectId)
|
||||
{
|
||||
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(),
|
||||
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
||||
m_data->GetObjectName( valueObjectId).c_str() ) );
|
||||
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(),
|
||||
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
||||
m_data->GetObjectName( valueObjectId).c_str() ) );
|
||||
@ -282,7 +282,7 @@ void wxObjectCodeReaderCallback::AddToPropertyCollection( int objectID,
|
||||
const wxPropertyInfo* propertyInfo,
|
||||
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(),
|
||||
propertyInfo->GetAccessor()->GetAdderName().c_str(),
|
||||
ValueAsCode(value).c_str()) );
|
||||
@ -317,8 +317,8 @@ void wxObjectCodeReaderCallback::SetConnect(int eventSourceObjectID,
|
||||
|
||||
wxString code =
|
||||
wxString::Format(
|
||||
wxT("\t%s->Connect( %s->GetId(), %d, ")
|
||||
wxT("(wxObjectEventFunction)(wxEventFunction) & %s::%s, NULL, %s );"),
|
||||
"\t%s->Connect( %s->GetId(), %d, "
|
||||
"(wxObjectEventFunction)(wxEventFunction) & %s::%s, NULL, %s );",
|
||||
ehsource.c_str(), ehsource.c_str(), eventType, ehsinkClass.c_str(),
|
||||
handlerName.c_str(), ehsink.c_str() );
|
||||
|
||||
|
@ -140,7 +140,7 @@ bool MyApp::OnInit()
|
||||
RegisterFrameRTTI();
|
||||
|
||||
// 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
|
||||
// created initially)
|
||||
@ -168,24 +168,24 @@ MyFrame::MyFrame(const wxString& title)
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
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..."),
|
||||
wxT("Creates a wxFrame using wxXTI and saves its description as XML"));
|
||||
fileMenu->Append(Minimal_Depersist, wxT("Depersist XML file..."),
|
||||
wxT("Loads the description of wxFrame from XML"));
|
||||
fileMenu->Append(Minimal_GenerateCode, wxT("Generate code for a wxFrame saved to XML..."),
|
||||
wxT("Generates the C++ code which belong to a persisted wxFrame"));
|
||||
fileMenu->Append(Minimal_Persist, "Persist a wxFrame to XML...",
|
||||
"Creates a wxFrame using wxXTI and saves its description as XML");
|
||||
fileMenu->Append(Minimal_Depersist, "Depersist XML file...",
|
||||
"Loads the description of wxFrame from XML");
|
||||
fileMenu->Append(Minimal_GenerateCode, "Generate code for a wxFrame saved to XML...",
|
||||
"Generates the C++ code which belong to a persisted wxFrame");
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append(Minimal_DumpClasses, wxT("Dump registered classes..."),
|
||||
wxT("Dumps the description of all wxWidgets classes registered in XTI"));
|
||||
fileMenu->Append(Minimal_DumpClasses, "Dump registered classes...",
|
||||
"Dumps the description of all wxWidgets classes registered in XTI");
|
||||
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...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(fileMenu, wxT("&File"));
|
||||
menuBar->Append(helpMenu, wxT("&Help"));
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
@ -194,7 +194,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
#if wxUSE_STATUSBAR
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar(2);
|
||||
SetStatusText(wxT("Welcome to wxWidgets!"));
|
||||
SetStatusText("Welcome to wxWidgets!");
|
||||
#endif // wxUSE_STATUSBAR
|
||||
}
|
||||
|
||||
@ -280,13 +280,13 @@ public:
|
||||
// this approach would be used if the handler would not
|
||||
// be connected really in the designer, so we have to supply
|
||||
// the information
|
||||
const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty(wxT("Button")) );
|
||||
const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty("Button") );
|
||||
if ( object == but &&
|
||||
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo(wxT("OnClick")) )
|
||||
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo("OnClick") )
|
||||
{
|
||||
eventSink = m_frame;
|
||||
handlerInfo = m_frame->GetClassInfo()->
|
||||
FindHandlerInfo(wxT("ButtonClickHandler"));
|
||||
FindHandlerInfo("ButtonClickHandler");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -315,16 +315,16 @@ void RegisterFrameRTTI()
|
||||
// set up the RTTI info for a class (MyXTIFrame) which
|
||||
// is not defined anywhere in this program
|
||||
wxDynamicClassInfo *dyninfo =
|
||||
wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass(wxT("MyXTIFrame")));
|
||||
wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass("MyXTIFrame"));
|
||||
if ( dyninfo == NULL )
|
||||
{
|
||||
dyninfo = new wxDynamicClassInfo(wxT("myxtiframe.h"),
|
||||
wxT("MyXTIFrame"),
|
||||
dyninfo = new wxDynamicClassInfo("myxtiframe.h",
|
||||
"MyXTIFrame",
|
||||
CLASSINFO(wxFrame) );
|
||||
|
||||
// this class has a property named "Button" and the relative handler:
|
||||
dyninfo->AddProperty(wxT("Button"), wxGetTypeInfo((wxButton**) NULL));
|
||||
dyninfo->AddHandler(wxT("ButtonClickHandler"),
|
||||
dyninfo->AddProperty("Button", wxGetTypeInfo((wxButton**) NULL));
|
||||
dyninfo->AddHandler("ButtonClickHandler",
|
||||
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
|
||||
// get a pointer to it just searching it like any other class:
|
||||
wxFrame* frame;
|
||||
wxClassInfo *info = wxClassInfo::FindClass(wxT("MyXTIFrame"));
|
||||
wxClassInfo *info = wxClassInfo::FindClass("MyXTIFrame");
|
||||
wxASSERT( info );
|
||||
wxDynamicObject* frameWrapper =
|
||||
wx_dynamic_cast(wxDynamicObject*, info->CreateObject() );
|
||||
Params[0] = wxAny((wxWindow*)(NULL));
|
||||
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[4] = wxAny(wxSize(400,300));
|
||||
Params[5] = wxAny((long)wxDEFAULT_FRAME_STYLE);
|
||||
@ -374,7 +374,7 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
Params[2] = wxAny(wxPoint(-1,-1));
|
||||
Params[3] = wxAny(wxSize(-1,-1));
|
||||
Params[4] = wxAny((long)0);
|
||||
Params[5] = wxAny(wxString(wxT("Hello")));
|
||||
Params[5] = wxAny(wxString("Hello"));
|
||||
wxASSERT( info->Create(panel, 6, Params ));
|
||||
notebook->AddPage( panel, "Buttons" );
|
||||
|
||||
@ -384,12 +384,12 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
button = wxDynamicCast( info->CreateObject(), wxButton );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
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[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
wxASSERT( info->Create(button, 6, Params ));
|
||||
frameWrapper->SetProperty( wxT("Button"), wxAny( button ) );
|
||||
frameWrapper->SetProperty( "Button", wxAny( button ) );
|
||||
|
||||
// other controls page
|
||||
|
||||
@ -401,7 +401,7 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
Params[2] = wxAny(wxPoint(-1,-1));
|
||||
Params[3] = wxAny(wxSize(-1,-1));
|
||||
Params[4] = wxAny((long)0);
|
||||
Params[5] = wxAny(wxString(wxT("Hello")));
|
||||
Params[5] = wxAny(wxString("Hello"));
|
||||
wxASSERT( info->Create(panel, 6, Params ));
|
||||
notebook->AddPage( panel, "Other Standard controls" );
|
||||
|
||||
@ -411,7 +411,7 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
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[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
@ -422,7 +422,7 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
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[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
@ -430,7 +430,7 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[1] = wxAny(wxWindowID(baseID++));
|
||||
Params[2] = wxAny(wxString(wxT("Another One")));
|
||||
Params[2] = wxAny(wxString("Another One"));
|
||||
Params[3] = wxAny(wxPoint( 10, 50 ));
|
||||
wxASSERT( info->Create(control, 6, Params ));
|
||||
|
||||
@ -439,7 +439,7 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
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[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
@ -450,7 +450,7 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
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[4] = wxAny(wxSize(100,80));
|
||||
Params[5] = wxAny((long)0);
|
||||
@ -461,7 +461,7 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||
Params[0] = wxAny((wxWindow*)(panel));
|
||||
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[4] = wxAny(wxSize(-1,-1));
|
||||
Params[5] = wxAny((long)0);
|
||||
@ -477,7 +477,7 @@ wxDynamicObject* CreateFrameRTTI()
|
||||
Params[2] = wxAny(wxPoint(-1,-1));
|
||||
Params[3] = wxAny(wxSize(-1,-1));
|
||||
Params[4] = wxAny((long)0);
|
||||
Params[5] = wxAny(wxString(wxT("Hello")));
|
||||
Params[5] = wxAny(wxString("Hello"));
|
||||
wxASSERT( info->Create(panel, 6, Params ));
|
||||
notebook->AddPage( panel, "Spins and Sliders" );
|
||||
|
||||
@ -619,7 +619,7 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
|
||||
wxDynamicObject *frame = CreateFrameRTTI();
|
||||
if (!frame)
|
||||
{
|
||||
wxLogError(wxT("Cannot create the XTI frame!"));
|
||||
wxLogError("Cannot create the XTI frame!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -628,8 +628,8 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
|
||||
trueFrame->Show();
|
||||
|
||||
// ask the user where to save it
|
||||
wxFileDialog dlg(this, wxT("Where should the frame be saved?"),
|
||||
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"),
|
||||
wxFileDialog dlg(this, "Where should the frame be saved?",
|
||||
wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
|
||||
wxFD_SAVE);
|
||||
if (dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
@ -637,7 +637,7 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
|
||||
// then save it to a test XML file
|
||||
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;
|
||||
}
|
||||
|
||||
@ -648,8 +648,8 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// ask the user which file to load
|
||||
wxFileDialog dlg(this, wxT("Which file contains the frame to depersist?"),
|
||||
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"),
|
||||
wxFileDialog dlg(this, "Which file contains the frame to depersist?",
|
||||
wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
|
||||
wxFD_OPEN);
|
||||
if (dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
@ -657,7 +657,7 @@ void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
|
||||
wxObject *frame = LoadFrameRTTI(dlg.GetPath());
|
||||
if (!frame)
|
||||
{
|
||||
wxLogError(wxT("Could not depersist the wxFrame from '%s'"), dlg.GetPath());
|
||||
wxLogError("Could not depersist the wxFrame from '%s'", dlg.GetPath());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -672,21 +672,21 @@ void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
|
||||
if ( trueFrame )
|
||||
trueFrame->Show();
|
||||
else
|
||||
wxLogError(wxT("Could not show the frame"));
|
||||
wxLogError("Could not show the frame");
|
||||
}
|
||||
|
||||
void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// ask the user which file to load
|
||||
wxFileDialog dlg(this, wxT("Which file contains the frame to work on?"),
|
||||
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"),
|
||||
wxFileDialog dlg(this, "Which file contains the frame to work on?",
|
||||
wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
|
||||
wxFD_OPEN);
|
||||
if (dlg.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
|
||||
// ask the user which file to load
|
||||
wxFileDialog dlg2(this, wxT("Where should the C++ code be saved?"),
|
||||
wxEmptyString, wxT("test.cpp"), wxT("Source files (*.cpp)|*.cpp"),
|
||||
wxFileDialog dlg2(this, "Where should the C++ code be saved?",
|
||||
wxEmptyString, "test.cpp", "Source files (*.cpp)|*.cpp",
|
||||
wxFD_SAVE);
|
||||
if (dlg2.ShowModal() == wxID_CANCEL)
|
||||
return;
|
||||
@ -694,7 +694,7 @@ void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
|
||||
// do generate code
|
||||
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;
|
||||
}
|
||||
|
||||
@ -704,7 +704,7 @@ void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
|
||||
wxStringOutputStream str;
|
||||
f.Read(str);
|
||||
|
||||
wxDialog dlg(this, wxID_ANY, wxT("Generated code"),
|
||||
wxDialog dlg(this, wxID_ANY, "Generated code",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE);
|
||||
wxPanel *panel = new wxPanel(&dlg);
|
||||
@ -734,12 +734,12 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxMessageBox(wxString::Format(
|
||||
wxT("Welcome to %s!\n")
|
||||
wxT("\n")
|
||||
wxT("This sample demonstrates wxWidgets eXtended RTTI (XTI) system."),
|
||||
"Welcome to %s!\n"
|
||||
"\n"
|
||||
"This sample demonstrates wxWidgets eXtended RTTI (XTI) system.",
|
||||
wxVERSION_STRING
|
||||
),
|
||||
wxT("About wxWidgets XTI sample"),
|
||||
"About wxWidgets XTI sample",
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user