]>
Commit | Line | Data |
---|---|---|
d0e2ede0 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _hyperlink.i | |
3 | // Purpose: SWIG interface defs for wxHyperlinkCtrl | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 28-May-2006 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2006 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | ||
d0e2ede0 RD |
18 | MAKE_CONST_WXSTRING(HyperlinkCtrlNameStr); |
19 | ||
20 | enum { | |
21 | wxHL_CONTEXTMENU, | |
22 | wxHL_DEFAULT_STYLE | |
23 | }; | |
24 | ||
25 | //--------------------------------------------------------------------------- | |
26 | %newgroup | |
27 | ||
28 | MustHaveApp(wxHyperlinkCtrl); | |
29 | ||
30 | ||
31 | DocStr( wxHyperlinkCtrl, | |
32 | "A static text control that emulates a hyperlink. The link is displayed | |
33 | in an appropriate text style, derived from the control's normal font. | |
34 | When the mouse rolls over the link, the cursor changes to a hand and | |
35 | the link's color changes to the active color. | |
36 | ||
37 | Clicking on the link does not launch a web browser; instead, a | |
38 | wx.HyperlinkEvent is fired. Use the wx.EVT_HYPERLINK to catch link | |
39 | events. | |
40 | ", ""); | |
41 | ||
42 | class wxHyperlinkCtrl : public wxControl | |
43 | { | |
44 | public: | |
45 | %pythonAppend wxHyperlinkCtrl "self._setOORInfo(self)" | |
46 | %pythonAppend wxHyperlinkCtrl() "" | |
47 | ||
48 | ||
49 | // Constructor. | |
50 | wxHyperlinkCtrl(wxWindow *parent, | |
51 | wxWindowID id, | |
52 | const wxString& label, const wxString& url, | |
53 | const wxPoint& pos = wxDefaultPosition, | |
54 | const wxSize& size = wxDefaultSize, | |
55 | long style = wxHL_DEFAULT_STYLE, | |
56 | const wxString& name = wxPyHyperlinkCtrlNameStr); | |
57 | %RenameCtor(PreHyperlinkCtrl, wxHyperlinkCtrl()); | |
58 | ||
59 | // Creation function (for two-step construction). | |
60 | bool Create(wxWindow *parent, | |
61 | wxWindowID id, | |
62 | const wxString& label, const wxString& url, | |
63 | const wxPoint& pos = wxDefaultPosition, | |
64 | const wxSize& size = wxDefaultSize, | |
65 | long style = wxHL_DEFAULT_STYLE, | |
66 | const wxString& name = wxPyHyperlinkCtrlNameStr); | |
67 | ||
68 | // get/set | |
69 | wxColour GetHoverColour() const; | |
70 | void SetHoverColour(const wxColour &colour); | |
71 | ||
72 | wxColour GetNormalColour() const; | |
73 | void SetNormalColour(const wxColour &colour); | |
74 | ||
75 | wxColour GetVisitedColour() const; | |
76 | void SetVisitedColour(const wxColour &colour); | |
77 | ||
78 | wxString GetURL() const; | |
79 | void SetURL (const wxString &url); | |
80 | ||
81 | void SetVisited(bool visited = true); | |
82 | bool GetVisited() const; | |
83 | ||
84 | }; | |
85 | ||
86 | ||
87 | %constant wxEventType wxEVT_COMMAND_HYPERLINK; | |
88 | ||
89 | ||
90 | // | |
91 | // An event fired when the user clicks on the label in a hyperlink control. | |
92 | // See HyperlinkControl for details. | |
93 | // | |
94 | class wxHyperlinkEvent : public wxCommandEvent | |
95 | { | |
96 | public: | |
97 | ||
98 | wxHyperlinkEvent(wxObject *generator, wxWindowID id, const wxString& url); | |
99 | ||
100 | // Returns the URL associated with the hyperlink control | |
101 | // that the user clicked on. | |
102 | wxString GetURL() const; | |
103 | void SetURL(const wxString &url); | |
104 | }; | |
105 | ||
106 | ||
107 | %pythoncode { | |
108 | EVT_HYPERLINK = wx.PyEventBinder( wxEVT_COMMAND_HYPERLINK, 1 ) | |
109 | } | |
110 | ||
111 | ||
112 | ||
113 | //--------------------------------------------------------------------------- | |
114 | //--------------------------------------------------------------------------- |