Set up a framework for menu deletion on GTK+.
This commit is contained in:
parent
62f4461c51
commit
9eede9d8ae
|
@ -291,3 +291,8 @@ GtkWidget *makeMenubar(uiWindow *w)
|
||||||
gtk_widget_set_halign(menubar, GTK_ALIGN_FILL);
|
gtk_widget_set_halign(menubar, GTK_ALIGN_FILL);
|
||||||
return menubar;
|
return menubar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void freeMenubar(GtkWidget *mb)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
|
@ -18,3 +18,4 @@ extern char *strdupText(const char *);
|
||||||
|
|
||||||
// menu.c
|
// menu.c
|
||||||
extern GtkWidget *makeMenubar(uiWindow *);
|
extern GtkWidget *makeMenubar(uiWindow *);
|
||||||
|
extern void freeMenubar(GtkWidget *);
|
||||||
|
|
|
@ -12,6 +12,8 @@ struct window {
|
||||||
GtkContainer *vboxContainer;
|
GtkContainer *vboxContainer;
|
||||||
GtkBox *vbox;
|
GtkBox *vbox;
|
||||||
|
|
||||||
|
GtkWidget *menubar;
|
||||||
|
|
||||||
uiContainer *bin;
|
uiContainer *bin;
|
||||||
|
|
||||||
int hidden;
|
int hidden;
|
||||||
|
@ -46,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));
|
||||||
// TODO menus
|
// now destroy the menus
|
||||||
|
freeMenubar(w->menubar);
|
||||||
// now destroy ourselves
|
// now destroy ourselves
|
||||||
// this will also free the vbox
|
// this will also free the vbox
|
||||||
gtk_widget_destroy(w->widget);
|
gtk_widget_destroy(w->widget);
|
||||||
|
@ -182,8 +185,10 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
// set the vbox as the GtkWindow child
|
// set the vbox as the GtkWindow child
|
||||||
gtk_container_add(w->container, w->vboxWidget);
|
gtk_container_add(w->container, w->vboxWidget);
|
||||||
|
|
||||||
if (hasMenubar)
|
if (hasMenubar) {
|
||||||
gtk_container_add(w->vboxContainer, makeMenubar(uiWindow(w)));
|
w->menubar = makeMenubar(uiWindow(w));
|
||||||
|
gtk_container_add(w->vboxContainer, w->menubar);
|
||||||
|
}
|
||||||
|
|
||||||
w->bin = newBin();
|
w->bin = newBin();
|
||||||
binWidget = GTK_WIDGET(uiControlHandle(uiControl(w->bin)));
|
binWidget = GTK_WIDGET(uiControlHandle(uiControl(w->bin)));
|
||||||
|
|
Loading…
Reference in New Issue