]> git.saurik.com Git - wxWidgets.git/blob - include/wx/html/helpctrl.h
Fix AUI compilation without PCH after recent changes.
[wxWidgets.git] / include / wx / html / helpctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: helpctrl.h
3 // Purpose: wxHtmlHelpController
4 // Notes: Based on htmlhelp.cpp, implementing a monolithic
5 // HTML Help controller class, by Vaclav Slavik
6 // Author: Harm van der Heijden and Vaclav Slavik
7 // RCS-ID: $Id$
8 // Copyright: (c) Harm van der Heijden and Vaclav Slavik
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_HELPCTRL_H_
13 #define _WX_HELPCTRL_H_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_WXHTML_HELP
18
19 #include "wx/helpbase.h"
20 #include "wx/html/helpfrm.h"
21
22 #define wxID_HTML_HELPFRAME (wxID_HIGHEST + 1)
23
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
38 class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog;
39 class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow;
40 class WXDLLIMPEXP_FWD_HTML wxHtmlHelpFrame;
41 class WXDLLIMPEXP_FWD_HTML wxHtmlHelpDialog;
42
43 class WXDLLIMPEXP_HTML wxHtmlHelpController : public wxHelpControllerBase // wxEvtHandler
44 {
45 DECLARE_DYNAMIC_CLASS(wxHtmlHelpController)
46
47 public:
48 wxHtmlHelpController(int style = wxHF_DEFAULT_STYLE, wxWindow* parentWindow = NULL);
49 virtual ~wxHtmlHelpController();
50
51 void SetTitleFormat(const wxString& format);
52 void SetTempDir(const wxString& path) { m_helpData.SetTempDir(path); }
53 bool AddBook(const wxString& book_url, bool show_wait_msg = false);
54 bool AddBook(const wxFileName& book_file, bool show_wait_msg = false);
55
56 bool Display(const wxString& x);
57 bool Display(int id);
58 bool DisplayContents();
59 bool DisplayIndex();
60 bool KeywordSearch(const wxString& keyword,
61 wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
62
63 wxHtmlHelpWindow* GetHelpWindow() { return m_helpWindow; }
64 void SetHelpWindow(wxHtmlHelpWindow* helpWindow);
65
66 wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
67 wxHtmlHelpDialog* GetDialog() { return m_helpDialog; }
68
69 #if wxUSE_CONFIG
70 void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
71
72 // Assigns config object to the Ctrl. This config is then
73 // used in subsequent calls to Read/WriteCustomization of both help
74 // Ctrl and it's wxHtmlWindow
75 virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
76 virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
77 #endif // wxUSE_CONFIG
78
79 //// Backward compatibility with wxHelpController API
80
81 virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize(file); }
82 virtual bool Initialize(const wxString& file);
83 virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
84 virtual bool LoadFile(const wxString& file = wxT(""));
85 virtual bool DisplaySection(int sectionNo);
86 virtual bool DisplaySection(const wxString& section) { return Display(section); }
87 virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); }
88 virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos);
89
90 virtual void SetFrameParameters(const wxString& title,
91 const wxSize& size,
92 const wxPoint& pos = wxDefaultPosition,
93 bool newFrameEachTime = false);
94 /// Obtains the latest settings used by the help frame and the help
95 /// frame.
96 virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
97 wxPoint *pos = NULL,
98 bool *newFrameEachTime = NULL);
99
100 // Get direct access to help data:
101 wxHtmlHelpData *GetHelpData() { return &m_helpData; }
102
103 virtual bool Quit() ;
104 virtual void OnQuit() {}
105
106 void OnCloseFrame(wxCloseEvent& evt);
107
108 // Make the help controller's frame 'modal' if
109 // needed
110 void MakeModalIfNeeded();
111
112 // Find the top-most parent window
113 wxWindow* FindTopLevelWindow();
114
115 protected:
116 virtual wxWindow* CreateHelpWindow();
117 virtual wxHtmlHelpFrame* CreateHelpFrame(wxHtmlHelpData *data);
118 virtual wxHtmlHelpDialog* CreateHelpDialog(wxHtmlHelpData *data);
119 virtual void DestroyHelpWindow();
120
121 wxHtmlHelpData m_helpData;
122 wxHtmlHelpWindow* m_helpWindow;
123 #if wxUSE_CONFIG
124 wxConfigBase * m_Config;
125 wxString m_ConfigRoot;
126 #endif // wxUSE_CONFIG
127 wxString m_titleFormat;
128 int m_FrameStyle;
129 wxHtmlHelpFrame* m_helpFrame;
130 wxHtmlHelpDialog* m_helpDialog;
131
132 wxDECLARE_NO_COPY_CLASS(wxHtmlHelpController);
133 };
134
135 /*
136 * wxHtmlModalHelp
137 * A convenience class particularly for use on wxMac,
138 * where you can only show modal dialogs from a modal
139 * dialog.
140 *
141 * Use like this:
142 *
143 * wxHtmlModalHelp help(parent, filename, topic);
144 *
145 * If topic is empty, the help contents is displayed.
146 */
147
148 class WXDLLIMPEXP_HTML wxHtmlModalHelp
149 {
150 public:
151 wxHtmlModalHelp(wxWindow* parent, const wxString& helpFile, const wxString& topic = wxEmptyString,
152 int style = wxHF_DEFAULT_STYLE | wxHF_DIALOG | wxHF_MODAL);
153 };
154
155 #endif // wxUSE_WXHTML_HELP
156
157 #endif // _WX_HELPCTRL_H_