1 /* 2 SPDX-FileCopyrightText: 1997 Mathias Mueller <in5y158@public.uni-hamburg.de> 3 SPDX-FileCopyrightText: 2006 Mauricio Piacentini <mauricio@tabuleiro.com> 4 5 SPDX-License-Identifier: GPL-2.0-or-later 6 */ 7 8 #ifndef KMAHJONGGTILESET_H 9 #define KMAHJONGGTILESET_H 10 11 // Qt 12 #include <QString> 13 #include <QPixmap> 14 // Std 15 #include <memory> 16 17 // LibKMahjongg 18 #include <libkmahjongg_export.h> 19 20 class KMahjonggTilesetPrivate; 21 22 /** 23 * @class KMahjonggTileset kmahjonggtileset.h <KMahjonggTileset> 24 * 25 * A tile set 26 */ 27 class LIBKMAHJONGG_EXPORT KMahjonggTileset { 28 public: 29 KMahjonggTileset(); 30 ~KMahjonggTileset(); 31 32 bool loadDefault(); 33 bool loadTileset(const QString & tilesetPath); 34 bool loadGraphics(); 35 bool reloadTileset(const QSize & newTilesize); 36 QSize preferredTileSize(const QSize & boardsize, int horizontalCells, int verticalCells); 37 QString authorProperty(const QString &key) const; 38 39 short width() const; 40 short height() const; 41 short levelOffsetX() const; 42 short levelOffsetY() const; 43 short qWidth() const; 44 short qHeight() const; 45 QString path() const; 46 47 QPixmap selectedTile(int num); 48 QPixmap unselectedTile(int num); 49 QPixmap tileface(int num); 50 51 protected: 52 void updateScaleInfo(short tilew, short tileh); 53 void buildElementIdTable(void); 54 QString pixmapCacheNameFromElementId(const QString & elementid); 55 QPixmap renderElement(short width, short height, const QString & elementid); 56 57 58 private: 59 friend class KMahjonggTilesetPrivate; 60 std::unique_ptr<KMahjonggTilesetPrivate> const d; 61 62 Q_DISABLE_COPY(KMahjonggTileset) 63 }; 64 65 #endif // KMAHJONGGTILESET_H 66