summaryrefslogtreecommitdiffstats
path: root/kdeui/kwordwrap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdeui/kwordwrap.cpp')
-rw-r--r--kdeui/kwordwrap.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/kdeui/kwordwrap.cpp b/kdeui/kwordwrap.cpp
index 4b2e801d0..9c6427eb5 100644
--- a/kdeui/kwordwrap.cpp
+++ b/kdeui/kwordwrap.cpp
@@ -19,19 +19,19 @@
#include "kwordwrap.h"
#include <kdebug.h>
#include <kstringhandler.h>
-#include <qpainter.h>
+#include <tqpainter.h>
class KWordWrapPrivate {
public:
- QRect m_constrainingRect;
+ TQRect m_constrainingRect;
};
-KWordWrap::KWordWrap(const QRect & r) {
+KWordWrap::KWordWrap(const TQRect & r) {
d = new KWordWrapPrivate;
d->m_constrainingRect = r;
}
-KWordWrap* KWordWrap::formatText( QFontMetrics &fm, const QRect & r, int /*flags*/, const QString & str, int len )
+KWordWrap* KWordWrap::formatText( TQFontMetrics &fm, const TQRect & r, int /*flags*/, const TQString & str, int len )
{
KWordWrap* kw = new KWordWrap( r );
// The wordwrap algorithm
@@ -58,7 +58,7 @@ KWordWrap* KWordWrap::formatText( QFontMetrics &fm, const QRect & r, int /*flags
for ( int i = 0 ; i < len; ++i )
{
- QChar c = str[i];
+ TQChar c = str[i];
int ww = fm.charWidth( str, i );
isParens = ( c == '(' || c == '[' || c == '{' );
@@ -67,7 +67,7 @@ KWordWrap* KWordWrap::formatText( QFontMetrics &fm, const QRect & r, int /*flags
// Special case for '(', '[' and '{': we want to break before them
if ( !isBreakable && i < len-1 ) {
- QChar nextc = str[i+1]; // look at next char
+ TQChar nextc = str[i+1]; // look at next char
isBreakable = ( nextc == '(' || nextc == '[' || nextc == '{' );
}
// Special case for '/': after normal chars it's breakable (e.g. inside a path),
@@ -76,7 +76,7 @@ KWordWrap* KWordWrap::formatText( QFontMetrics &fm, const QRect & r, int /*flags
if ( c == '/' && (wasBreakable || wasParens) )
isBreakable = false;
- /*kdDebug() << "c='" << QString(c) << "' i=" << i << "/" << len
+ /*kdDebug() << "c='" << TQString(c) << "' i=" << i << "/" << len
<< " x=" << x << " ww=" << ww << " w=" << w
<< " lastBreak=" << lastBreak << " isBreakable=" << isBreakable << endl;*/
int breakAt = -1;
@@ -145,12 +145,12 @@ KWordWrap::~KWordWrap() {
delete d;
}
-QString KWordWrap::wrappedString() const
+TQString KWordWrap::wrappedString() const
{
// We use the calculated break positions to insert '\n' into the string
- QString ws;
+ TQString ws;
int start = 0;
- QValueList<int>::ConstIterator it = m_breakPositions.begin();
+ TQValueList<int>::ConstIterator it = m_breakPositions.begin();
for ( ; it != m_breakPositions.end() ; ++it )
{
int end = (*it);
@@ -161,28 +161,28 @@ QString KWordWrap::wrappedString() const
return ws;
}
-QString KWordWrap::truncatedString( bool dots ) const
+TQString KWordWrap::truncatedString( bool dots ) const
{
if ( m_breakPositions.isEmpty() )
return m_text;
- QString ts = m_text.left( m_breakPositions.first() + 1 );
+ TQString ts = m_text.left( m_breakPositions.first() + 1 );
if ( dots )
ts += "...";
return ts;
}
-static QColor mixColors(double p1, QColor c1, QColor c2) {
- return QColor(int(c1.red() * p1 + c2.red() * (1.0-p1)),
+static TQColor mixColors(double p1, TQColor c1, TQColor c2) {
+ return TQColor(int(c1.red() * p1 + c2.red() * (1.0-p1)),
int(c1.green() * p1 + c2.green() * (1.0-p1)),
int(c1.blue() * p1 + c2.blue() * (1.0-p1)));
}
-void KWordWrap::drawFadeoutText(QPainter *p, int x, int y, int maxW,
- const QString &t) {
- QFontMetrics fm = p->fontMetrics();
- QColor bgColor = p->backgroundColor();
- QColor textColor = p->pen().color();
+void KWordWrap::drawFadeoutText(TQPainter *p, int x, int y, int maxW,
+ const TQString &t) {
+ TQFontMetrics fm = p->fontMetrics();
+ TQColor bgColor = p->backgroundColor();
+ TQColor textColor = p->pen().color();
if ( ( fm.boundingRect( t ).width() > maxW ) && ( t.length() > 1 ) ) {
unsigned int tl = 0;
@@ -201,7 +201,7 @@ void KWordWrap::drawFadeoutText(QPainter *p, int x, int y, int maxW,
int n = QMIN( tl, 3);
for (int i = 0; i < n; i++) {
p->setPen( mixColors( 0.70 - i * 0.25, textColor, bgColor ) );
- QString s( t.at( tl - n + i ) );
+ TQString s( t.at( tl - n + i ) );
p->drawText( x, y, s );
x += fm.width( s );
}
@@ -210,24 +210,24 @@ void KWordWrap::drawFadeoutText(QPainter *p, int x, int y, int maxW,
p->drawText( x, y, t );
}
-void KWordWrap::drawTruncateText(QPainter *p, int x, int y, int maxW,
- const QString &t) {
- QString tmpText = KStringHandler::rPixelSqueeze( t, p->fontMetrics(), maxW );
+void KWordWrap::drawTruncateText(TQPainter *p, int x, int y, int maxW,
+ const TQString &t) {
+ TQString tmpText = KStringHandler::rPixelSqueeze( t, p->fontMetrics(), maxW );
p->drawText( x, y, tmpText, maxW );
}
-void KWordWrap::drawText( QPainter *painter, int textX, int textY, int flags ) const
+void KWordWrap::drawText( TQPainter *painter, int textX, int textY, int flags ) const
{
//kdDebug() << "KWordWrap::drawText text=" << wrappedString() << " x=" << textX << " y=" << textY << endl;
// We use the calculated break positions to draw the text line by line using QPainter
int start = 0;
int y = 0;
- QFontMetrics fm = painter->fontMetrics();
+ TQFontMetrics fm = painter->fontMetrics();
int height = fm.height(); // line height
int ascent = fm.ascent();
int maxwidth = m_boundingRect.width();
- QValueList<int>::ConstIterator it = m_breakPositions.begin();
- QValueList<int>::ConstIterator itw = m_lineWidths.begin();
+ TQValueList<int>::ConstIterator it = m_breakPositions.begin();
+ TQValueList<int>::ConstIterator itw = m_lineWidths.begin();
for ( ; it != m_breakPositions.end() ; ++it, ++itw )
{
// if this is the last line, leave the loop