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

superkaramba

  • superkaramba
  • src
richtextlabel_python.cpp
1/****************************************************************************
2* richtextlabel_python.cpp - Functions for richtext 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 "richtextlabel.h"
33#include "meter_python.h"
34#include "richtextlabel_python.h"
35
36PyObject* py_createRichText(PyObject *, PyObject *args)
37{
38 long widget, underline = 0;
39 PyObject *text;
40 if (!PyArg_ParseTuple(args, (char*)"lO|l:createRichText",
41 &widget, &text, &underline))
42 return NULL;
43 if (!checkKaramba(widget))
44 return NULL;
45 RichTextLabel *tmp = new RichTextLabel((karamba*)widget);
46 tmp->setText(PyString2TQString(text), underline);
47 tmp->setTextProps(((karamba*)widget)->getDefaultTextProps());
48 ((karamba*)widget)->meterList->append(tmp);
49 ((karamba*)widget)->clickList->append(tmp);
50 return (Py_BuildValue((char*)"l", (long)tmp));
51}
52
53PyObject* py_deleteRichText(PyObject *, PyObject *args)
54{
55 long widget, meter;
56 if (!PyArg_ParseTuple(args, (char*)"ll:deleteRichText", &widget, &meter))
57 return NULL;
58 if (!checkKarambaAndMeter(widget, meter, "RichTextLabel"))
59 return NULL;
60
61 ((karamba*)widget)->deleteMeterFromSensors((Meter*)meter);
62 ((karamba*)widget)->clickList->removeRef((Meter*)meter);
63 return Py_BuildValue((char*)"l",
64 ((karamba*)widget)->meterList->removeRef((Meter*)meter));
65}
66
67PyObject* py_getThemeRichText(PyObject *self, PyObject *args)
68{
69 return py_getThemeMeter(self, args, "RichTextLabel");
70}
71
72PyObject* py_getRichTextSize(PyObject *self, PyObject *args)
73{
74 return py_getSize(self, args, "RichTextLabel");
75}
76
77PyObject* py_resizeRichText(PyObject *self, PyObject *args)
78{
79 return py_resize(self, args, "RichTextLabel");
80}
81
82PyObject* py_getRichTextPos(PyObject *self, PyObject *args)
83{
84 return py_getPos(self, args, "RichTextLabel");
85}
86
87PyObject* py_moveRichText(PyObject *self, PyObject *args)
88{
89 return py_move(self, args, "RichTextLabel");
90}
91
92PyObject* py_hideRichText(PyObject *self, PyObject *args)
93{
94 return py_hide(self, args, "RichTextLabel");
95}
96
97PyObject* py_showRichText(PyObject *self, PyObject *args)
98{
99 return py_show(self, args, "RichTextLabel");
100}
101
102PyObject* py_getRichTextValue(PyObject *self, PyObject *args)
103{
104 return py_getStringValue(self, args, "RichTextLabel");
105}
106
107PyObject* py_setRichTextValue(PyObject *self, PyObject *args)
108{
109 return py_setStringValue(self, args, "RichTextLabel");
110}
111
112PyObject* py_getRichTextSensor(PyObject *self, PyObject *args)
113{
114 return py_getSensor(self, args, "RichTextLabel");
115}
116
117PyObject* py_setRichTextSensor(PyObject *self, PyObject *args)
118{
119 return py_setSensor(self, args, "RichTextLabel");
120}
121
122PyObject* py_setRichTextFontSize(PyObject *, PyObject *args)
123{
124 long widget, textSensor;
125 long size;
126 if (!PyArg_ParseTuple(args, (char*)"lll:changeRichTextSize",
127 &widget, &textSensor, &size))
128 return NULL;
129 if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
130 return NULL;
131 ((RichTextLabel*)textSensor)->setFontSize( size );
132 return Py_BuildValue((char*)"l", 1);
133}
134
135PyObject* py_getRichTextFontSize(PyObject *, PyObject *args)
136{
137 long widget, textSensor;
138 if (!PyArg_ParseTuple(args, (char*)"ll:getRichTextSize", &widget, &textSensor))
139 return NULL;
140 if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
141 return NULL;
142 return Py_BuildValue((char*)"l", ((RichTextLabel*)textSensor)->getFontSize());
143}
144
145PyObject* py_setRichTextFont(PyObject *, PyObject *args)
146{
147 long widget, textSensor;
148 char* text;
149 if (!PyArg_ParseTuple(args, (char*)"lls:changeRichTextFont",
150 &widget, &textSensor, &text))
151 return NULL;
152 if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
153 return NULL;
154 ((RichTextLabel*)textSensor)->setFont( text );
155 return Py_BuildValue((char*)"l", 1);
156}
157
158PyObject* py_getRichTextFont(PyObject *, PyObject *args)
159{
160 long widget, textSensor;
161 if (!PyArg_ParseTuple(args, (char*)"ll:getRichTextFont", &widget, &textSensor))
162 return NULL;
163 if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
164 return NULL;
165 return Py_BuildValue((char*)"s", ((RichTextLabel*)textSensor)->getFont().ascii());
166}
167
168// Set the width of a Rich Text Label
169PyObject* py_set_rich_text_width(PyObject*, PyObject* args)
170{
171 long widget, text, size;
172 if (!PyArg_ParseTuple(args, (char*)"lll:setRichTextWidth", &widget, &text, &size))
173 return NULL;
174 if (!checkKarambaAndMeter(widget, text, "RichTextLabel"))
175 return NULL;
176
177 RichTextLabel* richText = (RichTextLabel*) text;
178
179 richText -> setWidth(size);
180 return Py_BuildValue((char*)"l", 1);
181}
182
py_show
PyObject * py_show(PyObject *self, PyObject *args)
Misc/show.
Definition: misc_python.cpp:623
py_hide
PyObject * py_hide(PyObject *self, PyObject *args)
Misc/hide.
Definition: misc_python.cpp:641

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.9.4
This website is maintained by Timothy Pearson.