2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program 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.
11 #ifndef PIXMAPLOADER_H
12 #define PIXMAPLOADER_H
17 #include "loader/theme.h"
18 #include "themeinfo.h"
21 * @class PixmapLoader <pixmaploader.h>
22 * @brief The simple pixmap loading facility.
24 * This is the utility class used by the interface to load pixmap from resource ids.
25 * It acts simply as a wrapper around PixmapLoader::ThemeLoader, making it possible to
26 * use it in a simple and afficient way.
28 * Note that pixmaps will not be all of the specified size, the size is only the base size.
33 typedef QHash
<ThemeInfo
, ThemeLoader
*> ThemeLoadersCache
;
35 /** static cache of the loaders, there should be only one for each (theme,variant) pair */
36 static ThemeLoadersCache
& loaders();
38 /** the current loader, or NULL */
39 ThemeLoader
*m_loader
;
41 /** the current size */
44 /** the current theme */
47 /** internal, clears references to the currently used loader, if any. */
50 /** internal, gets or creates a loader good for the current
51 (theme,variant) pair and refs the size */
60 void setTheme(const ThemeInfo
& theme
);
62 /** set the base size of the pixmaps. Note that returned pixmaps's size can be different.
63 * For instance, if the size is 100 the "background" generated by the
64 * chess variant will be 200x200 (and it will be tiled on the Board)
68 /** looks up a string id (for instance a predefined id, like "background" or "highlighting") */
69 // QPixmap operator()(const QString& id);
70 QPixmap
getPixmap(const QString
& id
);
72 QPixmap
piecePixmap(const QString
& id
, bool flipped
= false);
74 /** returns a value */
76 T
getValue(const QString
& id
, const ::LuaApi::LuaValueMap
* args
= NULL
, bool allow_nil
= false);
78 /** returns a static value (not depending on the size) */
80 T
getStaticValue(const QString
& id
, const ::LuaApi::LuaValueMap
* args
= NULL
, bool allow_nil
= false);
83 #endif // PIXMAPLOADER_H