diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kivio/kiviopart/stencilbardockmanager.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-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 'kivio/kiviopart/stencilbardockmanager.cpp')
-rw-r--r-- | kivio/kiviopart/stencilbardockmanager.cpp | 192 |
1 files changed, 96 insertions, 96 deletions
diff --git a/kivio/kiviopart/stencilbardockmanager.cpp b/kivio/kiviopart/stencilbardockmanager.cpp index 73061ad1..606c6a93 100644 --- a/kivio/kiviopart/stencilbardockmanager.cpp +++ b/kivio/kiviopart/stencilbardockmanager.cpp @@ -22,35 +22,35 @@ #include "kivio_stackbar.h" #include "kivio_view.h" -#include <qcursor.h> -#include <qvaluelist.h> -#include <qapplication.h> -#include <qwindowdefs.h> -#include <qtimer.h> -#include <qrect.h> -#include <qframe.h> -#include <qpainter.h> +#include <tqcursor.h> +#include <tqvaluelist.h> +#include <tqapplication.h> +#include <tqwindowdefs.h> +#include <tqtimer.h> +#include <tqrect.h> +#include <tqframe.h> +#include <tqpainter.h> #include <klocale.h> #include <kdebug.h> -StencilBarDockManager::StencilBarDockManager( KivioView* parent, const char* name ) -: QWidget(parent,name) +StencilBarDockManager::StencilBarDockManager( KivioView* tqparent, const char* name ) +: TQWidget(tqparent,name) { dragButton = 0L; dragWidget = 0L; - m_pView = parent; + m_pView = tqparent; m_destinationBar = 0L; dragPos = OnDesktop; m_pBars.setAutoDelete(true); m_pDoc = m_pView->doc(); - connect(m_pDoc, SIGNAL(sig_deleteStencilSet(DragBarButton*, QWidget*, KivioStackBar*)), this, - SLOT(slotDeleteStencilSet(DragBarButton*, QWidget*, KivioStackBar*))); + connect(m_pDoc, TQT_SIGNAL(sig_deleteStencilSet(DragBarButton*, TQWidget*, KivioStackBar*)), this, + TQT_SLOT(slotDeleteStencilSet(DragBarButton*, TQWidget*, KivioStackBar*))); moveManager = new KoToolDockMoveManager(); - connect(moveManager,SIGNAL(positionChanged()),SLOT(slotMoving())); + connect(moveManager,TQT_SIGNAL(positionChanged()),TQT_SLOT(slotMoving())); } StencilBarDockManager::~StencilBarDockManager() @@ -58,15 +58,15 @@ StencilBarDockManager::~StencilBarDockManager() delete moveManager; } -void StencilBarDockManager::insertStencilSet( QWidget* w, const QString& caption, - BarPos pos, QRect /*r*/, KivioStackBar* destinationBar ) +void StencilBarDockManager::insertStencilSet( TQWidget* w, const TQString& caption, + BarPos pos, TQRect /*r*/, KivioStackBar* destinationBar ) { KivioStackBar* bar = 0L; if(destinationBar) { bar = destinationBar; } else { - Qt::Dock position = Qt::DockLeft; + TQt::Dock position = TQt::DockLeft; if ( pos == AutoSelect ) { pos = Left; @@ -74,66 +74,66 @@ void StencilBarDockManager::insertStencilSet( QWidget* w, const QString& caption switch (pos) { case OnDesktop: - position = Qt::DockTornOff; + position = TQt::DockTornOff; break; case Left: { - QPtrList<QDockWindow> dockList = m_pView->mainWindow()->dockWindows(Qt::DockLeft); + TQPtrList<TQDockWindow> dockList = m_pView->mainWindow()->dockWindows(TQt::DockLeft); - for(QDockWindow* dock = dockList.first(); dock; dock = dockList.next()) { - if(::qt_cast<KivioStackBar*>(dock) && (static_cast<KivioStackBar*>(dock)->view() == m_pView)) { + for(TQDockWindow* dock = dockList.first(); dock; dock = dockList.next()) { + if(::tqqt_cast<KivioStackBar*>(dock) && (static_cast<KivioStackBar*>(dock)->view() == m_pView)) { bar = static_cast<KivioStackBar*>(dock); break; } } - position = Qt::DockLeft; + position = TQt::DockLeft; break; } case Top: { - QPtrList<QDockWindow> dockList = m_pView->mainWindow()->dockWindows(Qt::DockTop); + TQPtrList<TQDockWindow> dockList = m_pView->mainWindow()->dockWindows(TQt::DockTop); - for(QDockWindow* dock = dockList.first(); dock; dock = dockList.next()) { - if(::qt_cast<KivioStackBar*>(dock) && (static_cast<KivioStackBar*>(dock)->view() == m_pView)) { + for(TQDockWindow* dock = dockList.first(); dock; dock = dockList.next()) { + if(::tqqt_cast<KivioStackBar*>(dock) && (static_cast<KivioStackBar*>(dock)->view() == m_pView)) { bar = static_cast<KivioStackBar*>(dock); break; } } - position = Qt::DockTop; + position = TQt::DockTop; break; } case Right: { - QPtrList<QDockWindow> dockList = m_pView->mainWindow()->dockWindows(Qt::DockRight); + TQPtrList<TQDockWindow> dockList = m_pView->mainWindow()->dockWindows(TQt::DockRight); - for(QDockWindow* dock = dockList.first(); dock; dock = dockList.next()) { - if(::qt_cast<KivioStackBar*>(dock) && (static_cast<KivioStackBar*>(dock)->view() == m_pView)) { + for(TQDockWindow* dock = dockList.first(); dock; dock = dockList.next()) { + if(::tqqt_cast<KivioStackBar*>(dock) && (static_cast<KivioStackBar*>(dock)->view() == m_pView)) { bar = static_cast<KivioStackBar*>(dock); break; } } - position = Qt::DockRight; + position = TQt::DockRight; break; } case Bottom: { - QPtrList<QDockWindow> dockList = m_pView->mainWindow()->dockWindows(Qt::DockBottom); + TQPtrList<TQDockWindow> dockList = m_pView->mainWindow()->dockWindows(TQt::DockBottom); - for(QDockWindow* dock = dockList.first(); dock; dock = dockList.next()) { - if(::qt_cast<KivioStackBar*>(dock) && (static_cast<KivioStackBar*>(dock)->view() == m_pView)) { + for(TQDockWindow* dock = dockList.first(); dock; dock = dockList.next()) { + if(::tqqt_cast<KivioStackBar*>(dock) && (static_cast<KivioStackBar*>(dock)->view() == m_pView)) { bar = static_cast<KivioStackBar*>(dock); break; } } - position = Qt::DockBottom; + position = TQt::DockBottom; break; } case OnTopLevelBar: // hmm this shouldn't happen :) - position = Qt::DockTornOff; + position = TQt::DockTornOff; break; default: break; @@ -143,10 +143,10 @@ void StencilBarDockManager::insertStencilSet( QWidget* w, const QString& caption bar = new KivioStackBar(m_pView, m_pView->mainWindow()); m_pView->mainWindow()->moveDockWindow(bar, position); m_pBars.append(bar); - connect(bar,SIGNAL(beginDragPage(DragBarButton*)),SLOT(slotBeginDragPage(DragBarButton*))); - connect(bar,SIGNAL(finishDragPage(DragBarButton*)),SLOT(slotFinishDragPage(DragBarButton*))); - connect(bar,SIGNAL(deleteButton(DragBarButton*,QWidget*,KivioStackBar*)), - m_pDoc, SLOT(slotDeleteStencilSet(DragBarButton*,QWidget*,KivioStackBar*))); + connect(bar,TQT_SIGNAL(beginDragPage(DragBarButton*)),TQT_SLOT(slotBeginDragPage(DragBarButton*))); + connect(bar,TQT_SIGNAL(finishDragPage(DragBarButton*)),TQT_SLOT(slotFinishDragPage(DragBarButton*))); + connect(bar,TQT_SIGNAL(deleteButton(DragBarButton*,TQWidget*,KivioStackBar*)), + m_pDoc, TQT_SLOT(slotDeleteStencilSet(DragBarButton*,TQWidget*,KivioStackBar*))); } } @@ -175,15 +175,15 @@ void StencilBarDockManager::slotFinishDragPage( DragBarButton* ) dragWidget->setUpdatesEnabled(true); dragWidget->update(); - QString caption(dragButton->text()); + TQString caption(dragButton->text()); KivioStackBar* bar = (KivioStackBar*)sender(); bar->removePage(dragWidget); - insertStencilSet(dragWidget,caption,dragPos,moveManager->geometry(),m_destinationBar); + insertStencilSet(dragWidget,caption,dragPos,moveManager->tqgeometry(),m_destinationBar); // remove KivioStackBar if no more pages if (!bar->visiblePage()) { - int k = m_pBars.findRef(bar); + int k = m_pBars.tqfindRef(bar); if ( k!= -1 ) { m_pBars.remove(k); @@ -200,18 +200,18 @@ void StencilBarDockManager::slotFinishDragPage( DragBarButton* ) void StencilBarDockManager::slotMoving() { m_destinationBar = 0L; - QPoint p = QCursor::pos(); - QPoint globalPos; + TQPoint p = TQCursor::pos(); + TQPoint globalPos; // check existing bars for ( KivioStackBar* bar = m_pBars.first(); bar; bar = m_pBars.next() ) { - if ( bar->geometry().contains(p) ) { - if(bar->place() == QDockWindow::OutsideDock) { + if ( bar->tqgeometry().tqcontains(p) ) { + if(bar->place() == TQDockWindow::OutsideDock) { dragPos = OnTopLevelBar; - globalPos = bar->geometry().topLeft(); + globalPos = bar->tqgeometry().topLeft(); } else { dragPos = AutoSelect; - globalPos = bar->mapToGlobal(bar->geometry().topLeft()); + globalPos = bar->mapToGlobal(bar->tqgeometry().topLeft()); } m_destinationBar = bar; @@ -219,18 +219,18 @@ void StencilBarDockManager::slotMoving() moveManager->setGeometry(globalPos.x(), moveManager->y(), bar->width(), - moveManager->getWidget()->sizeHint().height()); + moveManager->getWidget()->tqsizeHint().height()); return; } } // check "on mainView" - QRect mr(m_pView->mapToGlobal(QPoint(0,0)),m_pView->size()); + TQRect mr(m_pView->mapToGlobal(TQPoint(0,0)),m_pView->size()); - if ( mr.contains(p) ) { - QRect r(mr); + if ( mr.tqcontains(p) ) { + TQRect r(mr); r.setWidth(r.width()/4); - if ( r.contains(p) && !m_pBars.at(Left) ) { + if ( r.tqcontains(p) && !m_pBars.at(Left) ) { moveManager->movePause(); moveManager->setGeometry(r); dragPos = Left; @@ -239,17 +239,17 @@ void StencilBarDockManager::slotMoving() r.moveBy(r.width()*3,0); - if ( r.contains(p) && !m_pBars.at(Right) ) { + if ( r.tqcontains(p) && !m_pBars.at(Right) ) { moveManager->movePause(); moveManager->setGeometry(r); dragPos = Right; return; } - QRect t(mr); + TQRect t(mr); t.setHeight(t.height()/4); - if ( t.contains(p) && !m_pBars.at(Top) ) { + if ( t.tqcontains(p) && !m_pBars.at(Top) ) { moveManager->movePause(); moveManager->setGeometry(t); dragPos = Top; @@ -258,7 +258,7 @@ void StencilBarDockManager::slotMoving() t.moveBy(0,t.height()*3); - if ( t.contains(p) && !m_pBars.at(Bottom) ) { + if ( t.tqcontains(p) && !m_pBars.at(Bottom) ) { moveManager->movePause(); moveManager->setGeometry(t); dragPos = Bottom; @@ -272,13 +272,13 @@ void StencilBarDockManager::slotMoving() dragPos = OnDesktop; } -void StencilBarDockManager::slotDeleteStencilSet( DragBarButton* pBtn, QWidget *, KivioStackBar *pBar ) +void StencilBarDockManager::slotDeleteStencilSet( DragBarButton* pBtn, TQWidget *, KivioStackBar *pBar ) { pBar->deletePageAndButton(pBtn); // remove KivioStackBar if no more pages if (!pBar->visiblePage()) { - int k = m_pBars.findRef(pBar); + int k = m_pBars.tqfindRef(pBar); if ( k!= -1 ) { m_pBars.remove(k); @@ -306,16 +306,16 @@ void StencilBarDockManager::setAllStackBarsShown(bool shown) // KoToolDockMoveManager::KoToolDockMoveManager() - : QObject() + : TQObject() { -#if defined Q_WS_X11 && !defined K_WS_QTONLY +#if defined TQ_WS_X11 && !defined K_WS_TQTONLY XGCValues gv; #endif working=false; noLast=true; -#if defined Q_WS_X11 && !defined K_WS_QTONLY +#if defined TQ_WS_X11 && !defined K_WS_TQTONLY scr = qt_xscreen(); root = qt_xrootwin(); @@ -323,11 +323,11 @@ KoToolDockMoveManager::KoToolDockMoveManager() gv.line_width = 2; gv.foreground = WhitePixel(qt_xdisplay(), scr)^BlackPixel(qt_xdisplay(), scr); gv.subwindow_mode = IncludeInferiors; - long mask = GCForeground | GCFunction | GCLineWidth | GCSubwindowMode; - rootgc = XCreateGC(qt_xdisplay(), qt_xrootwin(), mask, &gv); + long tqmask = GCForeground | GCFunction | GCLineWidth | GCSubwindowMode; + rootgc = XCreateGC(qt_xdisplay(), qt_xrootwin(), tqmask, &gv); #endif - timer = new QTimer(this); + timer = new TQTimer(this); } KoToolDockMoveManager::~KoToolDockMoveManager() @@ -336,7 +336,7 @@ KoToolDockMoveManager::~KoToolDockMoveManager() delete timer; } -void KoToolDockMoveManager::doMove( QWidget* _w ) +void KoToolDockMoveManager::doMove( TQWidget* _w ) { if (working) return; @@ -356,14 +356,14 @@ void KoToolDockMoveManager::doMove( QWidget* _w ) orig_w = w; orig_h = h; - QApplication::setOverrideCursor(QCursor(sizeAllCursor)); + TQApplication::setOverrideCursor(TQCursor(sizeAllCursor)); movePause(false,false); drawRectangle(xp, yp, w, h); timer->disconnect(); - connect(timer,SIGNAL(timeout()),SLOT(doMoveInternal())); + connect(timer,TQT_SIGNAL(timeout()),TQT_SLOT(doMoveInternal())); timer->start(0); } @@ -373,10 +373,10 @@ void KoToolDockMoveManager::doMoveInternal() return; if (!pauseMoveX) - rx = QCursor::pos().x(); + rx = TQCursor::pos().x(); if (!pauseMoveY) - ry = QCursor::pos().y(); + ry = TQCursor::pos().y(); xp = rx - offX; yp = ry - offY; @@ -386,7 +386,7 @@ void KoToolDockMoveManager::doMoveInternal() if (check(xp, yp, w, h)) { paintProcess(false,xp, yp, w, h); -#if defined Q_WS_X11 && !defined K_WS_QTONLY +#if defined TQ_WS_X11 && !defined K_WS_TQTONLY XFlush(qt_xdisplay()); XSync(qt_xdisplay(),false); #endif @@ -399,17 +399,17 @@ void KoToolDockMoveManager::stop() return; timer->stop(); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); paintProcess(); -#if defined Q_WS_X11 && !defined K_WS_QTONLY +#if defined TQ_WS_X11 && !defined K_WS_TQTONLY XFlush(qt_xdisplay()); #endif working = false; } -void KoToolDockMoveManager::setGeometry( const QRect& r ) +void KoToolDockMoveManager::setGeometry( const TQRect& r ) { setGeometry(r.x(),r.y(),r.width(),r.height()); } @@ -424,7 +424,7 @@ void KoToolDockMoveManager::setGeometry(int _x, int _y, int _w, int _h) check(_x, _y, _w, _h, true); paintProcess(false,_x, _y, _w, _h); -#if defined Q_WS_X11 && !defined K_WS_QTONLY +#if defined TQ_WS_X11 && !defined K_WS_TQTONLY XFlush(qt_xdisplay()); XSync(qt_xdisplay(),false); #endif @@ -440,7 +440,7 @@ void KoToolDockMoveManager::drawRectangle( int _x, int _y, int _w, int _h) ow = _w; oh = _h; -#if defined Q_WS_X11 && !defined K_WS_QTONLY +#if defined TQ_WS_X11 && !defined K_WS_TQTONLY XDrawRectangle(qt_xdisplay(), root, rootgc, _x, _y, _w, _h); #endif noLast = false; @@ -454,7 +454,7 @@ void KoToolDockMoveManager::paintProcess( bool onlyDelete, int _x, int _y, int _ if ( ox == _x && oy == _y && ow ==_w && oh == _h ) return; -#if defined Q_WS_X11 && !defined K_WS_QTONLY +#if defined TQ_WS_X11 && !defined K_WS_TQTONLY XDrawRectangle(qt_xdisplay(), root, rootgc, ox, oy, ow, oh); #endif noLast = true; @@ -474,7 +474,7 @@ void KoToolDockMoveManager::moveContinue() pauseMoveY = false; } -void KoToolDockMoveManager::doXResize( QWidget* w, bool mirror ) +void KoToolDockMoveManager::doXResize( TQWidget* w, bool mirror ) { if (working) return; @@ -488,7 +488,7 @@ void KoToolDockMoveManager::doXResize( QWidget* w, bool mirror ) doResize(w); } -void KoToolDockMoveManager::doYResize( QWidget* w, bool mirror ) +void KoToolDockMoveManager::doYResize( TQWidget* w, bool mirror ) { if (working) return; @@ -502,7 +502,7 @@ void KoToolDockMoveManager::doYResize( QWidget* w, bool mirror ) doResize(w); } -void KoToolDockMoveManager::doXYResize( QWidget* w, bool _mirrorX, bool _mirrorY ) +void KoToolDockMoveManager::doXYResize( TQWidget* w, bool _mirrorX, bool _mirrorY ) { if (working) return; @@ -519,10 +519,10 @@ void KoToolDockMoveManager::doXYResize( QWidget* w, bool _mirrorX, bool _mirrorY void KoToolDockMoveManager::doResizeInternal() { if (!yOnly) - rx = QCursor::pos().x(); + rx = TQCursor::pos().x(); if (!xOnly) - ry = QCursor::pos().y(); + ry = TQCursor::pos().y(); int dx = rx - sx; int dy = ry - sy; @@ -546,20 +546,20 @@ void KoToolDockMoveManager::doResizeInternal() if (check(xp, yp, w, h)) { paintProcess(false,xp, yp, w, h); -#if defined Q_WS_X11 && !defined K_WS_QTONLY +#if defined TQ_WS_X11 && !defined K_WS_TQTONLY XFlush(qt_xdisplay()); XSync(qt_xdisplay(),false); #endif } } -void KoToolDockMoveManager::setWidget( QWidget* _w ) +void KoToolDockMoveManager::setWidget( TQWidget* _w ) { widget = _w; - minSize = widget->minimumSize(); - maxSize = widget->maximumSize(); + minSize = widget->tqminimumSize(); + maxSize = widget->tqmaximumSize(); - rr = QRect(widget->mapToGlobal(QPoint(0,0)),widget->size()); + rr = TQRect(widget->mapToGlobal(TQPoint(0,0)),widget->size()); p = rr.topLeft(); xp = rr.x(); @@ -567,18 +567,18 @@ void KoToolDockMoveManager::setWidget( QWidget* _w ) w = rr.width(); h = rr.height(); - rx = QCursor::pos().x(); - ry = QCursor::pos().y(); + rx = TQCursor::pos().x(); + ry = TQCursor::pos().y(); } -void KoToolDockMoveManager::doResize( QWidget* _w ) +void KoToolDockMoveManager::doResize( TQWidget* _w ) { setWidget(_w); working=true; isDoMove = false; - QPoint curPos = QCursor::pos(); + TQPoint curPos = TQCursor::pos(); sx = curPos.x(); sy = curPos.y(); @@ -588,15 +588,15 @@ void KoToolDockMoveManager::doResize( QWidget* _w ) drawRectangle(xp, yp, w, h); timer->disconnect(); - connect(timer,SIGNAL(timeout()),SLOT(doResizeInternal())); + connect(timer,TQT_SIGNAL(timeout()),TQT_SLOT(doResizeInternal())); timer->start(0); } bool KoToolDockMoveManager::check(int& x, int& y, int& w, int& h, bool change) { - int w1 = QMIN(QMAX(minSize.width(), w), maxSize.width()); - int h1 = QMIN(QMAX(minSize.height(), h), maxSize.height()); + int w1 = TQMIN(TQMAX(minSize.width(), w), maxSize.width()); + int h1 = TQMIN(TQMAX(minSize.height(), h), maxSize.height()); bool f1 = (w1-w)+(h1-h) == 0; @@ -631,7 +631,7 @@ bool KoToolDockMoveManager::check(int& x, int& y, int& w, int& h, bool change) return f1&&f2; } -QRect KoToolDockMoveManager::geometry() +TQRect KoToolDockMoveManager::tqgeometry() { int x0 = xp; int y0 = yp; @@ -639,7 +639,7 @@ QRect KoToolDockMoveManager::geometry() int h0 = h; check(x0,y0,w0,h0,true); - return QRect(x0,y0,w0,h0); + return TQRect(x0,y0,w0,h0); } #include "stencilbardockmanager.moc" |