]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/helpbest.h
added wxWxCharBuffer which stands for buffer of wxChars
[wxWidgets.git] / include / wx / msw / helpbest.h
... / ...
CommitLineData
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
5// Modified by:
6// Created: 02/04/2001
7// RCS-ID: $Id$
8// Copyright: (c) Mattia Barbon
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_HELPBEST_H_
13#define _WX_HELPBEST_H_
14
15#if wxUSE_HELP && wxUSE_MS_HTML_HELP \
16 && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
17
18#include "wx/helpbase.h"
19
20class WXDLLIMPEXP_HTML wxBestHelpController: public wxHelpControllerBase
21{
22public:
23 wxBestHelpController(wxWindow* parentWindow = NULL)
24 : wxHelpControllerBase( parentWindow ), m_helpControllerType( wxUseNone ),
25 m_helpController( NULL )
26 {
27 }
28
29 virtual ~wxBestHelpController() { delete m_helpController; }
30
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 ); }
34
35 // If file is "", reloads file given in Initialize
36 virtual bool LoadFile(const wxString& file = wxEmptyString)
37 {
38 return m_helpController->LoadFile( GetValidFilename( file ) );
39 }
40
41 virtual bool DisplayContents()
42 {
43 return m_helpController->DisplayContents();
44 }
45
46 virtual bool DisplaySection(int sectionNo)
47 {
48 return m_helpController->DisplaySection( sectionNo );
49 }
50
51 virtual bool DisplaySection(const wxString& section)
52 {
53 return m_helpController->DisplaySection( section );
54 }
55
56 virtual bool DisplayBlock(long blockNo)
57 {
58 return m_helpController->DisplayBlock( blockNo );
59 }
60
61 virtual bool DisplayContextPopup(int contextId)
62 {
63 return m_helpController->DisplayContextPopup( contextId );
64 }
65
66 virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos)
67 {
68 return m_helpController->DisplayTextPopup( text, pos );
69 }
70
71 virtual bool KeywordSearch(const wxString& k,
72 wxHelpSearchMode mode = wxHELP_SEARCH_ALL)
73 {
74 return m_helpController->KeywordSearch( k, mode );
75 }
76
77 virtual bool Quit()
78 {
79 return m_helpController->Quit();
80 }
81
82 // Allows one to override the default settings for the help frame.
83 virtual void SetFrameParameters(const wxString& title,
84 const wxSize& size,
85 const wxPoint& pos = wxDefaultPosition,
86 bool newFrameEachTime = false)
87 {
88 m_helpController->SetFrameParameters( title, size, pos,
89 newFrameEachTime );
90 }
91
92 // Obtains the latest settings used by the help frame and the help frame.
93 virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
94 wxPoint *pos = NULL,
95 bool *newFrameEachTime = NULL)
96 {
97 return m_helpController->GetFrameParameters( size, pos,
98 newFrameEachTime );
99 }
100
101 /// Set the window that can optionally be used for the help window's parent.
102 virtual void SetParentWindow(wxWindow* win) { m_helpController->SetParentWindow(win); }
103
104 /// Get the window that can optionally be used for the help window's parent.
105 virtual wxWindow* GetParentWindow() const { return m_helpController->GetParentWindow(); }
106
107protected:
108 // Append/change extension if necessary.
109 wxString GetValidFilename(const wxString& file) const;
110
111protected:
112 enum HelpControllerType { wxUseNone, wxUseHtmlHelp, wxUseChmHelp };
113
114 HelpControllerType m_helpControllerType;
115 wxHelpControllerBase* m_helpController;
116
117 DECLARE_DYNAMIC_CLASS(wxBestHelpController)
118 DECLARE_NO_COPY_CLASS(wxBestHelpController)
119};
120
121#endif // wxUSE_HELP && wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP
122
123#endif
124 // _WX_HELPBEST_H_