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"
19 #include "themeinfo.h"
23 typedef std::map
<QRect
, QPixmap
, ::LuaApi::RectLess
> PixmapMap
;
24 typedef boost::variant
<QPixmap
, PixmapMap
> PixmapOrMap
;
27 * @class Theme <loader/theme.h>
28 * @brief A class that represents and caches all images loaded by a theme.
30 * This class will be created once for each lua-scripted theme, and will cache
31 * images loaded from that theme.
33 class Theme
: public QObject
{
39 /** there will be one such class for each size, and i will store pixmaps and glyphs */
42 typedef std::map
<QString
, PixmapOrMap
> PixmapsCache
;
43 typedef std::map
<QString
, Glyph
> GlyphsCache
;
45 PixmapsCache m_pixmaps_cache
;
46 GlyphsCache m_glyphs_cache
;
52 typedef std::map
<int, SizeCache
> Cache
;
55 LuaApi::Loader m_lua_loader
;
58 static PixmapOrMap
to_pixmap_map(const ::LuaApi::ImageOrMap
& m
);
61 void onSettingsChanged();
64 /** Constructor, created the class from a lua theme file */
65 Theme(const ThemeInfo
& theme
);
68 /** References the size \a size, enabling you to get pixmaps of size \a size */
69 void refSize(int size
);
71 /** Unreferences the size */
72 void unrefSize(int size
);
76 T
getValue(const QString
& key
, int size
, const ::LuaApi::LuaValueMap
* args
= NULL
);
79 } //end namespace loader
81 #endif //LOADER__THEME_H