1//
2// KBlackBox
3//
4// A simple game inspired by an emacs module
5//
6/***************************************************************************
7 * Copyright (c) 1999-2000, Robert Cimrman *
8 * cimrman3@students.zcu.cz *
9 * *
10 * Copyright (c) 2007, Nicolas Roffet *
11 * nicolas-kde@roffet.com *
12 * *
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program; if not, write to the *
26 * Free Software Foundation, Inc., *
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
28 ***************************************************************************/
29
30#ifndef KBBGRAPHICSITEMBALL_H
31#define KBBGRAPHICSITEMBALL_H
32
33
34
35class QTimer;
36
37
38#include "kbbgraphicsitemonbox.h"
39class KBBGraphicsItemInteractionInfo;
40class KBBScalableGraphicWidget;
41class KBBThemeManager;
42
43
44
45/**
46 * @brief Ball on the scalable graphic widget
47 *
48 * A ball can be gray, red or gray with a question mark.
49 */
50class KBBGraphicsItemBall : public KBBGraphicsItemOnBox
51{
52 Q_OBJECT
53
54 public:
55 static const int TIME_TO_WAIT_BEFORE_SHOWING_INTERACTIONS = 1500;
56
57 /**
58 * @brief Constructor
59 */
60 KBBGraphicsItemBall(KBBScalableGraphicWidget::itemType itemType, KBBScalableGraphicWidget* parent, KBBThemeManager* themeManager, int boxPosition, int columns, int rows);
61
62
63 ~KBBGraphicsItemBall();
64
65
66 private slots:
67 void showInteractions();
68
69
70 private:
71 void hoverEnterEvent (QGraphicsSceneHoverEvent*);
72 void hoverLeaveEvent (QGraphicsSceneHoverEvent*);
73 void init(KBBScalableGraphicWidget::itemType itemType, KBBThemeManager* themeManager);
74 void removeInteractionInfos();
75
76 KBBGraphicsItemInteractionInfo* m_interactionInfos[8];
77 KBBThemeManager* m_themeManager;
78 QTimer* m_timer;
79
80 KBBScalableGraphicWidget::itemType m_ballType;
81};
82
83#endif // KBBGRAPHICSITEMBALL_H
84