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
}
39 \helpref{wxAdv
}{librarieslist
}
42 \wxheading{Window styles
}
45 \begin{twocollist
}\itemsep=
0pt
46 \twocolitem{\windowstyle{wxHL
\_ALIGN\_LEFT}}{Align the text to the left.
}
47 \twocolitem{\windowstyle{wxHL
\_ALIGN\_RIGHT}}{Align the text to the right.
}
48 \twocolitem{\windowstyle{wxHL
\_ALIGN\_CENTRE}}{Center the text (horizontally).
}
49 \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.
}
50 \twocolitem{\windowstyle{wxHL
\_DEFAULT\_STYLE}}{The default style for wxHyperlinkCtrl:
\texttt{wxBORDER
\_NONE|wxHL
\_CONTEXTMENU|wxHL
\_ALIGN\_CENTRE}.
}
53 See also
\helpref{window styles overview
}{windowstyles
}.
56 \wxheading{Event handling
}
58 To process input from an hyperlink control, use these event handler macros to
59 direct input to member functions that take a
60 \helpref{wxHyperlinkEvent
}{wxhyperlinkevent
} argument.
63 \begin{twocollist
}\itemsep=
0pt
64 \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.
}
70 \helpref{wxURL
}{wxurl
},
\helpref{wxHyperlinkEvent
}{wxhyperlinkevent
}
73 \latexignore{\rtfignore{\wxheading{Members
}}}
75 \membersection{wxHyperlinkCtrl::wxHyperLinkCtrl
}\label{wxhyperlinkctrlctor
}
77 \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"
}}
79 Constructor. See
\helpref{Create
}{wxhyperlinkctrlcreate
} for more info.
82 \membersection{wxHyperlinkCtrl::Create
}\label{wxhyperlinkctrlcreate
}
84 \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"
}}
86 Creates the hyperlink control.
88 \wxheading{Parameters
}
90 \docparam{parent
}{Parent window. Must not be
\NULL.
}
92 \docparam{id
}{Window identifier. A value of wxID
\_ANY indicates a default value.
}
94 \docparam{label
}{The label of the hyperlink.
}
96 \docparam{url
}{The URL associated with the given label.
}
98 \docparam{pos
}{Window position.
}
100 \docparam{size
}{Window size. If the wxDefaultSize is specified then the window is sized
103 \docparam{style
}{Window style. See
\helpref{wxHyperlinkCtrl
}{wxhyperlinkctrl
}.
}
105 \docparam{validator
}{Window validator.
}
107 \docparam{name
}{Window name.
}
110 \membersection{wxHyperlinkCtrl::GetHoverColour
}\label{wxhyperlinkctrlgethovercolour
}
112 \constfunc{wxColour
}{GetHoverColour
}{\void}
114 Returns the colour used to print the label of the hyperlink when the mouse is over the control.
117 \membersection{wxHyperlinkCtrl::SetHoverColour
}\label{wxhyperlinkctrlsethovercolour
}
119 \func{void
}{SetHoverColour
}{\param{const wxColour \&
}{ colour
}}
121 Sets the colour used to print the label of the hyperlink when the mouse is over the control.
124 \membersection{wxHyperlinkCtrl::GetNormalColour
}\label{wxhyperlinkctrlgetnormalcolour
}
126 \constfunc{wxColour
}{GetNormalColour
}{\void}
128 Returns the colour used to print the label when the link has never been clicked before
129 (i.e. the link has not been
{\it visited
}) and the mouse is not over the control.
132 \membersection{wxHyperlinkCtrl::SetNormalColour
}\label{wxhyperlinkctrlsetnormalcolour
}
134 \func{void
}{SetNormalColour
}{\param{const wxColour \&
}{ colour
}}
136 Sets the colour used to print the label when the link has never been clicked before
137 (i.e. the link has not been
{\it visited
}) and the mouse is not over the control.
140 \membersection{wxHyperlinkCtrl::GetVisitedColour
}\label{wxhyperlinkctrlgetvisitedcolour
}
142 \constfunc{wxColour
}{GetVisitedColour
}{\void}
144 Returns the colour used to print the label when the mouse is not over the control
145 and the link has already been clicked before (i.e. the link has been
{\it visited
}).
148 \membersection{wxHyperlinkCtrl::SetVisitedColour
}\label{wxhyperlinkctrlsetvisitedcolour
}
150 \func{void
}{SetVisitedColour
}{\param{const wxColour \&
}{ colour
}}
152 Sets the colour used to print the label when the mouse is not over the control
153 and the link has already been clicked before (i.e. the link has been
{\it visited
}).
156 \membersection{wxHyperlinkCtrl::GetVisited
}\label{wxhyperlinkctrlgetvisited
}
158 \constfunc{bool
}{GetVisited
}{\void}
160 Returns
\true if the hyperlink has already been clicked by the user at least one time.
163 \membersection{wxHyperlinkCtrl::SetVisited
}\label{wxhyperlinkctrlsetvisited
}
165 \func{void
}{SetVisited
}{\param{bool
}{ visited = true
}}
167 Marks the hyperlink as visited (see
\helpref{SetVisitedColour
}{wxhyperlinkctrlsetvisitedcolour
}).
170 \membersection{wxHyperlinkCtrl::GetURL
}\label{wxhyperlinkctrlgeturl
}
172 \constfunc{wxString
}{GetURL
}{\void}
174 Returns the URL associated with the hyperlink.
177 \membersection{wxHyperlinkCtrl::SetURL
}\label{wxhyperlinkctrlseturl
}
179 \func{void
}{SetURL
}{\param{const wxString \&
}{ url
}}
181 Sets the URL associated with the hyperlink.
188 \section{\class{wxHyperlinkEvent
}}\label{wxhyperlinkevent
}
190 This event class is used for the events generated by
191 \helpref{wxHyperlinkCtrl
}{wxhyperlinkctrl
}.
193 \wxheading{Derived from
}
195 \helpref{wxCommandEvent
}{wxcommandevent
}\\
196 \helpref{wxEvent
}{wxevent
}\\
197 \helpref{wxObject
}{wxobject
}
199 \wxheading{Include files
}
205 \helpref{wxAdv
}{librarieslist
}
207 \wxheading{Event handling
}
209 To process input from a wxHyperlinkCtrl, use one of these event handler macros to
210 direct input to member function that take a
211 \helpref{wxHyperlinkEvent
}{wxhyperlinkevent
} argument:
215 \twocolitem{{\bf EVT
\_HYPERLINK(id, func)
}}{User clicked on an hyperlink.
}
219 \latexignore{\rtfignore{\wxheading{Members
}}}
221 \membersection{wxHyperlinkEvent::wxHyperlinkEvent
}\label{wxhyperlinkeventctor
}
223 \func{}{wxHyperlinkEvent
}{\param{wxObject *
}{ generator
},
\param{int
}{ id
},
\param{const wxString \&
}{ url
}}
225 The constructor is not normally used by the user code.
228 \membersection{wxHyperlinkEvent::GetURL
}\label{wxhyperlinkeventgeturl
}
230 \constfunc{wxString
}{GetURL
}{\void}
232 Returns the URL of the hyperlink where the user has just clicked.
235 \membersection{wxHyperlinkEvent::SetURL
}\label{wxhyperlinkeventseturl
}
237 \func{void
}{SetURL
}{\param{const wxString \&
}{ url
}}
239 Sets the URL associated with the event.