KDEUI
kwordwrap.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001 David Faure <faure@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef kwordwrap_h 00020 #define kwordwrap_h 00021 00022 #include <kdeui_export.h> 00023 #include <QtCore/Qt> 00024 00025 class QFontMetrics; 00026 class QRect; 00027 class QString; 00028 class QPainter; 00029 00049 class KDEUI_EXPORT KWordWrap 00050 { 00051 public: 00056 enum { FadeOut = 0x10000000, Truncate = 0x20000000 }; 00057 00069 static KWordWrap* formatText( QFontMetrics &fm, const QRect & r, int flags, const QString & str, int len = -1 ); // KDE5 TODO: return a value, not a pointer, and use QSharedDataPointer. 00070 00077 QRect boundingRect() const; 00078 00083 QString wrappedString() const; // gift for Dirk :) 00084 00090 QString truncatedString( bool dots = true ) const; 00091 00104 void drawText( QPainter *painter, int x, int y, int flags = Qt::AlignLeft ) const; 00105 00109 ~KWordWrap(); 00110 00122 static void drawFadeoutText( QPainter *p, int x, int y, int maxW, 00123 const QString &t ); 00124 00134 static void drawTruncateText( QPainter *p, int x, int y, int maxW, 00135 const QString &t ); 00136 00137 private: 00138 Q_DISABLE_COPY( KWordWrap ) 00139 KWordWrap( const QRect & r ); 00140 class KWordWrapPrivate* const d; 00141 }; 00142 00143 #endif
KDE 4.6 API Reference