📄 htwindow.tex
字号:
%% automatically generated by HelpGen from% htmlwindow.tex at 14/Mar/99 20:13:37%\section{\class{wxHtmlWindow}}\label{wxhtmlwindow}wxHtmlWindow is probably the only class you will directly useunless you want to do something special (like adding new taghandlers or MIME filters).The purpose of this class is to display HTML pages (either localfile or downloaded via HTTP protocol) in a window. The widthof the window is constant - given in the constructor - and virtual heightis changed dynamically depending on page size.Once the window is created you can set its content by calling \helpref{SetPage(text)}{wxhtmlwindowsetpage},\helpref{LoadPage(filename)}{wxhtmlwindowloadpage} or\helpref{LoadFile}{wxhtmlwindowloadfile}.\wxheading{Note}wxHtmlWindow uses the \helpref{wxImage}{wximage} class for displaying images.Don't forget to initialize all image formats you need before loading any page!(See \helpref{wxInitAllImageHandlers}{wxinitallimagehandlers} and\helpref{wxImage::AddHandler}{wximageaddhandler}.)\wxheading{Derived from}\helpref{wxScrolledWindow}{wxscrolledwindow}\wxheading{Include files}<wx/html/htmlwin.h>\wxheading{Window styles}\twocolwidtha{5cm}\begin{twocollist}\itemsep=0pt\twocolitem{\windowstyle{wxHW\_SCROLLBAR\_NEVER}}{Never display scrollbars, noteven when the page is larger than the window.}\twocolitem{\windowstyle{wxHW\_SCROLLBAR\_AUTO}}{Display scrollbars only ifpage's size exceeds window's size.}\twocolitem{\windowstyle{wxHW\_NO\_SELECTION}}{Don't allow the user to selecttext.}\end{twocollist}\wxheading{Event handling}To process input from a wxHtmlWindow, use these event handler macros to direct input to memberfunctions that take a \helpref{wxHtmlCellEvent}{wxhtmlcellevent} argument or a \helpref{wxHtmlLinkEvent}{wxhtmllinkevent}.\twocolwidtha{7cm}\begin{twocollist}\itemsep=0pt\twocolitem{{\bf EVT\_HTML\_CELL\_CLICKED(id, func)}}{A \helpref{wxHtmlCell}{wxhtmlcell} was clicked.}\twocolitem{{\bf EVT\_HTML\_CELL\_HOVER(id, func)}}{The mouse passed over a \helpref{wxHtmlCell}{wxhtmlcell}.}\twocolitem{{\bf EVT\_HTML\_LINK\_CLICKED(id, func)}}{A \helpref{wxHtmlCell}{wxhtmlcell} which contains an hyperlink was clicked.}\end{twocollist}\wxheading{See also}\helpref{wxHtmlLinkEvent}{wxhtmllinkevent}, \helpref{wxHtmlCellEvent}{wxhtmlcellevent}\membersection{wxHtmlWindow::wxHtmlWindow}\label{wxhtmlwindowwxhtmlwindow}\func{}{wxHtmlWindow}{\void}Default constructor.\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"}}Constructor. The parameters are the same as for the \helpref{wxScrolledWindow}{wxscrolledwindow} constructor.\wxheading{Parameters}\docparam{style}{Window style. See \helpref{wxHtmlWindow}{wxhtmlwindow}.}\membersection{wxHtmlWindow::AddFilter}\label{wxhtmlwindowaddfilter}\func{static void}{AddFilter}{\param{wxHtmlFilter }{*filter}}Adds \helpref{input filter}{filters} to the static list of availablefilters. These filters are present by default:\begin{itemize}\itemsep=0pt\item {\tt text/html} MIME type\item {\tt image/*} MIME types\item Plain Text filter (this filter is used if no other filter matches)\end{itemize}\membersection{wxHtmlWindow::AppendToPage}\label{wxhtmlwindowappendtopage}\func{bool}{AppendToPage}{\param{const wxString\& }{source}}Appends HTML fragment to currently displayed text and refreshes the window. \wxheading{Parameters}\docparam{source}{HTML code fragment}\wxheading{Return value}false if an error occurred, true otherwise.\membersection{wxHtmlWindow::GetInternalRepresentation}\label{wxhtmlwindowgetinternalrepresentation}\constfunc{wxHtmlContainerCell*}{GetInternalRepresentation}{\void}Returns pointer to the top-level container.See also: \helpref{Cells Overview}{cells}, \helpref{Printing Overview}{printing}\membersection{wxHtmlWindow::GetOpenedAnchor}\label{wxhtmlwindowgetopenedanchor}\func{wxString}{GetOpenedAnchor}{\void}Returns anchor within currently opened page(see \helpref{GetOpenedPage}{wxhtmlwindowgetopenedpage}). If no page is opened or if the displayed page wasn'tproduced by call to LoadPage, empty string is returned.\membersection{wxHtmlWindow::GetOpenedPage}\label{wxhtmlwindowgetopenedpage}\func{wxString}{GetOpenedPage}{\void}Returns full location of the opened page. If no page is opened or if the displayed page wasn'tproduced by call to LoadPage, empty string is returned.\membersection{wxHtmlWindow::GetOpenedPageTitle}\label{wxhtmlwindowgetopenedpagetitle}\func{wxString}{GetOpenedPageTitle}{\void}Returns title of the opened page or wxEmptyString if current page does not contain {\tt <TITLE>} tag.\membersection{wxHtmlWindow::GetRelatedFrame}\label{wxhtmlwindowgetrelatedframe}\constfunc{wxFrame*}{GetRelatedFrame}{\void}Returns the related frame.\membersection{wxHtmlWindow::HistoryBack}\label{wxhtmlwindowhistoryback}\func{bool}{HistoryBack}{\void}Moves back to the previous page. (each page displayed using \helpref{LoadPage}{wxhtmlwindowloadpage} is stored in history list.)\membersection{wxHtmlWindow::HistoryCanBack}\label{wxhtmlwindowhistorycanback}\func{bool}{HistoryCanBack}{\void}Returns true if it is possible to go back in the history (i.e. HistoryBack()won't fail).\membersection{wxHtmlWindow::HistoryCanForward}\label{wxhtmlwindowhistorycanforward}\func{bool}{HistoryCanForward}{\void}Returns true if it is possible to go forward in the history (i.e. HistoryBack()won't fail).\membersection{wxHtmlWindow::HistoryClear}\label{wxhtmlwindowhistoryclear}\func{void}{HistoryClear}{\void}Clears history.\membersection{wxHtmlWindow::HistoryForward}\label{wxhtmlwindowhistoryforward}\func{bool}{HistoryForward}{\void}Moves to next page in history.\membersection{wxHtmlWindow::LoadFile}\label{wxhtmlwindowloadfile}\func{virtual bool}{LoadFile}{\param{const wxFileName\& }{filename}}Loads HTML page from file and displays it.\wxheading{Return value}false if an error occurred, true otherwise\wxheading{See also}\helpref{LoadPage}{wxhtmlwindowloadpage}\membersection{wxHtmlWindow::LoadPage}\label{wxhtmlwindowloadpage}\func{virtual bool}{LoadPage}{\param{const wxString\& }{location}}Unlike SetPage this function first loads HTML page from {\it location} and then displays it. See example:\begin{verbatim}htmlwin->LoadPage("help/myproject/index.htm");\end{verbatim}\wxheading{Parameters}\docparam{location}{The address of document. See \helpref{wxFileSystem}{wxfilesystem} for details on address format and behaviour of "opener".}\wxheading{Return value}false if an error occurred, true otherwise\wxheading{See also}\helpref{LoadFile}{wxhtmlwindowloadfile}\membersection{wxHtmlWindow::OnCellClicked}\label{wxhtmlwindowoncellclicked}\func{virtual bool}{OnCellClicked}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}, \param{const wxMouseEvent\& }{event}}This method is called when a mouse button is clicked inside wxHtmlWindow.The default behaviour is to emit a \helpref{wxHtmlCellEvent}{wxhtmlcellevent}and, if the event was not processed or skipped, call\helpref{OnLinkClicked}{wxhtmlwindowonlinkclicked} if the cell contains anhypertext link.Overloading this method is deprecated; intercept the event instead.\wxheading{Parameters}\docparam{cell}{The cell inside which the mouse was clicked, always a simple(i.e. non-container) cell}\docparam{x, y}{The logical coordinates of the click point}\docparam{event}{The mouse event containing other information about the click}\wxheading{Return value}\true if a link was clicked, \false otherwise.\membersection{wxHtmlWindow::OnCellMouseHover}\label{wxhtmlwindowoncellmousehover}\func{virtual void}{OnCellMouseHover}{\param{wxHtmlCell }{*cell}, \param{wxCoord }{x}, \param{wxCoord }{y}}This method is called when a mouse moves over an HTML cell.Default behaviour is to emit a \helpref{wxHtmlCellEvent}{wxhtmlcellevent}.Overloading this method is deprecated; intercept the event instead.\wxheading{Parameters}\docparam{cell}{The cell inside which the mouse is currently, always a simple(i.e. non-container) cell}\docparam{x, y}{The logical coordinates of the click point}\membersection{wxHtmlWindow::OnLinkClicked}\label{wxhtmlwindowonlinkclicked}\func{virtual void}{OnLinkClicked}{\param{const wxHtmlLinkInfo\& }{link}}Called when user clicks on hypertext link. Default behaviour is to emit a\helpref{wxHtmlLinkEvent}{wxhtmllinkevent} and, if the event was not processedor skipped, call \helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.Overloading this method is deprecated; intercept the event instead.Also see \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.\membersection{wxHtmlWindow::OnOpeningURL}\label{wxhtmlwindowonopeningurl}\func{virtual wxHtmlOpeningStatus}{OnOpeningURL}{\param{wxHtmlURLType }{type},\param{const wxString\& }{url}, \param{wxString *}{redirect}}Called when an URL is being opened (either when the user clicks on a link oran image is loaded). The URL will be opened only if OnOpeningURL returns {\tt wxHTML\_OPEN}. This method is called by\helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl}.You can override OnOpeningURL to selectively block someURLs (e.g. for security reasons) or to redirect them elsewhere. Defaultbehaviour is to always return {\tt wxHTML\_OPEN}.\wxheading{Parameters}\docparam{type}{Indicates type of the resource. Is one of\begin{twocollist}\itemsep=0pt\twocolitem{{\bf wxHTML\_URL\_PAGE}}{Opening a HTML page.}\twocolitem{{\bf wxHTML\_URL\_IMAGE}}{Opening an image.}\twocolitem{{\bf wxHTML\_URL\_OTHER}}{Opening a resource that doesn't fall intoany other category.}\end{twocollist}}\docparam{url}{URL being opened.}\docparam{redirect}{Pointer to wxString variable that must be filled with anURL if OnOpeningURL returns {\tt wxHTML\_REDIRECT}.}\wxheading{Return value}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -