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 LOADER__THEME_H
12 #define LOADER__THEME_H
17 #include "loader/context.h"
18 #include "luaapi/loader.h"
22 typedef std::map
<QRect
, QPixmap
, ::LuaApi::RectLess
> PixmapMap
;
23 typedef boost::variant
<QPixmap
, PixmapMap
> PixmapOrMap
;
26 * @class Theme <loader/theme.h>
27 * @brief A class that represents and caches all images loaded by a theme.
29 * This class will be created once for each lua-scripted theme, and will cache
30 * images loaded from that theme.
32 class Theme
: public QObject
{
38 /** there will be one such class for each size, and i will store pixmaps and glyphs */
41 typedef std::map
<QString
, PixmapOrMap
> PixmapsCache
;
42 typedef std::map
<QString
, Glyph
> GlyphsCache
;
44 PixmapsCache m_pixmaps_cache
;
45 GlyphsCache m_glyphs_cache
;
51 typedef std::map
<int, SizeCache
> Cache
;
54 LuaApi::Loader m_lua_loader
;
57 static PixmapOrMap
to_pixmap_map(const ::LuaApi::ImageOrMap
& m
);
60 void onSettingsChanged();
63 /** Constructor, created the class from a lua theme file */
64 Theme(const QString
& lua_file
);
67 /** References the size \a size, enabling you to get pixmaps of size \a size */
68 void refSize(int size
);
70 /** Unreferences the size */
71 void unrefSize(int size
);
75 T
getValue(const QString
& key
, int size
, const ::LuaApi::LuaValueMap
* args
= NULL
);
78 } //end namespace loader
80 #endif //LOADER__THEME_H