1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/helpbest.h
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 \
16 && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
18 #include "wx/helpbase.h"
20 class WXDLLIMPEXP_HTML wxBestHelpController
: public wxHelpControllerBase
23 wxBestHelpController(wxWindow
* parentWindow
= NULL
,
24 int style
= wxHF_DEFAULT_STYLE
)
25 : wxHelpControllerBase(parentWindow
),
26 m_helpControllerType(wxUseNone
),
27 m_helpController(NULL
),
32 virtual ~wxBestHelpController() { delete m_helpController
; }
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
); }
38 // If file is "", reloads file given in Initialize
39 virtual bool LoadFile(const wxString
& file
= wxEmptyString
)
41 return m_helpController
->LoadFile( GetValidFilename( file
) );
44 virtual bool DisplayContents()
46 return m_helpController
->DisplayContents();
49 virtual bool DisplaySection(int sectionNo
)
51 return m_helpController
->DisplaySection( sectionNo
);
54 virtual bool DisplaySection(const wxString
& section
)
56 return m_helpController
->DisplaySection( section
);
59 virtual bool DisplayBlock(long blockNo
)
61 return m_helpController
->DisplayBlock( blockNo
);
64 virtual bool DisplayContextPopup(int contextId
)
66 return m_helpController
->DisplayContextPopup( contextId
);
69 virtual bool DisplayTextPopup(const wxString
& text
, const wxPoint
& pos
)
71 return m_helpController
->DisplayTextPopup( text
, pos
);
74 virtual bool KeywordSearch(const wxString
& k
,
75 wxHelpSearchMode mode
= wxHELP_SEARCH_ALL
)
77 return m_helpController
->KeywordSearch( k
, mode
);
82 return m_helpController
->Quit();
85 // Allows one to override the default settings for the help frame.
86 virtual void SetFrameParameters(const wxString
& title
,
88 const wxPoint
& pos
= wxDefaultPosition
,
89 bool newFrameEachTime
= false)
91 m_helpController
->SetFrameParameters( title
, size
, pos
,
95 // Obtains the latest settings used by the help frame and the help frame.
96 virtual wxFrame
*GetFrameParameters(wxSize
*size
= NULL
,
98 bool *newFrameEachTime
= NULL
)
100 return m_helpController
->GetFrameParameters( size
, pos
,
104 /// Set the window that can optionally be used for the help window's parent.
105 virtual void SetParentWindow(wxWindow
* win
) { m_helpController
->SetParentWindow(win
); }
107 /// Get the window that can optionally be used for the help window's parent.
108 virtual wxWindow
* GetParentWindow() const { return m_helpController
->GetParentWindow(); }
111 // Append/change extension if necessary.
112 wxString
GetValidFilename(const wxString
& file
) const;
115 enum HelpControllerType
{ wxUseNone
, wxUseHtmlHelp
, wxUseChmHelp
};
117 HelpControllerType m_helpControllerType
;
118 wxHelpControllerBase
* m_helpController
;
121 DECLARE_DYNAMIC_CLASS(wxBestHelpController
)
122 DECLARE_NO_COPY_CLASS(wxBestHelpController
)
125 #endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP