File indexing completed on 2024-04-21 15:08:03

0001 // Copyright (c) 2002-2003 Rob Kaper <cap@capsi.com>
0002 //
0003 // This library is free software; you can redistribute it and/or
0004 // modify it under the terms of the GNU Lesser General Public
0005 // License version 2.1 as published by the Free Software Foundation.
0006 //
0007 // This library is distributed in the hope that it will be useful,
0008 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0010 // Lesser General Public License for more details.
0011 //
0012 // You should have received a copy of the GNU Lesser General Public License
0013 // along with this library; see the file COPYING.LIB.  If not, write to
0014 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0015 // Boston, MA 02110-1301, USA.
0016 
0017 #ifndef ATLANTIK_TOKEN_H
0018 #define ATLANTIK_TOKEN_H
0019 
0020 #include <QWidget>
0021 
0022 #include "tokentheme.h"
0023 
0024 class QPixmap;
0025 
0026 class Player;
0027 class Estate;
0028 class AtlantikBoard;
0029 
0030 class Token : public QWidget
0031 {
0032 Q_OBJECT
0033 
0034     public:
0035         Token (Player *player, AtlantikBoard *parent);
0036         ~Token();
0037         Player *player() const;
0038         void setLocation(Estate *estate);
0039         Estate *location() const { return m_location; }
0040         void setDestination(Estate *estate);
0041         Estate *destination() const { return m_destination; }
0042         void setInJail (bool inJail) { m_inJail = inJail; }
0043         bool inJail() const { return m_inJail; }
0044         void setTokenTheme(const TokenTheme &theme);
0045 
0046     private Q_SLOTS:
0047         void playerChanged();
0048 
0049     protected:
0050         void paintEvent(QPaintEvent *) override;
0051         void resizeEvent(QResizeEvent *) override;
0052 
0053 private:
0054         void loadIcon();
0055 
0056         Player *m_player;
0057         Estate *m_location, *m_destination;
0058         bool m_inJail;
0059         AtlantikBoard *m_parentBoard;
0060         bool b_recreate;
0061         QPixmap *qpixmap, *m_image;
0062         QString m_imageName;
0063         QString m_playerName;
0064         TokenTheme m_theme;
0065 };
0066 
0067 #endif