2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
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
16 #include "loader/theme.h"
19 * @class PixmapLoader <pixmaploader.h>
20 * @brief The simple pixmap loading facility.
22 * This is the utility class used by the interface to load pixmap from resource ids.
23 * It acts simply as a wrapper around PixmapLoader::ThemeLoader, making it possible to
24 * use it in a simple and afficient way.
26 * Note that pixmaps will not be all of the specified size, the size is only the base size.
31 typedef std::map
<QString
, ThemeLoader
*> ThemeLoadersCache
;
33 /** static cache of the loaders, there should be only one for each (theme,variant) pair */
34 static ThemeLoadersCache s_loaders
;
36 /** the current loader, or NULL */
37 ThemeLoader
*m_loader
;
39 /** the current size */
42 /** the current theme */
45 /** internal, clears references to the currently used loader, if any. */
48 /** internal, gets or creates a loader good for the current
49 (theme,variant) pair and refs the size */
57 /** set the theme path */
58 void setBasePath(const QString
& base
);
60 /** set the base size of the pixmaps. Note that returned pixmaps's size can be different.
61 * For instance, if the size is 100 the "background" generated by the
62 * chess variant will be 200x200 (and it will be tiled on the Board)
66 /** looks up a string id (for instance a predefined id, like "background" or "highlighting") */
67 QPixmap
operator()(const QString
& id
) {
68 return getValue
<QPixmap
>(id
);
71 /** returns a value */
73 T
getValue(const QString
& id
, const ::LuaApi::LuaValueMap
* args
= NULL
);
75 /** returns a static value (not depending on the size) */
77 T
getStaticValue(const QString
& id
, const ::LuaApi::LuaValueMap
* args
= NULL
);
80 #endif // PIXMAPLOADER_H