• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • superkaramba
 

superkaramba

  • superkaramba
  • src
systray_python.cpp
1 /****************************************************************************
2 * systray_python.h - Functions for systray python api
3 *
4 * Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
5 * Copyright (C) 2003-2004 Adam Geitgey <adam@rootnode.org>
6 * Copyright (c) 2004 Petri Damstén <damu@iki.fi>
7 *
8 * This file is part of SuperKaramba.
9 *
10 * SuperKaramba is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * SuperKaramba is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with SuperKaramba; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 ****************************************************************************/
24 
25 #ifdef _XOPEN_SOURCE
26 #undef _XOPEN_SOURCE
27 #endif
28 
29 #include <Python.h>
30 #include <tqobject.h>
31 #include "karamba.h"
32 #include "meter.h"
33 #include "meter_python.h"
34 #include "systray_python.h"
35 
36 long moveSystray(long widget, long x, long y, long w, long h)
37 {
38  karamba* currTheme = (karamba*)widget;
39 
40  if (currTheme->systray != 0) {
41  currTheme->systray->move((int)x,(int)y);
42  currTheme->systray->setMinimumSize((int)w,(int)h);
43  currTheme->systray->layoutSystray();
44  currTheme->systray->show();
45  }
46  return 1;
47 }
48 
49 PyObject* py_move_systray(PyObject *, PyObject *args)
50 {
51  long widget, x, y, w, h;
52  if (!PyArg_ParseTuple(args, (char*)"lllll:moveSystray", &widget, &x, &y, &w, &h))
53  return NULL;
54  if (!checkKaramba(widget))
55  return NULL;
56  return Py_BuildValue((char*)"l", moveSystray(widget, x, y, w, h));
57 }
58 
59 /* now a method we need to expose to Python */
60 long showSystray(long widget)
61 {
62  karamba* currTheme = (karamba*)widget;
63 
64  if (currTheme->systray != 0)
65  {
66  currTheme->systray->show();
67  }
68  return 1;
69 }
70 
71 PyObject* py_show_systray(PyObject *, PyObject *args)
72 {
73  long widget;
74  if (!PyArg_ParseTuple(args, (char*)"l:showSystray", &widget))
75  return NULL;
76  if (!checkKaramba(widget))
77  return NULL;
78  return Py_BuildValue((char*)"l", showSystray(widget));
79 }
80 
81 /* now a method we need to expose to Python */
82 long hideSystray(long widget)
83 {
84  karamba* currTheme = (karamba*)widget;
85 
86  if (currTheme->systray != 0)
87  {
88  currTheme->systray->hide();
89  }
90  return 1;
91 }
92 
93 PyObject* py_hide_systray(PyObject *, PyObject *args)
94 {
95  long widget;
96  if (!PyArg_ParseTuple(args, (char*)"l:hideSystray", &widget))
97  return NULL;
98  if (!checkKaramba(widget))
99  return NULL;
100  return Py_BuildValue((char*)"l", hideSystray(widget));
101 }
102 
103 /* now a method we need to expose to Python */
104 long createSystray(long widget, long x, long y, long w, long h)
105 {
106  karamba* currTheme = (karamba*)widget;
107 
108  //Don't create more than one systray
109  if (currTheme->systray == 0) {
110  currTheme->systray = new Systemtray(currTheme);
111  currTheme->systray->move((int)x,(int)y);
112  currTheme->systray->setMinimumSize((int)w,(int)h);
113  currTheme->systray->initSystray();
114  TQObject::connect(currTheme->systray,TQ_SIGNAL(updated()),
115  currTheme,TQ_SLOT(systrayUpdated()));
116  currTheme->systray->show();
117  }
118 
119  return 1;
120 }
121 
122 PyObject* py_create_systray(PyObject *, PyObject *args)
123 {
124  long widget, x, y, w, h;
125  if (!PyArg_ParseTuple(args, (char*)"lllll:createSystray", &widget, &x, &y, &w, &h))
126  return NULL;
127  if (!checkKaramba(widget))
128  return NULL;
129  return Py_BuildValue((char*)"l", createSystray(widget, x, y, w, h));
130 }
131 
132 /* now a method we need to expose to Python */
133 long getCurrentWindowCount(long widget)
134 {
135  karamba* currTheme = (karamba*)widget;
136  int num;
137 
138  num = 0;
139 
140  if (currTheme->systray != 0)
141  {
142  num = currTheme->systray->getCurrentWindowCount();
143  }
144  return num;
145 }
146 
147 PyObject* py_get_current_window_count(PyObject *, PyObject *args)
148 {
149  long widget;
150  if (!PyArg_ParseTuple(args, (char*)"l:getCurrentWindowCount", &widget ))
151  return NULL;
152  if (!checkKaramba(widget))
153  return NULL;
154  return Py_BuildValue((char*)"l", getCurrentWindowCount(widget));
155 }
156 
157 /* now a method we need to expose to Python */
158 long updateSystrayLayout(long widget)
159 {
160  karamba* currTheme = (karamba*)widget;
161 
162  if (currTheme->systray != 0)
163  {
164  currTheme->systray->layoutSystray();
165  }
166  return 1;
167 }
168 
169 PyObject* py_update_systray_layout(PyObject *, PyObject *args)
170 {
171  long widget;
172  if (!PyArg_ParseTuple(args, (char*)"l:updateSystrayLayout", &widget ))
173  return NULL;
174  if (!checkKaramba(widget))
175  return NULL;
176  return Py_BuildValue((char*)"l", updateSystrayLayout(widget));
177 }
178 
179 /* get the systray size from python */
180 int getSystraySize(long widget) {
181  karamba* currTheme = (karamba*)widget;
182  if(currTheme->systray == 0) {
183  return 0;
184  } else {
185  return currTheme->systray->getTraySize();
186  }
187 }
188 
189 // Returns the size of the systray
190 PyObject* py_get_systray_size(PyObject*, PyObject* args)
191 {
192  long widget;
193 
194  if (!PyArg_ParseTuple(args, "l:getSystraySize", &widget))
195  return NULL;
196 
197  return Py_BuildValue("l", getSystraySize(widget));
198 }
199 

superkaramba

Skip menu "superkaramba"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

superkaramba

Skip menu "superkaramba"
  • kcalc
  •   knumber
  • superkaramba
Generated for superkaramba by doxygen 1.8.13
This website is maintained by Timothy Pearson.