]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_taskbar.i
This workaround is no longer needed because of fix in
[wxWidgets.git] / wxPython / src / _taskbar.i
CommitLineData
d14a1e28
RD
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#ifdef __WXMAC__
27// implement dummy classes and such for wxMac
28
29class wxTaskBarIcon : public wxEvtHandler
30{
31public:
81cfe5e1 32 wxTaskBarIcon() { wxPyRaiseNotImplemented(); }
d14a1e28 33};
b8400a3a 34
d14a1e28
RD
35
36class wxTaskBarIconEvent : public wxEvent
37{
38public:
39 wxTaskBarIconEvent(wxEventType, wxTaskBarIcon *)
81cfe5e1 40 { wxPyRaiseNotImplemented(); }
d14a1e28
RD
41 virtual wxEvent* Clone() const { return NULL; }
42};
43
44enum {
45 wxEVT_TASKBAR_MOVE = 0,
46 wxEVT_TASKBAR_LEFT_DOWN = 0,
47 wxEVT_TASKBAR_LEFT_UP = 0,
48 wxEVT_TASKBAR_RIGHT_DOWN = 0,
49 wxEVT_TASKBAR_RIGHT_UP = 0,
50 wxEVT_TASKBAR_LEFT_DCLICK = 0,
51 wxEVT_TASKBAR_RIGHT_DCLICK = 0,
52};
b8400a3a
RD
53
54
55#else
56// // Otherwise make a class that can virtualize CreatePopupMenu
57// class wxPyTaskBarIcon : public wxTaskBarIcon
58// {
59// DECLARE_ABSTRACT_CLASS(wxPyTaskBarIcon);
60// public:
61// wxPyTaskBarIcon() : wxTaskBarIcon()
62// {}
63
64// wxMenu* CreatePopupMenu() {
65// wxMenu *rval = NULL;
66// bool found;
67// bool blocked = wxPyBeginBlockThreads();
68// if ((found = wxPyCBH_findCallback(m_myInst, "CreatePopupMenu"))) {
69// PyObject* ro;
70// wxMenu* ptr;
71// ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
72// if (ro) {
73// if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxMenu")))
74// rval = ptr;
75// Py_DECREF(ro);
76// }
77// }
78// wxPyEndBlockThreads(blocked);
79// if (! found)
80// rval = wxTaskBarIcon::CreatePopupMenu();
81// return rval;
82// }
83
84// PYPRIVATE;
85// };
86
87// IMPLEMENT_ABSTRACT_CLASS(wxPyTaskBarIcon, wxTaskBarIcon);
88
d14a1e28
RD
89#endif
90%}
91
92
b8400a3a
RD
93// NOTE: TaskbarIcon has not yet been changed to be able to virtualize the
94// CreatePopupMenu method because it is just before a release and I worry that
95// there will be a problem in this case with it holding a reference to itself
96// (since it depends on the dtor for cleanup.) Better safe than sorry!
97//
98// Perhaps a better mechanism for wxPython woudl be to turn CreatePopupMenu
99// into an event...
d14a1e28 100
ab1f7d2a
RD
101MustHaveApp(wxTaskBarIcon);
102
d14a1e28
RD
103class wxTaskBarIcon : public wxEvtHandler
104{
105public:
106 wxTaskBarIcon();
107 ~wxTaskBarIcon();
33e10b88
RD
108
109 %extend {
110 void Destroy() {
111 #ifndef __WXMAC__
112 self->RemoveIcon();
113 #endif
114 }
115 }
d14a1e28
RD
116
117#ifndef __WXMAC__
118 bool IsOk() const;
e0269b2e 119 %pythoncode { def __nonzero__(self): return self.IsOk() }
b8400a3a 120
d14a1e28
RD
121 bool IsIconInstalled() const;
122
123 bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString);
b8400a3a 124 bool RemoveIcon();
d14a1e28
RD
125 bool PopupMenu(wxMenu *menu);
126#endif
127};
128
129
130
131class wxTaskBarIconEvent : public wxEvent
132{
133public:
134 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon);
135};
136
137
138
139%constant wxEventType wxEVT_TASKBAR_MOVE;
140%constant wxEventType wxEVT_TASKBAR_LEFT_DOWN;
141%constant wxEventType wxEVT_TASKBAR_LEFT_UP;
142%constant wxEventType wxEVT_TASKBAR_RIGHT_DOWN;
143%constant wxEventType wxEVT_TASKBAR_RIGHT_UP;
144%constant wxEventType wxEVT_TASKBAR_LEFT_DCLICK;
145%constant wxEventType wxEVT_TASKBAR_RIGHT_DCLICK;
146
147
148%pythoncode {
149EVT_TASKBAR_MOVE = wx.PyEventBinder ( wxEVT_TASKBAR_MOVE )
150EVT_TASKBAR_LEFT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DOWN )
151EVT_TASKBAR_LEFT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_UP )
152EVT_TASKBAR_RIGHT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DOWN )
153EVT_TASKBAR_RIGHT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_UP )
154EVT_TASKBAR_LEFT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DCLICK )
155EVT_TASKBAR_RIGHT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DCLICK )
b8400a3a 156}
d14a1e28
RD
157
158//---------------------------------------------------------------------------