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