]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/helpbest.h
don't use EM_STREAMIN at all in Unicode mode, it's not needed
[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 #ifdef __GNUG__
16 #pragma interface "helpbest.h"
17 #endif
18
19 #include "wx/wx.h"
20
21 #if wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP
22
23 #include "wx/helpbase.h"
24
25 class WXDLLEXPORT wxBestHelpController: public wxHelpControllerBase
26 {
27 DECLARE_DYNAMIC_CLASS(wxBestHelpController)
28
29 public:
30 wxBestHelpController():m_helpControllerType( wxUseNone ),
31 m_helpController( 0 ) {}
32 ~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 wxASSERT( m_helpController );
41 return m_helpController->LoadFile( GetValidFilename( file ) );
42 }
43
44 virtual bool DisplayContents()
45 {
46 wxASSERT( m_helpController );
47 return m_helpController->DisplayContents();
48 }
49
50 virtual bool DisplaySection(int sectionNo)
51 {
52 wxASSERT( m_helpController );
53 return m_helpController->DisplaySection( sectionNo );
54 }
55
56 virtual bool DisplaySection(const wxString& section)
57 {
58 wxASSERT( m_helpController );
59 return m_helpController->DisplaySection( section );
60 }
61
62 virtual bool DisplayBlock(long blockNo)
63 {
64 wxASSERT( m_helpController );
65 return m_helpController->DisplayBlock( blockNo );
66 }
67
68 virtual bool DisplayContextPopup(int contextId)
69 {
70 wxASSERT( m_helpController );
71 return m_helpController->DisplayContextPopup( contextId );
72 }
73
74 virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos)
75 {
76 wxASSERT( m_helpController );
77 return m_helpController->DisplayTextPopup( text, pos );
78 }
79
80 virtual bool KeywordSearch(const wxString& k)
81 {
82 wxASSERT( m_helpController );
83 return m_helpController->KeywordSearch( k );
84 }
85
86 virtual bool Quit()
87 {
88 wxASSERT( m_helpController );
89 return m_helpController->Quit();
90 }
91
92 /// Allows one to override the default settings for the help frame.
93 virtual void SetFrameParameters(const wxString& title,
94 const wxSize& size,
95 const wxPoint& pos = wxDefaultPosition,
96 bool newFrameEachTime = FALSE)
97 {
98 wxASSERT( m_helpController );
99 m_helpController->SetFrameParameters( title, size, pos,
100 newFrameEachTime );
101 }
102
103 /// Obtains the latest settings used by the help frame and the help
104 /// frame.
105 virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
106 wxPoint *pos = NULL,
107 bool *newFrameEachTime = NULL)
108 {
109 wxASSERT( m_helpController );
110 return m_helpController->GetFrameParameters( size, pos,
111 newFrameEachTime );
112 }
113
114 protected:
115 // Append/change extension if necessary.
116 wxString GetValidFilename(const wxString& file) const;
117
118 protected:
119 enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp };
120
121 HelpControllerType m_helpControllerType;
122 wxHelpControllerBase* m_helpController;
123 };
124
125 #endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP
126
127 #endif
128 // _WX_HELPBEST_H_