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