Warning: That file was not part of the compilation database. It may have many parsing errors.

1//
2// KBlackBox
3//
4// A simple game inspired by an emacs module
5//
6/***************************************************************************
7 * Copyright (c) 2007, Nicolas Roffet *
8 * nicolas-kde@roffet.com *
9 * *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License for more details. *
20 * *
21 * You should have received a copy of the GNU General Public License *
22 * along with this program; if not, write to the *
23 * Free Software Foundation, Inc., *
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
25 ***************************************************************************/
26
27
28
29#ifndef KBBBALLSGRAPHICWIDGET_H
30#define KBBBALLSGRAPHICWIDGET_H
31
32
33class QGraphicsScene;
34#include <QGraphicsView>
35#include <QList>
36
37
38class KBBGraphicsItem;
39class KBBThemeManager;
40
41
42
43/**
44 * @brief Widget displaying the number of balls to place on the black box
45 *
46 * This is always the number of balls remaining to be placed. If this number is negative because the player placed too many balls, the widget displays how many balls the player should remove from the black box.
47 */
48class KBBBallsGraphicWidget : public QGraphicsView
49{
50 public:
51 /**
52 * @brief Constructor
53 *
54 * @param themeManager Pointer to the theme manager to display the right graphic items.
55 */
56 explicit KBBBallsGraphicWidget(KBBThemeManager* themeManager);
57
58 /**
59 * @brief Destructor
60 * Remove all items displayed on the scene.
61 */
62 ~KBBBallsGraphicWidget();
63
64
65 /**
66 * @brief Event: widget has been resized
67 * This happens for instance when the main window has been resized.
68 */
69 void resizeEvent(QResizeEvent*);
70
71 /**
72 * @brief Define the number of balls to place on the black box
73 *
74 * This defines also the maximum number of balls (or items) to display on this widget.
75 * @param ballsToPlace Number of balls to place
76 */
77 void setBallsToPlace(const int ballsToPlace);
78
79 /**
80 * @brief Define the number of balls the player already placed on the board
81 *
82 * So the number of balls to display on this widget is "Number of balls to place" - this. (if >=0).
83 * @param placedBalls Number of balls placed on the black box.
84 */
85 void setPlacedBalls(const int placedBalls);
86
87
88 private:
89 int m_ballsToPlace;
90 QList<KBBGraphicsItem*> m_playerBalls;
91 QGraphicsScene* m_scene;
92 KBBThemeManager* m_themeManager;
93 QList<KBBGraphicsItem*> m_wrongPlayerBalls;
94};
95
96#endif // KBBBALLSGRAPHICWIDGET_H
97

Warning: That file was not part of the compilation database. It may have many parsing errors.