diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-08 00:43:35 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-08 00:43:35 -0400 |
| commit | 54e947eed3d75d0fbae533e7e4cce8fe84aaf77c (patch) | |
| tree | d510e639dfdb00f7ae8d8ce9de90a9e54001f901 /new/newcontrol_windows.c | |
| parent | 521829a0a66f62e9ed4256440a1ed34565e4d51f (diff) | |
Started work on ensuring things get cleaned up. Added a destroy() method to uiControl and implemented most of the work for Windows.
Diffstat (limited to 'new/newcontrol_windows.c')
| -rw-r--r-- | new/newcontrol_windows.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/new/newcontrol_windows.c b/new/newcontrol_windows.c index 1ea9947..eff4c9a 100644 --- a/new/newcontrol_windows.c +++ b/new/newcontrol_windows.c @@ -15,6 +15,13 @@ struct uiSingleHWNDControl { #define S(c) ((uiSingleHWNDControl *) (c)) +static void singleDestroy(uiControl *c) +{ + if (DestroyWindow(S(c)->hwnd) == 0) + logLastError("error destroying control in singleDestroy()"); + // the uiSingleHWNDControl is destroyed in the subclass procedure +} + static uintptr_t singleHandle(uiControl *c) { return (uintptr_t) (S(c)->hwnd); @@ -57,6 +64,8 @@ static LRESULT CALLBACK singleSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, return lResult; break; case WM_NCDESTROY: + // TODO call an onDestroy handler + uiFree(c); if ((*fv_RemoveWindowSubclass)(hwnd, singleSubclassProc, uIdSubclass) == FALSE) logLastError("error removing Windows control subclass in singleSubclassProc()"); break; @@ -79,6 +88,7 @@ uiControl *uiWindowsNewControl(uiWindowsNewControlParams *p) if (c->hwnd == NULL) logLastError("error creating control in uiWindowsNewControl()"); + c->control.destroy = singleDestroy; c->control.handle = singleHandle; c->control.setParent = singleSetParent; c->control.preferredSize = singlePreferredSize; |
