cardcache.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE games library
00003 
00004     Copyright 2008 Andreas Pakulat <apaku@gmx.de>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License version 2 as published by the Free Software Foundation.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef __CARDCACHE_H_
00022 #define __CARDCACHE_H_
00023 
00024 #include "libkdegames_export.h"
00025 
00026 class QPixmap;
00027 class QString;
00028 class QSize;
00029 class QSizeF;
00030 
00031 
00032 class KDEGAMES_EXPORT KCardInfo
00033 {
00034 public:
00035     enum Suit { None, Diamond, Heart, Club, Spade };
00036     enum Card { Joker, Ace, King, Queen, Jack, Ten, Nine, Eight, Seven, Six, Five, Four, Three, Two };
00037 
00038     KCardInfo( Suit s, Card c );
00039 
00040     void setCard( Card c );
00041     Card card() const;
00042 
00043     void setSuit( Suit s );
00044     Suit suit() const;
00045 
00046     QString pngName() const;
00047     QString svgName() const;
00048     bool operator==( const KCardInfo& c ) const;
00049 private:
00050     Suit m_suit;
00051     Card m_card;
00052 };
00053 
00079 class KDEGAMES_EXPORT KCardCache
00080 {
00081 public:
00082 
00088     enum LoadInfo
00089     {
00090         LoadFrontSide = 1 << 0 ,
00091         LoadBackSide = 1 << 2 ,
00092         Load52Cards = 1 << 3 ,
00093         Load32Cards = 1 << 4 ,
00094         Load53Cards = 1 << 5 
00095     };
00096     Q_DECLARE_FLAGS( LoadInfos, LoadInfo )
00097     
00098     
00102     KCardCache();
00103     
00107     ~KCardCache();
00108     
00116     void setSize( const QSize& size );
00117 
00123     QSize size() const;
00124     
00132     void setFrontTheme( const QString& theme );
00133     
00138     QString frontTheme() const;
00139     
00147     void setBackTheme( const QString& theme );
00148     
00153     QString backTheme() const;
00154 
00168     QPixmap backside( int variant = -1 ) const;
00169     
00181     QSizeF defaultBackSize( int variant = -1 ) const;
00182     
00186     void invalidateBackside();
00187     
00204     QPixmap frontside( const KCardInfo& info ) const;
00205     
00218     QSizeF defaultFrontSize( const KCardInfo& info ) const;
00219     
00220     
00224     void invalidateFrontside();
00225     
00234     void loadTheme( LoadInfos infos = LoadInfos( LoadFrontSide | LoadBackSide | Load53Cards ) );
00235 private:
00236     class KCardCachePrivate* const d;
00237 };
00238 
00239 Q_DECLARE_OPERATORS_FOR_FLAGS( KCardCache::LoadInfos )
00240 
00241 #endif

Generated on Sun Mar 16 08:02:52 2008 for Libkdegames by  doxygen 1.5.3