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
|
// 7 april 2015
|
||||||
#include "out/ui.h"
|
#include "uipriv_unix.h"
|
||||||
#include "uipriv.h"
|
|
||||||
|
|
||||||
struct box {
|
struct box {
|
||||||
uiBox b;
|
uiBox b;
|
||||||
|
|
|
@ -12,9 +12,8 @@ struct tab {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tabPage {
|
struct tabPage {
|
||||||
uiControl *holder;
|
|
||||||
GtkWidget *holderWidget;
|
|
||||||
uiControl *c;
|
uiControl *c;
|
||||||
|
GtkWidget *widget;
|
||||||
int margined;
|
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 tab *t = (struct tab *) tt;
|
||||||
struct tabPage page;
|
struct tabPage page;
|
||||||
|
|
||||||
page.holder = newHolder();
|
|
||||||
page.c = child;
|
page.c = child;
|
||||||
holderSetChild(page.holder, page.c);
|
page.widget = GTK_WIDGET(uiControlHandle(page.c));
|
||||||
page.holderWidget = GTK_WIDGET(uiControlHandle(page.holder));
|
|
||||||
|
|
||||||
gtk_container_add(t->container, page.holderWidget);
|
uiControlSetParent(page.c, uiControl(t));
|
||||||
gtk_notebook_set_tab_label_text(t->notebook, page.holderWidget, name);
|
gtk_notebook_set_tab_label_text(t->notebook, page.widget, name);
|
||||||
gtk_notebook_reorder_child(t->notebook, page.holderWidget, n);
|
gtk_notebook_reorder_child(t->notebook, page.widget, n);
|
||||||
|
|
||||||
g_array_insert_val(t->pages, n, page);
|
g_array_insert_val(t->pages, n, page);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#define gtkXMargin 12
|
#define gtkXMargin 12
|
||||||
#define gtkYMargin 12
|
#define gtkYMargin 12
|
||||||
|
#define gtkXPadding 12
|
||||||
|
#define gtkYPadding 6
|
||||||
|
|
||||||
// menu.c
|
// menu.c
|
||||||
extern GtkWidget *makeMenubar(uiWindow *);
|
extern GtkWidget *makeMenubar(uiWindow *);
|
||||||
|
|
|
@ -12,9 +12,6 @@ void complain(const char *fmt, ...)
|
||||||
g_error("[libui] %s\n", msg);
|
g_error("[libui] %s\n", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define gtkXPadding 12
|
|
||||||
#define gtkYPadding 6
|
|
||||||
|
|
||||||
uiSizing *uiUnixNewSizing(void)
|
uiSizing *uiUnixNewSizing(void)
|
||||||
{
|
{
|
||||||
uiSizing *d;
|
uiSizing *d;
|
||||||
|
|
|
@ -16,7 +16,6 @@ struct window {
|
||||||
|
|
||||||
GtkWidget *menubar;
|
GtkWidget *menubar;
|
||||||
|
|
||||||
uiControl *holder;
|
|
||||||
uiControl *child;
|
uiControl *child;
|
||||||
|
|
||||||
int (*onClosing)(uiWindow *, void *);
|
int (*onClosing)(uiWindow *, void *);
|
||||||
|
@ -49,11 +48,9 @@ static void windowCommitDestroy(uiControl *c)
|
||||||
|
|
||||||
// first hide ourselves
|
// first hide ourselves
|
||||||
gtk_widget_hide(w->widget);
|
gtk_widget_hide(w->widget);
|
||||||
// now destroy the child; removing it from its holder first
|
// now destroy the child
|
||||||
holderSetChild(w->holder, NULL);
|
uiControlSetParent(w->child, NULL);
|
||||||
uiControlDestroy(w->child);
|
uiControlDestroy(w->child);
|
||||||
// now destroy the holder
|
|
||||||
uiControlDestroy(w->holder);
|
|
||||||
// now destroy the menus, if any
|
// now destroy the menus, if any
|
||||||
if (w->menubar != NULL)
|
if (w->menubar != NULL)
|
||||||
freeMenubar(w->menubar);
|
freeMenubar(w->menubar);
|
||||||
|
@ -115,10 +112,15 @@ static void windowSetChild(uiWindow *ww, uiControl *child)
|
||||||
struct window *w = (struct window *) ww;
|
struct window *w = (struct window *) ww;
|
||||||
|
|
||||||
if (w->child != NULL)
|
if (w->child != NULL)
|
||||||
holderSetChild(w->holder, NULL);
|
uiControlSetParent(w->child, NULL);
|
||||||
w->child = child;
|
w->child = child;
|
||||||
if (w->child != NULL) {
|
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);
|
uiControlQueueResize(w->child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +137,7 @@ static void windowSetMargined(uiWindow *ww, int margined)
|
||||||
struct window *w = (struct window *) ww;
|
struct window *w = (struct window *) ww;
|
||||||
|
|
||||||
w->margined = margined;
|
w->margined = margined;
|
||||||
|
// TODO
|
||||||
uiControlQueueResize(uiControl(w));
|
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);
|
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
|
// 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