]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | MAKE_CONST_WXSTRING(HyperlinkCtrlNameStr); | |
19 | ||
20 | enum { | |
21 | wxHL_CONTEXTMENU, | |
22 | wxHL_ALIGN_LEFT, | |
23 | wxHL_ALIGN_RIGHT, | |
24 | wxHL_ALIGN_CENTRE, | |
25 | wxHL_DEFAULT_STYLE, | |
26 | }; | |
27 | ||
28 | //--------------------------------------------------------------------------- | |
29 | %newgroup | |
30 | ||
31 | ||
32 | MustHaveApp(wxHyperlinkCtrl); | |
33 | ||
34 | DocStr( wxHyperlinkCtrl, | |
35 | "A static text control that emulates a hyperlink. The link is displayed | |
36 | in an appropriate text style, derived from the control's normal font. | |
37 | When the mouse rolls over the link, the cursor changes to a hand and | |
38 | the link's color changes to the active color. | |
39 | ||
40 | Clicking on the link does not launch a web browser; instead, a | |
41 | wx.HyperlinkEvent is fired. Use the wx.EVT_HYPERLINK to catch link | |
42 | events. | |
43 | ", ""); | |
44 | ||
45 | class wxHyperlinkCtrl : public wxControl | |
46 | { | |
47 | public: | |
48 | %pythonAppend wxHyperlinkCtrl "self._setOORInfo(self)" | |
49 | %pythonAppend wxHyperlinkCtrl() "" | |
50 | ||
51 | ||
52 | // Constructor. | |
53 | wxHyperlinkCtrl(wxWindow *parent, | |
54 | wxWindowID id, | |
55 | const wxString& label, const wxString& url, | |
56 | const wxPoint& pos = wxDefaultPosition, | |
57 | const wxSize& size = wxDefaultSize, | |
58 | long style = wxHL_DEFAULT_STYLE, | |
59 | const wxString& name = wxPyHyperlinkCtrlNameStr); | |
60 | %RenameCtor(PreHyperlinkCtrl, wxHyperlinkCtrl()); | |
61 | ||
62 | // Creation function (for two-step construction). | |
63 | bool Create(wxWindow *parent, | |
64 | wxWindowID id, | |
65 | const wxString& label, const wxString& url, | |
66 | const wxPoint& pos = wxDefaultPosition, | |
67 | const wxSize& size = wxDefaultSize, | |
68 | long style = wxHL_DEFAULT_STYLE, | |
69 | const wxString& name = wxPyHyperlinkCtrlNameStr); | |
70 | ||
71 | // get/set | |
72 | wxColour GetHoverColour() const; | |
73 | void SetHoverColour(const wxColour &colour); | |
74 | ||
75 | wxColour GetNormalColour() const; | |
76 | void SetNormalColour(const wxColour &colour); | |
77 | ||
78 | wxColour GetVisitedColour() const; | |
79 | void SetVisitedColour(const wxColour &colour); | |
80 | ||
81 | wxString GetURL() const; | |
82 | void SetURL (const wxString &url); | |
83 | ||
84 | void SetVisited(bool visited = true); | |
85 | bool GetVisited() const; | |
86 | ||
87 | %property(HoverColour, GetHoverColour, SetHoverColour, doc="See `GetHoverColour` and `SetHoverColour`"); | |
88 | %property(NormalColour, GetNormalColour, SetNormalColour, doc="See `GetNormalColour` and `SetNormalColour`"); | |
89 | %property(URL, GetURL, SetURL, doc="See `GetURL` and `SetURL`"); | |
90 | %property(Visited, GetVisited, SetVisited, doc="See `GetVisited` and `SetVisited`"); | |
91 | %property(VisitedColour, GetVisitedColour, SetVisitedColour, doc="See `GetVisitedColour` and `SetVisitedColour`"); | |
92 | }; | |
93 | ||
94 | ||
95 | %constant wxEventType wxEVT_COMMAND_HYPERLINK; | |
96 | ||
97 | ||
98 | // | |
99 | // An event fired when the user clicks on the label in a hyperlink control. | |
100 | // See HyperlinkControl for details. | |
101 | // | |
102 | class wxHyperlinkEvent : public wxCommandEvent | |
103 | { | |
104 | public: | |
105 | ||
106 | wxHyperlinkEvent(wxObject *generator, wxWindowID id, const wxString& url); | |
107 | ||
108 | // Returns the URL associated with the hyperlink control | |
109 | // that the user clicked on. | |
110 | wxString GetURL() const; | |
111 | void SetURL(const wxString &url); | |
112 | ||
113 | %property(URL, GetURL, SetURL, doc="See `GetURL` and `SetURL`"); | |
114 | }; | |
115 | ||
116 | ||
117 | %pythoncode { | |
118 | EVT_HYPERLINK = wx.PyEventBinder( wxEVT_COMMAND_HYPERLINK, 1 ) | |
119 | } | |
120 | ||
121 | ||
122 | ||
123 | //--------------------------------------------------------------------------- | |
124 | //--------------------------------------------------------------------------- |