diff options
Diffstat (limited to 'src/modules/objects/class_label.cpp')
-rw-r--r-- | src/modules/objects/class_label.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/src/modules/objects/class_label.cpp b/src/modules/objects/class_label.cpp index 9c629818..fcde9a18 100644 --- a/src/modules/objects/class_label.cpp +++ b/src/modules/objects/class_label.cpp @@ -21,9 +21,9 @@ // Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // -#include <qfont.h> -#include <qpixmap.h> -#include <qmessagebox.h> +#include <tqfont.h> +#include <tqpixmap.h> +#include <tqmessagebox.h> #include "class_label.h" //#include "kvi_fileutils.h" #include "kvi_error.h" @@ -34,7 +34,7 @@ -// Tables used in $setAlignment & $alignment +// Tables used in $tqsetAlignment & $tqalignment const char * const align_tbl[] = { "Left", "Right", @@ -46,34 +46,34 @@ const char * const align_tbl[] = { "WordBreak" }; #ifdef COMPILE_USE_QT4 - #define QT_LABEL_ALIGNLEFT Qt::AlignLeft - #define QT_LABEL_ALIGNRIGHT Qt::AlignRight - #define QT_LABEL_ALIGNHCENTER Qt::AlignHCenter - #define QT_LABEL_ALIGNVCENTER Qt::AlignVCenter - #define QT_LABEL_ALIGNCENTER Qt::AlignCenter - #define QT_LABEL_ALIGNTOP Qt::AlignTop - #define QT_LABEL_ALIGNBOTTOM Qt::AlignBottom - #define QT_LABEL_JUSTIFY Qt::AlignJustify + #define TQT_LABEL_ALIGNLEFT TQt::AlignLeft + #define TQT_LABEL_ALIGNRIGHT TQt::AlignRight + #define TQT_LABEL_ALIGNHCENTER TQt::AlignHCenter + #define TQT_LABEL_ALIGNVCENTER TQt::AlignVCenter + #define TQT_LABEL_ALIGNCENTER TQt::AlignCenter + #define TQT_LABEL_ALIGNTOP TQt::AlignTop + #define TQT_LABEL_ALIGNBOTTOM TQt::AlignBottom + #define TQT_LABEL_JUSTIFY TQt::AlignJustify #else - #define QT_LABEL_ALIGNLEFT QLabel::AlignLeft - #define QT_LABEL_ALIGNRIGHT QLabel::AlignRight - #define QT_LABEL_ALIGNHCENTER QLabel::AlignHCenter - #define QT_LABEL_ALIGNVCENTER QLabel::AlignVCenter - #define QT_LABEL_ALIGNCENTER QLabel::AlignCenter - #define QT_LABEL_ALIGNTOP QLabel::AlignTop - #define QT_LABEL_ALIGNBOTTOM QLabel::AlignBottom - #define QT_LABEL_JUSTIFY QLabel::WordBreak + #define TQT_LABEL_ALIGNLEFT TQLabel::AlignLeft + #define TQT_LABEL_ALIGNRIGHT TQLabel::AlignRight + #define TQT_LABEL_ALIGNHCENTER TQLabel::AlignHCenter + #define TQT_LABEL_ALIGNVCENTER TQLabel::AlignVCenter + #define TQT_LABEL_ALIGNCENTER TQLabel::AlignCenter + #define TQT_LABEL_ALIGNTOP TQLabel::AlignTop + #define TQT_LABEL_ALIGNBOTTOM TQLabel::AlignBottom + #define TQT_LABEL_JUSTIFY TQLabel::WordBreak #endif const int align_cod[] = { - QT_LABEL_ALIGNLEFT, - QT_LABEL_ALIGNRIGHT, - QT_LABEL_ALIGNHCENTER, - QT_LABEL_ALIGNVCENTER, - QT_LABEL_ALIGNCENTER, - QT_LABEL_ALIGNTOP, - QT_LABEL_ALIGNBOTTOM, - QT_LABEL_JUSTIFY, + TQT_LABEL_ALIGNLEFT, + TQT_LABEL_ALIGNRIGHT, + TQT_LABEL_ALIGNHCENTER, + TQT_LABEL_ALIGNVCENTER, + TQT_LABEL_ALIGNCENTER, + TQT_LABEL_ALIGNTOP, + TQT_LABEL_ALIGNBOTTOM, + TQT_LABEL_JUSTIFY, }; #define align_num (sizeof(align_tbl) / sizeof(align_tbl[0])) @@ -92,14 +92,14 @@ const char * const frame_tbl[] = { }; const int frame_cod[] = { - QFrame::NoFrame, - QFrame::Box, - QFrame::Panel, - QFrame::WinPanel, - QFrame::HLine, - QFrame::Plain, - QFrame::Raised, - QFrame::Sunken + TQFrame::NoFrame, + TQFrame::Box, + TQFrame::Panel, + TQFrame::WinPanel, + TQFrame::HLine, + TQFrame::Plain, + TQFrame::Raised, + TQFrame::Sunken }; #define frame_num (sizeof(frame_tbl) / sizeof(frame_tbl[0])) @@ -120,7 +120,7 @@ const int frame_cod[] = { [class]widget[/class] @description: This widget can be used to display a text or an image. It can - have different frame styles and text/image alignment. + have different frame styles and text/image tqalignment. @functions: !fn: $setText(<text:string>) Sets the text to be displayed by the label. @@ -142,17 +142,17 @@ const int frame_cod[] = { Sets auto-resize ability to enabled (if <benabled> is 1) or disabled (if <benabled> is 0). If auto-resize is enabled, the label will automagically resize itself accordingly to the 'size' of the - text it contains. + text it tqcontains. See also [classfnc]$autoResize[/classfnc](). - !fn: <string> $alignment() - Returns a string containing alignment flags that are set for + !fn: <string> $tqalignment() + Returns a string containing tqalignment flags that are set for this label. The flags are separated by commas. An example output could look like this:[br] [pre]Bottom, Right[/pre][br] - See [classfnc]$setAlignment[/classfnc]() for explanation of all - alignment flags. - !fn: $setAlignment(<flag1:string>, <flag2:string>, ...) - This function sets alignment flags, given as parameters, for + See [classfnc]$tqsetAlignment[/classfnc]() for explanation of all + tqalignment flags. + !fn: $tqsetAlignment(<flag1:string>, <flag2:string>, ...) + This function sets tqalignment flags, given as parameters, for this label. Valid flags are: [pre] Right - Text is aligned to right border[br] @@ -179,8 +179,8 @@ const int frame_cod[] = { frame-style flags and their explenation. !fn: $setFrameStyle(<flag1>, <flag2>, ...) Sets the frame-style flags to the ones passed as arguments. - The flags can either decide of the shape or shadow of the - label's frame. Valid shape flags are:[br] + The flags can either decide of the tqshape or shadow of the + label's frame. Valid tqshape flags are:[br] [pre] NoFrame - draw no frame. You shouldn't specify a shadow when using this.[br] @@ -196,9 +196,9 @@ const int frame_cod[] = { [pre] Plain - no 3D effect (draws using foreground color)[br] Raised - makes the label look like it was raised above the - parent widget[br] + tqparent widget[br] Sunken - makes the label look like it was "pushed" inside - the parent widget[br] + the tqparent widget[br] [/pre] !fn: $setImage(<image_id>) Sets the image to be displayed on this label. @@ -216,8 +216,8 @@ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_label,"label","widget") KVSO_REGISTER_HANDLER(KviKvsObject_label,"setMargin", functionSetMargin) KVSO_REGISTER_HANDLER(KviKvsObject_label,"autoResize", functionAutoResize) KVSO_REGISTER_HANDLER(KviKvsObject_label,"setAutoResize", functionSetAutoResize) - KVSO_REGISTER_HANDLER(KviKvsObject_label,"alignment", functionAlignment) - KVSO_REGISTER_HANDLER(KviKvsObject_label,"setAlignment", functionSetAlignment) + KVSO_REGISTER_HANDLER(KviKvsObject_label,"tqalignment", functionAlignment) + KVSO_REGISTER_HANDLER(KviKvsObject_label,"tqsetAlignment", functionSetAlignment) KVSO_REGISTER_HANDLER(KviKvsObject_label,"clear", functionClear) KVSO_REGISTER_HANDLER(KviKvsObject_label,"frameStyle", functionFrameStyle) KVSO_REGISTER_HANDLER(KviKvsObject_label,"setFrameStyle", functionSetFrameStyle) @@ -235,23 +235,23 @@ KVSO_END_CONSTRUCTOR(KviKvsObject_label) bool KviKvsObject_label::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams) { - setObject(new QLabel(parentScriptWidget(), name()), true); + setObject(TQT_TQOBJECT(new TQLabel(tqparentScriptWidget(), name())), true); return true; } bool KviKvsObject_label::functionSetText(KviKvsObjectFunctionCall *c) { - QString szText; + TQString szText; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("text",KVS_PT_STRING,0,szText) KVSO_PARAMETERS_END(c) if (widget()) - ((QLabel *)widget())->setText(szText); + ((TQLabel *)widget())->setText(szText); return true; } bool KviKvsObject_label::functionText(KviKvsObjectFunctionCall *c) { - if (widget()) c->returnValue()->setString(((QLabel *)widget())->text()); + if (widget()) c->returnValue()->setString(((TQLabel *)widget())->text()); return true; } @@ -261,12 +261,12 @@ bool KviKvsObject_label::functionSetMargin(KviKvsObjectFunctionCall *c) KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("margin",KVS_PT_UNSIGNEDINTEGER,0,iMargin) KVSO_PARAMETERS_END(c) - if (widget()) ((QLabel *)widget())->setMargin(iMargin); + if (widget()) ((TQLabel *)widget())->setMargin(iMargin); return true; } bool KviKvsObject_label::functionMargin(KviKvsObjectFunctionCall *c) { - if (widget()) c->returnValue()->setInteger(((QLabel *)widget())->margin()); + if (widget()) c->returnValue()->setInteger(((TQLabel *)widget())->margin()); return true; } @@ -281,7 +281,7 @@ bool KviKvsObject_label::functionSetAutoResize(KviKvsObjectFunctionCall *c) return true; #else if(widget()) - ((QLabel *)widget())->setAutoResize(bEnabled); + ((TQLabel *)widget())->setAutoResize(bEnabled); return true; #endif } @@ -290,26 +290,26 @@ bool KviKvsObject_label::functionAutoResize(KviKvsObjectFunctionCall *c) #ifdef COMPILE_USE_QT4 if (widget()) c->returnValue()->setBoolean(true); #else - if (widget()) c->returnValue()->setBoolean(((QLabel *)widget())->autoResize()); + if (widget()) c->returnValue()->setBoolean(((TQLabel *)widget())->autoResize()); #endif return true; } // bool KviKvsObject_label::functionSetAlignment(KviKvsObjectFunctionCall *c) { - QStringList alignment; + TQStringList tqalignment; KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("alignment",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,alignment) + KVSO_PARAMETER("tqalignment",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,tqalignment) KVSO_PARAMETERS_END(c) if (!widget()) return true; int align,sum=0; - for ( QStringList::Iterator it = alignment.begin(); it != alignment.end(); ++it ) + for ( TQStringList::Iterator it = tqalignment.begin(); it != tqalignment.end(); ++it ) { align = 0; for(unsigned int j = 0; j < align_num; j++) { - if(KviQString::equalCI((*it), align_tbl[j])) + if(KviTQString::equalCI((*it), align_tbl[j])) { align=align_cod[j]; break; @@ -318,16 +318,16 @@ bool KviKvsObject_label::functionSetAlignment(KviKvsObjectFunctionCall *c) if(align) sum = sum | align; else - c->warning(__tr2qs("Unknown alignment: '%Q'"),&(*it)); + c->warning(__tr2qs("Unknown tqalignment: '%Q'"),&(*it)); } - ((QLabel *)widget())->setAlignment(sum); + ((TQLabel *)widget())->tqsetAlignment(sum); return true; } bool KviKvsObject_label::functionAlignment(KviKvsObjectFunctionCall *c) { - int mode = ((QLabel *)widget())->alignment(); - QString szAlignment=""; + int mode = ((TQLabel *)widget())->tqalignment(); + TQString szAlignment=""; for(unsigned int i = 0; i < align_num; i++) { if(mode == align_cod[i]) @@ -342,7 +342,7 @@ bool KviKvsObject_label::functionAlignment(KviKvsObjectFunctionCall *c) bool KviKvsObject_label::functionClear(KviKvsObjectFunctionCall *c) { if(widget()) - ((QLabel *)widget())->clear(); + ((TQLabel *)widget())->clear(); return true; } @@ -350,18 +350,18 @@ bool KviKvsObject_label::functionClear(KviKvsObjectFunctionCall *c) bool KviKvsObject_label::functionSetFrameStyle(KviKvsObjectFunctionCall *c) { - QStringList style; + TQStringList style; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("style",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,style) KVSO_PARAMETERS_END(c) if (!widget()) return true; int framestyle,sum=0; - for ( QStringList::Iterator it = style.begin(); it != style.end(); ++it ) + for ( TQStringList::Iterator it = style.begin(); it != style.end(); ++it ) { framestyle = 0; for(unsigned int j = 0; j < align_num; j++) { - if(KviQString::equalCI((*it), frame_tbl[j])) + if(KviTQString::equalCI((*it), frame_tbl[j])) { framestyle=frame_cod[j]; break; @@ -373,7 +373,7 @@ bool KviKvsObject_label::functionSetFrameStyle(KviKvsObjectFunctionCall *c) c->warning(__tr2qs("Unknown style: '%Q'"),&(*it)); } - ((QLabel *)widget())->setFrameStyle(sum); + ((TQLabel *)widget())->setFrameStyle(sum); return true; @@ -382,8 +382,8 @@ bool KviKvsObject_label::functionSetFrameStyle(KviKvsObjectFunctionCall *c) } bool KviKvsObject_label::functionFrameStyle(KviKvsObjectFunctionCall *c) { - int mode = ((QLabel *)widget())->frameStyle(); - QString szStyle=""; + int mode = ((TQLabel *)widget())->frameStyle(); + TQString szStyle=""; for(unsigned int i = 0; i < frame_num; i++) { if(mode == frame_cod[i]) @@ -398,12 +398,12 @@ bool KviKvsObject_label::functionFrameStyle(KviKvsObjectFunctionCall *c) bool KviKvsObject_label::functionSetImage(KviKvsObjectFunctionCall *c) { - QString icon; + TQString icon; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("icon",KVS_PT_STRING,0,icon) KVSO_PARAMETERS_END(c) if(!widget())return true; - QPixmap * pix = g_pIconManager->getImage(icon); - if(pix) ((QLabel *)widget())->setPixmap(*pix); + TQPixmap * pix = g_pIconManager->getImage(icon); + if(pix) ((TQLabel *)widget())->setPixmap(*pix); return true; } |