wxString service = IPC_SERVICE;
// ignored under DDE, host name in TCP/IP based classes
- wxString hostName = "localhost";
+ wxString hostName = _T("localhost");
if (argc > 1)
service = argv[1];
while ( !the_connection )
{
- if ( wxMessageBox("Failed to make connection to server.\nRetry?",
- "Client Demo Error",
+ if ( wxMessageBox(_T("Failed to make connection to server.\nRetry?"),
+ _T("Client Demo Error"),
wxICON_ERROR | wxYES_NO | wxCANCEL ) != wxYES )
{
// no server
return FALSE;
}
- the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, "IPC TEST");
+ the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, _T("IPC TEST"));
}
}
if (!the_connection->StartAdvise(IPC_ADVISE_NAME))
- wxMessageBox("StartAdvise failed", "Client Demo Error");
+ wxMessageBox(_T("StartAdvise failed"), _T("Client Demo Error"));
// Create the main frame window
- (new MyFrame(NULL, "Client"))->Show(TRUE);
+ (new MyFrame(NULL, _T("Client")))->Show(TRUE);
return TRUE;
}
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(CLIENT_EXECUTE, "&Execute\tCtrl-E");
- file_menu->Append(CLIENT_REQUEST, "&Request\tCtrl-R");
- file_menu->Append(CLIENT_POKE, "&Poke\tCtrl-P");
- file_menu->Append(CLIENT_QUIT, "&Quit\tCtrl-Q");
+ file_menu->Append(CLIENT_EXECUTE, _T("&Execute\tCtrl-E"));
+ file_menu->Append(CLIENT_REQUEST, _T("&Request\tCtrl-R"));
+ file_menu->Append(CLIENT_POKE, _T("&Poke\tCtrl-P"));
+ file_menu->Append(CLIENT_QUIT, _T("&Quit\tCtrl-Q"));
wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(file_menu, _T("&File"));
// Associate the menu bar with the frame
SetMenuBar(menu_bar);
// Make a listbox which shows the choices made in the server
the_list = new wxListBox(this, CLIENT_LISTBOX, wxPoint(5, 5));
- the_list->Append("Apple");
- the_list->Append("Pear");
- the_list->Append("Orange");
- the_list->Append("Banana");
- the_list->Append("Fruit");
+ the_list->Append(_T("Apple"));
+ the_list->Append(_T("Pear"));
+ the_list->Append(_T("Orange"));
+ the_list->Append(_T("Banana"));
+ the_list->Append(_T("Fruit"));
}
void MyFrame::OnExecute(wxCommandEvent& event)
{
if (the_connection)
- if (!the_connection->Execute("Hello from the client!"))
- wxMessageBox("Execute failed", "Client Demo Error");
+ if (!the_connection->Execute(_T("Hello from the client!")))
+ wxMessageBox(_T("Execute failed"), _T("Client Demo Error"));
}
void MyFrame::OnPoke(wxCommandEvent& event)
{
if (the_connection)
- if (!the_connection->Poke("An item", "Some data to poke at the server!"))
- wxMessageBox("Poke failed", "Client Demo Error");
+ if (!the_connection->Poke(_T("An item"), _T("Some data to poke at the server!")))
+ wxMessageBox(_T("Poke failed"), _T("Client Demo Error"));
}
void MyFrame::OnRequest(wxCommandEvent& event)
{
if (the_connection)
{
- char *data = the_connection->Request("An item");
+ wxChar *data = the_connection->Request(_T("An item"));
if (data)
- wxMessageBox(data, "Client: Request", wxOK);
+ wxMessageBox(data, _T("Client: Request"), wxOK);
else
- wxMessageBox("Request failed", "Client Demo Error");
+ wxMessageBox(_T("Request failed"), _T("Client Demo Error"));
}
}
return new MyConnection;
}
-bool MyConnection::OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format)
+bool MyConnection::OnAdvise(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format)
{
if (the_list)
{
class MyConnection: public wxConnection
{
public:
- bool OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
+ bool OnAdvise(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format);
bool OnDisconnect();
};
#include <wx/ipc.h>
// the default service name
-#define IPC_SERVICE "4242"
+#define IPC_SERVICE _T("4242")
// the IPC topic
-#define IPC_TOPIC "IPC TEST"
+#define IPC_TOPIC _T("IPC TEST")
// the name of the item we're being advised about
-#define IPC_ADVISE_NAME "Item"
+#define IPC_ADVISE_NAME _T("Item")
bool MyApp::OnInit()
{
// Create the main frame window
- (new MyFrame(NULL, "Server"))->Show(TRUE);
+ (new MyFrame(NULL, _T("Server")))->Show(TRUE);
// service name (DDE classes) or port number (TCP/IP based classes)
wxString service = IPC_SERVICE;
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(SERVER_EXIT, "&Quit\tCtrl-Q");
+ file_menu->Append(SERVER_EXIT, _T("&Quit\tCtrl-Q"));
wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(file_menu, _T("&File"));
// Associate the menu bar with the frame
SetMenuBar(menu_bar);
// Make a listbox
wxListBox *list = new wxListBox(this, SERVER_LISTBOX, wxPoint(5, 5));
- 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"));
}
// Set the client process's listbox to this item
one connection can receive advise messages */
if (the_connection)
{
- the_connection->Advise(IPC_ADVISE_NAME, (wxChar *)value.c_str());
+ the_connection->Advise(IPC_ADVISE_NAME, (wxChar*)value.c_str());
}
}
}
: wxDialog(parent, -1, title, pos, size)
{
m_connection = connection;
- (void)new wxButton(this, SERVER_QUIT_BUTTON, "Quit this connection",
+ (void)new wxButton(this, SERVER_QUIT_BUTTON, _T("Quit this connection"),
wxPoint(5, 5));
Fit();
}
MyConnection::MyConnection()
: wxConnection()
{
- dialog = new IPCDialogBox(wxTheApp->GetTopWindow(), "Connection",
+ dialog = new IPCDialogBox(wxTheApp->GetTopWindow(), _T("Connection"),
wxPoint(100, 100), wxSize(500, 500), this);
dialog->Show(TRUE);
the_connection = this;
}
bool MyConnection::OnExecute(const wxString& WXUNUSED(topic),
- char *data,
+ wxChar *data,
int WXUNUSED(size),
wxIPCFormat WXUNUSED(format))
{
bool MyConnection::OnPoke(const wxString& WXUNUSED(topic),
const wxString& item,
- char *data,
+ wxChar *data,
int WXUNUSED(size),
wxIPCFormat WXUNUSED(format))
{
return TRUE;
}
-char *MyConnection::OnRequest(const wxString& WXUNUSED(topic),
+wxChar *MyConnection::OnRequest(const wxString& WXUNUSED(topic),
const wxString& WXUNUSED(item),
int * WXUNUSED(size),
wxIPCFormat WXUNUSED(format))
{
- return "Here, have your data, client!";
+ return _T("Here, have your data, client!");
}
bool MyConnection::OnStartAdvise(const wxString& WXUNUSED(topic),
MyConnection();
~MyConnection();
- bool OnExecute(const wxString& topic, char *data, int size, wxIPCFormat format);
- char *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
- bool OnPoke(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
+ bool OnExecute(const wxString& topic, wxChar *data, int size, wxIPCFormat format);
+ wxChar *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
+ bool OnPoke(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format);
bool OnStartAdvise(const wxString& topic, const wxString& item);
IPCDialogBox *dialog;
wxJoystick stick(wxJOYSTICK1);
if (!stick.IsOk())
{
- wxMessageBox("No joystick detected!");
+ wxMessageBox(_T("No joystick detected!"));
return FALSE;
}
#if wxUSE_WAVE
- m_fire.Create("gun.wav");
+ m_fire.Create(_T("gun.wav"));
#endif // wxUSE_WAVE
m_maxX = stick.GetXMax();
// Create the main frame window
- frame = new MyFrame(NULL, "Joystick Demo", wxDefaultPosition,
+ frame = new MyFrame(NULL, _T("Joystick Demo"), wxDefaultPosition,
wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
// Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__
- frame->SetIcon(wxIcon("joyicon"));
+ frame->SetIcon(wxIcon(_T("joyicon")));
#endif
#ifdef __X__
- frame->SetIcon(wxIcon("joyicon.xbm"));
+ frame->SetIcon(wxIcon(_T("joyicon.xbm")));
#endif
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(JOYTEST_QUIT, "&Exit");
+ file_menu->Append(JOYTEST_QUIT, _T("&Exit"));
wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(file_menu, _T("&File"));
// Associate the menu bar with the frame
frame->SetMenuBar(menu_bar);
xpos = pt.x;
ypos = pt.y;
- char buf[100];
+ wxString buf;
if (event.ButtonDown())
- sprintf(buf, "Joystick (%d, %d) Fire!", pt.x, pt.y);
+ buf.Printf(_T("Joystick (%d, %d) Fire!"), pt.x, pt.y);
else
- sprintf(buf, "Joystick (%d, %d)", pt.x, pt.y);
+ buf.Printf(_T("Joystick (%d, %d)"), pt.x, pt.y);
frame->SetStatusText(buf);
bool MyApp::OnInit()
{
// Create the main frame window
- main_frame = new MyMainFrame((wxFrame *) NULL, -1, "wxFrame sample",
+ main_frame = new MyMainFrame((wxFrame *) NULL, -1, _T("wxFrame sample"),
wxPoint(100, 100), wxSize(300, 200));
main_frame->CreateToolBar(wxNO_BORDER|wxTB_VERTICAL, ID_TOOLBAR);
InitToolbar(main_frame->GetToolBar());
- button = new wxButton( main_frame, ID_REPARENT, "Press to reparent!" );
+ button = new wxButton( main_frame, ID_REPARENT, _T("Press to reparent!") );
// Create the mini frame window
- mini_frame = new MyMiniFrame( main_frame, -1, "wxMiniFrame sample",
+ mini_frame = new MyMiniFrame( main_frame, -1, _T("wxMiniFrame sample"),
wxPoint(100, 100), wxSize(220, 100));
mini_frame_exists = TRUE;
int width = 16;
int currentX = 5;
- toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New file");
+ toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("New file"));
currentX += width + 5;
- toolBar->AddTool(wxID_OPEN, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open file");
+ toolBar->AddTool(wxID_OPEN, *(toolBarBitmaps[1]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Open file"));
currentX += width + 5;
- toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Save file");
+ toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Save file"));
currentX += width + 5;
toolBar->AddSeparator();
- toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Copy");
+ toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Copy"));
currentX += width + 5;
- toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Cut");
+ toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Cut"));
currentX += width + 5;
- toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste");
+ toolBar->AddTool(wxID_PASTE, *(toolBarBitmaps[5]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Paste"));
currentX += width + 5;
toolBar->AddSeparator();
- toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Reparent the button");
+ toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Reparent the button"));
currentX += width + 5;
toolBar->AddSeparator();
- toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help");
+ toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, _T("Help"));
toolBar->Realize();
// practical jokers might find satisfaction in reparenting the button
// after closing the mini_frame. We'll have the last laugh.
if (! mini_frame_exists)
- wxMessageBox("The miniframe no longer exists.\n"
- "You don't want to make this button an orphan, do you?",
- "You got to be kidding");
+ wxMessageBox(_T("The miniframe no longer exists.\n")
+ _T("You don't want to make this button an orphan, do you?"),
+ _T("You got to be kidding"));
else
{
button->Reparent( mini_frame );
class MyMiniFrame: public wxMiniFrame
{
public:
- MyMiniFrame(wxFrame *parent, wxWindowID id = -1, const wxString& title = "wxToolBar Sample",
+ MyMiniFrame(wxFrame *parent, wxWindowID id = -1, const wxString& title = _T("wxToolBar Sample"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize );
void OnCloseWindow(wxCloseEvent& event);
class MyMainFrame: public wxFrame
{
public:
- MyMainFrame(wxFrame *parent, wxWindowID id = -1, const wxString& title = "wxToolBar Sample",
+ MyMainFrame(wxFrame *parent, wxWindowID id = -1, const wxString& title = _T("wxToolBar Sample"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize );
void OnCloseWindow(wxCloseEvent& event);
bool MyApp::OnInit(void)
{
// Create the main frame window
- frame = new MyFrame(NULL, -1, "wxWindows Native Dialog Sample", wxPoint(0, 0), wxSize(300, 250));
+ frame = new MyFrame(NULL, -1, _T("wxWindows Native Dialog Sample"), wxPoint(0, 0), wxSize(300, 250));
// Give it a status line
frame->CreateStatusBar(2);
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(RESOURCE_TEST1, "&Dialog box test", "Test dialog box resource");
- file_menu->Append(RESOURCE_QUIT, "E&xit", "Quit program");
+ file_menu->Append(RESOURCE_TEST1, _T("&Dialog box test"), _T("Test dialog box resource"));
+ file_menu->Append(RESOURCE_QUIT, _T("E&xit"), _T("Quit program"));
wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(file_menu, _T("&File"));
// Associate the menu bar with the frame
frame->SetMenuBar(menu_bar);
// Make a panel
- frame->panel = new wxWindow(frame, -1, wxPoint(0, 0), wxSize(400, 400), 0, "MyMainFrame");
+ frame->panel = new wxWindow(frame, -1, wxPoint(0, 0), wxSize(400, 400), 0, _T("MyMainFrame"));
frame->Show(TRUE);
// Return the main frame window
void MyFrame::OnTest1(wxCommandEvent& event)
{
MyDialog *dialog = new MyDialog;
- if (dialog->LoadNativeDialog(this, "dialog1"))
+ if (dialog->LoadNativeDialog(this, _T("dialog1")))
{
/*
wxTextCtrl *text = (wxTextCtrl *)wxFindWindowByName("multitext3", dialog);
GridFrame::GridFrame()
- : wxFrame( (wxFrame *)NULL, -1, "wxWindows grid class demo",
+ : wxFrame( (wxFrame *)NULL, -1, _T("wxWindows grid class demo"),
wxDefaultPosition,
wxDefaultSize )
{
int logW = gridW, logH = 100;
wxMenu *fileMenu = new wxMenu;
- fileMenu->Append( ID_VTABLE, "&Virtual table test\tCtrl-V");
- fileMenu->Append( ID_BUGS_TABLE, "&Bugs table test\tCtrl-B");
- fileMenu->Append( ID_SMALL_GRID, "&Small Grid test\tCtrl-S");
+ fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V"));
+ fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B"));
+ fileMenu->Append( ID_SMALL_GRID, _T("&Small Grid test\tCtrl-S"));
fileMenu->AppendSeparator();
- fileMenu->Append( wxID_EXIT, "E&xit\tAlt-X" );
+ fileMenu->Append( wxID_EXIT, _T("E&xit\tAlt-X") );
wxMenu *viewMenu = new wxMenu;
- viewMenu->Append( ID_TOGGLEROWLABELS, "&Row labels", "", TRUE );
- viewMenu->Append( ID_TOGGLECOLLABELS, "&Col labels", "", TRUE );
- viewMenu->Append( ID_TOGGLEEDIT, "&Editable", "", TRUE );
- viewMenu->Append( ID_TOGGLEROWSIZING, "Ro&w drag-resize", "", TRUE );
- viewMenu->Append( ID_TOGGLECOLSIZING, "C&ol drag-resize", "", TRUE );
- viewMenu->Append( ID_TOGGLEGRIDSIZING, "&Grid drag-resize", "", TRUE );
- viewMenu->Append( ID_TOGGLEGRIDLINES, "&Grid Lines", "", TRUE );
- viewMenu->Append( ID_SET_HIGHLIGHT_WIDTH, "&Set Cell Highlight Width...", "" );
- viewMenu->Append( ID_SET_RO_HIGHLIGHT_WIDTH, "&Set Cell RO Highlight Width...", "" );
- viewMenu->Append( ID_AUTOSIZECOLS, "&Auto-size cols" );
- viewMenu->Append( ID_CELLOVERFLOW, "&Overflow cells", "", TRUE );
- viewMenu->Append( ID_RESIZECELL, "&Resize cell (7,1)", "", TRUE );
+ viewMenu->Append( ID_TOGGLEROWLABELS, _T("&Row labels"), _T(""), TRUE );
+ viewMenu->Append( ID_TOGGLECOLLABELS, _T("&Col labels"), _T(""), TRUE );
+ viewMenu->Append( ID_TOGGLEEDIT, _T("&Editable"), _T(""), TRUE );
+ viewMenu->Append( ID_TOGGLEROWSIZING, _T("Ro&w drag-resize"), _T(""), TRUE );
+ viewMenu->Append( ID_TOGGLECOLSIZING, _T("C&ol drag-resize"), _T(""), TRUE );
+ viewMenu->Append( ID_TOGGLEGRIDSIZING, _T("&Grid drag-resize"), _T(""), TRUE );
+ viewMenu->Append( ID_TOGGLEGRIDLINES, _T("&Grid Lines"), _T(""), TRUE );
+ viewMenu->Append( ID_SET_HIGHLIGHT_WIDTH, _T("&Set Cell Highlight Width..."), _T("") );
+ viewMenu->Append( ID_SET_RO_HIGHLIGHT_WIDTH, _T("&Set Cell RO Highlight Width..."), _T("") );
+ viewMenu->Append( ID_AUTOSIZECOLS, _T("&Auto-size cols") );
+ viewMenu->Append( ID_CELLOVERFLOW, _T("&Overflow cells"), _T(""), TRUE );
+ viewMenu->Append( ID_RESIZECELL, _T("&Resize cell (7,1)"), _T(""), TRUE );
wxMenu *rowLabelMenu = new wxMenu;
- viewMenu->Append( ID_ROWLABELALIGN, "R&ow label alignment",
+ viewMenu->Append( ID_ROWLABELALIGN, _T("R&ow label alignment"),
rowLabelMenu,
- "Change alignment of row labels" );
+ _T("Change alignment of row labels") );
- rowLabelMenu->Append( ID_ROWLABELHORIZALIGN, "&Horizontal" );
- rowLabelMenu->Append( ID_ROWLABELVERTALIGN, "&Vertical" );
+ rowLabelMenu->Append( ID_ROWLABELHORIZALIGN, _T("&Horizontal") );
+ rowLabelMenu->Append( ID_ROWLABELVERTALIGN, _T("&Vertical") );
wxMenu *colLabelMenu = new wxMenu;
- viewMenu->Append( ID_COLLABELALIGN, "Col l&abel alignment",
+ viewMenu->Append( ID_COLLABELALIGN, _T("Col l&abel alignment"),
colLabelMenu,
- "Change alignment of col labels" );
+ _T("Change alignment of col labels") );
- colLabelMenu->Append( ID_COLLABELHORIZALIGN, "&Horizontal" );
- colLabelMenu->Append( ID_COLLABELVERTALIGN, "&Vertical" );
+ colLabelMenu->Append( ID_COLLABELHORIZALIGN, _T("&Horizontal") );
+ colLabelMenu->Append( ID_COLLABELVERTALIGN, _T("&Vertical") );
wxMenu *colMenu = new wxMenu;
- 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..." );
+ colMenu->Append( ID_SETLABELCOLOUR, _T("Set &label colour...") );
+ colMenu->Append( ID_SETLABELTEXTCOLOUR, _T("Set label &text colour...") );
+ colMenu->Append( ID_SETLABEL_FONT, _T("Set label fo&nt...") );
+ colMenu->Append( ID_GRIDLINECOLOUR, _T("&Grid line colour...") );
+ colMenu->Append( ID_SET_CELL_FG_COLOUR, _T("Set cell &foreground colour...") );
+ colMenu->Append( ID_SET_CELL_BG_COLOUR, _T("Set cell &background colour...") );
wxMenu *editMenu = new wxMenu;
- 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_INSERTROW, _T("Insert &row") );
+ editMenu->Append( ID_INSERTCOL, _T("Insert &column") );
+ editMenu->Append( ID_DELETEROW, _T("Delete selected ro&ws") );
+ editMenu->Append( ID_DELETECOL, _T("Delete selected co&ls") );
+ editMenu->Append( ID_CLEARGRID, _T("Cl&ear grid cell contents") );
wxMenu *selectMenu = new wxMenu;
- selectMenu->Append( ID_SELECT_UNSELECT, "Add new cells to the selection",
- "When off, old selection is deselected before "
- "selecting the new cells", TRUE );
- 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->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->Append( ID_SELECT_UNSELECT, _T("Add new cells to the selection"),
+ _T("When off, old selection is deselected before ")
+ _T("selecting the new cells"), TRUE );
+ selectMenu->Append( ID_SELECT_ALL, _T("Select all"));
+ selectMenu->Append( ID_SELECT_ROW, _T("Select row 2"));
+ selectMenu->Append( ID_SELECT_COL, _T("Select col 2"));
+ selectMenu->Append( ID_SELECT_CELL, _T("Select cell (3, 1)"));
+ selectMenu->Append( ID_DESELECT_ALL, _T("Deselect all"));
+ selectMenu->Append( ID_DESELECT_ROW, _T("Deselect row 2"));
+ selectMenu->Append( ID_DESELECT_COL, _T("Deselect col 2"));
+ selectMenu->Append( ID_DESELECT_CELL, _T("Deselect cell (3, 1)"));
wxMenu *selectionMenu = new wxMenu;
- selectMenu->Append( ID_CHANGESEL, "Change &selection mode",
+ selectMenu->Append( ID_CHANGESEL, _T("Change &selection mode"),
selectionMenu,
- "Change selection mode" );
+ _T("Change selection mode") );
- selectionMenu->Append( ID_SELCELLS, "Select &Cells" );
- selectionMenu->Append( ID_SELROWS, "Select &Rows" );
- selectionMenu->Append( ID_SELCOLS, "Select C&ols" );
+ selectionMenu->Append( ID_SELCELLS, _T("Select &Cells") );
+ selectionMenu->Append( ID_SELROWS, _T("Select &Rows") );
+ selectionMenu->Append( ID_SELCOLS, _T("Select C&ols") );
wxMenu *helpMenu = new wxMenu;
- helpMenu->Append( ID_ABOUT, "&About wxGrid demo" );
+ helpMenu->Append( ID_ABOUT, _T("&About wxGrid demo") );
wxMenuBar *menuBar = new wxMenuBar;
- menuBar->Append( fileMenu, "&File" );
- menuBar->Append( viewMenu, "&View" );
- menuBar->Append( colMenu, "&Colours" );
- menuBar->Append( editMenu, "&Edit" );
- menuBar->Append( selectMenu, "&Select" );
- menuBar->Append( helpMenu, "&Help" );
+ menuBar->Append( fileMenu, _T("&File") );
+ menuBar->Append( viewMenu, _T("&View") );
+ menuBar->Append( colMenu, _T("&Colours") );
+ menuBar->Append( editMenu, _T("&Edit") );
+ menuBar->Append( selectMenu, _T("&Select") );
+ menuBar->Append( helpMenu, _T("&Help") );
SetMenuBar( menuBar );
grid->AppendRows(ir);
grid->SetRowSize( 0, 60 );
- grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" );
+ grid->SetCellValue( 0, 0, _T("Ctrl+Home\nwill go to\nthis cell") );
- grid->SetCellValue( 0, 1, "A long piece of text to demonstrate wrapping." );
+ grid->SetCellValue( 0, 1, _T("A long piece of text to demonstrate wrapping.") );
grid->SetCellRenderer(0 , 1, new wxGridCellAutoWrapStringRenderer);
grid->SetCellEditor( 0, 1 , new wxGridCellAutoWrapStringEditor);
- grid->SetCellValue( 0, 2, "Blah" );
- grid->SetCellValue( 0, 3, "Read only" );
+ grid->SetCellValue( 0, 2, _T("Blah") );
+ grid->SetCellValue( 0, 3, _T("Read only") );
grid->SetReadOnly( 0, 3 );
- grid->SetCellValue( 0, 4, "Can veto edit this cell" );
+ grid->SetCellValue( 0, 4, _T("Can veto edit this cell") );
- grid->SetCellValue( 0, 5, "Press\nCtrl+arrow\nto skip over\ncells" );
+ grid->SetCellValue( 0, 5, _T("Press\nCtrl+arrow\nto skip over\ncells") );
grid->SetRowSize( 99, 60 );
- 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->SetCellValue( 99, 99, _T("Ctrl+End\nwill go to\nthis cell") );
+ grid->SetCellValue( 1, 0, _T("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, "I'm in the middle");
+ grid->SetCellValue( 1, 4, _T("I'm in the middle"));
- grid->SetCellValue(2, 2, "red");
+ grid->SetCellValue(2, 2, _T("red"));
grid->SetCellTextColour(2, 2, *wxRED);
- grid->SetCellValue(3, 3, "green on grey");
+ grid->SetCellValue(3, 3, _T("green on grey"));
grid->SetCellTextColour(3, 3, *wxGREEN);
grid->SetCellBackgroundColour(3, 3, *wxLIGHT_GREY);
- grid->SetCellValue(4, 4, "a weird looking cell");
+ grid->SetCellValue(4, 4, _T("a weird looking cell"));
grid->SetCellAlignment(4, 4, wxALIGN_CENTRE, wxALIGN_CENTRE);
grid->SetCellRenderer(4, 4, new MyGridCellRenderer);
- grid->SetCellValue(3, 0, "0");
+ grid->SetCellValue(3, 0, _T("0"));
grid->SetCellRenderer(3, 0, new wxGridCellBoolRenderer);
grid->SetCellEditor(3, 0, new wxGridCellBoolEditor);
attr->SetBackgroundColour(*wxRED);
grid->SetRowAttr(5, attr);
- grid->SetCellValue(2, 4, "a wider column");
+ grid->SetCellValue(2, 4, _T("a wider column"));
grid->SetColSize(4, 120);
grid->SetColMinimalWidth(4, 120);
grid->SetCellTextColour(5, 8, *wxGREEN);
- 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");
+ grid->SetCellValue(5, 8, _T("Bg from row attr\nText col from cell attr"));
+ grid->SetCellValue(5, 5, _T("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->SetColFormatFloat(6);
- grid->SetCellValue(0, 6, "3.1415");
- grid->SetCellValue(1, 6, "1415");
- grid->SetCellValue(2, 6, "12345.67890");
+ grid->SetCellValue(0, 6, _T("3.1415"));
+ grid->SetCellValue(1, 6, _T("1415"));
+ grid->SetCellValue(2, 6, _T("12345.67890"));
grid->SetColFormatFloat(7, 6, 2);
- grid->SetCellValue(0, 7, "3.1415");
- grid->SetCellValue(1, 7, "1415");
- grid->SetCellValue(2, 7, "12345.67890");
+ grid->SetCellValue(0, 7, _T("3.1415"));
+ grid->SetCellValue(1, 7, _T("1415"));
+ grid->SetCellValue(2, 7, _T("12345.67890"));
const wxString choices[] =
{
grid->SetCellSize(7, 1, 3, 4);
grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE);
- grid->SetCellValue(7, 1, "Big box!");
+ grid->SetCellValue(7, 1, _T("Big box!"));
wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
topSizer->Add( grid,
void GridFrame::OnSetHighlightWidth( wxCommandEvent& WXUNUSED(ev) )
{
- wxString choices[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
+ wxString choices[] = { _T("0"), _T("1"), _T("2"), _T("3"), _T("4"), _T("5"), _T("6"), _T("7"), _T("8"), _T("9"), _T("10")};
- wxSingleChoiceDialog dlg(this, "Choose the thickness of the highlight pen:",
- "Pen Width", 11, choices);
+ wxSingleChoiceDialog dlg(this, _T("Choose the thickness of the highlight pen:"),
+ _T("Pen Width"), 11, choices);
int current = grid->GetCellHighlightPenWidth();
dlg.SetSelection(current);
void GridFrame::OnSetROHighlightWidth( wxCommandEvent& WXUNUSED(ev) )
{
- wxString choices[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
+ wxString choices[] = { _T("0"), _T("1"), _T("2"), _T("3"), _T("4"), _T("5"), _T("6"), _T("7"), _T("8"), _T("9"), _T("10")};
- wxSingleChoiceDialog dlg(this, "Choose the thickness of the highlight pen:",
- "Pen Width", 11, choices);
+ wxSingleChoiceDialog dlg(this, _T("Choose the thickness of the highlight pen:"),
+ _T("Pen Width"), 11, choices);
int current = grid->GetCellHighlightROPenWidth();
dlg.SetSelection(current);
void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
{
- logBuf = "";
+ logBuf = _T("");
if ( ev.GetRow() != -1 )
{
- logBuf << "Left click on row label " << ev.GetRow();
+ logBuf << _T("Left click on row label ") << ev.GetRow();
}
else if ( ev.GetCol() != -1 )
{
- logBuf << "Left click on col label " << ev.GetCol();
+ logBuf << _T("Left click on col label ") << ev.GetCol();
}
else
{
- logBuf << "Left click on corner label";
+ logBuf << _T("Left click on corner label");
}
- if ( ev.ShiftDown() ) logBuf << " (shift down)";
- if ( ev.ControlDown() ) logBuf << " (control down)";
+ if ( ev.ShiftDown() ) logBuf << _T(" (shift down)");
+ if ( ev.ControlDown() ) logBuf << _T(" (control down)");
wxLogMessage( wxT("%s"), logBuf.c_str() );
// you must call event skip if you want default grid processing
void GridFrame::OnCellLeftClick( wxGridEvent& ev )
{
- logBuf = "";
- logBuf << "Left click at row " << ev.GetRow()
- << " col " << ev.GetCol();
+ logBuf = _T("");
+ logBuf << _T("Left click at row ") << ev.GetRow()
+ << _T(" col ") << ev.GetCol();
wxLogMessage( wxT("%s"), logBuf.c_str() );
// you must call event skip if you want default grid processing
void GridFrame::OnRowSize( wxGridSizeEvent& ev )
{
- logBuf = "";
- logBuf << "Resized row " << ev.GetRowOrCol();
+ logBuf = _T("");
+ logBuf << _T("Resized row ") << ev.GetRowOrCol();
wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip();
void GridFrame::OnColSize( wxGridSizeEvent& ev )
{
- logBuf = "";
- logBuf << "Resized col " << ev.GetRowOrCol();
+ logBuf = _T("");
+ logBuf << _T("Resized col ") << ev.GetRowOrCol();
wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip();
void GridFrame::OnSelectCell( wxGridEvent& ev )
{
- logBuf = "";
+ logBuf = _T("");
if ( ev.Selecting() )
- logBuf << "Selected ";
+ logBuf << _T("Selected ");
else
- 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') << " )";
+ logBuf << _T("Deselected ");
+ logBuf << _T("cell at row ") << ev.GetRow()
+ << _T(" col ") << ev.GetCol()
+ << _T(" ( ControlDown: ")<< (ev.ControlDown() ? 'T':'F')
+ << _T(", ShiftDown: ")<< (ev.ShiftDown() ? 'T':'F')
+ << _T(", AltDown: ")<< (ev.AltDown() ? 'T':'F')
+ << _T(", MetaDown: ")<< (ev.MetaDown() ? 'T':'F') << _T(" )");
wxLogMessage( wxT("%s"), logBuf.c_str() );
// you must call Skip() if you want the default processing
void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev )
{
- logBuf = "";
+ logBuf = _T("");
if ( ev.Selecting() )
- logBuf << "Selected ";
+ logBuf << _T("Selected ");
else
- 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') << " )";
+ logBuf << _T("Deselected ");
+ logBuf << _T("cells from row ") << ev.GetTopRow()
+ << _T(" col ") << ev.GetLeftCol()
+ << _T(" to row ") << ev.GetBottomRow()
+ << _T(" col ") << ev.GetRightCol()
+ << _T(" ( ControlDown: ")<< (ev.ControlDown() ? 'T':'F')
+ << _T(", ShiftDown: ")<< (ev.ShiftDown() ? 'T':'F')
+ << _T(", AltDown: ")<< (ev.AltDown() ? 'T':'F')
+ << _T(", MetaDown: ")<< (ev.MetaDown() ? 'T':'F') << _T(" )");
wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip();
void GridFrame::OnCellValueChanged( wxGridEvent& ev )
{
- logBuf = "";
- logBuf << "Value changed for cell at"
- << " row " << ev.GetRow()
- << " col " << ev.GetCol();
+ logBuf = _T("");
+ logBuf << _T("Value changed for cell at")
+ << _T(" row ") << ev.GetRow()
+ << _T(" col ") << ev.GetCol();
wxLogMessage( wxT("%s"), logBuf.c_str() );
void GridFrame::About( wxCommandEvent& WXUNUSED(ev) )
{
- (void)wxMessageBox( "\n\nwxGrid demo \n\n"
- "Michael Bedward \n"
- "mbedward@ozemail.com.au \n\n",
- "About",
+ (void)wxMessageBox( _T("\n\nwxGrid demo \n\n")
+ _T("Michael Bedward \n")
+ _T("mbedward@ozemail.com.au \n\n"),
+ _T("About"),
wxOK );
}
void GridFrame::OnSmallGrid(wxCommandEvent& )
{
- wxFrame* frame = new wxFrame(NULL, -1, "A Small Grid",
+ wxFrame* frame = new wxFrame(NULL, -1, _T("A Small Grid"),
wxDefaultPosition, wxSize(640, 480));
wxPanel* panel = new wxPanel(frame, -1);
wxGrid* grid = new wxGrid(panel, -1, wxPoint(10,10), wxSize(400,400),
// MB: wxGetNumberFromUser doesn't work properly for wxMotif
wxString s;
s << s_sizeGrid;
- s = wxGetTextFromUser( "Size of the table to create",
- "Size:",
+ s = wxGetTextFromUser( _T("Size of the table to create"),
+ _T("Size:"),
s );
s.ToLong( &s_sizeGrid );
#else
- s_sizeGrid = wxGetNumberFromUser("Size of the table to create",
- "Size: ",
- "wxGridDemo question",
+ s_sizeGrid = wxGetNumberFromUser(_T("Size of the table to create"),
+ _T("Size: "),
+ _T("wxGridDemo question"),
s_sizeGrid,
0, 32000, this);
#endif
// ============================================================================
BigGridFrame::BigGridFrame(long sizeGrid)
- : wxFrame(NULL, -1, "Plugin Virtual Table",
+ : wxFrame(NULL, -1, _T("Plugin Virtual Table"),
wxDefaultPosition, wxSize(500, 450))
{
m_grid = new wxGrid(this, -1, wxDefaultPosition, wxDefaultSize);
// ----------------------------------------------------------------------------
BugsGridFrame::BugsGridFrame()
- : wxFrame(NULL, -1, "Bugs table",
+ : wxFrame(NULL, -1, _T("Bugs table"),
wxDefaultPosition, wxSize(500, 300))
{
wxGrid *grid = new wxGrid(this, -1, wxDefaultPosition);
bool MyApp::OnInit()
{
// Create the main application window
- MyFrame *frame = new MyFrame("OleAuto wxWindows App",
+ MyFrame *frame = new MyFrame(_T("OleAuto wxWindows App"),
wxPoint(50, 50), wxSize(450, 340));
// Show it and tell the application that it's our main window
// create a menu bar
wxMenu *menuFile = new wxMenu;
- menuFile->Append(OleAuto_Test, "&Test Excel Automation...");
- menuFile->Append(OleAuto_About, "&About...");
+ menuFile->Append(OleAuto_Test, _T("&Test Excel Automation..."));
+ menuFile->Append(OleAuto_About, _T("&About..."));
menuFile->AppendSeparator();
- menuFile->Append(OleAuto_Quit, "E&xit");
+ menuFile->Append(OleAuto_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(2);
- SetStatusText("Welcome to wxWindows!");
+ SetStatusText(_T("Welcome to wxWindows!"));
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
- wxMessageBox("This is an OLE Automation sample",
- "About OleAuto", wxOK | wxICON_INFORMATION, this);
+ wxMessageBox(_T("This is an OLE Automation sample"),
+ _T("About OleAuto"), wxOK | wxICON_INFORMATION, this);
}
/* Tests OLE automation by making the active Excel cell bold,
*/
void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event))
{
- wxMessageBox("Please ensure Excel is running, then press OK.\nThe active cell should then say 'wxWindows automation test!' in bold.");
+ wxMessageBox(_T("Please ensure Excel is running, then press OK.\nThe active cell should then say 'wxWindows automation test!' in bold."));
wxAutomationObject excelObject, rangeObject;
- if (!excelObject.GetInstance("Excel.Application"))
+ if (!excelObject.GetInstance(_T("Excel.Application")))
{
- if (!excelObject.CreateInstance("Excel.Application"))
+ if (!excelObject.CreateInstance(_T("Excel.Application")))
{
- wxMessageBox("Could not create Excel object.");
+ wxMessageBox(_T("Could not create Excel object."));
return;
}
}
- if (!excelObject.PutProperty("ActiveCell.Value", "wxWindows automation test!"))
+ if (!excelObject.PutProperty(_T("ActiveCell.Value"), _T("wxWindows automation test!")))
{
- wxMessageBox("Could not set active cell value.");
+ wxMessageBox(_T("Could not set active cell value."));
return;
}
#ifdef HAVE_BOOL
- if (!excelObject.PutProperty("ActiveCell.Font.Bold", wxVariant((bool) TRUE)) )
+ if (!excelObject.PutProperty(_T("ActiveCell.Font.Bold"), wxVariant((bool) TRUE)) )
{
- wxMessageBox("Could not put Bold property to active cell.");
+ wxMessageBox(_T("Could not put Bold property to active cell."));
return;
}
#endif
{
public:
// ctor & dtor
- OwnerDrawnFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
+ OwnerDrawnFrame(wxFrame *frame, wxChar *title, int x, int y, int w, int h);
~OwnerDrawnFrame();
// notifications
bool OwnerDrawnApp::OnInit(void)
{
OwnerDrawnFrame *pFrame
- = new OwnerDrawnFrame(NULL, "wxWindows Ownerdraw Sample",
+ = new OwnerDrawnFrame(NULL, _T("wxWindows Ownerdraw Sample"),
50, 50, 450, 340);
SetTopWindow(pFrame);
fontBmp(14, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE);
// sorry for my artistic skills...
- wxBitmap bmpBell("bell"), bmpSound("sound"), bmpNoSound("nosound");
+ wxBitmap bmpBell(_T("bell")), bmpSound(_T("sound")), bmpNoSound(_T("nosound"));
// construct submenu
- pItem = new wxMenuItem(sub_menu, Menu_Sub1, "Submenu &first", "large");
+ pItem = new wxMenuItem(sub_menu, Menu_Sub1, _T("Submenu &first"), _T("large"));
pItem->SetFont(fontLarge);
sub_menu->Append(pItem);
- pItem = new wxMenuItem(sub_menu, Menu_Sub2, "Submenu &second", "italic",
+ pItem = new wxMenuItem(sub_menu, Menu_Sub2, _T("Submenu &second"), _T("italic"),
wxITEM_CHECK);
pItem->SetFont(fontItalic);
sub_menu->Append(pItem);
- pItem = new wxMenuItem(sub_menu, Menu_Sub3, "Submenu &third", "underlined",
+ pItem = new wxMenuItem(sub_menu, Menu_Sub3, _T("Submenu &third"), _T("underlined"),
wxITEM_CHECK);
pItem->SetFont(fontUlined);
sub_menu->Append(pItem);
// construct menu
- pItem = new wxMenuItem(file_menu, Menu_Test1, "&Uncheckable", "red item");
+ pItem = new wxMenuItem(file_menu, Menu_Test1, _T("&Uncheckable"), _T("red item"));
pItem->SetFont(*wxITALIC_FONT);
pItem->SetTextColour(wxColor(255, 0, 0));
pItem->SetMarginWidth(23);
file_menu->Append(pItem);
- pItem = new wxMenuItem(file_menu, Menu_Test2, "&Checkable",
- "checkable item", wxITEM_CHECK);
+ pItem = new wxMenuItem(file_menu, Menu_Test2, _T("&Checkable"),
+ _T("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, "&Disabled", "disabled item");
+ pItem = new wxMenuItem(file_menu, Menu_Test3, _T("&Disabled"), _T("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, "&Bell",
- "check/uncheck me!", wxITEM_CHECK);
+ pItem = new wxMenuItem(file_menu, Menu_Bitmap, _T("&Bell"),
+ _T("check/uncheck me!"), wxITEM_CHECK);
pItem->SetFont(fontBmp);
pItem->SetBitmaps(bmpBell);
file_menu->Append(pItem);
- pItem = new wxMenuItem(file_menu, Menu_Bitmap2, "So&und",
- "icon changes!", wxITEM_CHECK);
+ pItem = new wxMenuItem(file_menu, Menu_Bitmap2, _T("So&und"),
+ _T("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, "&Sub menu", "",
+ pItem = new wxMenuItem(file_menu, Menu_Submenu, _T("&Sub menu"), _T(""),
wxITEM_CHECK, sub_menu);
pItem->SetFont(*wxSWISS_FONT);
file_menu->Append(pItem);
file_menu->AppendSeparator();
- pItem = new wxMenuItem(file_menu, Menu_Quit, "&Quit", "Normal item",
+ pItem = new wxMenuItem(file_menu, Menu_Quit, _T("&Quit"), _T("Normal item"),
wxITEM_NORMAL);
pItem->SetFont(*wxNORMAL_FONT);
file_menu->Append(pItem);
wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(file_menu, _T("&File"));
SetMenuBar(menu_bar);
}
// main frame constructor
-OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, char *title,
+OwnerDrawnFrame::OwnerDrawnFrame(wxFrame *frame, wxChar *title,
int x, int y, int w, int h)
: wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
{
// set the icon
- SetIcon(wxIcon("mondrian"));
+ SetIcon(wxIcon(_T("mondrian")));
// create the menu
InitMenu();
const int widths[] = { -1, 60 };
CreateStatusBar(2);
SetStatusWidths(2, widths);
- SetStatusText("no selection", 0);
+ SetStatusText(_T("no selection"), 0);
// make a panel with some controls
wxPanel *pPanel = new wxPanel(this, -1, wxPoint(0, 0),
wxSize(400, 200), wxTAB_TRAVERSAL);
// check list box
- static const char* aszChoices[] = { "Hello", "world", "and",
- "goodbye", "cruel", "world",
- "-------", "owner-drawn", "listbox" };
+ static const wxChar* aszChoices[] = { _T("Hello"), _T("world"), _T("and"),
+ _T("goodbye"), _T("cruel"), _T("world"),
+ _T("-------"), _T("owner-drawn"), _T("listbox") };
wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)];
unsigned int ui;
m_pListBox->Check(2);
// normal (but owner-drawn) listbox
- static const char* aszColors[] = { "Red", "Blue", "Pink",
- "Green", "Yellow",
- "Black", "Violet" };
+ static const wxChar* aszColors[] = { _T("Red"), _T("Blue"), _T("Pink"),
+ _T("Green"), _T("Yellow"),
+ _T("Black"), _T("Violet") };
struct { unsigned int r, g, b; } aColors[] =
{
{255,0,0}, {0,0,255}, {255,128,192},
void OwnerDrawnFrame::OnAbout(wxCommandEvent& event)
{
wxMessageDialog dialog(this,
- "Demo of owner-drawn controls\n",
- "About wxOwnerDrawn", wxYES_NO | wxCANCEL);
+ _T("Demo of owner-drawn controls\n"),
+ _T("About wxOwnerDrawn"), wxYES_NO | wxCANCEL);
dialog.ShowModal();
}
{
wxString strSelection;
unsigned int nSel = event.GetSelection();
- strSelection.sprintf(wxT("item %d selected (%schecked)"), nSel,
- m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not "));
+ strSelection.Printf(wxT("item %d selected (%schecked)"), nSel,
+ m_pListBox->IsChecked(nSel) ? wxT("") : wxT("not "));
SetStatusText(strSelection);
}
void OwnerDrawnFrame::OnListboxDblClick(wxCommandEvent& event)
{
wxString strSelection;
- strSelection.sprintf(wxT("item %d double clicked"),
- m_pListBox->GetSelection());
+ strSelection.Printf(wxT("item %d double clicked"),
+ m_pListBox->GetSelection());
wxMessageDialog dialog(this, strSelection);
dialog.ShowModal();
}
{
wxString strSelection;
unsigned int nItem = event.GetInt();
- strSelection.sprintf(wxT("item %d was %schecked"), nItem,
- m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un"));
+ strSelection.Printf(wxT("item %d was %schecked"), nItem,
+ m_pListBox->IsChecked(nItem) ? wxT("") : wxT("un"));
SetStatusText(strSelection);
}
wxImage::AddHandler(new wxPNGHandler);
// Create the main frame window
- frame = new MyFrame((wxFrame *) NULL, "wxPNGBitmap Demo", wxPoint(0, 0), wxSize(300, 300));
+ frame = new MyFrame((wxFrame *) NULL, _T("wxPNGBitmap Demo"), wxPoint(0, 0), wxSize(300, 300));
// Give it a status line
frame->CreateStatusBar(2);
wxMenu *file_menu = new wxMenu;
wxMenu *help_menu = new wxMenu;
- file_menu->Append(PNGDEMO_LOAD_FILE, "&Load file", "Load file");
- file_menu->Append(PNGDEMO_SAVE_FILE, "&Save file", "Save file");
- file_menu->Append(PNGDEMO_QUIT, "E&xit", "Quit program");
- help_menu->Append(PNGDEMO_ABOUT, "&About", "About PNG demo");
+ file_menu->Append(PNGDEMO_LOAD_FILE, _T("&Load file"), _T("Load file"));
+ file_menu->Append(PNGDEMO_SAVE_FILE, _T("&Save file"), _T("Save file"));
+ file_menu->Append(PNGDEMO_QUIT, _T("E&xit"), _T("Quit program"));
+ help_menu->Append(PNGDEMO_ABOUT, _T("&About"), _T("About PNG demo"));
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, wxWindows");
+ frame->SetStatusText(_T("Hello, wxWindows"));
return TRUE;
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
- (void)wxMessageBox("PNG demo\nJulian Smart (c) 1998",
- "About PNG Demo", wxOK);
+ (void)wxMessageBox(_T("PNG demo\nJulian Smart (c) 1998"),
+ _T("About PNG Demo"), wxOK);
}
void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
(const wxChar *)NULL,
wxT("png"), wxT("PNG files (*.png)|*.png") );
- if (f == "") return;
+ if (f == _T("")) return;
wxBitmap *backstore = new wxBitmap( 150, 150 );
memDC.SetPen( *wxBLACK_PEN );
memDC.DrawLine( 0, 0, 0, 10 );
memDC.SetTextForeground( *wxWHITE );
- memDC.DrawText( "This is a memory dc.", 10, 10 );
+ memDC.DrawText( _T("This is a memory dc."), 10, 10 );
memDC.SelectObject( wxNullBitmap );
(const wxChar *) NULL, wxT("png"),
wxT("PNG files (*.png)|*.png"));
- if (f == "")
+ if (f == _T(""))
return;
if ( g_TestBitmap )
IMPLEMENT_APP(MyApp)
// Writes a header on a page. Margin units are in millimetres.
-bool WritePageHeader(wxPrintout *printout, wxDC *dc, char *text, float mmToLogical);
+bool WritePageHeader(wxPrintout *printout, wxDC *dc, wxChar *text, float mmToLogical);
MyApp::MyApp()
{
g_pageSetupData = new wxPageSetupDialogData;
// Create the main frame window
- frame = new MyFrame((wxFrame *) NULL, (char *) "wxWindows Printing Demo", wxPoint(0, 0), wxSize(400, 400));
+ frame = new MyFrame((wxFrame *) NULL, _T("wxWindows Printing Demo"), wxPoint(0, 0), wxSize(400, 400));
// Give it a status line
frame->CreateStatusBar(2);
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(WXPRINT_PRINT, "&Print...", "Print");
- file_menu->Append(WXPRINT_PRINT_SETUP, "Print &Setup...", "Setup printer properties");
- file_menu->Append(WXPRINT_PAGE_SETUP, "Page Set&up...", "Page setup");
- file_menu->Append(WXPRINT_PREVIEW, "Print Pre&view", "Preview");
+ file_menu->Append(WXPRINT_PRINT, _T("&Print..."), _T("Print"));
+ file_menu->Append(WXPRINT_PRINT_SETUP, _T("Print &Setup..."), _T("Setup printer properties"));
+ file_menu->Append(WXPRINT_PAGE_SETUP, _T("Page Set&up..."), _T("Page setup"));
+ file_menu->Append(WXPRINT_PREVIEW, _T("Print Pre&view"), _T("Preview"));
#if wxUSE_ACCEL
// Accelerators
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
file_menu->AppendSeparator();
- file_menu->Append(WXPRINT_PRINT_PS, "Print PostScript...", "Print (PostScript)");
- file_menu->Append(WXPRINT_PRINT_SETUP_PS, "Print Setup PostScript...", "Setup printer properties (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)");
+ file_menu->Append(WXPRINT_PRINT_PS, _T("Print PostScript..."), _T("Print (PostScript)"));
+ file_menu->Append(WXPRINT_PRINT_SETUP_PS, _T("Print Setup PostScript..."), _T("Setup printer properties (PostScript)"));
+ file_menu->Append(WXPRINT_PAGE_SETUP_PS, _T("Page Setup PostScript..."), _T("Page setup (PostScript)"));
+ file_menu->Append(WXPRINT_PREVIEW_PS, _T("Print Preview PostScript"), _T("Preview (PostScript)"));
#endif
file_menu->AppendSeparator();
- file_menu->Append(WXPRINT_QUIT, "E&xit", "Exit program");
+ file_menu->Append(WXPRINT_QUIT, _T("E&xit"), _T("Exit program"));
wxMenu *help_menu = new wxMenu;
- help_menu->Append(WXPRINT_ABOUT, "&About", "About this demo");
+ help_menu->Append(WXPRINT_ABOUT, _T("&About"), _T("About this demo"));
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->Centre(wxBOTH);
frame->Show(TRUE);
- frame->SetStatusText("Printing demo");
+ frame->SetStatusText(_T("Printing demo"));
SetTopWindow(frame);
wxPrintDialogData printDialogData(* g_printData);
wxPrinter printer(& printDialogData);
- MyPrintout printout("My printout");
+ MyPrintout printout(_T("My printout"));
if (!printer.Print(this, &printout, TRUE))
{
if (wxPrinter::GetLastError() == wxPRINTER_ERROR)
- wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK);
+ wxMessageBox(_T("There was a problem printing.\nPerhaps your current printer is not set correctly?"), _T("Printing"), wxOK);
else
- wxMessageBox("You canceled printing", "Printing", wxOK);
+ wxMessageBox(_T("You canceled printing"), _T("Printing"), wxOK);
}
else
{
if (!preview->Ok())
{
delete preview;
- wxMessageBox("There was a problem previewing.\nPerhaps your current printer is not set correctly?", "Previewing", wxOK);
+ wxMessageBox(_T("There was a problem previewing.\nPerhaps your current printer is not set correctly?"), _T("Previewing"), wxOK);
return;
}
- wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
+ wxPreviewFrame *frame = new wxPreviewFrame(preview, this, _T("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650));
frame->Centre(wxBOTH);
frame->Initialize();
frame->Show(TRUE);
void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
{
wxPostScriptPrinter printer(g_printData);
- MyPrintout printout("My printout");
+ MyPrintout printout(_T("My printout"));
printer.Print(this, &printout, TRUE);
(*g_printData) = printer.GetPrintData();
// Pass two printout objects: for preview, and possible printing.
wxPrintDialogData printDialogData(* g_printData);
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printDialogData);
- wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
+ wxPreviewFrame *frame = new wxPreviewFrame(preview, this, _T("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650));
frame->Centre(wxBOTH);
frame->Initialize();
frame->Show(TRUE);
void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event))
{
- (void)wxMessageBox("wxWindows printing demo\nAuthor: Julian Smart",
- "About wxWindows printing demo", wxOK|wxCENTRE);
+ (void)wxMessageBox(_T("wxWindows printing demo\nAuthor: Julian Smart"),
+ _T("About wxWindows printing demo"), wxOK|wxCENTRE);
}
void MyFrame::Draw(wxDC& dc)
{ // GetTextExtent demo:
- wxString words[7] = {"This ", "is ", "GetTextExtent ", "testing ", "string. ", "Enjoy ", "it!"};
+ wxString words[7] = {_T("This "), _T("is "), _T("GetTextExtent "), _T("testing "), _T("string. "), _T("Enjoy "), _T("it!")};
long w, h;
long x = 200, y= 250;
wxFont fnt(15, wxSWISS, wxNORMAL, wxNORMAL);
dc->SetFont(* wxGetApp().m_testFont);
}
- dc->DrawText("Some test text", 200, 300 );
+ dc->DrawText(_T("Some test text"), 200, 300 );
// TESTING
dc->DrawLine( (long)leftMarginLogical, (long)bottomMarginLogical,
(long)rightMarginLogical, (long)bottomMarginLogical);
- WritePageHeader(this, dc, "A header", logUnitsFactor);
+ WritePageHeader(this, dc, _T("A header"), logUnitsFactor);
}
// Writes a header on a page. Margin units are in millimetres.
-bool WritePageHeader(wxPrintout *printout, wxDC *dc, char *text, float mmToLogical)
+bool WritePageHeader(wxPrintout *printout, wxDC *dc, wxChar *text, float mmToLogical)
{
/*
static wxFont *headerFont = (wxFont *) NULL;
class MyPrintout: public wxPrintout
{
public:
- MyPrintout(char *title = "My printout"):wxPrintout(title) {}
+ MyPrintout(wxChar *title = _T("My printout")):wxPrintout(title) {}
bool OnPrintPage(int page);
bool HasPage(int page);
bool OnBeginDocument(int startPage, int endPage);
RegisterValidators();
// Create the main frame window
- m_mainFrame = new MyFrame(NULL, "wxPropertySheet Demo", wxPoint(0, 0), wxSize(300, 400), wxDEFAULT_FRAME_STYLE);
+ m_mainFrame = new MyFrame(NULL, _T("wxPropertySheet Demo"), wxPoint(0, 0), wxSize(300, 400), wxDEFAULT_FRAME_STYLE);
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(PROPERTY_TEST_DIALOG_LIST, "Test property list &dialog...");
- file_menu->Append(PROPERTY_TEST_FRAME_LIST, "Test property list &frame...");
+ file_menu->Append(PROPERTY_TEST_DIALOG_LIST, _T("Test property list &dialog..."));
+ file_menu->Append(PROPERTY_TEST_FRAME_LIST, _T("Test property list &frame..."));
file_menu->AppendSeparator();
- file_menu->Append(PROPERTY_TEST_DIALOG_FORM, "Test property form d&ialog...");
- file_menu->Append(PROPERTY_TEST_FRAME_FORM, "Test property form f&rame...");
+ file_menu->Append(PROPERTY_TEST_DIALOG_FORM, _T("Test property form d&ialog..."));
+ file_menu->Append(PROPERTY_TEST_FRAME_FORM, _T("Test property form f&rame..."));
file_menu->AppendSeparator();
- file_menu->Append(PROPERTY_QUIT, "E&xit");
+ file_menu->Append(PROPERTY_QUIT, _T("E&xit"));
wxMenu *help_menu = new wxMenu;
- help_menu->Append(PROPERTY_ABOUT, "&About");
+ help_menu->Append(PROPERTY_ABOUT, _T("&About"));
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
m_mainFrame->SetMenuBar(menu_bar);
void MyFrame::OnAbout(wxCommandEvent& event)
{
- (void)wxMessageBox("Property Classes Demo\nAuthor: Julian Smart", "About Property Classes Test");
+ (void)wxMessageBox(_T("Property Classes Demo\nAuthor: Julian Smart"), _T("About Property Classes Test"));
}
void MyApp::RegisterValidators(void)
{
- myListValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator);
- myListValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator);
- myListValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator);
- myListValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator);
- myListValidatorRegistry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator);
-
- myFormValidatorRegistry.RegisterValidator((wxString)"real", new wxRealFormValidator);
- myFormValidatorRegistry.RegisterValidator((wxString)"string", new wxStringFormValidator);
- myFormValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerFormValidator);
- myFormValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolFormValidator);
+ myListValidatorRegistry.RegisterValidator((wxString)_T("real"), new wxRealListValidator);
+ myListValidatorRegistry.RegisterValidator((wxString)_T("string"), new wxStringListValidator);
+ myListValidatorRegistry.RegisterValidator((wxString)_T("integer"), new wxIntegerListValidator);
+ myListValidatorRegistry.RegisterValidator((wxString)_T("bool"), new wxBoolListValidator);
+ myListValidatorRegistry.RegisterValidator((wxString)_T("stringlist"), new wxListOfStringsListValidator);
+
+ myFormValidatorRegistry.RegisterValidator((wxString)_T("real"), new wxRealFormValidator);
+ myFormValidatorRegistry.RegisterValidator((wxString)_T("string"), new wxStringFormValidator);
+ myFormValidatorRegistry.RegisterValidator((wxString)_T("integer"), new wxIntegerFormValidator);
+ myFormValidatorRegistry.RegisterValidator((wxString)_T("bool"), new wxBoolFormValidator);
}
void MyApp::PropertyListTest(bool useDialog)
wxPropertySheet *sheet = new wxPropertySheet;
- sheet->AddProperty(new wxProperty("fred", 1.0, "real"));
- sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool"));
- sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerListValidator(-50, 50)));
- sheet->AddProperty(new wxProperty("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0)));
- sheet->AddProperty(new wxProperty("julian", "one", "string"));
- sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")));
+ sheet->AddProperty(new wxProperty(_T("fred"), 1.0, _T("real")));
+ sheet->AddProperty(new wxProperty(_T("tough choice"), (bool)TRUE, _T("bool")));
+ sheet->AddProperty(new wxProperty(_T("ian"), (long)45, _T("integer"), new wxIntegerListValidator(-50, 50)));
+ sheet->AddProperty(new wxProperty(_T("bill"), 25.0, _T("real"), new wxRealListValidator(0.0, 100.0)));
+ sheet->AddProperty(new wxProperty(_T("julian"), _T("one"), _T("string")));
+ sheet->AddProperty(new wxProperty(_T("bitmap"), _T("none"), _T("string"), new wxFilenameListValidator(_T("Select a bitmap file"), _T("*.bmp"))));
wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL);
- sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringListValidator(strings)));
+ sheet->AddProperty(new wxProperty(_T("constrained"), _T("one"), _T("string"), new wxStringListValidator(strings)));
wxStringList *strings2 = new wxStringList(wxT("earth"), wxT("fire"), wxT("wind"), wxT("water"), NULL);
- sheet->AddProperty(new wxProperty("string list", strings2, "stringlist"));
+ sheet->AddProperty(new wxProperty(_T("string list"), strings2, _T("stringlist")));
wxPropertyListView *view = new wxPropertyListView
(
wxPropertyListFrame *propFrame = NULL;
if (useDialog)
{
- propDialog = new PropListDialog(view, NULL, "Property Sheet Test",
+ propDialog = new PropListDialog(view, NULL, _T("Property Sheet Test"),
wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS);
m_childWindow = propDialog;
}
else
{
- propFrame = new PropListFrame(view, NULL, "Property Sheet Test", wxPoint(-1, -1), wxSize(400, 500));
+ propFrame = new PropListFrame(view, NULL, _T("Property Sheet Test"), wxPoint(-1, -1), wxSize(400, 500));
m_childWindow = propFrame;
}
wxPropertySheet *sheet = new wxPropertySheet;
- sheet->AddProperty(new wxProperty("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0)));
- sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool"));
- sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50)));
- sheet->AddProperty(new wxProperty("julian", "one", "string"));
+ sheet->AddProperty(new wxProperty(_T("fred"), 25.0, _T("real"), new wxRealFormValidator(0.0, 100.0)));
+ sheet->AddProperty(new wxProperty(_T("tough choice"), (bool)TRUE, _T("bool")));
+ sheet->AddProperty(new wxProperty(_T("ian"), (long)45, _T("integer"), new wxIntegerFormValidator(-50, 50)));
+ sheet->AddProperty(new wxProperty(_T("julian"), _T("one"), _T("string")));
wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL);
- sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringFormValidator(strings)));
+ sheet->AddProperty(new wxProperty(_T("constrained"), _T("one"), _T("string"), new wxStringFormValidator(strings)));
wxPropertyFormView *view = new wxPropertyFormView(NULL);
if (useDialog)
{
- propDialog = new PropFormDialog(view, NULL, "Property Form Test",
+ propDialog = new PropFormDialog(view, NULL, _T("Property Form Test"),
wxPoint(-1, -1), wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
m_childWindow = propDialog;
}
else
{
- propFrame = new PropFormFrame(view, NULL, "Property Form Test",
+ propFrame = new PropFormFrame(view, NULL, _T("Property Form Test"),
wxPoint(-1, -1), wxSize(380, 250));
propFrame->Initialize();
m_childWindow = propFrame;
#endif
// Add items to the panel
- wxButton *okButton = new wxButton(panel, wxID_OK, "OK", wxPoint(-1, -1),
- wxSize(80, 26), 0, wxDefaultValidator, "ok");
- wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, "Cancel", wxPoint(-1, -1),
- wxSize(80, 26), 0, wxDefaultValidator, "cancel");
- wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, "Update", wxPoint(-1, -1),
- wxSize(80, 26), 0, wxDefaultValidator, "update");
- wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, "Revert", wxPoint(-1, -1),
- wxSize(80, 26), 0, wxDefaultValidator, "revert");
+ wxButton *okButton = new wxButton(panel, wxID_OK, _T("OK"), wxPoint(-1, -1),
+ wxSize(80, 26), 0, wxDefaultValidator, _T("ok"));
+ wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, _T("Cancel"), wxPoint(-1, -1),
+ wxSize(80, 26), 0, wxDefaultValidator, _T("cancel"));
+ wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, _T("Update"), wxPoint(-1, -1),
+ wxSize(80, 26), 0, wxDefaultValidator, _T("update"));
+ wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, _T("Revert"), wxPoint(-1, -1),
+ wxSize(80, 26), 0, wxDefaultValidator, _T("revert"));
c = new wxLayoutConstraints;
c->right.SameAs(panel, wxRight, 4);
okButton->SetConstraints(c);
// The name of this text item matches the "fred" property
- wxTextCtrl *text = new wxTextCtrl(panel, -1, "Fred", wxPoint(-1, -1), wxSize(
- 200, -1), 0, wxDefaultValidator, "fred");
+ wxTextCtrl *text = new wxTextCtrl(panel, -1, _T("Fred"), wxPoint(-1, -1), wxSize(
+ 200, -1), 0, wxDefaultValidator, _T("fred"));
c = new wxLayoutConstraints;
c->left.SameAs(panel, wxLeft, 4);
c->width.AsIs();
text->SetConstraints(c);
- wxCheckBox *checkBox = new wxCheckBox(panel, -1, "Yes or no", wxPoint(-1, -1),
- wxSize(-1, -1), 0, wxDefaultValidator, "tough choice");
+ wxCheckBox *checkBox = new wxCheckBox(panel, -1, _T("Yes or no"), wxPoint(-1, -1),
+ wxSize(-1, -1), 0, wxDefaultValidator, _T("tough choice"));
c = new wxLayoutConstraints;
c->left.SameAs(text, wxRight, 20);
checkBox->SetConstraints(c);
wxSlider *slider = new wxSlider(panel, -1, -50, 50, 150, wxPoint(-1, -1),
- wxSize(200,10), 0, wxDefaultValidator, "ian");
+ wxSize(200,10), 0, wxDefaultValidator, _T("ian"));
c = new wxLayoutConstraints;
c->left.SameAs(panel, wxLeft, 4);
slider->SetConstraints(c);
wxListBox *listBox = new wxListBox(panel, -1, wxPoint(-1, -1),
- wxSize(200, 100), 0, NULL, 0, wxDefaultValidator, "constrained");
+ wxSize(200, 100), 0, NULL, 0, wxDefaultValidator, _T("constrained"));
c = new wxLayoutConstraints;
c->left.SameAs(panel, wxLeft, 4);
public:
PropListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"):
+ long style = wxDEFAULT_FRAME_STYLE, const wxString& name = _T("frame")):
wxPropertyListFrame(v, parent, title, pos, size, style, name)
{
}
public:
PropListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"):
+ long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = _T("dialogBox")):
wxPropertyListDialog(v, parent, title, pos, size, style, name)
{
}
public:
PropFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"):
+ long style = wxDEFAULT_FRAME_STYLE, const wxString& name = _T("frame")):
wxPropertyFormFrame(v, parent, title, pos, size, style, name)
{
}
public:
PropFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"):
+ long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = _T("dialogBox")):
wxPropertyFormDialog(v, parent, title, pos, size, style, name)
{
}
bool MyApp::OnInit()
{
// Create the main application window
- MyFrame *frame = new MyFrame("Proportional resize",
+ MyFrame *frame = new MyFrame(_T("Proportional resize"),
wxPoint(50, 50), wxSize(450, 340));
// Show it and tell the application that it's our main window
SetIcon(wxICON(mondrian));
// create a menu bar
- wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
+ wxMenu *menuFile = new wxMenu(_T(""), wxMENU_TEAROFF);
- menuFile->Append(wxID_ABOUT, "&About...\tCtrl-A", "Show about dialog");
+ menuFile->Append(wxID_ABOUT, _T("&About...\tCtrl-A"), _T("Show about dialog"));
menuFile->AppendSeparator();
- menuFile->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
+ menuFile->Append(Minimal_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));
// 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);
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(1);
- SetStatusText("Resize the frame to see how controls react");
+ SetStatusText(_T("Resize the frame to see how controls react"));
#endif // wxUSE_STATUSBAR
#define AddLine(orient) \
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
// top row -- top-aligned
wxBoxSizer *hsizer1 = new wxBoxSizer( wxHORIZONTAL );
- hsizer1->AddButton( "one", wxALIGN_LEFT | wxALIGN_TOP);
+ hsizer1->AddButton( _T("one"), wxALIGN_LEFT | wxALIGN_TOP);
hsizer1->AddLine(wxVERTICAL);
- hsizer1->AddButton( "two", wxALIGN_CENTER_HORIZONTAL | wxALIGN_TOP);
+ hsizer1->AddButton( _T("two"), wxALIGN_CENTER_HORIZONTAL | wxALIGN_TOP);
hsizer1->AddLine(wxVERTICAL);
- hsizer1->AddButton( "three", wxALIGN_RIGHT | wxALIGN_TOP);
+ hsizer1->AddButton( _T("three"), wxALIGN_RIGHT | wxALIGN_TOP);
topsizer->Add(hsizer1, 1, wxEXPAND);
topsizer->AddLine(wxHORIZONTAL);
wxBoxSizer *hsizer2 = new wxBoxSizer( wxHORIZONTAL );
- hsizer2->AddButton( "four", wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+ hsizer2->AddButton( _T("four"), wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
hsizer2->AddLine(wxVERTICAL);
// sizer that preserves it's shape
wxBoxSizer *vsizer = new wxBoxSizer( wxVERTICAL );
vsizer->Add(
- new wxButton( this, -1, "up", wxDefaultPosition, wxSize(100,25) ),
+ new wxButton( this, -1, _T("up"), wxDefaultPosition, wxSize(100,25) ),
1, wxEXPAND);
vsizer->Add(
- new wxButton( this, -1, "down", wxDefaultPosition, wxSize(100,25) ),
+ new wxButton( this, -1, _T("down"), wxDefaultPosition, wxSize(100,25) ),
1, wxEXPAND);
hsizer2->Add(vsizer, 1, wxSHAPED | wxALIGN_CENTER);
hsizer2->AddLine(wxVERTICAL);
- hsizer2->AddButton( "six", wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ hsizer2->AddButton( _T("six"), wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
topsizer->Add(hsizer2, 1, wxEXPAND);
topsizer->AddLine(wxHORIZONTAL);
wxBoxSizer *hsizer3 = new wxBoxSizer( wxHORIZONTAL );
- hsizer3->AddButton( "seven", wxALIGN_LEFT | wxALIGN_BOTTOM);
+ hsizer3->AddButton( _T("seven"), wxALIGN_LEFT | wxALIGN_BOTTOM);
hsizer3->AddLine(wxVERTICAL);
- hsizer3->AddButton( "eight", wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM);
+ hsizer3->AddButton( _T("eight"), wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM);
hsizer3->AddLine(wxVERTICAL);
// wxEXPAND should have no effect
- hsizer3->AddButton( "nine", wxEXPAND | wxALIGN_RIGHT | wxALIGN_BOTTOM);
+ hsizer3->AddButton( _T("nine"), wxEXPAND | wxALIGN_RIGHT | wxALIGN_BOTTOM);
topsizer->Add(hsizer3, 1, wxEXPAND);
#endif // wxBETA_NUMBER
);
- wxMessageBox(msg, "About Shaped Sizer", wxOK | wxICON_INFORMATION, this);
+ wxMessageBox(msg, _T("About Shaped Sizer"), wxOK | wxICON_INFORMATION, this);
}
{
public:
// ctor & dtor
- RegFrame(wxFrame *parent, char *title, int x, int y, int w, int h);
+ RegFrame(wxFrame *parent, wxChar *title, int x, int y, int w, int h);
virtual ~RegFrame();
// callbacks
wxMenu *CreateRegistryMenu()
{
wxMenu *pMenuNew = new wxMenu;
- pMenuNew->Append(Menu_NewKey, "&Key", "Create a new key");
+ pMenuNew->Append(Menu_NewKey, _T("&Key"), _T("Create a new key"));
pMenuNew->AppendSeparator();
- pMenuNew->Append(Menu_NewText, "&Text value", "Create a new text value");
- pMenuNew->Append(Menu_NewBinary, "&Binary value", "Create a new binary value");
+ pMenuNew->Append(Menu_NewText, _T("&Text value"), _T("Create a new text value"));
+ pMenuNew->Append(Menu_NewBinary, _T("&Binary value"), _T("Create a new binary value"));
wxMenu *pMenuReg = new wxMenu;
- pMenuReg->Append(Menu_New, "&New", pMenuNew);
- pMenuReg->Append(Menu_Delete, "&Delete...", "Delete selected key/value");
+ pMenuReg->Append(Menu_New, _T("&New"), pMenuNew);
+ pMenuReg->Append(Menu_Delete, _T("&Delete..."), _T("Delete selected key/value"));
pMenuReg->AppendSeparator();
- 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->Append(Menu_GoTo, _T("&Go to...\tCtrl-G"), _T("Go to registry key"));
+ pMenuReg->Append(Menu_Expand, _T("&Expand"), _T("Expand current key"));
+ pMenuReg->Append(Menu_Collapse, _T("&Collapse"), _T("Collapse current key"));
+ pMenuReg->Append(Menu_Toggle, _T("&Toggle"), _T("Toggle current key"));
pMenuReg->AppendSeparator();
- pMenuReg->Append(Menu_Refresh, "&Refresh", "Refresh the subtree");
+ pMenuReg->Append(Menu_Refresh, _T("&Refresh"), _T("Refresh the subtree"));
pMenuReg->AppendSeparator();
- pMenuReg->Append(Menu_Info, "&Properties","Information about current selection");
+ pMenuReg->Append(Menu_Info, _T("&Properties"),_T("Information about current selection"));
return pMenuReg;
}
bool RegApp::OnInit()
{
// create the main frame window and show it
- RegFrame *frame = new RegFrame(NULL, "wxRegTest", 50, 50, 600, 350);
+ RegFrame *frame = new RegFrame(NULL, _T("wxRegTest"), 50, 50, 600, 350);
frame->Show(TRUE);
SetTopWindow(frame);
// RegFrame
// ----------------------------------------------------------------------------
-RegFrame::RegFrame(wxFrame *parent, char *title, int x, int y, int w, int h)
+RegFrame::RegFrame(wxFrame *parent, wxChar *title, int x, int y, int w, int h)
: wxFrame(parent, -1, title, wxPoint(x, y), wxSize(w, h))
{
// this reduces flicker effects
// set the icon
// ------------
- SetIcon(wxIcon("app_icon"));
+ SetIcon(wxIcon(_T("app_icon")));
// create menu
// -----------
wxMenu *pMenuFile = new wxMenu;
- pMenuFile->Append(Menu_Test, "Te&st", "Test key creation");
+ pMenuFile->Append(Menu_Test, _T("Te&st"), _T("Test key creation"));
pMenuFile->AppendSeparator();
- pMenuFile->Append(Menu_About, "&About...", "Show an extraordinarly beautiful dialog");
+ pMenuFile->Append(Menu_About, _T("&About..."), _T("Show an extraordinarly beautiful dialog"));
pMenuFile->AppendSeparator();
- pMenuFile->Append(Menu_Quit, "E&xit", "Quit this program");
+ pMenuFile->Append(Menu_Quit, _T("E&xit"), _T("Quit this program"));
wxMenuBar *pMenu = new wxMenuBar;
- pMenu->Append(pMenuFile, "&File");
- pMenu->Append(CreateRegistryMenu(), "&Registry");
+ pMenu->Append(pMenuFile, _T("&File"));
+ pMenu->Append(CreateRegistryMenu(), _T("&Registry"));
SetMenuBar(pMenu);
// create child controls
void RegFrame::OnAbout(wxCommandEvent& event)
{
wxMessageDialog dialog(this,
- "wxRegistry sample\n"
- "© 1998, 2000 Vadim Zeitlin",
- "About wxRegTest", wxOK);
+ _T("wxRegistry sample\n")
+ _T("© 1998, 2000 Vadim Zeitlin"),
+ _T("About wxRegTest"), wxOK);
dialog.ShowModal();
}
{
if ( m_treeCtrl->IsKeySelected() ) {
m_treeCtrl->CreateNewKey(
- wxGetTextFromUser("Enter the name of the new key"));
+ wxGetTextFromUser(_T("Enter the name of the new key")));
}
}
{
if ( m_treeCtrl->IsKeySelected() ) {
m_treeCtrl->CreateNewTextValue(
- wxGetTextFromUser("Enter the name for the new text value"));
+ wxGetTextFromUser(_T("Enter the name for the new text value")));
}
}
{
if ( m_treeCtrl->IsKeySelected() ) {
m_treeCtrl->CreateNewBinaryValue(
- wxGetTextFromUser("Enter the name for the new binary value"));
+ wxGetTextFromUser(_T("Enter the name for the new binary value")));
}
}
RegImageList::RegImageList() : wxImageList(16, 16, TRUE)
{
// should be in sync with enum RegImageList::RegIcon
- static const char *aszIcons[] = { "key1","key2","key3","value1","value2" };
- wxString str = "icon_";
+ static const wxChar *aszIcons[] = { _T("key1"),_T("key2"),_T("key3"),_T("value1"),_T("value2") };
+ wxString str = _T("icon_");
for ( unsigned int n = 0; n < WXSIZEOF(aszIcons); n++ ) {
Add(wxIcon(str + aszIcons[n], wxBITMAP_TYPE_ICO_RESOURCE));
}
// create root keys
// ----------------
- m_pRoot = InsertNewTreeNode(NULL, "Registry Root", RegImageList::Root);
+ m_pRoot = InsertNewTreeNode(NULL, _T("Registry Root"), RegImageList::Root);
// create popup menu
// -----------------
return;
}
- wxRegKey key1(pNode->Key(), "key1");
+ wxRegKey key1(pNode->Key(), _T("key1"));
if ( key1.Create() ) {
- wxRegKey key2a(key1, "key2a"), key2b(key1, "key2b");
+ wxRegKey key2a(key1, _T("key2a")), key2b(key1, _T("key2b"));
if ( key2a.Create() && key2b.Create() ) {
// put some values under the newly created keys
- key1.SetValue(wxT("first_term"), "10");
- key1.SetValue(wxT("second_term"), "7");
- key2a = "this is the unnamed value";
+ key1.SetValue(wxT("first_term"), _T("10"));
+ key1.SetValue(wxT("second_term"), _T("7"));
+ key2a = _T("this is the unnamed value");
key2b.SetValue(wxT("sum"), 17);
// refresh tree
nameDst << wxString(dst->FullName()).AfterFirst('\\') << '\\'
<< wxString(src->FullName()).AfterLast('\\');
- wxString verb = m_copyOnDrop ? "copy" : "move";
- wxString what = isKey ? "key" : "value";
+ wxString verb = m_copyOnDrop ? _T("copy") : _T("move");
+ wxString what = isKey ? _T("key") : _T("value");
if ( wxMessageBox(wxString::Format
(
nameSrc.c_str(),
nameDst.c_str()
),
- "RegTest Confirm",
+ _T("RegTest Confirm"),
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) {
return;
}
while ( bCont ) {
wxString strItem;
if (str.IsEmpty())
- strItem = "<default>";
+ strItem = _T("<default>");
else
strItem = str;
- strItem += " = ";
+ strItem += _T(" = ");
// determine the appropriate icon
RegImageList::Icon icon;
return;
}
- wxString what = pCurrent->IsKey() ? "key" : "value";
+ wxString what = pCurrent->IsKey() ? _T("key") : _T("value");
if ( wxMessageBox(wxString::Format
(
wxT("Do you really want to delete this %s?"),
what.c_str()
),
- "Confirmation",
+ _T("Confirmation"),
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) {
return;
}
return;
}
- if ( pCurrent->Key().SetValue(strName, "") )
+ if ( pCurrent->Key().SetValue(strName, _T("")) )
pCurrent->Refresh();
}
bool MyApp::OnInit()
{
- m_image = wxImage("kclub.bmp", wxBITMAP_TYPE_BMP);
+ m_image = wxImage(_T("kclub.bmp"), wxBITMAP_TYPE_BMP);
// any unused colour will do
m_image.SetMaskColour( 0, 255, 255 );
return FALSE;
}
- MyFrame *frame = new MyFrame ("wxWindows rotate sample",
+ MyFrame *frame = new MyFrame (_T("wxWindows rotate sample"),
wxPoint(20,20), wxSize(600,450));
frame->Show (TRUE);
new MyCanvas(this);
wxMenu *menuFile = new wxMenu;
- menuFile->Append (ID_Angle, "Set &angle\tCtrl-A");
+ menuFile->Append (ID_Angle, _T("Set &angle\tCtrl-A"));
menuFile->AppendSeparator();
- menuFile->Append (ID_Quit, "E&xit\tAlt-X");
+ menuFile->Append (ID_Quit, _T("E&xit\tAlt-X"));
wxMenuBar *menuBar = new wxMenuBar;
- menuBar->Append (menuFile, "&File");
+ menuBar->Append (menuFile, _T("&File"));
SetMenuBar (menuBar);
}
void MyFrame::OnAngle (wxCommandEvent &)
{
long degrees = (long)((180*m_angle)/M_PI);
- degrees = wxGetNumberFromUser("Change the image rotation angle",
- "Angle in degrees:",
- "wxWindows rotate sample",
+ degrees = wxGetNumberFromUser(_T("Change the image rotation angle"),
+ _T("Angle in degrees:"),
+ _T("wxWindows rotate sample"),
degrees,
-180, +180,
this);
{
// Create the main frame window
- frame = new MyFrame(NULL, -1, "Sash Demo", wxPoint(0, 0), wxSize(500, 400),
+ frame = new MyFrame(NULL, -1, _T("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("sashtest_icn"));
+ frame->SetIcon(wxIcon(_T("sashtest_icn")));
#endif
#ifdef __X__
- frame->SetIcon(wxIcon("sashtest.xbm"));
+ frame->SetIcon(wxIcon(_T("sashtest.xbm")));
#endif
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(SASHTEST_NEW_WINDOW, "&New window");
- file_menu->Append(SASHTEST_TOGGLE_WINDOW, "&Toggle window");
- file_menu->Append(SASHTEST_QUIT, "&Exit");
+ file_menu->Append(SASHTEST_NEW_WINDOW, _T("&New window"));
+ file_menu->Append(SASHTEST_TOGGLE_WINDOW, _T("&Toggle window"));
+ file_menu->Append(SASHTEST_QUIT, _T("&Exit"));
wxMenu *help_menu = new wxMenu;
- help_menu->Append(SASHTEST_ABOUT, "&About");
+ help_menu->Append(SASHTEST_ABOUT, _T("&About"));
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);
win->SetSashVisible(wxSASH_RIGHT, TRUE);
win->SetExtraBorderSize(10);
- wxTextCtrl* textWindow = new wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
+ wxTextCtrl* textWindow = new wxTextCtrl(win, -1, _T(""), wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE|wxSUNKEN_BORDER);
// wxTE_MULTILINE|wxNO_BORDER);
- textWindow->SetValue("A help window");
+ textWindow->SetValue(_T("A help window"));
m_leftWindow1 = win;
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
- (void)wxMessageBox("wxWindows 2.0 Sash Demo\nAuthor: Julian Smart (c) 1998", "About Sash Demo");
+ (void)wxMessageBox(_T("wxWindows 2.0 Sash Demo\nAuthor: Julian Smart (c) 1998"), _T("About Sash Demo"));
}
void MyFrame::OnToggleWindow(wxCommandEvent& WXUNUSED(event))
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(10, 10), wxSize(300, 300),
wxDEFAULT_FRAME_STYLE |
wxNO_FULL_REPAINT_ON_RESIZE);
- char titleBuf[100];
- sprintf(titleBuf, "Canvas Frame %d", winNumber);
- subframe->SetTitle(titleBuf);
+ subframe->SetTitle(wxString::Format(_T("Canvas Frame %d"), winNumber));
winNumber ++;
// Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__
- subframe->SetIcon(wxIcon("sashtest_icn"));
+ subframe->SetIcon(wxIcon(_T("sashtest_icn")));
#endif
// Give it a status line
// Make a menubar
wxMenu *file_menu = new wxMenu;
- file_menu->Append(SASHTEST_NEW_WINDOW, "&New window");
- file_menu->Append(SASHTEST_CHILD_QUIT, "&Close child");
- file_menu->Append(SASHTEST_QUIT, "&Exit");
+ file_menu->Append(SASHTEST_NEW_WINDOW, _T("&New window"));
+ file_menu->Append(SASHTEST_CHILD_QUIT, _T("&Close child"));
+ file_menu->Append(SASHTEST_QUIT, _T("&Exit"));
wxMenu *option_menu = new wxMenu;
// Dummy option
- option_menu->Append(SASHTEST_REFRESH, "&Refresh picture");
+ option_menu->Append(SASHTEST_REFRESH, _T("&Refresh picture"));
wxMenu *help_menu = new wxMenu;
- help_menu->Append(SASHTEST_ABOUT, "&About");
+ help_menu->Append(SASHTEST_ABOUT, _T("&About"));
wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, "&File");
- menu_bar->Append(option_menu, "&Options");
- menu_bar->Append(help_menu, "&Help");
+ menu_bar->Append(file_menu, _T("&File"));
+ menu_bar->Append(option_menu, _T("&Options"));
+ menu_bar->Append(help_menu, _T("&Help"));
// Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar);
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;
MyScrolledWindow::MyScrolledWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size )
- : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER, "test canvas" )
+ : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER, _T("test canvas") )
{
MyTopLabels *top = new MyTopLabels( this, -1, wxDefaultPosition, wxSize(-1,25) );
MyRightLabels *right = new MyRightLabels( this, -1, wxDefaultPosition, wxSize(60,-1) );
m_owner->GetScrollPixelsPerUnit( &xScrollUnits, 0 );
dc.SetDeviceOrigin( -xOrigin * xScrollUnits, 0 );
- dc.DrawText( "Column 1", 5, 5 );
- dc.DrawText( "Column 2", 105, 5 );
- dc.DrawText( "Column 3", 205, 5 );
+ dc.DrawText( _T("Column 1"), 5, 5 );
+ dc.DrawText( _T("Column 2"), 105, 5 );
+ dc.DrawText( _T("Column 3"), 205, 5 );
}
// MyRightLabels
m_owner->GetScrollPixelsPerUnit( 0, &yScrollUnits );
dc.SetDeviceOrigin( 0, -yOrigin * yScrollUnits );
- dc.DrawText( "Row 1", 5, 5 );
- dc.DrawText( "Row 2", 5, 30 );
- dc.DrawText( "Row 3", 5, 55 );
- dc.DrawText( "Row 4", 5, 80 );
- dc.DrawText( "Row 5", 5, 105 );
- dc.DrawText( "Row 6", 5, 130 );
+ dc.DrawText( _T("Row 1"), 5, 5 );
+ dc.DrawText( _T("Row 2"), 5, 30 );
+ dc.DrawText( _T("Row 3"), 5, 55 );
+ dc.DrawText( _T("Row 4"), 5, 80 );
+ dc.DrawText( _T("Row 5"), 5, 105 );
+ dc.DrawText( _T("Row 6"), 5, 130 );
}
// MyCanvas
MyCanvas::MyCanvas( wxScrolledWindow *parent, MyTopLabels *top, MyRightLabels *right,
wxWindowID id, const wxPoint &pos, const wxSize &size )
- : wxPanel( parent, id, pos, size, wxSUNKEN_BORDER, "test canvas" )
+ : wxPanel( parent, id, pos, size, wxSUNKEN_BORDER, _T("test canvas") )
{
m_owner = parent;
m_topLabels = top;
m_rightLabels = right;
- (void)new wxButton( this, -1, "Hallo I", wxPoint(0,50), wxSize(100,25) );
- (void)new wxButton( this, -1, "Hallo II", wxPoint(200,50), wxSize(100,25) );
+ (void)new wxButton( this, -1, _T("Hallo I"), wxPoint(0,50), wxSize(100,25) );
+ (void)new wxButton( this, -1, _T("Hallo II"), wxPoint(200,50), wxSize(100,25) );
- (void)new wxTextCtrl( this, -1, "Text I", wxPoint(0,100), wxSize(100,25) );
- (void)new wxTextCtrl( this, -1, "Text II", wxPoint(200,100), wxSize(100,25) );
+ (void)new wxTextCtrl( this, -1, _T("Text I"), wxPoint(0,100), wxSize(100,25) );
+ (void)new wxTextCtrl( this, -1, _T("Text II"), wxPoint(200,100), wxSize(100,25) );
- (void)new wxComboBox( this, -1, "ComboBox I", wxPoint(0,150), wxSize(100,25), 0, NULL );
- (void)new wxComboBox( this, -1, "ComboBox II", wxPoint(200,150), wxSize(100,25), 0, NULL );
+ (void)new wxComboBox( this, -1, _T("ComboBox I"), wxPoint(0,150), wxSize(100,25), 0, NULL );
+ (void)new wxComboBox( this, -1, _T("ComboBox II"), wxPoint(200,150), wxSize(100,25), 0, NULL );
SetBackgroundColour( wxT("WHEAT") );
{
wxLogMessage( wxT("Redraw first cell") );
dc.DrawRectangle( 0, 0, 100, 25 );
- dc.DrawText( "First Cell", 5, 5 );
+ dc.DrawText( _T("First Cell"), 5, 5 );
}
}
{
wxLogMessage( wxT("Redraw second cell") );
dc.DrawRectangle( 200, 0, 100, 25 );
- dc.DrawText( "Second Cell", 205, 5 );
+ dc.DrawText( _T("Second Cell"), 205, 5 );
}
}
END_EVENT_TABLE()
MyFrame::MyFrame()
- : wxFrame( (wxFrame *)NULL, -1, "wxScrolledWindow sample",
+ : wxFrame( (wxFrame *)NULL, -1, _T("wxScrolledWindow sample"),
wxPoint(20,20), wxSize(470,500) )
{
wxMenu *file_menu = new wxMenu();
- file_menu->Append( ID_ABOUT, "&About...");
- file_menu->Append( ID_FULL, "&Full screen on/off");
- file_menu->Append( ID_QUIT, "E&xit\tAlt-X");
+ file_menu->Append( ID_ABOUT, _T("&About..."));
+ file_menu->Append( ID_FULL, _T("&Full screen on/off"));
+ file_menu->Append( ID_QUIT, _T("E&xit\tAlt-X"));
wxMenuBar *menu_bar = new wxMenuBar();
- menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(file_menu, _T("&File"));
SetMenuBar( menu_bar );
m_scrolled = new MyScrolledWindow( this, -1, wxDefaultPosition, wxSize(100,100) );
m_scrolled->SetScrollbars( 10, 10, 50, 100 );
- m_log = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
+ m_log = new wxTextCtrl( this, -1, _T("This is the log window.\n"), wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
delete old_log;
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
{
- (void)wxMessageBox( "wxScroll demo II\n"
- "Robert Roebling (c) 1998",
- "About wxScroll II Demo", wxICON_INFORMATION | wxOK );
+ (void)wxMessageBox( _T("wxScroll demo II\n")
+ _T("Robert Roebling (c) 1998"),
+ _T("About wxScroll II Demo"), wxICON_INFORMATION | wxOK );
}
//-----------------------------------------------------------------------------