1 | /*************************************************************************** |
2 | * Copyright 2010 Stefan Majewsky <majewsky@gmx.net> * |
3 | * * |
4 | * This program is free software; you can redistribute it and/or modify * |
5 | * it under the terms of the GNU Library General Public License * |
6 | * version 2 as published by the Free Software Foundation * |
7 | * * |
8 | * This program is distributed in the hope that it will be useful, * |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
11 | * GNU Library General Public License for more details. * |
12 | * * |
13 | * You should have received a copy of the GNU Library General Public * |
14 | * License along with this program; if not, write to the * |
15 | * Free Software Foundation, Inc., * |
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
17 | ***************************************************************************/ |
18 | |
19 | #ifndef KGAMERENDEREDITEM_H |
20 | #define KGAMERENDEREDITEM_H |
21 | |
22 | #include <QtCore/QObject> |
23 | #include <QtGui/QGraphicsItem> |
24 | |
25 | #include <kgamerendererclient.h> |
26 | #include <libkdegames_export.h> |
27 | |
28 | class KGameRenderedItemPrivate; |
29 | |
30 | /** |
31 | * @class KGameRenderedItem kgamerendereditem.h <KGameRenderedItem> |
32 | * @since 4.6 |
33 | * @short A QGraphicsPixmapItem which reacts to theme changes automatically. |
34 | * |
35 | * This class is a QGraphicsPixmapItem which retrieves its pixmap from a |
36 | * KGameRenderer, and updates it automatically when the KGameRenderer changes |
37 | * the theme. |
38 | */ |
39 | class KDEGAMES_EXPORT KGameRenderedItem : public QGraphicsPixmapItem, public KGameRendererClient |
40 | { |
41 | public: |
42 | ///Creates a new KGameRenderedItem which renders the sprite with the |
43 | ///given @a spriteKey as provided by the given @a renderer. |
44 | KGameRenderedItem(KGameRenderer* renderer, const QString& spriteKey, QGraphicsItem* parent = 0); |
45 | virtual ~KGameRenderedItem(); |
46 | protected: |
47 | virtual void receivePixmap(const QPixmap& pixmap); |
48 | private: |
49 | friend class KGameRenderedItemPrivate; |
50 | KGameRenderedItemPrivate* const d; |
51 | }; |
52 | |
53 | #endif // KGAMERENDEREDITEM_H |
54 | |