kchart

KDDrawText.h
1/*
2 KDChart - a multi-platform charting engine
3 */
4
5/****************************************************************************
6 ** Copyright (C) 2001-2003 Klarälvdalens Datakonsult AB. All rights reserved.
7 **
8 ** This file is part of the KDChart library.
9 **
10 ** This file may be distributed and/or modified under the terms of the
11 ** GNU General Public License version 2 as published by the Free Software
12 ** Foundation and appearing in the file LICENSE.GPL included in the
13 ** packaging of this file.
14 **
15 ** Licensees holding valid commercial KDChart licenses may use this file in
16 ** accordance with the KDChart Commercial License Agreement provided with
17 ** the Software.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.klaralvdalens-datakonsult.se/?page=products for
23 ** information about KDChart Commercial License Agreements.
24 **
25 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
26 ** licensing are not clear to you.
27 **
28 **********************************************************************/
29#ifndef __KDDRAWTEXT_H__
30#define __KDDRAWTEXT_H__
31
32#include <tqpainter.h>
33#ifdef linux
34#include <values.h>
35#endif
36#include "KDChartGlobal.h"
37
38
39struct KDDrawTextRegionAndTrueRect
40{
41 TQRegion region;
42 TQPoint pos;
43 int x,y,width,height;
44};
45
46
47class KDDrawText
48{
49 public:
50 static void drawRotatedText( TQPainter* painter,
51 float degrees,
52 TQPoint anchor,
53 const TQString& text,
54 const TQFont* font = 0,
55 int align = TQt::AlignLeft | TQt::AlignTop,
56 // useful for debugging of your layout:
57 bool showAnchor = false,
58 const TQFontMetrics* fontMet = 0,
59 bool noFirstrotate = false,
60 bool noBackrotate = false,
61 KDDrawTextRegionAndTrueRect* infos = 0,
62 bool optimizeOutputForScreen = false );
63
64 static KDDrawTextRegionAndTrueRect measureRotatedText(
65 TQPainter* painter,
66 float degrees,
67 TQPoint anchor,
68 const TQString& text,
69 const TQFont* font,
70 int align,
71 const TQFontMetrics* fontMet,
72 bool noFirstrotate,
73 bool noBackrotate,
74 int addPercentOfHeightToRegion );
75
76 private:
77 static void drawRotatedTxt( TQPainter* painter,
78 bool optimizeOutputForScreen,
79 float degrees,
80 TQPoint anchor,
81 const TQString& text,
82 const TQFont* font = 0,
83 int align = TQt::AlignLeft | TQt::AlignTop,
84 // usefull for debugging of your layout:
85 bool showAnchor = false,
86 // speed-up parameters
87 // used internally by drawCircleText()
88 // to avoid duplicate calculation
89 int txtWidth = INT_MAX,
90 int txtHeight = INT_MAX,
91 const TQFontMetrics* fontMet = 0,
92 // additional speed-up parameters used by KDChart
93 bool calculateOnly = false,
94 bool doNotCalculate= false,
95 bool noFirstrotate = false,
96 bool noBackrotate = false,
97 KDDrawTextRegionAndTrueRect* infos = 0,
98 int addPercentOfHeightToRegion = 0 );
99
100};
101
102#endif