Backported Unicode compilation fixes for demos and exec sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-01-12 20:48:13 +00:00
parent c25bc243eb
commit a98477bd0b
16 changed files with 161 additions and 144 deletions

View File

@@ -40,7 +40,7 @@ bool AppClass::OnInit()
level=IDM_EASY;
BombsFrame =
new BombsFrameClass(NULL, "wxBombs", wxPoint(155, 165), wxSize(300, 300), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION);
new BombsFrameClass(NULL, _T("wxBombs"), wxPoint(155, 165), wxSize(300, 300), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION);
int xmax=BombsFrame->BombsCanvas->field_width*BombsFrame->BombsCanvas->x_cell*X_UNIT;
int ymax=BombsFrame->BombsCanvas->field_height*BombsFrame->BombsCanvas->y_cell*Y_UNIT;
@@ -72,17 +72,17 @@ BombsFrameClass::BombsFrameClass(wxFrame *parent, const wxString& title, const w
// Create a menu bar for the frame
wxMenuBar *menuBar1 = new wxMenuBar;
wxMenu *menu1 = new wxMenu;
menu1->Append(IDM_EXIT, "E&xit"); // , "Quit the program");
menu1->Append(IDM_EXIT, _T("E&xit")); // , "Quit the program");
menu1->AppendSeparator();
menu1->Append(IDM_ABOUT, "&About..."); // , "Infos on wxBombs");
menuBar1->Append(menu1, "&File");
menu1->Append(IDM_ABOUT, _T("&About...")); // , "Infos on wxBombs");
menuBar1->Append(menu1, _T("&File"));
wxMenu *menu2 = new wxMenu;
menu2->Append(IDM_RESTART, "&Restart"); // , "Clear the play field");
menu2->Append(IDM_RESTART, _T("&Restart")); // , "Clear the play field");
menu2->AppendSeparator();
menu2->Append(IDM_EASY, "&Easy", wxEmptyString, TRUE); // "10x10 play field", TRUE);
menu2->Append(IDM_MEDIUM, "&Medium", wxEmptyString, TRUE); // "15x15 play field", TRUE);
menu2->Append(IDM_DIFFICULT, "&Difficult", wxEmptyString, TRUE); // "25x20 play field", TRUE);
menuBar1->Append(menu2, "&Game");
menu2->Append(IDM_EASY, _T("&Easy"), wxEmptyString, TRUE); // "10x10 play field", TRUE);
menu2->Append(IDM_MEDIUM, _T("&Medium"), wxEmptyString, TRUE); // "15x15 play field", TRUE);
menu2->Append(IDM_DIFFICULT, _T("&Difficult"), wxEmptyString, TRUE); // "25x20 play field", TRUE);
menuBar1->Append(menu2, _T("&Game"));
SetMenuBar(menuBar1);
menuBar=menuBar1;
menuBar->Check(wxGetApp().level, TRUE);
@@ -124,7 +124,7 @@ void BombsFrameClass::OnRestart(wxCommandEvent& event)
void BombsFrameClass::OnAbout(wxCommandEvent& event)
{
wxMessageBox("wxBombs (c) 1996 by P. Foggia\n<foggia@amalfi.dis.unina.it>", "About wxBombs");
wxMessageBox(_T("wxBombs (c) 1996 by P. Foggia\n<foggia@amalfi.dis.unina.it>"), _T("About wxBombs"));
}
void BombsFrameClass::OnEasy(wxCommandEvent& event)
@@ -162,7 +162,7 @@ BombsCanvasClass::BombsCanvasClass(wxFrame *parent, const wxPoint& pos, const wx
dc.SetFont(font);
long chw, chh;
char buf[]="M";
wxChar buf[]=_T("M");
dc.GetTextExtent(buf, &chw, &chh);
dc.SetFont(wxNullFont);

View File

@@ -33,15 +33,15 @@
/*---------------------------------------------------------------------*/
void BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
{ int x,y,xmax,ymax;
char buf[2];
wxChar buf[2];
long chw, chh;
wxColour *wxBlack = wxTheColourDatabase->FindColour("BLACK");
wxColour *wxWhite = wxTheColourDatabase->FindColour("WHITE");
wxColour *wxRed = wxTheColourDatabase->FindColour("RED");
wxColour *wxBlue = wxTheColourDatabase->FindColour("BLUE");
wxColour *wxGrey = wxTheColourDatabase->FindColour("LIGHT GREY");
wxColour *wxGreen = wxTheColourDatabase->FindColour("GREEN");
wxColour *wxBlack = wxTheColourDatabase->FindColour(_T("BLACK"));
wxColour *wxWhite = wxTheColourDatabase->FindColour(_T("WHITE"));
wxColour *wxRed = wxTheColourDatabase->FindColour(_T("RED"));
wxColour *wxBlue = wxTheColourDatabase->FindColour(_T("BLUE"));
wxColour *wxGrey = wxTheColourDatabase->FindColour(_T("LIGHT GREY"));
wxColour *wxGreen = wxTheColourDatabase->FindColour(_T("GREEN"));
wxPen *blackPen = wxThePenList->FindOrCreatePen(*wxBlack, 1, wxSOLID);
wxPen *redPen = wxThePenList->FindOrCreatePen(*wxRed, 1, wxSOLID);
@@ -64,7 +64,7 @@ void BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
wxFont font= BOMBS_FONT;
dc->SetFont(font);
buf[1]='\0';
buf[1]=_T('\0');
for(x=xc1; x<=xc2; x++)
for(y=yc1; y<=yc2; y++)
{ if (wxGetApp().Game.IsMarked(x,y))
@@ -72,7 +72,7 @@ void BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
dc->SetBrush(* greyBrush);
dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
*buf='M';
*buf=_T('M');
if (!wxGetApp().Game.IsHidden(x,y) && wxGetApp().Game.IsBomb(x,y))
dc->SetTextForeground(*wxBlue);
else
@@ -102,7 +102,7 @@ void BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
dc->SetBrush(* redBrush);
dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
*buf='B';
*buf=_T('B');
dc->SetTextForeground(* wxBlack);
dc->SetTextBackground(* wxRed);
dc->GetTextExtent(buf, &chw, &chh);
@@ -123,11 +123,11 @@ void BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
dc->SetBrush(* whiteBrush);
dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
*buf = (wxGetApp().Game.Get(x,y) & BG_MASK) + '0';
*buf = (wxGetApp().Game.Get(x,y) & BG_MASK) + _T('0');
dc->GetTextExtent(buf, &chw, &chh);
switch(*buf)
{ case '0': dc->SetTextForeground(* wxGreen); break;
case '1': dc->SetTextForeground(* wxBlue); break;
{ case _T('0'): dc->SetTextForeground(* wxGreen); break;
case _T('1'): dc->SetTextForeground(* wxBlue); break;
default: dc->SetTextForeground(* wxBlack); break;
}
dc->SetTextBackground(* wxWhite);
@@ -140,9 +140,10 @@ void BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
dc->SetFont(wxNullFont);
if (wxGetApp().BombsFrame)
{ char buf[80];
sprintf(buf, "%d bombs %d remaining cells",
wxGetApp().Game.GetBombs(), wxGetApp().Game.GetRemainingCells());
{ wxString buf;
buf.Printf(_T("%d bombs %d remaining cells"),
wxGetApp().Game.GetBombs(),
wxGetApp().Game.GetRemainingCells());
wxGetApp().BombsFrame->SetStatusText(buf, 0);
}
}
@@ -172,7 +173,7 @@ void BombsCanvasClass::Uncover(int x, int y)
if (wxGetApp().Game.IsBomb(x,y) || wxGetApp().Game.GetRemainingCells()==0)
{ wxBell();
if (!wxGetApp().Game.IsBomb(x,y))
{ wxMessageBox("Nice! You found all the bombs!", "wxWin Bombs",
{ wxMessageBox(_T("Nice! You found all the bombs!"), _T("wxWin Bombs"),
wxOK|wxCENTRE, wxGetApp().BombsFrame);
}
else // x,y is a bomb