kwordwrap.h
/* This file is part of the KDE libraries
Copyright (C) 2001 David Faure <david@mandrakesoft.com>
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.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef kwordwrap_h
#define kwordwrap_h
#include <qfontmetrics.h>
#include <qvaluelist.h>
#include <qrect.h>
#include <qstring.h>
#include <kdelibs_export.h>
class KDEUI_EXPORT KWordWrap
{
public:
enum { FadeOut = 0x10000000, Truncate = 0x20000000 };
static KWordWrap* formatText( QFontMetrics &fm, const QRect & r, int flags, const QString & str, int len = -1 );
QRect boundingRect() const { return m_boundingRect; }
QString wrappedString() const; // gift for Dirk :)
QString truncatedString( bool dots = true ) const;
void drawText( QPainter *painter, int x, int y, int flags = Qt::AlignAuto ) const;
~KWordWrap();
static void drawFadeoutText( QPainter *p, int x, int y, int maxW,
const QString &t );
static void drawTruncateText( QPainter *p, int x, int y, int maxW,
const QString &t );
private:
KWordWrap( const QRect & r );
QValueList<int> m_breakPositions;
QValueList<int> m_lineWidths;
QRect m_boundingRect;
QString m_text;
private:
class KWordWrapPrivate* d;
};
#endif
KWordWrap::boundingRect
QRect boundingRect() const
Definition: kwordwrap.h:77
KWordWrap
Word-wrap algorithm that takes into account beautifulness ;)
Definition: kwordwrap.h:48

KDE Home | KDE Accessibility Home | Description of Access Keys