]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/config/conftest.cpp
Added more makefiles
[wxWidgets.git] / samples / config / conftest.cpp
index 4626dd0122c8f607c78409a836d73a5a4bc5d9f3..b5ed3c607ffa250ec5c6eef5dadc20ef448543b5 100644 (file)
@@ -46,7 +46,7 @@ public:
   void OnQuit(wxCommandEvent& event);
   void OnAbout(wxCommandEvent& event);
   void OnDelete(wxCommandEvent& event);
-  bool OnClose() { return TRUE; }
+  void OnCloseWindow(wxCloseEvent& event);
 
 private:
   wxTextCtrl *m_text;
@@ -69,6 +69,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
   EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
   EVT_MENU(Minimal_About, MyFrame::OnAbout)
   EVT_MENU(Minimal_Delete, MyFrame::OnDelete)
+  EVT_CLOSE(MyFrame::OnCloseWindow)
 END_EVENT_TABLE()
 
 // ============================================================================
@@ -189,6 +190,11 @@ MyFrame::MyFrame()
   SetClientSize(w, h);
 }
 
+void MyFrame::OnCloseWindow(wxCloseEvent& event)
+{
+    this->Destroy();
+}
+
 void MyFrame::OnQuit(wxCommandEvent&)
 {
   Close(TRUE);
@@ -202,18 +208,16 @@ void MyFrame::OnAbout(wxCommandEvent&)
 
 void MyFrame::OnDelete(wxCommandEvent&)
 {
-  // VZ: it seems that DeleteAll() wreaks havoc on NT. Disabled until I
-  // investigate it further, do _not_ compile this code in meanwhile!
-#if 0
-  if ( wxConfigBase::Get()->DeleteAll() ) {
-    wxLogMessage("Config file/registry key successfully deleted.");
-
-    delete wxConfigBase::Set((wxConfigBase *) NULL);
-    wxConfigBase::DontCreateOnDemand();
-  }
-  else
-#endif // 0
-    wxLogError("Deleting config file/registry key failed.");
+    if ( wxConfigBase::Get()->DeleteAll() ) {
+        wxLogMessage("Config file/registry key successfully deleted.");
+
+        delete wxConfigBase::Set((wxConfigBase *) NULL);
+        wxConfigBase::DontCreateOnDemand();
+    }
+    else
+    {
+        wxLogError("Deleting config file/registry key failed.");
+    }
 }
 
 MyFrame::~MyFrame()