• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • @topname@
  • Sitemap
  • Contact Us
 

superkaramba

richtextlabel_python.cpp

00001 /****************************************************************************
00002 *  richtextlabel_python.cpp  -  Functions for richtext python api
00003 *
00004 *  Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
00005 *  Copyright (C) 2003-2004 Adam Geitgey <adam@rootnode.org>
00006 *  Copyright (c) 2004 Petri Damstén <damu@iki.fi>
00007 *
00008 *  This file is part of SuperKaramba.
00009 *
00010 *  SuperKaramba is free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  SuperKaramba is distributed in the hope that it will be useful,
00016 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 *  GNU General Public License for more details.
00019 *
00020 *  You should have received a copy of the GNU General Public License
00021 *  along with SuperKaramba; if not, write to the Free Software
00022 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
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 "richtextlabel.h"
00033 #include "meter_python.h"
00034 #include "richtextlabel_python.h"
00035 
00036 PyObject* py_createRichText(PyObject *, PyObject *args)
00037 {
00038   long widget, underline = 0;
00039   PyObject *text;
00040   if (!PyArg_ParseTuple(args, (char*)"lO|l:createRichText",
00041       &widget, &text, &underline))
00042     return NULL;
00043   if (!checkKaramba(widget))
00044     return NULL;
00045   RichTextLabel *tmp = new RichTextLabel((karamba*)widget);
00046   tmp->setText(PyString2TQString(text), underline);
00047   tmp->setTextProps(((karamba*)widget)->getDefaultTextProps());
00048   ((karamba*)widget)->meterList->append(tmp);
00049   ((karamba*)widget)->clickList->append(tmp);
00050   return (Py_BuildValue((char*)"l", (long)tmp));
00051 }
00052 
00053 PyObject* py_deleteRichText(PyObject *, PyObject *args)
00054 {
00055   long widget, meter;
00056   if (!PyArg_ParseTuple(args, (char*)"ll:deleteRichText", &widget, &meter))
00057     return NULL;
00058   if (!checkKarambaAndMeter(widget, meter, "RichTextLabel"))
00059     return NULL;
00060 
00061   ((karamba*)widget)->deleteMeterFromSensors((Meter*)meter);
00062   ((karamba*)widget)->clickList->removeRef((Meter*)meter);
00063   return Py_BuildValue((char*)"l",
00064       ((karamba*)widget)->meterList->removeRef((Meter*)meter));
00065 }
00066 
00067 PyObject* py_getThemeRichText(PyObject *self, PyObject *args)
00068 {
00069   return py_getThemeMeter(self, args, "RichTextLabel");
00070 }
00071 
00072 PyObject* py_getRichTextSize(PyObject *self, PyObject *args)
00073 {
00074   return py_getSize(self, args, "RichTextLabel");
00075 }
00076 
00077 PyObject* py_resizeRichText(PyObject *self, PyObject *args)
00078 {
00079   return py_resize(self, args, "RichTextLabel");
00080 }
00081 
00082 PyObject* py_getRichTextPos(PyObject *self, PyObject *args)
00083 {
00084   return py_getPos(self, args, "RichTextLabel");
00085 }
00086 
00087 PyObject* py_moveRichText(PyObject *self, PyObject *args)
00088 {
00089   return py_move(self, args, "RichTextLabel");
00090 }
00091 
00092 PyObject* py_hideRichText(PyObject *self, PyObject *args)
00093 {
00094   return py_hide(self, args, "RichTextLabel");
00095 }
00096 
00097 PyObject* py_showRichText(PyObject *self, PyObject *args)
00098 {
00099   return py_show(self, args, "RichTextLabel");
00100 }
00101 
00102 PyObject* py_getRichTextValue(PyObject *self, PyObject *args)
00103 {
00104   return py_getStringValue(self, args, "RichTextLabel");
00105 }
00106 
00107 PyObject* py_setRichTextValue(PyObject *self, PyObject *args)
00108 {
00109   return py_setStringValue(self, args, "RichTextLabel");
00110 }
00111 
00112 PyObject* py_getRichTextSensor(PyObject *self, PyObject *args)
00113 {
00114   return py_getSensor(self, args, "RichTextLabel");
00115 }
00116 
00117 PyObject* py_setRichTextSensor(PyObject *self, PyObject *args)
00118 {
00119   return py_setSensor(self, args, "RichTextLabel");
00120 }
00121 
00122 PyObject* py_setRichTextFontSize(PyObject *, PyObject *args)
00123 {
00124   long widget, textSensor;
00125   long size;
00126   if (!PyArg_ParseTuple(args, (char*)"lll:changeRichTextSize",
00127       &widget, &textSensor, &size))
00128     return NULL;
00129   if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
00130     return NULL;
00131   ((RichTextLabel*)textSensor)->setFontSize( size );
00132   return Py_BuildValue((char*)"l", 1);
00133 }
00134 
00135 PyObject* py_getRichTextFontSize(PyObject *, PyObject *args)
00136 {
00137   long widget, textSensor;
00138   if (!PyArg_ParseTuple(args, (char*)"ll:getRichTextSize", &widget, &textSensor))
00139     return NULL;
00140   if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
00141     return NULL;
00142   return Py_BuildValue((char*)"l", ((RichTextLabel*)textSensor)->getFontSize());
00143 }
00144 
00145 PyObject* py_setRichTextFont(PyObject *, PyObject *args)
00146 {
00147   long widget, textSensor;
00148   char* text;
00149   if (!PyArg_ParseTuple(args, (char*)"lls:changeRichTextFont",
00150       &widget, &textSensor, &text))
00151     return NULL;
00152   if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
00153     return NULL;
00154   ((RichTextLabel*)textSensor)->setFont( text );
00155   return Py_BuildValue((char*)"l", 1);
00156 }
00157 
00158 PyObject* py_getRichTextFont(PyObject *, PyObject *args)
00159 {
00160   long widget, textSensor;
00161   if (!PyArg_ParseTuple(args, (char*)"ll:getRichTextFont", &widget, &textSensor))
00162     return NULL;
00163   if (!checkKarambaAndMeter(widget, textSensor, "RichTextLabel"))
00164     return NULL;
00165   return Py_BuildValue((char*)"s", ((RichTextLabel*)textSensor)->getFont().ascii());
00166 }
00167 
00168 // Set the width of a Rich Text Label
00169 PyObject* py_set_rich_text_width(PyObject*, PyObject* args)
00170 {
00171   long widget, text, size;
00172   if (!PyArg_ParseTuple(args, (char*)"lll:setRichTextWidth", &widget, &text, &size))
00173       return NULL;
00174   if (!checkKarambaAndMeter(widget, text, "RichTextLabel"))
00175     return NULL;
00176 
00177   RichTextLabel* richText = (RichTextLabel*) text;
00178 
00179   richText -> setWidth(size);
00180   return Py_BuildValue((char*)"l", 1);
00181 }
00182 

superkaramba

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

@topname@

Skip menu "@topname@"
  • kcalc
  •   knumber
  • superkaramba
Generated for @topname@ by doxygen 1.5.6
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal