add events API to wxHtmlWindow (patch #1504493 by Francesco Montorsi)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2006-10-29 20:26:03 +00:00
parent 55f42db2fb
commit a1c3cdc4a2
10 changed files with 408 additions and 72 deletions

View File

@@ -93,7 +93,8 @@ All (GUI):
- Many enhancements to wxRichTextCtrl including URL support,
formatting and symbol dialogs, print/preview, and better list
formatting.
- Support for loading TGA files added (Seth Jackson)
- Support for loading TGA files added (Seth Jackson).
- Added events API to wxHtmlWindow (Francesco Montorsi).
Unix Ports:

View File

@@ -35,6 +35,19 @@ example) but you will only need to override a single
\helpref{wxSimpleHtmlListBox}{wxsimplehtmllistbox}
\wxheading{Event handling}
To process input from a wxHtmlListBox, use these event handler macros to direct input to member
functions that take a \helpref{wxHtmlCellEvent}{wxhtmlcellevent} argument or a \helpref{wxHtmlLinkEvent}{wxhtmllinkevent}.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_HTMLWINDOW\_CELL\_CLICKED(id, func)}}{A \helpref{wxHtmlCell}{wxhtmlcell} was clicked.}
\twocolitem{{\bf EVT\_HTMLWINDOW\_CELL\_HOVER(id, func)}}{The mouse passed over a {\helpref{wxHtmlCell}{wxhtmlcell}.}
\twocolitem{{\bf EVT\_HTMLWINDOW\_LINK\_CLICKED(id, func)}}{A \helpref{wxHtmlCell}{wxhtmlcell} which contains an hyperlink was clicked.}
\end{twocollist}
\latexignore{\rtfignore{\wxheading{Members}}}
@@ -147,6 +160,7 @@ This function may be overridden to decorate HTML returned by
\func{virtual void}{OnLinkClicked}{\param{size\_t }{n}, \param{const wxHtmlLinkInfo\& }{link}}
Called when the user clicks on hypertext link. Does nothing by default.
Overloading this method is deprecated; intercept the event instead.
\wxheading{Parameters}
@@ -226,7 +240,10 @@ See also \helpref{window styles overview}{windowstyles}.
\wxheading{Event handling}
A wxSimpleHtmlListBox emits the same events used by \helpref{wxListBox}{wxlistbox}:
A wxSimpleHtmlListBox emits the same events used by \helpref{wxListBox}{wxlistbox} and by
\helpref{wxHtmlListBox}{wxhtmllistbox}.
The event handlers for the following events take a \helpref{wxCommandEvent}{wxcommandevent}:
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
@@ -236,6 +253,16 @@ when an item on the list is selected.}
when the listbox is double-clicked.}
\end{twocollist}
The event handlers for the following events take a \helpref{wxHtmlCellEvent}{wxhtmlcellevent}
or a \helpref{wxHtmlLinkEvent}{wxhtmllinkevent}:
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_HTMLWINDOW\_CELL\_CLICKED(id, func)}}{A \helpref{wxHtmlCell}{wxhtmlcell} was clicked.}
\twocolitem{{\bf EVT\_HTMLWINDOW\_CELL\_HOVER(id, func)}}{The mouse passed over a {\helpref{wxHtmlCell}{wxhtmlcell}.}
\twocolitem{{\bf EVT\_HTMLWINDOW\_LINK\_CLICKED(id, func)}}{A \helpref{wxHtmlCell}{wxhtmlcell} which contains an hyperlink was clicked.}
\end{twocollist}
\latexignore{\rtfignore{\wxheading{Members}}}

View File

@@ -45,6 +45,26 @@ page's size exceeds window's size.}
text.}
\end{twocollist}
\wxheading{Event handling}
To process input from a wxHtmlWindow, use these event handler macros to direct input to member
functions that take a \helpref{wxHtmlCellEvent}{wxhtmlcellevent} argument or a \helpref{wxHtmlLinkEvent}{wxhtmllinkevent}.
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_HTMLWINDOW\_CELL\_CLICKED(id, func)}}{A \helpref{wxHtmlCell}{wxhtmlcell} was clicked.}
\twocolitem{{\bf EVT\_HTMLWINDOW\_CELL\_HOVER(id, func)}}{The mouse passed over a {\helpref{wxHtmlCell}{wxhtmlcell}.}
\twocolitem{{\bf EVT\_HTMLWINDOW\_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}
@@ -200,10 +220,15 @@ false if an error occurred, true otherwise
\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 call
\helpref{OnLinkClicked}{wxhtmlwindowonlinkclicked} if the cell contains a
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 an
hypertext 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
@@ -222,6 +247,8 @@ hypertext link.
\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}
@@ -234,8 +261,10 @@ This method is called when a mouse moves over an HTML cell.
\func{virtual void}{OnLinkClicked}{\param{const wxHtmlLinkInfo\& }{link}}
Called when user clicks on hypertext link. Default behaviour is to call
\helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.
Called when user clicks on hypertext link. Default behaviour is to emit a
\helpref{wxHtmlLinkEvent}{wxhtmllinkevent} and, if the event was not processed
or skipped, call \helpref{LoadPage}{wxhtmlwindowloadpage} and do nothing else.
Overloading this method is deprecated; intercept the event instead.
Also see \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo}.
@@ -447,3 +476,119 @@ Saved values: all things set by SetFonts, SetBorders.
\docparam{path}{Optional path in config tree. If not given, the current path is used.}
\section{\class{wxHtmlLinkEvent}}\label{wxhtmllinkevent}
This event class is used for the events generated by \helpref{wxHtmlWindow}{wxhtmlwindow}.
\wxheading{Derived from}
\helpref{wxCommandEvent}{wxcommandevent}\\
\helpref{wxEvent}{wxevent}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/html/htmlwin.h>
\wxheading{Event handling}
To process input from a wxHtmlLinkEvent, use one of these event handler macros to
direct input to member function that take a \helpref{wxHtmlLinkEvent}{wxhtmllinkevent} argument:
\twocolwidtha{7cm}
\begin{twocollist}
\twocolitem{{\bf EVT\_HTMLWINDOW\_LINK\_CLICKED(id, func)}}{User clicked on an hyperlink.}
\end{twocollist}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxHtmlLinkEvent::wxHtmlLinkEvent}\label{wxhtmllinkeventctor}
\func{}{wxHyperlinkEvent}{\param{int}{ id}, \param{const wxHtmlLinkInfo \&}{ linkinfo}}
The constructor is not normally used by the user code.
\membersection{wxHtmlLinkEvent::GetLinkInfo}\label{wxhtmllinkeventgetlinkinfo}
\constfunc{const wxHtmlLinkInfo &}{GetLinkInfo}{\void}
Returns the \helpref{wxHtmlLinkInfo}{wxhtmllinkinfo} which contains info about the cell clicked and the hyperlink it contains.
\section{\class{wxHtmlCellEvent}}\label{wxhtmlcellevent}
This event class is used for the events generated by \helpref{wxHtmlWindow}{wxhtmlwindow}.
\wxheading{Derived from}
\helpref{wxCommandEvent}{wxcommandevent}\\
\helpref{wxEvent}{wxevent}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/html/htmlwin.h>
\wxheading{Event handling}
To process input from a wxHtmlCellEvent, use one of these event handler macros to
direct input to member function that take a \helpref{wxHtmlCellEvent}{wxhtmlcellevent} argument:
\twocolwidtha{7cm}
\begin{twocollist}
\twocolitem{{\bf EVT\_HTMLWINDOW\_CELL\_HOVER(id, func)}}{User moved the mouse over a \helpref{wxHtmlCell}{wxhtmlcell}.}
\twocolitem{{\bf EVT\_HTMLWINDOW\_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.}
\end{twocollist}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxHtmlCellEvent::wxHtmlCellEvent}\label{wxhtmlcelleventctor}
\func{}{wxHtmlCellEvent}{\param{wxEventType}{ commandType}, \param{int}{ id}, \param{wxHtmlCell *}{ cell}, \param{const wxPoint \&}{ point}}
The constructor is not normally used by the user code.
\membersection{wxHtmlCellEvent::GetCell}\label{wxhtmlcelleventgetcell}
\constfunc{wxHtmlCell *}{GetCell}{\void}
Returns the \helpref{wxHtmlCellEvent}{wxhtmlcellevent} associated with the event.
\membersection{wxHtmlCellEvent::GetPoint}\label{wxhtmlcelleventgetpoint}
\constfunc{wxPoint}{GetPoint}{\void}
Returns the \helpref{wxPoint}{wxpoint} associated with the event.
\membersection{wxHtmlCellEvent::SetLinkClicked}\label{wxhtmlcelleventsetlinkclicked}
\func{bool}{SetLinkClicked}{\param{bool}{ linkclicked}}
Call this function with {\tt linkclicked} set to \true if the cell which has been clicked contained a link or
\false otherwise (which is the default). With this function the event handler can return info to the
wxHtmlWindow which sent the event.
\membersection{wxHtmlCellEvent::GetLinkClicked}\label{wxhtmlcelleventgetlinkclicked}
\constfunc{bool}{GetLinkClicked}{\void}
Returns \true if \helpref{SetLinkClicked(true)}{wxhtmlcelleventsetlinkclicked} has previously been called;
\false otherwise.