#else
m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
#endif
- SetBackgroundColour(*FortyApp::BackgroundColour());
- AllowDoubleClick(true);
+ SetBackgroundColour(FortyApp::BackgroundColour());
m_handCursor = new wxCursor(wxCURSOR_HAND);
m_arrowCursor = new wxCursor(wxCURSOR_ARROW);
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)
// then ask the player for their name
if (m_player.Length() == 0 && !m_playerDialog)
{
- m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile);
+ m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile);
+ m_playerDialog->ShowModal();
m_player = m_playerDialog->GetPlayersName();
if (m_player.Length() > 0)
{
m_scoreFile->ReadPlayersScore(m_player, wins, games, score);
m_game->NewPlayer(wins, games, score);
m_game->DisplayScore(dc);
- delete m_playerDialog;
+ m_playerDialog->Destroy();
m_playerDialog = 0;
+ Refresh();
}
else
{
/*
Called when the main frame is closed
*/
-bool FortyCanvas::OnClose()
+bool FortyCanvas::OnCloseCanvas()
{
if (m_game->InPlay() &&
wxMessageBox("Are you sure you want to\nabandon the current game?",
"Warning", wxYES_NO | wxICON_QUESTION) == wxNO)
{
- return FALSE;
+ return FALSE;
}
return TRUE;
}
wxClientDC dc(this);
PrepareDC(dc);
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
if (event.LeftDClick())
{
wxClientDC dc(this);
PrepareDC(dc);
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
m_game->Redraw(dc);
}
else
// 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);
}
}
{
wxClientDC dc(this);
PrepareDC(dc);
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
m_game->Undo(dc);
}
{
wxClientDC dc(this);
PrepareDC(dc);
- dc.SetFont(m_font);
+ dc.SetFont(* m_font);
m_game->Redo(dc);
}