1wxHtmlWindow(3) Erlang Module Definition wxHtmlWindow(3)
2
3
4
6 wxHtmlWindow - Functions for wxHtmlWindow class
7
9 wxHtmlWindow is probably the only class you will directly use unless
10 you want to do something special (like adding new tag handlers or MIME
11 filters).
12
13 The purpose of this class is to display rich content pages (either lo‐
14 cal file or downloaded via HTTP protocol) in a window based on a subset
15 of the HTML standard. The width of the window is constant, given in the
16 constructor and virtual height is changed dynamically depending on page
17 size. Once the window is created you can set its content by calling
18 setPage/2 with raw HTML, loadPage/2 with a wxFileSystem (not imple‐
19 mented in wx) location or loadFile/2 with a filename.
20
21 Note: If you want complete HTML/CSS support as well as a Javascript en‐
22 gine, consider using wxWebView instead.
23
24 wxHtmlWindow uses the wxImage class for displaying images, so you need
25 to initialize the handlers for any image formats you use before loading
26 a page. See ?wxInitAllImageHandlers and wxImage::AddHandler (not imple‐
27 mented in wx).
28
29 Styles
30
31 This class supports the following styles:
32
33 See: wxHtmlLinkEvent, wxHtmlCellEvent (not implemented in wx)
34
35 This class is derived (and can use functions) from: wxScrolledWindow
36 wxPanel wxWindow wxEvtHandler
37
38 wxWidgets docs: wxHtmlWindow
39
41 Event types emitted from this class: html_cell_clicked,
42 html_cell_hover, command_html_link_clicked
43
45 wxHtmlWindow() = wx:wx_object()
46
48 new() -> wxHtmlWindow()
49
50 Default ctor.
51
52 new(Parent) -> wxHtmlWindow()
53
54 Types:
55
56 Parent = wxWindow:wxWindow()
57
58 new(Parent, Options :: [Option]) -> wxHtmlWindow()
59
60 Types:
61
62 Parent = wxWindow:wxWindow()
63 Option =
64 {id, integer()} |
65 {pos, {X :: integer(), Y :: integer()}} |
66 {size, {W :: integer(), H :: integer()}} |
67 {style, integer()}
68
69 Constructor.
70
71 The parameters are the same as wxScrolled::wxScrolled() (not im‐
72 plemented in wx) constructor.
73
74 appendToPage(This, Source) -> boolean()
75
76 Types:
77
78 This = wxHtmlWindow()
79 Source = unicode:chardata()
80
81 Appends HTML fragment to currently displayed text and refreshes
82 the window.
83
84 Return: false if an error occurred, true otherwise.
85
86 getOpenedAnchor(This) -> unicode:charlist()
87
88 Types:
89
90 This = wxHtmlWindow()
91
92 Returns anchor within currently opened page (see getOpened‐
93 Page/1).
94
95 If no page is opened or if the displayed page wasn't produced by
96 call to loadPage/2, empty string is returned.
97
98 getOpenedPage(This) -> unicode:charlist()
99
100 Types:
101
102 This = wxHtmlWindow()
103
104 Returns full location of the opened page.
105
106 If no page is opened or if the displayed page wasn't produced by
107 call to loadPage/2, empty string is returned.
108
109 getOpenedPageTitle(This) -> unicode:charlist()
110
111 Types:
112
113 This = wxHtmlWindow()
114
115 Returns title of the opened page or wxEmptyString if the current
116 page does not contain <TITLE> tag.
117
118 getRelatedFrame(This) -> wxFrame:wxFrame()
119
120 Types:
121
122 This = wxHtmlWindow()
123
124 Returns the related frame.
125
126 historyBack(This) -> boolean()
127
128 Types:
129
130 This = wxHtmlWindow()
131
132 Moves back to the previous page.
133
134 Only pages displayed using loadPage/2 are stored in history
135 list.
136
137 historyCanBack(This) -> boolean()
138
139 Types:
140
141 This = wxHtmlWindow()
142
143 Returns true if it is possible to go back in the history i.e.
144
145 historyBack/1 won't fail.
146
147 historyCanForward(This) -> boolean()
148
149 Types:
150
151 This = wxHtmlWindow()
152
153 Returns true if it is possible to go forward in the history i.e.
154
155 historyForward/1 won't fail.
156
157 historyClear(This) -> ok
158
159 Types:
160
161 This = wxHtmlWindow()
162
163 Clears history.
164
165 historyForward(This) -> boolean()
166
167 Types:
168
169 This = wxHtmlWindow()
170
171 Moves to next page in history.
172
173 Only pages displayed using loadPage/2 are stored in history
174 list.
175
176 loadFile(This, Filename) -> boolean()
177
178 Types:
179
180 This = wxHtmlWindow()
181 Filename = unicode:chardata()
182
183 Loads an HTML page from a file and displays it.
184
185 Return: false if an error occurred, true otherwise
186
187 See: loadPage/2
188
189 loadPage(This, Location) -> boolean()
190
191 Types:
192
193 This = wxHtmlWindow()
194 Location = unicode:chardata()
195
196 Unlike setPage/2 this function first loads the HTML page from
197 location and then displays it.
198
199 Return: false if an error occurred, true otherwise
200
201 See: loadFile/2
202
203 selectAll(This) -> ok
204
205 Types:
206
207 This = wxHtmlWindow()
208
209 Selects all text in the window.
210
211 See: selectLine/2, selectWord/2
212
213 selectionToText(This) -> unicode:charlist()
214
215 Types:
216
217 This = wxHtmlWindow()
218
219 Returns the current selection as plain text.
220
221 Returns an empty string if no text is currently selected.
222
223 selectLine(This, Pos) -> ok
224
225 Types:
226
227 This = wxHtmlWindow()
228 Pos = {X :: integer(), Y :: integer()}
229
230 Selects the line of text that pos points at.
231
232 Note that pos is relative to the top of displayed page, not to
233 window's origin, use wxScrolledWindow:calcUnscrolledPosition/3
234 to convert physical coordinate.
235
236 See: selectAll/1, selectWord/2
237
238 selectWord(This, Pos) -> ok
239
240 Types:
241
242 This = wxHtmlWindow()
243 Pos = {X :: integer(), Y :: integer()}
244
245 Selects the word at position pos.
246
247 Note that pos is relative to the top of displayed page, not to
248 window's origin, use wxScrolledWindow:calcUnscrolledPosition/3
249 to convert physical coordinate.
250
251 See: selectAll/1, selectLine/2
252
253 setBorders(This, B) -> ok
254
255 Types:
256
257 This = wxHtmlWindow()
258 B = integer()
259
260 This function sets the space between border of window and HTML
261 contents.
262
263 See image:
264
265 setFonts(This, Normal_face, Fixed_face) -> ok
266
267 Types:
268
269 This = wxHtmlWindow()
270 Normal_face = Fixed_face = unicode:chardata()
271
272 setFonts(This, Normal_face, Fixed_face, Options :: [Option]) -> ok
273
274 Types:
275
276 This = wxHtmlWindow()
277 Normal_face = Fixed_face = unicode:chardata()
278 Option = {sizes, [integer()]}
279
280 This function sets font sizes and faces.
281
282 See wxHtmlDCRenderer::SetFonts (not implemented in wx) for de‐
283 tailed description.
284
285 See: SetSize()
286
287 setPage(This, Source) -> boolean()
288
289 Types:
290
291 This = wxHtmlWindow()
292 Source = unicode:chardata()
293
294 Sets the source of a page and displays it, for example:
295
296 If you want to load a document from some location use loadPage/2
297 instead.
298
299 Return: false if an error occurred, true otherwise.
300
301 setRelatedFrame(This, Frame, Format) -> ok
302
303 Types:
304
305 This = wxHtmlWindow()
306 Frame = wxFrame:wxFrame()
307 Format = unicode:chardata()
308
309 Sets the frame in which page title will be displayed.
310
311 format is the format of the frame title, e.g. "HtmlHelp : %s".
312 It must contain exactly one s. This s is substituted with HTML
313 page title.
314
315 setRelatedStatusBar(This, Statusbar) -> ok
316
317 setRelatedStatusBar(This, Index) -> ok
318
319 Types:
320
321 This = wxHtmlWindow()
322 Index = integer()
323
324 After calling setRelatedFrame/3, this sets statusbar slot where
325 messages will be displayed.
326
327 (Default is -1 = no messages.)
328
329 setRelatedStatusBar(This, Statusbar, Options :: [Option]) -> ok
330
331 Types:
332
333 This = wxHtmlWindow()
334 Statusbar = wxStatusBar:wxStatusBar()
335 Option = {index, integer()}
336
337 Sets the associated statusbar where messages will be displayed.
338
339 Call this instead of setRelatedFrame/3 if you want statusbar up‐
340 dates only, no changing of the frame title.
341
342 Since: 2.9.0
343
344 toText(This) -> unicode:charlist()
345
346 Types:
347
348 This = wxHtmlWindow()
349
350 Returns content of currently displayed page as plain text.
351
352 destroy(This :: wxHtmlWindow()) -> ok
353
354 Destroys the object.
355
356
357
358wxWidgets team. wx 2.2.2 wxHtmlWindow(3)