1/*
2 Copyright (C) 1997 Mathias Mueller <in5y158@public.uni-hamburg.de>
3 Copyright (C) 2006 Mauricio Piacentini <mauricio@tabuleiro.com>
4
5 Libkmahjongg is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18*/
19
20#ifndef _KMAHJONGGTILESET_H_
21#define _KMAHJONGGTILESET_H_
22
23#include <QtCore/QString>
24#include <QtGui/QPixmap>
25
26#include <libkmahjongg_export.h>
27
28class KMahjonggTilesetPrivate;
29
30class KMAHJONGGLIB_EXPORT KMahjonggTileset {
31 public:
32 KMahjonggTileset();
33 ~KMahjonggTileset();
34
35 bool loadDefault();
36 bool loadTileset(const QString & tilesetPath);
37 bool loadGraphics();
38 bool reloadTileset(const QSize & newTilesize);
39 QSize preferredTileSize(const QSize & boardsize, int horizontalCells, int verticalCells);
40 QString authorProperty(const QString &key) const;
41
42 short width() const;
43 short height() const;
44 short levelOffsetX() const;
45 short levelOffsetY() const;
46 short qWidth() const;
47 short qHeight() const;
48 QString path() const;
49
50 QPixmap selectedTile(int num);
51 QPixmap unselectedTile(int num);
52 QPixmap tileface(int num);
53
54 protected:
55 void updateScaleInfo(short tilew, short tileh);
56 void buildElementIdTable(void);
57 QString pixmapCacheNameFromElementId(const QString & elementid);
58 QPixmap renderElement(short width, short height, const QString & elementid);
59
60
61 private:
62 friend class KMahjonggTilesetPrivate;
63 KMahjonggTilesetPrivate *const d;
64
65 Q_DISABLE_COPY(KMahjonggTileset)
66};
67
68#endif
69