Unicode compilation fixes.
wxpoem now compiles with default settings (making it compilable with Unicode is a lost cause). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18396 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,16 +27,6 @@
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_IOSTREAMH
|
||||
#if defined(__WXMSW__) && !defined(__GNUWIN32__) && !defined(__MWERKS__)
|
||||
#include <strstrea.h>
|
||||
#else
|
||||
#include <strstream.h>
|
||||
#endif
|
||||
#else
|
||||
#include <strstream>
|
||||
//using namespace std;
|
||||
#endif
|
||||
#include "scorefil.h"
|
||||
#include "scoredg.h"
|
||||
|
||||
@@ -66,9 +56,9 @@ ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile) :
|
||||
wxArrayString players;
|
||||
scoreFile->GetPlayerList( players);
|
||||
|
||||
ostrstream os;
|
||||
wxString os;
|
||||
|
||||
os << "Player\tWins\tGames\tScore\n";
|
||||
os << _T("Player\tWins\tGames\tScore\n");
|
||||
for (unsigned int i = 0; i < players.Count(); i++)
|
||||
{
|
||||
int wins, games, score;
|
||||
@@ -79,15 +69,13 @@ ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile) :
|
||||
average = (2 * score + games) / (2 * games);
|
||||
}
|
||||
|
||||
os << players[i] << '\t'
|
||||
<< wins << '\t'
|
||||
<< games << '\t'
|
||||
<< average << '\n';
|
||||
os << players[i] << _T('\t')
|
||||
<< wins << _T('\t')
|
||||
<< games << _T('\t')
|
||||
<< average << _T('\n');
|
||||
}
|
||||
os << '\0';
|
||||
char* str = os.str();
|
||||
m_text = str;
|
||||
delete str;
|
||||
os << _T('\0');
|
||||
m_text = os;
|
||||
}
|
||||
|
||||
ScoreCanvas::~ScoreCanvas()
|
||||
@@ -98,7 +86,7 @@ void ScoreCanvas::OnDraw(wxDC& dc)
|
||||
{
|
||||
dc.SetFont(* m_font);
|
||||
|
||||
const char* str = m_text;
|
||||
const wxChar* str = m_text;
|
||||
unsigned int tab = 0;
|
||||
unsigned int tabstops[] = { 5, 100, 150, 200 };
|
||||
|
||||
@@ -106,29 +94,29 @@ void ScoreCanvas::OnDraw(wxDC& dc)
|
||||
int lineSpacing;
|
||||
{
|
||||
long w, h;
|
||||
dc.GetTextExtent("Testing", &w, &h);
|
||||
dc.GetTextExtent(_T("Testing"), &w, &h);
|
||||
lineSpacing = (int)h;
|
||||
}
|
||||
|
||||
int y = 0;
|
||||
while (*str)
|
||||
{
|
||||
char text[256];
|
||||
char* dest = text;
|
||||
wxChar text[256];
|
||||
wxChar* dest = text;
|
||||
|
||||
while (*str && *str >= ' ') *dest++ = *str++;
|
||||
*dest = '\0';
|
||||
while (*str && *str >= _T(' ')) *dest++ = *str++;
|
||||
*dest = _T('\0');
|
||||
|
||||
dc.DrawText(text, tabstops[tab], y);
|
||||
|
||||
if (*str == '\t')
|
||||
if (*str == _T('\t'))
|
||||
{
|
||||
if (tab < sizeof(tabstops) / sizeof(tabstops[0]) - 1)
|
||||
{
|
||||
tab++;
|
||||
}
|
||||
}
|
||||
else if (*str == '\n')
|
||||
else if (*str == _T('\n'))
|
||||
{
|
||||
tab = 0;
|
||||
y += lineSpacing;
|
||||
@@ -145,7 +133,7 @@ ScoreDialog::ScoreDialog(
|
||||
wxWindow* parent,
|
||||
ScoreFile* file
|
||||
) :
|
||||
wxDialog(parent, -1, "Scores",
|
||||
wxDialog(parent, -1, _T("Scores"),
|
||||
wxDefaultPosition, wxSize(310, 200),
|
||||
wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
|
||||
m_scoreFile(file)
|
||||
@@ -154,7 +142,7 @@ ScoreDialog::ScoreDialog(
|
||||
SetAutoLayout (TRUE);
|
||||
|
||||
ScoreCanvas* list = new ScoreCanvas(this, m_scoreFile);
|
||||
m_OK = new wxButton(this, wxID_OK, "OK");
|
||||
m_OK = new wxButton(this, wxID_OK, _T("OK"));
|
||||
|
||||
wxLayoutConstraints* layout;
|
||||
|
||||
|
Reference in New Issue
Block a user