]> git.saurik.com Git - wxWidgets.git/blob - samples/html/helpview/helpview.cpp
correct access for virtuals
[wxWidgets.git] / samples / html / helpview / helpview.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: helpview.cpp
3 // Purpose: wxHtml help browser
4 // Please note: see utils/helpview for a more fully-featured
5 // standalone help browser.
6 /////////////////////////////////////////////////////////////////////////////
7
8 // For compilers that support precompilation, includes "wx/wx.h".
9 #include "wx/wxprec.h"
10
11 #ifdef __BORLANDC__
12 #pragma hdrstop
13 #endif
14
15 // for all others, include the necessary headers (this file is usually all you
16 // need because it includes almost all "standard" wxWidgets headers
17 #ifndef WX_PRECOMP
18 #include "wx/wx.h"
19 #endif
20
21 #include "wx/image.h"
22 #include "wx/wxhtml.h"
23 #include "wx/fs_zip.h"
24 #include "wx/log.h"
25 #include "wx/filedlg.h"
26
27 // ----------------------------------------------------------------------------
28 // private classes
29 // ----------------------------------------------------------------------------
30
31
32 // Define a new application type, each program should derive a class from wxApp
33 class MyApp : public wxApp
34 {
35 public:
36 // override base class virtuals
37 // ----------------------------
38
39 // this one is called on application startup and is a good place for the app
40 // initialization (doing it here and not in the ctor allows to have an error
41 // return: if OnInit() returns false, the application terminates)
42
43 virtual bool OnInit();
44 virtual int OnExit();
45
46 private:
47 wxHtmlHelpController *help;
48 };
49
50
51 IMPLEMENT_APP(MyApp)
52
53
54 bool MyApp::OnInit()
55 {
56 #ifdef __WXMOTIF__
57 delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used
58 #endif
59
60 wxInitAllImageHandlers();
61 wxFileSystem::AddHandler(new wxZipFSHandler);
62
63 SetVendorName(wxT("wxWidgets"));
64 SetAppName(wxT("wxHTMLHelp"));
65 wxConfig::Get(); // create an instance
66
67 help = new wxHtmlHelpController;
68
69 if (argc < 2) {
70 wxLogError(wxT("Usage : helpview <helpfile> [<more helpfiles>]"));
71 wxLogError(wxT(" helpfile may be .hhp, .zip or .htb"));
72 return false;
73 }
74
75 for (int i = 1; i < argc; i++)
76 help->AddBook(wxFileName(argv[i]));
77
78 #ifdef __WXMOTIF__
79 delete wxLog::SetActiveTarget(new wxLogGui);
80 #endif
81
82 help -> DisplayContents();
83
84 return true;
85 }
86
87
88 int MyApp::OnExit()
89 {
90 delete help;
91 delete wxConfig::Set(NULL);
92
93 return 0;
94 }
95