diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-09 16:21:09 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-09 16:21:09 -0400 |
| commit | 92b43720b6b33e838f8e9b5dffaa556529de3d52 (patch) | |
| tree | 5bbfb07548bab0cdbecb2b38a479321e6730d6b4 /new/stack.c | |
| parent | 3f05be544ce9e57e8b00dfe99a64f223c6c2539b (diff) | |
Decided to split control removal from parent into its own method removeParent() rather than automatically doing it in setParent().
Diffstat (limited to 'new/stack.c')
| -rw-r--r-- | new/stack.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/new/stack.c b/new/stack.c index eaa7a7e..80c2d75 100644 --- a/new/stack.c +++ b/new/stack.c @@ -41,16 +41,26 @@ static void stackSetParent(uiControl *c, uintptr_t parent) { stack *s = S(c); uintmax_t i; - uintptr_t oldparent; - oldparent = s->parent; s->parent = parent; for (i = 0; i < S(c)->len; i++) (*(s->controls[i]->setParent))(s->controls[i], s->parent); - updateParent(oldparent); updateParent(s->parent); } +static void stackRemoveParent(uiControl *c) +{ + stack *s = S(c); + uintmax_t i; + uintptr_t oldparent; + + oldparent = s->parent; + s->parent = 0; + for (i = 0; i < S(c)->len; i++) + (*(s->controls[i]->removeParent))(s->controls[i]); + updateParent(oldparent); +} + static uiSize stackPreferredSize(uiControl *c, uiSizing *d) { stack *s = S(c); @@ -197,6 +207,7 @@ uiControl *uiNewHorizontalStack(void) s->control.destroy = stackDestroy; s->control.handle = stackHandle; s->control.setParent = stackSetParent; + s->control.removeParent = stackRemoveParent; s->control.preferredSize = stackPreferredSize; s->control.resize = stackResize; |
