]> git.saurik.com Git - wxWidgets.git/blame - samples/html/helpview/helpview.cpp
Replaced an old ifndef FWD_ONLY_CURSORS with the new wxODBC_FWD_ONLY_CURSORS setup...
[wxWidgets.git] / samples / html / helpview / helpview.cpp
CommitLineData
62877de0
VS
1
2/////////////////////////////////////////////////////////////////////////////
3// Name: helpview.cpp
4// Purpose: wxHtml help browser
5/////////////////////////////////////////////////////////////////////////////
6
7#ifdef __GNUG__
8#pragma implementation "help.cpp"
9#pragma interface "help.cpp"
10#endif
11
12// For compilers that support precompilation, includes "wx/wx.h".
13#include <wx/wxprec.h>
14
15#ifdef __BORLANDC__
16#pragma hdrstop
17#endif
18
19// for all others, include the necessary headers (this file is usually all you
20// need because it includes almost all "standard" wxWindows headers
21#ifndef WX_PRECOMP
22#include <wx/wx.h>
23#endif
24
25#include <wx/image.h>
26#include <wx/wxhtml.h>
27#include <wx/fs_zip.h>
28
29// ----------------------------------------------------------------------------
30// private classes
31// ----------------------------------------------------------------------------
32
33
34// Define a new application type, each program should derive a class from wxApp
35class MyApp : public wxApp
36{
37 public:
38 // override base class virtuals
39 // ----------------------------
40
41 // this one is called on application startup and is a good place for the app
42 // initialization (doing it here and not in the ctor allows to have an error
43 // return: if OnInit() returns false, the application terminates)
44
45 virtual bool OnInit();
46 virtual int OnExit();
47
48 private:
49 wxHtmlHelpController *help;
50 wxConfig* config;
51};
52
53
54IMPLEMENT_APP(MyApp)
55
56
57bool MyApp::OnInit()
58{
59 wxInitAllImageHandlers();
60 wxFileSystem::AddHandler(new wxZipFSHandler);
61
62 config = new wxConfig("wxHTMLhelp");
63 help = new wxHtmlHelpController;
64 help -> UseConfig(config);
65
66 if (argc < 2) {
67 wxLogError("Usage : helpview <helpfile> [<more helpfiles>]");
68 wxLogError(" helpfile may be .hhp, .zip or .htb");
69 return FALSE;
70 }
71
72 for (int i = 1; i < argc; i++)
73 help -> AddBook(argv[i]);
74
75 help -> DisplayContents();
76
77 return TRUE;
78}
79
80
81int MyApp::OnExit()
82{
83 delete help;
84 delete config;
85
86 return 0;
87}
88