1/*
2 Copyright 2007 Dmitry Suzdalev <dimsuz@gmail.com>
3 Copyright 2010 Brian Croom <brian.s.croom@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19#ifndef BORDERITEM_H
20#define BORDERITEM_H
21#include <KGameRenderedItem>
22
23#include "commondefs.h"
24
25class KGameRenderer;
26
27/**
28 * Graphics item representing border cell
29 */
30class BorderItem : public KGameRenderedItem
31{
32public:
33 BorderItem( KGameRenderer* renderer, QGraphicsItem* parent );
34 void setBorderType( KMinesState::BorderElement e ) { m_element = e; updatePixmap(); }
35 void setRowCol( int row, int col ) { m_row = row; m_col = col; }
36 int row() const { return m_row; }
37 int col() const { return m_col; }
38 void updatePixmap();
39
40 // enable use of qgraphicsitem_cast
41 enum { Type = UserType + 1 };
42 virtual int type() const { return Type; }
43private:
44 static QHash<KMinesState::BorderElement, QString> s_elementNames;
45 static void fillNameHash();
46
47 KMinesState::BorderElement m_element;
48 int m_row;
49 int m_col;
50};
51
52#endif
53