]>
Commit | Line | Data |
---|---|---|
3d285623 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1ed64378 | 2 | // Name: wx/msw/helpbest.h |
3d285623 VS |
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 | ||
1ed64378 | 15 | #if wxUSE_HELP && wxUSE_MS_HTML_HELP \ |
62cdd7d3 | 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: |
3db52265 JS |
23 | wxBestHelpController(wxWindow* parentWindow = NULL) |
24 | : wxHelpControllerBase( parentWindow ), m_helpControllerType( wxUseNone ), | |
3295e238 VZ |
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 | ||
3db52265 JS |
101 | /// Set the window that can optionally be used for the help window's parent. |
102 | virtual void SetParentWindow(wxWindow* win) { m_helpController->SetParentWindow(win); } | |
103 | ||
104 | /// Get the window that can optionally be used for the help window's parent. | |
105 | virtual wxWindow* GetParentWindow() const { return m_helpController->GetParentWindow(); } | |
106 | ||
3d285623 VS |
107 | protected: |
108 | // Append/change extension if necessary. | |
109 | wxString GetValidFilename(const wxString& file) const; | |
3295e238 | 110 | |
3d285623 VS |
111 | protected: |
112 | enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp }; | |
113 | ||
114 | HelpControllerType m_helpControllerType; | |
115 | wxHelpControllerBase* m_helpController; | |
3295e238 VZ |
116 | |
117 | DECLARE_DYNAMIC_CLASS(wxBestHelpController) | |
22f3361e | 118 | DECLARE_NO_COPY_CLASS(wxBestHelpController) |
3d285623 VS |
119 | }; |
120 | ||
1ed64378 | 121 | #endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP |
3d285623 VS |
122 | |
123 | #endif | |
124 | // _WX_HELPBEST_H_ |