More Windows uiUninit() implementation.

This commit is contained in:
Pietro Gagliardi 2015-05-08 15:01:23 -04:00
parent 04923399fe
commit 3f3191ea7a
4 changed files with 18 additions and 2 deletions

View File

@ -277,6 +277,14 @@ const char *initContainer(HICON hDefaultIcon, HCURSOR hDefaultCursor)
return NULL;
}
void uninitContainer(void)
{
if (DestroyWindow(initialParent) == 0)
logLastError("error destroying initial parent in uninitContainer()");
if (UnregisterClassW(containerClass, hInstance) == 0)
logLastError("error unregistering uiContainer window class in uninitContainer()");
}
// subclasses override this and call back here when all children are destroyed
static void containerDestroy(uiControl *cc)
{

View File

@ -109,9 +109,9 @@ void uiUninit(void)
{
uninitMenus();
// TODO delete hollow brush
// TODO uninit container
uninitContainer();
// TODO delete message font
// TODO uninit window
unregisterWindowClass();
// TODO delete default cursor
// TODO delete default icon
uninitAlloc();

View File

@ -72,10 +72,12 @@ extern const char *initCommonControls(void);
// window.c
extern ATOM registerWindowClass(HICON, HCURSOR);
extern void unregisterWindowClass(void);
// container.c
extern HWND initialParent;
extern const char *initContainer(HICON, HCURSOR);
extern void uninitContainer(void);
// menu.c
extern HMENU makeMenubar(void);

View File

@ -71,6 +71,12 @@ ATOM registerWindowClass(HICON hDefaultIcon, HCURSOR hDefaultCursor)
return RegisterClassW(&wc);
}
void unregisterWindowClass(void)
{
if (UnregisterClassW(windowClass, hInstance) == 0)
logLastError("error unregistering uiWindow window class in unregisterWindowClass()");
}
static int defaultOnClosing(uiWindow *w, void *data)
{
return 0;