]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/config/conftest.cpp
don't call wxYield() from EnsureVisible(), this is too dangerous - and unnecessary...
[wxWidgets.git] / samples / config / conftest.cpp
index 4d485ac2694ef528d7104d16fb43a14ac70dbc77..0dbc6cd1488b48512268922cb93601bb626be2db 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()
 
 // ============================================================================
@@ -140,6 +141,12 @@ int MyApp::OnExit()
 MyFrame::MyFrame()
        : wxFrame((wxFrame *) NULL, -1, "wxConfig Demo")
 {
+  // submenu
+  wxMenu *sub_menu = new wxMenu( wxEmptyString, wxMENU_TEAROFF );
+  sub_menu->Append(Minimal_About, "&About", "About this sample");
+  sub_menu->Append(Minimal_About, "&About", "About this sample");
+  sub_menu->Append(Minimal_About, "&About", "About this sample");
+
   // menu
   wxMenu *file_menu = new wxMenu;
 
@@ -189,6 +196,11 @@ MyFrame::MyFrame()
   SetClientSize(w, h);
 }
 
+void MyFrame::OnCloseWindow(wxCloseEvent& event)
+{
+    this->Destroy();
+}
+
 void MyFrame::OnQuit(wxCommandEvent&)
 {
   Close(TRUE);
@@ -196,24 +208,22 @@ void MyFrame::OnQuit(wxCommandEvent&)
 
 void MyFrame::OnAbout(wxCommandEvent&)
 {
-  wxMessageBox("wxConfig demo\n© Vadim Zeitlin 1998", "About",
+  wxMessageBox(_T("wxConfig demo\n© Vadim Zeitlin 1998"), _T("About"),
                wxICON_INFORMATION | wxOK);
 }
 
 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!
-  // JACS: wxRegConfig::DeleteAll is disabled, so it's safe to call DeleteAll,
-  // it just won't do anything useful on Win95/NT.
     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.");
+        wxLogMessage(_T("Config file/registry key successfully deleted."));
+
+        delete wxConfigBase::Set((wxConfigBase *) NULL);
+        wxConfigBase::DontCreateOnDemand();
+    }
+    else
+    {
+        wxLogError(_T("Deleting config file/registry key failed."));
+    }
 }
 
 MyFrame::~MyFrame()