]>
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 | ||
76b8fa1d RD |
84 | %property(HoverColour, GetHoverColour, SetHoverColour, doc="See `GetHoverColour` and `SetHoverColour`"); |
85 | %property(NormalColour, GetNormalColour, SetNormalColour, doc="See `GetNormalColour` and `SetNormalColour`"); | |
86 | %property(URL, GetURL, SetURL, doc="See `GetURL` and `SetURL`"); | |
87 | %property(Visited, GetVisited, SetVisited, doc="See `GetVisited` and `SetVisited`"); | |
88 | %property(VisitedColour, GetVisitedColour, SetVisitedColour, doc="See `GetVisitedColour` and `SetVisitedColour`"); | |
d0e2ede0 RD |
89 | }; |
90 | ||
91 | ||
92 | %constant wxEventType wxEVT_COMMAND_HYPERLINK; | |
93 | ||
94 | ||
95 | // | |
96 | // An event fired when the user clicks on the label in a hyperlink control. | |
97 | // See HyperlinkControl for details. | |
98 | // | |
99 | class wxHyperlinkEvent : public wxCommandEvent | |
100 | { | |
101 | public: | |
102 | ||
103 | wxHyperlinkEvent(wxObject *generator, wxWindowID id, const wxString& url); | |
104 | ||
105 | // Returns the URL associated with the hyperlink control | |
106 | // that the user clicked on. | |
107 | wxString GetURL() const; | |
108 | void SetURL(const wxString &url); | |
76b8fa1d RD |
109 | |
110 | %property(URL, GetURL, SetURL, doc="See `GetURL` and `SetURL`"); | |
d0e2ede0 RD |
111 | }; |
112 | ||
113 | ||
114 | %pythoncode { | |
115 | EVT_HYPERLINK = wx.PyEventBinder( wxEVT_COMMAND_HYPERLINK, 1 ) | |
116 | } | |
117 | ||
118 | ||
119 | ||
120 | //--------------------------------------------------------------------------- | |
121 | //--------------------------------------------------------------------------- |