summaryrefslogtreecommitdiffstats
path: root/src/qeffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qeffects.cpp')
-rw-r--r--src/qeffects.cpp266
1 files changed, 133 insertions, 133 deletions
diff --git a/src/qeffects.cpp b/src/qeffects.cpp
index 4658373..45ff01d 100644
--- a/src/qeffects.cpp
+++ b/src/qeffects.cpp
@@ -1,8 +1,8 @@
#if 0
-// Note: this file has been copied from the Qt source.
-// Those classes are normally used internally in Qt
-// but we need them for immitate the roll-over effect of QComboBox.
+// Note: this file has been copied from the TQt source.
+// Those classes are normally used internally in TQt
+// but we need them for immitate the roll-over effect of TQComboBox.
//
// A portion of code has been added. It's underlined by "THIS CODE WAS ADDED:".
//
@@ -12,33 +12,33 @@
/****************************************************************************
** $Id: qt/qeffects.cpp 3.3.4 edited Dec 10 10:13 $
**
-** Implementation of QEffects functions
+** Implementation of TQEffects functions
**
** Created : 000621
**
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
-** This file is part of the widgets module of the Qt GUI Toolkit.
+** This file is part of the widgets module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
+** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-** licenses may use this file in accordance with the Qt Commercial License
+** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
+** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** information about TQt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
@@ -46,51 +46,51 @@
**
**********************************************************************/
-#include "qapplication.h"
-#ifndef QT_NO_EFFECTS
-#include "qwidget.h"
-#include "qeffects.h"
-#include "qpixmap.h"
-#include "qimage.h"
-#include "qtimer.h"
-#include "qdatetime.h"
-#include "qguardedptr.h"
-#include "qscrollview.h"
+#include "tqapplication.h"
+#ifndef TQT_NO_EFFECTS
+#include "tqwidget.h"
+#include "tqeffects.h"
+#include "tqpixmap.h"
+#include "tqimage.h"
+#include "tqtimer.h"
+#include "tqdatetime.h"
+#include "tqguardedptr.h"
+#include "tqscrollview.h"
/* REMOVED CLASS DEFINITION HERE (MOVED TO qeffects.h) */
-static QAlphaWidget* q_blend = 0;
+static TQAlphaWidget* q_blend = 0;
/*
- Constructs a QAlphaWidget.
+ Constructs a TQAlphaWidget.
*/
-QAlphaWidget::QAlphaWidget( QWidget* w, WFlags f )
- : QWidget( QApplication::desktop()->screen(QApplication::desktop()->screenNumber(w)),
+TQAlphaWidget::TQAlphaWidget( TQWidget* w, WFlags f )
+ : TQWidget( TQApplication::desktop()->screen(TQApplication::desktop()->screenNumber(w)),
"qt internal alpha effect widget", f )
{
-#if 1 //ndef Q_WS_WIN
+#if 1 //ndef TQ_WS_WIN
setEnabled( FALSE );
#endif
- pm.setOptimization( QPixmap::BestOptim );
+ pm.setOptimization( TQPixmap::BestOptim );
setBackgroundMode( NoBackground );
- widget = (QAccessWidget*)w;
+ widget = (TQAccessWidget*)w;
alpha = 0;
}
/*
\reimp
*/
-void QAlphaWidget::paintEvent( QPaintEvent* )
+void TQAlphaWidget::paintEvent( TQPaintEvent* )
{
- bitBlt( this, QPoint(0,0), &pm );
+ bitBlt( this, TQPoint(0,0), &pm );
}
/*
Starts the alphablending animation.
The animation will take about \a time ms
*/
-void QAlphaWidget::run( int time )
+void TQAlphaWidget::run( int time )
{
duration = time;
@@ -104,20 +104,20 @@ void QAlphaWidget::run( int time )
checkTime.start();
showWidget = TRUE;
- qApp->installEventFilter( this );
+ tqApp->installEventFilter( this );
widget->setWState( WState_Visible );
- move( widget->geometry().x(),widget->geometry().y() );
+ move( widget->tqgeometry().x(),widget->tqgeometry().y() );
resize( widget->size().width(), widget->size().height() );
- front = QImage( widget->size(), 32 );
- front = QPixmap::grabWidget( widget );
+ front = TQImage( widget->size(), 32 );
+ front = TQPixmap::grabWidget( widget );
- back = QImage( widget->size(), 32 );
- back = QPixmap::grabWindow( QApplication::desktop()->winId(),
- widget->geometry().x(), widget->geometry().y(),
- widget->geometry().width(), widget->geometry().height() );
+ back = TQImage( widget->size(), 32 );
+ back = TQPixmap::grabWindow( TQApplication::desktop()->winId(),
+ widget->tqgeometry().x(), widget->tqgeometry().y(),
+ widget->tqgeometry().width(), widget->tqgeometry().height() );
if ( !back.isNull() && checkTime.elapsed() < duration / 2 ) {
mixed = back.copy();
@@ -125,7 +125,7 @@ void QAlphaWidget::run( int time )
show();
setEnabled(FALSE);
- connect( &anim, SIGNAL(timeout()), this, SLOT(render()));
+ connect( &anim, TQT_SIGNAL(timeout()), this, TQT_SLOT(render()));
anim.start( 1 );
} else {
duration = 0;
@@ -136,32 +136,32 @@ void QAlphaWidget::run( int time )
/*
\reimp
*/
-bool QAlphaWidget::eventFilter( QObject* o, QEvent* e )
+bool TQAlphaWidget::eventFilter( TQObject* o, TQEvent* e )
{
switch ( e->type() ) {
- case QEvent::Move:
+ case TQEvent::Move:
if ( o != widget )
break;
- move( widget->geometry().x(),widget->geometry().y() );
+ move( widget->tqgeometry().x(),widget->tqgeometry().y() );
update();
break;
- case QEvent::Hide:
- case QEvent::Close:
+ case TQEvent::Hide:
+ case TQEvent::Close:
if ( o != widget )
break;
- case QEvent::MouseButtonPress:
-#ifndef QT_NO_SCROLLVIEW
- if ( ::qt_cast<QScrollView*>(o) )
+ case TQEvent::MouseButtonPress:
+#ifndef TQT_NO_SCROLLVIEW
+ if ( ::tqqt_cast<TQScrollView*>(o) )
break;
#endif
- case QEvent::MouseButtonDblClick:
+ case TQEvent::MouseButtonDblClick:
setEnabled(TRUE);
showWidget = FALSE;
render();
break;
- case QEvent::KeyPress:
+ case TQEvent::KeyPress:
{
- QKeyEvent *ke = (QKeyEvent*)e;
+ TQKeyEvent *ke = (TQKeyEvent*)e;
if ( ke->key() == Key_Escape )
showWidget = FALSE;
else
@@ -172,13 +172,13 @@ bool QAlphaWidget::eventFilter( QObject* o, QEvent* e )
default:
break;
}
- return QWidget::eventFilter( o, e );
+ return TQWidget::eventFilter( o, e );
}
/*
\reimp
*/
-void QAlphaWidget::closeEvent( QCloseEvent *e )
+void TQAlphaWidget::closeEvent( TQCloseEvent *e )
{
e->accept();
if ( !q_blend )
@@ -187,7 +187,7 @@ void QAlphaWidget::closeEvent( QCloseEvent *e )
showWidget = FALSE;
render();
- QWidget::closeEvent( e );
+ TQWidget::closeEvent( e );
}
/*
@@ -196,7 +196,7 @@ void QAlphaWidget::closeEvent( QCloseEvent *e )
Show the blended widget and free all allocated source
if the blending is finished.
*/
-void QAlphaWidget::render()
+void TQAlphaWidget::render()
{
int tempel = checkTime.elapsed();
if ( elapsed >= tempel )
@@ -210,11 +210,11 @@ void QAlphaWidget::render()
alpha = 1;
if ( alpha >= 1 || !showWidget) {
anim.stop();
- qApp->removeEventFilter( this );
+ tqApp->removeEventFilter( this );
if ( widget ) {
if ( !showWidget ) {
-#ifdef Q_WS_WIN
+#ifdef TQ_WS_WIN
setEnabled(TRUE);
setFocus();
#endif
@@ -223,8 +223,8 @@ void QAlphaWidget::render()
widget->clearWState( WState_Visible );
} else if ( duration ) {
BackgroundMode bgm = widget->backgroundMode();
- QColor erc = widget->eraseColor();
- const QPixmap *erp = widget->erasePixmap();
+ TQColor erc = widget->eraseColor();
+ const TQPixmap *erp = widget->erasePixmap();
widget->clearWState( WState_Visible );
widget->setBackgroundMode( NoBackground );
@@ -251,14 +251,14 @@ void QAlphaWidget::render()
widget->clearWState( WState_ForceHide );
alphaBlend();
pm = mixed;
- repaint( FALSE );
+ tqrepaint( FALSE );
}
}
/*
Calculate an alphablended image.
*/
-void QAlphaWidget::alphaBlend()
+void TQAlphaWidget::alphaBlend()
{
const double ia = 1-alpha;
const int sw = front.width();
@@ -266,20 +266,20 @@ void QAlphaWidget::alphaBlend()
switch( front.depth() ) {
case 32:
{
- Q_UINT32** md = (Q_UINT32**)mixed.jumpTable();
- Q_UINT32** bd = (Q_UINT32**)back.jumpTable();
- Q_UINT32** fd = (Q_UINT32**)front.jumpTable();
+ TQ_UINT32** md = (TQ_UINT32**)mixed.jumpTable();
+ TQ_UINT32** bd = (TQ_UINT32**)back.jumpTable();
+ TQ_UINT32** fd = (TQ_UINT32**)front.jumpTable();
for (int sy = 0; sy < sh; sy++ ) {
- Q_UINT32* bl = ((Q_UINT32*)bd[sy]);
- Q_UINT32* fl = ((Q_UINT32*)fd[sy]);
+ TQ_UINT32* bl = ((TQ_UINT32*)bd[sy]);
+ TQ_UINT32* fl = ((TQ_UINT32*)fd[sy]);
for (int sx = 0; sx < sw; sx++ ) {
- Q_UINT32 bp = bl[sx];
- Q_UINT32 fp = fl[sx];
+ TQ_UINT32 bp = bl[sx];
+ TQ_UINT32 fp = fl[sx];
- ((Q_UINT32*)(md[sy]))[sx] = qRgb(int (qRed(bp)*ia + qRed(fp)*alpha),
- int (qGreen(bp)*ia + qGreen(fp)*alpha),
- int (qBlue(bp)*ia + qBlue(fp)*alpha) );
+ ((TQ_UINT32*)(md[sy]))[sx] = tqRgb(int (tqRed(bp)*ia + tqRed(fp)*alpha),
+ int (tqGreen(bp)*ia + tqGreen(fp)*alpha),
+ int (tqBlue(bp)*ia + tqBlue(fp)*alpha) );
}
}
}
@@ -290,19 +290,19 @@ void QAlphaWidget::alphaBlend()
/* REMOVED CLASS DEFINITION HERE (MOVED TO qeffects.h) */
-static QRollEffect* q_roll = 0;
+static TQRollEffect* q_roll = 0;
/*
- Construct a QRollEffect widget.
+ Construct a TQRollEffect widget.
*/
-QRollEffect::QRollEffect( QWidget* w, WFlags f, DirFlags orient )
- : QWidget( QApplication::desktop()->screen(QApplication::desktop()->screenNumber(w)),
+TQRollEffect::TQRollEffect( TQWidget* w, WFlags f, DirFlags orient )
+ : TQWidget( TQApplication::desktop()->screen(TQApplication::desktop()->screenNumber(w)),
"qt internal roll effect widget", f ), orientation(orient)
{
-#if 1 //ndef Q_WS_WIN
+#if 1 //ndef TQ_WS_WIN
setEnabled( FALSE );
#endif
- widget = (QAccessWidget*) w;
+ widget = (TQAccessWidget*) w;
Q_ASSERT( widget );
setBackgroundMode( NoBackground );
@@ -311,8 +311,8 @@ QRollEffect::QRollEffect( QWidget* w, WFlags f, DirFlags orient )
totalWidth = widget->width();
totalHeight = widget->height();
} else {
- totalWidth = widget->sizeHint().width();
- totalHeight = widget->sizeHint().height();
+ totalWidth = widget->tqsizeHint().width();
+ totalHeight = widget->tqsizeHint().height();
}
currentHeight = totalHeight;
@@ -323,17 +323,17 @@ QRollEffect::QRollEffect( QWidget* w, WFlags f, DirFlags orient )
if ( orientation & (DownScroll|UpScroll) )
currentHeight = 0;
- pm.setOptimization( QPixmap::BestOptim );
- pm = QPixmap::grabWidget( widget );
+ pm.setOptimization( TQPixmap::BestOptim );
+ pm = TQPixmap::grabWidget( widget );
}
/*
\reimp
*/
-void QRollEffect::paintEvent( QPaintEvent* )
+void TQRollEffect::paintEvent( TQPaintEvent* )
{
- int x = orientation & RightScroll ? QMIN(0, currentWidth - totalWidth) : 0;
- int y = orientation & DownScroll ? QMIN(0, currentHeight - totalHeight) : 0;
+ int x = orientation & RightScroll ? TQMIN(0, currentWidth - totalWidth) : 0;
+ int y = orientation & DownScroll ? TQMIN(0, currentHeight - totalHeight) : 0;
bitBlt( this, x, y, &pm,
0, 0, pm.width(), pm.height(), CopyROP, TRUE );
@@ -342,17 +342,17 @@ void QRollEffect::paintEvent( QPaintEvent* )
/*
\reimp
*/
-bool QRollEffect::eventFilter( QObject* o, QEvent* e )
+bool TQRollEffect::eventFilter( TQObject* o, TQEvent* e )
{
switch ( e->type() ) {
- case QEvent::Move:
+ case TQEvent::Move:
if ( o != widget )
break;
- move( widget->geometry().x(),widget->geometry().y() );
+ move( widget->tqgeometry().x(),widget->tqgeometry().y() );
update();
break;
- case QEvent::Hide:
- case QEvent::Close:
+ case TQEvent::Hide:
+ case TQEvent::Close:
if ( o != widget || done )
break;
setEnabled(TRUE);
@@ -360,12 +360,12 @@ bool QRollEffect::eventFilter( QObject* o, QEvent* e )
done = TRUE;
scroll();
break;
- case QEvent::MouseButtonPress:
-#ifndef QT_NO_SCROLLVIEW
- if ( ::qt_cast<QScrollView*>(o) )
+ case TQEvent::MouseButtonPress:
+#ifndef TQT_NO_SCROLLVIEW
+ if ( ::tqqt_cast<TQScrollView*>(o) )
break;
#endif
- case QEvent::MouseButtonDblClick:
+ case TQEvent::MouseButtonDblClick:
if ( done )
break;
setEnabled(TRUE);
@@ -373,13 +373,13 @@ bool QRollEffect::eventFilter( QObject* o, QEvent* e )
done = TRUE;
scroll();
break;
- case QEvent::KeyPress:
+ case TQEvent::KeyPress:
{
- QKeyEvent *ke = (QKeyEvent*)e;
+ TQKeyEvent *ke = (TQKeyEvent*)e;
/* THIS CODE WAS ADDED: ************** */
- if (ke->key() == Qt::Key_Enter) /*** Because we are simulating an Enter key press. */
+ if (ke->key() == TQt::Key_Enter) /*** Because we are simulating an Enter key press. */
break; /*** So we should not car about it and continue the animation. */
/************************************* */
@@ -393,13 +393,13 @@ bool QRollEffect::eventFilter( QObject* o, QEvent* e )
default:
break;
}
- return QWidget::eventFilter( o, e );
+ return TQWidget::eventFilter( o, e );
}
/*
\reimp
*/
-void QRollEffect::closeEvent( QCloseEvent *e )
+void TQRollEffect::closeEvent( TQCloseEvent *e )
{
e->accept();
if ( done )
@@ -408,7 +408,7 @@ void QRollEffect::closeEvent( QCloseEvent *e )
done = TRUE;
scroll();
- QWidget::closeEvent( e );
+ TQWidget::closeEvent( e );
}
/*
@@ -417,7 +417,7 @@ void QRollEffect::closeEvent( QCloseEvent *e )
The animation will take about \a time ms, or is
calculated if \a time is negative
*/
-void QRollEffect::run( int time )
+void TQRollEffect::run( int time )
{
if ( !widget )
return;
@@ -431,20 +431,20 @@ void QRollEffect::run( int time )
dist += totalWidth - currentWidth;
if ( orientation & (DownScroll|UpScroll) )
dist += totalHeight - currentHeight;
- duration = QMIN( QMAX( dist/3, 50 ), 120 );
+ duration = TQMIN( TQMAX( dist/3, 50 ), 120 );
}
- connect( &anim, SIGNAL(timeout()), this, SLOT(scroll()));
+ connect( &anim, TQT_SIGNAL(timeout()), this, TQT_SLOT(scroll()));
widget->setWState( WState_Visible );
- move( widget->geometry().x(),widget->geometry().y() );
- resize( QMIN( currentWidth, totalWidth ), QMIN( currentHeight, totalHeight ) );
+ move( widget->tqgeometry().x(),widget->tqgeometry().y() );
+ resize( TQMIN( currentWidth, totalWidth ), TQMIN( currentHeight, totalHeight ) );
show();
setEnabled(FALSE);
- qApp->installEventFilter( this );
+ tqApp->installEventFilter( this );
showWidget = TRUE;
done = FALSE;
@@ -455,7 +455,7 @@ void QRollEffect::run( int time )
/*
Roll according to the time elapsed.
*/
-void QRollEffect::scroll()
+void TQRollEffect::scroll()
{
if ( !done && widget) {
widget->clearWState( WState_ForceHide );
@@ -484,32 +484,32 @@ void QRollEffect::scroll()
int w = totalWidth;
int h = totalHeight;
- int x = widget->geometry().x();
- int y = widget->geometry().y();
+ int x = widget->tqgeometry().x();
+ int y = widget->tqgeometry().y();
if ( orientation & RightScroll || orientation & LeftScroll )
- w = QMIN( currentWidth, totalWidth );
+ w = TQMIN( currentWidth, totalWidth );
if ( orientation & DownScroll || orientation & UpScroll )
- h = QMIN( currentHeight, totalHeight );
+ h = TQMIN( currentHeight, totalHeight );
setUpdatesEnabled( FALSE );
if ( orientation & UpScroll )
- y = widget->geometry().y() + QMAX( 0, totalHeight - currentHeight );
+ y = widget->tqgeometry().y() + TQMAX( 0, totalHeight - currentHeight );
if ( orientation & LeftScroll )
- x = widget->geometry().x() + QMAX( 0, totalWidth - currentWidth );
+ x = widget->tqgeometry().x() + TQMAX( 0, totalWidth - currentWidth );
if ( orientation & UpScroll || orientation & LeftScroll )
move( x, y );
resize( w, h );
setUpdatesEnabled( TRUE );
- repaint( FALSE );
+ tqrepaint( FALSE );
}
if ( done ) {
anim.stop();
- qApp->removeEventFilter( this );
+ tqApp->removeEventFilter( this );
if ( widget ) {
if ( !showWidget ) {
-#ifdef Q_WS_WIN
+#ifdef TQ_WS_WIN
setEnabled(TRUE);
setFocus();
#endif
@@ -518,8 +518,8 @@ void QRollEffect::scroll()
widget->clearWState( WState_Visible );
} else {
BackgroundMode bgm = widget->backgroundMode();
- QColor erc = widget->eraseColor();
- const QPixmap *erp = widget->erasePixmap();
+ TQColor erc = widget->eraseColor();
+ const TQPixmap *erp = widget->erasePixmap();
widget->clearWState( WState_Visible );
widget->setBackgroundMode( NoBackground );
@@ -551,52 +551,52 @@ void QRollEffect::scroll()
Scroll widget \a w in \a time ms. \a orient may be 1 (vertical), 2
(horizontal) or 3 (diagonal).
*/
-void qScrollEffect( QWidget* w, QEffects::DirFlags orient, int time )
+void qScrollEffect( TQWidget* w, TQEffects::DirFlags orient, int time )
{
if ( q_roll ) {
delete q_roll;
q_roll = 0;
}
- qApp->sendPostedEvents( w, QEvent::Move );
- qApp->sendPostedEvents( w, QEvent::Resize );
-#ifdef Q_WS_X11
- uint flags = Qt::WStyle_Customize | Qt::WNoAutoErase | Qt::WStyle_StaysOnTop
- | (w->isPopup() ? Qt::WType_Popup : (Qt::WX11BypassWM | Qt::WStyle_Tool));
+ tqApp->sendPostedEvents( w, TQEvent::Move );
+ tqApp->sendPostedEvents( w, TQEvent::Resize );
+#ifdef TQ_WS_X11
+ uint flags = TQt::WStyle_Customize | TQt::WNoAutoErase | TQt::WStyle_StaysOnTop
+ | (w->isPopup() ? TQt::WType_Popup : (TQt::WX11BypassWM | TQt::WStyle_Tool));
#else
- uint flags = Qt::WStyle_Customize | Qt::WType_Popup | Qt::WX11BypassWM | Qt::WNoAutoErase | Qt::WStyle_StaysOnTop;
+ uint flags = TQt::WStyle_Customize | TQt::WType_Popup | TQt::WX11BypassWM | TQt::WNoAutoErase | TQt::WStyle_StaysOnTop;
#endif
// those can popups - they would steal the focus, but are disabled
- q_roll = new QRollEffect( w, flags, orient );
+ q_roll = new TQRollEffect( w, flags, orient );
q_roll->run( time );
}
/*!
Fade in widget \a w in \a time ms.
*/
-void qFadeEffect( QWidget* w, int time )
+void qFadeEffect( TQWidget* w, int time )
{
if ( q_blend ) {
delete q_blend;
q_blend = 0;
}
- qApp->sendPostedEvents( w, QEvent::Move );
- qApp->sendPostedEvents( w, QEvent::Resize );
+ tqApp->sendPostedEvents( w, TQEvent::Move );
+ tqApp->sendPostedEvents( w, TQEvent::Resize );
-#ifdef Q_WS_X11
- uint flags = Qt::WStyle_Customize | Qt::WNoAutoErase | Qt::WStyle_StaysOnTop
- | (w->isPopup() ? Qt::WType_Popup : (Qt::WX11BypassWM | Qt::WStyle_Tool));
+#ifdef TQ_WS_X11
+ uint flags = TQt::WStyle_Customize | TQt::WNoAutoErase | TQt::WStyle_StaysOnTop
+ | (w->isPopup() ? TQt::WType_Popup : (TQt::WX11BypassWM | TQt::WStyle_Tool));
#else
- uint flags = Qt::WStyle_Customize | Qt::WType_Popup | Qt::WX11BypassWM | Qt::WNoAutoErase | Qt::WStyle_StaysOnTop;
+ uint flags = TQt::WStyle_Customize | TQt::WType_Popup | TQt::WX11BypassWM | TQt::WNoAutoErase | TQt::WStyle_StaysOnTop;
#endif
// those can popups - they would steal the focus, but are disabled
- q_blend = new QAlphaWidget( w, flags );
+ q_blend = new TQAlphaWidget( w, flags );
q_blend->run( time );
}
-#endif //QT_NO_EFFECTS
+#endif //TQT_NO_EFFECTS
#endif // #if 0