summaryrefslogtreecommitdiffstats
path: root/kdgantt/KDGanttMinimizeSplitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdgantt/KDGanttMinimizeSplitter.cpp')
-rw-r--r--kdgantt/KDGanttMinimizeSplitter.cpp164
1 files changed, 82 insertions, 82 deletions
diff --git a/kdgantt/KDGanttMinimizeSplitter.cpp b/kdgantt/KDGanttMinimizeSplitter.cpp
index 1e9a9783c..f11832f37 100644
--- a/kdgantt/KDGanttMinimizeSplitter.cpp
+++ b/kdgantt/KDGanttMinimizeSplitter.cpp
@@ -39,8 +39,8 @@
#include "tqbitmap.h"
#include "tqptrlist.h"
#include "tqmemarray.h"
-#include "layout.h"
-#include "layoutengine_p.h"
+#include "tqlayout.h"
+#include "tqlayoutengine_p.h"
#include "tqobjectlist.h"
#include "tqstyle.h"
#include "tqapplication.h" //sendPostedEvents
@@ -64,7 +64,7 @@ KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o,
setMouseTracking( true );
}
-TQSize KDGanttSplitterHandle::sizeHint() const
+TQSize KDGanttSplitterHandle::tqsizeHint() const
{
return TQSize(8,8);
}
@@ -108,7 +108,7 @@ void KDGanttSplitterHandle::mousePressEvent( TQMouseEvent *e )
_activeButton = onButton( e->pos() );
mouseOffset = s->pick(e->pos());
if ( _activeButton != 0)
- repaint();
+ tqrepaint();
updateCursor( e->pos() );
}
}
@@ -165,7 +165,7 @@ void KDGanttSplitterHandle::mouseReleaseEvent( TQMouseEvent *e )
s->moveSplitter( pos, id() );
}
}
- repaint();
+ tqrepaint();
}
int KDGanttSplitterHandle::onButton( const TQPoint& p )
@@ -238,16 +238,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()->tqstyle().tqdrawPrimitive( TQStyle::PE_Panel, &p, rect(),
- parentWidget()->colorGroup());
+ parentWidget()->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 );
@@ -256,13 +256,13 @@ void KDGanttSplitterHandle::paintEvent( TQPaintEvent * )
for ( TQValueList<TQPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
if ( index == _activeButton ) {
p.save();
- p.translate( parentWidget()->tqstyle().pixelMetric( TQStyle::PM_ButtonShiftHorizontal ),
- parentWidget()->tqstyle().pixelMetric( TQStyle::PM_ButtonShiftVertical ) );
- p.drawPolygon( *it, true );
+ p.translate( parentWidget()->tqstyle().tqpixelMetric( TQStyle::PM_ButtonShiftHorizontal ),
+ parentWidget()->tqstyle().tqpixelMetric( TQStyle::PM_ButtonShiftVertical ) );
+ p.tqdrawPolygon( *it, true );
p.restore();
}
else {
- p.drawPolygon( *it, true );
+ p.tqdrawPolygon( *it, true );
}
index++;
}
@@ -319,7 +319,7 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
such a license) and are (C) Trolltech AS.
A splitter lets the user control the size of child widgets by
- dragging the boundary between the children. Any number of widgets
+ dragging the boundary between the tqchildren. Any number of widgets
may be controlled.
To show a TQListBox, a TQListView and a TQTextEdit side by side:
@@ -332,14 +332,14 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
\endcode
In KDGanttMinimizeSplitter, the boundary can be either horizontal or
- vertical. The default is horizontal (the children are side by side)
+ vertical. The default is horizontal (the tqchildren are side by side)
but you can use setOrientation( TQSplitter::Vertical ) to set it to
vertical.
Use setResizeMode() to specify
that a widget should keep its size when the splitter is resized.
- Although KDGanttMinimizeSplitter normally resizes the children only
+ Although KDGanttMinimizeSplitter normally resizes the tqchildren only
at the end of a resize operation, if you call setOpaqueResize( TRUE
) the widgets are resized as often as possible.
@@ -349,7 +349,7 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
sizes set by the user.
If you hide() a child, its space will be distributed among the other
- children. It will be reinstated when you show() it again. It is also
+ tqchildren. It will be reinstated when you show() it again. It is also
possible to reorder the widgets within the splitter using
moveToFirst() and moveToLast().
*/
@@ -364,10 +364,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 )
@@ -400,7 +400,7 @@ KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Qt::Orientation o, TQWidget *p
}
/*!
- Destroys the splitter and any children.
+ Destroys the splitter and any tqchildren.
*/
KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter()
{
@@ -413,9 +413,9 @@ void KDGanttMinimizeSplitter::init()
{
data = new TQSplitterData;
if ( orient == Qt::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) );
}
@@ -433,9 +433,9 @@ void KDGanttMinimizeSplitter::setOrientation( Qt::Orientation o )
orient = o;
if ( orient == Qt::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 ) );
TQSplitterLayoutStruct *s = data->list.first();
while ( s ) {
@@ -478,7 +478,7 @@ TQSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( TQWidget *w, bool fi
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
@@ -487,8 +487,8 @@ TQSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( TQWidget *w, bool fi
s = new TQSplitterLayoutStruct;
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;
@@ -561,7 +561,7 @@ void KDGanttMinimizeSplitter::setRubberband( int p )
paint.setRasterOp( XorROP );
TQRect r = contentsRect();
const int rBord = 3; //Themable????
- int sw = tqstyle().pixelMetric(TQStyle::PM_SplitterWidth, this);
+ int sw = tqstyle().tqpixelMetric(TQStyle::PM_SplitterWidth, this);
if ( orient == Qt::Horizontal ) {
if ( opaqueOldPos >= 0 )
paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(),
@@ -601,7 +601,7 @@ bool KDGanttMinimizeSplitter::event( TQEvent *e )
void KDGanttMinimizeSplitter::drawSplitter( TQPainter *p,
TQCOORD x, TQCOORD y, TQCOORD w, TQCOORD h )
{
- tqstyle().tqdrawPrimitive(TQStyle::PE_Splitter, p, TQRect(x, y, w, h), colorGroup(),
+ tqstyle().tqdrawPrimitive(TQStyle::PE_Splitter, p, TQRect(x, y, w, h), tqcolorGroup(),
(orientation() == Qt::Horizontal ?
TQStyle::Style_Horizontal : 0));
}
@@ -632,7 +632,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.
@@ -705,13 +705,13 @@ void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft )
} else {
int dd, newLeft, nextPos;
if( TQApplication::reverseLayout() && orient == Qt::Horizontal ) {
- dd = w->geometry().right() - pos;
- dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->maximumSize())));
+ dd = w->tqgeometry().right() - pos;
+ dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->tqmaximumSize())));
newLeft = pos+1;
nextPos = newLeft + dd;
} else {
dd = pos - pick( w->pos() ) + 1;
- dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->maximumSize())));
+ dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->tqmaximumSize())));
newLeft = pos-dd+1;
nextPos = newLeft - 1;
}
@@ -760,13 +760,13 @@ void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft )
int right, dd,/* newRight,*/ newLeft, nextPos;
if ( TQApplication::reverseLayout() && orient == Qt::Horizontal ) {
dd = pos - left + 1;
- dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->maximumSize())));
+ dd = TQMAX( pick(minSize(w)), TQMIN(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 = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->maximumSize())));
+ dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->tqmaximumSize())));
/*newRight = pos+dd-1;*/
newLeft = pos;
nextPos = newLeft + dd;
@@ -820,7 +820,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++ ) {
@@ -832,12 +832,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 == Qt::Horizontal && TQApplication::reverseLayout() ) {
- int splitterWidth = tqstyle().pixelMetric(TQStyle::PM_SplitterWidth, this);
+ int splitterWidth = tqstyle().tqpixelMetric(TQStyle::PM_SplitterWidth, this);
if ( min )
*min = pick(r.topRight()) - TQMIN( maxB, pick(r.size())-minA ) - splitterWidth;
if ( max )
@@ -879,27 +879,27 @@ void KDGanttMinimizeSplitter::doResize()
TQSplitterLayoutStruct *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;
}
}
@@ -953,9 +953,9 @@ 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 = TQMAX( mint, trans( minS ));
- int tm = trans( s->wid->maximumSize() );
+ int tm = trans( s->wid->tqmaximumSize() );
if ( tm > 0 )
maxt = TQMIN( maxt, tm );
}
@@ -966,7 +966,7 @@ void KDGanttMinimizeSplitter::recalc( bool update )
// nested splitters; be nice
maxl = maxt = 0;
} else {
- // KDGanttMinimizeSplitter with no children yet
+ // KDGanttMinimizeSplitter with no tqchildren yet
maxl = TQWIDGETSIZE_MAX;
}
} else {
@@ -1105,7 +1105,7 @@ void KDGanttMinimizeSplitter::recalcId()
/*! Reimplemented from superclass.
*/
-TQSize KDGanttMinimizeSplitter::sizeHint() const
+TQSize KDGanttMinimizeSplitter::tqsizeHint() const
{
constPolish();
int l = 0;
@@ -1119,7 +1119,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 = TQMAX( t, trans( s ) );
@@ -1135,7 +1135,7 @@ TQSize KDGanttMinimizeSplitter::sizeHint() const
\reimp
*/
-TQSize KDGanttMinimizeSplitter::minimumSizeHint() const
+TQSize KDGanttMinimizeSplitter::tqminimumSizeHint() const
{
constPolish();
int l = 0;
@@ -1229,7 +1229,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.
@@ -1309,7 +1309,7 @@ void KDGanttMinimizeSplitter::processChildEvents()
void KDGanttMinimizeSplitter::styleChange( TQStyle& old )
{
- int sw = tqstyle().pixelMetric(TQStyle::PM_SplitterWidth, this);
+ int sw = tqstyle().tqpixelMetric(TQStyle::PM_SplitterWidth, this);
TQSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->isSplitter )
@@ -1364,9 +1364,9 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
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++;
@@ -1379,11 +1379,11 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
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 TQt 2.x.
// Commented-out lines will give more space to stretchier items.
int n = count;
@@ -1391,10 +1391,10 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
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--;
}
@@ -1413,13 +1413,13 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
// 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;
@@ -1431,11 +1431,11 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
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--;
}
@@ -1467,20 +1467,20 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
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--;
}
@@ -1490,10 +1490,10 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i
// 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--;
}