Finished the migration for now. Yeah, this will work...
This commit is contained in:
parent
af8fe560ff
commit
21319201f2
|
@ -1,6 +1,5 @@
|
|||
// 7 april 2015
|
||||
#include "out/ui.h"
|
||||
#include "uipriv.h"
|
||||
#include "uipriv_unix.h"
|
||||
|
||||
struct box {
|
||||
uiBox b;
|
||||
|
|
|
@ -12,9 +12,8 @@ struct tab {
|
|||
};
|
||||
|
||||
struct tabPage {
|
||||
uiControl *holder;
|
||||
GtkWidget *holderWidget;
|
||||
uiControl *c;
|
||||
GtkWidget *widget;
|
||||
int margined;
|
||||
};
|
||||
|
||||
|
@ -39,14 +38,12 @@ static void tabInsertAt(uiTab *tt, const char *name, uintmax_t n, uiControl *chi
|
|||
struct tab *t = (struct tab *) tt;
|
||||
struct tabPage page;
|
||||
|
||||
page.holder = newHolder();
|
||||
page.c = child;
|
||||
holderSetChild(page.holder, page.c);
|
||||
page.holderWidget = GTK_WIDGET(uiControlHandle(page.holder));
|
||||
page.widget = GTK_WIDGET(uiControlHandle(page.c));
|
||||
|
||||
gtk_container_add(t->container, page.holderWidget);
|
||||
gtk_notebook_set_tab_label_text(t->notebook, page.holderWidget, name);
|
||||
gtk_notebook_reorder_child(t->notebook, page.holderWidget, n);
|
||||
uiControlSetParent(page.c, uiControl(t));
|
||||
gtk_notebook_set_tab_label_text(t->notebook, page.widget, name);
|
||||
gtk_notebook_reorder_child(t->notebook, page.widget, n);
|
||||
|
||||
g_array_insert_val(t->pages, n, page);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#define gtkXMargin 12
|
||||
#define gtkYMargin 12
|
||||
#define gtkXPadding 12
|
||||
#define gtkYPadding 6
|
||||
|
||||
// menu.c
|
||||
extern GtkWidget *makeMenubar(uiWindow *);
|
||||
|
|
|
@ -12,9 +12,6 @@ void complain(const char *fmt, ...)
|
|||
g_error("[libui] %s\n", msg);
|
||||
}
|
||||
|
||||
#define gtkXPadding 12
|
||||
#define gtkYPadding 6
|
||||
|
||||
uiSizing *uiUnixNewSizing(void)
|
||||
{
|
||||
uiSizing *d;
|
||||
|
|
|
@ -16,7 +16,6 @@ struct window {
|
|||
|
||||
GtkWidget *menubar;
|
||||
|
||||
uiControl *holder;
|
||||
uiControl *child;
|
||||
|
||||
int (*onClosing)(uiWindow *, void *);
|
||||
|
@ -49,11 +48,9 @@ static void windowCommitDestroy(uiControl *c)
|
|||
|
||||
// first hide ourselves
|
||||
gtk_widget_hide(w->widget);
|
||||
// now destroy the child; removing it from its holder first
|
||||
holderSetChild(w->holder, NULL);
|
||||
// now destroy the child
|
||||
uiControlSetParent(w->child, NULL);
|
||||
uiControlDestroy(w->child);
|
||||
// now destroy the holder
|
||||
uiControlDestroy(w->holder);
|
||||
// now destroy the menus, if any
|
||||
if (w->menubar != NULL)
|
||||
freeMenubar(w->menubar);
|
||||
|
@ -115,10 +112,15 @@ static void windowSetChild(uiWindow *ww, uiControl *child)
|
|||
struct window *w = (struct window *) ww;
|
||||
|
||||
if (w->child != NULL)
|
||||
holderSetChild(w->holder, NULL);
|
||||
uiControlSetParent(w->child, NULL);
|
||||
w->child = child;
|
||||
if (w->child != NULL) {
|
||||
holderSetChild(w->holder, w->child);
|
||||
//TODO uiControlSetParent(w->child, w->child);
|
||||
gtk_widget_set_hexpand(GTK_WIDGET(uiControlHandle(w->child)), TRUE);
|
||||
gtk_widget_set_halign(GTK_WIDGET(uiControlHandle(w->child)), GTK_ALIGN_FILL);
|
||||
gtk_widget_set_vexpand(GTK_WIDGET(uiControlHandle(w->child)), TRUE);
|
||||
gtk_widget_set_valign(GTK_WIDGET(uiControlHandle(w->child)), GTK_ALIGN_FILL);
|
||||
gtk_container_add(w->vboxContainer, GTK_WIDGET(uiControlHandle(w->child)));
|
||||
uiControlQueueResize(w->child);
|
||||
}
|
||||
}
|
||||
|
@ -135,6 +137,7 @@ static void windowSetMargined(uiWindow *ww, int margined)
|
|||
struct window *w = (struct window *) ww;
|
||||
|
||||
w->margined = margined;
|
||||
// TODO
|
||||
uiControlQueueResize(uiControl(w));
|
||||
}
|
||||
|
||||
|
@ -175,14 +178,6 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
|||
gtk_container_add(w->vboxContainer, w->menubar);
|
||||
}
|
||||
|
||||
w->holder = newHolder();
|
||||
holderWidget = GTK_WIDGET(uiControlHandle(uiControl(w->holder)));
|
||||
gtk_widget_set_hexpand(holderWidget, TRUE);
|
||||
gtk_widget_set_halign(holderWidget, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_vexpand(holderWidget, TRUE);
|
||||
gtk_widget_set_valign(holderWidget, GTK_ALIGN_FILL);
|
||||
gtk_container_add(w->vboxContainer, holderWidget);
|
||||
|
||||
// show everything in the vbox, but not the GtkWindow itself
|
||||
gtk_widget_show_all(w->vboxWidget);
|
||||
|
||||
|
|
Loading…
Reference in New Issue