Commit | Line | Data |
---|---|---|
3d285623 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: helpbest.h | |
3 | // Purpose: Tries to load MS HTML Help, falls back to wxHTML upon failure | |
4 | // Author: Mattia Barbon | |
5 | // Modified by: | |
6 | // Created: 02/04/2001 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Mattia Barbon | |
65571936 | 9 | // Licence: wxWindows licence |
3d285623 VS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_HELPBEST_H_ | |
13 | #define _WX_HELPBEST_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
3d285623 VS |
16 | #pragma interface "helpbest.h" |
17 | #endif | |
18 | ||
62cdd7d3 MB |
19 | #if wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) \ |
20 | && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__) | |
3d285623 VS |
21 | |
22 | #include "wx/helpbase.h" | |
23 | ||
6acba9a7 | 24 | class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase |
3d285623 | 25 | { |
3d285623 | 26 | public: |
3295e238 VZ |
27 | wxBestHelpController() |
28 | : m_helpControllerType( wxUseNone ), | |
29 | m_helpController( NULL ) | |
30 | { | |
31 | } | |
32 | ||
33 | virtual ~wxBestHelpController() { delete m_helpController; } | |
34 | ||
3d285623 VS |
35 | // Must call this to set the filename |
36 | virtual bool Initialize(const wxString& file); | |
0e4acbd4 | 37 | virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } |
3295e238 | 38 | |
3d285623 VS |
39 | // If file is "", reloads file given in Initialize |
40 | virtual bool LoadFile(const wxString& file = wxEmptyString) | |
41 | { | |
3d285623 VS |
42 | return m_helpController->LoadFile( GetValidFilename( file ) ); |
43 | } | |
44 | ||
45 | virtual bool DisplayContents() | |
46 | { | |
3d285623 VS |
47 | return m_helpController->DisplayContents(); |
48 | } | |
49 | ||
50 | virtual bool DisplaySection(int sectionNo) | |
51 | { | |
3d285623 VS |
52 | return m_helpController->DisplaySection( sectionNo ); |
53 | } | |
54 | ||
55 | virtual bool DisplaySection(const wxString& section) | |
56 | { | |
3d285623 VS |
57 | return m_helpController->DisplaySection( section ); |
58 | } | |
59 | ||
60 | virtual bool DisplayBlock(long blockNo) | |
61 | { | |
3d285623 VS |
62 | return m_helpController->DisplayBlock( blockNo ); |
63 | } | |
64 | ||
65 | virtual bool DisplayContextPopup(int contextId) | |
66 | { | |
3d285623 VS |
67 | return m_helpController->DisplayContextPopup( contextId ); |
68 | } | |
69 | ||
70 | virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) | |
71 | { | |
3d285623 VS |
72 | return m_helpController->DisplayTextPopup( text, pos ); |
73 | } | |
74 | ||
69b5cec2 | 75 | virtual bool KeywordSearch(const wxString& k, |
506c7b5b | 76 | wxHelpSearchMode mode = wxHELP_SEARCH_ALL) |
3d285623 | 77 | { |
69b5cec2 | 78 | return m_helpController->KeywordSearch( k, mode ); |
3d285623 VS |
79 | } |
80 | ||
81 | virtual bool Quit() | |
82 | { | |
3d285623 VS |
83 | return m_helpController->Quit(); |
84 | } | |
85 | ||
3295e238 | 86 | // Allows one to override the default settings for the help frame. |
3d285623 | 87 | virtual void SetFrameParameters(const wxString& title, |
3295e238 VZ |
88 | const wxSize& size, |
89 | const wxPoint& pos = wxDefaultPosition, | |
59af881e | 90 | bool newFrameEachTime = false) |
3d285623 | 91 | { |
3d285623 VS |
92 | m_helpController->SetFrameParameters( title, size, pos, |
93 | newFrameEachTime ); | |
94 | } | |
95 | ||
3295e238 | 96 | // Obtains the latest settings used by the help frame and the help frame. |
3d285623 | 97 | virtual wxFrame *GetFrameParameters(wxSize *size = NULL, |
3295e238 VZ |
98 | wxPoint *pos = NULL, |
99 | bool *newFrameEachTime = NULL) | |
3d285623 | 100 | { |
3d285623 VS |
101 | return m_helpController->GetFrameParameters( size, pos, |
102 | newFrameEachTime ); | |
103 | } | |
104 | ||
105 | protected: | |
106 | // Append/change extension if necessary. | |
107 | wxString GetValidFilename(const wxString& file) const; | |
3295e238 | 108 | |
3d285623 VS |
109 | protected: |
110 | enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp }; | |
111 | ||
112 | HelpControllerType m_helpControllerType; | |
113 | wxHelpControllerBase* m_helpController; | |
3295e238 VZ |
114 | |
115 | DECLARE_DYNAMIC_CLASS(wxBestHelpController) | |
22f3361e | 116 | DECLARE_NO_COPY_CLASS(wxBestHelpController) |
3d285623 VS |
117 | }; |
118 | ||
119 | #endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP | |
120 | ||
121 | #endif | |
122 | // _WX_HELPBEST_H_ |