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 \membersection{wxHtmlWindow::wxHtmlWindow
}\label{wxhtmlwindowwxhtmlwindow
}
38 \func{}{wxHtmlWindow
}{\void}
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"
}}
44 Constructor. The parameters are the same as for the
\helpref{wxScrolledWindow
}{wxscrolledwindow
} constructor.
46 \wxheading{Parameters
}
48 \docparam{style
}{wxHW
\_SCROLLBAR\_NEVER, or wxHW
\_SCROLLBAR\_AUTO.
49 Affects the appearance of vertical scrollbar in the window.
}
51 \membersection{wxHtmlWindow::AddFilter
}\label{wxhtmlwindowaddfilter
}
53 \func{static void
}{AddFilter
}{\param{wxHtmlFilter
}{*filter
}}
55 Adds
\helpref{input filter
}{filters
} to the static list of available
56 filters. These filters are present by default:
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)
64 \membersection{wxHtmlWindow::AppendToPage
}\label{wxhtmlwindowappendtopage
}
66 \func{bool
}{AppendToPage
}{\param{const wxString\&
}{source
}}
68 Appends HTML fragment to currently displayed text and refreshes the window.
70 \wxheading{Parameters
}
72 \docparam{source
}{HTML code fragment
}
74 \wxheading{Return value
}
76 false if an error occurred, true otherwise.
78 \membersection{wxHtmlWindow::GetInternalRepresentation
}\label{wxhtmlwindowgetinternalrepresentation
}
80 \constfunc{wxHtmlContainerCell*
}{GetInternalRepresentation
}{\void}
82 Returns pointer to the top-level container.
84 See also:
\helpref{Cells Overview
}{cells
},
85 \helpref{Printing Overview
}{printing
}
87 \membersection{wxHtmlWindow::GetOpenedAnchor
}\label{wxhtmlwindowgetopenedanchor
}
89 \func{wxString
}{GetOpenedAnchor
}{\void}
91 Returns anchor within currently opened page
92 (see
\helpref{GetOpenedPage
}{wxhtmlwindowgetopenedpage
}).
93 If no page is opened or if the displayed page wasn't
94 produced by call to LoadPage, empty string is returned.
97 \membersection{wxHtmlWindow::GetOpenedPage
}\label{wxhtmlwindowgetopenedpage
}
99 \func{wxString
}{GetOpenedPage
}{\void}
101 Returns full location of the opened page. If no page is opened or if the displayed page wasn't
102 produced by call to LoadPage, empty string is returned.
104 \membersection{wxHtmlWindow::GetOpenedPageTitle
}\label{wxhtmlwindowgetopenedpagetitle
}
106 \func{wxString
}{GetOpenedPageTitle
}{\void}
108 Returns title of the opened page or wxEmptyString if current page does not contain
{\tt <TITLE>
} tag.
110 \membersection{wxHtmlWindow::GetRelatedFrame
}\label{wxhtmlwindowgetrelatedframe
}
112 \constfunc{wxFrame*
}{GetRelatedFrame
}{\void}
114 Returns the related frame.
116 \membersection{wxHtmlWindow::HistoryBack
}\label{wxhtmlwindowhistoryback
}
118 \func{bool
}{HistoryBack
}{\void}
120 Moves back to the previous page. (each page displayed using
121 \helpref{LoadPage
}{wxhtmlwindowloadpage
} is stored in history list.)
123 \membersection{wxHtmlWindow::HistoryCanBack
}\label{wxhtmlwindowhistorycanback
}
125 \func{bool
}{HistoryCanBack
}{\void}
127 Returns true if it is possible to go back in the history (i.e. HistoryBack()
130 \membersection{wxHtmlWindow::HistoryCanForward
}\label{wxhtmlwindowhistorycanforward
}
132 \func{bool
}{HistoryCanForward
}{\void}
134 Returns true if it is possible to go forward in the history (i.e. HistoryBack()
138 \membersection{wxHtmlWindow::HistoryClear
}\label{wxhtmlwindowhistoryclear
}
140 \func{void
}{HistoryClear
}{\void}
144 \membersection{wxHtmlWindow::HistoryForward
}\label{wxhtmlwindowhistoryforward
}
146 \func{bool
}{HistoryForward
}{\void}
148 Moves to next page in history.
150 \membersection{wxHtmlWindow::LoadFile
}\label{wxhtmlwindowloadfile
}
152 \func{virtual bool
}{LoadFile
}{\param{const wxFileName\&
}{filename
}}
154 Loads HTML page from file and displays it.
156 \wxheading{Return value
}
158 false if an error occurred, true otherwise
162 \helpref{LoadPage
}{wxhtmlwindowloadpage
}
164 \membersection{wxHtmlWindow::LoadPage
}\label{wxhtmlwindowloadpage
}
166 \func{virtual bool
}{LoadPage
}{\param{const wxString\&
}{location
}}
168 Unlike SetPage this function first loads HTML page from
{\it location
}
169 and then displays it. See example:
172 htmlwin->LoadPage("help/myproject/index.htm");
175 \wxheading{Parameters
}
177 \docparam{location
}{The address of
document. See
\helpref{wxFileSystem
}{wxfilesystem
} for details on address format and behaviour of "opener".
}
179 \wxheading{Return value
}
181 false if an error occurred, true otherwise
185 \helpref{LoadFile
}{wxhtmlwindowloadfile
}
187 \membersection{wxHtmlWindow::OnCellClicked
}\label{wxhtmlwindowoncellclicked
}
189 \func{virtual void
}{OnCellClicked
}{\param{wxHtmlCell
}{*cell
},
\param{wxCoord
}{x
},
\param{wxCoord
}{y
},
\param{const wxMouseEvent\&
}{event
}}
191 This method is called when a mouse button is clicked inside wxHtmlWindow.
192 The default behaviour is to call
193 \helpref{OnLinkClicked
}{wxhtmlwindowonlinkclicked
} if the cell contains a
196 \wxheading{Parameters
}
198 \docparam{cell
}{The cell inside which the mouse was clicked, always a simple
199 (i.e. non container) cell
}
201 \docparam{x, y
}{The logical coordinates of the click point
}
203 \docparam{event
}{The mouse event containing other information about the click
}
205 \membersection{wxHtmlWindow::OnCellMouseHover
}\label{wxhtmlwindowoncellmousehover
}
207 \func{virtual void
}{OnCellMouseHover
}{\param{wxHtmlCell
}{*cell
},
\param{wxCoord
}{x
},
\param{wxCoord
}{y
}}
209 This method is called when a mouse moves over an HTML cell.
211 \wxheading{Parameters
}
213 \docparam{cell
}{The cell inside which the mouse is currently, always a simple
214 (i.e. non container) cell
}
216 \docparam{x, y
}{The logical coordinates of the click point
}
218 \membersection{wxHtmlWindow::OnLinkClicked
}\label{wxhtmlwindowonlinkclicked
}
220 \func{virtual void
}{OnLinkClicked
}{\param{const wxHtmlLinkInfo\&
}{link
}}
222 Called when user clicks on hypertext link. Default behaviour is to call
223 \helpref{LoadPage
}{wxhtmlwindowloadpage
} and do nothing else.
225 Also see
\helpref{wxHtmlLinkInfo
}{wxhtmllinkinfo
}.
227 \membersection{wxHtmlWindow::OnOpeningURL
}\label{wxhtmlwindowonopeningurl
}
229 \func{virtual wxHtmlOpeningStatus
}{OnOpeningURL
}{\param{wxHtmlURLType
}{type
},
\param{const wxString\&
}{url
},
\param{wxString *
}{redirect
}}
231 Called when an URL is being opened (either when the user clicks on a link or
232 an 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
}.
235 You can override OnOpeningURL to selectively block some
236 URLs (e.g. for security reasons) or to redirect them elsewhere. Default
237 behaviour is to always return
{\tt wxHTML
\_OPEN}.
239 \wxheading{Parameters
}
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
249 \docparam{url
}{URL being opened.
}
251 \docparam{redirect
}{Pointer to wxString variable that must be filled with an
252 URL if OnOpeningURL returns
{\tt wxHTML
\_REDIRECT}.
}
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
259 URL. OnOpeningURL must fill
{\it *redirect
} with the new URL. OnOpeningURL will
260 be called again on returned URL.
}
263 \membersection{wxHtmlWindow::OnSetTitle
}\label{wxhtmlwindowonsettitle
}
265 \func{virtual void
}{OnSetTitle
}{\param{const wxString\&
}{title
}}
267 Called on parsing
{\tt <TITLE>
} tag.
270 \membersection{wxHtmlWindow::ReadCustomization
}\label{wxhtmlwindowreadcustomization
}
272 \func{virtual void
}{ReadCustomization
}{\param{wxConfigBase
}{*cfg
},
\param{wxString
}{path = wxEmptyString
}}
274 This reads custom settings from wxConfig. It uses the path 'path'
275 if given, otherwise it saves info into currently selected path.
276 The values are stored in sub-path
{\tt wxHtmlWindow
}
278 Read values: all things set by SetFonts, SetBorders.
280 \wxheading{Parameters
}
282 \docparam{cfg
}{wxConfig from which you want to read the configuration.
}
284 \docparam{path
}{Optional path in config tree. If not given current path is used.
}
286 \membersection{wxHtmlWindow::SetBorders
}\label{wxhtmlwindowsetborders
}
288 \func{void
}{SetBorders
}{\param{int
}{b
}}
290 This function sets the space between border of window and HTML contents. See image:
292 \helponly{\image{}{border.bmp
}}
294 \wxheading{Parameters
}
296 \docparam{b
}{indentation from borders in pixels
}
298 \membersection{wxHtmlWindow::SetFonts
}\label{wxhtmlwindowsetfonts
}
300 \func{void
}{SetFonts
}{\param{wxString
}{normal
\_face},
\param{wxString
}{fixed
\_face},
\param{const int
}{*sizes = NULL
}}
302 This function sets font sizes and faces.
304 \wxheading{Parameters
}
306 \docparam{normal
\_face}{This is face name for normal (i.e. non-fixed) font.
307 It can be either empty string (then the default face is chosen) or
308 platform-specific face name. Examples are "helvetica" under Unix or
309 "Times New Roman" under Windows.
}
311 \docparam{fixed
\_face}{The same thing for fixed face ( <TT>..</TT> )
}
313 \docparam{sizes
}{This is an array of
7 items of
{\it int
} type.
314 The 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
}
320 Default font sizes are defined by constants wxHTML
\_FONT\_SIZE\_1,
321 wxHTML
\_FONT\_SIZE\_2, ..., wxHTML
\_FONT\_SIZE\_7. Note that they differ among
322 platforms. Default face names are empty strings.
324 \membersection{wxHtmlWindow::SetPage
}\label{wxhtmlwindowsetpage
}
326 \func{bool
}{SetPage
}{\param{const wxString\&
}{source
}}
328 Sets HTML page and display it. This won't
{\bf load
} the page!!
329 It will display the
{\it source
}. See example:
332 htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
335 If you want to load a
document from some location use
336 \helpref{LoadPage
}{wxhtmlwindowloadpage
} instead.
338 \wxheading{Parameters
}
340 \docparam{source
}{The HTML
document source to be displayed.
}
342 \wxheading{Return value
}
344 false if an error occurred, true otherwise.
346 \membersection{wxHtmlWindow::SetRelatedFrame
}\label{wxhtmlwindowsetrelatedframe
}
348 \func{void
}{SetRelatedFrame
}{\param{wxFrame*
}{frame
},
\param{const wxString\&
}{format
}}
350 Sets the frame in which page title will be displayed.
{\it format
} is format of
351 frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
352 \%s is substituted with HTML page title.
354 \membersection{wxHtmlWindow::SetRelatedStatusBar
}\label{wxhtmlwindowsetrelatedstatusbar
}
356 \func{void
}{SetRelatedStatusBar
}{\param{int
}{bar
}}
358 {\bf After
} calling
\helpref{SetRelatedFrame
}{wxhtmlwindowsetrelatedframe
},
359 this sets statusbar slot where messages will be displayed.
360 (Default is -
1 = no messages.)
362 \wxheading{Parameters
}
364 \docparam{bar
}{statusbar slot number (
0..n)
}
367 \membersection{wxHtmlWindow::WriteCustomization
}\label{wxhtmlwindowwritecustomization
}
369 \func{virtual void
}{WriteCustomization
}{\param{wxConfigBase
}{*cfg
},
\param{wxString
}{path = wxEmptyString
}}
371 Saves custom settings into wxConfig. It uses the path 'path'
372 if given, otherwise it saves info into currently selected path.
373 Regardless of whether the path is given or not, the function creates sub-path
376 Saved values: all things set by SetFonts, SetBorders.
378 \wxheading{Parameters
}
380 \docparam{cfg
}{wxConfig to which you want to save the configuration.
}
382 \docparam{path
}{Optional path in config tree. If not given, the current path is used.
}