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: 2007 Nicolas Roffet <nicolas-kde@roffet.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 
0010 
0011 #ifndef KBBGRAPHICSITEMCURSOR_H
0012 #define KBBGRAPHICSITEMCURSOR_H
0013 
0014 
0015 #include "kbbgraphicsitem.h"
0016 class KBBScalableGraphicWidget;
0017 class KBBThemeManager;
0018 
0019 
0020 
0021 /**
0022  * @brief "Cursor" on the scalable graphic widget
0023  *
0024  * The "cursor" is used to play with the keyboard.
0025  */
0026 class KBBGraphicsItemCursor : public KBBGraphicsItem
0027 {
0028     Q_OBJECT
0029 
0030 
0031     public:
0032         /**
0033          * @brief Invalid border and box position
0034          */
0035         static const int NO_POSITION = -1;
0036 
0037 
0038         KBBGraphicsItemCursor(KBBScalableGraphicWidget* parent, KBBThemeManager* themeManager);
0039         
0040         
0041         int borderPosition();
0042         int boxPosition();
0043         
0044         void moveDown();
0045         void moveLeft();
0046         void moveRight();
0047         void moveUp();
0048         
0049         void setBoardSize(const int columns, const int rows);
0050         void setBorderPosition(const int borderPosition);
0051         void setBoxPosition(const int boxPosition);
0052         void updatePositions();
0053 
0054     Q_SIGNALS:
0055         void cursorAtNewPosition(const int borderPosition);
0056 
0057 
0058     private:
0059         
0060         int m_boxPosition;
0061         int m_borderPosition;
0062         int m_columns;
0063         int m_rows;
0064 };
0065 
0066 #endif // KBBGRAPHICSITEMCURSOR_H