diff options
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; |
