new wxHtmlWindow::OnOpeningURL API

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13854 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2002-01-27 19:03:10 +00:00
parent d2b0092bed
commit 6cc4e6b81a
10 changed files with 244 additions and 85 deletions

View File

@@ -134,6 +134,40 @@ Returns pointer to the source being parsed.
Setups the parser for parsing the {\it source} string. (Should be overridden
in derived class)
\membersection{wxHtmlParser::OpenURL}\label{wxhtmlparseropenurl}
\func{virtual wxFSFile*}{OpenURL}{\param{wxHtmlURLType }{type}, \param{const wxString\& }{url}}
Opens given URL and returns {\tt wxFSFile} object that can be used to read data
from it. This method may return NULL in one of two cases: either the URL doesn't
point to any valid resource or the URL is blocked by overriden implementation
of {\it OpenURL} in derived class.
\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 into
any other category.}
\end{twocollist}}
\docparam{url}{URL being opened.}
\wxheading{Notes}
Always use this method in tag handlers instead of {\tt GetFS()->OpenFile()}
because it can block the URL and is thus more secure.
Default behaviour is to call \helpref{wxHtmlWindow::OnOpeningURL}{wxhtmlwindowonopeningurl}
of the associated wxHtmlWindow object (which may decide to block the URL or
redirect it to another one),if there's any, and always open the URL if the
parser is not used with wxHtmlWindow.
Returned {\tt wxFSFile} object is not guaranteed to point to {\it url}, it might
have been redirected!
\membersection{wxHtmlParser::Parse}\label{wxhtmlparserparse}
\func{wxObject*}{Parse}{\param{const wxString\& }{source}}

View File

@@ -200,13 +200,39 @@ Also see \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
\membersection{wxHtmlWindow::OnOpeningURL}\label{wxhtmlwindowonopeningurl}
\func{virtual bool}{OnOpeningURL}{\param{const wxString\& }{url}}
\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 or
an image is loaded). If the function returns FALSE, the URL won't be fetched.
Default behaviour is to return TRUE.
an 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 some
URLs (e.g. for security reasons) or to redirect them elsewhere. Default
behaviour is to always return {\tt wxHTML\_OPEN}.
Also see \helpref{wxHtmlWinParser::CanOpenURL}{wxhtmlwinparsercanopenurl}.
\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 into
any other category.}
\end{twocollist}}
\docparam{url}{URL being opened.}
\docparam{redirect}{Pointer to wxString variable that must be filled with an
URL if OnOpeningURL returns {\tt wxHTML\_REDIRECT}.}
\wxheading{Return value}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxHTML\_OPEN}}{Open the URL.}
\twocolitem{{\bf wxHTML\_BLOCK}}{Deny access to the URL, \helpref{wxHtmlParser::OpenURL}{wxhtmlparseropenurl} will return NULL.}
\twocolitem{{\bf wxHTML\_REDIRECT}}{Don't open {\it url}, redirect to another
URL. OnOpeningURL must fill {\it *redirect} with the new URL. OnOpeningURL will
be called again on returned URL.}
\end{twocollist}
\membersection{wxHtmlWindow::OnSetTitle}\label{wxhtmlwindowonsettitle}

View File

@@ -43,14 +43,6 @@ Constructor. Don't use the default one, use constructor with
Adds \helpref{module}{handlers} to the list of wxHtmlWinParser tag handler.
\membersection{wxHtmlWinParser::CanOpenURL}\label{wxhtmlwinparsercanopenurl}
\func{virtual bool}{CanOpenURL}{\param{const wxString\& }{url}}
Call this function to determine whether you are allowed to open given URL.
Default behaviour is to call \helpref{wxHtmlWindow::OnOpeningURL}{wxhtmlwindowonopeningurl}
of the associated wxHtmlWindow object.
\membersection{wxHtmlWinParser::CloseContainer}\label{wxhtmlwinparserclosecontainer}
\func{wxHtmlContainerCell*}{CloseContainer}{\void}