aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin/gwin.c
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2014-01-04 15:51:18 +0100
committerJoel Bodenmann <joel@unormal.org>2014-01-04 15:51:18 +0100
commitbad22f5feea49a7417237aa70e2f6b9e349d91c2 (patch)
tree81bb7485d055fed8ef0ce4b5908e31b550a37f6e /src/gwin/gwin.c
parent12a7d7957b0d264ab44f2f17075a9cc3a524da43 (diff)
downloaduGFX-bad22f5feea49a7417237aa70e2f6b9e349d91c2.tar.gz
uGFX-bad22f5feea49a7417237aa70e2f6b9e349d91c2.tar.bz2
uGFX-bad22f5feea49a7417237aa70e2f6b9e349d91c2.zip
working gwinGetVisible() and gwinGetEnabled()
Diffstat (limited to 'src/gwin/gwin.c')
-rw-r--r--src/gwin/gwin.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c
index 057fd6e0..6d47f3b5 100644
--- a/src/gwin/gwin.c
+++ b/src/gwin/gwin.c
@@ -219,7 +219,18 @@ void gwinSetVisible(GHandle gh, bool_t visible) {
}
bool_t gwinGetVisible(GHandle gh) {
- return (gh->flags & GWIN_FLG_VISIBLE) ? TRUE : FALSE;
+ #if GWIN_NEED_HIERARCHY
+ // return TRUE if all widgets (itself + parents) are visble, false otherwise
+ GHandle e = gh;
+ while (e) {
+ if (!(e->flags & GWIN_FLG_VISIBLE))
+ return FALSE;
+ e = e->parent;
+ };
+ return TRUE;
+ #else
+ return (gh->flags & GWIN_FLG_VISIBLE) ? TRUE : FALSE;
+ #endif
}
void gwinSetEnabled(GHandle gh, bool_t enabled) {
@@ -238,13 +249,14 @@ void gwinSetEnabled(GHandle gh, bool_t enabled) {
bool_t gwinGetEnabled(GHandle gh) {
#if GWIN_NEED_HIERARCHY
+ // return TRUE if all widgets (itself + parents) are enabled, false otherwise
GHandle e = gh;
while (e) {
- if ( e->flags & GWIN_FLG_ENABLED);
- return TRUE;
+ if (!(e->flags & GWIN_FLG_ENABLED))
+ return FALSE;
e = e->parent;
};
- return FALSE;
+ return TRUE;
#else
return (gh->flags & GWIN_FLG_ENABLED) ? TRUE : FALSE;
#endif