summaryrefslogtreecommitdiffstats
path: root/lib/kofficecore/KoFrame.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/kofficecore/KoFrame.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kofficecore/KoFrame.cpp')
-rw-r--r--lib/kofficecore/KoFrame.cpp152
1 files changed, 76 insertions, 76 deletions
diff --git a/lib/kofficecore/KoFrame.cpp b/lib/kofficecore/KoFrame.cpp
index 4c07d5c1..b6f77b8a 100644
--- a/lib/kofficecore/KoFrame.cpp
+++ b/lib/kofficecore/KoFrame.cpp
@@ -20,12 +20,12 @@
#include <KoFrame.h>
#include <KoView.h>
-#include <qpainter.h>
+#include <tqpainter.h>
#include <kparts/event.h>
#include <kcursor.h>
#include <kdebug.h>
-#define QMAX32767(a,b) QMAX(QMAX(32767,a),b)
+#define TQMAX32767(a,b) TQMAX(TQMAX(32767,a),b)
class KoFramePrivate
{
@@ -39,8 +39,8 @@ public:
KoView *m_view;
- QPoint m_mousePressPos;
- QPoint m_framePos;
+ TQPoint m_mousePressPos;
+ TQPoint m_framePos;
int m_width;
int m_height;
int m_mode;
@@ -48,8 +48,8 @@ public:
KoFrame::State m_state;
};
-KoFrame::KoFrame( QWidget *parent, const char *name )
- : QWidget( parent, name )
+KoFrame::KoFrame( TQWidget *tqparent, const char *name )
+ : TQWidget( tqparent, name )
{
d = new KoFramePrivate;
d->m_state = Inactive;
@@ -97,12 +97,12 @@ void KoFrame::setState( State s )
{
/*
kdDebug(30003) << "KoFrame::setView setMaximumSize "
- << "QMAX32767(" << d->m_view->maximumWidth() + 2 * border() << "," << d->m_view->maximumWidth() << "), "
- << "QMAX32767(" << d->m_view->maximumHeight() + 2 * border() << "," << d->m_view->maximumHeight() << ")"
+ << "TQMAX32767(" << d->m_view->maximumWidth() + 2 * border() << "," << d->m_view->maximumWidth() << "), "
+ << "TQMAX32767(" << d->m_view->maximumHeight() + 2 * border() << "," << d->m_view->maximumHeight() << ")"
<< endl;
*/
- setMaximumSize( QMAX32767( d->m_view->maximumWidth() + 2 * border(), d->m_view->maximumWidth() ),
- QMAX32767( d->m_view->maximumHeight() + 2 * border(), d->m_view->maximumHeight() ) );
+ setMaximumSize( TQMAX32767( d->m_view->maximumWidth() + 2 * border(), d->m_view->maximumWidth() ),
+ TQMAX32767( d->m_view->maximumHeight() + 2 * border(), d->m_view->maximumHeight() ) );
setMinimumSize( d->m_view->minimumWidth() + leftBorder() + rightBorder(),
d->m_view->minimumHeight() + topBorder() + bottomBorder() );
}
@@ -183,9 +183,9 @@ int KoFrame::border() const
return 5;
}
-void KoFrame::paintEvent( QPaintEvent* )
+void KoFrame::paintEvent( TQPaintEvent* )
{
- QPainter painter;
+ TQPainter painter;
painter.begin( this );
painter.setPen( black );
@@ -206,32 +206,32 @@ void KoFrame::paintEvent( QPaintEvent* )
painter.end();
}
-void KoFrame::mousePressEvent( QMouseEvent* ev )
+void KoFrame::mousePressEvent( TQMouseEvent* ev )
{
- QRect r1( 0, 0, 5, 5 );
- QRect r2( 0, height() - 5, 5, 5 );
- QRect r3( width() - 5, height() - 5, 5, 5 );
- QRect r4( width() - 5, 0, 5, 5 );
- QRect r5( width() / 2 - 3, 0, 5, 5 );
- QRect r6( width() / 2 - 3, height() - 5, 5, 5 );
- QRect r7( 0, height() / 2 - 3, 5, 5 );
- QRect r8( width()- 5, height() / 2 - 3, 5, 5 );
-
- if ( r1.contains( ev->pos() ) )
+ TQRect r1( 0, 0, 5, 5 );
+ TQRect r2( 0, height() - 5, 5, 5 );
+ TQRect r3( width() - 5, height() - 5, 5, 5 );
+ TQRect r4( width() - 5, 0, 5, 5 );
+ TQRect r5( width() / 2 - 3, 0, 5, 5 );
+ TQRect r6( width() / 2 - 3, height() - 5, 5, 5 );
+ TQRect r7( 0, height() / 2 - 3, 5, 5 );
+ TQRect r8( width()- 5, height() / 2 - 3, 5, 5 );
+
+ if ( r1.tqcontains( ev->pos() ) )
d->m_mode = 1;
- else if ( r2.contains( ev->pos() ) )
+ else if ( r2.tqcontains( ev->pos() ) )
d->m_mode = 2;
- else if ( r3.contains( ev->pos() ) )
+ else if ( r3.tqcontains( ev->pos() ) )
d->m_mode = 3;
- else if ( r4.contains( ev->pos() ) )
+ else if ( r4.tqcontains( ev->pos() ) )
d->m_mode = 4;
- else if ( r5.contains( ev->pos() ) )
+ else if ( r5.tqcontains( ev->pos() ) )
d->m_mode = 5;
- else if ( r6.contains( ev->pos() ) )
+ else if ( r6.tqcontains( ev->pos() ) )
d->m_mode = 6;
- else if ( r7.contains( ev->pos() ) )
+ else if ( r7.tqcontains( ev->pos() ) )
d->m_mode = 7;
- else if ( r8.contains( ev->pos() ) )
+ else if ( r8.tqcontains( ev->pos() ) )
d->m_mode = 8;
else
d->m_mode = 0;
@@ -242,98 +242,98 @@ void KoFrame::mousePressEvent( QMouseEvent* ev )
kdDebug(30003) << "---- MODE=" << d->m_mode << endl;
d->m_mousePressPos = mapToParent( ev->pos() );
- d->m_framePos = mapToParent( QPoint( 0, 0 ) );
+ d->m_framePos = mapToParent( TQPoint( 0, 0 ) );
d->m_width = width();
d->m_height = height();
}
-void KoFrame::mouseMoveEvent( QMouseEvent* ev )
+void KoFrame::mouseMoveEvent( TQMouseEvent* ev )
{
if ( d->m_mode == 0 )
{
- QPoint p = parentWidget()->mapFromGlobal( ev->globalPos() );
- move( QPoint( p.x() + d->m_framePos.x() - d->m_mousePressPos.x(),
+ TQPoint p = tqparentWidget()->mapFromGlobal( ev->globalPos() );
+ move( TQPoint( p.x() + d->m_framePos.x() - d->m_mousePressPos.x(),
p.y() + d->m_framePos.y() - d->m_mousePressPos.y() ) );
- // The other modes change the geometry so they call resizeEvent.
- // This one doesn't, so it has to emit geometryChangedby itself.
- emit geometryChanged();
+ // The other modes change the tqgeometry so they call resizeEvent.
+ // This one doesn't, so it has to emit tqgeometryChangedby itself.
+ emit tqgeometryChanged();
//kdDebug() << "KoFrame::mouseMoveEvent koFrame position is " << x() << "," << y() << endl;
}
else if ( d->m_mode == 1 )
{
- QPoint p = parentWidget()->mapFromGlobal( ev->globalPos() );
- int w = QMIN( QMAX( d->m_width + d->m_mousePressPos.x() - p.x(), minimumWidth() ), maximumWidth() );
- int h = QMIN( QMAX( d->m_height + d->m_mousePressPos.y() - p.y(), minimumHeight() ), maximumHeight() );
+ TQPoint p = tqparentWidget()->mapFromGlobal( ev->globalPos() );
+ int w = TQMIN( TQMAX( d->m_width + d->m_mousePressPos.x() - p.x(), minimumWidth() ), maximumWidth() );
+ int h = TQMIN( TQMAX( d->m_height + d->m_mousePressPos.y() - p.y(), minimumHeight() ), maximumHeight() );
setGeometry( d->m_framePos.x() - w + d->m_width,
d->m_framePos.y() - h + d->m_height, w, h );
}
else if ( d->m_mode == 2 )
{
- QPoint p = parentWidget()->mapFromGlobal( ev->globalPos() );
- int w = QMIN( QMAX( d->m_width + d->m_mousePressPos.x() - p.x(), minimumWidth() ), maximumWidth() );
- int h = QMIN( QMAX( d->m_height - d->m_mousePressPos.y() + p.y(), minimumHeight() ), maximumHeight() );
+ TQPoint p = tqparentWidget()->mapFromGlobal( ev->globalPos() );
+ int w = TQMIN( TQMAX( d->m_width + d->m_mousePressPos.x() - p.x(), minimumWidth() ), maximumWidth() );
+ int h = TQMIN( TQMAX( d->m_height - d->m_mousePressPos.y() + p.y(), minimumHeight() ), maximumHeight() );
setGeometry( d->m_framePos.x() - w + d->m_width,
d->m_framePos.y(), w, h );
}
else if ( d->m_mode == 3 )
{
- QPoint p = parentWidget()->mapFromGlobal( ev->globalPos() );
- int w = QMIN( QMAX( d->m_width - d->m_mousePressPos.x() + p.x(), minimumWidth() ), maximumWidth() );
- int h = QMIN( QMAX( d->m_height - d->m_mousePressPos.y() + p.y(), minimumHeight() ), maximumHeight() );
+ TQPoint p = tqparentWidget()->mapFromGlobal( ev->globalPos() );
+ int w = TQMIN( TQMAX( d->m_width - d->m_mousePressPos.x() + p.x(), minimumWidth() ), maximumWidth() );
+ int h = TQMIN( TQMAX( d->m_height - d->m_mousePressPos.y() + p.y(), minimumHeight() ), maximumHeight() );
resize( w, h );
}
else if ( d->m_mode == 4 )
{
- QPoint p = parentWidget()->mapFromGlobal( ev->globalPos() );
- int w = QMIN( QMAX( d->m_width - d->m_mousePressPos.x() + p.x(), minimumWidth() ), maximumWidth() );
- int h = QMIN( QMAX( d->m_height + d->m_mousePressPos.y() - p.y(), minimumHeight() ), maximumHeight() );
+ TQPoint p = tqparentWidget()->mapFromGlobal( ev->globalPos() );
+ int w = TQMIN( TQMAX( d->m_width - d->m_mousePressPos.x() + p.x(), minimumWidth() ), maximumWidth() );
+ int h = TQMIN( TQMAX( d->m_height + d->m_mousePressPos.y() - p.y(), minimumHeight() ), maximumHeight() );
setGeometry( d->m_framePos.x(),
d->m_framePos.y() - h + d->m_height, w, h );
}
else if ( d->m_mode == 5 )
{
- QPoint p = parentWidget()->mapFromGlobal( ev->globalPos() );
- int h = QMIN( QMAX( d->m_height + d->m_mousePressPos.y() - p.y(), minimumHeight() ), maximumHeight() );
+ TQPoint p = tqparentWidget()->mapFromGlobal( ev->globalPos() );
+ int h = TQMIN( TQMAX( d->m_height + d->m_mousePressPos.y() - p.y(), minimumHeight() ), maximumHeight() );
setGeometry( d->m_framePos.x(),
d->m_framePos.y() - h + d->m_height, d->m_width, h );
}
else if ( d->m_mode == 6 )
{
- QPoint p = parentWidget()->mapFromGlobal( ev->globalPos() );
- int h = QMIN( QMAX( d->m_height - d->m_mousePressPos.y() + p.y(), minimumHeight() ), maximumHeight() );
+ TQPoint p = tqparentWidget()->mapFromGlobal( ev->globalPos() );
+ int h = TQMIN( TQMAX( d->m_height - d->m_mousePressPos.y() + p.y(), minimumHeight() ), maximumHeight() );
resize( d->m_width, h );
}
else if ( d->m_mode == 7 )
{
- QPoint p = parentWidget()->mapFromGlobal( ev->globalPos() );
- int w = QMIN( QMAX( d->m_width + d->m_mousePressPos.x() - p.x(), minimumWidth() ), maximumWidth() );
+ TQPoint p = tqparentWidget()->mapFromGlobal( ev->globalPos() );
+ int w = TQMIN( TQMAX( d->m_width + d->m_mousePressPos.x() - p.x(), minimumWidth() ), maximumWidth() );
setGeometry( d->m_framePos.x() - w + d->m_width,
d->m_framePos.y(), w, d->m_height );
}
else if ( d->m_mode == 8 )
{
- QPoint p = parentWidget()->mapFromGlobal( ev->globalPos() );
- int w = QMIN( QMAX( d->m_width - d->m_mousePressPos.x() + p.x(), minimumWidth() ), maximumWidth() );
+ TQPoint p = tqparentWidget()->mapFromGlobal( ev->globalPos() );
+ int w = TQMIN( TQMAX( d->m_width - d->m_mousePressPos.x() + p.x(), minimumWidth() ), maximumWidth() );
resize( w, d->m_height );
}
else if ( d->m_state == Selected || d->m_state == Active )
{
- QRect r1( 0, 0, 5, 5 );
- QRect r2( 0, height() - 5, 5, 5 );
- QRect r3( width() - 5, height() - 5, 5, 5 );
- QRect r4( width() - 5, 0, 5, 5 );
- QRect r5( width() / 2 - 3, 0, 5, 5 );
- QRect r6( width() / 2 - 3, height() - 5, 5, 5 );
- QRect r7( 0, height() / 2 - 3, 5, 5 );
- QRect r8( width()- 5, height() / 2 - 3, 5, 5 );
-
- if ( r1.contains( ev->pos() ) || r3.contains( ev->pos() ) )
+ TQRect r1( 0, 0, 5, 5 );
+ TQRect r2( 0, height() - 5, 5, 5 );
+ TQRect r3( width() - 5, height() - 5, 5, 5 );
+ TQRect r4( width() - 5, 0, 5, 5 );
+ TQRect r5( width() / 2 - 3, 0, 5, 5 );
+ TQRect r6( width() / 2 - 3, height() - 5, 5, 5 );
+ TQRect r7( 0, height() / 2 - 3, 5, 5 );
+ TQRect r8( width()- 5, height() / 2 - 3, 5, 5 );
+
+ if ( r1.tqcontains( ev->pos() ) || r3.tqcontains( ev->pos() ) )
setCursor( sizeFDiagCursor );
- else if ( r2.contains( ev->pos() ) || r4.contains( ev->pos() ) )
+ else if ( r2.tqcontains( ev->pos() ) || r4.tqcontains( ev->pos() ) )
setCursor( sizeBDiagCursor );
- else if ( r5.contains( ev->pos() ) || r6.contains( ev->pos() ) )
+ else if ( r5.tqcontains( ev->pos() ) || r6.tqcontains( ev->pos() ) )
setCursor( sizeVerCursor );
- else if ( r7.contains( ev->pos() ) || r8.contains( ev->pos() ) )
+ else if ( r7.tqcontains( ev->pos() ) || r8.tqcontains( ev->pos() ) )
setCursor( sizeHorCursor );
else
setCursor( KCursor::handCursor() );
@@ -342,12 +342,12 @@ void KoFrame::mouseMoveEvent( QMouseEvent* ev )
setCursor( KCursor::handCursor() );
}
-void KoFrame::mouseReleaseEvent( QMouseEvent* )
+void KoFrame::mouseReleaseEvent( TQMouseEvent* )
{
d->m_mode = -1;
}
-void KoFrame::resizeEvent( QResizeEvent* )
+void KoFrame::resizeEvent( TQResizeEvent* )
{
if ( !d->m_view )
return;
@@ -357,12 +357,12 @@ void KoFrame::resizeEvent( QResizeEvent* )
else
d->m_view->setGeometry( 0, 0, width(), height() );
- emit geometryChanged();
+ emit tqgeometryChanged();
}
-bool KoFrame::eventFilter( QObject* obj, QEvent* ev )
+bool KoFrame::eventFilter( TQObject* obj, TQEvent* ev )
{
- if ( obj == d->m_view && KParts::PartActivateEvent::test( ev ) )
+ if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(d->m_view) && KParts::PartActivateEvent::test( ev ) )
{
kdDebug(30003) << "Activate event"<< endl;
KParts::PartActivateEvent* e = (KParts::PartActivateEvent*)ev;
@@ -374,7 +374,7 @@ bool KoFrame::eventFilter( QObject* obj, QEvent* ev )
setState( Inactive );
}
}
- else if ( obj == d->m_view && KParts::PartSelectEvent::test( ev ) )
+ else if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(d->m_view) && KParts::PartSelectEvent::test( ev ) )
{
kdDebug(30003) << "Selected event" << endl;
KParts::PartSelectEvent* e = (KParts::PartSelectEvent*)ev;