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 | |
31 | |
32 | #ifndef KBBGRAPHICSITEMBLACKBOX_H |
33 | #define KBBGRAPHICSITEMBLACKBOX_H |
34 | |
35 | |
36 | class QGraphicsLineItem; |
37 | #include <QGraphicsRectItem> |
38 | class QGraphicsScene; |
39 | class QGraphicsView; |
40 | #include <QList> |
41 | #include <QPen> |
42 | |
43 | |
44 | class KBBGraphicsItem; |
45 | #include "kbbscalablegraphicwidget.h" |
46 | |
47 | |
48 | |
49 | /** |
50 | * @brief The black box in the scalable graphic widget |
51 | */ |
52 | class KBBGraphicsItemBlackBox : public QGraphicsRectItem |
53 | { |
54 | public: |
55 | /** |
56 | * @brief Constructor |
57 | */ |
58 | KBBGraphicsItemBlackBox(QGraphicsView* parent, QGraphicsScene* scene, KBBThemeManager* themeManager); |
59 | |
60 | |
61 | /** |
62 | * @brief Set the KBBScalableGraphicWidget |
63 | */ |
64 | void setKBBScalableGraphicWidget(KBBScalableGraphicWidget* w); |
65 | |
66 | /** |
67 | * @brief Define the (new) size of the black box |
68 | * |
69 | * Used to "recycle" the black box for a new game. |
70 | */ |
71 | void setSize(const int columns, const int rows); |
72 | |
73 | |
74 | private: |
75 | void mousePressEvent (QGraphicsSceneMouseEvent* event); |
76 | |
77 | KBBGraphicsItem* m_background; |
78 | int m_columns; |
79 | QList<QGraphicsLineItem*> m_lines; |
80 | QPen m_penLines; |
81 | int m_rows; |
82 | QGraphicsScene* m_scene; |
83 | KBBScalableGraphicWidget* m_widget; |
84 | int m_zValueLines; |
85 | }; |
86 | |
87 | #endif // KBBGRAPHICSITEMBLACKBOX_H |
88 | |