]>
git.saurik.com Git - wxWidgets.git/blob - interface/hyperlink.h
5421ca0e0c07f7f4148b7035f4022664f13ba73b
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxHyperlinkEvent
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxHyperlinkEvent
11 @wxheader{hyperlink.h}
13 This event class is used for the events generated by
19 class wxHyperlinkEvent
: public wxCommandEvent
23 The constructor is not normally used by the user code.
25 wxHyperlinkEvent(wxObject
* generator
, int id
,
29 Returns the URL of the hyperlink where the user has just clicked.
31 wxString
GetURL() const;
34 Sets the URL associated with the event.
36 void SetURL(const wxString
& url
);
42 @class wxHyperlinkCtrl
43 @wxheader{hyperlink.h}
45 This class shows a static text element which links to an URL.
46 Appearance and behaviour is completely customizable. In fact, when the user
47 clicks on the hyperlink, a wxHyperlinkEvent is
48 sent but if that event is not handled (or it's skipped; see
49 wxEvent::Skip), then a call to
50 wxLaunchDefaultBrowser() is done with the
53 Note that standard wxWindow functions like wxWindow::SetBackgroundColour,
54 wxWindow::SetFont, wxWindow::SetCursor, wxWindow::SetLabel can be used to customize appearance of the hyperlink.
57 @style{wxHL_ALIGN_LEFT}:
58 Align the text to the left.
59 @style{wxHL_ALIGN_RIGHT}:
60 Align the text to the right.
61 @style{wxHL_ALIGN_CENTRE}:
62 Center the text (horizontally).
63 @style{wxHL_CONTEXTMENU}:
64 Pop up a context menu when the hyperlink is right-clicked. The
65 context menu contains a "Copy URL" menu item which is automatically
66 handled by the hyperlink and which just copies in the clipboard the
67 URL (not the label) of the control.
68 @style{wxHL_DEFAULT_STYLE}:
69 The default style for wxHyperlinkCtrl:
70 wxBORDER_NONE|wxHL_CONTEXTMENU|wxHL_ALIGN_CENTRE.
75 @appearance{hyperlinkctrl.png}
77 @see wxURL, wxHyperlinkEvent
79 class wxHyperlinkCtrl
: public wxControl
83 Creates the hyperlink control.
86 Parent window. Must not be @NULL.
88 Window identifier. A value of wxID_ANY indicates a default value.
90 The label of the hyperlink.
92 The URL associated with the given label.
96 Window size. If the wxDefaultSize is specified then the window is sized
99 Window style. See wxHyperlinkCtrl.
105 bool Create(wxWindow
* parent
, wxWindowID id
,
106 const wxString
& label
,
108 const wxPoint
& pos
= wxDefaultPosition
,
109 const wxSize
& size
= wxDefaultSize
,
111 const wxString
& name
= "hyperlink");
114 Returns the colour used to print the label of the hyperlink when the mouse is
117 wxColour
GetHoverColour() const;
120 Returns the colour used to print the label when the link has never been clicked
122 (i.e. the link has not been @e visited) and the mouse is not over the control.
124 wxColour
GetNormalColour() const;
127 Returns the URL associated with the hyperlink.
129 wxString
GetURL() const;
132 Returns @true if the hyperlink has already been clicked by the user at least
135 bool GetVisited() const;
138 Returns the colour used to print the label when the mouse is not over the
140 and the link has already been clicked before (i.e. the link has been @e
143 wxColour
GetVisitedColour() const;
146 Sets the colour used to print the label of the hyperlink when the mouse is over
149 void SetHoverColour(const wxColour
& colour
);
152 Sets the colour used to print the label when the link has never been clicked
154 (i.e. the link has not been @e visited) and the mouse is not over the control.
156 void SetNormalColour(const wxColour
& colour
);
159 Sets the URL associated with the hyperlink.
161 void SetURL(const wxString
& url
);
164 Marks the hyperlink as visited (see wxHyperlinkCtrl::SetVisitedColour).
166 void SetVisited(bool visited
= true);
169 Sets the colour used to print the label when the mouse is not over the control
170 and the link has already been clicked before (i.e. the link has been @e
173 void SetVisitedColour(const wxColour
& colour
);
176 Constructor. See Create() for more info.
178 wxHyperLink(wxWindow
* parent
, wxWindowID id
,
179 const wxString
& label
,
181 const wxPoint
& pos
= wxDefaultPosition
,
182 const wxSize
& size
= wxDefaultSize
,
184 const wxString
& name
= "hyperlink");