33#include "meter_python.h"
34#include "task_python.h"
37int performTaskAction(
long widget,
long ctask,
long action)
39 karamba* currTheme = (karamba*)widget;
43 TaskList taskList = currTheme -> taskManager.tasks();
45 for (task = taskList.first(); task; task = taskList.next())
47 if ((
long)task == (long)ctask)
90 currTask->toggleAlwaysOnTop();
94 currTask->toggleShaded();
98 printf(
"You are trying to perform an invalid action in \
99 performTaskAction\n");
109PyObject* py_perform_task_action(PyObject *, PyObject *args)
111 long widget, task, action;
112 if (!PyArg_ParseTuple(args, (
char*)
"lll:performTaskAction",
113 &widget, &task, &action))
115 if (!checkKaramba(widget))
117 return Py_BuildValue((
char*)
"l", performTaskAction(widget, task, action));
122PyObject* getTaskInfo(
long widget,
long ctask)
124 karamba* currTheme = (karamba*)widget;
128 TaskList taskList = currTheme -> taskManager.tasks();
130 for (task = taskList.first(); task; task = taskList.next())
132 if ((
long)task == (long)ctask)
141 PyObject* pList = PyList_New(0);
144 if (currTask->name() != NULL)
146 PyList_Append(pList, PyBytes_FromString(currTask->name().latin1()));
150 PyList_Append(pList, PyBytes_FromString(
""));
154 if (currTask->iconName() != NULL)
156 PyList_Append(pList, PyBytes_FromString(currTask->iconName().latin1()));
160 PyList_Append(pList, PyBytes_FromString(
""));
164 if (currTask->className() != NULL)
166 PyList_Append(pList, PyBytes_FromString(currTask->className().latin1()));
170 PyList_Append(pList, PyBytes_FromString(
""));
174 PyList_Append(pList, PyLong_FromLong(currTask->
desktop()));
177 PyList_Append(pList, PyLong_FromLong(currTask->
isMaximized()));
180 PyList_Append(pList, PyLong_FromLong(currTask->
isIconified()));
183 PyList_Append(pList, PyLong_FromLong(currTask->
isShaded()));
186 PyList_Append(pList, PyLong_FromLong(currTask->
isActive()));
189 PyList_Append(pList, PyLong_FromLong((
long)currTask));
196 tqWarning(
"Task not found.");
201PyObject* py_get_task_info(PyObject *, PyObject *args)
204 if (!PyArg_ParseTuple(args, (
char*)
"ll:getTaskInfo", &widget, &task))
206 if (!checkKaramba(widget))
208 return getTaskInfo(widget, task);
213PyObject* getStartupInfo(
long widget,
long cstartup)
215 karamba* currTheme = (karamba*)widget;
219 StartupList startupList = currTheme -> taskManager.startups();
221 for (startup = startupList.first(); startup; startup = startupList.next())
223 if ((
long)startup == (long)cstartup)
229 startup = currentStartup;
233 PyObject* pList = PyList_New(0);
236 if (startup -> text() != NULL)
238 PyList_Append(pList, PyBytes_FromString(startup -> text().latin1()));
242 PyList_Append(pList, PyBytes_FromString(
""));
246 if (startup -> icon() != NULL)
248 PyList_Append(pList, PyBytes_FromString(startup -> icon().latin1()));
252 PyList_Append(pList, PyBytes_FromString(
""));
256 if (startup -> bin() != NULL)
258 PyList_Append(pList, PyBytes_FromString(startup -> bin().latin1()));
262 PyList_Append(pList, PyBytes_FromString(
""));
266 PyList_Append(pList, PyLong_FromLong((
long) startup));
277PyObject* py_get_startup_info(PyObject*, PyObject* args)
279 long widget, startup;
280 if (!PyArg_ParseTuple(args, (
char*)
"ll:getStartupInfo", &widget, &startup))
282 if (!checkKaramba(widget))
284 return getStartupInfo(widget, startup);
289PyObject* getTaskNames(
long widget)
291 karamba* currTheme = (karamba*)widget;
292 PyObject* pList = PyList_New(0);
295 TaskList taskList = currTheme -> taskManager.tasks();
298 for (task = taskList.first(); task; task = taskList.next())
300 const char* tmp = task->name().latin1();
303 pString = PyBytes_FromString(tmp);
305 PyList_Append(pList, pString);
310PyObject* py_get_task_names(PyObject *, PyObject *args)
313 if(!PyArg_ParseTuple(args, (
char*)
"l:getTaskNames", &widget))
315 if (!checkKaramba(widget))
317 return getTaskNames(widget);
321PyObject* getTaskList(
long widget)
323 karamba* currTheme = (karamba*)widget;
324 PyObject* pList = PyList_New(0);
327 TaskList taskList = currTheme -> taskManager.tasks();
330 for (task = taskList.first(); task; task = taskList.next())
332 pString = PyLong_FromLong((
long)task);
333 PyList_Append(pList, pString);
338PyObject* py_get_task_list(PyObject *, PyObject *args)
341 if(!PyArg_ParseTuple(args, (
char*)
"l:getTaskList", &widget))
343 if (!checkKaramba(widget))
345 return getTaskList(widget);
349PyObject* getStartupList(
long widget)
351 karamba* currTheme = (karamba*)widget;
352 PyObject* pList = PyList_New(0);
355 StartupList startupList = currTheme -> taskManager.startups();
359 for (startup = startupList.first(); startup; startup = startupList.next())
361 pString = PyLong_FromLong((
long) startup);
362 PyList_Append(pList, pString);
367PyObject* py_get_startup_list(PyObject *, PyObject *args)
370 if(!PyArg_ParseTuple(args, (
char*)
"l:getStartupList", &widget))
372 if (!checkKaramba(widget))
374 return getStartupList(widget);
Represents a task which is in the process of starting.
A dynamic interface to a task (main window).
void raise()
Raise the task's window.
bool isActive() const
Returns true if the task's window is the active window.
void maximize()
Maximise the main window of this task.
bool isShaded() const
Returns true if the task's window is shaded.
void activate()
Activate the task's window.
void lower()
Lower the task's window.
bool isIconified() const
Returns true if the task's window is iconified.
void activateRaiseOrIconify()
Perform the action that is most appropriate for this task.
void restore()
Restore the main window of the task (if it was iconified).
int desktop() const
Returns the desktop on which this task's window resides.
void iconify()
Iconify the task.
void close()
Activate the task's window.
bool isMaximized() const
Returns true if the task's window is maximized.