]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_taskbar.i
Allow for Cmd-click on wxMac
[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 #ifdef __WXMAC__
27 // implement dummy classes and such for wxMac
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 };
43
44 enum {
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 };
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
89 #endif
90 %}
91
92
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...
100
101 MustHaveApp(wxTaskBarIcon);
102
103 class wxTaskBarIcon : public wxEvtHandler
104 {
105 public:
106 wxTaskBarIcon();
107 ~wxTaskBarIcon();
108
109 %extend {
110 void Destroy() {
111 #ifndef __WXMAC__
112 self->RemoveIcon();
113 #endif
114 }
115 }
116
117 #ifndef __WXMAC__
118 bool IsOk() const;
119 %pythoncode { def __nonzero__(self): return self.IsOk() }
120
121 bool IsIconInstalled() const;
122
123 bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString);
124 bool RemoveIcon();
125 bool PopupMenu(wxMenu *menu);
126 #endif
127 };
128
129
130
131 class wxTaskBarIconEvent : public wxEvent
132 {
133 public:
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 {
149 EVT_TASKBAR_MOVE = wx.PyEventBinder ( wxEVT_TASKBAR_MOVE )
150 EVT_TASKBAR_LEFT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DOWN )
151 EVT_TASKBAR_LEFT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_UP )
152 EVT_TASKBAR_RIGHT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DOWN )
153 EVT_TASKBAR_RIGHT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_UP )
154 EVT_TASKBAR_LEFT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DCLICK )
155 EVT_TASKBAR_RIGHT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DCLICK )
156 }
157
158 //---------------------------------------------------------------------------