File indexing completed on 2024-06-09 04:03:33
0001 /* 0002 * Copyright (C) 2009-2010 Parker Coates <coates@kde.org> 0003 * 0004 * This program is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU General Public License as 0006 * published by the Free Software Foundation; either version 2 of 0007 * the License, or (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0016 * 0017 */ 0018 0019 #ifndef KABSTRACTCARDDECK_H 0020 #define KABSTRACTCARDDECK_H 0021 0022 // own 0023 #include "kcardtheme.h" 0024 #include "libkcardgame_export.h" 0025 // Qt 0026 #include <QObject> 0027 0028 class KCard; 0029 class QSize; 0030 0031 class LIBKCARDGAME_EXPORT KAbstractCardDeck : public QObject 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 explicit KAbstractCardDeck(const KCardTheme &theme = KCardTheme(), QObject *parent = nullptr); 0037 virtual ~KAbstractCardDeck(); 0038 0039 void setDeckContents(const QList<quint32> &ids); 0040 QList<KCard *> cards() const; 0041 0042 virtual int rankFromId(quint32 id) const; 0043 virtual int suitFromId(quint32 id) const; 0044 virtual int colorFromId(quint32 id) const; 0045 0046 void setCardWidth(int width); 0047 int cardWidth() const; 0048 void setCardHeight(int height); 0049 int cardHeight() const; 0050 QSize cardSize() const; 0051 0052 void setTheme(const KCardTheme &theme); 0053 KCardTheme theme() const; 0054 0055 bool hasAnimatedCards() const; 0056 void stopAnimations(); 0057 0058 QPixmap cardPixmap(quint32 id, bool faceUp); 0059 0060 Q_SIGNALS: 0061 void cardAnimationDone(); 0062 0063 protected: 0064 virtual QString elementName(quint32 id, bool faceUp = true) const = 0; 0065 0066 private: 0067 class KAbstractCardDeckPrivate *const d; 0068 0069 friend class KAbstractCardDeckPrivate; 0070 }; 0071 0072 #endif