2006-05-28 13:41:09 -04:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: hyperlink.tex
2006-06-04 11:14:53 -04:00
%% Purpose: wxHyperlinkCtrl documentation
2006-05-28 13:41:09 -04:00
%% Author: Otto Wyss
%% Modified by: Francesco Montorsi
%% Created: 25.4.2004
%% RCS-ID: $Id$
%% Copyright: (c) 2004 wxCode, Francesco Montorsi
%% License: wxWindows
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2006-06-04 11:14:53 -04:00
\section { \class { wxHyperlinkCtrl} } \label { wxhyperlinkctrl}
2006-05-28 13:41:09 -04:00
This class shows a static text element which links to an URL.
2006-06-16 05:11:09 -04:00
Appearance and behaviour is completely customizable. In fact, when the user
clicks on the hyperlink, a \helpref { wxHyperlinkEvent} { wxhyperlinkevent} is
sent but if that event is not handled (or it's skipped; see
\helpref { wxEvent::Skip} { wxeventskip} ), then a call to
\helpref { wxLaunchDefaultBrowser} { wxlaunchdefaultbrowser} is done with the
hyperlink's URL.
2006-05-28 13:41:09 -04:00
Note that standard \helpref { wxWindow} { wxwindow} functions like \helpref { SetBackgroundColour} { wxwindowsetbackgroundcolour} , \helpref { SetFont} { wxwindowsetfont} , \helpref { SetCursor} { wxwindowsetcursor} , \helpref { SetLabel} { wxwindowsetlabel} can be used to customize appearance of the hyperlink.
\wxheading { Derived from}
2006-07-01 21:30:14 -04:00
\helpref { wxControl} { wxcontrol} \\
\helpref { wxWindow} { wxwindow} \\
\helpref { wxEvtHandler} { wxevthandler} \\
\helpref { wxObject} { wxobject}
2006-05-28 13:41:09 -04:00
\wxheading { Include files}
<wx/hyperlink.h>
\wxheading { Window styles}
\twocolwidtha { 7cm}
\begin { twocollist} \itemsep =0pt
2006-09-10 19:57:26 -04:00
\twocolitem { \windowstyle { wxHL\_ ALIGN\_ LEFT} } { Align the text to the left.}
\twocolitem { \windowstyle { wxHL\_ ALIGN\_ RIGHT} } { Align the text to the right.}
\twocolitem { \windowstyle { wxHL\_ ALIGN\_ CENTRE} } { Center the text (horizontally).}
2006-05-28 13:41:09 -04:00
\twocolitem { \windowstyle { wxHL\_ CONTEXTMENU} } { Pop up a context menu when the hyperlink is right-clicked. The context menu contains a \texttt { ``Copy URL"} menu item which is automatically handled by the hyperlink and which just copies in the clipboard the URL (not the label) of the control.}
2006-09-10 19:57:26 -04:00
\twocolitem { \windowstyle { wxHL\_ DEFAULT\_ STYLE} } { The default style for wxHyperlinkCtrl: \texttt { wxNO\_ BORDER|wxHL\_ CONTEXTMENU|wxHL\_ ALIGN\_ CENTRE} .}
2006-05-28 13:41:09 -04:00
\end { twocollist}
See also \helpref { window styles overview} { windowstyles} .
\wxheading { Event handling}
2006-06-16 05:11:09 -04:00
To process input from an hyperlink control, use these event handler macros to
direct input to member functions that take a
\helpref { wxHyperlinkEvent} { wxhyperlinkevent} argument.
2006-05-28 13:41:09 -04:00
\twocolwidtha { 7cm}
\begin { twocollist} \itemsep =0pt
\twocolitem { { \bf EVT\_ HYPERLINK(id, func)} } { The hyperlink was (left) clicked. If this event is not handled in user's code (or it's skipped; see \helpref { wxEvent::Skip} { wxeventskip} ), then a call to \helpref { wxLaunchDefaultBrowser} { wxlaunchdefaultbrowser} is done with the hyperlink's URL.}
\end { twocollist}
\wxheading { See also}
2006-06-16 05:11:09 -04:00
\helpref { wxURL} { wxurl} , \helpref { wxHyperlinkEvent} { wxhyperlinkevent}
2006-05-28 13:41:09 -04:00
\latexignore { \rtfignore { \wxheading { Members} } }
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::wxHyperLink} \label { wxhyperlinkctrlctor}
2006-05-28 13:41:09 -04:00
\func { } { wxHyperLink} { \param { wxWindow*} { parent} , \param { wxWindowID} { id} , \param { const wxString \& } { label} , \param { const wxString \& } { url} , \param { const wxPoint\& } { pos = wxDefaultPosition} , \param { const wxSize\& } { size = wxDefaultSize} , \param { long} { style} , \param { const wxString\& } { name = ``hyperlink"} }
Constructor. See \helpref { Create} { wxhyperlinkctrlcreate} for more info.
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::Create} \label { wxhyperlinkctrlcreate}
2006-05-28 13:41:09 -04:00
2006-06-16 05:11:09 -04:00
\func { bool} { Create} { \param { wxWindow*} { parent} , \param { wxWindowID} { id} , \param { const wxString \& } { label} , \param { const wxString \& } { url} , \param { const wxPoint\& } { pos = wxDefaultPosition} , \param { const wxSize\& } { size = wxDefaultSize} , \param { long} { style} , \param { const wxString\& } { name = ``hyperlink"} }
2006-05-28 13:41:09 -04:00
Creates the hyperlink control.
\wxheading { Parameters}
\docparam { parent} { Parent window. Must not be \NULL .}
2006-05-29 03:31:24 -04:00
\docparam { id} { Window identifier. A value of wxID\_ ANY indicates a default value.}
2006-05-28 13:41:09 -04:00
\docparam { label} { The label of the hyperlink.}
2006-06-16 05:11:09 -04:00
\docparam { url} { The URL associated with the given label.}
2006-05-28 13:41:09 -04:00
\docparam { pos} { Window position.}
2006-05-29 03:31:24 -04:00
\docparam { size} { Window size. If the wxDefaultSize is specified then the window is sized
2006-05-28 13:41:09 -04:00
appropriately.}
\docparam { style} { Window style. See \helpref { wxHyperlinkCtrl} { wxhyperlinkctrl} .}
\docparam { validator} { Window validator.}
\docparam { name} { Window name.}
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::GetHoverColour} \label { wxhyperlinkctrlgethovercolour}
2006-05-28 13:41:09 -04:00
\constfunc { wxColour} { GetHoverColour} { \void }
Returns the colour used to print the label of the hyperlink when the mouse is over the control.
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::SetHoverColour} \label { wxhyperlinkctrlsethovercolour}
2006-05-28 13:41:09 -04:00
\func { void} { SetHoverColour} { \param { const wxColour \& } { colour} }
Sets the colour used to print the label of the hyperlink when the mouse is over the control.
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::GetNormalColour} \label { wxhyperlinkctrlgetnormalcolour}
2006-05-28 13:41:09 -04:00
\constfunc { wxColour} { GetNormalColour} { \void }
Returns the colour used to print the label when the link has never been clicked before
(i.e. the link has not been { \it visited} ) and the mouse is not over the control.
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::SetNormalColour} \label { wxhyperlinkctrlsetnormalcolour}
2006-05-28 13:41:09 -04:00
\func { void} { SetNormalColour} { \param { const wxColour \& } { colour} }
Sets the colour used to print the label when the link has never been clicked before
(i.e. the link has not been { \it visited} ) and the mouse is not over the control.
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::GetVisitedColour} \label { wxhyperlinkctrlgetvisitedcolour}
2006-05-28 13:41:09 -04:00
\constfunc { wxColour} { GetVisitedColour} { \void }
Returns the colour used to print the label when the mouse is not over the control
and the link has already been clicked before (i.e. the link has been { \it visited} ).
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::SetVisitedColour} \label { wxhyperlinkctrlsetvisitedcolour}
2006-05-28 13:41:09 -04:00
\func { void} { SetVisitedColour} { \param { const wxColour \& } { colour} }
Sets the colour used to print the label when the mouse is not over the control
and the link has already been clicked before (i.e. the link has been { \it visited} ).
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::GetVisited} \label { wxhyperlinkctrlgetvisited}
2006-05-28 13:41:09 -04:00
\constfunc { bool} { GetVisited} { \void }
Returns \true if the hyperlink has already been clicked by the user at least one time.
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::SetVisited} \label { wxhyperlinkctrlsetvisited}
2006-05-28 13:41:09 -04:00
\func { void} { SetVisited} { \param { bool} { visited = true} }
Marks the hyperlink as visited (see \helpref { SetVisitedColour} { wxhyperlinkctrlsetvisitedcolour} ).
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::GetURL} \label { wxhyperlinkctrlgeturl}
2006-05-28 13:41:09 -04:00
\constfunc { wxString} { GetURL} { \void }
Returns the URL associated with the hyperlink.
2006-06-04 11:14:53 -04:00
\membersection { wxHyperlinkCtrl::SetURL} \label { wxhyperlinkctrlseturl}
2006-05-28 13:41:09 -04:00
\func { void} { SetURL} { \param { const wxString \& } { url} }
Sets the URL associated with the hyperlink.
2006-06-16 05:11:09 -04:00
\section { \class { wxHyperlinkEvent} } \label { wxhyperlinkevent}
2006-05-28 13:41:09 -04:00
This event class is used for the events generated by
\helpref { wxHyperlinkCtrl} { wxhyperlinkctrl} .
\wxheading { Derived from}
\helpref { wxCommandEvent} { wxcommandevent} \\
\helpref { wxEvent} { wxevent} \\
\helpref { wxObject} { wxobject}
\wxheading { Include files}
<wx/hyperlink.h>
\wxheading { Event handling}
To process input from a wxHyperlinkCtrl, use one of these event handler macros to
direct input to member function that take a
2006-06-16 05:11:09 -04:00
\helpref { wxHyperlinkEvent} { wxhyperlinkevent} argument:
2006-05-28 13:41:09 -04:00
\twocolwidtha { 7cm}
\begin { twocollist}
\twocolitem { { \bf EVT\_ HYPERLINK(id, func)} } { User clicked on an hyperlink.}
\end { twocollist}
\latexignore { \rtfignore { \wxheading { Members} } }
\membersection { wxHyperlinkEvent::wxHyperlinkEvent} \label { wxhyperlinkctrlctor}
\func { } { wxHyperlinkEvent} { \param { wxObject *} { generator} , \param { int} { id} , \param { const wxString \& } { url} }
The constructor is not normally used by the user code.
\membersection { wxHyperlinkEvent::GetURL} \label { wxhyperlinkctrlgeturl}
\constfunc { wxString} { GetURL} { \void }
Returns the URL of the hyperlink where the user has just clicked.
\membersection { wxHyperlinkEvent::SetURL} \label { wxhyperlinkctrlseturl}
\func { void} { SetURL} { \param { const wxString \& } { url} }
Sets the URL associated with the event.
2006-10-10 13:46:49 -04:00