]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/hyperlink.tex
added alpha support to wxCocoa, also fixed compilation after alpha changes hopefully
[wxWidgets.git] / docs / latex / wx / hyperlink.tex
CommitLineData
17e91437
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: hyperlink.tex
db67d86d 3%% Purpose: wxHyperlinkCtrl documentation
17e91437
VZ
4%% Author: Otto Wyss
5%% Modified by: Francesco Montorsi
6%% Created: 25.4.2004
7%% RCS-ID: $Id$
8%% Copyright: (c) 2004 wxCode, Francesco Montorsi
9%% License: wxWindows
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
db67d86d 12\section{\class{wxHyperlinkCtrl}}\label{wxhyperlinkctrl}
17e91437
VZ
13
14This class shows a static text element which links to an URL.
103791a6
WS
15Appearance and behaviour is completely customizable. In fact, when the user
16clicks on the hyperlink, a \helpref{wxHyperlinkEvent}{wxhyperlinkevent} is
17sent 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
20hyperlink's URL.
17e91437
VZ
21
22Note 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.
23
24
25\wxheading{Derived from}
26
2cc1457d
VZ
27\helpref{wxControl}{wxcontrol}\\
28\helpref{wxWindow}{wxwindow}\\
29\helpref{wxEvtHandler}{wxevthandler}\\
30\helpref{wxObject}{wxobject}
17e91437
VZ
31
32
33\wxheading{Include files}
34
35<wx/hyperlink.h>
36
37
38\wxheading{Window styles}
39
40\twocolwidtha{7cm}
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}.}
44\end{twocollist}
45
46See also \helpref{window styles overview}{windowstyles}.
47
48
49\wxheading{Event handling}
50
103791a6
WS
51To process input from an hyperlink control, use these event handler macros to
52direct input to member functions that take a
53\helpref{wxHyperlinkEvent}{wxhyperlinkevent} argument.
17e91437
VZ
54
55\twocolwidtha{7cm}
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.}
58\end{twocollist}
59
60
61\wxheading{See also}
62
103791a6 63\helpref{wxURL}{wxurl}, \helpref{wxHyperlinkEvent}{wxhyperlinkevent}
17e91437
VZ
64
65
66\latexignore{\rtfignore{\wxheading{Members}}}
67
db67d86d 68\membersection{wxHyperlinkCtrl::wxHyperLink}\label{wxhyperlinkctrlctor}
17e91437
VZ
69
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"}}
71
72Constructor. See \helpref{Create}{wxhyperlinkctrlcreate} for more info.
73
74
db67d86d 75\membersection{wxHyperlinkCtrl::Create}\label{wxhyperlinkctrlcreate}
17e91437 76
103791a6 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"}}
17e91437
VZ
78
79Creates the hyperlink control.
80
81\wxheading{Parameters}
82
83\docparam{parent}{Parent window. Must not be \NULL.}
84
98159dd8 85\docparam{id}{Window identifier. A value of wxID\_ANY indicates a default value.}
17e91437
VZ
86
87\docparam{label}{The label of the hyperlink.}
88
103791a6 89\docparam{url}{The URL associated with the given label.}
17e91437
VZ
90
91\docparam{pos}{Window position.}
92
98159dd8 93\docparam{size}{Window size. If the wxDefaultSize is specified then the window is sized
17e91437
VZ
94appropriately.}
95
96\docparam{style}{Window style. See \helpref{wxHyperlinkCtrl}{wxhyperlinkctrl}.}
97
98\docparam{validator}{Window validator.}
99
100\docparam{name}{Window name.}
101
102
db67d86d 103\membersection{wxHyperlinkCtrl::GetHoverColour}\label{wxhyperlinkctrlgethovercolour}
17e91437
VZ
104
105\constfunc{wxColour}{GetHoverColour}{\void}
106
107Returns the colour used to print the label of the hyperlink when the mouse is over the control.
108
109
db67d86d 110\membersection{wxHyperlinkCtrl::SetHoverColour}\label{wxhyperlinkctrlsethovercolour}
17e91437
VZ
111
112\func{void}{SetHoverColour}{\param{const wxColour \&}{ colour}}
113
114Sets the colour used to print the label of the hyperlink when the mouse is over the control.
115
116
db67d86d 117\membersection{wxHyperlinkCtrl::GetNormalColour}\label{wxhyperlinkctrlgetnormalcolour}
17e91437
VZ
118
119\constfunc{wxColour}{GetNormalColour}{\void}
120
121Returns 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.
123
124
db67d86d 125\membersection{wxHyperlinkCtrl::SetNormalColour}\label{wxhyperlinkctrlsetnormalcolour}
17e91437
VZ
126
127\func{void}{SetNormalColour}{\param{const wxColour \&}{ colour}}
128
129Sets 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.
131
132
db67d86d 133\membersection{wxHyperlinkCtrl::GetVisitedColour}\label{wxhyperlinkctrlgetvisitedcolour}
17e91437
VZ
134
135\constfunc{wxColour}{GetVisitedColour}{\void}
136
137Returns the colour used to print the label when the mouse is not over the control
138and the link has already been clicked before (i.e. the link has been {\it visited}).
139
140
db67d86d 141\membersection{wxHyperlinkCtrl::SetVisitedColour}\label{wxhyperlinkctrlsetvisitedcolour}
17e91437
VZ
142
143\func{void}{SetVisitedColour}{\param{const wxColour \&}{ colour}}
144
145Sets the colour used to print the label when the mouse is not over the control
146and the link has already been clicked before (i.e. the link has been {\it visited}).
147
148
db67d86d 149\membersection{wxHyperlinkCtrl::GetVisited}\label{wxhyperlinkctrlgetvisited}
17e91437
VZ
150
151\constfunc{bool}{GetVisited}{\void}
152
153Returns \true if the hyperlink has already been clicked by the user at least one time.
154
155
db67d86d 156\membersection{wxHyperlinkCtrl::SetVisited}\label{wxhyperlinkctrlsetvisited}
17e91437
VZ
157
158\func{void}{SetVisited}{\param{bool}{ visited = true}}
159
160Marks the hyperlink as visited (see \helpref{SetVisitedColour}{wxhyperlinkctrlsetvisitedcolour}).
161
162
db67d86d 163\membersection{wxHyperlinkCtrl::GetURL}\label{wxhyperlinkctrlgeturl}
17e91437
VZ
164
165\constfunc{wxString}{GetURL}{\void}
166
167Returns the URL associated with the hyperlink.
168
169
db67d86d 170\membersection{wxHyperlinkCtrl::SetURL}\label{wxhyperlinkctrlseturl}
17e91437
VZ
171
172\func{void}{SetURL}{\param{const wxString \&}{ url}}
173
174Sets the URL associated with the hyperlink.
175
176
177
178
179
180
103791a6 181\section{\class{wxHyperlinkEvent}}\label{wxhyperlinkevent}
17e91437
VZ
182
183This event class is used for the events generated by
184\helpref{wxHyperlinkCtrl}{wxhyperlinkctrl}.
185
186\wxheading{Derived from}
187
188\helpref{wxCommandEvent}{wxcommandevent}\\
189\helpref{wxEvent}{wxevent}\\
190\helpref{wxObject}{wxobject}
191
192\wxheading{Include files}
193
194<wx/hyperlink.h>
195
196\wxheading{Event handling}
197
198To process input from a wxHyperlinkCtrl, use one of these event handler macros to
199direct input to member function that take a
103791a6 200\helpref{wxHyperlinkEvent}{wxhyperlinkevent} argument:
17e91437
VZ
201
202\twocolwidtha{7cm}
203\begin{twocollist}
204\twocolitem{{\bf EVT\_HYPERLINK(id, func)}}{User clicked on an hyperlink.}
205\end{twocollist}
206
207
208\latexignore{\rtfignore{\wxheading{Members}}}
209
210\membersection{wxHyperlinkEvent::wxHyperlinkEvent}\label{wxhyperlinkctrlctor}
211
212\func{}{wxHyperlinkEvent}{\param{wxObject *}{ generator}, \param{int}{ id}, \param{const wxString \&}{ url}}
213
214The constructor is not normally used by the user code.
215
216
217\membersection{wxHyperlinkEvent::GetURL}\label{wxhyperlinkctrlgeturl}
218
219\constfunc{wxString}{GetURL}{\void}
220
221Returns the URL of the hyperlink where the user has just clicked.
222
223
224\membersection{wxHyperlinkEvent::SetURL}\label{wxhyperlinkctrlseturl}
225
226\func{void}{SetURL}{\param{const wxString \&}{ url}}
227
228Sets the URL associated with the event.