File indexing completed on 2024-04-14 14:32:01
0001 // Copyright (c) 2002 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_PORTFOLIOESTATE_H 0018 #define ATLANTIK_PORTFOLIOESTATE_H 0019 0020 #include <qpixmap.h> 0021 #include <QWidget> 0022 0023 #define PE_WIDTH 13 0024 #define PE_HEIGHT 16 0025 0026 class Estate; 0027 class Player; 0028 0029 class PortfolioEstate : public QWidget 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 PortfolioEstate(Estate *estate, Player *player, bool alwaysOwned, QWidget *parent); 0035 Estate *estate() const { return m_estate; } 0036 static QPixmap drawPixmap(Estate *estate, Player *player = nullptr, bool alwaysOwned = true); 0037 0038 protected: 0039 void paintEvent(QPaintEvent *) override; 0040 void mousePressEvent(QMouseEvent *) override; 0041 0042 private Q_SLOTS: 0043 void estateChanged(); 0044 0045 Q_SIGNALS: 0046 void estateClicked(Estate *estate); 0047 0048 private: 0049 Estate *m_estate; 0050 Player *m_player; 0051 QPixmap m_pixmap; 0052 bool b_recreate, m_alwaysOwned; 0053 QColor m_estateColor; 0054 Player *m_estateOwner; 0055 }; 0056 0057 #endif