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