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
49 \wxheading{Event handling
}
51 To process input from a wxHtmlWindow, use these event handler macros to direct input to member
52 functions that take a
\helpref{wxHtmlCellEvent
}{wxhtmlcellevent
} argument or a
\helpref{wxHtmlLinkEvent
}{wxhtmllinkevent
}.
55 \begin{twocollist
}\itemsep=
0pt
56 \twocolitem{{\bf EVT
\_HTML\_CELL\_CLICKED(id, func)
}}{A
\helpref{wxHtmlCell
}{wxhtmlcell
} was clicked.
}
57 \twocolitem{{\bf EVT
\_HTML\_CELL\_HOVER(id, func)
}}{The mouse passed over a
\helpref{wxHtmlCell
}{wxhtmlcell
}.
}
58 \twocolitem{{\bf EVT
\_HTML\_LINK\_CLICKED(id, func)
}}{A
\helpref{wxHtmlCell
}{wxhtmlcell
} which contains an hyperlink was clicked.
}
64 \helpref{wxHtmlLinkEvent
}{wxhtmllinkevent
},
\helpref{wxHtmlCellEvent
}{wxhtmlcellevent
}
68 \membersection{wxHtmlWindow::wxHtmlWindow
}\label{wxhtmlwindowwxhtmlwindow
}
70 \func{}{wxHtmlWindow
}{\void}
74 \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"
}}
76 Constructor. The parameters are the same as for the
\helpref{wxScrolledWindow
}{wxscrolledwindow
} constructor.
78 \wxheading{Parameters
}
80 \docparam{style
}{Window style. See
\helpref{wxHtmlWindow
}{wxhtmlwindow
}.
}
82 \membersection{wxHtmlWindow::AddFilter
}\label{wxhtmlwindowaddfilter
}
84 \func{static void
}{AddFilter
}{\param{wxHtmlFilter
}{*filter
}}
86 Adds
\helpref{input filter
}{filters
} to the static list of available
87 filters. These filters are present by default:
89 \begin{itemize
}\itemsep=
0pt
90 \item {\tt text/html
} MIME type
91 \item {\tt image/*
} MIME types
92 \item Plain Text filter (this filter is used if no other filter matches)
95 \membersection{wxHtmlWindow::AppendToPage
}\label{wxhtmlwindowappendtopage
}
97 \func{bool
}{AppendToPage
}{\param{const wxString\&
}{source
}}
99 Appends HTML fragment to currently displayed text and refreshes the window.
101 \wxheading{Parameters
}
103 \docparam{source
}{HTML code fragment
}
105 \wxheading{Return value
}
107 false if an error occurred, true otherwise.
109 \membersection{wxHtmlWindow::GetInternalRepresentation
}\label{wxhtmlwindowgetinternalrepresentation
}
111 \constfunc{wxHtmlContainerCell*
}{GetInternalRepresentation
}{\void}
113 Returns pointer to the top-level container.
115 See also:
\helpref{Cells Overview
}{cells
},
116 \helpref{Printing Overview
}{printing
}
118 \membersection{wxHtmlWindow::GetOpenedAnchor
}\label{wxhtmlwindowgetopenedanchor
}
120 \func{wxString
}{GetOpenedAnchor
}{\void}
122 Returns anchor within currently opened page
123 (see
\helpref{GetOpenedPage
}{wxhtmlwindowgetopenedpage
}).
124 If no page is opened or if the displayed page wasn't
125 produced by call to LoadPage, empty string is returned.
128 \membersection{wxHtmlWindow::GetOpenedPage
}\label{wxhtmlwindowgetopenedpage
}
130 \func{wxString
}{GetOpenedPage
}{\void}
132 Returns full location of the opened page. If no page is opened or if the displayed page wasn't
133 produced by call to LoadPage, empty string is returned.
135 \membersection{wxHtmlWindow::GetOpenedPageTitle
}\label{wxhtmlwindowgetopenedpagetitle
}
137 \func{wxString
}{GetOpenedPageTitle
}{\void}
139 Returns title of the opened page or wxEmptyString if current page does not contain
{\tt <TITLE>
} tag.
141 \membersection{wxHtmlWindow::GetRelatedFrame
}\label{wxhtmlwindowgetrelatedframe
}
143 \constfunc{wxFrame*
}{GetRelatedFrame
}{\void}
145 Returns the related frame.
147 \membersection{wxHtmlWindow::HistoryBack
}\label{wxhtmlwindowhistoryback
}
149 \func{bool
}{HistoryBack
}{\void}
151 Moves back to the previous page. (each page displayed using
152 \helpref{LoadPage
}{wxhtmlwindowloadpage
} is stored in history list.)
154 \membersection{wxHtmlWindow::HistoryCanBack
}\label{wxhtmlwindowhistorycanback
}
156 \func{bool
}{HistoryCanBack
}{\void}
158 Returns true if it is possible to go back in the history (i.e. HistoryBack()
161 \membersection{wxHtmlWindow::HistoryCanForward
}\label{wxhtmlwindowhistorycanforward
}
163 \func{bool
}{HistoryCanForward
}{\void}
165 Returns true if it is possible to go forward in the history (i.e. HistoryBack()
169 \membersection{wxHtmlWindow::HistoryClear
}\label{wxhtmlwindowhistoryclear
}
171 \func{void
}{HistoryClear
}{\void}
175 \membersection{wxHtmlWindow::HistoryForward
}\label{wxhtmlwindowhistoryforward
}
177 \func{bool
}{HistoryForward
}{\void}
179 Moves to next page in history.
181 \membersection{wxHtmlWindow::LoadFile
}\label{wxhtmlwindowloadfile
}
183 \func{virtual bool
}{LoadFile
}{\param{const wxFileName\&
}{filename
}}
185 Loads HTML page from file and displays it.
187 \wxheading{Return value
}
189 false if an error occurred, true otherwise
193 \helpref{LoadPage
}{wxhtmlwindowloadpage
}
195 \membersection{wxHtmlWindow::LoadPage
}\label{wxhtmlwindowloadpage
}
197 \func{virtual bool
}{LoadPage
}{\param{const wxString\&
}{location
}}
199 Unlike SetPage this function first loads HTML page from
{\it location
}
200 and then displays it. See example:
203 htmlwin->LoadPage("help/myproject/index.htm");
206 \wxheading{Parameters
}
208 \docparam{location
}{The address of
document. See
\helpref{wxFileSystem
}{wxfilesystem
} for details on address format and behaviour of "opener".
}
210 \wxheading{Return value
}
212 false if an error occurred, true otherwise
216 \helpref{LoadFile
}{wxhtmlwindowloadfile
}
218 \membersection{wxHtmlWindow::OnCellClicked
}\label{wxhtmlwindowoncellclicked
}
220 \func{virtual bool
}{OnCellClicked
}{\param{wxHtmlCell
}{*cell
},
\param{wxCoord
}{x
},
\param{wxCoord
}{y
},
\param{const wxMouseEvent\&
}{event
}}
222 This method is called when a mouse button is clicked inside wxHtmlWindow.
224 The default behaviour is to emit a
\helpref{wxHtmlCellEvent
}{wxhtmlcellevent
}
225 and, if the event was not processed or skipped, call
226 \helpref{OnLinkClicked
}{wxhtmlwindowonlinkclicked
} if the cell contains an
229 Overloading this method is deprecated; intercept the event instead.
232 \wxheading{Parameters
}
234 \docparam{cell
}{The cell inside which the mouse was clicked, always a simple
235 (i.e. non-container) cell
}
237 \docparam{x, y
}{The logical coordinates of the click point
}
239 \docparam{event
}{The mouse event containing other information about the click
}
241 \wxheading{Return value
}
243 \true if a link was clicked,
\false otherwise.
245 \membersection{wxHtmlWindow::OnCellMouseHover
}\label{wxhtmlwindowoncellmousehover
}
247 \func{virtual void
}{OnCellMouseHover
}{\param{wxHtmlCell
}{*cell
},
\param{wxCoord
}{x
},
\param{wxCoord
}{y
}}
249 This method is called when a mouse moves over an HTML cell.
250 Default behaviour is to emit a
\helpref{wxHtmlCellEvent
}{wxhtmlcellevent
}.
251 Overloading this method is deprecated; intercept the event instead.
253 \wxheading{Parameters
}
255 \docparam{cell
}{The cell inside which the mouse is currently, always a simple
256 (i.e. non-container) cell
}
258 \docparam{x, y
}{The logical coordinates of the click point
}
260 \membersection{wxHtmlWindow::OnLinkClicked
}\label{wxhtmlwindowonlinkclicked
}
262 \func{virtual void
}{OnLinkClicked
}{\param{const wxHtmlLinkInfo\&
}{link
}}
264 Called when user clicks on hypertext link. Default behaviour is to emit a
265 \helpref{wxHtmlLinkEvent
}{wxhtmllinkevent
} and, if the event was not processed
266 or skipped, call
\helpref{LoadPage
}{wxhtmlwindowloadpage
} and do nothing else.
267 Overloading this method is deprecated; intercept the event instead.
269 Also see
\helpref{wxHtmlLinkInfo
}{wxhtmllinkinfo
}.
271 \membersection{wxHtmlWindow::OnOpeningURL
}\label{wxhtmlwindowonopeningurl
}
273 \func{virtual wxHtmlOpeningStatus
}{OnOpeningURL
}{\param{wxHtmlURLType
}{type
},
\param{const wxString\&
}{url
},
\param{wxString *
}{redirect
}}
275 Called when an URL is being opened (either when the user clicks on a link or
276 an image is loaded). The URL will be opened only if OnOpeningURL returns
277 {\tt wxHTML
\_OPEN}. This method is called by
278 \helpref{wxHtmlParser::OpenURL
}{wxhtmlparseropenurl
}.
279 You can override OnOpeningURL to selectively block some
280 URLs (e.g. for security reasons) or to redirect them elsewhere. Default
281 behaviour is to always return
{\tt wxHTML
\_OPEN}.
283 \wxheading{Parameters
}
285 \docparam{type
}{Indicates type of the resource. Is one of
286 \begin{twocollist
}\itemsep=
0pt
287 \twocolitem{{\bf wxHTML
\_URL\_PAGE}}{Opening a HTML page.
}
288 \twocolitem{{\bf wxHTML
\_URL\_IMAGE}}{Opening an image.
}
289 \twocolitem{{\bf wxHTML
\_URL\_OTHER}}{Opening a resource that doesn't fall into
293 \docparam{url
}{URL being opened.
}
295 \docparam{redirect
}{Pointer to wxString variable that must be filled with an
296 URL if OnOpeningURL returns
{\tt wxHTML
\_REDIRECT}.
}
298 \wxheading{Return value
}
299 \begin{twocollist
}\itemsep=
0pt
300 \twocolitem{{\bf wxHTML
\_OPEN}}{Open the URL.
}
301 \twocolitem{{\bf wxHTML
\_BLOCK}}{Deny access to the URL,
\helpref{wxHtmlParser::OpenURL
}{wxhtmlparseropenurl
} will return NULL.
}
302 \twocolitem{{\bf wxHTML
\_REDIRECT}}{Don't open
{\it url
}, redirect to another
303 URL. OnOpeningURL must fill
{\it *redirect
} with the new URL. OnOpeningURL will
304 be called again on returned URL.
}
307 \membersection{wxHtmlWindow::OnSetTitle
}\label{wxhtmlwindowonsettitle
}
309 \func{virtual void
}{OnSetTitle
}{\param{const wxString\&
}{title
}}
311 Called on parsing
{\tt <TITLE>
} tag.
314 \membersection{wxHtmlWindow::ReadCustomization
}\label{wxhtmlwindowreadcustomization
}
316 \func{virtual void
}{ReadCustomization
}{\param{wxConfigBase
}{*cfg
},
\param{wxString
}{path = wxEmptyString
}}
318 This reads custom settings from wxConfig. It uses the path 'path'
319 if given, otherwise it saves info into currently selected path.
320 The values are stored in sub-path
{\tt wxHtmlWindow
}
322 Read values: all things set by SetFonts, SetBorders.
324 \wxheading{Parameters
}
326 \docparam{cfg
}{wxConfig from which you want to read the configuration.
}
328 \docparam{path
}{Optional path in config tree. If not given current path is used.
}
330 \membersection{wxHtmlWindow::SelectAll
}\label{wxhtmlwindowselectall
}
332 \func{void
}{SelectAll
}{\void}
334 Selects all text in the window.
338 \helpref{SelectLine
}{wxhtmlwindowselectline
},
339 \helpref{SelectWord
}{wxhtmlwindowselectword
}
341 \membersection{wxHtmlWindow::SelectionToText
}\label{wxhtmlwindowselectiontotext
}
343 \func{wxString
}{SelectionToText
}{\void}
345 Returns current selection as plain text. Returns empty string if no text
346 is currently selected.
348 \membersection{wxHtmlWindow::SelectLine
}\label{wxhtmlwindowselectline
}
350 \func{void
}{SelectLine
}{\param{const wxPoint\&
}{pos
}}
352 Selects the line of text that
\arg{pos
} points at. Note that
\arg{pos
}
353 is relative to the top of displayed page, not to window's origin, use
354 \helpref{CalcUnscrolledPosition
}{wxscrolledwindowcalcunscrolledposition
}
355 to convert physical coordinate.
359 \helpref{SelectAll
}{wxhtmlwindowselectall
},
360 \helpref{SelectWord
}{wxhtmlwindowselectword
}
362 \membersection{wxHtmlWindow::SelectWord
}\label{wxhtmlwindowselectword
}
364 \func{void
}{SelectWord
}{\param{const wxPoint\&
}{pos
}}
366 Selects the word at position
\arg{pos
}. Note that
\arg{pos
}
367 is relative to the top of displayed page, not to window's origin, use
368 \helpref{CalcUnscrolledPosition
}{wxscrolledwindowcalcunscrolledposition
}
369 to convert physical coordinate.
373 \helpref{SelectAll
}{wxhtmlwindowselectall
},
374 \helpref{SelectLine
}{wxhtmlwindowselectline
}
376 \membersection{wxHtmlWindow::SetBorders
}\label{wxhtmlwindowsetborders
}
378 \func{void
}{SetBorders
}{\param{int
}{b
}}
380 This function sets the space between border of window and HTML contents. See image:
382 \helponly{\image{}{border.bmp
}}
384 \wxheading{Parameters
}
386 \docparam{b
}{indentation from borders in pixels
}
388 \membersection{wxHtmlWindow::SetFonts
}\label{wxhtmlwindowsetfonts
}
390 \func{void
}{SetFonts
}{\param{const wxString\&
}{normal
\_face},
\param{const wxString\&
}{fixed
\_face},
\param{const int
}{*sizes = NULL
}}
392 This function sets font sizes and faces.
394 \wxheading{Parameters
}
396 \docparam{normal
\_face}{This is face name for normal (i.e. non-fixed) font.
397 It can be either empty string (then the default face is chosen) or
398 platform-specific face name. Examples are "helvetica" under Unix or
399 "Times New Roman" under Windows.
}
401 \docparam{fixed
\_face}{The same thing for fixed face ( <TT>..</TT> )
}
403 \docparam{sizes
}{This is an array of
7 items of
{\it int
} type.
404 The values represent size of font with HTML size from -
2 to +
4
405 ( <FONT SIZE=-
2> to <FONT SIZE=+
4> ). Default sizes are used if
{\it sizes
}
410 Default font sizes are defined by constants wxHTML
\_FONT\_SIZE\_1,
411 wxHTML
\_FONT\_SIZE\_2, ..., wxHTML
\_FONT\_SIZE\_7. Note that they differ among
412 platforms. Default face names are empty strings.
414 \membersection{wxHtmlWindow::SetPage
}\label{wxhtmlwindowsetpage
}
416 \func{bool
}{SetPage
}{\param{const wxString\&
}{source
}}
418 Sets HTML page and display it. This won't
{\bf load
} the page!!
419 It will display the
{\it source
}. See example:
422 htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
425 If you want to load a
document from some location use
426 \helpref{LoadPage
}{wxhtmlwindowloadpage
} instead.
428 \wxheading{Parameters
}
430 \docparam{source
}{The HTML
document source to be displayed.
}
432 \wxheading{Return value
}
434 false if an error occurred, true otherwise.
436 \membersection{wxHtmlWindow::SetRelatedFrame
}\label{wxhtmlwindowsetrelatedframe
}
438 \func{void
}{SetRelatedFrame
}{\param{wxFrame*
}{frame
},
\param{const wxString\&
}{format
}}
440 Sets the frame in which page title will be displayed.
{\it format
} is format of
441 frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
442 \%s is substituted with HTML page title.
444 \membersection{wxHtmlWindow::SetRelatedStatusBar
}\label{wxhtmlwindowsetrelatedstatusbar
}
446 \func{void
}{SetRelatedStatusBar
}{\param{int
}{bar
}}
448 {\bf After
} calling
\helpref{SetRelatedFrame
}{wxhtmlwindowsetrelatedframe
},
449 this sets statusbar slot where messages will be displayed.
450 (Default is -
1 = no messages.)
452 \wxheading{Parameters
}
454 \docparam{bar
}{statusbar slot number (
0..n)
}
456 \membersection{wxHtmlWindow::ToText
}\label{wxhtmlwindowtotext
}
458 \func{wxString
}{ToText
}{\void}
460 Returns content of currently displayed page as plain text.
462 \membersection{wxHtmlWindow::WriteCustomization
}\label{wxhtmlwindowwritecustomization
}
464 \func{virtual void
}{WriteCustomization
}{\param{wxConfigBase
}{*cfg
},
\param{wxString
}{path = wxEmptyString
}}
466 Saves custom settings into wxConfig. It uses the path 'path'
467 if given, otherwise it saves info into currently selected path.
468 Regardless of whether the path is given or not, the function creates sub-path
471 Saved values: all things set by SetFonts, SetBorders.
473 \wxheading{Parameters
}
475 \docparam{cfg
}{wxConfig to which you want to save the configuration.
}
477 \docparam{path
}{Optional path in config tree. If not given, the current path is used.
}
485 \section{\class{wxHtmlLinkEvent
}}\label{wxhtmllinkevent
}
487 This event class is used for the events generated by
\helpref{wxHtmlWindow
}{wxhtmlwindow
}.
489 \wxheading{Derived from
}
491 \helpref{wxCommandEvent
}{wxcommandevent
}\\
492 \helpref{wxEvent
}{wxevent
}\\
493 \helpref{wxObject
}{wxobject
}
495 \wxheading{Include files
}
499 \wxheading{Event handling
}
501 To process input from a wxHtmlLinkEvent, use one of these event handler macros to
502 direct input to member function that take a
\helpref{wxHtmlLinkEvent
}{wxhtmllinkevent
} argument:
506 \twocolitem{{\bf EVT
\_HTML\_LINK\_CLICKED(id, func)
}}{User clicked on an hyperlink.
}
510 \latexignore{\rtfignore{\wxheading{Members
}}}
512 \membersection{wxHtmlLinkEvent::wxHtmlLinkEvent
}\label{wxhtmllinkeventctor
}
514 \func{}{wxHyperlinkEvent
}{\param{int
}{ id
},
\param{const wxHtmlLinkInfo \&
}{ linkinfo
}}
516 The constructor is not normally used by the user code.
519 \membersection{wxHtmlLinkEvent::GetLinkInfo
}\label{wxhtmllinkeventgetlinkinfo
}
521 \constfunc{const wxHtmlLinkInfo &
}{GetLinkInfo
}{\void}
523 Returns the
\helpref{wxHtmlLinkInfo
}{wxhtmllinkinfo
} which contains info about the cell clicked and the hyperlink it contains.
530 \section{\class{wxHtmlCellEvent
}}\label{wxhtmlcellevent
}
532 This event class is used for the events generated by
\helpref{wxHtmlWindow
}{wxhtmlwindow
}.
534 \wxheading{Derived from
}
536 \helpref{wxCommandEvent
}{wxcommandevent
}\\
537 \helpref{wxEvent
}{wxevent
}\\
538 \helpref{wxObject
}{wxobject
}
540 \wxheading{Include files
}
544 \wxheading{Event handling
}
546 To process input from a wxHtmlCellEvent, use one of these event handler macros to
547 direct input to member function that take a
\helpref{wxHtmlCellEvent
}{wxhtmlcellevent
} argument:
551 \twocolitem{{\bf EVT
\_HTML\_CELL\_HOVER(id, func)
}}{User moved the mouse over a
\helpref{wxHtmlCell
}{wxhtmlcell
}.
}
552 \twocolitem{{\bf EVT
\_HTML\_CELL\_CLICKED(id, func)
}}{User clicked on a
\helpref{wxHtmlCell
}{wxhtmlcell
}. When handling this event, remember to use
\helpref{wxHtmlCell::SetLinkClicked(true)
}{wxhtmlcelleventsetlinkclicked
} if the cell contains a link.
}
556 \latexignore{\rtfignore{\wxheading{Members
}}}
558 \membersection{wxHtmlCellEvent::wxHtmlCellEvent
}\label{wxhtmlcelleventctor
}
560 \func{}{wxHtmlCellEvent
}{\param{wxEventType
}{ commandType
},
\param{int
}{ id
},
\param{wxHtmlCell *
}{ cell
},
\param{const wxPoint \&
}{ point
}}
562 The constructor is not normally used by the user code.
565 \membersection{wxHtmlCellEvent::GetCell
}\label{wxhtmlcelleventgetcell
}
567 \constfunc{wxHtmlCell *
}{GetCell
}{\void}
569 Returns the
\helpref{wxHtmlCellEvent
}{wxhtmlcellevent
} associated with the event.
572 \membersection{wxHtmlCellEvent::GetPoint
}\label{wxhtmlcelleventgetpoint
}
574 \constfunc{wxPoint
}{GetPoint
}{\void}
576 Returns the
\helpref{wxPoint
}{wxpoint
} associated with the event.
579 \membersection{wxHtmlCellEvent::SetLinkClicked
}\label{wxhtmlcelleventsetlinkclicked
}
581 \func{bool
}{SetLinkClicked
}{\param{bool
}{ linkclicked
}}
583 Call this function with
{\tt linkclicked
} set to
\true if the cell which has been clicked contained a link or
584 \false otherwise (which is the default). With this function the event handler can return info to the
585 wxHtmlWindow which sent the event.
588 \membersection{wxHtmlCellEvent::GetLinkClicked
}\label{wxhtmlcelleventgetlinkclicked
}
590 \constfunc{bool
}{GetLinkClicked
}{\void}
592 Returns
\true if
\helpref{SetLinkClicked(true)
}{wxhtmlcelleventsetlinkclicked
} has previously been called;