kdeui Library API Documentation

kwordwrap.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2001 David Faure <david@mandrakesoft.com>
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., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
00017 */
00018 
00019 #ifndef kwordwrap_h
00020 #define kwordwrap_h
00021 
00022 #include <qfontmetrics.h>
00023 #include <qvaluelist.h>
00024 #include <qrect.h>
00025 #include <qstring.h>
00026 
00040 class KWordWrap
00041 {
00042 public:
00053     static KWordWrap* formatText( QFontMetrics &fm, const QRect & r, int flags, const QString & str, int len = -1 );
00054 
00058     QRect boundingRect() const { return m_boundingRect; }
00059 
00064     QString wrappedString() const; // gift for Dirk :)
00065 
00071     QString truncatedString( bool dots = true ) const;
00072 
00077     void drawText( QPainter *painter, int x, int y, int flags = Qt::AlignAuto ) const;
00078 
00079 private:
00080     QValueList<int> m_breakPositions;
00081     QValueList<int> m_lineWidths;
00082     QRect m_boundingRect;
00083     QString m_text;
00084 private:
00085     class KWordWrapPrivate* d;
00086 };
00087 
00088 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:02 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001