]>
Commit | Line | Data |
---|---|---|
8ec2b484 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/html/helpfrm.h |
8ec2b484 | 3 | // Purpose: wxHtmlHelpFrame |
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_HELPFRM_H_ | |
13 | #define _WX_HELPFRM_H_ | |
14 | ||
8ec2b484 HH |
15 | #include "wx/defs.h" |
16 | ||
3379ed37 | 17 | #if wxUSE_WXHTML_HELP |
8ec2b484 | 18 | |
69b5cec2 | 19 | #include "wx/helpbase.h" |
16a12a3d | 20 | #include "wx/html/helpdata.h" |
8ec2b484 HH |
21 | #include "wx/window.h" |
22 | #include "wx/frame.h" | |
23 | #include "wx/config.h" | |
24 | #include "wx/splitter.h" | |
25 | #include "wx/notebook.h" | |
26 | #include "wx/listbox.h" | |
27 | #include "wx/choice.h" | |
382e6efe | 28 | #include "wx/combobox.h" |
c4971147 | 29 | #include "wx/checkbox.h" |
240c2873 | 30 | #include "wx/stattext.h" |
8ec2b484 | 31 | #include "wx/html/htmlwin.h" |
4e1ed07b | 32 | #include "wx/html/helpwnd.h" |
0646614d | 33 | #include "wx/html/htmprint.h" |
2b5f62a0 | 34 | |
b5dbe15d VS |
35 | class WXDLLIMPEXP_FWD_CORE wxButton; |
36 | class WXDLLIMPEXP_FWD_CORE wxTextCtrl; | |
37 | class WXDLLIMPEXP_FWD_CORE wxTreeEvent; | |
38 | class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; | |
8ec2b484 | 39 | |
d5bb85a0 | 40 | |
8ec2b484 | 41 | // style flags for the Help Frame |
576507e2 VS |
42 | #define wxHF_TOOLBAR 0x0001 |
43 | #define wxHF_CONTENTS 0x0002 | |
44 | #define wxHF_INDEX 0x0004 | |
45 | #define wxHF_SEARCH 0x0008 | |
46 | #define wxHF_BOOKMARKS 0x0010 | |
47 | #define wxHF_OPEN_FILES 0x0020 | |
48 | #define wxHF_PRINT 0x0040 | |
49 | #define wxHF_FLAT_TOOLBAR 0x0080 | |
50 | #define wxHF_MERGE_BOOKS 0x0100 | |
51 | #define wxHF_ICONS_BOOK 0x0200 | |
52 | #define wxHF_ICONS_BOOK_CHAPTER 0x0400 | |
53 | #define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default | |
54 | #define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \ | |
55 | wxHF_INDEX | wxHF_SEARCH | \ | |
56 | wxHF_BOOKMARKS | wxHF_PRINT) | |
57 | //compatibility: | |
58 | #define wxHF_OPENFILES wxHF_OPEN_FILES | |
59 | #define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR | |
60 | #define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE | |
8ec2b484 | 61 | |
9817a085 | 62 | struct wxHtmlHelpMergedIndexItem; |
08300277 | 63 | class wxHtmlHelpMergedIndex; |
d5bb85a0 | 64 | |
b5dbe15d VS |
65 | class WXDLLIMPEXP_FWD_CORE wxHelpControllerBase; |
66 | class WXDLLIMPEXP_FWD_HTML wxHtmlHelpController; | |
4f7d425f | 67 | class WXDLLIMPEXP_FWD_HTML wxHtmlHelpWindow; |
b31ba288 | 68 | |
6acba9a7 | 69 | class WXDLLIMPEXP_HTML wxHtmlHelpFrame : public wxFrame |
8ec2b484 | 70 | { |
97494971 VS |
71 | DECLARE_DYNAMIC_CLASS(wxHtmlHelpFrame) |
72 | ||
73 | public: | |
74 | wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); } | |
75 | wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID, | |
76 | const wxString& title = wxEmptyString, | |
b4246849 VZ |
77 | int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL |
78 | #if wxUSE_CONFIG | |
79 | , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString | |
80 | #endif // wxUSE_CONFIG | |
81 | ); | |
97494971 | 82 | bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, |
b4246849 VZ |
83 | int style = wxHF_DEFAULT_STYLE |
84 | #if wxUSE_CONFIG | |
85 | , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString | |
86 | #endif // wxUSE_CONFIG | |
87 | ); | |
d3c7fc99 | 88 | virtual ~wxHtmlHelpFrame(); |
97494971 | 89 | |
3755cfa6 | 90 | /// Returns the data associated with the window. |
97494971 | 91 | wxHtmlHelpData* GetData() { return m_Data; } |
97494971 | 92 | |
3755cfa6 JS |
93 | /// Returns the help controller associated with the window. |
94 | wxHtmlHelpController* GetController() const { return m_helpController; } | |
97494971 | 95 | |
3755cfa6 | 96 | /// Sets the help controller associated with the window. |
664d1729 | 97 | void SetController(wxHtmlHelpController* controller); |
dabbc6a5 | 98 | |
3755cfa6 JS |
99 | /// Returns the help window. |
100 | wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; } | |
97494971 | 101 | |
3755cfa6 JS |
102 | // Sets format of title of the frame. Must contain exactly one "%s" |
103 | // (for title of displayed HTML page) | |
104 | void SetTitleFormat(const wxString& format); | |
97494971 | 105 | |
b4246849 | 106 | #if wxUSE_CONFIG |
3755cfa6 JS |
107 | // For compatibility |
108 | void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString); | |
b4246849 | 109 | #endif // wxUSE_CONFIG |
97494971 | 110 | |
3755cfa6 JS |
111 | // Make the help controller's frame 'modal' if |
112 | // needed | |
113 | void AddGrabIfNeeded(); | |
08300277 | 114 | |
3755cfa6 | 115 | // Override to add custom buttons to the toolbar |
47b378bd | 116 | virtual void AddToolbarButtons(wxToolBar* WXUNUSED(toolBar), int WXUNUSED(style)) {} |
97494971 | 117 | |
bd45b3e1 VZ |
118 | void SetShouldPreventAppExit(bool enable); |
119 | ||
65afac3f VZ |
120 | // we don't want to prevent the app from closing just because a help window |
121 | // remains opened | |
bd45b3e1 | 122 | virtual bool ShouldPreventAppExit() const { return m_shouldPreventAppExit; } |
65afac3f | 123 | |
171a1afe | 124 | protected: |
3755cfa6 | 125 | void Init(wxHtmlHelpData* data = NULL); |
97494971 | 126 | |
97494971 | 127 | void OnCloseWindow(wxCloseEvent& event); |
d45bc436 | 128 | void OnActivate(wxActivateEvent& event); |
97494971 | 129 | |
d9b21c9f | 130 | #ifdef __WXMAC__ |
4aa31786 | 131 | void OnClose(wxCommandEvent& event); |
d9b21c9f JS |
132 | void OnAbout(wxCommandEvent& event); |
133 | #endif | |
134 | ||
97494971 VS |
135 | // Images: |
136 | enum { | |
137 | IMG_Book = 0, | |
138 | IMG_Folder, | |
07e252a5 | 139 | IMG_Page |
97494971 VS |
140 | }; |
141 | ||
142 | protected: | |
143 | wxHtmlHelpData* m_Data; | |
144 | bool m_DataCreated; // m_Data created by frame, or supplied? | |
145 | wxString m_TitleFormat; // title of the help frame | |
3755cfa6 JS |
146 | wxHtmlHelpWindow *m_HtmlHelpWin; |
147 | wxHtmlHelpController* m_helpController; | |
bd45b3e1 | 148 | bool m_shouldPreventAppExit; |
d5bb85a0 | 149 | |
08300277 | 150 | private: |
6953da00 | 151 | |
97494971 | 152 | DECLARE_EVENT_TABLE() |
c0c133e1 | 153 | wxDECLARE_NO_COPY_CLASS(wxHtmlHelpFrame); |
8ec2b484 HH |
154 | }; |
155 | ||
3379ed37 | 156 | #endif // wxUSE_WXHTML_HELP |
8ec2b484 HH |
157 | |
158 | #endif |