File indexing completed on 2024-04-21 04:02:38

0001 /*
0002     SPDX-FileCopyrightText: 2007 Dmitry Suzdalev <dimsuz@gmail.com>
0003     SPDX-FileCopyrightText: 2010 Brian Croom <brian.s.croom@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef BORDERITEM_H
0009 #define BORDERITEM_H
0010 
0011 // own
0012 #include "commondefs.h"
0013 // KDEGames
0014 #include <KGameRenderedItem>
0015 
0016 class KGameRenderer;
0017 
0018 /**
0019  * Graphics item representing border cell
0020  */
0021 class BorderItem : public KGameRenderedItem
0022 {
0023 public:
0024     BorderItem( KGameRenderer* renderer, QGraphicsItem* parent );
0025     void setBorderType( KMinesState::BorderElement e );
0026     void setRowCol( int row, int col );
0027     Q_REQUIRED_RESULT int row() const;
0028     Q_REQUIRED_RESULT int col() const;
0029     void updatePixmap();
0030 
0031     // enable use of qgraphicsitem_cast
0032     enum { Type = UserType + 1 };
0033     Q_REQUIRED_RESULT int type() const override;
0034 private:
0035     static QHash<KMinesState::BorderElement, QString> s_elementNames;
0036     static void fillNameHash();
0037 
0038     KMinesState::BorderElement m_element;
0039     int m_row = -1;
0040     int m_col = -1;
0041 };
0042 
0043 #endif