]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/htwindow.tex
Changes for wxOGL since wxFatalError has been deprecated.
[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
704a4b75
VS
17\helpref{SetPage(text)}{wxhtmlwindowsetpage} or
18\helpref{LoadPage(filename)}{wxhtmlwindowloadpage}.
19
5270a2f9
VS
20\wxheading{Note}
21
22wxHtmlWindow uses the \helpref{wxImage}{wximage} class for displaying images.
23Don't forget to initialize all image formats you need before loading any page!
24(See \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} and
25\helpref{wxImage::AddHandler}{wximageaddhandler}.)
26
704a4b75
VS
27\wxheading{Derived from}
28
9704b250 29\helpref{wxScrolledWindow}{wxscrolledwindow}
704a4b75
VS
30
31\wxheading{Include files}
32
9704b250 33<wx/html/htmlwin.h>
704a4b75
VS
34
35\membersection{wxHtmlWindow::wxHtmlWindow}\label{wxhtmlwindowwxhtmlwindow}
36
37\func{}{wxHtmlWindow}{\void}
38
39Default constructor.
40
605d715d 41\func{}{wxHtmlWindow}{\param{wxWindow }{*parent}, \param{wxWindowID }{id = -1}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxHW\_SCROLLBAR\_AUTO}, \param{const wxString\& }{name = "htmlWindow"}}
704a4b75 42
448af9a4 43Constructor. The parameters are the same as for the \helpref{wxScrolledWindow}{wxscrolledwindow} constructor.
704a4b75
VS
44
45\wxheading{Parameters}
46
22d6efa8 47\docparam{style}{wxHW\_SCROLLBAR\_NEVER, or wxHW\_SCROLLBAR\_AUTO.
448af9a4 48Affects the appearance of vertical scrollbar in the window.}
704a4b75 49
559fe022 50\membersection{wxHtmlWindow::AddFilter}\label{wxhtmlwindowaddfilter}
704a4b75 51
559fe022 52\func{static void}{AddFilter}{\param{wxHtmlFilter }{*filter}}
704a4b75 53
559fe022
VS
54Adds \helpref{input filter}{filters} to the static list of available
55filters. These filters are present by default:
704a4b75 56
448af9a4 57\begin{itemize}\itemsep=0pt
559fe022
VS
58\item {\tt text/html} MIME type
59\item {\tt image/*} MIME types
60\item Plain Text filter (this filter is used if no other filter matches)
61\end{itemize}
704a4b75 62
39029898
VS
63\membersection{wxHtmlWindow::AppendToPage}\label{wxhtmlwindowappendtopage}
64
65\func{bool}{AppendToPage}{\param{const wxString\& }{source}}
66
67Appends HTML fragment to currently displayed text and refreshes the window.
68
69\wxheading{Parameters}
70
71\docparam{source}{HTML code fragment}
72
73\wxheading{Return value}
74
75FALSE if an error occurred, TRUE otherwise.
76
559fe022 77\membersection{wxHtmlWindow::GetInternalRepresentation}\label{wxhtmlwindowgetinternalrepresentation}
704a4b75 78
559fe022 79\constfunc{wxHtmlContainerCell*}{GetInternalRepresentation}{\void}
704a4b75 80
559fe022 81Returns pointer to the top-level container.
704a4b75 82
559fe022
VS
83See also: \helpref{Cells Overview}{cells},
84\helpref{Printing Overview}{printing}
704a4b75 85
5656c6ef
VS
86\membersection{wxHtmlWindow::GetOpenedAnchor}\label{wxhtmlwindowgetopenedanchor}
87
88\func{wxString}{GetOpenedAnchor}{\void}
89
90Returns anchor within currently opened page
91(see \helpref{GetOpenedPage}{wxhtmlwindowgetopenedpage}).
92If no page is opened or if the displayed page wasn't
93produced by call to LoadPage, empty string is returned.
94
95
559fe022
VS
96\membersection{wxHtmlWindow::GetOpenedPage}\label{wxhtmlwindowgetopenedpage}
97
98\func{wxString}{GetOpenedPage}{\void}
99
100Returns full location of the opened page. If no page is opened or if the displayed page wasn't
101produced by call to LoadPage, empty string is returned.
102
d5db80c2
VS
103\membersection{wxHtmlWindow::GetOpenedPageTitle}\label{wxhtmlwindowgetopenedpagetitle}
104
105\func{wxString}{GetOpenedPageTitle}{\void}
106
107Returns title of the opened page or wxEmptyString if current page does not contain {\tt <TITLE>} tag.
108
559fe022
VS
109\membersection{wxHtmlWindow::GetRelatedFrame}\label{wxhtmlwindowgetrelatedframe}
110
111\constfunc{wxFrame*}{GetRelatedFrame}{\void}
112
113Returns the related frame.
114
115\membersection{wxHtmlWindow::HistoryBack}\label{wxhtmlwindowhistoryback}
116
117\func{bool}{HistoryBack}{\void}
118
119Moves back to the previous page. (each page displayed using
120\helpref{LoadPage}{wxhtmlwindowloadpage} is stored in history list.)
121
1b113a81
VS
122\membersection{wxHtmlWindow::HistoryCanBack}\label{wxhtmlwindowhistorycanback}
123
124\func{bool}{HistoryCanBack}{\void}
125
126Returns true if it is possible to go back in the history (i.e. HistoryBack()
127won't fail).
128
129\membersection{wxHtmlWindow::HistoryCanForward}\label{wxhtmlwindowhistorycanforward}
130
131\func{bool}{HistoryCanForward}{\void}
132
133Returns true if it is possible to go forward in the history (i.e. HistoryBack()
134won't fail).
135
136
559fe022
VS
137\membersection{wxHtmlWindow::HistoryClear}\label{wxhtmlwindowhistoryclear}
138
139\func{void}{HistoryClear}{\void}
140
141Clears history.
142
143\membersection{wxHtmlWindow::HistoryForward}\label{wxhtmlwindowhistoryforward}
144
145\func{bool}{HistoryForward}{\void}
146
147Moves to next page in history.
704a4b75
VS
148
149\membersection{wxHtmlWindow::LoadPage}\label{wxhtmlwindowloadpage}
150
298d8653 151\func{virtual bool}{LoadPage}{\param{const wxString\& }{location}}
704a4b75 152
448af9a4 153Unlike SetPage this function first loads HTML page from {\it location}
704a4b75
VS
154and then displays it. See example:
155
156\begin{verbatim}
157htmlwin -> SetPage("help/myproject/index.htm");
158\end{verbatim}
159
160\wxheading{Parameters}
161
162\docparam{location}{The address of document. See \helpref{wxFileSystem}{wxfilesystem} for details on address format and behaviour of "opener".}
163
164\wxheading{Return value}
165
f6bcfd97 166FALSE if an error occurred, TRUE otherwise
704a4b75 167
f6010d8f
VZ
168\membersection{wxHtmlWindow::OnCellClicked}\label{wxhtmlwindowoncellclicked}
169
170\func{virtual void}{OnCellClicked}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}, \param{const wxMouseEvent\& }{event}}
171
172This method is called when a mouse button is clicked inside wxHtmlWindow.
173The default behaviour is to call
174\helpref{OnLinkClicked}{wxhtmlwindowonlinkclicked} if the cell contains a
175hypertext link.
176
177\wxheading{Parameters}
178
179\docparam{cell}{The cell inside which the mouse was clicked, always a simple
180(i.e. non container) cell}
181
182\docparam{x, y}{The logical coordinates of the click point}
183
184\docparam{event}{The mouse event containing other information about the click}
185
186\membersection{wxHtmlWindow::OnCellMouseHover}\label{wxhtmlwindowoncellmousehover}
187
188\func{virtual void}{OnCellMouseHover}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}}
189
190This method is called when a mouse moves over an HTML cell.
191
192\wxheading{Parameters}
193
194\docparam{cell}{The cell inside which the mouse is currently, always a simple
195(i.e. non container) cell}
196
197\docparam{x, y}{The logical coordinates of the click point}
198
559fe022 199\membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked}
704a4b75 200
d17f05af 201\func{virtual void}{OnLinkClicked}{\param{const wxHtmlLinkInfo\& }{link}}
704a4b75 202
559fe022
VS
203Called when user clicks on hypertext link. Default behaviour is to call
204\helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.
704a4b75 205
846914d1
VS
206Also see \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
207
e03ca426
VS
208\membersection{wxHtmlWindow::OnOpeningURL}\label{wxhtmlwindowonopeningurl}
209
6cc4e6b8 210\func{virtual wxHtmlOpeningStatus}{OnOpeningURL}{\param{wxHtmlURLType }{type},\param{const wxString\& }{url}, \param{wxString *}{redirect}}
e03ca426
VS
211
212Called when an URL is being opened (either when the user clicks on a link or
6cc4e6b8
VS
213an image is loaded). The URL will be opened only if OnOpeningURL returns
214{\tt wxHTML\_OPEN}. This method is called by
215\helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl}.
216You can override OnOpeningURL to selectively block some
217URLs (e.g. for security reasons) or to redirect them elsewhere. Default
218behaviour is to always return {\tt wxHTML\_OPEN}.
e03ca426 219
6cc4e6b8
VS
220\wxheading{Parameters}
221
222\docparam{type}{Indicates type of the resource. Is one of
223\begin{twocollist}\itemsep=0pt
224\twocolitem{{\bf wxHTML\_URL\_PAGE}}{Opening a HTML page.}
225\twocolitem{{\bf wxHTML\_URL\_IMAGE}}{Opening an image.}
226\twocolitem{{\bf wxHTML\_URL\_OTHER}}{Opening a resource that doesn't fall into
227any other category.}
228\end{twocollist}}
229
230\docparam{url}{URL being opened.}
231
232\docparam{redirect}{Pointer to wxString variable that must be filled with an
233URL if OnOpeningURL returns {\tt wxHTML\_REDIRECT}.}
234
235\wxheading{Return value}
236\begin{twocollist}\itemsep=0pt
237\twocolitem{{\bf wxHTML\_OPEN}}{Open the URL.}
238\twocolitem{{\bf wxHTML\_BLOCK}}{Deny access to the URL, \helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl} will return NULL.}
239\twocolitem{{\bf wxHTML\_REDIRECT}}{Don't open {\it url}, redirect to another
240URL. OnOpeningURL must fill {\it *redirect} with the new URL. OnOpeningURL will
241be called again on returned URL.}
242\end{twocollist}
d5db80c2
VS
243
244\membersection{wxHtmlWindow::OnSetTitle}\label{wxhtmlwindowonsettitle}
245
246\func{virtual void}{OnSetTitle}{\param{const wxString\& }{title}}
247
248Called on parsing {\tt <TITLE>} tag.
249
250
559fe022 251\membersection{wxHtmlWindow::ReadCustomization}\label{wxhtmlwindowreadcustomization}
704a4b75 252
559fe022 253\func{virtual void}{ReadCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
704a4b75 254
559fe022
VS
255This reads custom settings from wxConfig. It uses the path 'path'
256if given, otherwise it saves info into currently selected path.
257The values are stored in sub-path {\tt wxHtmlWindow}
704a4b75 258
448af9a4 259Read values: all things set by SetFonts, SetBorders.
704a4b75 260
559fe022 261\wxheading{Parameters}
704a4b75 262
448af9a4 263\docparam{cfg}{wxConfig from which you want to read the configuration.}
704a4b75 264
559fe022 265\docparam{path}{Optional path in config tree. If not given current path is used.}
704a4b75 266
559fe022 267\membersection{wxHtmlWindow::SetBorders}\label{wxhtmlwindowsetborders}
704a4b75 268
559fe022
VS
269\func{void}{SetBorders}{\param{int }{b}}
270
271This function sets the space between border of window and HTML contents. See image:
272
605d715d 273\helponly{\image{}{border.bmp}}
704a4b75
VS
274
275\wxheading{Parameters}
276
559fe022 277\docparam{b}{indentation from borders in pixels}
704a4b75
VS
278
279\membersection{wxHtmlWindow::SetFonts}\label{wxhtmlwindowsetfonts}
280
8eb2940f 281\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes}}
704a4b75
VS
282
283This function sets font sizes and faces.
284
285\wxheading{Parameters}
286
448af9a4 287\docparam{normal\_face}{This is face name for normal (i.e. non-fixed) font.
704a4b75
VS
288It can be either empty string (then the default face is choosen) or
289platform-specific face name. Examples are "helvetica" under Unix or
290"Times New Roman" under Windows.}
291
448af9a4 292\docparam{fixed\_face}{The same thing for fixed face ( <TT>..</TT> )}
704a4b75 293
704a4b75
VS
294\docparam{sizes}{This is an array of 7 items of {\it int} type.
295The values represent size of font with HTML size from -2 to +4
296( <FONT SIZE=-2> to <FONT SIZE=+4> )}
297
298\wxheading{Defaults}
299
300Under wxGTK:
301
302\begin{verbatim}
8eb2940f 303 SetFonts("", "", {10, 12, 14, 16, 19, 24, 32});
704a4b75
VS
304\end{verbatim}
305
306Under Windows:
307
308\begin{verbatim}
8eb2940f 309 SetFonts("", "", {7, 8, 10, 12, 16, 22, 30});
704a4b75
VS
310\end{verbatim}
311
312Athough it seems different the fact is that the fonts are of approximately
313same size under both platforms (due to wxMSW / wxGTK inconsistency)
314
559fe022 315\membersection{wxHtmlWindow::SetPage}\label{wxhtmlwindowsetpage}
704a4b75 316
559fe022 317\func{bool}{SetPage}{\param{const wxString\& }{source}}
704a4b75 318
559fe022
VS
319Sets HTML page and display it. This won't {\bf load} the page!!
320It will display the {\it source}. See example:
704a4b75 321
559fe022
VS
322\begin{verbatim}
323htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
324\end{verbatim}
325
448af9a4 326If you want to load a document from some location use
559fe022 327\helpref{LoadPage}{wxhtmlwindowloadpage} instead.
704a4b75
VS
328
329\wxheading{Parameters}
330
559fe022 331\docparam{source}{The HTML document source to be displayed.}
704a4b75 332
559fe022 333\wxheading{Return value}
704a4b75 334
f6bcfd97 335FALSE if an error occurred, TRUE otherwise.
704a4b75 336
559fe022 337\membersection{wxHtmlWindow::SetRelatedFrame}\label{wxhtmlwindowsetrelatedframe}
704a4b75 338
559fe022 339\func{void}{SetRelatedFrame}{\param{wxFrame* }{frame}, \param{const wxString\& }{format}}
704a4b75 340
448af9a4 341Sets the frame in which page title will be displayed. {\it format} is format of
559fe022
VS
342frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
343\%s is substituted with HTML page title.
704a4b75 344
559fe022 345\membersection{wxHtmlWindow::SetRelatedStatusBar}\label{wxhtmlwindowsetrelatedstatusbar}
704a4b75 346
559fe022
VS
347\func{void}{SetRelatedStatusBar}{\param{int }{bar}}
348
349{\bf After} calling \helpref{SetRelatedFrame}{wxhtmlwindowsetrelatedframe},
350this sets statusbar slot where messages will be displayed.
351(Default is -1 = no messages.)
352
353\wxheading{Parameters}
354
355\docparam{bar}{statusbar slot number (0..n)}
704a4b75 356
d5db80c2 357
704a4b75
VS
358\membersection{wxHtmlWindow::WriteCustomization}\label{wxhtmlwindowwritecustomization}
359
360\func{virtual void}{WriteCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
361
362Saves custom settings into wxConfig. It uses the path 'path'
363if given, otherwise it saves info into currently selected path.
448af9a4
JS
364Regardless of whether the path is given or not, the function creates sub-path
365{\tt wxHtmlWindow}.
704a4b75 366
448af9a4 367Saved values: all things set by SetFonts, SetBorders.
704a4b75
VS
368
369\wxheading{Parameters}
370
448af9a4 371\docparam{cfg}{wxConfig to which you want to save the configuration.}
704a4b75 372
448af9a4 373\docparam{path}{Optional path in config tree. If not given, the current path is used.}
704a4b75 374