00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifdef _XOPEN_SOURCE
00026 #undef _XOPEN_SOURCE
00027 #endif
00028
00029 #include <Python.h>
00030 #include <tqobject.h>
00031 #include "karamba.h"
00032 #include "meter.h"
00033 #include "meter_python.h"
00034 #include "systray_python.h"
00035
00036 long moveSystray(long widget, long x, long y, long w, long h)
00037 {
00038 karamba* currTheme = (karamba*)widget;
00039
00040 if (currTheme->systray != 0) {
00041 currTheme->systray->move((int)x,(int)y);
00042 currTheme->systray->setMinimumSize((int)w,(int)h);
00043 currTheme->systray->layoutSystray();
00044 currTheme->systray->show();
00045 }
00046 return 1;
00047 }
00048
00049 PyObject* py_move_systray(PyObject *, PyObject *args)
00050 {
00051 long widget, x, y, w, h;
00052 if (!PyArg_ParseTuple(args, (char*)"lllll:moveSystray", &widget, &x, &y, &w, &h))
00053 return NULL;
00054 if (!checkKaramba(widget))
00055 return NULL;
00056 return Py_BuildValue((char*)"l", moveSystray(widget, x, y, w, h));
00057 }
00058
00059
00060 long showSystray(long widget)
00061 {
00062 karamba* currTheme = (karamba*)widget;
00063
00064 if (currTheme->systray != 0)
00065 {
00066 currTheme->systray->show();
00067 }
00068 return 1;
00069 }
00070
00071 PyObject* py_show_systray(PyObject *, PyObject *args)
00072 {
00073 long widget;
00074 if (!PyArg_ParseTuple(args, (char*)"l:showSystray", &widget))
00075 return NULL;
00076 if (!checkKaramba(widget))
00077 return NULL;
00078 return Py_BuildValue((char*)"l", showSystray(widget));
00079 }
00080
00081
00082 long hideSystray(long widget)
00083 {
00084 karamba* currTheme = (karamba*)widget;
00085
00086 if (currTheme->systray != 0)
00087 {
00088 currTheme->systray->hide();
00089 }
00090 return 1;
00091 }
00092
00093 PyObject* py_hide_systray(PyObject *, PyObject *args)
00094 {
00095 long widget;
00096 if (!PyArg_ParseTuple(args, (char*)"l:hideSystray", &widget))
00097 return NULL;
00098 if (!checkKaramba(widget))
00099 return NULL;
00100 return Py_BuildValue((char*)"l", hideSystray(widget));
00101 }
00102
00103
00104 long createSystray(long widget, long x, long y, long w, long h)
00105 {
00106 karamba* currTheme = (karamba*)widget;
00107
00108
00109 if (currTheme->systray == 0) {
00110 currTheme->systray = new Systemtray(currTheme);
00111 currTheme->systray->move((int)x,(int)y);
00112 currTheme->systray->setMinimumSize((int)w,(int)h);
00113 currTheme->systray->initSystray();
00114 TQObject::connect(currTheme->systray,TQT_SIGNAL(updated()),
00115 currTheme,TQT_SLOT(systrayUpdated()));
00116 currTheme->systray->show();
00117 }
00118
00119 return 1;
00120 }
00121
00122 PyObject* py_create_systray(PyObject *, PyObject *args)
00123 {
00124 long widget, x, y, w, h;
00125 if (!PyArg_ParseTuple(args, (char*)"lllll:createSystray", &widget, &x, &y, &w, &h))
00126 return NULL;
00127 if (!checkKaramba(widget))
00128 return NULL;
00129 return Py_BuildValue((char*)"l", createSystray(widget, x, y, w, h));
00130 }
00131
00132
00133 long getCurrentWindowCount(long widget)
00134 {
00135 karamba* currTheme = (karamba*)widget;
00136 int num;
00137
00138 num = 0;
00139
00140 if (currTheme->systray != 0)
00141 {
00142 num = currTheme->systray->getCurrentWindowCount();
00143 }
00144 return num;
00145 }
00146
00147 PyObject* py_get_current_window_count(PyObject *, PyObject *args)
00148 {
00149 long widget;
00150 if (!PyArg_ParseTuple(args, (char*)"l:getCurrentWindowCount", &widget ))
00151 return NULL;
00152 if (!checkKaramba(widget))
00153 return NULL;
00154 return Py_BuildValue((char*)"l", getCurrentWindowCount(widget));
00155 }
00156
00157
00158 long updateSystrayLayout(long widget)
00159 {
00160 karamba* currTheme = (karamba*)widget;
00161
00162 if (currTheme->systray != 0)
00163 {
00164 currTheme->systray->layoutSystray();
00165 }
00166 return 1;
00167 }
00168
00169 PyObject* py_update_systray_layout(PyObject *, PyObject *args)
00170 {
00171 long widget;
00172 if (!PyArg_ParseTuple(args, (char*)"l:updateSystrayLayout", &widget ))
00173 return NULL;
00174 if (!checkKaramba(widget))
00175 return NULL;
00176 return Py_BuildValue((char*)"l", updateSystrayLayout(widget));
00177 }
00178
00179
00180 int getSystraySize(long widget) {
00181 karamba* currTheme = (karamba*)widget;
00182 if(currTheme->systray == 0) {
00183 return 0;
00184 } else {
00185 return currTheme->systray->getTraySize();
00186 }
00187 }
00188
00189
00190 PyObject* py_get_systray_size(PyObject*, PyObject* args)
00191 {
00192 long widget;
00193
00194 if (!PyArg_ParseTuple(args, "l:getSystraySize", &widget))
00195 return NULL;
00196
00197 return Py_BuildValue("l", getSystraySize(widget));
00198 }
00199