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

superkaramba

  • superkaramba
  • src
bar_python.cpp
1 /****************************************************************************
2 * bar_python.cpp - Functions for bar python api
3 *
4 * Copyright (c) 2004 Petri Damstén <damu@iki.fi>
5 *
6 * This file is part of SuperKaramba.
7 *
8 * SuperKaramba is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * SuperKaramba is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with SuperKaramba; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 ****************************************************************************/
22 
23 #ifdef _XOPEN_SOURCE
24 #undef _XOPEN_SOURCE
25 #endif
26 
27 #include <Python.h>
28 #include <tqobject.h>
29 #include "karamba.h"
30 #include "meter.h"
31 #include "meter_python.h"
32 #include "bar_python.h"
33 
34 PyObject* py_createBar(PyObject *, PyObject *args)
35 {
36  long widget, x, y, w, h;
37  char *text;
38  if (!PyArg_ParseTuple(args, (char*)"lllll|s", &widget, &x, &y, &w, &h, &text))
39  return NULL;
40  if (!checkKaramba(widget))
41  return NULL;
42 
43  Bar *tmp = new Bar((karamba*)widget, x,y,w,h);
44  if (text && text[0] != '\0')
45  tmp->setImage(text);
46  ((karamba*)widget)->meterList->append(tmp);
47  return (Py_BuildValue((char*)"l", (long)tmp));
48 }
49 
50 PyObject* py_deleteBar(PyObject *, PyObject *args)
51 {
52  long widget, meter;
53  if (!PyArg_ParseTuple(args, (char*)"ll", &widget, &meter))
54  return NULL;
55  if (!checkKarambaAndMeter(widget, meter, "Bar"))
56  return NULL;
57 
58  ((karamba*)widget)->deleteMeterFromSensors((Meter*)meter);
59  return Py_BuildValue((char*)"l",
60  ((karamba*)widget)->meterList->removeRef((Meter*)meter));
61 }
62 
63 PyObject* py_getThemeBar(PyObject *self, PyObject *args)
64 {
65  return py_getThemeMeter(self, args, "Bar");
66 }
67 
68 PyObject* py_getBarSize(PyObject *self, PyObject *args)
69 {
70  return py_getSize(self, args, "Bar");
71 }
72 
73 PyObject* py_resizeBar(PyObject *self, PyObject *args)
74 {
75  return py_resize(self, args, "Bar");
76 }
77 
78 PyObject* py_getBarPos(PyObject *self, PyObject *args)
79 {
80  return py_getPos(self, args, "Bar");
81 }
82 
83 PyObject* py_moveBar(PyObject *self, PyObject *args)
84 {
85  return py_move(self, args, "Bar");
86 }
87 
88 PyObject* py_hideBar(PyObject *self, PyObject *args)
89 {
90  return py_hide(self, args, "Bar");
91 }
92 
93 PyObject* py_showBar(PyObject *self, PyObject *args)
94 {
95  return py_show(self, args, "Bar");
96 }
97 
98 PyObject* py_getBarMinMax(PyObject *self, PyObject *args)
99 {
100  return py_getMinMax(self, args, "Bar");
101 }
102 
103 PyObject* py_setBarMinMax(PyObject *self, PyObject *args)
104 {
105  return py_setMinMax(self, args, "Bar");
106 }
107 
108 PyObject* py_getBarValue(PyObject *self, PyObject *args)
109 {
110  return py_getValue(self, args, "Bar");
111 }
112 
113 PyObject* py_setBarValue(PyObject *self, PyObject *args)
114 {
115  return py_setValue(self, args, "Bar");
116 }
117 
118 PyObject* py_getBarSensor(PyObject *self, PyObject *args)
119 {
120  return py_getSensor(self, args, "Bar");
121 }
122 
123 PyObject* py_setBarSensor(PyObject *self, PyObject *args)
124 {
125  return py_setSensor(self, args, "Bar");
126 }
127 
128 PyObject* py_getBarImage(PyObject *, PyObject *args)
129 {
130  long widget, meter;
131  if (!PyArg_ParseTuple(args, (char*)"ll", &widget, &meter))
132  return NULL;
133  if (!checkKarambaAndMeter(widget, meter, "Bar"))
134  return NULL;
135  return Py_BuildValue((char*)"s", ((Bar*)meter)->getImage().ascii());
136 }
137 
138 PyObject* py_setBarImage(PyObject *, PyObject *args)
139 {
140  long widget, meter;
141  char* s;
142  if (!PyArg_ParseTuple(args, (char*)"lls", &widget, &meter, &s))
143  return NULL;
144  if (!checkKarambaAndMeter(widget, meter, "Bar"))
145  return NULL;
146  return Py_BuildValue((char*)"l", ((Bar*)meter)->setImage(s));
147 }
148 
149 PyObject* py_getBarVertical(PyObject *, PyObject *args)
150 {
151  long widget, meter;
152  if (!PyArg_ParseTuple(args, (char*)"ll", &widget, &meter))
153  return NULL;
154  if (!checkKarambaAndMeter(widget, meter, "Bar"))
155  return NULL;
156  return Py_BuildValue((char*)"l", ((Bar*)meter)->getVertical());
157 }
158 
159 PyObject* py_setBarVertical(PyObject *, PyObject *args)
160 {
161  long widget, meter, l;
162  if (!PyArg_ParseTuple(args, (char*)"lll", &widget, &meter, &l))
163  return NULL;
164  if (!checkKarambaAndMeter(widget, meter, "Bar"))
165  return NULL;
166  ((Bar*)meter)->setVertical(l);
167  return Py_BuildValue((char*)"l", 1);
168 }
py_hide
PyObject * py_hide(PyObject *self, PyObject *args)
Misc/hide.
Definition: misc_python.cpp:641
py_show
PyObject * py_show(PyObject *self, PyObject *args)
Misc/show.
Definition: misc_python.cpp:623

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.