From 0304df4d4e607cc53a8302e2da0a51131cd6bcbd Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 13 Apr 2015 13:43:29 -0400 Subject: Added uiStackRemove(), the first removal function in package ui! That took long enough... Now I can piece together all the control and parent logic... --- new/stack.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'new/stack.c') diff --git a/new/stack.c b/new/stack.c index 1a08ee0..41a67d6 100644 --- a/new/stack.c +++ b/new/stack.c @@ -367,6 +367,22 @@ void uiStackAdd(uiControl *st, uiControl *c, int stretchy) uiParentUpdate(s->parent); } +void uiStackRemove(uiControl *st, uintptr_t index) +{ + stack *s = (stack *) (st->data); + uiControl *removed; + uintmax_t nAfter; + + removed = s->controls[index].c; + nAfter = s->len - index - 1; + memmove(&(s->controls[index + 1]), &(s->controls[index]), nAfter * sizeof (stackControl)); + s->len--; + if (s->parent != NULL) { + uiControlRemoveParent(removed); + uiParentUpdate(s->parent); + } +} + int uiStackPadded(uiControl *c) { stack *s = (stack *) (c->data); -- cgit v1.2.3