]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/helpbest.h
Applied patch [ 882493 ] Added XRC support for wxStatusBar
[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 virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); }
37
38 // If file is "", reloads file given in Initialize
39 virtual bool LoadFile(const wxString& file = wxEmptyString)
40 {
41 return m_helpController->LoadFile( GetValidFilename( file ) );
42 }
43
44 virtual bool DisplayContents()
45 {
46 return m_helpController->DisplayContents();
47 }
48
49 virtual bool DisplaySection(int sectionNo)
50 {
51 return m_helpController->DisplaySection( sectionNo );
52 }
53
54 virtual bool DisplaySection(const wxString& section)
55 {
56 return m_helpController->DisplaySection( section );
57 }
58
59 virtual bool DisplayBlock(long blockNo)
60 {
61 return m_helpController->DisplayBlock( blockNo );
62 }
63
64 virtual bool DisplayContextPopup(int contextId)
65 {
66 return m_helpController->DisplayContextPopup( contextId );
67 }
68
69 virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos)
70 {
71 return m_helpController->DisplayTextPopup( text, pos );
72 }
73
74 virtual bool KeywordSearch(const wxString& k,
75 wxHelpSearchMode mode = wxHELP_SEARCH_ALL)
76 {
77 return m_helpController->KeywordSearch( k, mode );
78 }
79
80 virtual bool Quit()
81 {
82 return m_helpController->Quit();
83 }
84
85 // Allows one to override the default settings for the help frame.
86 virtual void SetFrameParameters(const wxString& title,
87 const wxSize& size,
88 const wxPoint& pos = wxDefaultPosition,
89 bool newFrameEachTime = FALSE)
90 {
91 m_helpController->SetFrameParameters( title, size, pos,
92 newFrameEachTime );
93 }
94
95 // Obtains the latest settings used by the help frame and the help frame.
96 virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
97 wxPoint *pos = NULL,
98 bool *newFrameEachTime = NULL)
99 {
100 return m_helpController->GetFrameParameters( size, pos,
101 newFrameEachTime );
102 }
103
104 protected:
105 // Append/change extension if necessary.
106 wxString GetValidFilename(const wxString& file) const;
107
108 protected:
109 enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp };
110
111 HelpControllerType m_helpControllerType;
112 wxHelpControllerBase* m_helpController;
113
114 DECLARE_DYNAMIC_CLASS(wxBestHelpController)
115 DECLARE_NO_COPY_CLASS(wxBestHelpController)
116 };
117
118 #endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP
119
120 #endif
121 // _WX_HELPBEST_H_