2 % automatically generated by HelpGen from
3 % htmlwindow.tex at 14/Mar/99 20:13:37
6 \section{\class{wxHtmlWindow
}}\label{wxhtmlwindow
}
8 wxHtmlWindow is probably the only class you will directly use
9 unless you want to do something special (like adding new tag
10 handlers or MIME filters).
12 The purpose of this class is to display HTML pages (either local
13 file or downloaded via HTTP protocol) in a window. The width
14 of the window is constant - given in the constructor - and virtual height
15 is changed dynamically depending on page size.
16 Once 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
}.
23 wxHtmlWindow uses the
\helpref{wxImage
}{wximage
} class for displaying images.
24 Don't forget to initialize all image formats you need before loading any page!
25 (See
\helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
} and
26 \helpref{wxImage::AddHandler
}{wximageaddhandler
}.)
28 \wxheading{Derived from
}
30 \helpref{wxScrolledWindow
}{wxscrolledwindow
}
32 \wxheading{Include files
}
36 \wxheading{Window styles
}
39 \begin{twocollist
}\itemsep=
0pt
40 \twocolitem{\windowstyle{wxHW
\_SCROLLBAR\_NEVER}}{Never display scrollbars, not
41 even when the page is larger than the window.
}
42 \twocolitem{\windowstyle{wxHW
\_SCROLLBAR\_AUTO}}{Display scrollbars only if
43 page's size exceeds window's size.
}
44 \twocolitem{\windowstyle{wxHW
\_NO\_SELECTION}}{Don't allow the user to select
48 \membersection{wxHtmlWindow::wxHtmlWindow
}\label{wxhtmlwindowwxhtmlwindow
}
50 \func{}{wxHtmlWindow
}{\void}
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"
}}
56 Constructor. The parameters are the same as for the
\helpref{wxScrolledWindow
}{wxscrolledwindow
} constructor.
58 \wxheading{Parameters
}
60 \docparam{style
}{Window style. See
\helpref{wxHtmlWindow
}{wxhtmlwindow
}.
}
62 \membersection{wxHtmlWindow::AddFilter
}\label{wxhtmlwindowaddfilter
}
64 \func{static void
}{AddFilter
}{\param{wxHtmlFilter
}{*filter
}}
66 Adds
\helpref{input filter
}{filters
} to the static list of available
67 filters. These filters are present by default:
69 \begin{itemize
}\itemsep=
0pt
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)
75 \membersection{wxHtmlWindow::AppendToPage
}\label{wxhtmlwindowappendtopage
}
77 \func{bool
}{AppendToPage
}{\param{const wxString\&
}{source
}}
79 Appends HTML fragment to currently displayed text and refreshes the window.
81 \wxheading{Parameters
}
83 \docparam{source
}{HTML code fragment
}
85 \wxheading{Return value
}
87 false if an error occurred, true otherwise.
89 \membersection{wxHtmlWindow::GetInternalRepresentation
}\label{wxhtmlwindowgetinternalrepresentation
}
91 \constfunc{wxHtmlContainerCell*
}{GetInternalRepresentation
}{\void}
93 Returns pointer to the top-level container.
95 See also:
\helpref{Cells Overview
}{cells
},
96 \helpref{Printing Overview
}{printing
}
98 \membersection{wxHtmlWindow::GetOpenedAnchor
}\label{wxhtmlwindowgetopenedanchor
}
100 \func{wxString
}{GetOpenedAnchor
}{\void}
102 Returns anchor within currently opened page
103 (see
\helpref{GetOpenedPage
}{wxhtmlwindowgetopenedpage
}).
104 If no page is opened or if the displayed page wasn't
105 produced by call to LoadPage, empty string is returned.
108 \membersection{wxHtmlWindow::GetOpenedPage
}\label{wxhtmlwindowgetopenedpage
}
110 \func{wxString
}{GetOpenedPage
}{\void}
112 Returns full location of the opened page. If no page is opened or if the displayed page wasn't
113 produced by call to LoadPage, empty string is returned.
115 \membersection{wxHtmlWindow::GetOpenedPageTitle
}\label{wxhtmlwindowgetopenedpagetitle
}
117 \func{wxString
}{GetOpenedPageTitle
}{\void}
119 Returns title of the opened page or wxEmptyString if current page does not contain
{\tt <TITLE>
} tag.
121 \membersection{wxHtmlWindow::GetRelatedFrame
}\label{wxhtmlwindowgetrelatedframe
}
123 \constfunc{wxFrame*
}{GetRelatedFrame
}{\void}
125 Returns the related frame.
127 \membersection{wxHtmlWindow::HistoryBack
}\label{wxhtmlwindowhistoryback
}
129 \func{bool
}{HistoryBack
}{\void}
131 Moves back to the previous page. (each page displayed using
132 \helpref{LoadPage
}{wxhtmlwindowloadpage
} is stored in history list.)
134 \membersection{wxHtmlWindow::HistoryCanBack
}\label{wxhtmlwindowhistorycanback
}
136 \func{bool
}{HistoryCanBack
}{\void}
138 Returns true if it is possible to go back in the history (i.e. HistoryBack()
141 \membersection{wxHtmlWindow::HistoryCanForward
}\label{wxhtmlwindowhistorycanforward
}
143 \func{bool
}{HistoryCanForward
}{\void}
145 Returns true if it is possible to go forward in the history (i.e. HistoryBack()
149 \membersection{wxHtmlWindow::HistoryClear
}\label{wxhtmlwindowhistoryclear
}
151 \func{void
}{HistoryClear
}{\void}
155 \membersection{wxHtmlWindow::HistoryForward
}\label{wxhtmlwindowhistoryforward
}
157 \func{bool
}{HistoryForward
}{\void}
159 Moves to next page in history.
161 \membersection{wxHtmlWindow::LoadFile
}\label{wxhtmlwindowloadfile
}
163 \func{virtual bool
}{LoadFile
}{\param{const wxFileName\&
}{filename
}}
165 Loads HTML page from file and displays it.
167 \wxheading{Return value
}
169 false if an error occurred, true otherwise
173 \helpref{LoadPage
}{wxhtmlwindowloadpage
}
175 \membersection{wxHtmlWindow::LoadPage
}\label{wxhtmlwindowloadpage
}
177 \func{virtual bool
}{LoadPage
}{\param{const wxString\&
}{location
}}
179 Unlike SetPage this function first loads HTML page from
{\it location
}
180 and then displays it. See example:
183 htmlwin->LoadPage("help/myproject/index.htm");
186 \wxheading{Parameters
}
188 \docparam{location
}{The address of
document. See
\helpref{wxFileSystem
}{wxfilesystem
} for details on address format and behaviour of "opener".
}
190 \wxheading{Return value
}
192 false if an error occurred, true otherwise
196 \helpref{LoadFile
}{wxhtmlwindowloadfile
}
198 \membersection{wxHtmlWindow::OnCellClicked
}\label{wxhtmlwindowoncellclicked
}
200 \func{virtual bool
}{OnCellClicked
}{\param{wxHtmlCell
}{*cell
},
\param{wxCoord
}{x
},
\param{wxCoord
}{y
},
\param{const wxMouseEvent\&
}{event
}}
202 This method is called when a mouse button is clicked inside wxHtmlWindow.
203 The default behaviour is to call
204 \helpref{OnLinkClicked
}{wxhtmlwindowonlinkclicked
} if the cell contains a
207 \wxheading{Parameters
}
209 \docparam{cell
}{The cell inside which the mouse was clicked, always a simple
210 (i.e. non container) cell
}
212 \docparam{x, y
}{The logical coordinates of the click point
}
214 \docparam{event
}{The mouse event containing other information about the click
}
216 \wxheading{Return value
}
218 \true if a link was clicked,
\false otherwise.
220 \membersection{wxHtmlWindow::OnCellMouseHover
}\label{wxhtmlwindowoncellmousehover
}
222 \func{virtual void
}{OnCellMouseHover
}{\param{wxHtmlCell
}{*cell
},
\param{wxCoord
}{x
},
\param{wxCoord
}{y
}}
224 This method is called when a mouse moves over an HTML cell.
226 \wxheading{Parameters
}
228 \docparam{cell
}{The cell inside which the mouse is currently, always a simple
229 (i.e. non container) cell
}
231 \docparam{x, y
}{The logical coordinates of the click point
}
233 \membersection{wxHtmlWindow::OnLinkClicked
}\label{wxhtmlwindowonlinkclicked
}
235 \func{virtual void
}{OnLinkClicked
}{\param{const wxHtmlLinkInfo\&
}{link
}}
237 Called when user clicks on hypertext link. Default behaviour is to call
238 \helpref{LoadPage
}{wxhtmlwindowloadpage
} and do nothing else.
240 Also see
\helpref{wxHtmlLinkInfo
}{wxhtmllinkinfo
}.
242 \membersection{wxHtmlWindow::OnOpeningURL
}\label{wxhtmlwindowonopeningurl
}
244 \func{virtual wxHtmlOpeningStatus
}{OnOpeningURL
}{\param{wxHtmlURLType
}{type
},
\param{const wxString\&
}{url
},
\param{wxString *
}{redirect
}}
246 Called when an URL is being opened (either when the user clicks on a link or
247 an 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
}.
250 You can override OnOpeningURL to selectively block some
251 URLs (e.g. for security reasons) or to redirect them elsewhere. Default
252 behaviour is to always return
{\tt wxHTML
\_OPEN}.
254 \wxheading{Parameters
}
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
264 \docparam{url
}{URL being opened.
}
266 \docparam{redirect
}{Pointer to wxString variable that must be filled with an
267 URL if OnOpeningURL returns
{\tt wxHTML
\_REDIRECT}.
}
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
274 URL. OnOpeningURL must fill
{\it *redirect
} with the new URL. OnOpeningURL will
275 be called again on returned URL.
}
278 \membersection{wxHtmlWindow::OnSetTitle
}\label{wxhtmlwindowonsettitle
}
280 \func{virtual void
}{OnSetTitle
}{\param{const wxString\&
}{title
}}
282 Called on parsing
{\tt <TITLE>
} tag.
285 \membersection{wxHtmlWindow::ReadCustomization
}\label{wxhtmlwindowreadcustomization
}
287 \func{virtual void
}{ReadCustomization
}{\param{wxConfigBase
}{*cfg
},
\param{wxString
}{path = wxEmptyString
}}
289 This reads custom settings from wxConfig. It uses the path 'path'
290 if given, otherwise it saves info into currently selected path.
291 The values are stored in sub-path
{\tt wxHtmlWindow
}
293 Read values: all things set by SetFonts, SetBorders.
295 \wxheading{Parameters
}
297 \docparam{cfg
}{wxConfig from which you want to read the configuration.
}
299 \docparam{path
}{Optional path in config tree. If not given current path is used.
}
301 \membersection{wxHtmlWindow::SelectAll
}\label{wxhtmlwindowselectall
}
303 \func{void
}{SelectAll
}{\void}
305 Selects all text in the window.
309 \helpref{SelectLine
}{wxhtmlwindowselectline
},
310 \helpref{SelectWord
}{wxhtmlwindowselectword
}
312 \membersection{wxHtmlWindow::SelectionToText
}\label{wxhtmlwindowselectiontotext
}
314 \func{wxString
}{SelectionToText
}{\void}
316 Returns current selection as plain text. Returns empty string if no text
317 is currently selected.
319 \membersection{wxHtmlWindow::SelectLine
}\label{wxhtmlwindowselectline
}
321 \func{void
}{SelectLine
}{\param{const wxPoint\&
}{pos
}}
323 Selects the line of text that
\arg{pos
} points at. Note that
\arg{pos
}
324 is relative to the top of displayed page, not to window's origin, use
325 \helpref{CalcUnscrolledPosition
}{wxscrolledwindowcalcunscrolledposition
}
326 to convert physical coordinate.
330 \helpref{SelectAll
}{wxhtmlwindowselectall
},
331 \helpref{SelectWord
}{wxhtmlwindowselectword
}
333 \membersection{wxHtmlWindow::SelectWord
}\label{wxhtmlwindowselectword
}
335 \func{void
}{SelectWord
}{\param{const wxPoint\&
}{pos
}}
337 Selects the word at position
\arg{pos
}. Note that
\arg{pos
}
338 is relative to the top of displayed page, not to window's origin, use
339 \helpref{CalcUnscrolledPosition
}{wxscrolledwindowcalcunscrolledposition
}
340 to convert physical coordinate.
344 \helpref{SelectAll
}{wxhtmlwindowselectall
},
345 \helpref{SelectLine
}{wxhtmlwindowselectline
}
347 \membersection{wxHtmlWindow::SetBorders
}\label{wxhtmlwindowsetborders
}
349 \func{void
}{SetBorders
}{\param{int
}{b
}}
351 This function sets the space between border of window and HTML contents. See image:
353 \helponly{\image{}{border.bmp
}}
355 \wxheading{Parameters
}
357 \docparam{b
}{indentation from borders in pixels
}
359 \membersection{wxHtmlWindow::SetFonts
}\label{wxhtmlwindowsetfonts
}
361 \func{void
}{SetFonts
}{\param{const wxString\&
}{normal
\_face},
\param{const wxString\&
}{fixed
\_face},
\param{const int
}{*sizes = NULL
}}
363 This function sets font sizes and faces.
365 \wxheading{Parameters
}
367 \docparam{normal
\_face}{This is face name for normal (i.e. non-fixed) font.
368 It can be either empty string (then the default face is chosen) or
369 platform-specific face name. Examples are "helvetica" under Unix or
370 "Times New Roman" under Windows.
}
372 \docparam{fixed
\_face}{The same thing for fixed face ( <TT>..</TT> )
}
374 \docparam{sizes
}{This is an array of
7 items of
{\it int
} type.
375 The values represent size of font with HTML size from -
2 to +
4
376 ( <FONT SIZE=-
2> to <FONT SIZE=+
4> ). Default sizes are used if
{\it sizes
}
381 Default font sizes are defined by constants wxHTML
\_FONT\_SIZE\_1,
382 wxHTML
\_FONT\_SIZE\_2, ..., wxHTML
\_FONT\_SIZE\_7. Note that they differ among
383 platforms. Default face names are empty strings.
385 \membersection{wxHtmlWindow::SetPage
}\label{wxhtmlwindowsetpage
}
387 \func{bool
}{SetPage
}{\param{const wxString\&
}{source
}}
389 Sets HTML page and display it. This won't
{\bf load
} the page!!
390 It will display the
{\it source
}. See example:
393 htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
396 If you want to load a
document from some location use
397 \helpref{LoadPage
}{wxhtmlwindowloadpage
} instead.
399 \wxheading{Parameters
}
401 \docparam{source
}{The HTML
document source to be displayed.
}
403 \wxheading{Return value
}
405 false if an error occurred, true otherwise.
407 \membersection{wxHtmlWindow::SetRelatedFrame
}\label{wxhtmlwindowsetrelatedframe
}
409 \func{void
}{SetRelatedFrame
}{\param{wxFrame*
}{frame
},
\param{const wxString\&
}{format
}}
411 Sets the frame in which page title will be displayed.
{\it format
} is format of
412 frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
413 \%s is substituted with HTML page title.
415 \membersection{wxHtmlWindow::SetRelatedStatusBar
}\label{wxhtmlwindowsetrelatedstatusbar
}
417 \func{void
}{SetRelatedStatusBar
}{\param{int
}{bar
}}
419 {\bf After
} calling
\helpref{SetRelatedFrame
}{wxhtmlwindowsetrelatedframe
},
420 this sets statusbar slot where messages will be displayed.
421 (Default is -
1 = no messages.)
423 \wxheading{Parameters
}
425 \docparam{bar
}{statusbar slot number (
0..n)
}
427 \membersection{wxHtmlWindow::ToText
}\label{wxhtmlwindowtotext
}
429 \func{wxString
}{ToText
}{\void}
431 Returns content of currently displayed page as plain text.
433 \membersection{wxHtmlWindow::WriteCustomization
}\label{wxhtmlwindowwritecustomization
}
435 \func{virtual void
}{WriteCustomization
}{\param{wxConfigBase
}{*cfg
},
\param{wxString
}{path = wxEmptyString
}}
437 Saves custom settings into wxConfig. It uses the path 'path'
438 if given, otherwise it saves info into currently selected path.
439 Regardless of whether the path is given or not, the function creates sub-path
442 Saved values: all things set by SetFonts, SetBorders.
444 \wxheading{Parameters
}
446 \docparam{cfg
}{wxConfig to which you want to save the configuration.
}
448 \docparam{path
}{Optional path in config tree. If not given, the current path is used.
}