wxTextOutputStream text_stream( stream );
wxInt32 n = lines.Number();
- text_stream << n << '\n';
+ text_stream << n << _T('\n');
wxNode *node = lines.First();
while (node)
{
DoodleLine *line = (DoodleLine *)node->Data();
- text_stream << line->x1 << " " <<
- line->y1 << " " <<
- line->x2 << " " <<
- line->y2 << "\n";
+ text_stream << line->x1 << _T(" ") <<
+ line->y1 << _T(" ") <<
+ line->x2 << _T(" ") <<
+ line->y2 << _T("\n");
node = node->Next();
}
m_docManager = new wxDocManager;
//// Create a template relating drawing documents to their views
- (void) new wxDocTemplate(m_docManager, "Drawing", "*.drw", "", "drw", "Drawing Doc", "Drawing View",
+ (void) new wxDocTemplate(m_docManager, _T("Drawing"), _T("*.drw"), _T(""), _T("drw"), _T("Drawing Doc"), _T("Drawing View"),
CLASSINFO(DrawingDocument), CLASSINFO(DrawingView));
if (singleWindowMode)
}
else
//// Create a template relating text documents to their views
- (void) new wxDocTemplate(m_docManager, "Text", "*.txt", "", "txt", "Text Doc", "Text View",
+ (void) new wxDocTemplate(m_docManager, _T("Text"), _T("*.txt"), _T(""), _T("txt"), _T("Text Doc"), _T("Text View"),
CLASSINFO(TextEditDocument), CLASSINFO(TextEditView));
//// Create the main frame window
- frame = new MyFrame(m_docManager, (wxFrame *) NULL, -1, "DocView Demo", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
+ frame = new MyFrame(m_docManager, (wxFrame *) NULL, -1, _T("DocView Demo"), wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
//// Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__
- frame->SetIcon(wxIcon("doc_icn"));
+ frame->SetIcon(wxIcon(_T("doc_icn")));
#endif
//// Make a menubar
wxMenu *file_menu = new wxMenu;
wxMenu *edit_menu = (wxMenu *) NULL;
- file_menu->Append(wxID_NEW, "&New...");
- file_menu->Append(wxID_OPEN, "&Open...");
+ file_menu->Append(wxID_NEW, _T("&New..."));
+ file_menu->Append(wxID_OPEN, _T("&Open..."));
if (singleWindowMode)
{
- file_menu->Append(wxID_CLOSE, "&Close");
- file_menu->Append(wxID_SAVE, "&Save");
- file_menu->Append(wxID_SAVEAS, "Save &As...");
+ file_menu->Append(wxID_CLOSE, _T("&Close"));
+ file_menu->Append(wxID_SAVE, _T("&Save"));
+ file_menu->Append(wxID_SAVEAS, _T("Save &As..."));
file_menu->AppendSeparator();
- file_menu->Append(wxID_PRINT, "&Print...");
- file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
- file_menu->Append(wxID_PREVIEW, "Print Pre&view");
+ file_menu->Append(wxID_PRINT, _T("&Print..."));
+ file_menu->Append(wxID_PRINT_SETUP, _T("Print &Setup..."));
+ file_menu->Append(wxID_PREVIEW, _T("Print Pre&view"));
edit_menu = new wxMenu;
- edit_menu->Append(wxID_UNDO, "&Undo");
- edit_menu->Append(wxID_REDO, "&Redo");
+ edit_menu->Append(wxID_UNDO, _T("&Undo"));
+ edit_menu->Append(wxID_REDO, _T("&Redo"));
edit_menu->AppendSeparator();
- edit_menu->Append(DOCVIEW_CUT, "&Cut last segment");
+ edit_menu->Append(DOCVIEW_CUT, _T("&Cut last segment"));
frame->editMenu = edit_menu;
}
file_menu->AppendSeparator();
- file_menu->Append(wxID_EXIT, "E&xit");
+ file_menu->Append(wxID_EXIT, _T("E&xit"));
// A nice touch: a history of files visited. Use this menu.
m_docManager->FileHistoryUseMenu(file_menu);
wxMenu *help_menu = new wxMenu;
- help_menu->Append(DOCVIEW_ABOUT, "&About");
+ help_menu->Append(DOCVIEW_ABOUT, _T("&About"));
wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(file_menu, _T("&File"));
if (edit_menu)
- menu_bar->Append(edit_menu, "&Edit");
- menu_bar->Append(help_menu, "&Help");
+ menu_bar->Append(edit_menu, _T("&Edit"));
+ menu_bar->Append(help_menu, _T("&Help"));
if (singleWindowMode)
frame->canvas = frame->CreateCanvas((wxView *) NULL, frame);
wxFrame *MyApp::CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas)
{
//// Make a child frame
- wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, GetMainFrame(), -1, "Child Frame",
+ wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, GetMainFrame(), -1, _T("Child Frame"),
wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE);
#ifdef __WXMSW__
- subframe->SetIcon(wxString(isCanvas ? "chrt_icn" : "notepad_icn"));
+ subframe->SetIcon(wxString(isCanvas ? _T("chrt_icn") : _T("notepad_icn")));
#endif
//// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(wxID_NEW, "&New...");
- file_menu->Append(wxID_OPEN, "&Open...");
- file_menu->Append(wxID_CLOSE, "&Close");
- file_menu->Append(wxID_SAVE, "&Save");
- file_menu->Append(wxID_SAVEAS, "Save &As...");
+ file_menu->Append(wxID_NEW, _T("&New..."));
+ file_menu->Append(wxID_OPEN, _T("&Open..."));
+ file_menu->Append(wxID_CLOSE, _T("&Close"));
+ file_menu->Append(wxID_SAVE, _T("&Save"));
+ file_menu->Append(wxID_SAVEAS, _T("Save &As..."));
if (isCanvas)
{
file_menu->AppendSeparator();
- file_menu->Append(wxID_PRINT, "&Print...");
- file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
- file_menu->Append(wxID_PREVIEW, "Print Pre&view");
+ file_menu->Append(wxID_PRINT, _T("&Print..."));
+ file_menu->Append(wxID_PRINT_SETUP, _T("Print &Setup..."));
+ file_menu->Append(wxID_PREVIEW, _T("Print Pre&view"));
}
wxMenu *edit_menu = (wxMenu *) NULL;
if (isCanvas)
{
edit_menu = new wxMenu;
- edit_menu->Append(wxID_UNDO, "&Undo");
- edit_menu->Append(wxID_REDO, "&Redo");
+ edit_menu->Append(wxID_UNDO, _T("&Undo"));
+ edit_menu->Append(wxID_REDO, _T("&Redo"));
edit_menu->AppendSeparator();
- edit_menu->Append(DOCVIEW_CUT, "&Cut last segment");
+ edit_menu->Append(DOCVIEW_CUT, _T("&Cut last segment"));
doc->GetCommandProcessor()->SetEditMenu(edit_menu);
}
wxMenu *help_menu = new wxMenu;
- help_menu->Append(DOCVIEW_ABOUT, "&About");
+ help_menu->Append(DOCVIEW_ABOUT, _T("&About"));
wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(file_menu, _T("&File"));
if (isCanvas)
- menu_bar->Append(edit_menu, "&Edit");
- menu_bar->Append(help_menu, "&Help");
+ menu_bar->Append(edit_menu, _T("&Edit"));
+ menu_bar->Append(help_menu, _T("&Help"));
//// Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar);
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{
- (void)wxMessageBox("DocView Demo\nAuthor: Julian Smart\nUsage: docview.exe [-single]", "About DocView");
+ (void)wxMessageBox(_T("DocView Demo\nAuthor: Julian Smart\nUsage: docview.exe [-single]"), _T("About DocView"));
}
// Creates a canvas. Called either from view.cc when a new drawing
{
// Multiple windows
frame = wxGetApp().CreateChildFrame(doc, this, TRUE);
- frame->SetTitle("DrawingView");
+ frame->SetTitle(_T("DrawingView"));
canvas = GetMainFrame()->CreateCanvas(this, frame);
#ifdef __X__
void DrawingView::OnCut(wxCommandEvent& WXUNUSED(event) )
{
DrawingDocument *doc = (DrawingDocument *)GetDocument();
- doc->GetCommandProcessor()->Submit(new DrawingCommand((char *) "Cut Last Segment", DOODLE_CUT, doc, (DoodleSegment *) NULL));
+ doc->GetCommandProcessor()->Submit(new DrawingCommand(_T("Cut Last Segment"), DOODLE_CUT, doc, (DoodleSegment *) NULL));
}
IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView)
int width, height;
frame->GetClientSize(&width, &height);
textsw = new MyTextWindow(this, frame, wxPoint(0, 0), wxSize(width, height), wxTE_MULTILINE);
- frame->SetTitle("TextEditView");
+ frame->SetTitle(_T("TextEditView"));
#ifdef __X__
// X seems to require a forced resize
// We've got a valid segment on mouse left up, so store it.
DrawingDocument *doc = (DrawingDocument *)view->GetDocument();
- doc->GetCommandProcessor()->Submit(new DrawingCommand("Add Segment", DOODLE_ADD, doc, currentSegment));
+ doc->GetCommandProcessor()->Submit(new DrawingCommand(_T("Add Segment"), DOODLE_ADD, doc, currentSegment));
view->GetDocument()->Modify(TRUE);
currentSegment = (DoodleSegment *) NULL;
// Define a constructor for my text subwindow
MyTextWindow::MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style):
- wxTextCtrl(frame, -1, "", pos, size, style)
+ wxTextCtrl(frame, -1, _T(""), pos, size, style)
{
view = v;
}
bool MyApp::OnInit()
{
// Create the main frame window
- MyFrame* frame = new MyFrame(NULL, "Tree Test", wxPoint(-1, -1), wxSize(400, 550));
+ MyFrame* frame = new MyFrame(NULL, _T("Tree Test"), wxPoint(-1, -1), wxSize(400, 550));
// Give it a status line
frame->CreateStatusBar(2);
// Give it an icon
#ifdef __WINDOWS__
- wxIcon icon("tree_icn");
+ wxIcon icon(_T("tree_icn"));
frame->SetIcon(icon);
#endif
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(TEST_LEFT_RIGHT, "&Left to right", "Redraw left to right");
- file_menu->Append(TEST_TOP_BOTTOM, "&Top to bottom", "Redraw top to bottom");
+ file_menu->Append(TEST_LEFT_RIGHT, _T("&Left to right"), _T("Redraw left to right"));
+ file_menu->Append(TEST_TOP_BOTTOM, _T("&Top to bottom"), _T("Redraw top to bottom"));
file_menu->AppendSeparator();
- file_menu->Append(TEST_QUIT, "E&xit", "Quit program");
+ file_menu->Append(TEST_QUIT, _T("E&xit"), _T("Quit program"));
wxMenu *help_menu = new wxMenu;
- help_menu->Append(TEST_ABOUT, "&About", "About Tree Test");
+ help_menu->Append(TEST_ABOUT, _T("&About"), _T("About Tree Test"));
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);
frame->Show(TRUE);
- frame->SetStatusText("Hello, tree!");
+ frame->SetStatusText(_T("Hello, tree!"));
// Return the main frame window
return TRUE;
{
tree.Initialize(200);
- tree.AddChild("animal");
- tree.AddChild("mammal", "animal");
- tree.AddChild("insect", "animal");
- tree.AddChild("bird", "animal");
-
- tree.AddChild("man", "mammal");
- tree.AddChild("cat", "mammal");
- tree.AddChild("dog", "mammal");
- tree.AddChild("giraffe", "mammal");
- tree.AddChild("elephant", "mammal");
- tree.AddChild("donkey", "mammal");
- tree.AddChild("horse", "mammal");
-
- tree.AddChild("fido", "dog");
- tree.AddChild("domestic cat", "cat");
- tree.AddChild("lion", "cat");
- tree.AddChild("tiger", "cat");
- tree.AddChild("felix", "domestic cat");
- tree.AddChild("socks", "domestic cat");
-
- tree.AddChild("beetle", "insect");
- tree.AddChild("earwig", "insect");
- tree.AddChild("eagle", "bird");
- tree.AddChild("bluetit", "bird");
- tree.AddChild("sparrow", "bird");
- tree.AddChild("blackbird", "bird");
- tree.AddChild("emu", "bird");
- tree.AddChild("crow", "bird");
+ tree.AddChild(_T("animal"));
+ tree.AddChild(_T("mammal"), _T("animal"));
+ tree.AddChild(_T("insect"), _T("animal"));
+ tree.AddChild(_T("bird"), _T("animal"));
+
+ tree.AddChild(_T("man"), _T("mammal"));
+ tree.AddChild(_T("cat"), _T("mammal"));
+ tree.AddChild(_T("dog"), _T("mammal"));
+ tree.AddChild(_T("giraffe"), _T("mammal"));
+ tree.AddChild(_T("elephant"), _T("mammal"));
+ tree.AddChild(_T("donkey"), _T("mammal"));
+ tree.AddChild(_T("horse"), _T("mammal"));
+
+ tree.AddChild(_T("fido"), _T("dog"));
+ tree.AddChild(_T("domestic cat"), _T("cat"));
+ tree.AddChild(_T("lion"), _T("cat"));
+ tree.AddChild(_T("tiger"), _T("cat"));
+ tree.AddChild(_T("felix"), _T("domestic cat"));
+ tree.AddChild(_T("socks"), _T("domestic cat"));
+
+ tree.AddChild(_T("beetle"), _T("insect"));
+ tree.AddChild(_T("earwig"), _T("insect"));
+ tree.AddChild(_T("eagle"), _T("bird"));
+ tree.AddChild(_T("bluetit"), _T("bird"));
+ tree.AddChild(_T("sparrow"), _T("bird"));
+ tree.AddChild(_T("blackbird"), _T("bird"));
+ tree.AddChild(_T("emu"), _T("bird"));
+ tree.AddChild(_T("crow"), _T("bird"));
tree.DoLayout(dc);
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
- (void)wxMessageBox("wxWindows tree library demo Vsn 2.0\nAuthor: Julian Smart (c) 1998", "About tree test");
+ (void)wxMessageBox(_T("wxWindows tree library demo Vsn 2.0\nAuthor: Julian Smart (c) 1998"), _T("About tree test"));
}
void MyFrame::OnCloseWindow(wxCloseEvent& event)
bool MyApp::OnInit()
{
// Create the main frame window
- MyFrame *frame = new MyFrame((wxFrame *) NULL, "Validation Test", 50, 50, 300, 250);
+ MyFrame *frame = new MyFrame((wxFrame *) NULL, _T("Validation Test"), 50, 50, 300, 250);
// Show the frame
frame->Show(TRUE);
}
// 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))
{
// Give it an icon
#ifdef __WXMSW__
- SetIcon(wxIcon("mondrian"));
+ SetIcon(wxIcon(_T("mondrian")));
#endif
#ifdef __X__
- SetIcon(wxIcon("aiai.xbm"));
+ SetIcon(wxIcon(_T("aiai.xbm")));
#endif
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(VALIDATE_TEST_DIALOG, "&Test dialog", "Show example dialog");
- file_menu->Append(VALIDATE_SILENT, "&Bell on error", "Toggle bell on error", TRUE);
+ file_menu->Append(VALIDATE_TEST_DIALOG, _T("&Test dialog"), _T("Show example dialog"));
+ file_menu->Append(VALIDATE_SILENT, _T("&Bell on error"), _T("Toggle bell on error"), TRUE);
file_menu->AppendSeparator();
- file_menu->Append(wxID_EXIT, "E&xit");
+ file_menu->Append(wxID_EXIT, _T("E&xit"));
file_menu->Check(VALIDATE_SILENT, !wxValidator::IsSilent());
wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "File");
+ menu_bar->Append(file_menu, _T("File"));
SetMenuBar(menu_bar);
CreateStatusBar(1);
void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event))
{
- MyDialog dialog(this, "Validation test dialog", wxPoint(100, 100), wxSize(340, 170));
+ MyDialog dialog(this, _T("Validation test dialog"), wxPoint(100, 100), wxSize(340, 170));
dialog.ShowModal();
}
const wxPoint& pos, const wxSize& size, const long WXUNUSED(style) ) :
wxDialog(parent, VALIDATE_DIALOG_ID, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
{
- wxButton *but1 = new wxButton(this, wxID_OK, "OK", wxPoint(250, 10), wxSize(80, 30));
- (void)new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(250, 60), wxSize(80, 30));
+ wxButton *but1 = new wxButton(this, wxID_OK, _T("OK"), wxPoint(250, 10), wxSize(80, 30));
+ (void)new wxButton(this, wxID_CANCEL, _T("Cancel"), wxPoint(250, 60), wxSize(80, 30));
- (void)new wxTextCtrl(this, VALIDATE_TEXT, "",
+ (void)new wxTextCtrl(this, VALIDATE_TEXT, _T(""),
wxPoint(10, 10), wxSize(120, -1), 0, wxTextValidator(wxFILTER_ALPHA, &g_data.m_string));
SetBackgroundColour(wxColour(0,0,255));
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);
void OnTestDialog(wxCommandEvent& event);
public:
wxString m_string;
- MyData() { m_string = "My string"; }
+ MyData() { m_string = _T("My string"); }
};
#define VALIDATE_DIALOG_ID 200