File indexing completed on 2022-11-29 18:38:54

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 #ifndef KBBGRAPHICSITEMBALL_H
0011 #define KBBGRAPHICSITEMBALL_H
0012 
0013 
0014 
0015 class QTimer;
0016 
0017 
0018 #include "kbbgraphicsitemonbox.h"
0019 class KBBGraphicsItemInteractionInfo;
0020 class KBBScalableGraphicWidget;
0021 class KBBThemeManager;
0022 
0023 
0024 
0025 /**
0026  * @brief Ball on the scalable graphic widget
0027  *
0028  * A ball can be gray, red or gray with a question mark.
0029  */
0030 class KBBGraphicsItemBall : public KBBGraphicsItemOnBox
0031 {
0032     Q_OBJECT
0033     
0034     public:
0035         static const int TIME_TO_WAIT_BEFORE_SHOWING_INTERACTIONS = 1500;
0036         
0037         /**
0038          * @brief Constructor
0039          */
0040         KBBGraphicsItemBall(KBBScalableGraphicWidget::itemType itemType, KBBScalableGraphicWidget* parent, KBBThemeManager* themeManager, int boxPosition, int columns, int rows);
0041 
0042 
0043         ~KBBGraphicsItemBall() override;
0044 
0045 
0046     private Q_SLOTS:
0047         void showInteractions();
0048 
0049 
0050     private:
0051         void hoverEnterEvent (QGraphicsSceneHoverEvent*) override;
0052         void hoverLeaveEvent (QGraphicsSceneHoverEvent*) override;
0053         void init(KBBScalableGraphicWidget::itemType itemType, KBBThemeManager* themeManager);
0054         void removeInteractionInfos() override;
0055         
0056         KBBGraphicsItemInteractionInfo* m_interactionInfos[8];
0057         KBBThemeManager* m_themeManager;
0058         QTimer* m_timer;
0059         
0060         KBBScalableGraphicWidget::itemType m_ballType;
0061 };
0062 
0063 #endif // KBBGRAPHICSITEMBALL_H