diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch) | |
tree | 8d927b7b47a90c4adb646482a52613f58acd6f8c /khexedit/lib/koffsetcolumn.cpp | |
download | tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'khexedit/lib/koffsetcolumn.cpp')
-rw-r--r-- | khexedit/lib/koffsetcolumn.cpp | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/khexedit/lib/koffsetcolumn.cpp b/khexedit/lib/koffsetcolumn.cpp new file mode 100644 index 0000000..6bd6d09 --- /dev/null +++ b/khexedit/lib/koffsetcolumn.cpp @@ -0,0 +1,110 @@ +/*************************************************************************** + koffsetcolumn.cpp - description + ------------------- + begin : Mit Mai 14 2003 + copyright : (C) 2003 by Friedrich W. H. Kossebau + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License version 2 as published by the Free Software Foundation. * + * * + ***************************************************************************/ + +// qt specific +#include "qpainter.h" +// lib specific +#include "kcolumnsview.h" +#include "koffsetcolumn.h" + +using namespace KHE; + +KOffsetColumn::KOffsetColumn( KColumnsView *V, int FLO, int D, KOffsetFormat::KFormat F ) + : KColumn( V ), + FirstLineOffset( FLO ), + Delta( D ), + Margin( 0 ), + DigitWidth( 0 ), + DigitBaseLine( 0 ), + Format( KOffsetFormat::None ) +{ + setFormat( F ); +} + + +KOffsetColumn::~KOffsetColumn() +{ +} + + +void KOffsetColumn::paintLine( QPainter *P, int Line ) +{ + const QColor &ButtonColor = View->colorGroup().button(); + P->fillRect( 0,0,width(),LineHeight, QBrush(ButtonColor,Qt::SolidPattern) ); + + printFunction()( CodedOffset,FirstLineOffset+Delta*Line ); + P->drawText( 0, DigitBaseLine, QString().append(CodedOffset) ); +} + + +void KOffsetColumn::paintFirstLine( QPainter *P, KPixelXs, int FirstLine ) +{ + PaintLine = FirstLine; + paintLine( P, PaintLine++ ); +} + + +void KOffsetColumn::paintNextLine( QPainter *P ) +{ + paintLine( P, PaintLine++ ); +} + + + +void KOffsetColumn::paintEmptyColumn( QPainter *P, KPixelXs Xs, KPixelYs Ys ) +{ + Xs.restrictTo( XSpan ); + + const QColor &ButtonColor = View->colorGroup().button(); + P->fillRect( Xs.start(), Ys.start(), Xs.width(), Ys.width(), QBrush(ButtonColor,Qt::SolidPattern) ); +} + +void KOffsetColumn::setFormat( KOffsetFormat::KFormat F ) +{ + // no changes? + if( Format == F ) + return; + + Format = F; + + CodingWidth = KOffsetFormat::codingWidth( Format ); + PrintFunction = KOffsetFormat::printFunction( Format ); + + recalcX(); +} + +void KOffsetColumn::setMetrics( KPixelX DW, KPixelY DBL ) +{ + DigitBaseLine = DBL; + setDigitWidth( DW ); +} + +void KOffsetColumn::setDigitWidth( KPixelX DW ) +{ + // no changes? + if( DigitWidth == DW ) + return; + + DigitWidth = DW; + + recalcX(); +} + +void KOffsetColumn::recalcX() +{ + // recalculate depend sizes + setWidth( CodingWidth * DigitWidth ); +} |