]> git.saurik.com Git - wxWidgets.git/blob - samples/html/help/help.cpp
*** empty log message ***
[wxWidgets.git] / samples / html / help / help.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: test.cpp
3 // Purpose: wxHtml testing example
4 /////////////////////////////////////////////////////////////////////////////
5
6 #ifdef __GNUG__
7 #pragma implementation
8 #pragma interface
9 #endif
10
11 // For compilers that support precompilation, includes "wx/wx.h".
12 #include <wx/wxprec.h>
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 // for all others, include the necessary headers (this file is usually all you
19 // need because it includes almost all "standard" wxWindows headers
20 #ifndef WX_PRECOMP
21 #include <wx/wx.h>
22 #endif
23
24 #include <wx/image.h>
25 #include <wx/wxhtml.h>
26 #if (( wxVERSION_NUMBER < 2100 ) || (( wxVERSION_NUMBER == 2100 ) && (wxBETA_NUMBER <= 4)))
27 #include <wx/imaggif.h>
28 #endif
29 #include <wx/config.h>
30
31 // ----------------------------------------------------------------------------
32 // private classes
33 // ----------------------------------------------------------------------------
34
35 // Define a new application type, each program should derive a class from wxApp
36 class MyApp : public wxApp
37 {
38 private:
39 wxHtmlHelpController help;
40 wxConfig* config;
41
42 public:
43 // override base class virtuals
44 // ----------------------------
45
46 // this one is called on application startup and is a good place for the app
47 // initialization (doing it here and not in the ctor allows to have an error
48 // return: if OnInit() returns false, the application terminates)
49 bool OnInit();
50 int OnExit();
51 };
52
53 IMPLEMENT_APP(MyApp)
54
55
56 bool MyApp::OnInit()
57 {
58 config = new wxConfig("wxHTMLhelp");
59 #if wxUSE_LIBPNG
60 wxImage::AddHandler(new wxPNGHandler);
61 #endif
62 #if wxUSE_LIBJPEG
63 wxImage::AddHandler(new wxJPEGHandler);
64 #endif
65
66 help.UseConfig(config);
67 help.SetTempDir("tmp");
68 help.AddBook("helpfiles/testing.hhp");
69 help.Display("Main page");
70 return TRUE;
71 }
72
73 int MyApp::OnExit()
74 {
75 delete config;
76 return 0;
77 }
78
79
80
81
82
83
84
85