summaryrefslogtreecommitdiffstats
path: root/kdgantt/KDGanttMinimizeSplitter.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-02-16 20:17:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-02-16 20:17:18 +0000
commitf4fae92b6768541e2952173c3d4b09040f95bf7e (patch)
treed8c5d93232235cd635f3310b4d95490df181ba2d /kdgantt/KDGanttMinimizeSplitter.cpp
parent125c0a08265b75a133644d3b55f47e37c919f45d (diff)
downloadtdepim-f4fae92b6768541e2952173c3d4b09040f95bf7e.tar.gz
tdepim-f4fae92b6768541e2952173c3d4b09040f95bf7e.zip
Moved kpilot from kdepim to applications, as the core Trinity libraries should not contain hardware-dependent software
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1221127 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdgantt/KDGanttMinimizeSplitter.cpp')
-rw-r--r--kdgantt/KDGanttMinimizeSplitter.cpp160
1 files changed, 80 insertions, 80 deletions
diff --git a/kdgantt/KDGanttMinimizeSplitter.cpp b/kdgantt/KDGanttMinimizeSplitter.cpp
index bdd166c5e..79d7e18d3 100644
--- a/kdgantt/KDGanttMinimizeSplitter.cpp
+++ b/kdgantt/KDGanttMinimizeSplitter.cpp
@@ -46,7 +46,7 @@
#define TQPtrList QList
#define TQMemArray QArray
#endif
-#include "qlayoutengine_p.h"
+#include "tqlayoutengine_p.h"
#include "tqobjectlist.h"
#include "tqstyle.h"
#include "tqapplication.h" //sendPostedEvents
@@ -73,7 +73,7 @@ KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o,
setMouseTracking( true );
}
-TQSize KDGanttSplitterHandle::sizeHint() const
+TQSize KDGanttSplitterHandle::tqsizeHint() const
{
return TQSize(8,8);
}
@@ -99,7 +99,7 @@ void KDGanttSplitterHandle::mouseMoveEvent( TQMouseEvent *e )
if ( _activeButton != 0)
return;
- QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
+ QCOORD pos = s->pick(tqparentWidget()->mapFromGlobal(e->globalPos()))
- mouseOffset;
if ( opaque() ) {
s->moveSplitter( pos, id() );
@@ -117,7 +117,7 @@ void KDGanttSplitterHandle::mousePressEvent( TQMouseEvent *e )
_activeButton = onButton( e->pos() );
mouseOffset = s->pick(e->pos());
if ( _activeButton != 0)
- repaint();
+ tqrepaint();
updateCursor( e->pos() );
}
}
@@ -168,13 +168,13 @@ void KDGanttSplitterHandle::mouseReleaseEvent( TQMouseEvent *e )
}
else {
if ( !opaque() && e->button() == LeftButton ) {
- QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
+ QCOORD pos = s->pick(tqparentWidget()->mapFromGlobal(e->globalPos()))
- mouseOffset;
s->setRubberband( -1 );
s->moveSplitter( pos, id() );
}
}
- repaint();
+ tqrepaint();
}
int KDGanttSplitterHandle::onButton( const TQPoint& p )
@@ -187,7 +187,7 @@ int KDGanttSplitterHandle::onButton( const TQPoint& p )
rect.setRight( rect.right() + 4);
rect.setTop( rect.top()- 4 );
rect.setBottom( rect.bottom() + 4);
- if ( rect.contains( p ) ) {
+ if ( rect.tqcontains( p ) ) {
return index;
}
index++;
@@ -247,16 +247,16 @@ void KDGanttSplitterHandle::paintEvent( TQPaintEvent * )
TQPainter p( &buffer );
// Draw the splitter rectangle
- p.setBrush( colorGroup().background() );
- p.setPen( colorGroup().foreground() );
+ p.setBrush( tqcolorGroup().background() );
+ p.setPen( tqcolorGroup().foreground() );
p.drawRect( rect() );
- parentWidget()->style().drawPrimitive( TQStyle::PE_Panel, &p, rect(),
- parentWidget()->colorGroup());
+ tqparentWidget()->style().drawPrimitive( TQStyle::PE_Panel, &p, rect(),
+ tqparentWidget()->tqcolorGroup());
int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size
// arrow color
- TQColor col = colorGroup().background().dark( 200 );
+ TQColor col = tqcolorGroup().background().dark( 200 );
p.setBrush( col );
p.setPen( col );
@@ -265,8 +265,8 @@ void KDGanttSplitterHandle::paintEvent( TQPaintEvent * )
for ( TQValueList<TQPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
if ( index == _activeButton ) {
p.save();
- p.translate( parentWidget()->style().pixelMetric( TQStyle::PM_ButtonShiftHorizontal ),
- parentWidget()->style().pixelMetric( TQStyle::PM_ButtonShiftVertical ) );
+ p.translate( tqparentWidget()->style().tqpixelMetric( TQStyle::PM_ButtonShiftHorizontal ),
+ tqparentWidget()->style().tqpixelMetric( TQStyle::PM_ButtonShiftVertical ) );
p.drawPolygon( *it, true );
p.restore();
}
@@ -374,10 +374,10 @@ static TQSize minSize( const TQWidget* /*w*/ )
// This is the original version of minSize
static TQSize minSizeHint( const TQWidget* w )
{
- TQSize min = w->minimumSize();
+ TQSize min = w->tqminimumSize();
TQSize s;
if ( min.height() <= 0 || min.width() <= 0 )
- s = w->minimumSizeHint();
+ s = w->tqminimumSizeHint();
if ( min.height() > 0 )
s.setHeight( min.height() );
if ( min.width() > 0 )
@@ -430,9 +430,9 @@ void KDGanttMinimizeSplitter::init()
{
data = new QSplitterData;
if ( orient == Horizontal )
- setSizePolicy( TQSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Minimum) );
+ tqsetSizePolicy( TQSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Minimum) );
else
- setSizePolicy( TQSizePolicy(TQSizePolicy::Minimum,TQSizePolicy::Expanding) );
+ tqsetSizePolicy( TQSizePolicy(TQSizePolicy::Minimum,TQSizePolicy::Expanding) );
}
#endif
@@ -452,9 +452,9 @@ void KDGanttMinimizeSplitter::setOrientation( Orientation o )
orient = o;
if ( orient == Horizontal )
- setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Minimum ) );
+ tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Minimum ) );
else
- setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Expanding ) );
+ tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Expanding ) );
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
@@ -499,7 +499,7 @@ QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( TQWidget *w, bool fir
s->wid = newHandle;
newHandle->setId(data->list.count());
s->isSplitter = TRUE;
- s->sizer = pick( newHandle->sizeHint() );
+ s->sizer = pick( newHandle->tqsizeHint() );
if ( first )
data->list.insert( 0, s );
else
@@ -508,8 +508,8 @@ QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( TQWidget *w, bool fir
s = new QSplitterLayoutStruct;
s->mode = Stretch;
s->wid = w;
- if ( !testWState( WState_Resized ) && w->sizeHint().isValid() )
- s->sizer = pick( w->sizeHint() );
+ if ( !testWState( WState_Resized ) && w->tqsizeHint().isValid() )
+ s->sizer = pick( w->tqsizeHint() );
else
s->sizer = pick( w->size() );
s->isSplitter = FALSE;
@@ -582,7 +582,7 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
paint.setRasterOp( XorROP );
TQRect r = contentsRect();
const int rBord = 3; //Themable????
- int sw = style().pixelMetric(TQStyle::PM_SplitterWidth, this);
+ int sw = style().tqpixelMetric(TQStyle::PM_SplitterWidth, this);
if ( orient == Horizontal ) {
if ( opaqueOldPos >= 0 )
paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(),
@@ -622,7 +622,7 @@ bool KDGanttMinimizeSplitter::event( TQEvent *e )
void KDGanttMinimizeSplitter::drawSplitter( TQPainter *p,
QCOORD x, QCOORD y, QCOORD w, QCOORD h )
{
- style().drawPrimitive(TQStyle::PE_Splitter, p, TQRect(x, y, w, h), colorGroup(),
+ style().drawPrimitive(TQStyle::PE_Splitter, p, TQRect(x, y, w, h), tqcolorGroup(),
(orientation() == Qt::Horizontal ?
TQStyle::Style_Horizontal : 0));
}
@@ -653,7 +653,7 @@ int KDGanttMinimizeSplitter::idAfter( TQWidget* w ) const
close as possible to position \a p, which is the distance from the
left (or top) edge of the widget.
- For Arabic and Hebrew the layout is reversed, and using this
+ For Arabic and Hebrew the tqlayout is reversed, and using this
function to set the position of the splitter might lead to
unexpected results, since in Arabic and Hebrew the position of
splitter one is to the left of the position of splitter zero.
@@ -726,13 +726,13 @@ void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft )
} else {
int dd, newLeft, nextPos;
if( TQApplication::reverseLayout() && orient == Horizontal ) {
- dd = w->geometry().right() - pos;
- dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
+ dd = w->tqgeometry().right() - pos;
+ dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->tqmaximumSize())));
newLeft = pos+1;
nextPos = newLeft + dd;
} else {
dd = pos - pick( w->pos() ) + 1;
- dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
+ dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->tqmaximumSize())));
newLeft = pos-dd+1;
nextPos = newLeft - 1;
}
@@ -781,13 +781,13 @@ void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft )
int right, dd,/* newRight,*/ newLeft, nextPos;
if ( TQApplication::reverseLayout() && orient == Horizontal ) {
dd = pos - left + 1;
- dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
+ dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->tqmaximumSize())));
newLeft = pos-dd+1;
nextPos = newLeft - 1;
} else {
- right = pick( w->geometry().bottomRight() );
+ right = pick( w->tqgeometry().bottomRight() );
dd = right - pos + 1;
- dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
+ dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->tqmaximumSize())));
/*newRight = pos+dd-1;*/
newLeft = pos;
nextPos = newLeft + dd;
@@ -841,7 +841,7 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max )
maxB += s->sizer;
} else {
minB += pick( minSize(s->wid) );
- maxB += pick( s->wid->maximumSize() );
+ maxB += pick( s->wid->tqmaximumSize() );
}
}
for ( i = id; i < n; i++ ) {
@@ -853,12 +853,12 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max )
maxA += s->sizer;
} else {
minA += pick( minSize(s->wid) );
- maxA += pick( s->wid->maximumSize() );
+ maxA += pick( s->wid->tqmaximumSize() );
}
}
TQRect r = contentsRect();
if ( orient == Horizontal && TQApplication::reverseLayout() ) {
- int splitterWidth = style().pixelMetric(TQStyle::PM_SplitterWidth, this);
+ int splitterWidth = style().tqpixelMetric(TQStyle::PM_SplitterWidth, this);
if ( min )
*min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth;
if ( max )
@@ -900,27 +900,27 @@ void KDGanttMinimizeSplitter::doResize()
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->wid->isHidden() ) {
a[i].stretch = 0;
- a[i].sizeHint = a[i].minimumSize = 0;
- a[i].maximumSize = 0;
+ a[i].tqsizeHint = a[i].tqminimumSize = 0;
+ a[i].tqmaximumSize = 0;
} else if ( s->isSplitter ) {
a[i].stretch = 0;
- a[i].sizeHint = a[i].minimumSize = a[i].maximumSize = s->sizer;
+ a[i].tqsizeHint = a[i].tqminimumSize = a[i].tqmaximumSize = s->sizer;
a[i].empty = FALSE;
} else if ( s->mode == KeepSize ) {
a[i].stretch = 0;
- a[i].minimumSize = pick( minSize(s->wid) );
- a[i].sizeHint = s->sizer;
- a[i].maximumSize = pick( s->wid->maximumSize() );
+ a[i].tqminimumSize = pick( minSize(s->wid) );
+ a[i].tqsizeHint = s->sizer;
+ a[i].tqmaximumSize = pick( s->wid->tqmaximumSize() );
a[i].empty = FALSE;
} else if ( s->mode == FollowSizeHint ) {
a[i].stretch = 0;
- a[i].minimumSize = a[i].sizeHint = pick( s->wid->sizeHint() );
- a[i].maximumSize = pick( s->wid->maximumSize() );
+ a[i].tqminimumSize = a[i].tqsizeHint = pick( s->wid->tqsizeHint() );
+ a[i].tqmaximumSize = pick( s->wid->tqmaximumSize() );
a[i].empty = FALSE;
} else { //proportional
a[i].stretch = s->sizer;
- a[i].maximumSize = pick( s->wid->maximumSize() );
- a[i].sizeHint = a[i].minimumSize = pick( minSize(s->wid) );
+ a[i].tqmaximumSize = pick( s->wid->tqmaximumSize() );
+ a[i].tqsizeHint = a[i].tqminimumSize = pick( minSize(s->wid) );
a[i].empty = FALSE;
}
}
@@ -974,16 +974,16 @@ void KDGanttMinimizeSplitter::recalc( bool update )
} else {
TQSize minS = minSize(s->wid);
minl += pick( minS );
- maxl += pick( s->wid->maximumSize() );
+ maxl += pick( s->wid->tqmaximumSize() );
mint = QMAX( mint, trans( minS ));
- int tm = trans( s->wid->maximumSize() );
+ int tm = trans( s->wid->tqmaximumSize() );
if ( tm > 0 )
maxt = QMIN( maxt, tm );
}
}
}
if ( empty ) {
- if ( parentWidget() != 0 && parentWidget()->inherits("KDGanttMinimizeSplitter") ) {
+ if ( tqparentWidget() != 0 && tqparentWidget()->inherits("KDGanttMinimizeSplitter") ) {
// nested splitters; be nice
maxl = maxt = 0;
} else {
@@ -1126,7 +1126,7 @@ void KDGanttMinimizeSplitter::recalcId()
/*! Reimplemented from superclass.
*/
-TQSize KDGanttMinimizeSplitter::sizeHint() const
+TQSize KDGanttMinimizeSplitter::tqsizeHint() const
{
constPolish();
int l = 0;
@@ -1140,7 +1140,7 @@ TQSize KDGanttMinimizeSplitter::sizeHint() const
++it;
if ( o->isWidgetType() &&
!((TQWidget*)o)->isHidden() ) {
- TQSize s = ((TQWidget*)o)->sizeHint();
+ TQSize s = ((TQWidget*)o)->tqsizeHint();
if ( s.isValid() ) {
l += pick( s );
t = QMAX( t, trans( s ) );
@@ -1156,7 +1156,7 @@ TQSize KDGanttMinimizeSplitter::sizeHint() const
\reimp
*/
-TQSize KDGanttMinimizeSplitter::minimumSizeHint() const
+TQSize KDGanttMinimizeSplitter::tqminimumSizeHint() const
{
constPolish();
int l = 0;
@@ -1250,7 +1250,7 @@ bool KDGanttMinimizeSplitter::isHidden( TQWidget *w ) const
splitter.
Giving the values to another splitter's setSizes() function will
- produce a splitter with the same layout as this one.
+ produce a splitter with the same tqlayout as this one.
Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
@@ -1291,7 +1291,7 @@ TQValueList<int> KDGanttMinimizeSplitter::sizes() const
top to bottom.
Extra values in \a list are ignored.
- If \a list contains too few values, the result is undefined
+ If \a list tqcontains too few values, the result is undefined
but the program will still be well-behaved.
\sa sizes()
@@ -1330,7 +1330,7 @@ void KDGanttMinimizeSplitter::processChildEvents()
void KDGanttMinimizeSplitter::styleChange( TQStyle& old )
{
- int sw = style().pixelMetric(TQStyle::PM_SplitterWidth, this);
+ int sw = style().tqpixelMetric(TQStyle::PM_SplitterWidth, this);
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->isSplitter )
@@ -1364,7 +1364,7 @@ KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection()
}
/*
- This is a copy of qGeomCalc() in qlayoutengine.cpp which
+ This is a copy of qGeomCalc() in qtqlayoutengine.cpp which
unfortunately isn't exported.
*/
static inline int toFixed( int i ) { return i * 256; }
@@ -1387,9 +1387,9 @@ void kdganttGeomCalc( TQMemArray<QLayoutStruct> &chain, int start, int count, in
int i;
for ( i = start; i < start + count; i++ ) {
chain[i].done = FALSE;
- cHint += chain[i].sizeHint;
- cMin += chain[i].minimumSize;
- cMax += chain[i].maximumSize;
+ cHint += chain[i].tqsizeHint;
+ cMin += chain[i].tqminimumSize;
+ cMax += chain[i].tqmaximumSize;
sumStretch += chain[i].stretch;
if ( !chain[i].empty )
spacerCount++;
@@ -1402,11 +1402,11 @@ void kdganttGeomCalc( TQMemArray<QLayoutStruct> &chain, int start, int count, in
if ( space < cMin + spacerCount * spacer ) {
// qDebug("not enough space");
for ( i = start; i < start+count; i++ ) {
- chain[i].size = chain[i].minimumSize;
+ chain[i].size = chain[i].tqminimumSize;
chain[i].done = TRUE;
}
} else if ( space < cHint + spacerCount*spacer ) {
- // Less space than sizeHint, but more than minimum.
+ // Less space than tqsizeHint, but more than minimum.
// Currently take space equally from each, like in Qt 2.x.
// Commented-out lines will give more space to stretchier items.
int n = count;
@@ -1414,10 +1414,10 @@ void kdganttGeomCalc( TQMemArray<QLayoutStruct> &chain, int start, int count, in
int overdraft = cHint - space_left;
//first give to the fixed ones:
for ( i = start; i < start+count; i++ ) {
- if ( !chain[i].done && chain[i].minimumSize >= chain[i].sizeHint) {
- chain[i].size = chain[i].sizeHint;
+ if ( !chain[i].done && chain[i].tqminimumSize >= chain[i].tqsizeHint) {
+ chain[i].size = chain[i].tqsizeHint;
chain[i].done = TRUE;
- space_left -= chain[i].sizeHint;
+ space_left -= chain[i].tqsizeHint;
// sumStretch -= chain[i].stretch;
n--;
}
@@ -1436,13 +1436,13 @@ void kdganttGeomCalc( TQMemArray<QLayoutStruct> &chain, int start, int count, in
// else
// fp_w += (fp_over * chain[i].stretch) / sumStretch;
int w = fRound( fp_w );
- chain[i].size = chain[i].sizeHint - w;
+ chain[i].size = chain[i].tqsizeHint - w;
fp_w -= toFixed( w ); //give the difference to the next
- if ( chain[i].size < chain[i].minimumSize ) {
+ if ( chain[i].size < chain[i].tqminimumSize ) {
chain[i].done = TRUE;
- chain[i].size = chain[i].minimumSize;
+ chain[i].size = chain[i].tqminimumSize;
finished = FALSE;
- overdraft -= chain[i].sizeHint - chain[i].minimumSize;
+ overdraft -= chain[i].tqsizeHint - chain[i].tqminimumSize;
// sumStretch -= chain[i].stretch;
n--;
break;
@@ -1454,11 +1454,11 @@ void kdganttGeomCalc( TQMemArray<QLayoutStruct> &chain, int start, int count, in
int space_left = space - spacerCount*spacer;
// first give to the fixed ones, and handle non-expansiveness
for ( i = start; i < start + count; i++ ) {
- if ( !chain[i].done && (chain[i].maximumSize <= chain[i].sizeHint
+ if ( !chain[i].done && (chain[i].tqmaximumSize <= chain[i].tqsizeHint
|| wannaGrow && !chain[i].expansive) ) {
- chain[i].size = chain[i].sizeHint;
+ chain[i].size = chain[i].tqsizeHint;
chain[i].done = TRUE;
- space_left -= chain[i].sizeHint;
+ space_left -= chain[i].tqsizeHint;
sumStretch -= chain[i].stretch;
n--;
}
@@ -1490,20 +1490,20 @@ void kdganttGeomCalc( TQMemArray<QLayoutStruct> &chain, int start, int count, in
int w = fRound( fp_w );
chain[i].size = w;
fp_w -= toFixed( w ); // give the difference to the next
- if ( w < chain[i].sizeHint ) {
- deficit += chain[i].sizeHint - w;
- } else if ( w > chain[i].maximumSize ) {
- surplus += w - chain[i].maximumSize;
+ if ( w < chain[i].tqsizeHint ) {
+ deficit += chain[i].tqsizeHint - w;
+ } else if ( w > chain[i].tqmaximumSize ) {
+ surplus += w - chain[i].tqmaximumSize;
}
}
if ( deficit > 0 && surplus <= deficit ) {
// give to the ones that have too little
for ( i = start; i < start+count; i++ ) {
if ( !chain[i].done &&
- chain[i].size < chain[i].sizeHint ) {
- chain[i].size = chain[i].sizeHint;
+ chain[i].size < chain[i].tqsizeHint ) {
+ chain[i].size = chain[i].tqsizeHint;
chain[i].done = TRUE;
- space_left -= chain[i].sizeHint;
+ space_left -= chain[i].tqsizeHint;
sumStretch -= chain[i].stretch;
n--;
}
@@ -1513,10 +1513,10 @@ void kdganttGeomCalc( TQMemArray<QLayoutStruct> &chain, int start, int count, in
// take from the ones that have too much
for ( i = start; i < start+count; i++ ) {
if ( !chain[i].done &&
- chain[i].size > chain[i].maximumSize ) {
- chain[i].size = chain[i].maximumSize;
+ chain[i].size > chain[i].tqmaximumSize ) {
+ chain[i].size = chain[i].tqmaximumSize;
chain[i].done = TRUE;
- space_left -= chain[i].maximumSize;
+ space_left -= chain[i].tqmaximumSize;
sumStretch -= chain[i].stretch;
n--;
}