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