]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/htwindow.tex
added support for reading alpha channel
[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
VS
35
36\membersection{wxHtmlWindow::wxHtmlWindow}\label{wxhtmlwindowwxhtmlwindow}
37
38\func{}{wxHtmlWindow}{\void}
39
40Default constructor.
41
605d715d 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"}}
704a4b75 43
448af9a4 44Constructor. The parameters are the same as for the \helpref{wxScrolledWindow}{wxscrolledwindow} constructor.
704a4b75
VS
45
46\wxheading{Parameters}
47
22d6efa8 48\docparam{style}{wxHW\_SCROLLBAR\_NEVER, or wxHW\_SCROLLBAR\_AUTO.
448af9a4 49Affects the appearance of vertical scrollbar in the window.}
704a4b75 50
559fe022 51\membersection{wxHtmlWindow::AddFilter}\label{wxhtmlwindowaddfilter}
704a4b75 52
559fe022 53\func{static void}{AddFilter}{\param{wxHtmlFilter }{*filter}}
704a4b75 54
559fe022
VS
55Adds \helpref{input filter}{filters} to the static list of available
56filters. These filters are present by default:
704a4b75 57
448af9a4 58\begin{itemize}\itemsep=0pt
559fe022
VS
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}
704a4b75 63
39029898
VS
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
cc81d32f 76false if an error occurred, true otherwise.
39029898 77
559fe022 78\membersection{wxHtmlWindow::GetInternalRepresentation}\label{wxhtmlwindowgetinternalrepresentation}
704a4b75 79
559fe022 80\constfunc{wxHtmlContainerCell*}{GetInternalRepresentation}{\void}
704a4b75 81
559fe022 82Returns pointer to the top-level container.
704a4b75 83
559fe022
VS
84See also: \helpref{Cells Overview}{cells},
85\helpref{Printing Overview}{printing}
704a4b75 86
5656c6ef
VS
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
559fe022
VS
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
d5db80c2
VS
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
559fe022
VS
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
1b113a81
VS
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
559fe022
VS
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.
704a4b75 149
903972f9
VS
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
704a4b75
VS
164\membersection{wxHtmlWindow::LoadPage}\label{wxhtmlwindowloadpage}
165
298d8653 166\func{virtual bool}{LoadPage}{\param{const wxString\& }{location}}
704a4b75 167
448af9a4 168Unlike SetPage this function first loads HTML page from {\it location}
704a4b75
VS
169and then displays it. See example:
170
171\begin{verbatim}
903972f9 172htmlwin->LoadPage("help/myproject/index.htm");
704a4b75
VS
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
cc81d32f 181false if an error occurred, true otherwise
704a4b75 182
903972f9
VS
183\wxheading{See also}
184
185\helpref{LoadFile}{wxhtmlwindowloadfile}
186
f6010d8f
VZ
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
559fe022 218\membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked}
704a4b75 219
d17f05af 220\func{virtual void}{OnLinkClicked}{\param{const wxHtmlLinkInfo\& }{link}}
704a4b75 221
559fe022
VS
222Called when user clicks on hypertext link. Default behaviour is to call
223\helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.
704a4b75 224
846914d1
VS
225Also see \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
226
e03ca426
VS
227\membersection{wxHtmlWindow::OnOpeningURL}\label{wxhtmlwindowonopeningurl}
228
6cc4e6b8 229\func{virtual wxHtmlOpeningStatus}{OnOpeningURL}{\param{wxHtmlURLType }{type},\param{const wxString\& }{url}, \param{wxString *}{redirect}}
e03ca426
VS
230
231Called when an URL is being opened (either when the user clicks on a link or
6cc4e6b8
VS
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}.
e03ca426 238
6cc4e6b8
VS
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}
d5db80c2
VS
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
559fe022 270\membersection{wxHtmlWindow::ReadCustomization}\label{wxhtmlwindowreadcustomization}
704a4b75 271
559fe022 272\func{virtual void}{ReadCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
704a4b75 273
559fe022
VS
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}
704a4b75 277
448af9a4 278Read values: all things set by SetFonts, SetBorders.
704a4b75 279
559fe022 280\wxheading{Parameters}
704a4b75 281
448af9a4 282\docparam{cfg}{wxConfig from which you want to read the configuration.}
704a4b75 283
559fe022 284\docparam{path}{Optional path in config tree. If not given current path is used.}
704a4b75 285
559fe022 286\membersection{wxHtmlWindow::SetBorders}\label{wxhtmlwindowsetborders}
704a4b75 287
559fe022
VS
288\func{void}{SetBorders}{\param{int }{b}}
289
290This function sets the space between border of window and HTML contents. See image:
291
605d715d 292\helponly{\image{}{border.bmp}}
704a4b75
VS
293
294\wxheading{Parameters}
295
559fe022 296\docparam{b}{indentation from borders in pixels}
704a4b75
VS
297
298\membersection{wxHtmlWindow::SetFonts}\label{wxhtmlwindowsetfonts}
299
8eb2940f 300\func{void}{SetFonts}{\param{wxString }{normal\_face}, \param{wxString }{fixed\_face}, \param{const int }{*sizes}}
704a4b75
VS
301
302This function sets font sizes and faces.
303
304\wxheading{Parameters}
305
448af9a4 306\docparam{normal\_face}{This is face name for normal (i.e. non-fixed) font.
2edb0bde 307It can be either empty string (then the default face is chosen) or
704a4b75
VS
308platform-specific face name. Examples are "helvetica" under Unix or
309"Times New Roman" under Windows.}
310
448af9a4 311\docparam{fixed\_face}{The same thing for fixed face ( <TT>..</TT> )}
704a4b75 312
704a4b75
VS
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> )}
316
317\wxheading{Defaults}
318
319Under wxGTK:
320
321\begin{verbatim}
8eb2940f 322 SetFonts("", "", {10, 12, 14, 16, 19, 24, 32});
704a4b75
VS
323\end{verbatim}
324
325Under Windows:
326
327\begin{verbatim}
8eb2940f 328 SetFonts("", "", {7, 8, 10, 12, 16, 22, 30});
704a4b75
VS
329\end{verbatim}
330
2edb0bde 331Although it seems different the fact is that the fonts are of approximately
704a4b75
VS
332same size under both platforms (due to wxMSW / wxGTK inconsistency)
333
559fe022 334\membersection{wxHtmlWindow::SetPage}\label{wxhtmlwindowsetpage}
704a4b75 335
559fe022 336\func{bool}{SetPage}{\param{const wxString\& }{source}}
704a4b75 337
559fe022
VS
338Sets HTML page and display it. This won't {\bf load} the page!!
339It will display the {\it source}. See example:
704a4b75 340
559fe022
VS
341\begin{verbatim}
342htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
343\end{verbatim}
344
448af9a4 345If you want to load a document from some location use
559fe022 346\helpref{LoadPage}{wxhtmlwindowloadpage} instead.
704a4b75
VS
347
348\wxheading{Parameters}
349
559fe022 350\docparam{source}{The HTML document source to be displayed.}
704a4b75 351
559fe022 352\wxheading{Return value}
704a4b75 353
cc81d32f 354false if an error occurred, true otherwise.
704a4b75 355
559fe022 356\membersection{wxHtmlWindow::SetRelatedFrame}\label{wxhtmlwindowsetrelatedframe}
704a4b75 357
559fe022 358\func{void}{SetRelatedFrame}{\param{wxFrame* }{frame}, \param{const wxString\& }{format}}
704a4b75 359
448af9a4 360Sets the frame in which page title will be displayed. {\it format} is format of
559fe022
VS
361frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
362\%s is substituted with HTML page title.
704a4b75 363
559fe022 364\membersection{wxHtmlWindow::SetRelatedStatusBar}\label{wxhtmlwindowsetrelatedstatusbar}
704a4b75 365
559fe022
VS
366\func{void}{SetRelatedStatusBar}{\param{int }{bar}}
367
368{\bf After} calling \helpref{SetRelatedFrame}{wxhtmlwindowsetrelatedframe},
369this sets statusbar slot where messages will be displayed.
370(Default is -1 = no messages.)
371
372\wxheading{Parameters}
373
374\docparam{bar}{statusbar slot number (0..n)}
704a4b75 375
d5db80c2 376
704a4b75
VS
377\membersection{wxHtmlWindow::WriteCustomization}\label{wxhtmlwindowwritecustomization}
378
379\func{virtual void}{WriteCustomization}{\param{wxConfigBase }{*cfg}, \param{wxString }{path = wxEmptyString}}
380
381Saves custom settings into wxConfig. It uses the path 'path'
382if given, otherwise it saves info into currently selected path.
448af9a4
JS
383Regardless of whether the path is given or not, the function creates sub-path
384{\tt wxHtmlWindow}.
704a4b75 385
448af9a4 386Saved values: all things set by SetFonts, SetBorders.
704a4b75
VS
387
388\wxheading{Parameters}
389
448af9a4 390\docparam{cfg}{wxConfig to which you want to save the configuration.}
704a4b75 391
448af9a4 392\docparam{path}{Optional path in config tree. If not given, the current path is used.}
704a4b75 393