Fix debian/rules to build in BUILD/ dir.
[tagua/yd.git] / src / constrainedtext.h
blob234ada4459f1d6f2ba8abb31af4adecae6f2ea38
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef CONSTRAINEDTEXT_H
12 #define CONSTRAINEDTEXT_H
14 #include <kgamecanvas.h>
16 class ConstrainedText : public KGameCanvasItem
18 private:
19 QString m_text;
20 QColor m_color;
21 QFont m_font;
22 QRect m_constr;
23 QRect m_bounding_rect;
24 QRect m_bounding_rect_max;
26 void calcBoundingRect();
28 public:
29 ConstrainedText(const QString& text, const QColor& color,
30 const QFont& font, const QRect& rect,
31 KGameCanvasAbstract* canvas = NULL);
33 ConstrainedText(KGameCanvasAbstract* canvas = NULL);
35 virtual ~ConstrainedText();
37 QRect constrainRect() const { return m_constr; }
38 void setConstrainRect(const QRect& );
39 QString text() const { return m_text; }
40 void setText(const QString& text);
41 QColor color() const { return m_color; }
42 void setColor(const QColor& color);
43 QFont font() const { return m_font; }
44 void setFont(const QFont& font);
46 virtual void paint(QPainter* p);
47 virtual QRect rect() const;
48 virtual bool layered() const { return false; }
51 #endif //CONSTRAINEDTEXT_H