Finished uiWindow Unix work.
This commit is contained in:
parent
6a90d8c5c6
commit
3756657921
|
@ -78,6 +78,7 @@ interface Window {
|
||||||
func SetTitle(title *const char);
|
func SetTitle(title *const char);
|
||||||
func Show(void);
|
func Show(void);
|
||||||
func Hide(void);
|
func Hide(void);
|
||||||
|
// TODO really return int?
|
||||||
func OnClosing(f *func(w *Window, data *void) int, data *void);
|
func OnClosing(f *func(w *Window, data *void) int, data *void);
|
||||||
func SetChild(c *Control);
|
func SetChild(c *Control);
|
||||||
func Margined(void) int;
|
func Margined(void) int;
|
||||||
|
|
|
@ -16,6 +16,11 @@ struct window {
|
||||||
|
|
||||||
// the OS container for the uiWindow
|
// the OS container for the uiWindow
|
||||||
uiOSContainer *content;
|
uiOSContainer *content;
|
||||||
|
GtkWidget *contentWidget;
|
||||||
|
|
||||||
|
// events
|
||||||
|
int (*onClosing)(uiWindow *, void *);
|
||||||
|
void *onClosingData;
|
||||||
|
|
||||||
int margined;
|
int margined;
|
||||||
};
|
};
|
||||||
|
@ -43,7 +48,7 @@ static void windowDestroy(uiWindow *ww)
|
||||||
// first, hide the window to avoid flicker
|
// first, hide the window to avoid flicker
|
||||||
gtk_widget_hide(w->widget);
|
gtk_widget_hide(w->widget);
|
||||||
// next, remove the uiOSContainer from the vbox
|
// next, remove the uiOSContainer from the vbox
|
||||||
gtk_container_remove(w->vboxcontainer, GTK_WIDGET(uiOSContainerHandle(w->content)));
|
gtk_container_remove(w->vboxcontainer, GTK_WIDGET(w->contentWidget));
|
||||||
// next, destroy the uiOSContainer, which will destroy its child widget
|
// next, destroy the uiOSContainer, which will destroy its child widget
|
||||||
uiOSContainerDestroy(w->content);
|
uiOSContainerDestroy(w->content);
|
||||||
// TODO menus
|
// TODO menus
|
||||||
|
@ -147,10 +152,11 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubars)
|
||||||
|
|
||||||
// and add the OS container
|
// and add the OS container
|
||||||
w->content = uiNewOSContainer((uintptr_t) (w->vboxcontainer));
|
w->content = uiNewOSContainer((uintptr_t) (w->vboxcontainer));
|
||||||
gtk_widget_set_hexpand(GTK_WIDGET(w->content), TRUE);
|
w->contentWidget = GTK_WIDGET(uiOSContainerHandle(w->content));
|
||||||
gtk_widget_set_halign(GTK_WIDGET(w->content), GTK_ALIGN_FILL);
|
gtk_widget_set_hexpand(w->contentWidget, TRUE);
|
||||||
gtk_widget_set_vexpand(GTK_WIDGET(w->content), TRUE);
|
gtk_widget_set_halign(w->contentWidget, GTK_ALIGN_FILL);
|
||||||
gtk_widget_set_valign(GTK_WIDGET(w->content), GTK_ALIGN_FILL);
|
gtk_widget_set_vexpand(w->contentWidget, TRUE);
|
||||||
|
gtk_widget_set_valign(w->contentWidget, GTK_ALIGN_FILL);
|
||||||
|
|
||||||
// show everything in the vbox, but not the GtkWindow itself
|
// show everything in the vbox, but not the GtkWindow itself
|
||||||
gtk_widget_show_all(w->vboxwidget);
|
gtk_widget_show_all(w->vboxwidget);
|
||||||
|
|
Loading…
Reference in New Issue