1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
//
// KBlackBox
//
// A simple game inspired by an emacs module
//
/***************************************************************************
* Copyright (c) 1999-2000, Robert Cimrman *
* cimrman3@students.zcu.cz *
* *
* Copyright (c) 2007, Nicolas Roffet *
* nicolas-kde@roffet.com *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
***************************************************************************/
#ifndef KBBGRAPHICSITEMLASER_H
#define KBBGRAPHICSITEMLASER_H
#include "kbbgraphicsitem.h"
#include "kbbgraphicsitemborder.h"
#include "kbbitemwithposition.h"
class KBBScalableGraphicWidget;
class KBBThemeManager;
/**
* @brief Laser element of the scalable graphic widget
*
* The laser is used to shoot a laser ray into the black box.
*
* 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.
*/
class KBBGraphicsItemLaser : public KBBGraphicsItemBorder, public KBBGraphicsItem, public KBBItemWithPosition
{
public:
/**
* @brief Constructor
*
* @param parent Scalable graphic widget
* @param themeManager Theme manager
* @param borderPosition Position of the laser around the border. Each laser has a different border position.
* @param columns Width of the Black Box
* @param rows Height of the Black Box
*/
KBBGraphicsItemLaser(KBBScalableGraphicWidget* parent, KBBThemeManager* themeManager, const int borderPosition, const int columns, const int rows);
/**
* @brief Get the border position
*/
int position() Q_DECL_OVERRIDE;
private:
void hoverEnterEvent (QGraphicsSceneHoverEvent*) Q_DECL_OVERRIDE;
void hoverLeaveEvent (QGraphicsSceneHoverEvent*) Q_DECL_OVERRIDE;
void mousePressEvent (QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE;
KBBScalableGraphicWidget* m_widget;
};
#endif // KBBGRAPHICSITEMLASER_H
|