]> git.saurik.com Git - wxWidgets.git/commitdiff
wxConfig is used together with wxConfig::Set now
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 17 Jan 2000 17:18:53 +0000 (17:18 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 17 Jan 2000 17:18:53 +0000 (17:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5476 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/html/help/help.cpp
samples/html/helpview/helpview.cpp
samples/html/test/test.cpp

index f67150b423ba66dc60bef7b66352c3fbb81a8990..26a13b0c0315e47a93fdac27fc128237a0fd94c8 100644 (file)
@@ -58,7 +58,6 @@
       void OnClose(wxCloseEvent& event);
    private:
       wxHtmlHelpController help;
-      wxConfig* config;
    
     // any class wishing to process wxWindows events must use this macro
     DECLARE_EVENT_TABLE()
         wxImage::AddHandler(new wxJPEGHandler);
        #endif
 
+      SetVendorName("wxWindows");
+      SetAppName("wxHTMLHelp"); 
+
     // Create the main application window
       MyFrame *frame = new MyFrame("HTML Help Sample",
          wxPoint(50, 50), wxSize(150, 50));
     // ... and attach this menu bar to the frame
       SetMenuBar(menuBar);
 
-      config = new wxConfig("wxHTMLhelp");
-
-      help.UseConfig(config);
+      help.UseConfig(wxConfig::Get());
       bool ret;
       ret = help.AddBook("helpfiles/testing.hhp");
       if (! ret)
        if ( help.GetFrame() ) // returns NULL if no help frame active
            help.GetFrame()->Close(TRUE);
        // now we can safely delete the config pointer
-       delete config;
        event.Skip();   
+       delete wxConfig::Set(NULL);
    }
 
 
index 5992be07a6be6fc905d05009af90b3108c18393d..a6165db27049ecd1f5c2306a25f5b8f8758c7d01 100644 (file)
@@ -48,7 +48,6 @@ class MyApp : public wxApp
 
     private:
         wxHtmlHelpController *help;
-        wxConfig* config;
 };
 
 
@@ -64,9 +63,11 @@ bool MyApp::OnInit()
     wxInitAllImageHandlers();
     wxFileSystem::AddHandler(new wxZipFSHandler);
 
-    config = new wxConfig("wxHTMLhelp");
+    SetVendorName("wxWindows");
+    SetAppName("wxHTMLHelp"); 
+    wxConfig::Get(); // create an instance
+
     help = new wxHtmlHelpController;
-    help -> UseConfig(config);
     
     if (argc < 2) {
         wxLogError("Usage : helpview <helpfile> [<more helpfiles>]");
@@ -90,7 +91,7 @@ bool MyApp::OnInit()
 int MyApp::OnExit()
 {
     delete help;
-    delete config;
+    delete wxConfig::Set(NULL);
 
     return 0;
 }
index 8268532c50689d0844b60c883df35d1e5e2c9f2b..d738d480e1b81c221d4bff3751d95d9733acfcf6 100644 (file)
      #if wxUSE_FS_INET
      wxFileSystem::AddHandler(new wxInternetFSHandler);
      #endif
+
+      SetVendorName("wxWindows");
+      SetAppName("wxHtmlTest"); 
+      // the following call to wxConfig::Get will use it to create an object...
+
     // Create the main application window
       MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
          wxPoint(50, 50), wxSize(640, 480));
    
       CreateStatusBar(1);
 
-      {
-      wxConfig *cfg = new wxConfig("wxHtmlTest");
       m_Html = new wxHtmlWindow(this);
       m_Html -> SetRelatedFrame(this, "HTML : %s");
       m_Html -> SetRelatedStatusBar(0);
-      m_Html -> ReadCustomization(cfg);
-      delete cfg;
+      m_Html -> ReadCustomization(wxConfig::Get());
       m_Html -> LoadPage("test.htm");
-      }
    }
 
 
    void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
    {
     // TRUE is to force the frame to close
-    wxLogDebug("about to save config...");
-    wxConfig *cfg = new wxConfig("wxHtmlTest");
-    m_Html -> WriteCustomization(cfg);
-    delete cfg;
+    m_Html -> WriteCustomization(wxConfig::Get());
+    delete wxConfig::Set(NULL);
     Close(TRUE);
    }