]> git.saurik.com Git - wxWidgets.git/blobdiff - demos/bombs/bombs.cpp
Removed very out of date files in docs/msw
[wxWidgets.git] / demos / bombs / bombs.cpp
index 846f692072f272b3a30354ab65b5d6fc870be448..53de513670ace9215525212e48818f8886f7c1d8 100644 (file)
@@ -23,6 +23,8 @@
 #   include "wx/wx.h"
 #endif //precompiled headers
 
+#include "wx/stockitem.h"
+
 #include "bombs.h"
 
 #include <stdlib.h>
@@ -53,7 +55,7 @@ bool BombsApp::OnInit()
 
     m_frame = new BombsFrame(&m_game);
 
-    m_frame->NewGame(bombsID_EASY);
+    m_frame->NewGame(bombsID_EASY, false);
 
     return true;
 }
@@ -90,7 +92,7 @@ BombsFrame::BombsFrame(BombsGame *game)
         menuLevel, wxT("Starts a new game"));
 
     menuFile->AppendSeparator();
-    menuFile->Append(wxID_EXIT, wxT("E&xit"), wxT("Quits the application"));
+    menuFile->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT), wxT("Quits the application"));
 
     menuBar->Append(menuFile, wxT("&File"));
 
@@ -121,8 +123,18 @@ void BombsFrame::OnExit(wxCommandEvent& WXUNUSED(event))
     Close();
 }
 
-void BombsFrame::NewGame(int level)
+void BombsFrame::NewGame(int level, bool query)
 {
+    if(query)
+    {
+       int ok = wxMessageBox(
+                  wxT("Start new game regardless previous board?"),
+                  wxT("Confirm"),
+                  wxYES_NO | wxICON_QUESTION,
+                  this
+                );
+       if(ok!=wxYES)return;
+    }
 
     int numHorzCells = 20, numVertCells = 20;
 
@@ -162,17 +174,17 @@ void BombsFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
 
 void BombsFrame::OnNewEasyGame(wxCommandEvent& WXUNUSED(event))
 {
-    NewGame(bombsID_EASY);
+    NewGame(bombsID_EASY, true);
 }
 
 void BombsFrame::OnNewMediumGame(wxCommandEvent& WXUNUSED(event))
 {
-    NewGame(bombsID_MEDIUM);
+    NewGame(bombsID_MEDIUM, true);
 }
 
 void BombsFrame::OnNewHardGame(wxCommandEvent& WXUNUSED(event))
 {
-    NewGame(bombsID_HARD);
+    NewGame(bombsID_HARD, true);
 }
 
 BEGIN_EVENT_TABLE(BombsCanvas, wxPanel)