File indexing completed on 2022-09-27 13:20:31

0001 /*
0002     SPDX-FileCopyrightText: 1997 Mathias Mueller <in5y158@public.uni-hamburg.de>
0003     SPDX-FileCopyrightText: 2006 Mauricio Piacentini <mauricio@tabuleiro.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KMAHJONGGTILESET_H
0009 #define KMAHJONGGTILESET_H
0010 
0011 // Qt
0012 #include <QString>
0013 #include <QPixmap>
0014 // Std
0015 #include <memory>
0016 
0017 // LibKMahjongg
0018 #include <libkmahjongg_export.h>
0019 
0020 class KMahjonggTilesetPrivate;
0021 
0022 /**
0023  * @class KMahjonggTileset kmahjonggtileset.h <KMahjonggTileset>
0024  *
0025  * A tile set
0026  */
0027 class LIBKMAHJONGG_EXPORT KMahjonggTileset {
0028    public:
0029     KMahjonggTileset();
0030     ~KMahjonggTileset();
0031 
0032     bool loadDefault();
0033     bool loadTileset(const QString & tilesetPath);
0034     bool loadGraphics();
0035     bool reloadTileset(const QSize & newTilesize);
0036     QSize preferredTileSize(const QSize & boardsize, int horizontalCells, int verticalCells);
0037     QString authorProperty(const QString &key) const;
0038 
0039     short width() const;
0040     short height() const;
0041     short levelOffsetX() const;
0042     short levelOffsetY() const;
0043     short qWidth() const;
0044     short qHeight() const;
0045     QString path() const;
0046 
0047     QPixmap selectedTile(int num);
0048     QPixmap unselectedTile(int num);
0049     QPixmap tileface(int num);
0050 
0051 protected:
0052     void updateScaleInfo(short tilew, short tileh);
0053     void buildElementIdTable(void);
0054     QString pixmapCacheNameFromElementId(const QString & elementid);
0055     QPixmap renderElement(short width, short height, const QString & elementid);
0056 
0057 
0058   private:
0059     friend class KMahjonggTilesetPrivate;
0060     std::unique_ptr<KMahjonggTilesetPrivate> const d;
0061 
0062     Q_DISABLE_COPY(KMahjonggTileset)
0063 };
0064 
0065 #endif // KMAHJONGGTILESET_H