]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/forty/canvas.cpp
allow 8bit chars in the group names in wxFileConfig
[wxWidgets.git] / samples / forty / canvas.cpp
index 18dec216f241d6e742ed0124e5d2bc128ef6802b..2ba1f15c5bf0c595bb2c51b515ed1d99d1abc57f 100644 (file)
@@ -50,8 +50,8 @@ FortyCanvas::FortyCanvas(wxWindow* parent, int x, int y, int w, int h) :
 #else
        m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
 #endif
-       SetBackgroundColour(*FortyApp::BackgroundColour());
-       AllowDoubleClick(true);
+       SetBackgroundColour(FortyApp::BackgroundColour());
+       AllowDoubleClick(TRUE);
 
        m_handCursor = new wxCursor(wxCURSOR_HAND);
        m_arrowCursor = new wxCursor(wxCURSOR_ARROW);
@@ -91,7 +91,7 @@ void FortyCanvas::UpdateScores()
 
 void FortyCanvas::OnDraw(wxDC& dc)
 {
-       dc.SetFont(m_font);
+       dc.SetFont(m_font);
        m_game->Redraw(dc);
 
        // if player name not set (and selection dialog is not displayed)
@@ -99,6 +99,7 @@ void FortyCanvas::OnDraw(wxDC& dc)
        if (m_player.Length() == 0 && !m_playerDialog)
        {
                m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile);
+               m_playerDialog->ShowModal();
                m_player = m_playerDialog->GetPlayersName();
                if (m_player.Length() > 0)
                {
@@ -109,6 +110,7 @@ void FortyCanvas::OnDraw(wxDC& dc)
                        m_game->DisplayScore(dc);
                        delete m_playerDialog;
                        m_playerDialog = 0;
+                       Refresh();
                }
                else
                {
@@ -139,7 +141,7 @@ void FortyCanvas::OnMouseEvent(wxMouseEvent& event)
 
        wxClientDC dc(this); 
        PrepareDC(dc);
-       dc.SetFont(m_font);
+       dc.SetFont(m_font);
 
        if (event.LeftDClick())
        {
@@ -206,7 +208,7 @@ void FortyCanvas::SetCursorStyle(int x, int y)
 
                        wxClientDC dc(this); 
                        PrepareDC(dc);
-                       dc.SetFont(m_font);
+                       dc.SetFont(m_font);
                        m_game->Redraw(dc);
                }
                else
@@ -220,11 +222,11 @@ void FortyCanvas::SetCursorStyle(int x, int y)
        // the card under the cursor can go somewhere 
        if (m_game->CanYouGo(x, y) && m_helpingHand)
        {
-               SetCursor(m_handCursor);
+               SetCursor(m_handCursor);
        }
        else
        {
-               SetCursor(m_arrowCursor);
+               SetCursor(m_arrowCursor);
        }
 
 }
@@ -239,7 +241,7 @@ void FortyCanvas::Undo()
 {
        wxClientDC dc(this); 
        PrepareDC(dc);
-       dc.SetFont(m_font);
+       dc.SetFont(m_font);
        m_game->Undo(dc);
 }
 
@@ -247,6 +249,6 @@ void FortyCanvas::Redo()
 {
        wxClientDC dc(this); 
        PrepareDC(dc);
-       dc.SetFont(m_font);
+       dc.SetFont(m_font);
        m_game->Redo(dc);
 }