summaryrefslogtreecommitdiffstats
path: root/src/SUSE2button.cpp
diff options
context:
space:
mode:
authorMavridis Philippe <[email protected]>2021-06-25 19:05:29 +0300
committerMavridis Philippe <[email protected]>2021-06-25 19:15:54 +0300
commita26e231b46ac6433f6500ddc9ed6b466cf38cc21 (patch)
treeeca43ec26318abfef06040103c74ccd6f1ac02eb /src/SUSE2button.cpp
parentd5914d4d3223d1bca7b1b845a229af9f30466189 (diff)
downloadtwin-style-suse2-a26e231b46ac6433f6500ddc9ed6b466cf38cc21.tar.gz
twin-style-suse2-a26e231b46ac6433f6500ddc9ed6b466cf38cc21.zip
Conversion Qt3→TQt
Signed-off-by: Mavridis Philippe <[email protected]>
Diffstat (limited to 'src/SUSE2button.cpp')
-rw-r--r--src/SUSE2button.cpp184
1 files changed, 92 insertions, 92 deletions
diff --git a/src/SUSE2button.cpp b/src/SUSE2button.cpp
index 8665ff2..0bbeaad 100644
--- a/src/SUSE2button.cpp
+++ b/src/SUSE2button.cpp
@@ -26,13 +26,13 @@
#include <math.h>
-#include <qbitmap.h>
-#include <qcursor.h>
-#include <qimage.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qtooltip.h>
-#include <qtimer.h>
+#include <tqbitmap.h>
+#include <tqcursor.h>
+#include <tqimage.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqtooltip.h>
+#include <tqtimer.h>
#include <kpixmap.h>
#include <kpixmapeffect.h>
@@ -59,11 +59,11 @@ SUSE2Button::SUSE2Button(ButtonType type, SUSE2Client *parent, const char *name)
m_iconType(NumButtonIcons),
hover(false)
{
- memset(lipstikCache, 0, sizeof(QPixmap*)*(8 + 3*(ANIMATIONSTEPS+1))*2); // set elements to 0
+ memset(lipstikCache, 0, sizeof(TQPixmap*)*(8 + 3*(ANIMATIONSTEPS+1))*2); // set elements to 0
setBackgroundMode(NoBackground);
- animTmr = new QTimer(this);
+ animTmr = new TQTimer(this);
connect(animTmr, SIGNAL(timeout() ), this, SLOT(animate() ) );
animProgress = 0;
}
@@ -168,25 +168,25 @@ void SUSE2Button::animate()
repaint(false);
}
-void SUSE2Button::enterEvent(QEvent *e)
+void SUSE2Button::enterEvent(TQEvent *e)
{
- QButton::enterEvent(e);
+ TQButton::enterEvent(e);
hover = true;
animate();
// repaint(false);
}
-void SUSE2Button::leaveEvent(QEvent *e)
+void SUSE2Button::leaveEvent(TQEvent *e)
{
- QButton::leaveEvent(e);
+ TQButton::leaveEvent(e);
hover = false;
animate();
// repaint(false);
}
-void SUSE2Button::drawButton(QPainter *painter)
+void SUSE2Button::drawButton(TQPainter *painter)
{
int type = Handler()->buttonType();
@@ -206,42 +206,42 @@ void SUSE2Button::drawButton(QPainter *painter)
}
}
-void SUSE2Button::drawPlastikBtn(QPainter *painter)
+void SUSE2Button::drawPlastikBtn(TQPainter *painter)
{
- QRect r(0, 0, width(), height());
+ TQRect r(0, 0, width(), height());
bool active = m_client->isActive();
bool down = isDown();
KPixmap backgroundTile = m_client->getTitleBarTile(active);
KPixmap tempKPixmap;
- QColor highlightColor;
+ TQColor highlightColor;
if(type() == CloseButton) {
- highlightColor = QColor(255,64,0);
+ highlightColor = TQColor(255,64,0);
} else {
- highlightColor = Qt::white;
+ highlightColor = TQt::white;
}
- QColor contourTop = alphaBlendColors(Handler()->getColor(TitleGradientFrom, active),
- Qt::black, 220);
- QColor contourBottom = alphaBlendColors(Handler()->getColor(TitleGradientTo, active),
- Qt::black, 220);
- QColor surfaceTop = alphaBlendColors(Handler()->getColor(TitleGradientFrom, active),
- Qt::white, 220);
- QColor surfaceBottom = alphaBlendColors(Handler()->getColor(TitleGradientTo, active),
- Qt::white, 220);
+ TQColor contourTop = alphaBlendColors(Handler()->getColor(TitleGradientFrom, active),
+ TQt::black, 220);
+ TQColor contourBottom = alphaBlendColors(Handler()->getColor(TitleGradientTo, active),
+ TQt::black, 220);
+ TQColor surfaceTop = alphaBlendColors(Handler()->getColor(TitleGradientFrom, active),
+ TQt::white, 220);
+ TQColor surfaceBottom = alphaBlendColors(Handler()->getColor(TitleGradientTo, active),
+ TQt::white, 220);
if (type() == CloseButton && active && Handler()->redCloseButton()) {
- contourTop = QColor(170,70,70);
- contourBottom = QColor(120,50,50);
- surfaceTop = QColor(255,70,70);
- surfaceBottom = QColor(170,50,50);
- highlightColor = QColor(140,10,10);
+ contourTop = TQColor(170,70,70);
+ contourBottom = TQColor(120,50,50);
+ surfaceTop = TQColor(255,70,70);
+ surfaceBottom = TQColor(170,50,50);
+ highlightColor = TQColor(140,10,10);
} else if (Handler()->customColors()) {
- contourTop = alphaBlendColors(Handler()->getColor(BtnBg, active), Qt::black, 185);
- contourBottom = alphaBlendColors(Handler()->getColor(BtnBg, active), Qt::black, 135);
+ contourTop = alphaBlendColors(Handler()->getColor(BtnBg, active), TQt::black, 185);
+ contourBottom = alphaBlendColors(Handler()->getColor(BtnBg, active), TQt::black, 135);
surfaceTop = Handler()->getColor(BtnBg, active);
- surfaceBottom = alphaBlendColors(Handler()->getColor(BtnBg, active), Qt::black, 185);
+ surfaceBottom = alphaBlendColors(Handler()->getColor(BtnBg, active), TQt::black, 185);
}
@@ -253,26 +253,26 @@ void SUSE2Button::drawPlastikBtn(QPainter *painter)
surfaceBottom = alphaBlendColors(surfaceBottom, highlightColor, highlightAlpha);
if (down) {
- contourTop = alphaBlendColors(contourTop, Qt::black, 200);
- contourBottom = alphaBlendColors(contourBottom, Qt::black, 200);
- surfaceTop = alphaBlendColors(surfaceTop, Qt::black, 200);
- surfaceBottom = alphaBlendColors(surfaceBottom, Qt::black, 200);
+ contourTop = alphaBlendColors(contourTop, TQt::black, 200);
+ contourBottom = alphaBlendColors(contourBottom, TQt::black, 200);
+ surfaceTop = alphaBlendColors(surfaceTop, TQt::black, 200);
+ surfaceBottom = alphaBlendColors(surfaceBottom, TQt::black, 200);
}
KPixmap buffer;
buffer.resize(width(), height());
- QPainter bP(&buffer);
+ TQPainter bP(&buffer);
// fill with the titlebar background
bP.drawTiledPixmap(0, 0, width(), width(), backgroundTile, 0, TOPMARGIN);
if (type() == MenuButton) {
- KPixmap menuIcon(m_client->icon().pixmap( QIconSet::Small, QIconSet::Normal));
+ KPixmap menuIcon(m_client->icon().pixmap( TQIconSet::Small, TQIconSet::Normal));
if (width() < menuIcon.width() || height() < menuIcon.height() ) {
menuIcon.convertFromImage( menuIcon.convertToImage().smoothScale(width(), height()));
}
double fade = animProgress * 0.09;
- KPixmapEffect::fade(menuIcon, fade, QColor(240, 240, 240));
+ KPixmapEffect::fade(menuIcon, fade, TQColor(240, 240, 240));
bP.drawPixmap((width()-menuIcon.width())/2, (height()-menuIcon.height())/2, menuIcon);
} else {
// contour
@@ -368,9 +368,9 @@ void SUSE2Button::drawPlastikBtn(QPainter *painter)
painter->drawPixmap(0, 0, buffer);
}
-void SUSE2Button::drawLipstikBtn(QPainter *painter)
+void SUSE2Button::drawLipstikBtn(TQPainter *painter)
{
- QRect r(0, 0, width(), height());
+ TQRect r(0, 0, width(), height());
bool active = m_client->isActive();
bool down = isDown();
@@ -378,30 +378,30 @@ void SUSE2Button::drawLipstikBtn(QPainter *painter)
KPixmap buffer;
buffer.resize(width(), height());
- QPainter bP(&buffer);
+ TQPainter bP(&buffer);
// fill with the titlebar background
bP.drawTiledPixmap(0, 0, width(), width(), backgroundTile, 0, TOPMARGIN);
if (type() == MenuButton)
{
- KPixmap menuIcon(m_client->icon().pixmap( QIconSet::Small, QIconSet::Normal));
+ KPixmap menuIcon(m_client->icon().pixmap( TQIconSet::Small, TQIconSet::Normal));
if (width() < menuIcon.width() || height() < menuIcon.height() ) {
menuIcon.convertFromImage( menuIcon.convertToImage().smoothScale(width(), height()));
}
double fade = animProgress * 0.09;
- KPixmapEffect::fade(menuIcon, fade, QColor(240, 240, 240));
+ KPixmapEffect::fade(menuIcon, fade, TQColor(240, 240, 240));
bP.drawPixmap((width()-menuIcon.width())/2, (height()-menuIcon.height())/2, menuIcon);
} else {
renderBtnContour(&bP, r);
if (down) {
- QColor downColor;
+ TQColor downColor;
if (type() == CloseButton && active && Handler()->redCloseButton()) {
- downColor = QColor(220,65,65).dark(115);
+ downColor = TQColor(220,65,65).dark(115);
} else if (Handler()->customColors()) {
downColor = Handler()->getColor(BtnBg, active).dark(115);
} else {
- downColor = alphaBlendColors(Handler()->getColor(TitleGradientFrom, active), Qt::black, 220).dark(115);
+ downColor = alphaBlendColors(Handler()->getColor(TitleGradientFrom, active), TQt::black, 220).dark(115);
}
bP.fillRect(r.left()+1, r.top()+2, r.width()-2, r.height()-4, downColor);
bP.setPen(downColor);
@@ -412,7 +412,7 @@ void SUSE2Button::drawLipstikBtn(QPainter *painter)
bP.drawLine(r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1);
bP.drawLine(r.right()-1, r.top()+2, r.right()-1, r.bottom()-2);
} else {
- renderBtnSurface(&bP, QRect(r.left()+1, r.top()+1, r.width()-2, r.height()-2));
+ renderBtnSurface(&bP, TQRect(r.left()+1, r.top()+1, r.width()-2, r.height()-2));
}
int dX,dY;
@@ -444,23 +444,23 @@ void SUSE2Button::drawLipstikBtn(QPainter *painter)
painter->drawPixmap(0, 0, buffer);
}
-void SUSE2Button::renderBtnContour(QPainter *p, const QRect &r)
+void SUSE2Button::renderBtnContour(TQPainter *p, const TQRect &r)
{
if((r.width() <= 0)||(r.height() <= 0))
return;
bool active = m_client->isActive();
- QColor backgroundColor;
+ TQColor backgroundColor;
if (type() == CloseButton && active && Handler()->redCloseButton()) {
- backgroundColor = QColor(220,65,65);
+ backgroundColor = TQColor(220,65,65);
} else if (Handler()->customColors()) {
backgroundColor = Handler()->getColor(BtnBg, active);
} else {
- backgroundColor = alphaBlendColors(Handler()->getColor(TitleGradientFrom, active), Qt::black, 220);
+ backgroundColor = alphaBlendColors(Handler()->getColor(TitleGradientFrom, active), TQt::black, 220);
}
- QColor contourColor = backgroundColor.dark(135);
+ TQColor contourColor = backgroundColor.dark(135);
// sides
p->setPen(contourColor);
@@ -484,26 +484,26 @@ void SUSE2Button::renderBtnContour(QPainter *p, const QRect &r)
// third part... anti-aliasing...
int intActive = active ? 0 : 1;
- renderPixel(p,QPoint(r.left()+1,r.top()),alphaAA,contourColor, 0, intActive);
- renderPixel(p,QPoint(r.left(),r.top()+1),alphaAA,contourColor, 1, intActive);
- renderPixel(p,QPoint(r.left()+1,r.bottom()),alphaAA,contourColor, 2, intActive);
- renderPixel(p,QPoint(r.left(),r.bottom()-1),alphaAA,contourColor, 3, intActive);
- renderPixel(p,QPoint(r.right()-1,r.top()),alphaAA,contourColor, 4, intActive);
- renderPixel(p,QPoint(r.right(),r.top()+1),alphaAA,contourColor, 5, intActive);
- renderPixel(p,QPoint(r.right()-1,r.bottom()),alphaAA,contourColor, 6, intActive);
- renderPixel(p,QPoint(r.right(),r.bottom()-1),alphaAA,contourColor, 7, intActive);
+ renderPixel(p,TQPoint(r.left()+1,r.top()),alphaAA,contourColor, 0, intActive);
+ renderPixel(p,TQPoint(r.left(),r.top()+1),alphaAA,contourColor, 1, intActive);
+ renderPixel(p,TQPoint(r.left()+1,r.bottom()),alphaAA,contourColor, 2, intActive);
+ renderPixel(p,TQPoint(r.left(),r.bottom()-1),alphaAA,contourColor, 3, intActive);
+ renderPixel(p,TQPoint(r.right()-1,r.top()),alphaAA,contourColor, 4, intActive);
+ renderPixel(p,TQPoint(r.right(),r.top()+1),alphaAA,contourColor, 5, intActive);
+ renderPixel(p,TQPoint(r.right()-1,r.bottom()),alphaAA,contourColor, 6, intActive);
+ renderPixel(p,TQPoint(r.right(),r.bottom()-1),alphaAA,contourColor, 7, intActive);
}
-void SUSE2Button::renderBtnSurface(QPainter *p, const QRect &r)
+void SUSE2Button::renderBtnSurface(TQPainter *p, const TQRect &r)
{
if((r.width() <= 0)||(r.height() <= 0))
return;
bool active = m_client->isActive();
- QColor backgroundColor;
+ TQColor backgroundColor;
if (type() == CloseButton && active && Handler()->redCloseButton()) {
- backgroundColor = QColor(220,65,65);
+ backgroundColor = TQColor(220,65,65);
} else if (Handler()->customColors()) {
backgroundColor = Handler()->getColor(BtnBg, active);
} else {
@@ -511,20 +511,20 @@ void SUSE2Button::renderBtnSurface(QPainter *p, const QRect &r)
if (!active)
backgroundColor = alphaBlendColors(backgroundColor,
Handler()->getColor(TitleGradientTo, active), 128);
- backgroundColor = alphaBlendColors(backgroundColor, Qt::black, 220);
+ backgroundColor = alphaBlendColors(backgroundColor, TQt::black, 220);
}
- QColor highlightColor;
+ TQColor highlightColor;
if(type() == CloseButton) {
- highlightColor = QColor(255,0,0);
+ highlightColor = TQColor(255,0,0);
} else {
- highlightColor = Qt::white;
+ highlightColor = TQt::white;
}
int highlightAlpha = static_cast<int>(255-((60/static_cast<double>(ANIMATIONSTEPS)) *
static_cast<double>(animProgress) ) );
- QColor buttonColor, bottomColor, topLineColor, bottomLineColor;
+ TQColor buttonColor, bottomColor, topLineColor, bottomLineColor;
if (Handler()->buttonType() == LIPSTIK_3D) { // Lipstik
buttonColor = backgroundColor;
@@ -547,9 +547,9 @@ void SUSE2Button::renderBtnSurface(QPainter *p, const QRect &r)
// sides,left
int height = r.height() - 2;
- renderGradient(p, QRect(r.left(), r.top()+1, 1, height), bottomColor, buttonColor, 8+animProgress, intActive);
+ renderGradient(p, TQRect(r.left(), r.top()+1, 1, height), bottomColor, buttonColor, 8+animProgress, intActive);
//right
- renderGradient(p, QRect(r.right(), r.top()+1, 1, height), bottomColor, buttonColor, 9+ANIMATIONSTEPS+animProgress, intActive);
+ renderGradient(p, TQRect(r.right(), r.top()+1, 1, height), bottomColor, buttonColor, 9+ANIMATIONSTEPS+animProgress, intActive);
//top
p->setPen(topLineColor);
p->drawLine(r.left()+1, r.top(), r.right()-1, r.top() );
@@ -562,21 +562,21 @@ void SUSE2Button::renderBtnSurface(QPainter *p, const QRect &r)
height = r.height();
width-=2;
height-=2;
- renderGradient(p, QRect(r.left()+1, r.top()+1, width, height), bottomColor, buttonColor,
+ renderGradient(p, TQRect(r.left()+1, r.top()+1, width, height), bottomColor, buttonColor,
10 + 2 * ANIMATIONSTEPS+animProgress, intActive);
}
-void SUSE2Button::renderPixel(QPainter *p, const QPoint &pos, const int alpha, const QColor &color,
+void SUSE2Button::renderPixel(TQPainter *p, const TQPoint &pos, const int alpha, const TQColor &color,
const int pixelPos, const int active)
{
if (lipstikCache[pixelPos][active]) {
p->drawPixmap(pos, *(lipstikCache[pixelPos][active]));
} else {
- QRgb rgb = color.rgb();
- QImage aImg(1,1,32); // 1x1
+ TQRgb rgb = color.rgb();
+ TQImage aImg(1,1,32); // 1x1
aImg.setAlphaBuffer(true);
- aImg.setPixel(0,0,qRgba(qRed(rgb),qGreen(rgb),qBlue(rgb),alpha));
- QPixmap *result = new QPixmap(aImg);
+ aImg.setPixel(0,0,tqRgba(tqRed(rgb),tqGreen(rgb),tqBlue(rgb),alpha));
+ TQPixmap *result = new TQPixmap(aImg);
p->drawPixmap(pos, *result);
@@ -585,7 +585,7 @@ void SUSE2Button::renderPixel(QPainter *p, const QPoint &pos, const int alpha, c
}
}
-void SUSE2Button::renderGradient(QPainter *painter, const QRect &rect, const QColor &c1, const QColor &c2,
+void SUSE2Button::renderGradient(TQPainter *painter, const TQRect &rect, const TQColor &c1, const TQColor &c2,
const int gradient, const int active)
{
if((rect.width() <= 0)||(rect.height() <= 0))
@@ -595,8 +595,8 @@ void SUSE2Button::renderGradient(QPainter *painter, const QRect &rect, const QCo
painter->drawTiledPixmap(rect, *(lipstikCache[gradient][active]));
} else {
// there wasn't anything matching in the cache, create the pixmap now...
- QPixmap *result = new QPixmap(10, rect.height());
- QPainter p(result);
+ TQPixmap *result = new TQPixmap(10, rect.height());
+ TQPainter p(result);
int r_h = result->rect().height();
int r_x, r_y, r_x2, r_y2;
@@ -626,7 +626,7 @@ void SUSE2Button::renderGradient(QPainter *painter, const QRect &rect, const QCo
gl += gdelta;
bl += bdelta;
- p.setPen(QColor(rl>>16, gl>>16, bl>>16));
+ p.setPen(TQColor(rl>>16, gl>>16, bl>>16));
p.drawLine(r_x, r_y+y, r_x2, r_y+y);
}
@@ -640,15 +640,15 @@ void SUSE2Button::renderGradient(QPainter *painter, const QRect &rect, const QCo
}
}
-QBitmap IconEngine::icon(ButtonIcon icon, int size)
+TQBitmap IconEngine::icon(ButtonIcon icon, int size)
{
- QBitmap bitmap(size,size);
- bitmap.fill(Qt::color0);
- QPainter p(&bitmap);
+ TQBitmap bitmap(size,size);
+ bitmap.fill(TQt::color0);
+ TQPainter p(&bitmap);
- p.setPen(Qt::color1);
+ p.setPen(TQt::color1);
- QRect r = bitmap.rect();
+ TQRect r = bitmap.rect();
// line widths
int lwTitleBar = 1;
@@ -883,7 +883,7 @@ QBitmap IconEngine::icon(ButtonIcon icon, int size)
lw2 = 1;
}
- int h = QMAX( (r.width()/2), (lw1+2*lw2) );
+ int h = TQMAX( (r.width()/2), (lw1+2*lw2) );
// horizontal bars
drawObject(p, HorizontalLine, r.x(), r.y(), r.width(), lw1);
@@ -906,7 +906,7 @@ QBitmap IconEngine::icon(ButtonIcon icon, int size)
return bitmap;
}
-void IconEngine::drawObject(QPainter &p, Object object, int x, int y, int length, int lineWidth)
+void IconEngine::drawObject(TQPainter &p, Object object, int x, int y, int length, int lineWidth)
{
switch(object) {
case DiagonalLine: