SVN_SILENT made messages (.desktop file)
[kdegames.git] / konquest / mapitems.h
blobdbf549c82ab8e718ebe943f35ee1a909afafa9b3
1 /*
2 Copyright Russell Steffen <rsteffen@bayarea.net>
3 Copyright Stephan Zehetner <s.zehetner@nevox.org>
4 Copyright Dmitry Suzdalev <dimsuz@gmail.com>
5 Copyright <inge@lysator.liu.se>
6 Copyright <pinaraf@gmail.com>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef _MAPITEMS_H_
23 #define _MAPITEMS_H_
26 #include <QGraphicsItem>
27 #include <QTextDocument>
28 #include <QObject>
29 #include "sector.h"
32 class MapScene;
34 class PlanetItem : public QObject, public QGraphicsItem
36 Q_OBJECT
38 public:
39 PlanetItem(MapScene *scene, Sector *sector);
40 ~PlanetItem() {}
42 QRectF boundingRect() const;
43 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
44 QWidget *widget);
46 void hoverEnterEvent ( QGraphicsSceneHoverEvent *event );
47 void hoverLeaveEvent ( QGraphicsSceneHoverEvent *event );
48 void mousePressEvent ( QGraphicsSceneMouseEvent *event );
49 void unselect ();
50 void select ();
51 Sector *sector () { return m_sector; }
53 signals:
54 void planetItemSelected (PlanetItem *);
56 private slots:
57 void updatePlanet ();
58 void blinkPlanet ();
60 private:
61 MapScene *m_scene;
62 Sector *m_sector;
64 bool m_hovered;
65 bool m_selected;
66 bool m_blinkState;
67 QTimer *m_blinkTimer;
68 QString m_lookName;
72 class PlanetInfoItem : public QGraphicsItem
74 public:
75 PlanetInfoItem();
76 ~PlanetInfoItem() {}
78 QRectF boundingRect() const;
79 void setPlanet (Planet *planet);
80 Planet *planet () { return m_planet; }
81 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
82 QWidget *widget);
84 private:
85 QTextDocument m_textDoc;
86 Planet *m_planet;
90 #endif