From abe6a47c1f59941faac719770aa654d2c79cacef Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Sat, 4 Jan 2014 04:41:32 +0100 Subject: basic implementation of parent/child (no flag handling done yet) --- src/gwin/gwin.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src') diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 6b9cb81e..3a4ae5b5 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -167,7 +167,15 @@ color_t gwinGetDefaultBgColor(void) { GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit) { if (!(pgw = _gwindowCreate(g, pgw, pInit, &basegwinVMT, 0))) return 0; + + #if GWIN_NEED_HIERARCHY + pgw->parent = NULL; + pgw->sibling = NULL; + pgw->child = NULL; + #endif + gwinSetVisible(pgw, pInit->show); + return pgw; } @@ -250,6 +258,27 @@ void gwinRedraw(GHandle gh) { } #endif +#if GWIN_NEED_HIERARCHY + void gwinAddChild(GHandle parent, GHandle child, bool_t last) + { + child->parent = parent; + child->sibling = NULL; + child->child = NULL; + + if(!parent) + return; + + if(last && parent->child) { + GHandle s = parent->child; + while(s->sibling) s = s->sibling; + s->sibling = child; + } else { + child->sibling = parent->child; + parent->child = child; + } + } +#endif + void gwinClear(GHandle gh) { /* * Don't render anything when the window is not visible but -- cgit v1.2.3