root / trunk / install / launcher / izpack-launcher-1.3_linux / src / wx / include / wx / html / helpfrm.h @ 6834
History | View | Annotate | Download (7.28 KB)
1 |
/////////////////////////////////////////////////////////////////////////////
|
---|---|
2 |
// Name: helpfrm.h
|
3 |
// Purpose: wxHtmlHelpFrame
|
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: helpfrm.h 6834 2006-08-24 08:23:24Z jmvivo $
|
8 |
// Copyright: (c) Harm van der Heijden and Vaclav Slavik
|
9 |
// Licence: wxWindows licence
|
10 |
/////////////////////////////////////////////////////////////////////////////
|
11 |
|
12 |
#ifndef _WX_HELPFRM_H_
|
13 |
#define _WX_HELPFRM_H_
|
14 |
|
15 |
#include "wx/defs.h" |
16 |
|
17 |
#if wxUSE_WXHTML_HELP
|
18 |
|
19 |
#include "wx/html/helpdata.h" |
20 |
#include "wx/window.h" |
21 |
#include "wx/frame.h" |
22 |
#include "wx/config.h" |
23 |
#include "wx/splitter.h" |
24 |
#include "wx/notebook.h" |
25 |
#include "wx/listbox.h" |
26 |
#include "wx/choice.h" |
27 |
#include "wx/combobox.h" |
28 |
#include "wx/checkbox.h" |
29 |
#include "wx/stattext.h" |
30 |
#include "wx/html/htmlwin.h" |
31 |
#include "wx/html/htmprint.h" |
32 |
|
33 |
class WXDLLEXPORT wxButton; |
34 |
class WXDLLEXPORT wxTextCtrl; |
35 |
|
36 |
|
37 |
// style flags for the Help Frame
|
38 |
#define wxHF_TOOLBAR 0x0001 |
39 |
#define wxHF_CONTENTS 0x0002 |
40 |
#define wxHF_INDEX 0x0004 |
41 |
#define wxHF_SEARCH 0x0008 |
42 |
#define wxHF_BOOKMARKS 0x0010 |
43 |
#define wxHF_OPEN_FILES 0x0020 |
44 |
#define wxHF_PRINT 0x0040 |
45 |
#define wxHF_FLAT_TOOLBAR 0x0080 |
46 |
#define wxHF_MERGE_BOOKS 0x0100 |
47 |
#define wxHF_ICONS_BOOK 0x0200 |
48 |
#define wxHF_ICONS_BOOK_CHAPTER 0x0400 |
49 |
#define wxHF_ICONS_FOLDER 0x0000 // this is 0 since it is default |
50 |
#define wxHF_DEFAULT_STYLE (wxHF_TOOLBAR | wxHF_CONTENTS | \
|
51 |
wxHF_INDEX | wxHF_SEARCH | \ |
52 |
wxHF_BOOKMARKS | wxHF_PRINT) |
53 |
//compatibility:
|
54 |
#define wxHF_OPENFILES wxHF_OPEN_FILES
|
55 |
#define wxHF_FLATTOOLBAR wxHF_FLAT_TOOLBAR
|
56 |
#define wxHF_DEFAULTSTYLE wxHF_DEFAULT_STYLE
|
57 |
|
58 |
|
59 |
struct wxHtmlHelpFrameCfg
|
60 |
{ |
61 |
int x, y, w, h;
|
62 |
long sashpos;
|
63 |
bool navig_on;
|
64 |
}; |
65 |
|
66 |
|
67 |
class WXDLLEXPORT wxHelpControllerBase; |
68 |
|
69 |
class WXDLLEXPORT wxHtmlHelpFrame : public wxFrame |
70 |
{ |
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,
|
77 |
int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL); |
78 |
bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString, |
79 |
int style = wxHF_DEFAULT_STYLE);
|
80 |
~wxHtmlHelpFrame(); |
81 |
|
82 |
wxHtmlHelpData* GetData() { return m_Data; }
|
83 |
wxHelpControllerBase* GetController() const { return m_helpController; } |
84 |
void SetController(wxHelpControllerBase* controller) { m_helpController = controller; }
|
85 |
|
86 |
// Sets format of title of the frame. Must contain exactly one "%s"
|
87 |
// (for title of displayed HTML page)
|
88 |
void SetTitleFormat(const wxString& format); |
89 |
|
90 |
// Displays page x. If not found it will offect the user a choice of
|
91 |
// searching books.
|
92 |
// Looking for the page runs in these steps:
|
93 |
// 1. try to locate file named x (if x is for example "doc/howto.htm")
|
94 |
// 2. try to open starting page of book x
|
95 |
// 3. try to find x in contents (if x is for example "How To ...")
|
96 |
// 4. try to find x in index (if x is for example "How To ...")
|
97 |
bool Display(const wxString& x); |
98 |
|
99 |
// Alternative version that works with numeric ID.
|
100 |
// (uses extension to MS format, <param name="ID" value=id>, see docs)
|
101 |
bool Display(const int id); |
102 |
|
103 |
// Displays help window and focuses contents.
|
104 |
bool DisplayContents();
|
105 |
|
106 |
// Displays help window and focuses index.
|
107 |
bool DisplayIndex();
|
108 |
|
109 |
// Searches for keyword. Returns TRUE and display page if found, return
|
110 |
// FALSE otherwise
|
111 |
// Syntax of keyword is Altavista-like:
|
112 |
// * words are separated by spaces
|
113 |
// (but "\"hello world\"" is only one world "hello world")
|
114 |
// * word may be pretended by + or -
|
115 |
// (+ : page must contain the word ; - : page can't contain the word)
|
116 |
// * if there is no + or - before the word, + is default
|
117 |
bool KeywordSearch(const wxString& keyword); |
118 |
|
119 |
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString) |
120 |
{ |
121 |
m_Config = config; |
122 |
m_ConfigRoot = rootpath; |
123 |
ReadCustomization(config, rootpath); |
124 |
} |
125 |
|
126 |
// Saves custom settings into cfg config. it will use the path 'path'
|
127 |
// if given, otherwise it will save info into currently selected path.
|
128 |
// saved values : things set by SetFonts, SetBorders.
|
129 |
void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); |
130 |
void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString); |
131 |
|
132 |
// call this to let wxHtmlHelpFrame know page changed
|
133 |
void NotifyPageChanged();
|
134 |
|
135 |
// Refreshes Contents and Index tabs
|
136 |
void RefreshLists();
|
137 |
|
138 |
protected:
|
139 |
void Init(wxHtmlHelpData* data = NULL); |
140 |
|
141 |
// Adds items to m_Contents tree control
|
142 |
void CreateContents();
|
143 |
|
144 |
// Adds items to m_IndexList
|
145 |
void CreateIndex();
|
146 |
|
147 |
// Add books to search choice panel
|
148 |
void CreateSearch();
|
149 |
|
150 |
// Add custom buttons to toolbar
|
151 |
virtual void AddToolbarButtons(wxToolBar *toolBar, int style); |
152 |
|
153 |
// Displays options dialog (fonts etc.)
|
154 |
virtual void OptionsDialog();
|
155 |
|
156 |
void OnToolbar(wxCommandEvent& event);
|
157 |
void OnContentsSel(wxTreeEvent& event);
|
158 |
void OnIndexSel(wxCommandEvent& event);
|
159 |
void OnIndexFind(wxCommandEvent& event);
|
160 |
void OnIndexAll(wxCommandEvent& event);
|
161 |
void OnSearchSel(wxCommandEvent& event);
|
162 |
void OnSearch(wxCommandEvent& event);
|
163 |
void OnBookmarksSel(wxCommandEvent& event);
|
164 |
void OnCloseWindow(wxCloseEvent& event);
|
165 |
void OnActivate(wxActivateEvent& event);
|
166 |
|
167 |
// Images:
|
168 |
enum {
|
169 |
IMG_Book = 0,
|
170 |
IMG_Folder, |
171 |
IMG_Page |
172 |
}; |
173 |
|
174 |
protected:
|
175 |
wxHtmlHelpData* m_Data; |
176 |
bool m_DataCreated; // m_Data created by frame, or supplied? |
177 |
wxString m_TitleFormat; // title of the help frame
|
178 |
// below are various pointers to GUI components
|
179 |
wxHtmlWindow *m_HtmlWin; |
180 |
wxSplitterWindow *m_Splitter; |
181 |
wxPanel *m_NavigPan; |
182 |
wxNotebook *m_NavigNotebook; |
183 |
wxTreeCtrl *m_ContentsBox; |
184 |
wxTextCtrl *m_IndexText; |
185 |
wxButton *m_IndexButton; |
186 |
wxButton *m_IndexButtonAll; |
187 |
wxListBox *m_IndexList; |
188 |
wxTextCtrl *m_SearchText; |
189 |
wxButton *m_SearchButton; |
190 |
wxListBox *m_SearchList; |
191 |
wxChoice *m_SearchChoice; |
192 |
wxStaticText *m_IndexCountInfo; |
193 |
wxCheckBox *m_SearchCaseSensitive; |
194 |
wxCheckBox *m_SearchWholeWords; |
195 |
|
196 |
wxComboBox *m_Bookmarks; |
197 |
wxArrayString m_BookmarksNames, m_BookmarksPages; |
198 |
|
199 |
wxHtmlHelpFrameCfg m_Cfg; |
200 |
|
201 |
wxConfigBase *m_Config; |
202 |
wxString m_ConfigRoot; |
203 |
|
204 |
// pagenumbers of controls in notebook (usually 0,1,2)
|
205 |
int m_ContentsPage;
|
206 |
int m_IndexPage;
|
207 |
int m_SearchPage;
|
208 |
|
209 |
// lists of available fonts (used in options dialog)
|
210 |
wxArrayString *m_NormalFonts, *m_FixedFonts; |
211 |
int m_FontSize; // 0,1,2 = small,medium,big |
212 |
wxString m_NormalFace, m_FixedFace; |
213 |
|
214 |
bool m_UpdateContents;
|
215 |
|
216 |
#if wxUSE_PRINTING_ARCHITECTURE
|
217 |
wxHtmlEasyPrinting *m_Printer; |
218 |
#endif
|
219 |
wxHashTable *m_PagesHash; |
220 |
wxHelpControllerBase* m_helpController; |
221 |
|
222 |
int m_hfStyle;
|
223 |
|
224 |
DECLARE_EVENT_TABLE() |
225 |
}; |
226 |
|
227 |
#endif // wxUSE_WXHTML_HELP |
228 |
|
229 |
#endif
|