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/newcontrol_windows.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/newcontrol_windows.c')
| -rw-r--r-- | new/newcontrol_windows.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/new/newcontrol_windows.c b/new/newcontrol_windows.c index 56719b3..1ff404b 100644 --- a/new/newcontrol_windows.c +++ b/new/newcontrol_windows.c @@ -32,16 +32,25 @@ static uintptr_t singleHandle(uiControl *c) static void singleSetParent(uiControl *c, uintptr_t parent) { uiSingleHWNDControl *s = S(c); - uintptr_t oldparent; - oldparent = s->parent; s->parent = parent; if (SetParent(s->hwnd, (HWND) (s->parent)) == NULL) - logLastError("error changing control parent in singleSetParent()"); - updateParent(oldparent); + logLastError("error setting control parent in singleSetParent()"); updateParent(s->parent); } +static void singleRemoveParent(uiControl *c) +{ + uiSingleHWNDControl *s = S(c); + uintptr_t oldparent; + + oldparent = s->parent; + s->parent = 0; + if (SetParent(s->hwnd, initialParent) == NULL) + logLastError("error removing control parent in singleSetParent()"); + updateParent(oldparent); +} + static uiSize singlePreferredSize(uiControl *c, uiSizing *d) { uiSize size; @@ -102,6 +111,7 @@ uiControl *uiWindowsNewControl(uiWindowsNewControlParams *p) c->control.destroy = singleDestroy; c->control.handle = singleHandle; c->control.setParent = singleSetParent; + c->control.removeParent = singleRemoveParent; c->control.preferredSize = singlePreferredSize; c->control.resize = singleResize; |
