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"
21 #if wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP
23 #include "wx/helpbase.h"
25 class WXDLLEXPORT wxBestHelpController
: public wxHelpControllerBase
27 DECLARE_DYNAMIC_CLASS(wxBestHelpController
)
30 wxBestHelpController():m_helpControllerType( wxUseNone
),
31 m_helpController( 0 ) {}
32 ~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 wxASSERT( m_helpController
);
41 return m_helpController
->LoadFile( GetValidFilename( file
) );
44 virtual bool DisplayContents()
46 wxASSERT( m_helpController
);
47 return m_helpController
->DisplayContents();
50 virtual bool DisplaySection(int sectionNo
)
52 wxASSERT( m_helpController
);
53 return m_helpController
->DisplaySection( sectionNo
);
56 virtual bool DisplaySection(const wxString
& section
)
58 wxASSERT( m_helpController
);
59 return m_helpController
->DisplaySection( section
);
62 virtual bool DisplayBlock(long blockNo
)
64 wxASSERT( m_helpController
);
65 return m_helpController
->DisplayBlock( blockNo
);
68 virtual bool DisplayContextPopup(int contextId
)
70 wxASSERT( m_helpController
);
71 return m_helpController
->DisplayContextPopup( contextId
);
74 virtual bool DisplayTextPopup(const wxString
& text
, const wxPoint
& pos
)
76 wxASSERT( m_helpController
);
77 return m_helpController
->DisplayTextPopup( text
, pos
);
80 virtual bool KeywordSearch(const wxString
& k
)
82 wxASSERT( m_helpController
);
83 return m_helpController
->KeywordSearch( k
);
88 wxASSERT( m_helpController
);
89 return m_helpController
->Quit();
92 /// Allows one to override the default settings for the help frame.
93 virtual void SetFrameParameters(const wxString
& title
,
95 const wxPoint
& pos
= wxDefaultPosition
,
96 bool newFrameEachTime
= FALSE
)
98 wxASSERT( m_helpController
);
99 m_helpController
->SetFrameParameters( title
, size
, pos
,
103 /// Obtains the latest settings used by the help frame and the help
105 virtual wxFrame
*GetFrameParameters(wxSize
*size
= NULL
,
107 bool *newFrameEachTime
= NULL
)
109 wxASSERT( m_helpController
);
110 return m_helpController
->GetFrameParameters( size
, pos
,
115 // Append/change extension if necessary.
116 wxString
GetValidFilename(const wxString
& file
) const;
119 enum HelpControllerType
{ wxUseNone
, wxUseHtmlHelp
, wxUseChmHelp
};
121 HelpControllerType m_helpControllerType
;
122 wxHelpControllerBase
* m_helpController
;
125 #endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && defined(__WIN95__) && wxUSE_WXHTML_HELP