]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_taskbar.i
fixed status bar positioning to work both with and without sizers (patch 1199639...
[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%{
b17dd4ce
RD
26#ifndef wxHAS_TASK_BAR_ICON
27// implement dummy classes for platforms that don't have it
d14a1e28
RD
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 41 virtual wxEvent* Clone() const { return NULL; }
b17dd4ce
RD
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; }
d14a1e28
RD
47};
48
49enum {
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};
b8400a3a
RD
58
59
60#else
662bd31e
RD
61// Otherwise make a class that can virtualize CreatePopupMenu
62class wxPyTaskBarIcon : public wxTaskBarIcon
63{
64 DECLARE_ABSTRACT_CLASS(wxPyTaskBarIcon);
65public:
66 wxPyTaskBarIcon() : wxTaskBarIcon()
67 {}
68
69 wxMenu* CreatePopupMenu() {
70 wxMenu *rval = NULL;
71 bool found;
6e6b3557 72 wxPyBlock_t blocked = wxPyBeginBlockThreads();
662bd31e
RD
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
92IMPLEMENT_ABSTRACT_CLASS(wxPyTaskBarIcon, wxTaskBarIcon);
b8400a3a 93
d14a1e28
RD
94#endif
95%}
96
97
662bd31e 98MustHaveApp(wxPyTaskBarIcon);
ab1f7d2a 99
1b8c7ba6
RD
100%rename(TaskBarIcon) wxPyTaskBarIcon;
101class wxPyTaskBarIcon : public wxEvtHandler
d14a1e28
RD
102{
103public:
662bd31e
RD
104 %pythonAppend wxPyTaskBarIcon "self._setCallbackInfo(self, TaskBarIcon, 0)"
105
106 wxPyTaskBarIcon();
107
108 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref);
33e10b88
RD
109
110 %extend {
111 void Destroy() {
33e10b88 112 self->RemoveIcon();
662bd31e 113 delete self;
33e10b88
RD
114 }
115 }
d14a1e28 116
d14a1e28 117 bool IsOk() const;
e0269b2e 118 %pythoncode { def __nonzero__(self): return self.IsOk() }
b8400a3a 119
d14a1e28
RD
120 bool IsIconInstalled() const;
121
122 bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString);
b8400a3a 123 bool RemoveIcon();
d14a1e28 124 bool PopupMenu(wxMenu *menu);
d14a1e28
RD
125};
126
127
128
129class wxTaskBarIconEvent : public wxEvent
130{
131public:
132 wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon);
133};
134
135
136
137%constant wxEventType wxEVT_TASKBAR_MOVE;
138%constant wxEventType wxEVT_TASKBAR_LEFT_DOWN;
139%constant wxEventType wxEVT_TASKBAR_LEFT_UP;
140%constant wxEventType wxEVT_TASKBAR_RIGHT_DOWN;
141%constant wxEventType wxEVT_TASKBAR_RIGHT_UP;
142%constant wxEventType wxEVT_TASKBAR_LEFT_DCLICK;
143%constant wxEventType wxEVT_TASKBAR_RIGHT_DCLICK;
144
145
146%pythoncode {
147EVT_TASKBAR_MOVE = wx.PyEventBinder ( wxEVT_TASKBAR_MOVE )
148EVT_TASKBAR_LEFT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DOWN )
149EVT_TASKBAR_LEFT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_UP )
150EVT_TASKBAR_RIGHT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DOWN )
151EVT_TASKBAR_RIGHT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_UP )
152EVT_TASKBAR_LEFT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DCLICK )
153EVT_TASKBAR_RIGHT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DCLICK )
b8400a3a 154}
d14a1e28
RD
155
156//---------------------------------------------------------------------------