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