KDDrawText.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002    KDChart - a multi-platform charting engine
00003    */
00004 
00005 /****************************************************************************
00006  ** Copyright (C) 2001-2003 Klarälvdalens Datakonsult AB.  All rights reserved.
00007  **
00008  ** This file is part of the KDChart library.
00009  **
00010  ** This file may be distributed and/or modified under the terms of the
00011  ** GNU General Public License version 2 as published by the Free Software
00012  ** Foundation and appearing in the file LICENSE.GPL included in the
00013  ** packaging of this file.
00014  **
00015  ** Licensees holding valid commercial KDChart licenses may use this file in
00016  ** accordance with the KDChart Commercial License Agreement provided with
00017  ** the Software.
00018  **
00019  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021  **
00022  ** See http://www.klaralvdalens-datakonsult.se/?page=products for
00023  **   information about KDChart Commercial License Agreements.
00024  **
00025  ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
00026  ** licensing are not clear to you.
00027  **
00028  **********************************************************************/
00029 #ifndef __KDDRAWTEXT_H__
00030 #define __KDDRAWTEXT_H__
00031 
00032 #include <qpainter.h>
00033 #ifdef linux
00034 #include <values.h>
00035 #endif
00036 #include "KDChartGlobal.h"
00037 
00038 
00039 struct KDDrawTextRegionAndTrueRect
00040 {
00041     QRegion region;
00042     QPoint pos;
00043     int x,y,width,height;
00044 };
00045 
00046 
00047 class KDDrawText
00048 {
00049     public:
00050         static void drawRotatedText( QPainter* painter,
00051                 float  degrees,
00052                 QPoint anchor,
00053                 const QString& text,
00054                 const QFont* font = 0,
00055                 int align = Qt::AlignLeft | Qt::AlignTop,
00056                 // useful for debugging of your layout:
00057                 bool showAnchor    = false,
00058                 const QFontMetrics* fontMet = 0,
00059                 bool noFirstrotate = false,
00060                 bool noBackrotate  = false,
00061                 KDDrawTextRegionAndTrueRect* infos = 0,
00062                 bool optimizeOutputForScreen = false );
00063 
00064         static KDDrawTextRegionAndTrueRect measureRotatedText(
00065                 QPainter* painter,
00066                 float  degrees,
00067                 QPoint anchor,
00068                 const QString& text,
00069                 const QFont* font,
00070                 int align,
00071                 const QFontMetrics* fontMet,
00072                 bool noFirstrotate,
00073                 bool noBackrotate,
00074                 int addPercentOfHeightToRegion );
00075 
00076     private:
00077         static void drawRotatedTxt( QPainter* painter,
00078                 bool optimizeOutputForScreen,
00079                 float  degrees,
00080                 QPoint anchor,
00081                 const QString& text,
00082                 const QFont* font  = 0,
00083                 int align = Qt::AlignLeft | Qt::AlignTop,
00084                 // usefull for debugging of your layout:
00085                 bool showAnchor    = false,
00086                 // speed-up parameters
00087                 // used internally by drawCircleText()
00088                 // to avoid duplicate calculation
00089                 int txtWidth       = INT_MAX,
00090                 int txtHeight      = INT_MAX,
00091                 const QFontMetrics* fontMet = 0,
00092                 // additional speed-up parameters used by KDChart
00093                 bool calculateOnly = false,
00094                 bool doNotCalculate= false,
00095                 bool noFirstrotate = false,
00096                 bool noBackrotate  = false,
00097                 KDDrawTextRegionAndTrueRect* infos = 0,
00098                 int addPercentOfHeightToRegion = 0 );
00099 
00100 };
00101 
00102 #endif

Generated on Wed Jan 26 13:03:16 2011 for KMyMoney by  doxygen 1.5.6