1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Tries to load MS HTML Help, falls back to wxHTML upon failure
4 // Author: Mattia Barbon
8 // Copyright: (c) Mattia Barbon
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_HELPBEST_H_
13 #define _WX_HELPBEST_H_
15 #if wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) \
16 && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
18 #include "wx/helpbase.h"
20 class WXDLLIMPEXP_HTML wxBestHelpController
: public wxHelpControllerBase
23 wxBestHelpController()
24 : m_helpControllerType( wxUseNone
),
25 m_helpController( NULL
)
29 virtual ~wxBestHelpController() { delete m_helpController
; }
31 // Must call this to set the filename
32 virtual bool Initialize(const wxString
& file
);
33 virtual bool Initialize(const wxString
& file
, int WXUNUSED(server
) ) { return Initialize( file
); }
35 // If file is "", reloads file given in Initialize
36 virtual bool LoadFile(const wxString
& file
= wxEmptyString
)
38 return m_helpController
->LoadFile( GetValidFilename( file
) );
41 virtual bool DisplayContents()
43 return m_helpController
->DisplayContents();
46 virtual bool DisplaySection(int sectionNo
)
48 return m_helpController
->DisplaySection( sectionNo
);
51 virtual bool DisplaySection(const wxString
& section
)
53 return m_helpController
->DisplaySection( section
);
56 virtual bool DisplayBlock(long blockNo
)
58 return m_helpController
->DisplayBlock( blockNo
);
61 virtual bool DisplayContextPopup(int contextId
)
63 return m_helpController
->DisplayContextPopup( contextId
);
66 virtual bool DisplayTextPopup(const wxString
& text
, const wxPoint
& pos
)
68 return m_helpController
->DisplayTextPopup( text
, pos
);
71 virtual bool KeywordSearch(const wxString
& k
,
72 wxHelpSearchMode mode
= wxHELP_SEARCH_ALL
)
74 return m_helpController
->KeywordSearch( k
, mode
);
79 return m_helpController
->Quit();
82 // Allows one to override the default settings for the help frame.
83 virtual void SetFrameParameters(const wxString
& title
,
85 const wxPoint
& pos
= wxDefaultPosition
,
86 bool newFrameEachTime
= false)
88 m_helpController
->SetFrameParameters( title
, size
, pos
,
92 // Obtains the latest settings used by the help frame and the help frame.
93 virtual wxFrame
*GetFrameParameters(wxSize
*size
= NULL
,
95 bool *newFrameEachTime
= NULL
)
97 return m_helpController
->GetFrameParameters( size
, pos
,
102 // Append/change extension if necessary.
103 wxString
GetValidFilename(const wxString
& file
) const;
106 enum HelpControllerType
{ wxUseNone
, wxUseHtmlHelp
, wxUseChmHelp
};
108 HelpControllerType m_helpControllerType
;
109 wxHelpControllerBase
* m_helpController
;
111 DECLARE_DYNAMIC_CLASS(wxBestHelpController
)
112 DECLARE_NO_COPY_CLASS(wxBestHelpController
)
115 #endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP