]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/hyperlink.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxHyperlinkEvent
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxHyperlinkEvent
12 This event class is used for the events generated by
18 class wxHyperlinkEvent
: public wxCommandEvent
22 The constructor is not normally used by the user code.
24 wxHyperlinkEvent(wxObject
* generator
, int id
,
28 Returns the URL of the hyperlink where the user has just clicked.
30 wxString
GetURL() const;
33 Sets the URL associated with the event.
35 void SetURL(const wxString
& url
);
41 @class wxHyperlinkCtrl
43 This class shows a static text element which links to an URL.
44 Appearance and behaviour is completely customizable. In fact, when the user
45 clicks on the hyperlink, a wxHyperlinkEvent is
46 sent but if that event is not handled (or it's skipped; see
47 wxEvent::Skip), then a call to
48 wxLaunchDefaultBrowser() is done with the
51 Note that standard wxWindow functions like wxWindow::SetBackgroundColour,
52 wxWindow::SetFont, wxWindow::SetCursor, wxWindow::SetLabel can be used to customize appearance of the hyperlink.
55 @style{wxHL_ALIGN_LEFT}
56 Align the text to the left.
57 @style{wxHL_ALIGN_RIGHT}
58 Align the text to the right.
59 @style{wxHL_ALIGN_CENTRE}
60 Center the text (horizontally).
61 @style{wxHL_CONTEXTMENU}
62 Pop up a context menu when the hyperlink is right-clicked. The
63 context menu contains a "Copy URL" menu item which is automatically
64 handled by the hyperlink and which just copies in the clipboard the
65 URL (not the label) of the control.
66 @style{wxHL_DEFAULT_STYLE}
67 The default style for wxHyperlinkCtrl:
68 wxBORDER_NONE|wxHL_CONTEXTMENU|wxHL_ALIGN_CENTRE.
73 <!-- @appearance{hyperlinkctrl.png} -->
75 @see wxURL, wxHyperlinkEvent
77 class wxHyperlinkCtrl
: public wxControl
81 Constructor. See Create() for more info.
83 wxHyperLink(wxWindow
* parent
, wxWindowID id
,
84 const wxString
& label
,
86 const wxPoint
& pos
= wxDefaultPosition
,
87 const wxSize
& size
= wxDefaultSize
,
88 long style
= wxHL_DEFAULT_STYLE
,
89 const wxString
& name
= "hyperlink");
92 Creates the hyperlink control.
95 Parent window. Must not be @NULL.
97 Window identifier. A value of wxID_ANY indicates a default value.
99 The label of the hyperlink.
101 The URL associated with the given label.
105 Window size. If the wxDefaultSize is specified then the window is sized
108 Window style. See wxHyperlinkCtrl.
114 bool Create(wxWindow
* parent
, wxWindowID id
,
115 const wxString
& label
,
117 const wxPoint
& pos
= wxDefaultPosition
,
118 const wxSize
& size
= wxDefaultSize
,
119 long style
= wxHL_DEFAULT_STYLE
,
120 const wxString
& name
= "hyperlink");
123 Returns the colour used to print the label of the hyperlink when the mouse is
126 wxColour
GetHoverColour() const;
129 Returns the colour used to print the label when the link has never been clicked
131 (i.e. the link has not been @e visited) and the mouse is not over the control.
133 wxColour
GetNormalColour() const;
136 Returns the URL associated with the hyperlink.
138 wxString
GetURL() const;
141 Returns @true if the hyperlink has already been clicked by the user at least
144 virtual bool GetVisited() const = 0;
147 Returns the colour used to print the label when the mouse is not over the
149 and the link has already been clicked before (i.e. the link has been @e
152 wxColour
GetVisitedColour() const;
155 Sets the colour used to print the label of the hyperlink when the mouse is over
158 void SetHoverColour(const wxColour
& colour
);
161 Sets the colour used to print the label when the link has never been clicked
163 (i.e. the link has not been @e visited) and the mouse is not over the control.
165 void SetNormalColour(const wxColour
& colour
);
168 Sets the URL associated with the hyperlink.
170 void SetURL(const wxString
& url
);
173 Marks the hyperlink as visited (see wxHyperlinkCtrl::SetVisitedColour).
175 virtual void SetVisited(bool visited
= true) = 0;
178 Sets the colour used to print the label when the mouse is not over the control
179 and the link has already been clicked before (i.e. the link has been @e
182 void SetVisitedColour(const wxColour
& colour
);