]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/htwindow.tex
test indeterminate wxGauge mode (part of patch 1551409)
[wxWidgets.git] / docs / latex / wx / htwindow.tex
CommitLineData
704a4b75
VS
1%
2% automatically generated by HelpGen from
3% htmlwindow.tex at 14/Mar/99 20:13:37
4%
5
704a4b75
VS
6\section{\class{wxHtmlWindow}}\label{wxhtmlwindow}
7
8wxHtmlWindow is probably the only class you will directly use
9unless you want to do something special (like adding new tag
448af9a4 10handlers or MIME filters).
704a4b75 11
448af9a4
JS
12The purpose of this class is to display HTML pages (either local
13file or downloaded via HTTP protocol) in a window. The width
14of the window is constant - given in the constructor - and virtual height
15is changed dynamically depending on page size.
fa482912 16Once the window is created you can set its content by calling
903972f9
VS
17\helpref{SetPage(text)}{wxhtmlwindowsetpage},
18\helpref{LoadPage(filename)}{wxhtmlwindowloadpage} or
19\helpref{LoadFile}{wxhtmlwindowloadfile}.
704a4b75 20
5270a2f9
VS
21\wxheading{Note}
22
23wxHtmlWindow uses the \helpref{wxImage}{wximage} class for displaying images.
24Don't forget to initialize all image formats you need before loading any page!
25(See \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} and
26\helpref{wxImage::AddHandler}{wximageaddhandler}.)
27
704a4b75
VS
28\wxheading{Derived from}
29
9704b250 30\helpref{wxScrolledWindow}{wxscrolledwindow}
704a4b75
VS
31
32\wxheading{Include files}
33
9704b250 34<wx/html/htmlwin.h>
704a4b75 35
a689b6d6
VS
36\wxheading{Window styles}
37
38\twocolwidtha{5cm}
39\begin{twocollist}\itemsep=0pt
40\twocolitem{\windowstyle{wxHW\_SCROLLBAR\_NEVER}}{Never display scrollbars, not
41even when the page is larger than the window.}
ec59d2cc 42\twocolitem{\windowstyle{wxHW\_SCROLLBAR\_AUTO}}{Display scrollbars only if
a689b6d6 43page's size exceeds window's size.}
ec59d2cc 44\twocolitem{\windowstyle{wxHW\_NO\_SELECTION}}{Don't allow the user to select
a689b6d6
VS
45text.}
46\end{twocollist}
47
704a4b75
VS
48\membersection{wxHtmlWindow::wxHtmlWindow}\label{wxhtmlwindowwxhtmlwindow}
49
50\func{}{wxHtmlWindow}{\void}
51
52Default constructor.
53
2284d64e 54\func{}{wxHtmlWindow}{\param{wxWindow }{*parent}, \param{wxWindowID }{id = -1}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxHW\_DEFAULT\_STYLE}, \param{const wxString\& }{name = "htmlWindow"}}
704a4b75 55
448af9a4 56Constructor. The parameters are the same as for the \helpref{wxScrolledWindow}{wxscrolledwindow} constructor.
704a4b75
VS
57
58\wxheading{Parameters}
59
a689b6d6 60\docparam{style}{Window style. See \helpref{wxHtmlWindow}{wxhtmlwindow}.}
704a4b75 61
559fe022 62\membersection{wxHtmlWindow::AddFilter}\label{wxhtmlwindowaddfilter}
704a4b75 63
559fe022 64\func{static void}{AddFilter}{\param{wxHtmlFilter }{*filter}}
704a4b75 65
559fe022
VS
66Adds \helpref{input filter}{filters} to the static list of available
67filters. These filters are present by default:
704a4b75 68
448af9a4 69\begin{itemize}\itemsep=0pt
559fe022
VS
70\item {\tt text/html} MIME type
71\item {\tt image/*} MIME types
72\item Plain Text filter (this filter is used if no other filter matches)
73\end{itemize}
704a4b75 74
39029898
VS
75\membersection{wxHtmlWindow::AppendToPage}\label{wxhtmlwindowappendtopage}
76
77\func{bool}{AppendToPage}{\param{const wxString\& }{source}}
78
79Appends HTML fragment to currently displayed text and refreshes the window.
80
81\wxheading{Parameters}
82
83\docparam{source}{HTML code fragment}
84
85\wxheading{Return value}
86
cc81d32f 87false if an error occurred, true otherwise.
39029898 88
559fe022 89\membersection{wxHtmlWindow::GetInternalRepresentation}\label{wxhtmlwindowgetinternalrepresentation}
704a4b75 90
559fe022 91\constfunc{wxHtmlContainerCell*}{GetInternalRepresentation}{\void}
704a4b75 92
559fe022 93Returns pointer to the top-level container.
704a4b75 94
559fe022
VS
95See also: \helpref{Cells Overview}{cells},
96\helpref{Printing Overview}{printing}
704a4b75 97
5656c6ef
VS
98\membersection{wxHtmlWindow::GetOpenedAnchor}\label{wxhtmlwindowgetopenedanchor}
99
100\func{wxString}{GetOpenedAnchor}{\void}
101
102Returns anchor within currently opened page
103(see \helpref{GetOpenedPage}{wxhtmlwindowgetopenedpage}).
104If no page is opened or if the displayed page wasn't
105produced by call to LoadPage, empty string is returned.
106
107
559fe022
VS
108\membersection{wxHtmlWindow::GetOpenedPage}\label{wxhtmlwindowgetopenedpage}
109
110\func{wxString}{GetOpenedPage}{\void}
111
112Returns full location of the opened page. If no page is opened or if the displayed page wasn't
113produced by call to LoadPage, empty string is returned.
114
d5db80c2
VS
115\membersection{wxHtmlWindow::GetOpenedPageTitle}\label{wxhtmlwindowgetopenedpagetitle}
116
117\func{wxString}{GetOpenedPageTitle}{\void}
118
119Returns title of the opened page or wxEmptyString if current page does not contain {\tt <TITLE>} tag.
120
559fe022
VS
121\membersection{wxHtmlWindow::GetRelatedFrame}\label{wxhtmlwindowgetrelatedframe}
122
123\constfunc{wxFrame*}{GetRelatedFrame}{\void}
124
125Returns the related frame.
126
127\membersection{wxHtmlWindow::HistoryBack}\label{wxhtmlwindowhistoryback}
128
129\func{bool}{HistoryBack}{\void}
130
131Moves back to the previous page. (each page displayed using
132\helpref{LoadPage}{wxhtmlwindowloadpage} is stored in history list.)
133
1b113a81
VS
134\membersection{wxHtmlWindow::HistoryCanBack}\label{wxhtmlwindowhistorycanback}
135
136\func{bool}{HistoryCanBack}{\void}
137
138Returns true if it is possible to go back in the history (i.e. HistoryBack()
139won't fail).
140
141\membersection{wxHtmlWindow::HistoryCanForward}\label{wxhtmlwindowhistorycanforward}
142
143\func{bool}{HistoryCanForward}{\void}
144
145Returns true if it is possible to go forward in the history (i.e. HistoryBack()
146won't fail).
147
148
559fe022
VS
149\membersection{wxHtmlWindow::HistoryClear}\label{wxhtmlwindowhistoryclear}
150
151\func{void}{HistoryClear}{\void}
152
153Clears history.
154
155\membersection{wxHtmlWindow::HistoryForward}\label{wxhtmlwindowhistoryforward}
156
157\func{bool}{HistoryForward}{\void}
158
159Moves to next page in history.
704a4b75 160
903972f9
VS
161\membersection{wxHtmlWindow::LoadFile}\label{wxhtmlwindowloadfile}
162
163\func{virtual bool}{LoadFile}{\param{const wxFileName\& }{filename}}
164
165Loads HTML page from file and displays it.
166
167\wxheading{Return value}
168
169false if an error occurred, true otherwise
170
171\wxheading{See also}
172
173\helpref{LoadPage}{wxhtmlwindowloadpage}
174
704a4b75
VS
175\membersection{wxHtmlWindow::LoadPage}\label{wxhtmlwindowloadpage}
176
298d8653 177\func{virtual bool}{LoadPage}{\param{const wxString\& }{location}}
704a4b75 178
448af9a4 179Unlike SetPage this function first loads HTML page from {\it location}
704a4b75
VS
180and then displays it. See example:
181
182\begin{verbatim}
903972f9 183htmlwin->LoadPage("help/myproject/index.htm");
704a4b75
VS
184\end{verbatim}
185
186\wxheading{Parameters}
187
188\docparam{location}{The address of document. See \helpref{wxFileSystem}{wxfilesystem} for details on address format and behaviour of "opener".}
189
190\wxheading{Return value}
191
cc81d32f 192false if an error occurred, true otherwise
704a4b75 193
903972f9
VS
194\wxheading{See also}
195
196\helpref{LoadFile}{wxhtmlwindowloadfile}
197
f6010d8f
VZ
198\membersection{wxHtmlWindow::OnCellClicked}\label{wxhtmlwindowoncellclicked}
199
bc55e31b 200\func{virtual bool}{OnCellClicked}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}, \param{const wxMouseEvent\& }{event}}
f6010d8f
VZ
201
202This method is called when a mouse button is clicked inside wxHtmlWindow.
203The default behaviour is to call
204\helpref{OnLinkClicked}{wxhtmlwindowonlinkclicked} if the cell contains a
205hypertext link.
206
207\wxheading{Parameters}
208
209\docparam{cell}{The cell inside which the mouse was clicked, always a simple
154b6b0f 210(i.e. non-container) cell}
f6010d8f
VZ
211
212\docparam{x, y}{The logical coordinates of the click point}
213
214\docparam{event}{The mouse event containing other information about the click}
215
bc55e31b
VS
216\wxheading{Return value}
217
218\true if a link was clicked, \false otherwise.
219
f6010d8f
VZ
220\membersection{wxHtmlWindow::OnCellMouseHover}\label{wxhtmlwindowoncellmousehover}
221
222\func{virtual void}{OnCellMouseHover}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}}
223
224This method is called when a mouse moves over an HTML cell.
225
226\wxheading{Parameters}
227
228\docparam{cell}{The cell inside which the mouse is currently, always a simple
154b6b0f 229(i.e. non-container) cell}
f6010d8f
VZ
230
231\docparam{x, y}{The logical coordinates of the click point}
232
559fe022 233\membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked}
704a4b75 234
d17f05af 235\func{virtual void}{OnLinkClicked}{\param{const wxHtmlLinkInfo\& }{link}}
704a4b75 236
559fe022
VS
237Called when user clicks on hypertext link. Default behaviour is to call
238\helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.
704a4b75 239
846914d1
VS
240Also see \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
241
e03ca426
VS
242\membersection{wxHtmlWindow::OnOpeningURL}\label{wxhtmlwindowonopeningurl}
243
6cc4e6b8 244\func{virtual wxHtmlOpeningStatus}{OnOpeningURL}{\param{wxHtmlURLType }{type},\param{const wxString\& }{url}, \param{wxString *}{redirect}}
e03ca426
VS
245
246Called when an URL is being opened (either when the user clicks on a link or
6cc4e6b8
VS
247an image is loaded). The URL will be opened only if OnOpeningURL returns
248{\tt wxHTML\_OPEN}. This method is called by
249\helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl}.
250You can override OnOpeningURL to selectively block some
251URLs (e.g. for security reasons) or to redirect them elsewhere. Default
252behaviour is to always return {\tt wxHTML\_OPEN}.
e03ca426 253
6cc4e6b8
VS
254\wxheading{Parameters}
255
256\docparam{type}{Indicates type of the resource. Is one of
257\begin{twocollist}\itemsep=0pt
258\twocolitem{{\bf wxHTML\_URL\_PAGE}}{Opening a HTML page.}
259\twocolitem{{\bf wxHTML\_URL\_IMAGE}}{Opening an image.}
260\twocolitem{{\bf wxHTML\_URL\_OTHER}}{Opening a resource that doesn't fall into
261any other category.}
262\end{twocollist}}
263
264\docparam{url}{URL being opened.}
265
266\docparam{redirect}{Pointer to wxString variable that must be filled with an
267URL if OnOpeningURL returns {\tt wxHTML\_REDIRECT}.}
268
269\wxheading{Return value}
270\begin{twocollist}\itemsep=0pt
271\twocolitem{{\bf wxHTML\_OPEN}}{Open the URL.}
272\twocolitem{{\bf wxHTML\_BLOCK}}{Deny access to the URL, \helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl} will return NULL.}
273\twocolitem{{\bf wxHTML\_REDIRECT}}{Don't open {\it url}, redirect to another
274URL. OnOpeningURL must fill {\it *redirect} with the new URL. OnOpeningURL will
275be called again on returned URL.}
276\end{twocollist}
d5db80c2
VS
277
278\membersection{wxHtmlWindow::OnSetTitle}\label{wxhtmlwindowonsettitle}
279
280\func{virtual void}{OnSetTitle}{\param{const wxString\& }{title}}
281
282Called on parsing {\tt <TITLE>} tag.
283
284
559fe022 285\membersection{wxHtmlWindow::ReadCustomization}\label{wxhtmlwindowreadcustomization}
704a4b75 286
559fe022 287\func{virtual void}{ReadCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
704a4b75 288
559fe022
VS
289This reads custom settings from wxConfig. It uses the path 'path'
290if given, otherwise it saves info into currently selected path.
291The values are stored in sub-path {\tt wxHtmlWindow}
704a4b75 292
448af9a4 293Read values: all things set by SetFonts, SetBorders.
704a4b75 294
559fe022 295\wxheading{Parameters}
704a4b75 296
448af9a4 297\docparam{cfg}{wxConfig from which you want to read the configuration.}
704a4b75 298
559fe022 299\docparam{path}{Optional path in config tree. If not given current path is used.}
704a4b75 300
00ee93d7
VS
301\membersection{wxHtmlWindow::SelectAll}\label{wxhtmlwindowselectall}
302
303\func{void}{SelectAll}{\void}
304
305Selects all text in the window.
306
307\wxheading{See also}
308
309\helpref{SelectLine}{wxhtmlwindowselectline},
310\helpref{SelectWord}{wxhtmlwindowselectword}
311
b55bab15
VS
312\membersection{wxHtmlWindow::SelectionToText}\label{wxhtmlwindowselectiontotext}
313
314\func{wxString}{SelectionToText}{\void}
315
316Returns current selection as plain text. Returns empty string if no text
317is currently selected.
318
00ee93d7
VS
319\membersection{wxHtmlWindow::SelectLine}\label{wxhtmlwindowselectline}
320
321\func{void}{SelectLine}{\param{const wxPoint\& }{pos}}
322
323Selects the line of text that \arg{pos} points at. Note that \arg{pos}
324is relative to the top of displayed page, not to window's origin, use
325\helpref{CalcUnscrolledPosition}{wxscrolledwindowcalcunscrolledposition}
326to convert physical coordinate.
327
328\wxheading{See also}
329
330\helpref{SelectAll}{wxhtmlwindowselectall},
331\helpref{SelectWord}{wxhtmlwindowselectword}
332
333\membersection{wxHtmlWindow::SelectWord}\label{wxhtmlwindowselectword}
334
335\func{void}{SelectWord}{\param{const wxPoint\& }{pos}}
336
337Selects the word at position \arg{pos}. Note that \arg{pos}
338is relative to the top of displayed page, not to window's origin, use
339\helpref{CalcUnscrolledPosition}{wxscrolledwindowcalcunscrolledposition}
340to convert physical coordinate.
341
342\wxheading{See also}
343
344\helpref{SelectAll}{wxhtmlwindowselectall},
345\helpref{SelectLine}{wxhtmlwindowselectline}
346
559fe022 347\membersection{wxHtmlWindow::SetBorders}\label{wxhtmlwindowsetborders}
704a4b75 348
559fe022
VS
349\func{void}{SetBorders}{\param{int }{b}}
350
351This function sets the space between border of window and HTML contents. See image:
352
605d715d 353\helponly{\image{}{border.bmp}}
704a4b75
VS
354
355\wxheading{Parameters}
356
559fe022 357\docparam{b}{indentation from borders in pixels}
704a4b75
VS
358
359\membersection{wxHtmlWindow::SetFonts}\label{wxhtmlwindowsetfonts}
360
fbfb8bcc 361\func{void}{SetFonts}{\param{const wxString\& }{normal\_face}, \param{const wxString\& }{fixed\_face}, \param{const int }{*sizes = NULL}}
704a4b75
VS
362
363This function sets font sizes and faces.
364
365\wxheading{Parameters}
366
448af9a4 367\docparam{normal\_face}{This is face name for normal (i.e. non-fixed) font.
2edb0bde 368It can be either empty string (then the default face is chosen) or
704a4b75
VS
369platform-specific face name. Examples are "helvetica" under Unix or
370"Times New Roman" under Windows.}
371
448af9a4 372\docparam{fixed\_face}{The same thing for fixed face ( <TT>..</TT> )}
704a4b75 373
704a4b75
VS
374\docparam{sizes}{This is an array of 7 items of {\it int} type.
375The values represent size of font with HTML size from -2 to +4
4eecf115
VS
376( <FONT SIZE=-2> to <FONT SIZE=+4> ). Default sizes are used if {\it sizes}
377is NULL.}
704a4b75
VS
378
379\wxheading{Defaults}
380
4eecf115
VS
381Default font sizes are defined by constants wxHTML\_FONT\_SIZE\_1,
382wxHTML\_FONT\_SIZE\_2, ..., wxHTML\_FONT\_SIZE\_7. Note that they differ among
383platforms. Default face names are empty strings.
704a4b75 384
559fe022 385\membersection{wxHtmlWindow::SetPage}\label{wxhtmlwindowsetpage}
704a4b75 386
559fe022 387\func{bool}{SetPage}{\param{const wxString\& }{source}}
704a4b75 388
559fe022
VS
389Sets HTML page and display it. This won't {\bf load} the page!!
390It will display the {\it source}. See example:
704a4b75 391
559fe022
VS
392\begin{verbatim}
393htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
394\end{verbatim}
395
448af9a4 396If you want to load a document from some location use
559fe022 397\helpref{LoadPage}{wxhtmlwindowloadpage} instead.
704a4b75
VS
398
399\wxheading{Parameters}
400
559fe022 401\docparam{source}{The HTML document source to be displayed.}
704a4b75 402
559fe022 403\wxheading{Return value}
704a4b75 404
cc81d32f 405false if an error occurred, true otherwise.
704a4b75 406
559fe022 407\membersection{wxHtmlWindow::SetRelatedFrame}\label{wxhtmlwindowsetrelatedframe}
704a4b75 408
559fe022 409\func{void}{SetRelatedFrame}{\param{wxFrame* }{frame}, \param{const wxString\& }{format}}
704a4b75 410
448af9a4 411Sets the frame in which page title will be displayed. {\it format} is format of
559fe022
VS
412frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
413\%s is substituted with HTML page title.
704a4b75 414
559fe022 415\membersection{wxHtmlWindow::SetRelatedStatusBar}\label{wxhtmlwindowsetrelatedstatusbar}
704a4b75 416
559fe022
VS
417\func{void}{SetRelatedStatusBar}{\param{int }{bar}}
418
419{\bf After} calling \helpref{SetRelatedFrame}{wxhtmlwindowsetrelatedframe},
420this sets statusbar slot where messages will be displayed.
421(Default is -1 = no messages.)
422
423\wxheading{Parameters}
424
425\docparam{bar}{statusbar slot number (0..n)}
704a4b75 426
b55bab15
VS
427\membersection{wxHtmlWindow::ToText}\label{wxhtmlwindowtotext}
428
429\func{wxString}{ToText}{\void}
430
431Returns content of currently displayed page as plain text.
d5db80c2 432
704a4b75
VS
433\membersection{wxHtmlWindow::WriteCustomization}\label{wxhtmlwindowwritecustomization}
434
435\func{virtual void}{WriteCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
436
437Saves custom settings into wxConfig. It uses the path 'path'
438if given, otherwise it saves info into currently selected path.
448af9a4
JS
439Regardless of whether the path is given or not, the function creates sub-path
440{\tt wxHtmlWindow}.
704a4b75 441
448af9a4 442Saved values: all things set by SetFonts, SetBorders.
704a4b75
VS
443
444\wxheading{Parameters}
445
448af9a4 446\docparam{cfg}{wxConfig to which you want to save the configuration.}
704a4b75 447
448af9a4 448\docparam{path}{Optional path in config tree. If not given, the current path is used.}
704a4b75 449