summaryrefslogtreecommitdiffstats
path: root/gui/button.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2012-10-19 19:13:15 +0200
committerDees_Troy <dees_troy@teamw.in>2012-10-19 19:13:15 +0200
commit4d12f969b8fa40497b60a6e15873b1b3af924dda (patch)
tree103d138e3d4a1a6e23dd7f44a28bb8efdef73bb4 /gui/button.cpp
parentInitial BML support (ext4 only) (diff)
downloadandroid_bootable_recovery-4d12f969b8fa40497b60a6e15873b1b3af924dda.tar
android_bootable_recovery-4d12f969b8fa40497b60a6e15873b1b3af924dda.tar.gz
android_bootable_recovery-4d12f969b8fa40497b60a6e15873b1b3af924dda.tar.bz2
android_bootable_recovery-4d12f969b8fa40497b60a6e15873b1b3af924dda.tar.lz
android_bootable_recovery-4d12f969b8fa40497b60a6e15873b1b3af924dda.tar.xz
android_bootable_recovery-4d12f969b8fa40497b60a6e15873b1b3af924dda.tar.zst
android_bootable_recovery-4d12f969b8fa40497b60a6e15873b1b3af924dda.zip
Diffstat (limited to 'gui/button.cpp')
-rw-r--r--gui/button.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/gui/button.cpp b/gui/button.cpp
index 72e2fe905..b9d1b52dc 100644
--- a/gui/button.cpp
+++ b/gui/button.cpp
@@ -107,7 +107,7 @@ int GUIButton::Update(void)
int ret = 0, ret2 = 0;
- if (mButtonImg) ret = mButtonImg->Update();
+ if (mButtonImg) ret = mButtonImg->Update();
if (ret < 0) return ret;
if (ret == 0)
@@ -188,7 +188,30 @@ int GUIButton::SetRenderPos(int x, int y, int w, int h)
int GUIButton::NotifyTouch(TOUCH_STATE state, int x, int y)
{
- if (!isConditionTrue()) return -1;
+ static int last_state = 0;
+
+ if (!isConditionTrue()) return -1;
+ if (x < mRenderX || x - mRenderX > mRenderW || y < mRenderY || y - mRenderY > mRenderH || state == TOUCH_RELEASE) {
+ if (last_state == 1) {
+ last_state = 0;
+ if (mButtonLabel != NULL)
+ mButtonLabel->isHighlighted = false;
+ if (mButtonImg != NULL)
+ mButtonImg->isHighlighted = false;
+ mRendered = false;
+ }
+ } else {
+ if (last_state == 0) {
+ last_state = 1;
+ if (mButtonLabel != NULL)
+ mButtonLabel->isHighlighted = true;
+ if (mButtonImg != NULL)
+ mButtonImg->isHighlighted = true;
+ mRendered = false;
+ }
+ }
+ if (x < mRenderX || x - mRenderX > mRenderW || y < mRenderY || y - mRenderY > mRenderH)
+ return 0;
return (mAction ? mAction->NotifyTouch(state, x, y) : 1);
}