summaryrefslogtreecommitdiffstats
path: root/gui/button.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@yahoo.com>2013-02-15 16:39:07 +0100
committerDees_Troy <dees_troy@yahoo.com>2013-02-15 16:42:35 +0100
commit1a7a6675ea69e8b8cb9f2a47eb8f8be4678816ab (patch)
tree18ce7eaa65e788c70be4e97a1c05260085aba956 /gui/button.cpp
parentChange popen in twrpTar to __popen (diff)
downloadandroid_bootable_recovery-1a7a6675ea69e8b8cb9f2a47eb8f8be4678816ab.tar
android_bootable_recovery-1a7a6675ea69e8b8cb9f2a47eb8f8be4678816ab.tar.gz
android_bootable_recovery-1a7a6675ea69e8b8cb9f2a47eb8f8be4678816ab.tar.bz2
android_bootable_recovery-1a7a6675ea69e8b8cb9f2a47eb8f8be4678816ab.tar.lz
android_bootable_recovery-1a7a6675ea69e8b8cb9f2a47eb8f8be4678816ab.tar.xz
android_bootable_recovery-1a7a6675ea69e8b8cb9f2a47eb8f8be4678816ab.tar.zst
android_bootable_recovery-1a7a6675ea69e8b8cb9f2a47eb8f8be4678816ab.zip
Diffstat (limited to '')
-rw-r--r--gui/button.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/gui/button.cpp b/gui/button.cpp
index b9d1b52dc..a4c5ecb7c 100644
--- a/gui/button.cpp
+++ b/gui/button.cpp
@@ -37,6 +37,8 @@ GUIButton::GUIButton(xml_node<>* node)
mButtonLabel = NULL;
mAction = NULL;
mRendered = false;
+ hasHighlightColor = false;
+ renderHighlight = false;
if (!node) return;
@@ -66,6 +68,17 @@ GUIButton::GUIButton(xml_node<>* node)
mButtonIcon = PageManager::FindResource(attr->value());
}
+ memset(&mHighlightColor, 0, sizeof(COLOR));
+ child = node->first_node("highlight");
+ if (child) {
+ attr = child->first_attribute("color");
+ if (attr) {
+ hasHighlightColor = true;
+ std::string color = attr->value();
+ ConvertStrToColor(color, &mHighlightColor);
+ }
+ }
+
int x, y, w, h;
if (mButtonImg) mButtonImg->GetRenderPos(x, y, w, h);
SetRenderPos(x, y, w, h);
@@ -96,6 +109,10 @@ int GUIButton::Render(void)
gr_blit(mButtonIcon->GetResource(), 0, 0, mIconW, mIconH, mIconX, mIconY);
if (mButtonLabel) ret = mButtonLabel->Render();
if (ret < 0) return ret;
+ if (renderHighlight && hasHighlightColor) {
+ gr_color(mHighlightColor.red, mHighlightColor.green, mHighlightColor.blue, mHighlightColor.alpha);
+ gr_fill(mRenderX, mRenderY, mRenderW, mRenderH);
+ }
mRendered = true;
return ret;
}
@@ -198,6 +215,7 @@ int GUIButton::NotifyTouch(TOUCH_STATE state, int x, int y)
mButtonLabel->isHighlighted = false;
if (mButtonImg != NULL)
mButtonImg->isHighlighted = false;
+ renderHighlight = false;
mRendered = false;
}
} else {
@@ -207,6 +225,7 @@ int GUIButton::NotifyTouch(TOUCH_STATE state, int x, int y)
mButtonLabel->isHighlighted = true;
if (mButtonImg != NULL)
mButtonImg->isHighlighted = true;
+ renderHighlight = true;
mRendered = false;
}
}