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_
16 #pragma interface "helpbest.h"
19 #if wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP
21 #include "wx/helpbase.h"
23 class WXDLLIMPEXP_HTML wxBestHelpController
: public wxHelpControllerBase
26 wxBestHelpController()
27 : m_helpControllerType( wxUseNone
),
28 m_helpController( NULL
)
32 virtual ~wxBestHelpController() { delete m_helpController
; }
34 // Must call this to set the filename
35 virtual bool Initialize(const wxString
& file
);
37 // If file is "", reloads file given in Initialize
38 virtual bool LoadFile(const wxString
& file
= wxEmptyString
)
40 return m_helpController
->LoadFile( GetValidFilename( file
) );
43 virtual bool DisplayContents()
45 return m_helpController
->DisplayContents();
48 virtual bool DisplaySection(int sectionNo
)
50 return m_helpController
->DisplaySection( sectionNo
);
53 virtual bool DisplaySection(const wxString
& section
)
55 return m_helpController
->DisplaySection( section
);
58 virtual bool DisplayBlock(long blockNo
)
60 return m_helpController
->DisplayBlock( blockNo
);
63 virtual bool DisplayContextPopup(int contextId
)
65 return m_helpController
->DisplayContextPopup( contextId
);
68 virtual bool DisplayTextPopup(const wxString
& text
, const wxPoint
& pos
)
70 return m_helpController
->DisplayTextPopup( text
, pos
);
73 virtual bool KeywordSearch(const wxString
& k
)
75 return m_helpController
->KeywordSearch( k
);
80 return m_helpController
->Quit();
83 // Allows one to override the default settings for the help frame.
84 virtual void SetFrameParameters(const wxString
& title
,
86 const wxPoint
& pos
= wxDefaultPosition
,
87 bool newFrameEachTime
= FALSE
)
89 m_helpController
->SetFrameParameters( title
, size
, pos
,
93 // Obtains the latest settings used by the help frame and the help frame.
94 virtual wxFrame
*GetFrameParameters(wxSize
*size
= NULL
,
96 bool *newFrameEachTime
= NULL
)
98 return m_helpController
->GetFrameParameters( size
, pos
,
103 // Append/change extension if necessary.
104 wxString
GetValidFilename(const wxString
& file
) const;
107 enum HelpControllerType
{ wxUseNone
, wxUseHtmlHelp
, wxUseChmHelp
};
109 HelpControllerType m_helpControllerType
;
110 wxHelpControllerBase
* m_helpController
;
112 DECLARE_DYNAMIC_CLASS(wxBestHelpController
)
113 DECLARE_NO_COPY_CLASS(wxBestHelpController
)
116 #endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP