diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-13 13:43:29 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-13 13:43:29 -0400 |
| commit | 0304df4d4e607cc53a8302e2da0a51131cd6bcbd (patch) | |
| tree | cd3ce360e3b0e3df47dfc7cb1c3f283821dbb5c5 /new/stack.c | |
| parent | 963feb6c0668b3c64242607fe71f458420a91f32 (diff) | |
Added uiStackRemove(), the first removal function in package ui! That took long enough... Now I can piece together all the control and parent logic...
Diffstat (limited to 'new/stack.c')
| -rw-r--r-- | new/stack.c | 16 |
1 files changed, 16 insertions, 0 deletions
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); |
