]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_hyperlink.i
A patch from Frame Niessink which adds an additional style that
[wxWidgets.git] / wxPython / src / _hyperlink.i
CommitLineData
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
18MAKE_CONST_WXSTRING(HyperlinkCtrlNameStr);
19
20enum {
21 wxHL_CONTEXTMENU,
6517912d
RD
22 wxHL_ALIGN_LEFT,
23 wxHL_ALIGN_RIGHT,
24 wxHL_ALIGN_CENTRE,
25 wxHL_DEFAULT_STYLE,
d0e2ede0
RD
26};
27
28//---------------------------------------------------------------------------
29%newgroup
30
d0e2ede0 31
6517912d 32MustHaveApp(wxHyperlinkCtrl);
d0e2ede0
RD
33
34DocStr( wxHyperlinkCtrl,
35"A static text control that emulates a hyperlink. The link is displayed
36in an appropriate text style, derived from the control's normal font.
37When the mouse rolls over the link, the cursor changes to a hand and
38the link's color changes to the active color.
39
40Clicking on the link does not launch a web browser; instead, a
41wx.HyperlinkEvent is fired. Use the wx.EVT_HYPERLINK to catch link
42events.
43", "");
44
45class wxHyperlinkCtrl : public wxControl
46{
47public:
48 %pythonAppend wxHyperlinkCtrl "self._setOORInfo(self)"
49 %pythonAppend wxHyperlinkCtrl() ""
50
6517912d 51
d0e2ede0
RD
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
76b8fa1d
RD
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`");
d0e2ede0
RD
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//
102class wxHyperlinkEvent : public wxCommandEvent
103{
104public:
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);
76b8fa1d
RD
112
113 %property(URL, GetURL, SetURL, doc="See `GetURL` and `SetURL`");
d0e2ede0
RD
114};
115
116
117%pythoncode {
118 EVT_HYPERLINK = wx.PyEventBinder( wxEVT_COMMAND_HYPERLINK, 1 )
119}
120
121
122
123//---------------------------------------------------------------------------
124//---------------------------------------------------------------------------