FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h);
virtual ~FortyFrame();
- bool OnClose();
+ void OnCloseWindow(wxCloseEvent& event);
// Menu callbacks
void NewGame(wxCommandEvent& event);
EVT_MENU(SCORES, FortyFrame::Scores)
EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
+ EVT_CLOSE(FortyFrame::OnCloseWindow)
END_EVENT_TABLE()
// Create a new application object
-1, -1, 668, 510
);
- // Show the frame
+ // Show the frame
frame->Show(TRUE);
- return true;
+ return TRUE;
}
const wxColour& FortyApp::BackgroundColour()
FortyFrame::FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h):
wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
{
+#ifdef __WXMAC__
+ // we need this in order to allow the about menu relocation, since ABOUT is not the default id of the about menu
+ wxApp::s_macAboutMenuItemId = ABOUT ;
+#endif
// set the icon
#ifdef __WXMSW__
SetIcon(wxIcon("CardsIcon"));
{
}
-bool FortyFrame::OnClose()
+void FortyFrame::OnCloseWindow(wxCloseEvent& event)
{
- return m_canvas->OnClose();
+ if (m_canvas->OnCloseCanvas() )
+ {
+ this->Destroy();
+ }
+ else
+ event.Veto();
}
void
{
#ifdef __WXGTK__
// wxGTK doesn't call OnClose() so we do it here
- if (OnClose())
+// if (OnClose())
#endif
Close(TRUE);
}