]> git.saurik.com Git - wxWidgets.git/blame - include/wx/html/helpctrl.h
Export recently added wxRichTextXMLHelper to fix link errors.
[wxWidgets.git] / include / wx / html / helpctrl.h
CommitLineData
8ec2b484 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/html/helpctrl.h
8ec2b484 3// Purpose: wxHtmlHelpController
f42b1601 4// Notes: Based on htmlhelp.cpp, implementing a monolithic
8ec2b484
HH
5// HTML Help controller class, by Vaclav Slavik
6// Author: Harm van der Heijden and Vaclav Slavik
8ec2b484 7// Copyright: (c) Harm van der Heijden and Vaclav Slavik
65571936 8// Licence: wxWindows licence
8ec2b484
HH
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_HELPCTRL_H_
12#define _WX_HELPCTRL_H_
13
14#include "wx/defs.h"
15
3abf2c72 16#if wxUSE_WXHTML_HELP
8ec2b484 17
b4414c1f 18#include "wx/helpbase.h"
69b5cec2 19#include "wx/html/helpfrm.h"
8ec2b484 20
576507e2
VS
21#define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
22
3755cfa6
JS
23// This style indicates that the window is
24// embedded in the application and must not be
25// destroyed by the help controller.
26#define wxHF_EMBEDDED 0x00008000
27
28// Create a dialog for the help window.
29#define wxHF_DIALOG 0x00010000
30
31// Create a frame for the help window.
32#define wxHF_FRAME 0x00020000
33
34// Make the dialog modal when displaying help.
35#define wxHF_MODAL 0x00040000
36
b5dbe15d
VS
37class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog;
38class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow;
39class WXDLLIMPEXP_FWD_HTML wxHtmlHelpFrame;
40class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog;
3755cfa6 41
6acba9a7 42class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler
8ec2b484 43{
97494971
VS
44 DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
45
46public:
3db52265 47 wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL);
895c1bc0
RD
48 wxHtmlHelpController(wxWindow* parentWindow, int style = wxHF_DEFAULT_STYLE);
49
97494971
VS
50 virtual ~wxHtmlHelpController();
51
bd45b3e1
VZ
52 void SetShouldPreventAppExit(bool enable);
53
97494971
VS
54 void SetTitleFormat(const wxString& format);
55 void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
6953da00
WS
56 bool AddBook(const wxString& book_url, bool show_wait_msg = false);
57 bool AddBook(const wxFileName& book_file, bool show_wait_msg = false);
5152b0e5
JS
58
59 bool Display(const wxString& x);
60 bool Display(int id);
61 bool DisplayContents();
62 bool DisplayIndex();
69b5cec2
VS
63 bool KeywordSearch(const wxString& keyword,
64 wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
5152b0e5 65
3755cfa6
JS
66 wxHtmlHelpWindow* GetHelpWindow() { return m_helpWindow; }
67 void SetHelpWindow(wxHtmlHelpWindow* helpWindow);
68
3ac95ecd
JS
69 wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
70 wxHtmlHelpDialog* GetDialog() { return m_helpDialog; }
f3e156ef 71
b4246849 72#if wxUSE_CONFIG
97494971
VS
73 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
74
75 // Assigns config object to the Ctrl. This config is then
76 // used in subsequent calls to Read/WriteCustomization of both help
77 // Ctrl and it's wxHtmlWindow
78 virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
79 virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
b4246849 80#endif // wxUSE_CONFIG
97494971
VS
81
82 //// Backward compatibility with wxHelpController API
83
84 virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); }
85 virtual bool Initialize(const wxString& file);
86 virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
2b5f62a0 87 virtual bool LoadFile(const wxString& file = wxT(""));
97494971
VS
88 virtual bool DisplaySection(int sectionNo);
89 virtual bool DisplaySection(const wxString& section) { return Display(section); }
90 virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); }
91 virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
92
eae48ea1 93 virtual void SetFrameParameters(const wxString& titleFormat,
97494971
VS
94 const wxSize& size,
95 const wxPoint& pos = wxDefaultPosition,
6953da00 96 bool newFrameEachTime = false);
97494971
VS
97 /// Obtains the latest settings used by the help frame and the help
98 /// frame.
99 virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
100 wxPoint *pos = NULL,
101 bool *newFrameEachTime = NULL);
102
219a5f10
VS
103 // Get direct access to help data:
104 wxHtmlHelpData *GetHelpData() { return &m_helpData; }
97494971
VS
105
106 virtual bool Quit() ;
6fb99eb3 107 virtual void OnQuit() {}
97494971
VS
108
109 void OnCloseFrame(wxCloseEvent& evt);
110
5152b0e5
JS
111 // Make the help controller's frame 'modal' if
112 // needed
3755cfa6
JS
113 void MakeModalIfNeeded();
114
115 // Find the top-most parent window
116 wxWindow* FindTopLevelWindow();
5152b0e5 117
97494971 118protected:
895c1bc0
RD
119 void Init(int style);
120
3755cfa6 121 virtual wxWindow* CreateHelpWindow();
97494971 122 virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data);
3755cfa6 123 virtual wxHtmlHelpDialog* CreateHelpDialog(wxHtmlHelpData *data);
97494971
VS
124 virtual void DestroyHelpWindow();
125
126 wxHtmlHelpData m_helpData;
3755cfa6 127 wxHtmlHelpWindow* m_helpWindow;
b4246849 128#if wxUSE_CONFIG
97494971
VS
129 wxConfigBase * m_Config;
130 wxString m_ConfigRoot;
b4246849 131#endif // wxUSE_CONFIG
97494971
VS
132 wxString m_titleFormat;
133 int m_FrameStyle;
f3e156ef
JS
134 wxHtmlHelpFrame* m_helpFrame;
135 wxHtmlHelpDialog* m_helpDialog;
22f3361e 136
bd45b3e1
VZ
137 bool m_shouldPreventAppExit;
138
c0c133e1 139 wxDECLARE_NO_COPY_CLASS(wxHtmlHelpController);
8ec2b484
HH
140};
141
3755cfa6
JS
142/*
143 * wxHtmlModalHelp
144 * A convenience class particularly for use on wxMac,
145 * where you can only show modal dialogs from a modal
146 * dialog.
147 *
148 * Use like this:
149 *
150 * wxHtmlModalHelp help(parent, filename, topic);
151 *
152 * If topic is empty, the help contents is displayed.
153 */
154
155class WXDLLIMPEXP_HTML wxHtmlModalHelp
156{
157public:
158 wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile, const wxString& topic = wxEmptyString,
159 int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL);
160};
161
3abf2c72 162#endif // wxUSE_WXHTML_HELP
8ec2b484
HH
163
164#endif // _WX_HELPCTRL_H_