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:
@@ -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
|
||||
|
Reference in New Issue
Block a user