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 KBBGRAPHICSITEMLASER_H
33#define KBBGRAPHICSITEMLASER_H
34
35
36#include "kbbgraphicsitem.h"
37#include "kbbgraphicsitemborder.h"
38#include "kbbitemwithposition.h"
39class KBBScalableGraphicWidget;
40class KBBThemeManager;
41
42
43
44/**
45 * @brief Laser element of the scalable graphic widget
46 *
47 * The laser is used to shoot a laser ray into the black box.
48 *
49 * Note: The laser size should be so defined: width = width of a single box of the black box (RATIO), height = twice the size of single box of the black box (2*RATIO). The laser size is independent of the board border size.
50 */
51class KBBGraphicsItemLaser : public KBBGraphicsItemBorder, public KBBGraphicsItem, public KBBItemWithPosition
52{
53 public:
54 /**
55 * @brief Constructor
56 *
57 * @param parent Scalable graphic widget
58 * @param themeManager Theme manager
59 * @param borderPosition Position of the laser around the border. Each laser has a different border position.
60 * @param columns Width of the Black Box
61 * @param rows Height of the Black Box
62 */
63 KBBGraphicsItemLaser(KBBScalableGraphicWidget* parent, KBBThemeManager* themeManager, const int borderPosition, const int columns, const int rows);
64
65 /**
66 * @brief Get the border position
67 */
68 int position();
69
70
71 private:
72 void hoverEnterEvent (QGraphicsSceneHoverEvent*);
73 void hoverLeaveEvent (QGraphicsSceneHoverEvent*);
74 void mousePressEvent (QGraphicsSceneMouseEvent* event);
75
76 KBBScalableGraphicWidget* m_widget;
77};
78
79#endif // KBBGRAPHICSITEMLASER_H
80