1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxHyperlinkCtrl 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
16 clicks on the hyperlink, a
\helpref{wxHyperlinkEvent
}{wxhyperlinkevent
} is
17 sent but if that event is not handled (or it's skipped; see
18 \helpref{wxEvent::Skip
}{wxeventskip
}), then a call to
19 \helpref{wxLaunchDefaultBrowser
}{wxlaunchdefaultbrowser
} is done with the
22 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.
25 \wxheading{Derived from
}
27 \helpref{wxControl
}{wxcontrol
}\\
28 \helpref{wxWindow
}{wxwindow
}\\
29 \helpref{wxEvtHandler
}{wxevthandler
}\\
30 \helpref{wxObject
}{wxobject
}
33 \wxheading{Include files
}
38 \wxheading{Window styles
}
41 \begin{twocollist
}\itemsep=
0pt
42 \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.
}
43 \twocolitem{\windowstyle{wxHL
\_DEFAULT\_STYLE}}{The default style for wxHyperlinkCtrl:
\texttt{wxNO
\_BORDER|wxHL
\_CONTEXTMENU}.
}
46 See also
\helpref{window styles overview
}{windowstyles
}.
49 \wxheading{Event handling
}
51 To process input from an hyperlink control, use these event handler macros to
52 direct input to member functions that take a
53 \helpref{wxHyperlinkEvent
}{wxhyperlinkevent
} argument.
56 \begin{twocollist
}\itemsep=
0pt
57 \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.
}
63 \helpref{wxURL
}{wxurl
},
\helpref{wxHyperlinkEvent
}{wxhyperlinkevent
}
66 \latexignore{\rtfignore{\wxheading{Members
}}}
68 \membersection{wxHyperlinkCtrl::wxHyperLink
}\label{wxhyperlinkctrlctor
}
70 \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"
}}
72 Constructor. See
\helpref{Create
}{wxhyperlinkctrlcreate
} for more info.
75 \membersection{wxHyperlinkCtrl::Create
}\label{wxhyperlinkctrlcreate
}
77 \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"
}}
79 Creates the hyperlink control.
81 \wxheading{Parameters
}
83 \docparam{parent
}{Parent window. Must not be
\NULL.
}
85 \docparam{id
}{Window identifier. A value of wxID
\_ANY indicates a default value.
}
87 \docparam{label
}{The label of the hyperlink.
}
89 \docparam{url
}{The URL associated with the given label.
}
91 \docparam{pos
}{Window position.
}
93 \docparam{size
}{Window size. If the wxDefaultSize is specified then the window is sized
96 \docparam{style
}{Window style. See
\helpref{wxHyperlinkCtrl
}{wxhyperlinkctrl
}.
}
98 \docparam{validator
}{Window validator.
}
100 \docparam{name
}{Window name.
}
103 \membersection{wxHyperlinkCtrl::GetHoverColour
}\label{wxhyperlinkctrlgethovercolour
}
105 \constfunc{wxColour
}{GetHoverColour
}{\void}
107 Returns the colour used to print the label of the hyperlink when the mouse is over the control.
110 \membersection{wxHyperlinkCtrl::SetHoverColour
}\label{wxhyperlinkctrlsethovercolour
}
112 \func{void
}{SetHoverColour
}{\param{const wxColour \&
}{ colour
}}
114 Sets the colour used to print the label of the hyperlink when the mouse is over the control.
117 \membersection{wxHyperlinkCtrl::GetNormalColour
}\label{wxhyperlinkctrlgetnormalcolour
}
119 \constfunc{wxColour
}{GetNormalColour
}{\void}
121 Returns the colour used to print the label when the link has never been clicked before
122 (i.e. the link has not been
{\it visited
}) and the mouse is not over the control.
125 \membersection{wxHyperlinkCtrl::SetNormalColour
}\label{wxhyperlinkctrlsetnormalcolour
}
127 \func{void
}{SetNormalColour
}{\param{const wxColour \&
}{ colour
}}
129 Sets the colour used to print the label when the link has never been clicked before
130 (i.e. the link has not been
{\it visited
}) and the mouse is not over the control.
133 \membersection{wxHyperlinkCtrl::GetVisitedColour
}\label{wxhyperlinkctrlgetvisitedcolour
}
135 \constfunc{wxColour
}{GetVisitedColour
}{\void}
137 Returns the colour used to print the label when the mouse is not over the control
138 and the link has already been clicked before (i.e. the link has been
{\it visited
}).
141 \membersection{wxHyperlinkCtrl::SetVisitedColour
}\label{wxhyperlinkctrlsetvisitedcolour
}
143 \func{void
}{SetVisitedColour
}{\param{const wxColour \&
}{ colour
}}
145 Sets the colour used to print the label when the mouse is not over the control
146 and the link has already been clicked before (i.e. the link has been
{\it visited
}).
149 \membersection{wxHyperlinkCtrl::GetVisited
}\label{wxhyperlinkctrlgetvisited
}
151 \constfunc{bool
}{GetVisited
}{\void}
153 Returns
\true if the hyperlink has already been clicked by the user at least one time.
156 \membersection{wxHyperlinkCtrl::SetVisited
}\label{wxhyperlinkctrlsetvisited
}
158 \func{void
}{SetVisited
}{\param{bool
}{ visited = true
}}
160 Marks the hyperlink as visited (see
\helpref{SetVisitedColour
}{wxhyperlinkctrlsetvisitedcolour
}).
163 \membersection{wxHyperlinkCtrl::GetURL
}\label{wxhyperlinkctrlgeturl
}
165 \constfunc{wxString
}{GetURL
}{\void}
167 Returns the URL associated with the hyperlink.
170 \membersection{wxHyperlinkCtrl::SetURL
}\label{wxhyperlinkctrlseturl
}
172 \func{void
}{SetURL
}{\param{const wxString \&
}{ url
}}
174 Sets the URL associated with the hyperlink.
181 \section{\class{wxHyperlinkEvent
}}\label{wxhyperlinkevent
}
183 This event class is used for the events generated by
184 \helpref{wxHyperlinkCtrl
}{wxhyperlinkctrl
}.
186 \wxheading{Derived from
}
188 \helpref{wxCommandEvent
}{wxcommandevent
}\\
189 \helpref{wxEvent
}{wxevent
}\\
190 \helpref{wxObject
}{wxobject
}
192 \wxheading{Include files
}
196 \wxheading{Event handling
}
198 To process input from a wxHyperlinkCtrl, use one of these event handler macros to
199 direct input to member function that take a
200 \helpref{wxHyperlinkEvent
}{wxhyperlinkevent
} argument:
204 \twocolitem{{\bf EVT
\_HYPERLINK(id, func)
}}{User clicked on an hyperlink.
}
208 \latexignore{\rtfignore{\wxheading{Members
}}}
210 \membersection{wxHyperlinkEvent::wxHyperlinkEvent
}\label{wxhyperlinkctrlctor
}
212 \func{}{wxHyperlinkEvent
}{\param{wxObject *
}{ generator
},
\param{int
}{ id
},
\param{const wxString \&
}{ url
}}
214 The constructor is not normally used by the user code.
217 \membersection{wxHyperlinkEvent::GetURL
}\label{wxhyperlinkctrlgeturl
}
219 \constfunc{wxString
}{GetURL
}{\void}
221 Returns the URL of the hyperlink where the user has just clicked.
224 \membersection{wxHyperlinkEvent::SetURL
}\label{wxhyperlinkctrlseturl
}
226 \func{void
}{SetURL
}{\param{const wxString \&
}{ url
}}
228 Sets the URL associated with the event.