]> git.saurik.com Git - wxWidgets.git/blobdiff - demos/forty/scoredg.cpp
1.
[wxWidgets.git] / demos / forty / scoredg.cpp
index 136fff7021434633fbbc25dbf59bd243bbc8e929..2d2dd133896a7276f661c0cae77bbaf8d4c66df9 100644 (file)
@@ -11,7 +11,7 @@
 // Last modified: 22nd July 1998 - ported to wxWindows 2.0
 /////////////////////////////////////////////////////////////////////////////
 
 // Last modified: 22nd July 1998 - ported to wxWindows 2.0
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(__APPLE__)
 #pragma implementation
 #pragma interface
 #endif
 #pragma implementation
 #pragma interface
 #endif
 #include "wx/wx.h"
 #endif
 
 #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"
 
 #include "scorefil.h"
 #include "scoredg.h"
 
@@ -66,9 +56,9 @@ ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile) :
         wxArrayString players;
        scoreFile->GetPlayerList( players);
 
         wxArrayString players;
        scoreFile->GetPlayerList( players);
 
-       ostrstream os;
+       wxString os;
 
 
-       os << "Player\tWins\tGames\tScore\n";
+       os << wxT("Player\tWins\tGames\tScore\n");
        for (unsigned int i = 0; i < players.Count(); i++)
        {
                int wins, games, score;
        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);
                }
 
                        average = (2 * score + games) / (2 * games);
                }
 
-               os << players[i] << '\t' 
-                  << wins  << '\t'
-                  << games << '\t'
-                  << average << '\n';
+               os << players[i] << wxT('\t') 
+                  << wins  << wxT('\t')
+                  << games << wxT('\t')
+                  << average << wxT('\n');
        }
        }
-       os << '\0';
-       char* str = os.str();
-       m_text = str;
-       delete str;
+       os << wxT('\0');
+       m_text = os;
 }
 
 ScoreCanvas::~ScoreCanvas()
 }
 
 ScoreCanvas::~ScoreCanvas()
@@ -98,7 +86,7 @@ void ScoreCanvas::OnDraw(wxDC& dc)
 {
        dc.SetFont(* m_font);
 
 {
        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 };
 
        unsigned int tab = 0;
        unsigned int tabstops[] = { 5, 100, 150, 200 };
 
@@ -106,15 +94,15 @@ void ScoreCanvas::OnDraw(wxDC& dc)
        int lineSpacing;
        {
                long w, h;
        int lineSpacing;
        {
                long w, h;
-               dc.GetTextExtent("Testing", &w, &h);
+               dc.GetTextExtent(wxT("Testing"), &w, &h);
                lineSpacing = (int)h;
        }
 
        int y = 0;
        while (*str)
        {
                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 >= ' ') *dest++ = *str++;
                *dest = '\0';
@@ -145,7 +133,7 @@ ScoreDialog::ScoreDialog(
                                                        wxWindow* parent,
                                                        ScoreFile* file
                                                        ) :
                                                        wxWindow* parent,
                                                        ScoreFile* file
                                                        ) :
-       wxDialog(parent, -1, "Scores",
+       wxDialog(parent, -1, _("Scores"),
                        wxDefaultPosition, wxSize(310, 200),
                        wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
        m_scoreFile(file)
                        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);
        SetAutoLayout (TRUE);
 
        ScoreCanvas* list = new ScoreCanvas(this, m_scoreFile);
-       m_OK = new wxButton(this, wxID_OK, "OK");
+       m_OK = new wxButton(this, wxID_OK, _("OK"));
 
        wxLayoutConstraints* layout;
 
 
        wxLayoutConstraints* layout;
 
@@ -186,7 +174,7 @@ void ScoreDialog::Display()
        Show(TRUE);
 }
 
        Show(TRUE);
 }
 
-void ScoreDialog::OnCloseWindow(wxCloseEvent& event)
+void ScoreDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
 {
     EndModal(wxID_OK);
 }
 {
     EndModal(wxID_OK);
 }