]>
Commit | Line | Data |
---|---|---|
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
2 | %% Name: hyperlink.tex | |
3 | %% Purpose: wxHyperlinkCtrl documentation | |
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 | ||
12 | \section{\class{wxHyperlinkCtrl}}\label{wxhyperlinkctrl} | |
13 | ||
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 | |
20 | hyperlink's URL. | |
21 | ||
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. | |
23 | ||
24 | ||
25 | \wxheading{Derived from} | |
26 | ||
27 | \helpref{wxControl}{wxcontrol}\\ | |
28 | \helpref{wxWindow}{wxwindow}\\ | |
29 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
30 | \helpref{wxObject}{wxobject} | |
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 | ||
46 | See also \helpref{window styles overview}{windowstyles}. | |
47 | ||
48 | ||
49 | \wxheading{Event handling} | |
50 | ||
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. | |
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 | ||
63 | \helpref{wxURL}{wxurl}, \helpref{wxHyperlinkEvent}{wxhyperlinkevent} | |
64 | ||
65 | ||
66 | \latexignore{\rtfignore{\wxheading{Members}}} | |
67 | ||
68 | \membersection{wxHyperlinkCtrl::wxHyperLink}\label{wxhyperlinkctrlctor} | |
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 | ||
72 | Constructor. See \helpref{Create}{wxhyperlinkctrlcreate} for more info. | |
73 | ||
74 | ||
75 | \membersection{wxHyperlinkCtrl::Create}\label{wxhyperlinkctrlcreate} | |
76 | ||
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"}} | |
78 | ||
79 | Creates the hyperlink control. | |
80 | ||
81 | \wxheading{Parameters} | |
82 | ||
83 | \docparam{parent}{Parent window. Must not be \NULL.} | |
84 | ||
85 | \docparam{id}{Window identifier. A value of wxID\_ANY indicates a default value.} | |
86 | ||
87 | \docparam{label}{The label of the hyperlink.} | |
88 | ||
89 | \docparam{url}{The URL associated with the given label.} | |
90 | ||
91 | \docparam{pos}{Window position.} | |
92 | ||
93 | \docparam{size}{Window size. If the wxDefaultSize is specified then the window is sized | |
94 | appropriately.} | |
95 | ||
96 | \docparam{style}{Window style. See \helpref{wxHyperlinkCtrl}{wxhyperlinkctrl}.} | |
97 | ||
98 | \docparam{validator}{Window validator.} | |
99 | ||
100 | \docparam{name}{Window name.} | |
101 | ||
102 | ||
103 | \membersection{wxHyperlinkCtrl::GetHoverColour}\label{wxhyperlinkctrlgethovercolour} | |
104 | ||
105 | \constfunc{wxColour}{GetHoverColour}{\void} | |
106 | ||
107 | Returns the colour used to print the label of the hyperlink when the mouse is over the control. | |
108 | ||
109 | ||
110 | \membersection{wxHyperlinkCtrl::SetHoverColour}\label{wxhyperlinkctrlsethovercolour} | |
111 | ||
112 | \func{void}{SetHoverColour}{\param{const wxColour \&}{ colour}} | |
113 | ||
114 | Sets the colour used to print the label of the hyperlink when the mouse is over the control. | |
115 | ||
116 | ||
117 | \membersection{wxHyperlinkCtrl::GetNormalColour}\label{wxhyperlinkctrlgetnormalcolour} | |
118 | ||
119 | \constfunc{wxColour}{GetNormalColour}{\void} | |
120 | ||
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. | |
123 | ||
124 | ||
125 | \membersection{wxHyperlinkCtrl::SetNormalColour}\label{wxhyperlinkctrlsetnormalcolour} | |
126 | ||
127 | \func{void}{SetNormalColour}{\param{const wxColour \&}{ colour}} | |
128 | ||
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. | |
131 | ||
132 | ||
133 | \membersection{wxHyperlinkCtrl::GetVisitedColour}\label{wxhyperlinkctrlgetvisitedcolour} | |
134 | ||
135 | \constfunc{wxColour}{GetVisitedColour}{\void} | |
136 | ||
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}). | |
139 | ||
140 | ||
141 | \membersection{wxHyperlinkCtrl::SetVisitedColour}\label{wxhyperlinkctrlsetvisitedcolour} | |
142 | ||
143 | \func{void}{SetVisitedColour}{\param{const wxColour \&}{ colour}} | |
144 | ||
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}). | |
147 | ||
148 | ||
149 | \membersection{wxHyperlinkCtrl::GetVisited}\label{wxhyperlinkctrlgetvisited} | |
150 | ||
151 | \constfunc{bool}{GetVisited}{\void} | |
152 | ||
153 | Returns \true if the hyperlink has already been clicked by the user at least one time. | |
154 | ||
155 | ||
156 | \membersection{wxHyperlinkCtrl::SetVisited}\label{wxhyperlinkctrlsetvisited} | |
157 | ||
158 | \func{void}{SetVisited}{\param{bool}{ visited = true}} | |
159 | ||
160 | Marks the hyperlink as visited (see \helpref{SetVisitedColour}{wxhyperlinkctrlsetvisitedcolour}). | |
161 | ||
162 | ||
163 | \membersection{wxHyperlinkCtrl::GetURL}\label{wxhyperlinkctrlgeturl} | |
164 | ||
165 | \constfunc{wxString}{GetURL}{\void} | |
166 | ||
167 | Returns the URL associated with the hyperlink. | |
168 | ||
169 | ||
170 | \membersection{wxHyperlinkCtrl::SetURL}\label{wxhyperlinkctrlseturl} | |
171 | ||
172 | \func{void}{SetURL}{\param{const wxString \&}{ url}} | |
173 | ||
174 | Sets the URL associated with the hyperlink. | |
175 | ||
176 | ||
177 | ||
178 | ||
179 | ||
180 | ||
181 | \section{\class{wxHyperlinkEvent}}\label{wxhyperlinkevent} | |
182 | ||
183 | This 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 | ||
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: | |
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 | ||
214 | The constructor is not normally used by the user code. | |
215 | ||
216 | ||
217 | \membersection{wxHyperlinkEvent::GetURL}\label{wxhyperlinkctrlgeturl} | |
218 | ||
219 | \constfunc{wxString}{GetURL}{\void} | |
220 | ||
221 | Returns 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 | ||
228 | Sets the URL associated with the event. |