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
} or
18 \helpref{LoadPage(filename)
}{wxhtmlwindowloadpage
}.
22 wxHtmlWindow uses the
\helpref{wxImage
}{wximage
} class for displaying images.
23 Don't forget to initialize all image formats you need before loading any page!
24 (See
\helpref{wxInitAllImageHandlers
}{wxinitallimagehandlers
} and
25 \helpref{wxImage::AddHandler
}{wximageaddhandler
}.)
27 \wxheading{Derived from
}
29 \helpref{wxScrolledWindow
}{wxscrolledwindow
}
31 \wxheading{Include files
}
35 \membersection{wxHtmlWindow::wxHtmlWindow
}\label{wxhtmlwindowwxhtmlwindow
}
37 \func{}{wxHtmlWindow
}{\void}
41 \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"
}}
43 Constructor. The parameters are the same as for the
\helpref{wxScrolledWindow
}{wxscrolledwindow
} constructor.
45 \wxheading{Parameters
}
47 \docparam{style
}{wxHW
\_SCROLLBAR\_NEVER, or wxHW
\_SCROLLBAR\_AUTO.
48 Affects the appearance of vertical scrollbar in the window.
}
50 \membersection{wxHtmlWindow::AddFilter
}\label{wxhtmlwindowaddfilter
}
52 \func{static void
}{AddFilter
}{\param{wxHtmlFilter
}{*filter
}}
54 Adds
\helpref{input filter
}{filters
} to the static list of available
55 filters. These filters are present by default:
57 \begin{itemize
}\itemsep=
0pt
58 \item {\tt text/html
} MIME type
59 \item {\tt image/*
} MIME types
60 \item Plain Text filter (this filter is used if no other filter matches)
63 \membersection{wxHtmlWindow::AppendToPage
}\label{wxhtmlwindowappendtopage
}
65 \func{bool
}{AppendToPage
}{\param{const wxString\&
}{source
}}
67 Appends HTML fragment to currently displayed text and refreshes the window.
69 \wxheading{Parameters
}
71 \docparam{source
}{HTML code fragment
}
73 \wxheading{Return value
}
75 FALSE if an error occurred, TRUE otherwise.
77 \membersection{wxHtmlWindow::GetInternalRepresentation
}\label{wxhtmlwindowgetinternalrepresentation
}
79 \constfunc{wxHtmlContainerCell*
}{GetInternalRepresentation
}{\void}
81 Returns pointer to the top-level container.
83 See also:
\helpref{Cells Overview
}{cells
},
84 \helpref{Printing Overview
}{printing
}
86 \membersection{wxHtmlWindow::GetOpenedAnchor
}\label{wxhtmlwindowgetopenedanchor
}
88 \func{wxString
}{GetOpenedAnchor
}{\void}
90 Returns anchor within currently opened page
91 (see
\helpref{GetOpenedPage
}{wxhtmlwindowgetopenedpage
}).
92 If no page is opened or if the displayed page wasn't
93 produced by call to LoadPage, empty string is returned.
96 \membersection{wxHtmlWindow::GetOpenedPage
}\label{wxhtmlwindowgetopenedpage
}
98 \func{wxString
}{GetOpenedPage
}{\void}
100 Returns full location of the opened page. If no page is opened or if the displayed page wasn't
101 produced by call to LoadPage, empty string is returned.
103 \membersection{wxHtmlWindow::GetOpenedPageTitle
}\label{wxhtmlwindowgetopenedpagetitle
}
105 \func{wxString
}{GetOpenedPageTitle
}{\void}
107 Returns title of the opened page or wxEmptyString if current page does not contain
{\tt <TITLE>
} tag.
109 \membersection{wxHtmlWindow::GetRelatedFrame
}\label{wxhtmlwindowgetrelatedframe
}
111 \constfunc{wxFrame*
}{GetRelatedFrame
}{\void}
113 Returns the related frame.
115 \membersection{wxHtmlWindow::HistoryBack
}\label{wxhtmlwindowhistoryback
}
117 \func{bool
}{HistoryBack
}{\void}
119 Moves back to the previous page. (each page displayed using
120 \helpref{LoadPage
}{wxhtmlwindowloadpage
} is stored in history list.)
122 \membersection{wxHtmlWindow::HistoryCanBack
}\label{wxhtmlwindowhistorycanback
}
124 \func{bool
}{HistoryCanBack
}{\void}
126 Returns true if it is possible to go back in the history (i.e. HistoryBack()
129 \membersection{wxHtmlWindow::HistoryCanForward
}\label{wxhtmlwindowhistorycanforward
}
131 \func{bool
}{HistoryCanForward
}{\void}
133 Returns true if it is possible to go forward in the history (i.e. HistoryBack()
137 \membersection{wxHtmlWindow::HistoryClear
}\label{wxhtmlwindowhistoryclear
}
139 \func{void
}{HistoryClear
}{\void}
143 \membersection{wxHtmlWindow::HistoryForward
}\label{wxhtmlwindowhistoryforward
}
145 \func{bool
}{HistoryForward
}{\void}
147 Moves to next page in history.
149 \membersection{wxHtmlWindow::LoadPage
}\label{wxhtmlwindowloadpage
}
151 \func{virtual bool
}{LoadPage
}{\param{const wxString\&
}{location
}}
153 Unlike SetPage this function first loads HTML page from
{\it location
}
154 and then displays it. See example:
157 htmlwin -> SetPage("help/myproject/index.htm");
160 \wxheading{Parameters
}
162 \docparam{location
}{The address of
document. See
\helpref{wxFileSystem
}{wxfilesystem
} for details on address format and behaviour of "opener".
}
164 \wxheading{Return value
}
166 FALSE if an error occurred, TRUE otherwise
168 \membersection{wxHtmlWindow::OnCellClicked
}\label{wxhtmlwindowoncellclicked
}
170 \func{virtual void
}{OnCellClicked
}{\param{wxHtmlCell
}{*cell
},
\param{wxCoord
}{x
},
\param{wxCoord
}{y
},
\param{const wxMouseEvent\&
}{event
}}
172 This method is called when a mouse button is clicked inside wxHtmlWindow.
173 The default behaviour is to call
174 \helpref{OnLinkClicked
}{wxhtmlwindowonlinkclicked
} if the cell contains a
177 \wxheading{Parameters
}
179 \docparam{cell
}{The cell inside which the mouse was clicked, always a simple
180 (i.e. non container) cell
}
182 \docparam{x, y
}{The logical coordinates of the click point
}
184 \docparam{event
}{The mouse event containing other information about the click
}
186 \membersection{wxHtmlWindow::OnCellMouseHover
}\label{wxhtmlwindowoncellmousehover
}
188 \func{virtual void
}{OnCellMouseHover
}{\param{wxHtmlCell
}{*cell
},
\param{wxCoord
}{x
},
\param{wxCoord
}{y
}}
190 This method is called when a mouse moves over an HTML cell.
192 \wxheading{Parameters
}
194 \docparam{cell
}{The cell inside which the mouse is currently, always a simple
195 (i.e. non container) cell
}
197 \docparam{x, y
}{The logical coordinates of the click point
}
199 \membersection{wxHtmlWindow::OnLinkClicked
}\label{wxhtmlwindowonlinkclicked
}
201 \func{virtual void
}{OnLinkClicked
}{\param{const wxHtmlLinkInfo\&
}{link
}}
203 Called when user clicks on hypertext link. Default behaviour is to call
204 \helpref{LoadPage
}{wxhtmlwindowloadpage
} and do nothing else.
206 Also see
\helpref{wxHtmlLinkInfo
}{wxhtmllinkinfo
}.
208 \membersection{wxHtmlWindow::OnOpeningURL
}\label{wxhtmlwindowonopeningurl
}
210 \func{virtual wxHtmlOpeningStatus
}{OnOpeningURL
}{\param{wxHtmlURLType
}{type
},
\param{const wxString\&
}{url
},
\param{wxString *
}{redirect
}}
212 Called when an URL is being opened (either when the user clicks on a link or
213 an image is loaded). The URL will be opened only if OnOpeningURL returns
214 {\tt wxHTML
\_OPEN}. This method is called by
215 \helpref{wxHtmlParser::OpenURL
}{wxhtmlparseropenurl
}.
216 You can override OnOpeningURL to selectively block some
217 URLs (e.g. for security reasons) or to redirect them elsewhere. Default
218 behaviour is to always return
{\tt wxHTML
\_OPEN}.
220 \wxheading{Parameters
}
222 \docparam{type
}{Indicates type of the resource. Is one of
223 \begin{twocollist
}\itemsep=
0pt
224 \twocolitem{{\bf wxHTML
\_URL\_PAGE}}{Opening a HTML page.
}
225 \twocolitem{{\bf wxHTML
\_URL\_IMAGE}}{Opening an image.
}
226 \twocolitem{{\bf wxHTML
\_URL\_OTHER}}{Opening a resource that doesn't fall into
230 \docparam{url
}{URL being opened.
}
232 \docparam{redirect
}{Pointer to wxString variable that must be filled with an
233 URL if OnOpeningURL returns
{\tt wxHTML
\_REDIRECT}.
}
235 \wxheading{Return value
}
236 \begin{twocollist
}\itemsep=
0pt
237 \twocolitem{{\bf wxHTML
\_OPEN}}{Open the URL.
}
238 \twocolitem{{\bf wxHTML
\_BLOCK}}{Deny access to the URL,
\helpref{wxHtmlParser::OpenURL
}{wxhtmlparseropenurl
} will return NULL.
}
239 \twocolitem{{\bf wxHTML
\_REDIRECT}}{Don't open
{\it url
}, redirect to another
240 URL. OnOpeningURL must fill
{\it *redirect
} with the new URL. OnOpeningURL will
241 be called again on returned URL.
}
244 \membersection{wxHtmlWindow::OnSetTitle
}\label{wxhtmlwindowonsettitle
}
246 \func{virtual void
}{OnSetTitle
}{\param{const wxString\&
}{title
}}
248 Called on parsing
{\tt <TITLE>
} tag.
251 \membersection{wxHtmlWindow::ReadCustomization
}\label{wxhtmlwindowreadcustomization
}
253 \func{virtual void
}{ReadCustomization
}{\param{wxConfigBase
}{*cfg
},
\param{wxString
}{path = wxEmptyString
}}
255 This reads custom settings from wxConfig. It uses the path 'path'
256 if given, otherwise it saves info into currently selected path.
257 The values are stored in sub-path
{\tt wxHtmlWindow
}
259 Read values: all things set by SetFonts, SetBorders.
261 \wxheading{Parameters
}
263 \docparam{cfg
}{wxConfig from which you want to read the configuration.
}
265 \docparam{path
}{Optional path in config tree. If not given current path is used.
}
267 \membersection{wxHtmlWindow::SetBorders
}\label{wxhtmlwindowsetborders
}
269 \func{void
}{SetBorders
}{\param{int
}{b
}}
271 This function sets the space between border of window and HTML contents. See image:
273 \helponly{\image{}{border.bmp
}}
275 \wxheading{Parameters
}
277 \docparam{b
}{indentation from borders in pixels
}
279 \membersection{wxHtmlWindow::SetFonts
}\label{wxhtmlwindowsetfonts
}
281 \func{void
}{SetFonts
}{\param{wxString
}{normal
\_face},
\param{wxString
}{fixed
\_face},
\param{const int
}{*sizes
}}
283 This function sets font sizes and faces.
285 \wxheading{Parameters
}
287 \docparam{normal
\_face}{This is face name for normal (i.e. non-fixed) font.
288 It can be either empty string (then the default face is chosen) or
289 platform-specific face name. Examples are "helvetica" under Unix or
290 "Times New Roman" under Windows.
}
292 \docparam{fixed
\_face}{The same thing for fixed face ( <TT>..</TT> )
}
294 \docparam{sizes
}{This is an array of
7 items of
{\it int
} type.
295 The values represent size of font with HTML size from -
2 to +
4
296 ( <FONT SIZE=-
2> to <FONT SIZE=+
4> )
}
303 SetFonts("", "",
{10,
12,
14,
16,
19,
24,
32});
309 SetFonts("", "",
{7,
8,
10,
12,
16,
22,
30});
312 Although it seems different the fact is that the fonts are of approximately
313 same size under both platforms (due to wxMSW / wxGTK inconsistency)
315 \membersection{wxHtmlWindow::SetPage
}\label{wxhtmlwindowsetpage
}
317 \func{bool
}{SetPage
}{\param{const wxString\&
}{source
}}
319 Sets HTML page and display it. This won't
{\bf load
} the page!!
320 It will display the
{\it source
}. See example:
323 htmlwin -> SetPage("<html><body>Hello, world!</body></html>");
326 If you want to load a
document from some location use
327 \helpref{LoadPage
}{wxhtmlwindowloadpage
} instead.
329 \wxheading{Parameters
}
331 \docparam{source
}{The HTML
document source to be displayed.
}
333 \wxheading{Return value
}
335 FALSE if an error occurred, TRUE otherwise.
337 \membersection{wxHtmlWindow::SetRelatedFrame
}\label{wxhtmlwindowsetrelatedframe
}
339 \func{void
}{SetRelatedFrame
}{\param{wxFrame*
}{frame
},
\param{const wxString\&
}{format
}}
341 Sets the frame in which page title will be displayed.
{\it format
} is format of
342 frame title, e.g. "HtmlHelp : \%s". It must contain exactly one \%s. This
343 \%s is substituted with HTML page title.
345 \membersection{wxHtmlWindow::SetRelatedStatusBar
}\label{wxhtmlwindowsetrelatedstatusbar
}
347 \func{void
}{SetRelatedStatusBar
}{\param{int
}{bar
}}
349 {\bf After
} calling
\helpref{SetRelatedFrame
}{wxhtmlwindowsetrelatedframe
},
350 this sets statusbar slot where messages will be displayed.
351 (Default is -
1 = no messages.)
353 \wxheading{Parameters
}
355 \docparam{bar
}{statusbar slot number (
0..n)
}
358 \membersection{wxHtmlWindow::WriteCustomization
}\label{wxhtmlwindowwritecustomization
}
360 \func{virtual void
}{WriteCustomization
}{\param{wxConfigBase
}{*cfg
},
\param{wxString
}{path = wxEmptyString
}}
362 Saves custom settings into wxConfig. It uses the path 'path'
363 if given, otherwise it saves info into currently selected path.
364 Regardless of whether the path is given or not, the function creates sub-path
367 Saved values: all things set by SetFonts, SetBorders.
369 \wxheading{Parameters
}
371 \docparam{cfg
}{wxConfig to which you want to save the configuration.
}
373 \docparam{path
}{Optional path in config tree. If not given, the current path is used.
}