]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/helpbest.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / msw / helpbest.h
CommitLineData
3d285623 1/////////////////////////////////////////////////////////////////////////////
1ed64378 2// Name: wx/msw/helpbest.h
3d285623
VS
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
3d285623 7// Copyright: (c) Mattia Barbon
65571936 8// Licence: wxWindows licence
3d285623
VS
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_HELPBEST_H_
12#define _WX_HELPBEST_H_
13
1ed64378 14#if wxUSE_HELP && wxUSE_MS_HTML_HELP \
62cdd7d3 15 && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
3d285623
VS
16
17#include "wx/helpbase.h"
4af8f6ef 18#include "wx/html/helpfrm.h" // for wxHF_DEFAULT_STYLE
3d285623 19
6acba9a7 20class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase
3d285623 21{
3d285623 22public:
1c756ac8
VZ
23 wxBestHelpController(wxWindow* parentWindow = NULL,
24 int style = wxHF_DEFAULT_STYLE)
25 : wxHelpControllerBase(parentWindow),
26 m_helpControllerType(wxUseNone),
27 m_helpController(NULL),
28 m_style(style)
3295e238
VZ
29 {
30 }
31
32 virtual ~wxBestHelpController() { delete m_helpController; }
33
3d285623
VS
34 // Must call this to set the filename
35 virtual bool Initialize(const wxString& file);
0e4acbd4 36 virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); }
3295e238 37
3d285623
VS
38 // If file is "", reloads file given in Initialize
39 virtual bool LoadFile(const wxString& file = wxEmptyString)
40 {
3d285623
VS
41 return m_helpController->LoadFile( GetValidFilename( file ) );
42 }
43
44 virtual bool DisplayContents()
45 {
3d285623
VS
46 return m_helpController->DisplayContents();
47 }
48
49 virtual bool DisplaySection(int sectionNo)
50 {
3d285623
VS
51 return m_helpController->DisplaySection( sectionNo );
52 }
53
54 virtual bool DisplaySection(const wxString& section)
55 {
3d285623
VS
56 return m_helpController->DisplaySection( section );
57 }
58
59 virtual bool DisplayBlock(long blockNo)
60 {
3d285623
VS
61 return m_helpController->DisplayBlock( blockNo );
62 }
63
64 virtual bool DisplayContextPopup(int contextId)
65 {
3d285623
VS
66 return m_helpController->DisplayContextPopup( contextId );
67 }
68
69 virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos)
70 {
3d285623
VS
71 return m_helpController->DisplayTextPopup( text, pos );
72 }
73
69b5cec2 74 virtual bool KeywordSearch(const wxString& k,
506c7b5b 75 wxHelpSearchMode mode = wxHELP_SEARCH_ALL)
3d285623 76 {
69b5cec2 77 return m_helpController->KeywordSearch( k, mode );
3d285623
VS
78 }
79
80 virtual bool Quit()
81 {
3d285623
VS
82 return m_helpController->Quit();
83 }
84
3295e238 85 // Allows one to override the default settings for the help frame.
3d285623 86 virtual void SetFrameParameters(const wxString& title,
3295e238
VZ
87 const wxSize& size,
88 const wxPoint& pos = wxDefaultPosition,
59af881e 89 bool newFrameEachTime = false)
3d285623 90 {
3d285623
VS
91 m_helpController->SetFrameParameters( title, size, pos,
92 newFrameEachTime );
93 }
94
3295e238 95 // Obtains the latest settings used by the help frame and the help frame.
3d285623 96 virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
3295e238
VZ
97 wxPoint *pos = NULL,
98 bool *newFrameEachTime = NULL)
3d285623 99 {
3d285623
VS
100 return m_helpController->GetFrameParameters( size, pos,
101 newFrameEachTime );
102 }
103
3db52265
JS
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); }
106
107 /// Get the window that can optionally be used for the help window's parent.
108 virtual wxWindow* GetParentWindow() const { return m_helpController->GetParentWindow(); }
109
3d285623
VS
110protected:
111 // Append/change extension if necessary.
112 wxString GetValidFilename(const wxString& file) const;
3295e238 113
3d285623
VS
114protected:
115 enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp };
116
117 HelpControllerType m_helpControllerType;
118 wxHelpControllerBase* m_helpController;
1c756ac8 119 int m_style;
3295e238
VZ
120
121 DECLARE_DYNAMIC_CLASS(wxBestHelpController)
c0c133e1 122 wxDECLARE_NO_COPY_CLASS(wxBestHelpController);
3d285623
VS
123};
124
1ed64378 125#endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP
3d285623
VS
126
127#endif
128 // _WX_HELPBEST_H_