• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkdegames

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 
00034 class KDEGAMES_EXPORT KCardInfo
00035 {
00036 public:
00037     enum Suit { None, Diamond, Heart, Club, Spade };
00038     enum Card { Joker, Ace, King, Queen, Jack, Ten, Nine, Eight, Seven, Six, Five, Four, Three, Two };
00039 
00040     KCardInfo( Suit s, Card c );
00041 
00042     void setCard( Card c );
00043     Card card() const;
00044 
00045     void setSuit( Suit s );
00046     Suit suit() const;
00047 
00048     QString pngName() const;
00049     QString svgName() const;
00050     bool operator==( const KCardInfo& c ) const;
00051 private:
00052     Suit m_suit;
00053     Card m_card;
00054 };
00055 
00083 class KDEGAMES_EXPORT KCardCache
00084 {
00085 public:
00086 
00092     enum LoadInfo
00093     {
00094         LoadFrontSide = 1 << 0 ,
00095         LoadBackSide = 1 << 2 ,
00096     Load52Cards = 1 << 3 ,
00097     Load32Cards = 1 << 4 ,
00098     Load53Cards = 1 << 5 
00099     };
00100     Q_DECLARE_FLAGS( LoadInfos, LoadInfo )
00101     
00102     
00106     KCardCache();
00107     
00111     ~KCardCache();
00112     
00120     void setSize( const QSize& size );
00121 
00127     QSize size() const;
00128     
00136     void setFrontTheme( const QString& theme );
00137     
00142     QString frontTheme() const;
00143     
00151     void setBackTheme( const QString& theme );
00152     
00157     QString backTheme() const;
00158 
00172     QPixmap backside( int variant = -1 ) const;
00173     
00185     QSizeF defaultBackSize( int variant = -1 ) const;
00186     
00190     void invalidateBackside();
00191     
00208     QPixmap frontside( const KCardInfo& info ) const;
00209     
00222     QSizeF defaultFrontSize( const KCardInfo& info ) const;
00223     
00224     
00228     void invalidateFrontside();
00229     
00238     void loadTheme( LoadInfos infos = LoadInfos( LoadFrontSide | LoadBackSide | Load53Cards ) );
00239 private:
00240     class KCardCachePrivate* const d;
00241 };
00242 
00243 Q_DECLARE_OPERATORS_FOR_FLAGS( KCardCache::LoadInfos )
00244 
00245 #endif

libkdegames

Skip menu "libkdegames"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal