diff options
Diffstat (limited to 'src/modules/objects/class_painter.cpp')
-rw-r--r-- | src/modules/objects/class_painter.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/src/modules/objects/class_painter.cpp b/src/modules/objects/class_painter.cpp index b27a24a3..a9adda33 100644 --- a/src/modules/objects/class_painter.cpp +++ b/src/modules/objects/class_painter.cpp @@ -41,12 +41,12 @@ @type: class @short: - This class provide a painter to paint line and shapes. + This class provide a painter to paint line and tqshapes. @inherits: [class]object[/class] [class]widget[/class] @description: - With this class you can draw many graphics objects from simple lines to complex shapes like pies and chords.[br] + With this class you can draw many graphics objects from simple lines to complex tqshapes like pies and chords.[br] It can also draw aligned text and pixmaps. Normally, it draws in a "natural" coordinate system, but it can also do view and world transformation.[br] The class need to be implemented into a [classfnc]$paintEvent[/classfnc](); @functions: @@ -196,8 +196,8 @@ timerevent()[br] {[br] $$->%b = $(($$->%b + 1) & 15);[br] - if ($$->%nextanim == 1) $$->$repaint(1);[br] - $$->$repaint(0);[br] + if ($$->%nextanim == 1) $$->$tqrepaint(1);[br] + $$->$tqrepaint(0);[br] }[br] drawAnim()[br] {[br] @@ -311,19 +311,19 @@ [br] privateimpl(%Btn,mousepressevent)[br] {[br] - if ($$->$parent->%nextanim==0) [br] + if ($$->$tqparent->%nextanim==0) [br] {[br] - $$->$parent->%nextanim=1[br] + $$->$tqparent->%nextanim=1[br] $$->$settext(Prev)[br] } [br] else[br] {[br] - $$->$parent->%nextanim=0[br] + $$->$tqparent->%nextanim=0[br] $$->$settext(Next)[br] }[br] }[br] [br] - %lay=$new(layout,%Hello)[br] + %lay=$new(tqlayout,%Hello)[br] %lay->$addwidget(%Btn,4,0)[br] %Hello->$setBackgroundColor("000000");[br] %Hello->$setmaximumwidth(800)[br] @@ -387,7 +387,7 @@ KVSO_END_REGISTERCLASS(KviKvsObject_painter) KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_painter,KviKvsObject) - m_pPainter = new QPainter(); + m_pPainter = new TQPainter(); m_pDeviceObject=0; @@ -414,18 +414,18 @@ if(__pXOrArray->isArray())\ KviKvsVariant * pH = __pXOrArray->array()->at(3);\ if(!(pX && pY && pW && pH))\ {\ - c->error(__tr2qs("One of the geometry array parameters is empty"));\ + c->error(__tr2qs("One of the tqgeometry array parameters is empty"));\ return false;\ }\ if(!(pX->asInteger(iX) && pY->asInteger(__iY) && pW->asInteger(__iW) && pH->asInteger(__iH)))\ {\ - c->error(__tr2qs("One of the geometry array parameters didn't evaluate to an integer"));\ + c->error(__tr2qs("One of the tqgeometry array parameters didn't evaluate to an integer"));\ return false;\ }\ } else {\ if(c->params()->count() < 4)\ {\ - QString error=function+" requires either an array as first parameter or four integers";\ + TQString error=function+" requires either an array as first parameter or four integers";\ c->error(__tr2qs(error));\ return false;\ }\ @@ -459,7 +459,7 @@ if(__pXOrArray->isArray())\ } else {\ if(c->params()->count() < 2)\ {\ - QString error=function+" requires either an array as first parameter or two integers";\ + TQString error=function+" requires either an array as first parameter or two integers";\ c->error(__tr2qs(error));\ return false;\ }\ @@ -494,7 +494,7 @@ if(__pCol1OrArray->isArray())\ } else {\ if(c->params()->count() < 3)\ {\ - QString error=function+" requires either an array as first parameter or 3 integers";\ + TQString error=function+" requires either an array as first parameter or 3 integers";\ c->error(__tr2qs(error));\ return false;\ }\ @@ -507,7 +507,7 @@ if(__pCol1OrArray->isArray())\ bool KviKvsObject_painter::functionSetFont(KviKvsObjectFunctionCall *c) { - QString szFamily,szStyle; + TQString szFamily,szStyle; kvs_int_t uSize; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("size",KVS_PT_UNSIGNEDINTEGER,0,uSize) @@ -515,15 +515,15 @@ bool KviKvsObject_painter::functionSetFont(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("style",KVS_PT_STRING,0,szStyle) KVSO_PARAMETERS_END(c) if(!m_pPainter)return true; - QFont font=m_pPainter->font(); + TQFont font=m_pPainter->font(); font.setFamily(szFamily); font.setPointSize(uSize); - if(KviQString::equalCI(szStyle,"italic")) font.setItalic(TRUE); - if(KviQString::equalCI(szStyle,"bold")) font.setBold(TRUE); - if(KviQString::equalCI(szStyle,"underline"))font.setUnderline(TRUE); - if(KviQString::equalCI(szStyle,"overline")) font.setOverline(TRUE); - if(KviQString::equalCI(szStyle,"strikeout"))font.setStrikeOut(TRUE); - if(KviQString::equalCI(szStyle,"fixedpitch")) font.setFixedPitch(TRUE); + if(KviTQString::equalCI(szStyle,"italic")) font.setItalic(TRUE); + if(KviTQString::equalCI(szStyle,"bold")) font.setBold(TRUE); + if(KviTQString::equalCI(szStyle,"underline"))font.setUnderline(TRUE); + if(KviTQString::equalCI(szStyle,"overline")) font.setOverline(TRUE); + if(KviTQString::equalCI(szStyle,"strikeout"))font.setStrikeOut(TRUE); + if(KviTQString::equalCI(szStyle,"fixedpitch")) font.setFixedPitch(TRUE); m_pPainter->setFont(font); return true; } @@ -534,20 +534,20 @@ bool KviKvsObject_painter::functionSetFontSize(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("size",KVS_PT_UNSIGNEDINTEGER,0,uSize) KVSO_PARAMETERS_END(c) if(!m_pPainter)return true; - QFont font=m_pPainter->font(); + TQFont font=m_pPainter->font(); font.setPointSize(uSize); m_pPainter->setFont(font); return true; } bool KviKvsObject_painter::functionsetBackGroundMode(KviKvsObjectFunctionCall *c) { - QString szMode; + TQString szMode; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("background mode",KVS_PT_STRING,0,szMode) KVSO_PARAMETERS_END(c) if(!m_pPainter)return true; - if(KviQString::equalCI(szMode,"Transparent")) m_pPainter->setBackgroundMode(Qt::TransparentMode); - else if(KviQString::equalCI(szMode,"Opaque")) m_pPainter->setBackgroundMode(Qt::OpaqueMode); + if(KviTQString::equalCI(szMode,"Transparent")) m_pPainter->setBackgroundMode(Qt::TransparentMode); + else if(KviTQString::equalCI(szMode,"Opaque")) m_pPainter->setBackgroundMode(Qt::OpaqueMode); else c->warning( __tr2qs("Unknown orientation")); return true; @@ -563,7 +563,7 @@ bool KviKvsObject_painter::functiondrawLine(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("w",KVS_PT_INT,KVS_PF_OPTIONAL,iW) KVSO_PARAMETER("h",KVS_PT_INT,KVS_PF_OPTIONAL,iH) KVSO_PARAMETERS_END(c) - QString function="$drawLine"; + TQString function="$drawLine"; KVSO_PARAMETERS_PAINTER(pXOrArray,iY,iW,iH) if(m_pPainter) m_pPainter->drawLine(iX,iY,iW,iH); return true; @@ -578,7 +578,7 @@ bool KviKvsObject_painter::functiondrawRect(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("w",KVS_PT_INT,KVS_PF_OPTIONAL,iW) KVSO_PARAMETER("h",KVS_PT_INT,KVS_PF_OPTIONAL,iH) KVSO_PARAMETERS_END(c) - QString function="$drawRect"; + TQString function="$drawRect"; KVSO_PARAMETERS_PAINTER(pXOrArray,iY,iW,iH) if(m_pPainter) m_pPainter->drawRect(iX,iY,iW,iH); return true; @@ -594,7 +594,7 @@ bool KviKvsObject_painter::functiondrawWinFocusRect(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("w",KVS_PT_INT,KVS_PF_OPTIONAL,iW) KVSO_PARAMETER("h",KVS_PT_INT,KVS_PF_OPTIONAL,iH) KVSO_PARAMETERS_END(c) - QString function="$drawWinFocusRect"; + TQString function="$drawWinFocusRect"; KVSO_PARAMETERS_PAINTER(pXOrArray,iY,iW,iH) #ifndef COMPILE_USE_QT4 if(m_pPainter) m_pPainter->drawWinFocusRect(iX,iY,iW,iH); @@ -611,7 +611,7 @@ bool KviKvsObject_painter::functiondrawEllipse(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("w",KVS_PT_INT,KVS_PF_OPTIONAL,iW) KVSO_PARAMETER("h",KVS_PT_INT,KVS_PF_OPTIONAL,iH) KVSO_PARAMETERS_END(c) - QString function="$drawEllipse"; + TQString function="$drawEllipse"; KVSO_PARAMETERS_PAINTER(pXOrArray,iY,iW,iH) if(m_pPainter) m_pPainter->drawEllipse(iX,iY,iW,iH); return true; @@ -628,7 +628,7 @@ bool KviKvsObject_painter::functiondrawRoundRect(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("w",KVS_PT_INT,KVS_PF_OPTIONAL,iW) KVSO_PARAMETER("h",KVS_PT_INT,KVS_PF_OPTIONAL,iH) KVSO_PARAMETERS_END(c) - QString function="$drawRoundRect"; + TQString function="$drawRoundRect"; KVSO_PARAMETERS_PAINTER(pXOrArray,iY,iW,iH) if(m_pPainter) m_pPainter->drawRoundRect(iX,iY,iW,iH,iXrnd,iYrnd); @@ -646,7 +646,7 @@ bool KviKvsObject_painter::functiondrawArc(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("w",KVS_PT_INT,KVS_PF_OPTIONAL,iW) KVSO_PARAMETER("h",KVS_PT_INT,KVS_PF_OPTIONAL,iH) KVSO_PARAMETERS_END(c) - QString function="$drawArc"; + TQString function="$drawArc"; KVSO_PARAMETERS_PAINTER(pXOrArray,iY,iW,iH) if(m_pPainter) m_pPainter->drawArc(iX,iY,iW,iH,iSangle,iLena); @@ -664,7 +664,7 @@ bool KviKvsObject_painter::functiondrawChord(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("w",KVS_PT_INT,KVS_PF_OPTIONAL,iW) KVSO_PARAMETER("h",KVS_PT_INT,KVS_PF_OPTIONAL,iH) KVSO_PARAMETERS_END(c) - QString function="$drawChord"; + TQString function="$drawChord"; KVSO_PARAMETERS_PAINTER(pXOrArray,iY,iW,iH) if(m_pPainter) m_pPainter->drawChord(iX,iY,iW,iH,iSangle,iLena); @@ -674,40 +674,40 @@ bool KviKvsObject_painter::functionsetBrush(KviKvsObjectFunctionCall *c) { KviKvsVariant * pCol1OrArray; kvs_int_t iCol1,iCol2,iCol3; - QString szColorMode; + TQString szColorMode; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("Col1_or_array",KVS_PT_VARIANT,0,pCol1OrArray) KVSO_PARAMETER("Color_2",KVS_PT_INT,KVS_PF_OPTIONAL,iCol2) KVSO_PARAMETER("Colo3_3",KVS_PT_INT,KVS_PF_OPTIONAL,iCol3) KVSO_PARAMETER("color_mode",KVS_PT_STRING,KVS_PF_OPTIONAL,szColorMode) KVSO_PARAMETERS_END(c) - QString function="$drawChord"; + TQString function="$drawChord"; KVSO_3ARRAYPARAMETERS(pCol1OrArray,iCol2,iCol3) if(!m_pPainter) return true; - if(KviQString::equalCI(szColorMode, "HSV")) - m_pPainter->setBrush(QColor(iCol1,iCol2,iCol3,QColor::Hsv)); + if(KviTQString::equalCI(szColorMode, "HSV")) + m_pPainter->setBrush(TQColor(iCol1,iCol2,iCol3,TQColor::Hsv)); else - m_pPainter->setBrush(QColor(iCol1,iCol2,iCol3,QColor::Rgb)); + m_pPainter->setBrush(TQColor(iCol1,iCol2,iCol3,TQColor::Rgb)); return true; } bool KviKvsObject_painter::functionsetPen(KviKvsObjectFunctionCall *c) { KviKvsVariant * pCol1OrArray; kvs_int_t iCol1,iCol2,iCol3; - QString szColorMode; + TQString szColorMode; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("Col1_or_array",KVS_PT_VARIANT,0,pCol1OrArray) KVSO_PARAMETER("Color_2",KVS_PT_INT,KVS_PF_OPTIONAL,iCol2) KVSO_PARAMETER("Colo3_3",KVS_PT_INT,KVS_PF_OPTIONAL,iCol3) KVSO_PARAMETER("color_mode",KVS_PT_STRING,KVS_PF_OPTIONAL,szColorMode) KVSO_PARAMETERS_END(c) - QString function="$setPen"; + TQString function="$setPen"; KVSO_3ARRAYPARAMETERS(pCol1OrArray,iCol2,iCol3) if(!m_pPainter) return true; - if(KviQString::equalCI(szColorMode, "HSV")) - m_pPainter->setPen(QColor(iCol1,iCol2,iCol3,QColor::Hsv)); + if(KviTQString::equalCI(szColorMode, "HSV")) + m_pPainter->setPen(TQColor(iCol1,iCol2,iCol3,TQColor::Hsv)); else - m_pPainter->setPen(QColor(iCol1,iCol2,iCol3,QColor::Rgb)); + m_pPainter->setPen(TQColor(iCol1,iCol2,iCol3,TQColor::Rgb)); return true; } @@ -723,7 +723,7 @@ bool KviKvsObject_painter::functiondrawPie(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("w",KVS_PT_INT,KVS_PF_OPTIONAL,iW) KVSO_PARAMETER("h",KVS_PT_INT,KVS_PF_OPTIONAL,iH) KVSO_PARAMETERS_END(c) - QString function="$drawPie"; + TQString function="$drawPie"; KVSO_PARAMETERS_PAINTER(pXOrArray,iY,iW,iH) if(m_pPainter) m_pPainter->drawPie(iX,iY,iW,iH,iSangle,iLena); @@ -737,7 +737,7 @@ bool KviKvsObject_painter::functiondrawPoint(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("x_or_array",KVS_PT_VARIANT,0,pXOrArray) KVSO_PARAMETER("y",KVS_PT_INT,KVS_PF_OPTIONAL,iY) KVSO_PARAMETERS_END(c) - QString function="$drawPoint"; + TQString function="$drawPoint"; KVSO_2ARRAYPARAMETERS(pXOrArray,iY) if(m_pPainter) m_pPainter->drawPoint(iX,iY); @@ -760,7 +760,7 @@ bool KviKvsObject_painter::functionfontAscent(KviKvsObjectFunctionCall * c) bool KviKvsObject_painter::functionfontMetricsWidth(KviKvsObjectFunctionCall * c) { - QString szText; + TQString szText; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("text",KVS_PT_STRING,0,szText) KVSO_PARAMETERS_END(c) @@ -790,9 +790,9 @@ bool KviKvsObject_painter::functionbegin(KviKvsObjectFunctionCall *c) return true; } - QPaintDevice * pd = 0; - if(pObject->inherits("KviKvsObject_pixmap"))pd =((KviKvsObject_pixmap *)pObject)->getPixmap(); - else if (pObject->inherits("KviKvsObject_widget")) pd=((KviKvsObject_widget *)pObject)->widget(); + TQPaintDevice * pd = 0; + if(pObject->inherits("KviKvsObject_pixmap"))pd =TQT_TQPAINTDEVICE(((KviKvsObject_pixmap *)pObject)->getPixmap()); + else if (pObject->inherits("KviKvsObject_widget")) pd=TQT_TQPAINTDEVICE(((KviKvsObject_widget *)pObject)->widget()); if (!pd) c->warning(__tr2qs("Widget or Pixmap required ")); @@ -803,16 +803,16 @@ bool KviKvsObject_painter::functionbegin(KviKvsObjectFunctionCall *c) } return true; } -void KviKvsObject_painter::attachDevice(KviKvsObject * o,QPaintDevice * p) +void KviKvsObject_painter::attachDevice(KviKvsObject * o,TQPaintDevice * p) { if(!m_pPainter)return; if(m_pDeviceObject)detachDevice(); m_pDeviceObject = o; // KviKvsObject_pixmap and KviKvsObject_widget object have this signal - // it is emitted BEFORE the real QPaintDevice is deleted, so we can eventually + // it is emitted BEFORE the real TQPaintDevice is deleted, so we can eventually // call m_pPainter->end() in time - QObject::connect(m_pDeviceObject,SIGNAL(aboutToDie()),this,SLOT(detachDevice())); + TQObject::connect(m_pDeviceObject,TQT_SIGNAL(aboutToDie()),this,TQT_SLOT(detachDevice())); m_pPainter->begin(p); } @@ -820,7 +820,7 @@ void KviKvsObject_painter::detachDevice() { if(!m_pDeviceObject)return; if(!m_pPainter)return; - disconnect(m_pDeviceObject,SIGNAL(aboutToDie()),this,SLOT(detachDevice())); + disconnect(m_pDeviceObject,TQT_SIGNAL(aboutToDie()),this,TQT_SLOT(detachDevice())); m_pPainter->end(); m_pDeviceObject = 0; } @@ -833,7 +833,7 @@ bool KviKvsObject_painter::functionend(KviKvsObjectFunctionCall *c) bool KviKvsObject_painter::functiondrawText(KviKvsObjectFunctionCall *c) { - QString szText,szMode; + TQString szText,szMode; kvs_int_t iX,iY,iLen; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("x",KVS_PT_INT,0,iX) @@ -845,8 +845,8 @@ bool KviKvsObject_painter::functiondrawText(KviKvsObjectFunctionCall *c) if(!m_pPainter)return true; #ifdef COMPILE_USE_QT4 if (!szMode.isEmpty()){ - if(KviQString::equalCI(szMode,"RTL"))m_pPainter->setLayoutDirection(Qt::RightToLeft); - else if(KviQString::equalCI(szMode,"LTR"))m_pPainter->setLayoutDirection(Qt::LeftToRight); + if(KviTQString::equalCI(szMode,"RTL"))m_pPainter->setLayoutDirection(TQt::RightToLeft); + else if(KviTQString::equalCI(szMode,"LTR"))m_pPainter->setLayoutDirection(TQt::LeftToRight); else { c->warning(__tr2qs("Invalid mode '%Q'"),&szMode); @@ -856,9 +856,9 @@ bool KviKvsObject_painter::functiondrawText(KviKvsObjectFunctionCall *c) m_pPainter->drawText(iX,iY,szText); #else - if(KviQString::equalCI(szMode,"Auto")) m_pPainter->drawText(iX,iY,szText,iLen,QPainter::Auto); - else if(KviQString::equalCI(szMode,"RTL")) m_pPainter->drawText(iX,iY,szText,iLen,QPainter::RTL); - else if(KviQString::equalCI(szMode,"LTR"))m_pPainter->drawText(iX,iY,szText,iLen,QPainter::LTR); + if(KviTQString::equalCI(szMode,"Auto")) m_pPainter->drawText(iX,iY,szText,iLen,TQPainter::Auto); + else if(KviTQString::equalCI(szMode,"RTL")) m_pPainter->drawText(iX,iY,szText,iLen,TQPainter::RTL); + else if(KviTQString::equalCI(szMode,"LTR"))m_pPainter->drawText(iX,iY,szText,iLen,TQPainter::LTR); else c->warning(__tr2qs("Invalid mode '%Q'"),&szMode); #endif @@ -891,7 +891,7 @@ bool KviKvsObject_painter::functiondrawPixmap(KviKvsObjectFunctionCall *c) c->warning(__tr2qs("Pixmap object required")); return true; } - QPixmap * pm=((KviKvsObject_pixmap *)obj)->getPixmap(); + TQPixmap * pm=((KviKvsObject_pixmap *)obj)->getPixmap(); m_pPainter->drawPixmap(iX,iY,*((KviKvsObject_pixmap *)obj)->getPixmap(),iStartx,iStarty,iEndx,iEndy); return true; } @@ -915,7 +915,7 @@ bool KviKvsObject_painter::functiontranslateMatrix(KviKvsObjectFunctionCall *c) KVSO_PARAMETER("trasl_y",KVS_PT_DOUBLE,0,dYtrasl) KVSO_PARAMETERS_END(c) if(!m_pPainter)return true; - QWMatrix tmpMatrix; + TQWMatrix tmpMatrix; tmpMatrix.translate(dXtrasl,dYtrasl); tmpMatrix = m_pMatrix * tmpMatrix; m_pPainter->setWorldMatrix( tmpMatrix ); @@ -975,7 +975,7 @@ bool KviKvsObject_painter::functionsetTextAntialiasing(KviKvsObjectFunctionCall KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled) KVSO_PARAMETERS_END(c) - m_pPainter->setRenderHint(QPainter::TextAntialiasing,bEnabled); + m_pPainter->setRenderHint(TQPainter::TextAntialiasing,bEnabled); return true; } bool KviKvsObject_painter::functionsetAntialiasing(KviKvsObjectFunctionCall *c) @@ -986,7 +986,7 @@ bool KviKvsObject_painter::functionsetAntialiasing(KviKvsObjectFunctionCall *c) KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled) KVSO_PARAMETERS_END(c) - m_pPainter->setRenderHint(QPainter::Antialiasing,bEnabled); + m_pPainter->setRenderHint(TQPainter::Antialiasing,bEnabled); return true; } bool KviKvsObject_painter::functionsetSmoothPixmapTransform(KviKvsObjectFunctionCall *c) @@ -997,7 +997,7 @@ bool KviKvsObject_painter::functionsetSmoothPixmapTransform(KviKvsObjectFunction KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("bEnabled",KVS_PT_BOOL,0,bEnabled) KVSO_PARAMETERS_END(c) - m_pPainter->setRenderHint(QPainter::SmoothPixmapTransform,bEnabled); + m_pPainter->setRenderHint(TQPainter::SmoothPixmapTransform,bEnabled); return true; } #endif |