File indexing completed on 2022-11-23 10:43:24

0001 /*
0002     KBlackBox - A simple game inspired by an emacs module
0003 
0004     SPDX-FileCopyrightText: 1999-2000 Robert Cimrman <cimrman3@students.zcu.cz>
0005     SPDX-FileCopyrightText: 2007 Nicolas Roffet <nicolas-kde@roffet.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 
0011 
0012 #ifndef KBBGRAPHICSITEMLASER_H
0013 #define KBBGRAPHICSITEMLASER_H
0014 
0015 
0016 #include "kbbgraphicsitem.h"
0017 #include "kbbgraphicsitemborder.h"
0018 #include "kbbitemwithposition.h"
0019 class KBBScalableGraphicWidget;
0020 class KBBThemeManager;
0021 
0022 
0023 
0024 /**
0025  * @brief Laser element of the scalable graphic widget
0026  *
0027  * The laser is used to shoot a laser ray into the black box.
0028  *
0029  * 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.
0030  */
0031 class KBBGraphicsItemLaser : public KBBGraphicsItemBorder, public KBBGraphicsItem, public KBBItemWithPosition
0032 {
0033     public:
0034         /**
0035          * @brief Constructor
0036          * 
0037          * @param parent Scalable graphic widget
0038          * @param themeManager Theme manager
0039          * @param borderPosition Position of the laser around the border. Each laser has a different border position.
0040          * @param columns Width of the Black Box
0041          * @param rows Height of the Black Box
0042          */
0043         KBBGraphicsItemLaser(KBBScalableGraphicWidget* parent, KBBThemeManager* themeManager, const int borderPosition, const int columns, const int rows);
0044 
0045         /**
0046          * @brief Get the border position
0047          */
0048         int position() override;
0049 
0050 
0051     private:
0052         void hoverEnterEvent (QGraphicsSceneHoverEvent*) override;
0053         void hoverLeaveEvent (QGraphicsSceneHoverEvent*) override;
0054         void mousePressEvent (QGraphicsSceneMouseEvent* event) override;
0055         
0056         KBBScalableGraphicWidget* m_widget;
0057 };
0058 
0059 #endif // KBBGRAPHICSITEMLASER_H