diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2015-10-01 18:08:45 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2015-10-01 19:33:35 +0200 |
commit | 12348780ecc7d112ffdd8d4f4dc4ccd6a63f10e7 (patch) | |
tree | 94abc892aabb1f4e2eab0cf1ff028ddfba454d60 /src/xosd.cpp | |
parent | 77649eee774e6f71da886d5c72a616a0b46e08fa (diff) | |
download | kooldock-12348780ecc7d112ffdd8d4f4dc4ccd6a63f10e7.tar.gz kooldock-12348780ecc7d112ffdd8d4f4dc4ccd6a63f10e7.zip |
Initial TQt conversion
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'src/xosd.cpp')
-rw-r--r-- | src/xosd.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/xosd.cpp b/src/xosd.cpp index 45d0799..fbedc63 100644 --- a/src/xosd.cpp +++ b/src/xosd.cpp @@ -1,12 +1,12 @@ #include "xosd.h" -#include <qpainter.h> -#include <qbitmap.h> -#include <qstring.h> -#include <qfont.h> -#include <qfontmetrics.h> +#include <ntqpainter.h> +#include <ntqbitmap.h> +#include <ntqstring.h> +#include <ntqfont.h> +#include <ntqfontmetrics.h> -#include <qwidget.h> +#include <ntqwidget.h> #include <klocale.h> #include <netwm.h> #include <netwm_def.h> @@ -15,9 +15,9 @@ #include <kdebug.h> #include <stdlib.h> -xosd::xosd(QWidget *parent, const char *name) : QWidget(parent, name, WStyle_Customize | WRepaintNoErase | WStyle_NoBorder | WDestructiveClose | WResizeNoErase | WMouseNoMask | WStyle_StaysOnTop | WX11BypassWM) +xosd::xosd(TQWidget *parent, const char *name) : TQWidget(parent, name, WStyle_Customize | WRepaintNoErase | WStyle_NoBorder | WDestructiveClose | WResizeNoErase | WMouseNoMask | WStyle_StaysOnTop | WX11BypassWM) { - info = new NETWinInfo( qt_xdisplay(), winId(), qt_xrootwin(), NET::WMState); + info = new NETWinInfo( tqt_xdisplay(), winId(), tqt_xrootwin(), NET::WMState); info->setDesktop( NETWinInfo::OnAllDesktops ); hide(); KWin::setState(winId(), NET::SkipTaskbar | NET::SkipPager); @@ -28,12 +28,12 @@ xosd::~xosd() { } -void xosd::setColor(const QString& color) +void xosd::setColor(const TQString& color) { fontColor=color; } -void xosd::setShadowColor(const QString& color) +void xosd::setShadowColor(const TQString& color) { shadowColor=color; } @@ -46,12 +46,12 @@ void xosd::setOrientation(int orientation, int w, int mh) if (fCleaner==1) { //font is set, so program can get its height to prepare background buffer - QFontMetrics *metrics = new QFontMetrics(f); + TQFontMetrics *metrics = new TQFontMetrics(f); h = metrics->height(); - bgBuffer = QPixmap(dw, h); - maskBuffer = QPixmap(dw, h, true); - bgBuffer = QPixmap::grabWindow(qt_xrootwin(), 0, 0, dw, h); + bgBuffer = TQPixmap(dw, h); + maskBuffer = TQPixmap(dw, h, true); + bgBuffer = TQPixmap::grabWindow(tqt_xrootwin(), 0, 0, dw, h); lastX=0; lastY=0; } @@ -69,15 +69,15 @@ void xosd::setShadowOffset(int off) shadowOffset=off; } -void xosd::setText(const QString& t) +void xosd::setText(const TQString& t) { - //setMask(QRegion(0,0,0,0)); + //setMask(TQRegion(0,0,0,0)); // NOTICE: it appears that with WX11BypassWM, resize() doesn't flick the widget anymore :) // so, setMask() is no more needed. // -- Matias resize(0,0); text = t; - QFontMetrics *metrics = new QFontMetrics(f); + TQFontMetrics *metrics = new TQFontMetrics(f); w = metrics->width(text); w = w + shadowOffset + 5; // 5 pixels more h = metrics->height(); @@ -85,7 +85,7 @@ void xosd::setText(const QString& t) update(); } -void xosd::setFont(const QString& font) +void xosd::setFont(const TQString& font) { f.setFamily(font); } @@ -108,26 +108,26 @@ void xosd::setSize(int size) /*int xosd::w() { - QFontMetrics *metrics = new QFontMetrics(f); + TQFontMetrics *metrics = new TQFontMetrics(f); return (metrics->width(text) + shadowOffset + 5); } int xosd::h() { - QFontMetrics *metrics = new QFontMetrics(f); + TQFontMetrics *metrics = new TQFontMetrics(f); return metrics->height(); }*/ -void xosd::paintEvent(QPaintEvent *) +void xosd::paintEvent(TQPaintEvent *) { int i, j; resize(w,h); - QPixmap pm(size()); - QBitmap bm(size()); - QPainter p; + TQPixmap pm(size()); + TQBitmap bm(size()); + TQPainter p; //Drawing text p.begin(&pm, this); @@ -139,15 +139,15 @@ void xosd::paintEvent(QPaintEvent *) else { //One colour background - work faster - p.fillRect (rect(), QColor(shadowColor)); + p.fillRect (rect(), TQColor(shadowColor)); } - p.setPen( QColor(shadowColor) ); + p.setPen( TQColor(shadowColor) ); p.setFont(f); p.drawText(shadowOffset, yOffset + shadowOffset, text, AlignCenter); // draw shadow text // now, draw normal text - p.setPen( QColor(fontColor) ); + p.setPen( TQColor(fontColor) ); p.drawText(1, yOffset, text, AlignCenter); // draw front text @@ -156,8 +156,8 @@ void xosd::paintEvent(QPaintEvent *) //Drawing mask p.begin(&bm, this); // now we must draw the text with black color for making the mask - p.setPen( Qt::white ); - p.fillRect (rect(), Qt::black); + p.setPen( TQt::white ); + p.fillRect (rect(), TQt::black); p.setFont(f); for (i=-fCleaner;i<=fCleaner;i++) { @@ -183,33 +183,33 @@ void xosd::move2(int x, int y) { if (fCleaner==1) { - QPixmap tmpBuffer; + TQPixmap tmpBuffer; //window is not hidden if (y!=rdh) { - tmpBuffer = QPixmap::grabWindow(qt_xrootwin(), 0, y, dw, h); + tmpBuffer = TQPixmap::grabWindow(tqt_xrootwin(), 0, y, dw, h); if (lastY!=rdh) { //fill background covered with the text with cached version if (fOrientation==0 ) //horizontal { - bitBlt(&tmpBuffer, lastX, 0, &maskBuffer, 0, 0, w, h, Qt::AndROP);//copying part, which hides only the text - bitBlt(&bgBuffer, lastX, 0, &maskBuffer, 0, 0, w, h, Qt::NotAndROP);//so the background won't be covered by - bitBlt(&tmpBuffer, lastX, 0, &bgBuffer, lastX, 0, w, h, Qt::OrROP);//currently visible text. + bitBlt(&tmpBuffer, lastX, 0, &maskBuffer, 0, 0, w, h, TQt::AndROP);//copying part, which hides only the text + bitBlt(&bgBuffer, lastX, 0, &maskBuffer, 0, 0, w, h, TQt::NotAndROP);//so the background won't be covered by + bitBlt(&tmpBuffer, lastX, 0, &bgBuffer, lastX, 0, w, h, TQt::OrROP);//currently visible text. } if (fOrientation==1) //vertical { if (y<lastY && (y+h)>lastY) { - bitBlt(&tmpBuffer, lastX, lastY-y, &maskBuffer, 0, 0, w, h, Qt::AndROP); - bitBlt(&bgBuffer, lastX, 0, &maskBuffer, 0, 0, w, h, Qt::NotAndROP); - bitBlt(&tmpBuffer, lastX, lastY-y, &bgBuffer, lastX, 0, w, h, Qt::OrROP); + bitBlt(&tmpBuffer, lastX, lastY-y, &maskBuffer, 0, 0, w, h, TQt::AndROP); + bitBlt(&bgBuffer, lastX, 0, &maskBuffer, 0, 0, w, h, TQt::NotAndROP); + bitBlt(&tmpBuffer, lastX, lastY-y, &bgBuffer, lastX, 0, w, h, TQt::OrROP); } if (y>lastY && (y-lastY)<h) { - bitBlt(&tmpBuffer, lastX, 0, &maskBuffer, 0, 0, w, h, Qt::AndROP); - bitBlt(&bgBuffer, lastX, y-lastY, &maskBuffer, 0, 0, w, h, Qt::NotAndROP); - bitBlt(&tmpBuffer, lastX, 0, &bgBuffer, lastX, y-lastY, w, h, Qt::OrROP); + bitBlt(&tmpBuffer, lastX, 0, &maskBuffer, 0, 0, w, h, TQt::AndROP); + bitBlt(&bgBuffer, lastX, y-lastY, &maskBuffer, 0, 0, w, h, TQt::NotAndROP); + bitBlt(&tmpBuffer, lastX, 0, &bgBuffer, lastX, y-lastY, w, h, TQt::OrROP); } } } |