[aseprite] 83/308: Allow "icon" parameter for <button> widgets to create an IconButtons
Tobias Hansen
thansen at moszumanska.debian.org
Tue Mar 8 02:44:55 UTC 2016
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 5cb4e2829338e53578b7f5f5bfadb5da2dfd3f0b
Author: David Capello <davidcapello at gmail.com>
Date: Thu Dec 10 16:52:43 2015 -0300
Allow "icon" parameter for <button> widgets to create an IconButtons
---
src/app/widget_loader.cpp | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/app/widget_loader.cpp b/src/app/widget_loader.cpp
index d2ecc68..9db8c9a 100644
--- a/src/app/widget_loader.cpp
+++ b/src/app/widget_loader.cpp
@@ -17,6 +17,7 @@
#include "app/ui/button_set.h"
#include "app/ui/color_button.h"
#include "app/ui/drop_down_button.h"
+#include "app/ui/icon_button.h"
#include "app/ui/search_entry.h"
#include "app/ui/skin/skin_style_property.h"
#include "app/ui/skin/skin_theme.h"
@@ -151,8 +152,21 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
widget = new BoxFiller();
}
else if (elem_name == "button") {
- if (!widget)
- widget = new Button("");
+ const char* icon_name = elem->Attribute("icon");
+
+ if (!widget) {
+ if (icon_name) {
+ SkinPartPtr part = SkinTheme::instance()->getPartById(icon_name);
+ if (!part)
+ throw base::Exception("<button> element found with invalid 'icon' attribute '%s'",
+ icon_name);
+
+ widget = new IconButton(part->bitmap(0));
+ }
+ else {
+ widget = new Button("");
+ }
+ }
bool left = bool_attr_is_true(elem, "left");
bool right = bool_attr_is_true(elem, "right");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list