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