summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/theme.cpp24
-rw-r--r--src/gui/theme.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 4d22612fb..77fe24d51 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -895,3 +895,27 @@ Image *Theme::getImageFromThemeXml(const std::string &name)
}
return nullptr;
}
+
+ImageSet *Theme::getImageSetFromThemeXml(const std::string &name,
+ int w, int h)
+{
+ Theme *theme = Theme::instance();
+ Skin *skin = theme->load(name);
+ if (skin)
+ {
+ const ImageRect &rect = skin->getBorder();
+ if (rect.grid[0])
+ {
+ Image *image = rect.grid[0];
+
+ ResourceManager *resman = ResourceManager::getInstance();
+ ImageSet *imageSet = resman->getSubImageSet(image, w, h);
+
+// image->incRef();
+ theme->unload(skin);
+ return imageSet;
+ }
+ theme->unload(skin);
+ }
+ return nullptr;
+}
diff --git a/src/gui/theme.h b/src/gui/theme.h
index e2be8a232..56c0c57c7 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -148,6 +148,8 @@ class Theme : public Palette, public ConfigListener
static ImageSet *getImageSetFromTheme(const std::string &path,
int w, int h);
+ ImageSet *getImageSetFromThemeXml(const std::string &name,
+ int w, int h);
enum ThemePalette
{
TEXT = 0,