More samples/Unicode fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
7cf4f7e21f
commit
42ed75321c
@ -283,7 +283,7 @@ bool MyApp::OnInit()
|
||||
#endif
|
||||
|
||||
// Create the main application window
|
||||
MyFrame *frame = new MyFrame("HelpDemo wxWindows App",
|
||||
MyFrame *frame = new MyFrame(_T("HelpDemo wxWindows App"),
|
||||
wxPoint(50, 50), wxSize(450, 340));
|
||||
|
||||
#if !USE_SIMPLE_HELP_PROVIDER
|
||||
@ -300,7 +300,7 @@ 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("doc") )
|
||||
if ( !frame->GetHelpController().Initialize(_T("doc")) )
|
||||
{
|
||||
wxLogError(wxT("Cannot initialize the help system, aborting."));
|
||||
|
||||
@ -308,7 +308,7 @@ bool MyApp::OnInit()
|
||||
}
|
||||
|
||||
#if wxUSE_MS_HTML_HELP
|
||||
if( !frame->GetMSHtmlHelpController().Initialize("doc") )
|
||||
if( !frame->GetMSHtmlHelpController().Initialize(_T("doc")) )
|
||||
{
|
||||
wxLogError(wxT("Cannot initialize the MS HTML Help system."));
|
||||
}
|
||||
@ -316,7 +316,7 @@ bool MyApp::OnInit()
|
||||
|
||||
#if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP
|
||||
// you need to call Initialize in order to use wxBestHelpController
|
||||
if( !frame->GetBestHelpController().Initialize("doc") )
|
||||
if( !frame->GetBestHelpController().Initialize(_T("doc")) )
|
||||
{
|
||||
wxLogError(wxT("Cannot initialize the best help system, aborting."));
|
||||
}
|
||||
@ -325,7 +325,7 @@ bool MyApp::OnInit()
|
||||
#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("doc") )
|
||||
if ( !frame->GetAdvancedHtmlHelpController().Initialize(_T("doc")) )
|
||||
{
|
||||
wxLogError(wxT("Cannot initialize the advanced HTML help system, aborting."));
|
||||
|
||||
@ -336,7 +336,7 @@ bool MyApp::OnInit()
|
||||
#if 0
|
||||
// defined(__WXMSW__) && wxUSE_MS_HTML_HELP
|
||||
wxString path(wxGetCwd());
|
||||
if ( !frame->GetMSHtmlHelpController().Initialize(path + "\\doc.chm") )
|
||||
if ( !frame->GetMSHtmlHelpController().Initialize(path + _T("\\doc.chm")) )
|
||||
{
|
||||
wxLogError("Cannot initialize the MS HTML help system, aborting.");
|
||||
|
||||
@ -369,57 +369,57 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
|
||||
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...");
|
||||
menuFile->Append(HelpDemo_Help_Index, _T("&Help Index..."));
|
||||
menuFile->Append(HelpDemo_Help_Classes, _T("&Help on Classes..."));
|
||||
menuFile->Append(HelpDemo_Help_Functions, _T("&Help on Functions..."));
|
||||
menuFile->Append(HelpDemo_Help_ContextHelp, _T("&Context Help..."));
|
||||
menuFile->Append(HelpDemo_Help_DialogContextHelp, _T("&Dialog Context Help...\tCtrl-H"));
|
||||
menuFile->Append(HelpDemo_Help_Help, _T("&About Help Demo..."));
|
||||
menuFile->Append(HelpDemo_Help_Search, _T("&Search help..."));
|
||||
#if USE_HTML_HELP
|
||||
menuFile->AppendSeparator();
|
||||
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_Index, _T("Advanced HTML &Help Index..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Classes, _T("Advanced HTML &Help on Classes..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Functions, _T("Advanced HTML &Help on Functions..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Help, _T("Advanced HTML &About Help Demo..."));
|
||||
menuFile->Append(HelpDemo_Advanced_Html_Help_Search, _T("Advanced HTML &Search help..."));
|
||||
#endif
|
||||
|
||||
#if wxUSE_MS_HTML_HELP
|
||||
menuFile->AppendSeparator();
|
||||
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...");
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Index, _T("MS HTML &Help Index..."));
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Classes, _T("MS HTML &Help on Classes..."));
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Functions, _T("MS HTML &Help on Functions..."));
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Help, _T("MS HTML &About Help Demo..."));
|
||||
menuFile->Append(HelpDemo_MS_Html_Help_Search, _T("MS HTML &Search help..."));
|
||||
#endif
|
||||
|
||||
#if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(HelpDemo_Best_Help_Index, "Best &Help Index...");
|
||||
menuFile->Append(HelpDemo_Best_Help_Index, _T("Best &Help Index..."));
|
||||
#endif
|
||||
|
||||
#ifndef __WXMSW__
|
||||
#if !wxUSE_HTML
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(HelpDemo_Help_KDE, "Use &KDE");
|
||||
menuFile->Append(HelpDemo_Help_GNOME, "Use &GNOME");
|
||||
menuFile->Append(HelpDemo_Help_Netscape, "Use &Netscape");
|
||||
menuFile->Append(HelpDemo_Help_KDE, _T("Use &KDE"));
|
||||
menuFile->Append(HelpDemo_Help_GNOME, _T("Use &GNOME"));
|
||||
menuFile->Append(HelpDemo_Help_Netscape, _T("Use &Netscape"));
|
||||
#endif
|
||||
#endif
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(HelpDemo_Quit, "E&xit");
|
||||
menuFile->Append(HelpDemo_Quit, _T("E&xit"));
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(menuFile, _T("&File"));
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
CreateStatusBar();
|
||||
SetStatusText("Welcome to wxWindows!");
|
||||
SetStatusText(_T("Welcome to wxWindows!"));
|
||||
|
||||
// now create some controls
|
||||
|
||||
@ -430,7 +430,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, "Hello, world!", wxPoint(10, 10));
|
||||
wxStaticText* staticText = new wxStaticText(panel, 302, _T("Hello, world!"), wxPoint(10, 10));
|
||||
staticText->SetHelpText(_("This static text control isn't doing a lot right now."));
|
||||
}
|
||||
|
||||
@ -585,9 +585,9 @@ void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController)
|
||||
case HelpDemo_MS_Html_Help_Search:
|
||||
case HelpDemo_Best_Help_Search:
|
||||
{
|
||||
wxString key = wxGetTextFromUser("Search for?",
|
||||
"Search help for keyword",
|
||||
"",
|
||||
wxString key = wxGetTextFromUser(_T("Search for?"),
|
||||
_T("Search help for keyword"),
|
||||
_T(""),
|
||||
this);
|
||||
if(! key.IsEmpty())
|
||||
helpController.KeywordSearch(key);
|
||||
@ -605,13 +605,13 @@ void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController)
|
||||
// These three calls are only used by wxExtHelpController
|
||||
|
||||
case HelpDemo_Help_KDE:
|
||||
helpController.SetViewer("kdehelp");
|
||||
helpController.SetViewer(_T("kdehelp"));
|
||||
break;
|
||||
case HelpDemo_Help_GNOME:
|
||||
helpController.SetViewer("gnome-help-browser");
|
||||
helpController.SetViewer(_T("gnome-help-browser"));
|
||||
break;
|
||||
case HelpDemo_Help_Netscape:
|
||||
helpController.SetViewer("netscape", wxHELP_NETSCAPE);
|
||||
helpController.SetViewer(_T("netscape"), wxHELP_NETSCAPE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -632,15 +632,15 @@ MyModalDialog::MyModalDialog(wxWindow *parent)
|
||||
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
|
||||
#endif
|
||||
|
||||
wxDialog::Create(parent, -1, wxString("Modal dialog"));
|
||||
wxDialog::Create(parent, -1, wxString(_T("Modal dialog")));
|
||||
|
||||
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxButton* btnOK = new wxButton(this, wxID_OK, "&OK");
|
||||
wxButton* btnOK = new wxButton(this, wxID_OK, _T("&OK"));
|
||||
btnOK->SetHelpText(_("The OK button confirms the dialog choices."));
|
||||
|
||||
wxButton* btnCancel = new wxButton(this, wxID_CANCEL, "&Cancel");
|
||||
wxButton* btnCancel = new wxButton(this, wxID_CANCEL, _T("&Cancel"));
|
||||
btnCancel->SetHelpText(_("The Cancel button cancels the dialog."));
|
||||
|
||||
sizerRow->Add(btnOK, 0, wxALIGN_CENTER | wxALL, 5);
|
||||
|
@ -45,7 +45,7 @@ MyApp::MyApp()
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
// Create the main frame window
|
||||
frame = new MyFrame(NULL, "wxWindows Layout Demo", -1, -1, 400, 300);
|
||||
frame = new MyFrame(NULL, _T("wxWindows Layout Demo"), -1, -1, 400, 300);
|
||||
|
||||
frame->SetAutoLayout(TRUE);
|
||||
|
||||
@ -55,19 +55,19 @@ bool MyApp::OnInit()
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(LAYOUT_TEST_SIZER, "&Test sizers", "Test sizer");
|
||||
file_menu->Append(LAYOUT_TEST_NB, "&Test notebook sizers", "Test notebook sizer");
|
||||
file_menu->Append(LAYOUT_TEST_SIZER, _T("&Test sizers"), _T("Test sizer"));
|
||||
file_menu->Append(LAYOUT_TEST_NB, _T("&Test notebook sizers"), _T("Test notebook sizer"));
|
||||
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(LAYOUT_QUIT, "E&xit", "Quit program");
|
||||
file_menu->Append(LAYOUT_QUIT, _T("E&xit"), _T("Quit program"));
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(LAYOUT_ABOUT, "&About", "About layout demo");
|
||||
help_menu->Append(LAYOUT_ABOUT, _T("&About"), _T("About layout demo"));
|
||||
|
||||
menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
menu_bar->Append(file_menu, _T("&File"));
|
||||
menu_bar->Append(help_menu, _T("&Help"));
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
frame->SetMenuBar(menu_bar);
|
||||
@ -76,7 +76,7 @@ bool MyApp::OnInit()
|
||||
wxPanel *panel = new wxPanel(frame);
|
||||
|
||||
// Create some panel items
|
||||
wxButton *btn1 = new wxButton(panel, -1, "A button (1)") ;
|
||||
wxButton *btn1 = new wxButton(panel, -1, _T("A button (1)")) ;
|
||||
|
||||
wxLayoutConstraints *b1 = new wxLayoutConstraints;
|
||||
b1->centreX.SameAs (panel, wxCentreX);
|
||||
@ -87,11 +87,11 @@ bool MyApp::OnInit()
|
||||
|
||||
wxListBox *list = new wxListBox(panel, -1,
|
||||
wxPoint(-1, -1), wxSize(200, 100));
|
||||
list->Append("Apple");
|
||||
list->Append("Pear");
|
||||
list->Append("Orange");
|
||||
list->Append("Banana");
|
||||
list->Append("Fruit");
|
||||
list->Append(_T("Apple"));
|
||||
list->Append(_T("Pear"));
|
||||
list->Append(_T("Orange"));
|
||||
list->Append(_T("Banana"));
|
||||
list->Append(_T("Fruit"));
|
||||
|
||||
wxLayoutConstraints *b2 = new wxLayoutConstraints;
|
||||
b2->top.Below (btn1, 5);
|
||||
@ -100,7 +100,7 @@ bool MyApp::OnInit()
|
||||
b2->bottom.SameAs (panel, wxBottom, 5);
|
||||
list->SetConstraints(b2);
|
||||
|
||||
wxTextCtrl *mtext = new wxTextCtrl(panel, -1, "Some text");
|
||||
wxTextCtrl *mtext = new wxTextCtrl(panel, -1, _T("Some text"));
|
||||
|
||||
wxLayoutConstraints *b3 = new wxLayoutConstraints;
|
||||
b3->top.Below (btn1, 5);
|
||||
@ -145,7 +145,7 @@ bool MyApp::OnInit()
|
||||
|
||||
frame->Show(TRUE);
|
||||
|
||||
frame->SetStatusText("wxWindows layout demo");
|
||||
frame->SetStatusText(_T("wxWindows layout demo"));
|
||||
|
||||
SetTopWindow(frame);
|
||||
|
||||
@ -157,7 +157,7 @@ bool MyApp::OnInit()
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
// Define my frame constructor
|
||||
MyFrame::MyFrame(wxFrame *frame, const char *title, int x, int y, int w, int h)
|
||||
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h)
|
||||
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
|
||||
{
|
||||
}
|
||||
@ -176,13 +176,13 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
void MyFrame::TestSizers(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
MySizerFrame *newFrame = new MySizerFrame(NULL, "Sizer Test Frame", 50, 50);
|
||||
MySizerFrame *newFrame = new MySizerFrame(NULL, _T("Sizer Test Frame"), 50, 50);
|
||||
newFrame->Show(TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::TestNotebookSizers(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxDialog dialog( this, -1, wxString("Notebook Sizer Test Dialog") );
|
||||
wxDialog dialog( this, -1, wxString(_T("Notebook Sizer Test Dialog")) );
|
||||
|
||||
// Begin with first hierarchy: a notebook at the top and
|
||||
// and OK button at the bottom.
|
||||
@ -193,24 +193,24 @@ void MyFrame::TestNotebookSizers(wxCommandEvent& WXUNUSED(event) )
|
||||
wxNotebookSizer *nbs = new wxNotebookSizer( notebook );
|
||||
topsizer->Add( nbs, 1, wxGROW );
|
||||
|
||||
wxButton *button = new wxButton( &dialog, wxID_OK, "OK" );
|
||||
wxButton *button = new wxButton( &dialog, wxID_OK, _T("OK") );
|
||||
topsizer->Add( button, 0, wxALIGN_RIGHT | wxALL, 10 );
|
||||
|
||||
// First page: one big text ctrl
|
||||
wxTextCtrl *multi = new wxTextCtrl( notebook, -1, "TextCtrl.", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
notebook->AddPage( multi, "Page One" );
|
||||
wxTextCtrl *multi = new wxTextCtrl( notebook, -1, _T("TextCtrl."), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
|
||||
notebook->AddPage( multi, _T("Page One") );
|
||||
|
||||
// Second page: a text ctrl and a button
|
||||
wxPanel *panel = new wxPanel( notebook, -1 );
|
||||
notebook->AddPage( panel, "Page Two" );
|
||||
notebook->AddPage( panel, _T("Page Two") );
|
||||
|
||||
wxSizer *panelsizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxTextCtrl *text = new wxTextCtrl( panel, -1, "TextLine 1.", wxDefaultPosition, wxSize(250,-1) );
|
||||
wxTextCtrl *text = new wxTextCtrl( panel, -1, _T("TextLine 1."), wxDefaultPosition, wxSize(250,-1) );
|
||||
panelsizer->Add( text, 0, wxGROW|wxALL, 30 );
|
||||
text = new wxTextCtrl( panel, -1, "TextLine 2.", wxDefaultPosition, wxSize(250,-1) );
|
||||
text = new wxTextCtrl( panel, -1, _T("TextLine 2."), wxDefaultPosition, wxSize(250,-1) );
|
||||
panelsizer->Add( text, 0, wxGROW|wxALL, 30 );
|
||||
wxButton *button2 = new wxButton( panel, -1, "Hallo" );
|
||||
wxButton *button2 = new wxButton( panel, -1, _T("Hallo") );
|
||||
panelsizer->Add( button2, 0, wxALIGN_RIGHT | wxLEFT|wxRIGHT|wxBOTTOM, 30 );
|
||||
|
||||
panel->SetAutoLayout( TRUE );
|
||||
@ -229,8 +229,8 @@ void MyFrame::TestNotebookSizers(wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
void MyFrame::About(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
(void)wxMessageBox("wxWindows GUI library layout demo\n",
|
||||
"About Layout Demo", wxOK|wxCENTRE);
|
||||
(void)wxMessageBox(_T("wxWindows GUI library layout demo\n"),
|
||||
_T("About Layout Demo"), wxOK|wxCENTRE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
@ -279,7 +279,7 @@ void MyWindow::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
||||
// MySizerFrame
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
MySizerFrame::MySizerFrame(wxFrame *frame, char *title, int x, int y )
|
||||
MySizerFrame::MySizerFrame(wxFrame *frame, wxChar *title, int x, int y )
|
||||
: wxFrame(frame, -1, title, wxPoint(x, y) )
|
||||
{
|
||||
// we want to get a dialog that is stretchable because it
|
||||
@ -290,7 +290,7 @@ MySizerFrame::MySizerFrame(wxFrame *frame, char *title, int x, int y )
|
||||
|
||||
// 1) top: create wxStaticText with minimum size equal to its default size
|
||||
topsizer->Add(
|
||||
new wxStaticText( this, -1, "An explanation (wxALIGN_RIGHT)." ),
|
||||
new wxStaticText( this, -1, _T("An explanation (wxALIGN_RIGHT).") ),
|
||||
0, // make vertically unstretchable
|
||||
wxALIGN_RIGHT | // right align text
|
||||
wxTOP | wxLEFT | wxRIGHT, // make border all around except wxBOTTOM
|
||||
@ -298,7 +298,7 @@ MySizerFrame::MySizerFrame(wxFrame *frame, char *title, int x, int y )
|
||||
|
||||
// 2) top: create wxTextCtrl with minimum size (100x60)
|
||||
topsizer->Add(
|
||||
new wxTextCtrl( this, -1, "My text (wxEXPAND).", wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
|
||||
new wxTextCtrl( this, -1, _T("My text (wxEXPAND)."), wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
|
||||
1, // make vertically stretchable
|
||||
wxEXPAND | // make horizontally stretchable
|
||||
wxALL, // and make border all around
|
||||
@ -306,10 +306,10 @@ MySizerFrame::MySizerFrame(wxFrame *frame, char *title, int x, int y )
|
||||
|
||||
// 2.5) Gratuitous test of wxStaticBoxSizers
|
||||
wxBoxSizer *statsizer = new wxStaticBoxSizer(
|
||||
new wxStaticBox(this, -1, "A wxStaticBoxSizer"),
|
||||
new wxStaticBox(this, -1, _T("A wxStaticBoxSizer")),
|
||||
wxVERTICAL );
|
||||
statsizer->Add(
|
||||
new wxStaticText(this, -1, "And some TEXT inside it"),
|
||||
new wxStaticText(this, -1, _T("And some TEXT inside it")),
|
||||
0,
|
||||
wxCENTER |
|
||||
wxALL,
|
||||
@ -318,17 +318,17 @@ MySizerFrame::MySizerFrame(wxFrame *frame, char *title, int x, int y )
|
||||
|
||||
// 2.7) And a test of wxGridSizer
|
||||
wxGridSizer *gridsizer = new wxGridSizer(2, 5, 5);
|
||||
gridsizer->Add(new wxStaticText(this, -1, "Label"), 0,
|
||||
gridsizer->Add(new wxStaticText(this, -1, _T("Label")), 0,
|
||||
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
|
||||
gridsizer->Add(new wxTextCtrl(this, -1, "Grid sizer demo"), 1,
|
||||
gridsizer->Add(new wxTextCtrl(this, -1, _T("Grid sizer demo")), 1,
|
||||
wxGROW | wxALIGN_CENTER_VERTICAL);
|
||||
gridsizer->Add(new wxStaticText(this, -1, "Another label"), 0,
|
||||
gridsizer->Add(new wxStaticText(this, -1, _T("Another label")), 0,
|
||||
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
|
||||
gridsizer->Add(new wxTextCtrl(this, -1, "More text"), 1,
|
||||
gridsizer->Add(new wxTextCtrl(this, -1, _T("More text")), 1,
|
||||
wxGROW | wxALIGN_CENTER_VERTICAL);
|
||||
gridsizer->Add(new wxStaticText(this, -1, "Final label"), 0,
|
||||
gridsizer->Add(new wxStaticText(this, -1, _T("Final label")), 0,
|
||||
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
|
||||
gridsizer->Add(new wxTextCtrl(this, -1, "And yet more text"), 1,
|
||||
gridsizer->Add(new wxTextCtrl(this, -1, _T("And yet more text")), 1,
|
||||
wxGROW | wxALIGN_CENTER_VERTICAL);
|
||||
topsizer->Add(gridsizer, 1, wxGROW | wxALL, 10);
|
||||
|
||||
@ -345,12 +345,12 @@ MySizerFrame::MySizerFrame(wxFrame *frame, char *title, int x, int y )
|
||||
// 4) bottom: create two centred wxButtons
|
||||
wxBoxSizer *button_box = new wxBoxSizer( wxHORIZONTAL );
|
||||
button_box->Add(
|
||||
new wxButton( this, -1, "Two buttons in a box" ),
|
||||
new wxButton( this, -1, _T("Two buttons in a box") ),
|
||||
0, // make horizontally unstretchable
|
||||
wxALL, // make border all around
|
||||
7 ); // set border width to 7
|
||||
button_box->Add(
|
||||
new wxButton( this, -1, "(wxCENTER)" ),
|
||||
new wxButton( this, -1, _T("(wxCENTER)") ),
|
||||
0, // make horizontally unstretchable
|
||||
wxALL, // make border all around
|
||||
7 ); // set border width to 7
|
||||
|
@ -24,7 +24,7 @@ class MyWindow;
|
||||
class MyFrame: public wxFrame
|
||||
{
|
||||
public:
|
||||
MyFrame(wxFrame *frame, const char *title, int x, int y, int w, int h);
|
||||
MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h);
|
||||
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
|
||||
@ -42,7 +42,7 @@ class MyTextWindow: public wxTextCtrl
|
||||
public:
|
||||
MyTextWindow(wxFrame *frame, int x=-1, int y=-1, int width=-1, int height=-1,
|
||||
long style=wxTE_MULTILINE):
|
||||
wxTextCtrl(frame, -1, "", wxPoint(x, y), wxSize(width, height), style)
|
||||
wxTextCtrl(frame, -1, _T(""), wxPoint(x, y), wxSize(width, height), style)
|
||||
{
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class MySizerFrame: public wxFrame
|
||||
{
|
||||
public:
|
||||
wxPanel *panel;
|
||||
MySizerFrame(wxFrame *frame, char *title, int x, int y );
|
||||
MySizerFrame(wxFrame *frame, wxChar *title, int x, int y );
|
||||
};
|
||||
|
||||
#define LAYOUT_QUIT 100
|
||||
|
@ -151,17 +151,17 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
|
||||
m_imageListSmall = new wxImageList(16, 16, TRUE);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
m_imageListNormal->Add( wxIcon("icon1", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon("icon2", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon("icon3", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon("icon4", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon("icon5", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon("icon6", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon("icon7", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon("icon8", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon("icon9", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon(_T("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon(_T("icon2"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon(_T("icon3"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon(_T("icon4"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon(_T("icon5"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon(_T("icon6"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon(_T("icon7"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon(_T("icon8"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListNormal->Add( wxIcon(_T("icon9"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
|
||||
m_imageListSmall->Add( wxIcon("iconsmall", wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
m_imageListSmall->Add( wxIcon(_T("iconsmall"), wxBITMAP_TYPE_ICO_RESOURCE) );
|
||||
|
||||
#else
|
||||
m_imageListNormal->Add( wxIcon( toolbrai_xpm ) );
|
||||
|
@ -109,21 +109,21 @@ bool MyApp::OnInit()
|
||||
{
|
||||
// Create the main frame window
|
||||
|
||||
frame = new MyFrame((wxFrame *)NULL, -1, "MDI Demo",
|
||||
frame = new MyFrame((wxFrame *)NULL, -1, _T("MDI Demo"),
|
||||
wxPoint(-1, -1), wxSize(500, 400),
|
||||
wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
|
||||
#ifdef __WXMSW__
|
||||
#if 0
|
||||
// Experimental: change the window menu
|
||||
wxMenu* windowMenu = new wxMenu;
|
||||
windowMenu->Append(5000, "My menu item!");
|
||||
windowMenu->Append(5000, _T("My menu item!"));
|
||||
frame->SetWindowMenu(windowMenu);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Give it an icon
|
||||
#ifdef __WXMSW__
|
||||
frame->SetIcon(wxIcon("mdi_icn"));
|
||||
frame->SetIcon(wxIcon(_T("mdi_icn")));
|
||||
#else
|
||||
frame->SetIcon(wxIcon( mondrian_xpm ));
|
||||
#endif
|
||||
@ -131,16 +131,16 @@ bool MyApp::OnInit()
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(MDI_NEW_WINDOW, "&New window\tCtrl-N", "Create a new child window");
|
||||
file_menu->Append(MDI_QUIT, "&Exit\tAlt-X", "Quit the program");
|
||||
file_menu->Append(MDI_NEW_WINDOW, _T("&New window\tCtrl-N"), _T("Create a new child window"));
|
||||
file_menu->Append(MDI_QUIT, _T("&Exit\tAlt-X"), _T("Quit the program"));
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(MDI_ABOUT, "&About\tF1");
|
||||
help_menu->Append(MDI_ABOUT, _T("&About\tF1"));
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
menu_bar->Append(file_menu, _T("&File"));
|
||||
menu_bar->Append(help_menu, _T("&Help"));
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
frame->SetMenuBar(menu_bar);
|
||||
@ -168,7 +168,7 @@ MyFrame::MyFrame(wxWindow *parent,
|
||||
: wxMDIParentFrame(parent, id, title, pos, size,
|
||||
style | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||
{
|
||||
textWindow = new wxTextCtrl(this, -1, "A help window",
|
||||
textWindow = new wxTextCtrl(this, -1, _T("A help window"),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE | wxSUNKEN_BORDER);
|
||||
|
||||
@ -190,7 +190,7 @@ void MyFrame::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf(_T("%d windows still open, close anyhow?"), gs_nFrames);
|
||||
if ( wxMessageBox(msg, "Please confirm",
|
||||
if ( wxMessageBox(msg, _T("Please confirm"),
|
||||
wxICON_QUESTION | wxYES_NO) != wxYES )
|
||||
{
|
||||
event.Veto();
|
||||
@ -209,15 +209,15 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
(void)wxMessageBox("wxWindows 2.0 MDI Demo\n"
|
||||
"Author: Julian Smart (c) 1997\n"
|
||||
"Usage: mdi.exe", "About MDI Demo");
|
||||
(void)wxMessageBox(_T("wxWindows 2.0 MDI Demo\n")
|
||||
_T("Author: Julian Smart (c) 1997\n")
|
||||
_T("Usage: mdi.exe"), _T("About MDI Demo"));
|
||||
}
|
||||
|
||||
void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
// Make another frame, containing a canvas
|
||||
MyChild *subframe = new MyChild(frame, "Canvas Frame",
|
||||
MyChild *subframe = new MyChild(frame, _T("Canvas Frame"),
|
||||
wxPoint(-1, -1), wxSize(-1, -1),
|
||||
wxDEFAULT_FRAME_STYLE);
|
||||
|
||||
@ -228,7 +228,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
// Give it an icon
|
||||
#ifdef __WXMSW__
|
||||
subframe->SetIcon(wxIcon("chrt_icn"));
|
||||
subframe->SetIcon(wxIcon(_T("chrt_icn")));
|
||||
#else
|
||||
subframe->SetIcon(wxIcon( mondrian_xpm ));
|
||||
#endif
|
||||
@ -236,26 +236,26 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
||||
file_menu->Append(MDI_NEW_WINDOW, "&New window");
|
||||
file_menu->Append(MDI_CHILD_QUIT, "&Close child", "Close this window");
|
||||
file_menu->Append(MDI_QUIT, "&Exit");
|
||||
file_menu->Append(MDI_NEW_WINDOW, _T("&New window"));
|
||||
file_menu->Append(MDI_CHILD_QUIT, _T("&Close child"), _T("Close this window"));
|
||||
file_menu->Append(MDI_QUIT, _T("&Exit"));
|
||||
|
||||
wxMenu *option_menu = new wxMenu;
|
||||
|
||||
option_menu->Append(MDI_REFRESH, "&Refresh picture");
|
||||
option_menu->Append(MDI_CHANGE_TITLE, "Change &title...\tCtrl-T");
|
||||
option_menu->Append(MDI_REFRESH, _T("&Refresh picture"));
|
||||
option_menu->Append(MDI_CHANGE_TITLE, _T("Change &title...\tCtrl-T"));
|
||||
option_menu->AppendSeparator();
|
||||
option_menu->Append(MDI_CHANGE_POSITION, "Move frame\tCtrl-M");
|
||||
option_menu->Append(MDI_CHANGE_SIZE, "Resize frame\tCtrl-S");
|
||||
option_menu->Append(MDI_CHANGE_POSITION, _T("Move frame\tCtrl-M"));
|
||||
option_menu->Append(MDI_CHANGE_SIZE, _T("Resize frame\tCtrl-S"));
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(MDI_ABOUT, "&About");
|
||||
help_menu->Append(MDI_ABOUT, _T("&About"));
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(option_menu, "&Child");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
menu_bar->Append(file_menu, _T("&File"));
|
||||
menu_bar->Append(option_menu, _T("&Child"));
|
||||
menu_bar->Append(help_menu, _T("&Help"));
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
subframe->SetMenuBar(menu_bar);
|
||||
@ -307,24 +307,24 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
|
||||
int width = 24;
|
||||
int currentX = 5;
|
||||
|
||||
toolBar->AddTool( MDI_NEW_WINDOW, *(bitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New file");
|
||||
toolBar->AddTool( MDI_NEW_WINDOW, *(bitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("New file"));
|
||||
currentX += width + 5;
|
||||
toolBar->AddTool(1, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open file");
|
||||
toolBar->AddTool(1, *bitmaps[1], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Open file"));
|
||||
currentX += width + 5;
|
||||
toolBar->AddTool(2, *bitmaps[2], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Save file");
|
||||
toolBar->AddTool(2, *bitmaps[2], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Save file"));
|
||||
currentX += width + 5;
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(3, *bitmaps[3], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Copy");
|
||||
toolBar->AddTool(3, *bitmaps[3], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Copy"));
|
||||
currentX += width + 5;
|
||||
toolBar->AddTool(4, *bitmaps[4], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Cut");
|
||||
toolBar->AddTool(4, *bitmaps[4], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Cut"));
|
||||
currentX += width + 5;
|
||||
toolBar->AddTool(5, *bitmaps[5], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste");
|
||||
toolBar->AddTool(5, *bitmaps[5], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Paste"));
|
||||
currentX += width + 5;
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(6, *bitmaps[6], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Print");
|
||||
toolBar->AddTool(6, *bitmaps[6], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Print"));
|
||||
currentX += width + 5;
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(7, *bitmaps[7], wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Help");
|
||||
toolBar->AddTool(7, *bitmaps[7], wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, _T("Help"));
|
||||
|
||||
toolBar->Realize();
|
||||
|
||||
@ -344,7 +344,7 @@ MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
|
||||
wxNO_FULL_REPAINT_ON_RESIZE |
|
||||
wxVSCROLL | wxHSCROLL)
|
||||
{
|
||||
SetBackgroundColour(wxColour("WHITE"));
|
||||
SetBackgroundColour(wxColour(_T("WHITE")));
|
||||
|
||||
m_dirty = FALSE;
|
||||
}
|
||||
@ -367,7 +367,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("This is a test string", 50, 230);
|
||||
dc.DrawText(_T("This is a test string"), 50, 230);
|
||||
|
||||
wxPoint points[3];
|
||||
points[0].x = 200; points[0].y = 300;
|
||||
@ -495,7 +495,7 @@ void MyChild::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
if ( canvas && canvas->IsDirty() )
|
||||
{
|
||||
if ( wxMessageBox("Really close?", "Please confirm",
|
||||
if ( wxMessageBox(_T("Really close?"), _T("Please confirm"),
|
||||
wxICON_QUESTION | wxYES_NO) != wxYES )
|
||||
{
|
||||
event.Veto();
|
||||
|
@ -280,7 +280,7 @@ bool MyApp::OnInit()
|
||||
frame->Show(TRUE);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
frame->SetStatusText("Welcome to wxWindows menu sample");
|
||||
frame->SetStatusText(_T("Welcome to wxWindows menu sample"));
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
SetTopWindow(frame);
|
||||
@ -294,7 +294,7 @@ bool MyApp::OnInit()
|
||||
|
||||
// Define my frame constructor
|
||||
MyFrame::MyFrame()
|
||||
: wxFrame((wxFrame *)NULL, -1, "wxWindows menu sample",
|
||||
: wxFrame((wxFrame *)NULL, -1, _T("wxWindows menu sample"),
|
||||
wxDefaultPosition, wxSize(400, 250))
|
||||
{
|
||||
m_textctrl = NULL;
|
||||
@ -310,78 +310,73 @@ MyFrame::MyFrame()
|
||||
wxMenu *fileMenu = new wxMenu;
|
||||
|
||||
wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog,
|
||||
"Clear &log\tCtrl-L");
|
||||
_T("Clear &log\tCtrl-L"));
|
||||
item->SetBitmap(copy_xpm);
|
||||
fileMenu->Append(item);
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->Append(Menu_File_Quit, "E&xit\tAlt-X", "Quit menu sample");
|
||||
fileMenu->Append(Menu_File_Quit, _T("E&xit\tAlt-X"), _T("Quit menu sample"));
|
||||
|
||||
wxMenu *menubarMenu = new wxMenu;
|
||||
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->Append(Menu_MenuBar_Append, _T("&Append menu\tCtrl-A"),
|
||||
_T("Append a menu to the menubar"));
|
||||
menubarMenu->Append(Menu_MenuBar_Insert, _T("&Insert menu\tCtrl-I"),
|
||||
_T("Insert a menu into the menubar"));
|
||||
menubarMenu->Append(Menu_MenuBar_Delete, _T("&Delete menu\tCtrl-D"),
|
||||
_T("Delete the last menu from the menubar"));
|
||||
menubarMenu->Append(Menu_MenuBar_Toggle, _T("&Toggle menu\tCtrl-T"),
|
||||
_T("Toggle the first menu in the menubar"), TRUE);
|
||||
menubarMenu->AppendSeparator();
|
||||
menubarMenu->Append(Menu_MenuBar_Enable, "&Enable menu\tCtrl-E",
|
||||
"Enable or disable the last menu", TRUE);
|
||||
menubarMenu->Append(Menu_MenuBar_Enable, _T("&Enable menu\tCtrl-E"),
|
||||
_T("Enable or disable the last menu"), TRUE);
|
||||
menubarMenu->AppendSeparator();
|
||||
menubarMenu->Append(Menu_MenuBar_GetLabel, "&Get menu label\tCtrl-G",
|
||||
"Get the label of the last menu");
|
||||
menubarMenu->Append(Menu_MenuBar_SetLabel, "&Set menu label\tCtrl-S",
|
||||
"Change the label of the last menu");
|
||||
menubarMenu->Append(Menu_MenuBar_GetLabel, _T("&Get menu label\tCtrl-G"),
|
||||
_T("Get the label of the last menu"));
|
||||
menubarMenu->Append(Menu_MenuBar_SetLabel, _T("&Set menu label\tCtrl-S"),
|
||||
_T("Change the label of the last menu"));
|
||||
menubarMenu->AppendSeparator();
|
||||
menubarMenu->Append(Menu_MenuBar_FindMenu, "&Find menu from label\tCtrl-F",
|
||||
"Find a menu by searching for its label");
|
||||
menubarMenu->Append(Menu_MenuBar_FindMenu, _T("&Find menu from label\tCtrl-F"),
|
||||
_T("Find a menu by searching for its label"));
|
||||
|
||||
wxMenu *menuMenu = new wxMenu;
|
||||
menuMenu->Append(Menu_Menu_Append, "&Append menu item\tAlt-A",
|
||||
"Append a menu item to the last menu");
|
||||
menuMenu->Append(Menu_Menu_AppendSub, "&Append sub menu\tAlt-S",
|
||||
"Append a sub menu to the last menu");
|
||||
menuMenu->Append(Menu_Menu_Insert, "&Insert menu item\tAlt-I",
|
||||
"Insert a menu item in head of the last menu");
|
||||
menuMenu->Append(Menu_Menu_Delete, "&Delete menu item\tAlt-D",
|
||||
"Delete the last menu item from the last menu");
|
||||
menuMenu->Append(Menu_Menu_Append, _T("&Append menu item\tAlt-A"),
|
||||
_T("Append a menu item to the last menu"));
|
||||
menuMenu->Append(Menu_Menu_AppendSub, _T("&Append sub menu\tAlt-S"),
|
||||
_T("Append a sub menu to the last menu"));
|
||||
menuMenu->Append(Menu_Menu_Insert, _T("&Insert menu item\tAlt-I"),
|
||||
_T("Insert a menu item in head of the last menu"));
|
||||
menuMenu->Append(Menu_Menu_Delete, _T("&Delete menu item\tAlt-D"),
|
||||
_T("Delete the last menu item from the last menu"));
|
||||
menuMenu->AppendSeparator();
|
||||
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->Append(Menu_Menu_Enable, _T("&Enable menu item\tAlt-E"),
|
||||
_T("Enable or disable the last menu item"), TRUE);
|
||||
menuMenu->Append(Menu_Menu_Check, _T("&Check menu item\tAlt-C"),
|
||||
_T("Check or uncheck the last menu item"), TRUE);
|
||||
menuMenu->AppendSeparator();
|
||||
menuMenu->Append(Menu_Menu_GetLabel, "&Get menu item label\tAlt-G",
|
||||
"Get the label of the last menu item");
|
||||
menuMenu->Append(Menu_Menu_SetLabel, "&Set menu item label\tAlt-S",
|
||||
"Change the label of the last menu item");
|
||||
menuMenu->Append(Menu_Menu_GetInfo, _T("Get menu item in&fo\tAlt-F"),
|
||||
_T("Show the state of the last menu item"));
|
||||
menuMenu->AppendSeparator();
|
||||
menuMenu->Append(Menu_Menu_GetInfo, "Get menu item in&fo\tAlt-F",
|
||||
"Show the state of the last menu item");
|
||||
menuMenu->AppendSeparator();
|
||||
menuMenu->Append(Menu_Menu_FindItem, "Find menu item from label",
|
||||
"Find a menu item by searching for its label");
|
||||
menuMenu->Append(Menu_Menu_FindItem, _T("Find menu item from label"),
|
||||
_T("Find a menu item by searching for its label"));
|
||||
|
||||
wxMenu *testMenu = new wxMenu;
|
||||
testMenu->Append(Menu_Test_Normal, "&Normal item");
|
||||
testMenu->Append(Menu_Test_Normal, _T("&Normal item"));
|
||||
testMenu->AppendSeparator();
|
||||
testMenu->AppendCheckItem(Menu_Test_Check, "&Check item");
|
||||
testMenu->AppendCheckItem(Menu_Test_Check, _T("&Check item"));
|
||||
testMenu->AppendSeparator();
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio1, "Radio item &1");
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio2, "Radio item &2");
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio3, "Radio item &3");
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio1, _T("Radio item &1"));
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio2, _T("Radio item &2"));
|
||||
testMenu->AppendRadioItem(Menu_Test_Radio3, _T("Radio item &3"));
|
||||
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(Menu_Help_About, "&About\tF1", "About menu sample");
|
||||
helpMenu->Append(Menu_Help_About, _T("&About\tF1"), _T("About menu sample"));
|
||||
|
||||
wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE );
|
||||
|
||||
menuBar->Append(fileMenu, "&File");
|
||||
menuBar->Append(menubarMenu, "Menu&bar");
|
||||
menuBar->Append(menuMenu, "&Menu");
|
||||
menuBar->Append(testMenu, "&Test");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
menuBar->Append(fileMenu, _T("&File"));
|
||||
menuBar->Append(menubarMenu, _T("Menu&bar"));
|
||||
menuBar->Append(menuMenu, _T("&Menu"));
|
||||
menuBar->Append(testMenu, _T("&Test"));
|
||||
menuBar->Append(helpMenu, _T("&Help"));
|
||||
|
||||
// these items should be initially checked
|
||||
menuBar->Check(Menu_MenuBar_Toggle, TRUE);
|
||||
@ -425,9 +420,9 @@ MyFrame::~MyFrame()
|
||||
wxMenu *MyFrame::CreateDummyMenu(wxString *title)
|
||||
{
|
||||
wxMenu *menu = new wxMenu;
|
||||
menu->Append(Menu_Dummy_First, "&First item\tCtrl-F1");
|
||||
menu->Append(Menu_Dummy_First, _T("&First item\tCtrl-F1"));
|
||||
menu->AppendSeparator();
|
||||
menu->Append(Menu_Dummy_Second, "&Second item\tCtrl-F2", "", TRUE);
|
||||
menu->Append(Menu_Dummy_Second, _T("&Second item\tCtrl-F2"), _T(""), TRUE);
|
||||
|
||||
if ( title )
|
||||
{
|
||||
@ -487,8 +482,8 @@ void MyFrame::OnClearLog(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
(void)wxMessageBox("wxWindows menu sample\n© 1999-2001 Vadim Zeitlin",
|
||||
"About wxWindows menu sample",
|
||||
(void)wxMessageBox(_T("wxWindows menu sample\n© 1999-2001 Vadim Zeitlin"),
|
||||
_T("About wxWindows menu sample"),
|
||||
wxICON_INFORMATION);
|
||||
}
|
||||
|
||||
@ -533,7 +528,7 @@ void MyFrame::OnToggleMenu(wxCommandEvent& WXUNUSED(event))
|
||||
else
|
||||
{
|
||||
// restore it
|
||||
mbar->Insert(0, m_menu, "&File");
|
||||
mbar->Insert(0, m_menu, _T("&File"));
|
||||
m_menu = NULL;
|
||||
}
|
||||
}
|
||||
@ -619,8 +614,8 @@ void MyFrame::OnAppendMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1);
|
||||
|
||||
menu->AppendSeparator();
|
||||
menu->Append(Menu_Dummy_Third, "&Third dummy item\tCtrl-F3",
|
||||
"Checkable item", TRUE);
|
||||
menu->Append(Menu_Dummy_Third, _T("&Third dummy item\tCtrl-F3"),
|
||||
_T("Checkable item"), TRUE);
|
||||
}
|
||||
|
||||
void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event))
|
||||
@ -629,8 +624,8 @@ void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1);
|
||||
|
||||
menu->Append(Menu_Dummy_Last, "&Dummy sub menu",
|
||||
CreateDummyMenu(NULL), "Dummy sub menu help");
|
||||
menu->Append(Menu_Dummy_Last, _T("&Dummy sub menu"),
|
||||
CreateDummyMenu(NULL), _T("Dummy sub menu help"));
|
||||
}
|
||||
|
||||
void MyFrame::OnDeleteMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
@ -655,8 +650,8 @@ void MyFrame::OnInsertMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1);
|
||||
|
||||
menu->Insert(0, wxMenuItem::New(menu, Menu_Dummy_Fourth,
|
||||
"Fourth dummy item\tCtrl-F4"));
|
||||
menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR, ""));
|
||||
_T("Fourth dummy item\tCtrl-F4")));
|
||||
menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR, _T("")));
|
||||
}
|
||||
|
||||
void MyFrame::OnEnableMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
@ -724,21 +719,21 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
|
||||
if ( item )
|
||||
{
|
||||
wxString msg;
|
||||
msg << "The item is " << (item->IsEnabled() ? "enabled"
|
||||
: "disabled")
|
||||
msg << _T("The item is ") << (item->IsEnabled() ? _T("enabled")
|
||||
: _T("disabled"))
|
||||
<< '\n';
|
||||
|
||||
if ( item->IsCheckable() )
|
||||
{
|
||||
msg << "It is checkable and " << (item->IsChecked() ? "" : "un")
|
||||
<< "checked\n";
|
||||
msg << _T("It is checkable and ") << (item->IsChecked() ? _T("") : _T("un"))
|
||||
<< _T("checked\n");
|
||||
}
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
wxAcceleratorEntry *accel = item->GetAccel();
|
||||
if ( accel )
|
||||
{
|
||||
msg << "Its accelerator is ";
|
||||
msg << _T("Its accelerator is ");
|
||||
|
||||
int flags = accel->GetFlags();
|
||||
if ( flags & wxACCEL_ALT )
|
||||
@ -784,7 +779,7 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
else
|
||||
{
|
||||
msg << "It doesn't have an accelerator";
|
||||
msg << _T("It doesn't have an accelerator");
|
||||
}
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
@ -830,15 +825,15 @@ void MyFrame::OnFindMenuItem(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::ShowContextMenu(const wxPoint& pos)
|
||||
{
|
||||
wxMenu menu("Test popup");
|
||||
wxMenu menu(_T("Test popup"));
|
||||
|
||||
menu.Append(Menu_Help_About, "&About");
|
||||
menu.Append(Menu_Popup_Submenu, "&Submenu", CreateDummyMenu(NULL));
|
||||
menu.Append(Menu_Popup_ToBeDeleted, "To be &deleted");
|
||||
menu.Append(Menu_Popup_ToBeChecked, "To be &checked", "", TRUE);
|
||||
menu.Append(Menu_Popup_ToBeGreyed, "To be &greyed");
|
||||
menu.Append(Menu_Help_About, _T("&About"));
|
||||
menu.Append(Menu_Popup_Submenu, _T("&Submenu"), CreateDummyMenu(NULL));
|
||||
menu.Append(Menu_Popup_ToBeDeleted, _T("To be &deleted"));
|
||||
menu.Append(Menu_Popup_ToBeChecked, _T("To be &checked"), _T(""), TRUE);
|
||||
menu.Append(Menu_Popup_ToBeGreyed, _T("To be &greyed"));
|
||||
menu.AppendSeparator();
|
||||
menu.Append(Menu_File_Quit, "E&xit");
|
||||
menu.Append(Menu_File_Quit, _T("E&xit"));
|
||||
|
||||
menu.Delete(Menu_Popup_ToBeDeleted);
|
||||
menu.Check(Menu_Popup_ToBeChecked, TRUE);
|
||||
|
Loading…
Reference in New Issue
Block a user