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

superkaramba

  • superkaramba
  • src
textlabel_python.cpp
1 /****************************************************************************
2 * textlabel_python.cpp - Functions for textlabel 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 "textlabel.h"
33 #include "meter_python.h"
34 #include "textlabel_python.h"
35 
36 PyObject* py_createText(PyObject *, PyObject *args)
37 {
38  long widget, x, y, w, h;
39  PyObject *text;
40  if (!PyArg_ParseTuple(args, (char*)"lllllO:createText", &widget, &x, &y, &w, &h, &text))
41  return NULL;
42  if (!checkKaramba(widget))
43  return NULL;
44  TextLabel *tmp =
45  new TextLabel((karamba*)widget, (int)x, (int)y, (int)w, (int)h);
46  tmp->setValue(PyString2TQString(text));
47  tmp->setTextProps(((karamba*)widget)->getDefaultTextProps());
48  ((karamba*)widget)->meterList->append(tmp);
49  return (Py_BuildValue((char*)"l", (long)tmp));
50 }
51 
52 PyObject* py_deleteText(PyObject *, PyObject *args)
53 {
54  long widget, meter;
55  if (!PyArg_ParseTuple(args, (char*)"ll:deleteText", &widget, &meter))
56  return NULL;
57  if (!checkKarambaAndMeter(widget, meter, "TextLabel"))
58  return NULL;
59 
60  ((karamba*)widget)->deleteMeterFromSensors((Meter*)meter);
61  ((karamba*)widget)->clickList->removeRef((Meter*)meter);
62  return Py_BuildValue((char*)"l",
63  ((karamba*)widget)->meterList->removeRef((Meter*)meter));
64 }
65 
66 PyObject* py_getThemeText(PyObject *self, PyObject *args)
67 {
68  return py_getThemeMeter(self, args, "TextLabel");
69 }
70 
71 PyObject* py_getTextSize(PyObject *self, PyObject *args)
72 {
73  return py_getSize(self, args, "TextLabel");
74 }
75 
76 PyObject* py_resizeText(PyObject *self, PyObject *args)
77 {
78  return py_resize(self, args, "TextLabel");
79 }
80 
81 PyObject* py_getTextPos(PyObject *self, PyObject *args)
82 {
83  return py_getPos(self, args, "TextLabel");
84 }
85 
86 PyObject* py_moveText(PyObject *self, PyObject *args)
87 {
88  return py_move(self, args, "TextLabel");
89 }
90 
91 PyObject* py_hideText(PyObject *self, PyObject *args)
92 {
93  return py_hide(self, args, "TextLabel");
94 }
95 
96 PyObject* py_showText(PyObject *self, PyObject *args)
97 {
98  return py_show(self, args, "TextLabel");
99 }
100 
101 PyObject* py_getTextValue(PyObject *self, PyObject *args)
102 {
103  return py_getStringValue(self, args, "TextLabel");
104 }
105 
106 PyObject* py_setTextValue(PyObject *self, PyObject *args)
107 {
108  return py_setStringValue(self, args, "TextLabel");
109 }
110 
111 PyObject* py_getTextSensor(PyObject *self, PyObject *args)
112 {
113  return py_getSensor(self, args, "TextLabel");
114 }
115 
116 PyObject* py_setTextSensor(PyObject *self, PyObject *args)
117 {
118  return py_setSensor(self, args, "TextLabel");
119 }
120 
121 PyObject* py_getTextColor(PyObject *self, PyObject *args)
122 {
123  return py_getColor(self, args, "TextLabel");
124 }
125 
126 PyObject* py_setTextColor(PyObject *self, PyObject *args)
127 {
128  return py_setColor(self, args, "TextLabel");
129 }
130 
131 PyObject* py_setTextShadow(PyObject *, PyObject *args)
132 {
133  long widget, textSensor;
134  long shadow;
135  if (!PyArg_ParseTuple(args, (char*)"lll:changeTextShadow",
136  &widget, &textSensor, &shadow))
137  return NULL;
138  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
139  return NULL;
140  ((TextLabel*)textSensor)->setShadow( shadow );
141  return Py_BuildValue((char*)"l", 1);
142 }
143 
144 PyObject* py_getTextShadow(PyObject *, PyObject *args)
145 {
146  long widget, textSensor;
147  if (!PyArg_ParseTuple(args, (char*)"ll:getTextShadow", &widget, &textSensor))
148  return NULL;
149  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
150  return NULL;
151  return Py_BuildValue((char*)"l", ((TextLabel*)textSensor)->getShadow());
152 }
153 
154 PyObject* py_setTextFontSize(PyObject *, PyObject *args)
155 {
156  long widget, textSensor;
157  long size;
158  if (!PyArg_ParseTuple(args, (char*)"lll:changeTextSize",
159  &widget, &textSensor, &size))
160  return NULL;
161  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
162  return NULL;
163  ((TextLabel*)textSensor)->setFontSize( size );
164  return Py_BuildValue((char*)"l", 1);
165 }
166 
167 PyObject* py_getTextFontSize(PyObject *, PyObject *args)
168 {
169  long widget, textSensor;
170  if (!PyArg_ParseTuple(args, (char*)"ll:getTextSize", &widget, &textSensor))
171  return NULL;
172  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
173  return NULL;
174  return Py_BuildValue((char*)"l", ((TextLabel*)textSensor)->getFontSize());
175 }
176 
177 PyObject* py_setTextFont(PyObject *, PyObject *args)
178 {
179  long widget, textSensor;
180  char* text;
181  if (!PyArg_ParseTuple(args, (char*)"lls:changeTextFont",
182  &widget, &textSensor, &text))
183  return NULL;
184  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
185  return NULL;
186  ((TextLabel*)textSensor)->setFont( text );
187  return Py_BuildValue((char*)"l", 1);
188 }
189 
190 PyObject* py_getTextFont(PyObject *, PyObject *args)
191 {
192  long widget, textSensor;
193  if (!PyArg_ParseTuple(args, (char*)"ll:getTextFont", &widget, &textSensor))
194  return NULL;
195  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
196  return NULL;
197  return Py_BuildValue((char*)"s", ((TextLabel*)textSensor)->getFont().ascii());
198 }
199 
200 PyObject* py_setTextAlign(PyObject *, PyObject *args)
201 {
202  long widget, textSensor;
203  char* text;
204  if (!PyArg_ParseTuple(args, (char*)"lls:changeTextFont",
205  &widget, &textSensor, &text))
206  return NULL;
207  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
208  return NULL;
209  ((TextLabel*)textSensor)->setAlignment( text );
210  return Py_BuildValue((char*)"l", 1);
211 }
212 
213 PyObject* py_getTextAlign(PyObject *, PyObject *args)
214 {
215  long widget, textSensor;
216  if (!PyArg_ParseTuple(args, (char*)"ll:getTextFont", &widget, &textSensor))
217  return NULL;
218  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
219  return NULL;
220  return Py_BuildValue((char*)"s", ((TextLabel*)textSensor)->getAlignment().ascii());
221 }
222 
223 PyObject* py_setTextScroll(PyObject *, PyObject *args)
224 {
225  long widget, textSensor;
226  char* type;
227  int x=0, y=0, pause=0, gap=0;
228  if (!PyArg_ParseTuple(args, (char*)"lls|llll:setScroll",
229  &widget, &textSensor, &type, &x, &y, &gap, &pause))
230  return NULL;
231  if (!checkKarambaAndMeter(widget, textSensor, "TextLabel"))
232  return NULL;
233  ((TextLabel*)textSensor)->setScroll(type, TQPoint(x,y), gap, pause);
234  return Py_BuildValue((char*)"l", 1);
235 }
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.