4 // A simple game inspired by an emacs module
6 /***************************************************************************
7 * Copyright (c) 2007, Nicolas Roffet *
8 * nicolas-kde@roffet.com *
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. *
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. *
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 ***************************************************************************/
29 #ifndef KBBBALLSGRAPHICWIDGET_H
30 #define KBBBALLSGRAPHICWIDGET_H
34 #include <QGraphicsView>
38 class KBBGraphicsItem
;
39 class KBBThemeManager
;
44 * @brief Widget displaying the number of balls to place on the black box
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.
48 class KBBBallsGraphicWidget
: public QGraphicsView
54 * @param themeManager Pointer to the theme manager to display the right graphic items.
56 explicit KBBBallsGraphicWidget(KBBThemeManager
* themeManager
);
60 * Remove all items displayed on the scene.
62 ~KBBBallsGraphicWidget();
66 * @brief Event: widget has been resized
67 * This happens for instance when the main window has been resized.
69 void resizeEvent(QResizeEvent
*);
72 * @brief Define the number of balls to place on the black box
74 * This defines also the maximum number of balls (or items) to display on this widget.
75 * @param ballsToPlace Number of balls to place
77 void setBallsToPlace(const int ballsToPlace
);
80 * @brief Define the number of balls the player already placed on the board
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.
85 void setPlacedBalls(const int placedBalls
);
90 QList
<KBBGraphicsItem
*> m_playerBalls
;
91 QGraphicsScene
* m_scene
;
92 KBBThemeManager
* m_themeManager
;
93 QList
<KBBGraphicsItem
*> m_wrongPlayerBalls
;
96 #endif // KBBBALLSGRAPHICWIDGET_H