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