kchart

KDChartTextPiece.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 __KDCHARTTEXTPIECE_H__
30#define __KDCHARTTEXTPIECE_H__
31
32#include <tqstring.h>
33#include <tqfont.h>
34#include <tqregion.h>
35#include <tqpalette.h>
36#include <tqobject.h>
37#include <kdchart_export.h>
38
39class TQBrush;
40class TQPainter;
41class TQSimpleRichText;
42class TQFontMetrics;
43
44class KDCHART_EXPORT KDChartTextPiece :public TQObject
45{
46 TQ_OBJECT
47
48
49 public:
50 KDChartTextPiece();
51 KDChartTextPiece( const TQString& text, const TQFont& font );
52 KDChartTextPiece( TQPainter* painter, const TQString& text, const TQFont& font );
53 virtual ~KDChartTextPiece();
61 void deepCopy( const KDChartTextPiece* source );
62
63
73 const KDChartTextPiece* clone() const;
74
75 private:
76 KDChartTextPiece( const KDChartTextPiece& ) : TQObject(0) {}
77
78 public slots:
79 virtual int width() const;
80 virtual int height() const;
81 virtual int fontLeading() const;
82 virtual TQRect rect( TQPainter *p, const TQRect& clipRect) const;
83 virtual void draw( TQPainter *p, int x, int y, const TQRect& clipRect,
84 const TQColor& color, const TQBrush* paper = 0 ) const;
85 virtual void draw( TQPainter *p, int x, int y, const TQRegion& clipRegion,
86 const TQColor& color, const TQBrush* paper = 0 ) const;
87
88 TQString text() const;
89 TQFont font() const;
90 bool isRichText() const;
91
92
93 protected:
94 bool _isRichText;
95 TQSimpleRichText* _richText; // used when _isRichText == true
96 TQString _text; // used when _isRichText == false
97 TQFont _font; // used when _isRichText == false
98 TQFontMetrics* _metrics;
99 bool _dirtyMetrics;
100};
101
102#endif