1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxHyperLink documentation
5 %% Modified by: Francesco Montorsi
8 %% Copyright: (c) 2004 wxCode, Francesco Montorsi
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxHyperLinkCtrl
}}\label{wxhyperlinkctrl
}
14 This class shows a static text element which links to an URL.
15 Appearance and behaviour is completely customizable. In fact, when the user clicks on the hyperlink, a
\helpref{wxHyperlinkEvent
}{wxhyperlinkctrlevent
} 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.
17 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.
20 \wxheading{Derived from
}
22 \helpref{wxControl
}{wxcontrol
}
25 \wxheading{Include files
}
30 \wxheading{Window styles
}
33 \begin{twocollist
}\itemsep=
0pt
34 \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.
}
35 \twocolitem{\windowstyle{wxHL
\_DEFAULT\_STYLE}}{The default style for wxHyperlinkCtrl:
\texttt{wxNO
\_BORDER|wxHL
\_CONTEXTMENU}.
}
38 See also
\helpref{window styles overview
}{windowstyles
}.
41 \wxheading{Event handling
}
43 To process input from a list control, use these event handler macros to direct input to member
44 functions that take a
\helpref{wxHyperlinkEvent
}{wxhyperlinkctrlevent
} argument.
47 \begin{twocollist
}\itemsep=
0pt
48 \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.
}
54 \helpref{wxURL
}{wxurl
}
57 \latexignore{\rtfignore{\wxheading{Members
}}}
59 \membersection{wxHyperLinkCtrl::wxHyperLink
}\label{wxhyperlinkctrlctor
}
61 \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"
}}
63 Constructor. See
\helpref{Create
}{wxhyperlinkctrlcreate
} for more info.
66 \membersection{wxHyperLinkCtrl::Create
}\label{wxhyperlinkctrlcreate
}
68 \func{}{Create
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{ id = wxID
\_ANY} \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"
}}
70 Creates the hyperlink control.
72 \wxheading{Parameters
}
74 \docparam{parent
}{Parent window. Must not be
\NULL.
}
76 \docparam{id
}{Window identifier. A value of wxID
\_ANY indicates a default value.
}
78 \docparam{label
}{The label of the hyperlink.
}
80 \docparam{url
}{The URL which is .
}
82 \docparam{pos
}{Window position.
}
84 \docparam{size
}{Window size. If the wxDefaultSize is specified then the window is sized
87 \docparam{style
}{Window style. See
\helpref{wxHyperlinkCtrl
}{wxhyperlinkctrl
}.
}
89 \docparam{validator
}{Window validator.
}
91 \docparam{name
}{Window name.
}
94 \membersection{wxHyperLinkCtrl::GetHoverColour
}\label{wxhyperlinkctrlgethovercolour
}
96 \constfunc{wxColour
}{GetHoverColour
}{\void}
98 Returns the colour used to print the label of the hyperlink when the mouse is over the control.
101 \membersection{wxHyperLinkCtrl::SetHoverColour
}\label{wxhyperlinkctrlsethovercolour
}
103 \func{void
}{SetHoverColour
}{\param{const wxColour \&
}{ colour
}}
105 Sets the colour used to print the label of the hyperlink when the mouse is over the control.
108 \membersection{wxHyperLinkCtrl::GetNormalColour
}\label{wxhyperlinkctrlgetnormalcolour
}
110 \constfunc{wxColour
}{GetNormalColour
}{\void}
112 Returns the colour used to print the label when the link has never been clicked before
113 (i.e. the link has not been
{\it visited
}) and the mouse is not over the control.
116 \membersection{wxHyperLinkCtrl::SetNormalColour
}\label{wxhyperlinkctrlsetnormalcolour
}
118 \func{void
}{SetNormalColour
}{\param{const wxColour \&
}{ colour
}}
120 Sets the colour used to print the label when the link has never been clicked before
121 (i.e. the link has not been
{\it visited
}) and the mouse is not over the control.
124 \membersection{wxHyperLinkCtrl::GetVisitedColour
}\label{wxhyperlinkctrlgetvisitedcolour
}
126 \constfunc{wxColour
}{GetVisitedColour
}{\void}
128 Returns the colour used to print the label when the mouse is not over the control
129 and the link has already been clicked before (i.e. the link has been
{\it visited
}).
132 \membersection{wxHyperLinkCtrl::SetVisitedColour
}\label{wxhyperlinkctrlsetvisitedcolour
}
134 \func{void
}{SetVisitedColour
}{\param{const wxColour \&
}{ colour
}}
136 Sets the colour used to print the label when the mouse is not over the control
137 and the link has already been clicked before (i.e. the link has been
{\it visited
}).
140 \membersection{wxHyperLinkCtrl::GetVisited
}\label{wxhyperlinkctrlgetvisited
}
142 \constfunc{bool
}{GetVisited
}{\void}
144 Returns
\true if the hyperlink has already been clicked by the user at least one time.
147 \membersection{wxHyperLinkCtrl::SetVisited
}\label{wxhyperlinkctrlsetvisited
}
149 \func{void
}{SetVisited
}{\param{bool
}{ visited = true
}}
151 Marks the hyperlink as visited (see
\helpref{SetVisitedColour
}{wxhyperlinkctrlsetvisitedcolour
}).
154 \membersection{wxHyperLinkCtrl::GetURL
}\label{wxhyperlinkctrlgeturl
}
156 \constfunc{wxString
}{GetURL
}{\void}
158 Returns the URL associated with the hyperlink.
161 \membersection{wxHyperLinkCtrl::SetURL
}\label{wxhyperlinkctrlseturl
}
163 \func{void
}{SetURL
}{\param{const wxString \&
}{ url
}}
165 Sets the URL associated with the hyperlink.
172 \section{\class{wxHyperlinkEvent
}}\label{wxhyperlinkctrlevent
}
174 This event class is used for the events generated by
175 \helpref{wxHyperlinkCtrl
}{wxhyperlinkctrl
}.
177 \wxheading{Derived from
}
179 \helpref{wxCommandEvent
}{wxcommandevent
}\\
180 \helpref{wxEvent
}{wxevent
}\\
181 \helpref{wxObject
}{wxobject
}
183 \wxheading{Include files
}
187 \wxheading{Event handling
}
189 To process input from a wxHyperlinkCtrl, use one of these event handler macros to
190 direct input to member function that take a
191 \helpref{wxHyperlinkEvent
}{wxhyperlinkctrlevent
} argument:
195 \twocolitem{{\bf EVT
\_HYPERLINK(id, func)
}}{User clicked on an hyperlink.
}
199 \latexignore{\rtfignore{\wxheading{Members
}}}
201 \membersection{wxHyperlinkEvent::wxHyperlinkEvent
}\label{wxhyperlinkctrlctor
}
203 \func{}{wxHyperlinkEvent
}{\param{wxObject *
}{ generator
},
\param{int
}{ id
},
\param{const wxString \&
}{ url
}}
205 The constructor is not normally used by the user code.
208 \membersection{wxHyperlinkEvent::GetURL
}\label{wxhyperlinkctrlgeturl
}
210 \constfunc{wxString
}{GetURL
}{\void}
212 Returns the URL of the hyperlink where the user has just clicked.
215 \membersection{wxHyperlinkEvent::SetURL
}\label{wxhyperlinkctrlseturl
}
217 \func{void
}{SetURL
}{\param{const wxString \&
}{ url
}}
219 Sets the URL associated with the event.