]>
git.saurik.com Git - wxWidgets.git/blob - interface/hyperlink.h
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 Constructor. See Create() for more info.
85 wxHyperLink(wxWindow
* parent
, wxWindowID id
,
86 const wxString
& label
,
88 const wxPoint
& pos
= wxDefaultPosition
,
89 const wxSize
& size
= wxDefaultSize
,
90 long style
= wxHL_DEFAULT_STYLE
,
91 const wxString
& name
= "hyperlink");
94 Creates the hyperlink control.
97 Parent window. Must not be @NULL.
99 Window identifier. A value of wxID_ANY indicates a default value.
101 The label of the hyperlink.
103 The URL associated with the given label.
107 Window size. If the wxDefaultSize is specified then the window is sized
110 Window style. See wxHyperlinkCtrl.
116 bool Create(wxWindow
* parent
, wxWindowID id
,
117 const wxString
& label
,
119 const wxPoint
& pos
= wxDefaultPosition
,
120 const wxSize
& size
= wxDefaultSize
,
121 long style
= wxHL_DEFAULT_STYLE
,
122 const wxString
& name
= "hyperlink");
125 Returns the colour used to print the label of the hyperlink when the mouse is
128 wxColour
GetHoverColour() const;
131 Returns the colour used to print the label when the link has never been clicked
133 (i.e. the link has not been @e visited) and the mouse is not over the control.
135 wxColour
GetNormalColour() const;
138 Returns the URL associated with the hyperlink.
140 wxString
GetURL() const;
143 Returns @true if the hyperlink has already been clicked by the user at least
146 virtual bool GetVisited() const = 0;
149 Returns the colour used to print the label when the mouse is not over the
151 and the link has already been clicked before (i.e. the link has been @e
154 wxColour
GetVisitedColour() const;
157 Sets the colour used to print the label of the hyperlink when the mouse is over
160 void SetHoverColour(const wxColour
& colour
);
163 Sets the colour used to print the label when the link has never been clicked
165 (i.e. the link has not been @e visited) and the mouse is not over the control.
167 void SetNormalColour(const wxColour
& colour
);
170 Sets the URL associated with the hyperlink.
172 void SetURL(const wxString
& url
);
175 Marks the hyperlink as visited (see wxHyperlinkCtrl::SetVisitedColour).
177 virtual void SetVisited(bool visited
= true) = 0;
180 Sets the colour used to print the label when the mouse is not over the control
181 and the link has already been clicked before (i.e. the link has been @e
184 void SetVisitedColour(const wxColour
& colour
);