]>
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 | ||
62cdd7d3 MB |
15 | #if wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) \ |
16 | && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__) | |
3d285623 VS |
17 | |
18 | #include "wx/helpbase.h" | |
19 | ||
6acba9a7 | 20 | class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase |
3d285623 | 21 | { |
3d285623 | 22 | public: |
3295e238 VZ |
23 | wxBestHelpController() |
24 | : m_helpControllerType( wxUseNone ), | |
25 | m_helpController( NULL ) | |
26 | { | |
27 | } | |
28 | ||
29 | virtual ~wxBestHelpController() { delete m_helpController; } | |
30 | ||
3d285623 VS |
31 | // Must call this to set the filename |
32 | virtual bool Initialize(const wxString& file); | |
0e4acbd4 | 33 | virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } |
3295e238 | 34 | |
3d285623 VS |
35 | // If file is "", reloads file given in Initialize |
36 | virtual bool LoadFile(const wxString& file = wxEmptyString) | |
37 | { | |
3d285623 VS |
38 | return m_helpController->LoadFile( GetValidFilename( file ) ); |
39 | } | |
40 | ||
41 | virtual bool DisplayContents() | |
42 | { | |
3d285623 VS |
43 | return m_helpController->DisplayContents(); |
44 | } | |
45 | ||
46 | virtual bool DisplaySection(int sectionNo) | |
47 | { | |
3d285623 VS |
48 | return m_helpController->DisplaySection( sectionNo ); |
49 | } | |
50 | ||
51 | virtual bool DisplaySection(const wxString& section) | |
52 | { | |
3d285623 VS |
53 | return m_helpController->DisplaySection( section ); |
54 | } | |
55 | ||
56 | virtual bool DisplayBlock(long blockNo) | |
57 | { | |
3d285623 VS |
58 | return m_helpController->DisplayBlock( blockNo ); |
59 | } | |
60 | ||
61 | virtual bool DisplayContextPopup(int contextId) | |
62 | { | |
3d285623 VS |
63 | return m_helpController->DisplayContextPopup( contextId ); |
64 | } | |
65 | ||
66 | virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos) | |
67 | { | |
3d285623 VS |
68 | return m_helpController->DisplayTextPopup( text, pos ); |
69 | } | |
70 | ||
69b5cec2 | 71 | virtual bool KeywordSearch(const wxString& k, |
506c7b5b | 72 | wxHelpSearchMode mode = wxHELP_SEARCH_ALL) |
3d285623 | 73 | { |
69b5cec2 | 74 | return m_helpController->KeywordSearch( k, mode ); |
3d285623 VS |
75 | } |
76 | ||
77 | virtual bool Quit() | |
78 | { | |
3d285623 VS |
79 | return m_helpController->Quit(); |
80 | } | |
81 | ||
3295e238 | 82 | // Allows one to override the default settings for the help frame. |
3d285623 | 83 | virtual void SetFrameParameters(const wxString& title, |
3295e238 VZ |
84 | const wxSize& size, |
85 | const wxPoint& pos = wxDefaultPosition, | |
59af881e | 86 | bool newFrameEachTime = false) |
3d285623 | 87 | { |
3d285623 VS |
88 | m_helpController->SetFrameParameters( title, size, pos, |
89 | newFrameEachTime ); | |
90 | } | |
91 | ||
3295e238 | 92 | // Obtains the latest settings used by the help frame and the help frame. |
3d285623 | 93 | virtual wxFrame *GetFrameParameters(wxSize *size = NULL, |
3295e238 VZ |
94 | wxPoint *pos = NULL, |
95 | bool *newFrameEachTime = NULL) | |
3d285623 | 96 | { |
3d285623 VS |
97 | return m_helpController->GetFrameParameters( size, pos, |
98 | newFrameEachTime ); | |
99 | } | |
100 | ||
101 | protected: | |
102 | // Append/change extension if necessary. | |
103 | wxString GetValidFilename(const wxString& file) const; | |
3295e238 | 104 | |
3d285623 VS |
105 | protected: |
106 | enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp }; | |
107 | ||
108 | HelpControllerType m_helpControllerType; | |
109 | wxHelpControllerBase* m_helpController; | |
3295e238 VZ |
110 | |
111 | DECLARE_DYNAMIC_CLASS(wxBestHelpController) | |
22f3361e | 112 | DECLARE_NO_COPY_CLASS(wxBestHelpController) |
3d285623 VS |
113 | }; |
114 | ||
115 | #endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP | |
116 | ||
117 | #endif | |
118 | // _WX_HELPBEST_H_ |