1/***************************************************************************
2 * Copyright (C) 1999-2006 by Éric Bischoff <ebischoff@nerim.net> *
3 * Copyright (C) 2007 by Albert Astals Cid <aacid@kde.org> *
4 * *
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 ***************************************************************************/
10
11/* Object to draw on the game board */
12
13#ifndef _TODRAW_H_
14#define _TODRAW_H_
15
16#include <QGraphicsSvgItem>
17
18
19QPixmap toPixmap(const QString &element, int width, int height, QSvgRenderer *renderer);
20
21class ToDraw : public QGraphicsSvgItem
22{
23 public:
24 ToDraw();
25
26 void save(QDataStream &stream) const;
27 bool load(QDataStream &stream);
28
29 bool contains(const QPointF &point) const;
30
31 enum { Type = UserType + 1 };
32 int type() const;
33
34 QRectF boundingRect() const;
35 QRectF unclippedRect() const;
36
37 protected:
38 QVariant itemChange(GraphicsItemChange change, const QVariant &value);
39
40 private:
41 QRectF clippedRectAt(const QPointF &somePos) const;
42};
43
44#endif
45