]> git.saurik.com Git - wxWidgets.git/blame - samples/html/helpview/helpview.cpp
[ 1936700 ] wxCAL_SHOW_WEEK_NUMBERS, slightly modified
[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
62877de0 8// For compilers that support precompilation, includes "wx/wx.h".
92a19c2e 9#include "wx/wxprec.h"
62877de0
VS
10
11#ifdef __BORLANDC__
12#pragma hdrstop
13#endif
14
15// for all others, include the necessary headers (this file is usually all you
be5a51fb 16// need because it includes almost all "standard" wxWidgets headers
62877de0 17#ifndef WX_PRECOMP
67547666 18#include "wx/wx.h"
62877de0
VS
19#endif
20
67547666
GD
21#include "wx/image.h"
22#include "wx/wxhtml.h"
23#include "wx/fs_zip.h"
24#include "wx/log.h"
7414c52c
JS
25#include "wx/filedlg.h"
26
62877de0
VS
27// ----------------------------------------------------------------------------
28// private classes
29// ----------------------------------------------------------------------------
30
31
32// Define a new application type, each program should derive a class from wxApp
33class 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;
62877de0
VS
48};
49
50
51IMPLEMENT_APP(MyApp)
52
53
54bool MyApp::OnInit()
55{
45e6e6f8
VZ
56 if ( !wxApp::OnInit() )
57 return false;
58
6adaedf0
JS
59#ifdef __WXMOTIF__
60 delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used
61#endif
62
62877de0
VS
63 wxInitAllImageHandlers();
64 wxFileSystem::AddHandler(new wxZipFSHandler);
65
be5a51fb 66 SetVendorName(wxT("wxWidgets"));
2b5f62a0 67 SetAppName(wxT("wxHTMLHelp"));
5612e524
VS
68 wxConfig::Get(); // create an instance
69
264a1086
JS
70 help = new wxHtmlHelpController;
71
62877de0 72 if (argc < 2) {
4693b20c
MB
73 wxLogError(wxT("Usage : helpview <helpfile> [<more helpfiles>]"));
74 wxLogError(wxT(" helpfile may be .hhp, .zip or .htb"));
348469c2 75 return false;
62877de0
VS
76 }
77
78 for (int i = 1; i < argc; i++)
11d667e7 79 help->AddBook(wxFileName(argv[i]));
62877de0 80
6adaedf0
JS
81#ifdef __WXMOTIF__
82 delete wxLog::SetActiveTarget(new wxLogGui);
83#endif
84
62877de0
VS
85 help -> DisplayContents();
86
348469c2 87 return true;
62877de0
VS
88}
89
90
91int MyApp::OnExit()
92{
93 delete help;
5612e524 94 delete wxConfig::Set(NULL);
62877de0
VS
95
96 return 0;
97}
98