Started Windows menu destruction code and fixed a bug in GTK+ menu destruction.

This commit is contained in:
Pietro Gagliardi 2015-04-30 16:44:06 -04:00
parent 14de9f3cad
commit b52aa4cfcb
2 changed files with 6 additions and 5 deletions

View File

@ -48,7 +48,8 @@ static void windowDestroy(uiControl *c)
// now destroy the bin // now destroy the bin
// the bin has no parent, so we can just call uiControlDestroy() // the bin has no parent, so we can just call uiControlDestroy()
uiControlDestroy(uiControl(w->bin)); uiControlDestroy(uiControl(w->bin));
// now destroy the menus // now destroy the menus, if any
if (w->menubar != NULL)
freeMenubar(w->menubar); freeMenubar(w->menubar);
// now destroy ourselves // now destroy ourselves
// this will also free the vbox // this will also free the vbox

View File

@ -6,6 +6,7 @@
struct window { struct window {
uiWindow w; uiWindow w;
HWND hwnd; HWND hwnd;
HMENU menubar;
uiContainer *bin; uiContainer *bin;
int hidden; int hidden;
BOOL shownOnce; BOOL shownOnce;
@ -226,7 +227,6 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
RECT adjust; RECT adjust;
WCHAR *wtitle; WCHAR *wtitle;
BOOL hasMenubarBOOL; BOOL hasMenubarBOOL;
HMENU hmenu;
w = uiNew(struct window); w = uiNew(struct window);
@ -260,8 +260,8 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
binSetParent(w->bin, (uintptr_t) (w->hwnd)); binSetParent(w->bin, (uintptr_t) (w->hwnd));
if (hasMenubar) { if (hasMenubar) {
hmenu = makeMenubar(); w->menubar = makeMenubar();
if (SetMenu(w->hwnd, hmenu) == 0) if (SetMenu(w->hwnd, w->menubar) == 0)
logLastError("error giving menu to window in uiNewWindow()"); logLastError("error giving menu to window in uiNewWindow()");
} }