wxConfig is used together with wxConfig::Set now
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5476 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -58,7 +58,6 @@
|
|||||||
void OnClose(wxCloseEvent& event);
|
void OnClose(wxCloseEvent& event);
|
||||||
private:
|
private:
|
||||||
wxHtmlHelpController help;
|
wxHtmlHelpController help;
|
||||||
wxConfig* config;
|
|
||||||
|
|
||||||
// any class wishing to process wxWindows events must use this macro
|
// any class wishing to process wxWindows events must use this macro
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
@@ -113,6 +112,9 @@
|
|||||||
wxImage::AddHandler(new wxJPEGHandler);
|
wxImage::AddHandler(new wxJPEGHandler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SetVendorName("wxWindows");
|
||||||
|
SetAppName("wxHTMLHelp");
|
||||||
|
|
||||||
// Create the main application window
|
// Create the main application window
|
||||||
MyFrame *frame = new MyFrame("HTML Help Sample",
|
MyFrame *frame = new MyFrame("HTML Help Sample",
|
||||||
wxPoint(50, 50), wxSize(150, 50));
|
wxPoint(50, 50), wxSize(150, 50));
|
||||||
@@ -151,9 +153,7 @@
|
|||||||
// ... and attach this menu bar to the frame
|
// ... and attach this menu bar to the frame
|
||||||
SetMenuBar(menuBar);
|
SetMenuBar(menuBar);
|
||||||
|
|
||||||
config = new wxConfig("wxHTMLhelp");
|
help.UseConfig(wxConfig::Get());
|
||||||
|
|
||||||
help.UseConfig(config);
|
|
||||||
bool ret;
|
bool ret;
|
||||||
ret = help.AddBook("helpfiles/testing.hhp");
|
ret = help.AddBook("helpfiles/testing.hhp");
|
||||||
if (! ret)
|
if (! ret)
|
||||||
@@ -184,8 +184,8 @@
|
|||||||
if ( help.GetFrame() ) // returns NULL if no help frame active
|
if ( help.GetFrame() ) // returns NULL if no help frame active
|
||||||
help.GetFrame()->Close(TRUE);
|
help.GetFrame()->Close(TRUE);
|
||||||
// now we can safely delete the config pointer
|
// now we can safely delete the config pointer
|
||||||
delete config;
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
delete wxConfig::Set(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -48,7 +48,6 @@ class MyApp : public wxApp
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
wxHtmlHelpController *help;
|
wxHtmlHelpController *help;
|
||||||
wxConfig* config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -64,9 +63,11 @@ bool MyApp::OnInit()
|
|||||||
wxInitAllImageHandlers();
|
wxInitAllImageHandlers();
|
||||||
wxFileSystem::AddHandler(new wxZipFSHandler);
|
wxFileSystem::AddHandler(new wxZipFSHandler);
|
||||||
|
|
||||||
config = new wxConfig("wxHTMLhelp");
|
SetVendorName("wxWindows");
|
||||||
|
SetAppName("wxHTMLHelp");
|
||||||
|
wxConfig::Get(); // create an instance
|
||||||
|
|
||||||
help = new wxHtmlHelpController;
|
help = new wxHtmlHelpController;
|
||||||
help -> UseConfig(config);
|
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
wxLogError("Usage : helpview <helpfile> [<more helpfiles>]");
|
wxLogError("Usage : helpview <helpfile> [<more helpfiles>]");
|
||||||
@@ -90,7 +91,7 @@ bool MyApp::OnInit()
|
|||||||
int MyApp::OnExit()
|
int MyApp::OnExit()
|
||||||
{
|
{
|
||||||
delete help;
|
delete help;
|
||||||
delete config;
|
delete wxConfig::Set(NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -113,6 +113,11 @@
|
|||||||
#if wxUSE_FS_INET
|
#if wxUSE_FS_INET
|
||||||
wxFileSystem::AddHandler(new wxInternetFSHandler);
|
wxFileSystem::AddHandler(new wxInternetFSHandler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SetVendorName("wxWindows");
|
||||||
|
SetAppName("wxHtmlTest");
|
||||||
|
// the following call to wxConfig::Get will use it to create an object...
|
||||||
|
|
||||||
// Create the main application window
|
// Create the main application window
|
||||||
MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
|
MyFrame *frame = new MyFrame("wxHtmlWindow testing application",
|
||||||
wxPoint(50, 50), wxSize(640, 480));
|
wxPoint(50, 50), wxSize(640, 480));
|
||||||
@@ -158,15 +163,11 @@
|
|||||||
|
|
||||||
CreateStatusBar(1);
|
CreateStatusBar(1);
|
||||||
|
|
||||||
{
|
|
||||||
wxConfig *cfg = new wxConfig("wxHtmlTest");
|
|
||||||
m_Html = new wxHtmlWindow(this);
|
m_Html = new wxHtmlWindow(this);
|
||||||
m_Html -> SetRelatedFrame(this, "HTML : %s");
|
m_Html -> SetRelatedFrame(this, "HTML : %s");
|
||||||
m_Html -> SetRelatedStatusBar(0);
|
m_Html -> SetRelatedStatusBar(0);
|
||||||
m_Html -> ReadCustomization(cfg);
|
m_Html -> ReadCustomization(wxConfig::Get());
|
||||||
delete cfg;
|
|
||||||
m_Html -> LoadPage("test.htm");
|
m_Html -> LoadPage("test.htm");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -175,10 +176,8 @@
|
|||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
// TRUE is to force the frame to close
|
// TRUE is to force the frame to close
|
||||||
wxLogDebug("about to save config...");
|
m_Html -> WriteCustomization(wxConfig::Get());
|
||||||
wxConfig *cfg = new wxConfig("wxHtmlTest");
|
delete wxConfig::Set(NULL);
|
||||||
m_Html -> WriteCustomization(cfg);
|
|
||||||
delete cfg;
|
|
||||||
Close(TRUE);
|
Close(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user