]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_taskbar.i
Allow the OOR reference to be saved without doing an INCREF. This
[wxWidgets.git] / wxPython / src / _taskbar.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _taskbar.i
3 // Purpose: SWIG interface defs for wxTaskBarIcon
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 2-June-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17
18 %{
19 %}
20
21 //---------------------------------------------------------------------------
22 %newgroup;
23
24
25 %{
26 #ifndef wxHAS_TASK_BAR_ICON
27 // implement dummy classes for platforms that don't have it
28
29 class wxTaskBarIcon : public wxEvtHandler
30 {
31 public:
32 wxTaskBarIcon() { wxPyRaiseNotImplemented(); }
33 };
34
35
36 class wxTaskBarIconEvent : public wxEvent
37 {
38 public:
39 wxTaskBarIconEvent(wxEventType, wxTaskBarIcon *)
40 { wxPyRaiseNotImplemented(); }
41 virtual wxEvent* Clone() const { return NULL; }
42 bool IsOk() const { return false; }
43 bool IsIconInstalled() const { return false; }
44 bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString) { return false; }
45 bool RemoveIcon() { return false; }
46 bool PopupMenu(wxMenu *menu) { return false; }
47 };
48
49 enum {
50 wxEVT_TASKBAR_MOVE = 0,
51 wxEVT_TASKBAR_LEFT_DOWN = 0,
52 wxEVT_TASKBAR_LEFT_UP = 0,
53 wxEVT_TASKBAR_RIGHT_DOWN = 0,
54 wxEVT_TASKBAR_RIGHT_UP = 0,
55 wxEVT_TASKBAR_LEFT_DCLICK = 0,
56 wxEVT_TASKBAR_RIGHT_DCLICK = 0,
57 };
58
59
60 #else
61 // Otherwise make a class that can virtualize CreatePopupMenu
62 class wxPyTaskBarIcon : public wxTaskBarIcon
63 {
64 DECLARE_ABSTRACT_CLASS(wxPyTaskBarIcon);
65 public:
66 wxPyTaskBarIcon() : wxTaskBarIcon()
67 {}
68
69 wxMenu* CreatePopupMenu() {
70 wxMenu *rval = NULL;
71 bool found;
72 bool blocked = wxPyBeginBlockThreads();
73 if ((found = wxPyCBH_findCallback(m_myInst, "CreatePopupMenu"))) {
74 PyObject* ro;
75 wxMenu* ptr;
76 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
77 if (ro) {
78 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxMenu")))
79 rval = ptr;
80 Py_DECREF(ro);
81 }
82 }
83 wxPyEndBlockThreads(blocked);
84 if (! found)
85 rval = wxTaskBarIcon::CreatePopupMenu();
86 return rval;
87 }
88
89 PYPRIVATE;
90 };
91
92 IMPLEMENT_ABSTRACT_CLASS(wxPyTaskBarIcon, wxTaskBarIcon);
93
94 #endif
95 %}
96
97
98 MustHaveApp(wxPyTaskBarIcon);
99
100 %name(TaskBarIcon)class wxPyTaskBarIcon : public wxEvtHandler
101 {
102 public:
103 %pythonAppend wxPyTaskBarIcon "self._setCallbackInfo(self, TaskBarIcon, 0)"
104
105 wxPyTaskBarIcon();
106
107 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref);
108
109 %extend {
110 void Destroy() {
111 self->RemoveIcon();
112 delete self;
113 }
114 }
115
116 bool IsOk() const;
117 %pythoncode { def __nonzero__(self): return self.IsOk() }
118
119 bool IsIconInstalled() const;
120
121 bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString);
122 bool RemoveIcon();
123 bool PopupMenu(wxMenu *menu);
124 };
125
126
127
128 class wxTaskBarIconEvent : public wxEvent
129 {
130 public:
131 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon);
132 };
133
134
135
136 %constant wxEventType wxEVT_TASKBAR_MOVE;
137 %constant wxEventType wxEVT_TASKBAR_LEFT_DOWN;
138 %constant wxEventType wxEVT_TASKBAR_LEFT_UP;
139 %constant wxEventType wxEVT_TASKBAR_RIGHT_DOWN;
140 %constant wxEventType wxEVT_TASKBAR_RIGHT_UP;
141 %constant wxEventType wxEVT_TASKBAR_LEFT_DCLICK;
142 %constant wxEventType wxEVT_TASKBAR_RIGHT_DCLICK;
143
144
145 %pythoncode {
146 EVT_TASKBAR_MOVE = wx.PyEventBinder ( wxEVT_TASKBAR_MOVE )
147 EVT_TASKBAR_LEFT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DOWN )
148 EVT_TASKBAR_LEFT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_UP )
149 EVT_TASKBAR_RIGHT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DOWN )
150 EVT_TASKBAR_RIGHT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_UP )
151 EVT_TASKBAR_LEFT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DCLICK )
152 EVT_TASKBAR_RIGHT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DCLICK )
153 }
154
155 //---------------------------------------------------------------------------