diff --git a/redo/GNUmakefile b/redo/GNUmakefile index 98a86c82..e4fe963b 100644 --- a/redo/GNUmakefile +++ b/redo/GNUmakefile @@ -26,7 +26,6 @@ baseHFILES = \ $(osHFILES) baseCFILES = \ - box.c \ control.c \ menu.c \ ptrarray.c \ diff --git a/redo/unix/GNUmakeinc.mk b/redo/unix/GNUmakeinc.mk index 57f6ca62..48cb6429 100644 --- a/redo/unix/GNUmakeinc.mk +++ b/redo/unix/GNUmakeinc.mk @@ -3,6 +3,7 @@ osCFILES = \ unix/alloc.c \ unix/bin.c \ + unix/box.c \ unix/button.c \ unix/checkbox.c \ unix/combobox.c \ diff --git a/redo/unix/box.c b/redo/unix/box.c index 905e6659..876d88b0 100644 --- a/redo/unix/box.c +++ b/redo/unix/box.c @@ -1,6 +1,7 @@ // 7 april 2015 -#include "out/ui.h" -#include "uipriv.h" +#include "uipriv_unix.h" + +// TODO clean this up struct box { uiBox b; @@ -64,14 +65,28 @@ static void boxAppend(uiBox *ss, uiControl *c, int stretchy) { struct box *b = (struct box *) ss; struct boxControl *bc; - uintmax_t i; + GtkWidget *widget; bc = uiNew(struct boxControl); bc->c = c; bc->stretchy = stretchy; uiControlSetParent(bc->c, uiControl(b)); - if (bc->stretchy) - gtk_size_group_add_widget(b->stretchygroup, GTK_WIDGET(uiControlHandle(bc->c))); + widget = GTK_WIDGET(uiControlHandle(bc->c)); + if (bc->stretchy) { + if (b->vertical) { + gtk_widget_set_vexpand(widget, TRUE); + gtk_widget_set_valign(widget, GTK_ALIGN_FILL); + } else { + gtk_widget_set_hexpand(widget, TRUE); + gtk_widget_set_halign(widget, GTK_ALIGN_FILL); + } + gtk_size_group_add_widget(b->stretchygroup, widget); + } else // TODO undo this all in delete + if (b->vertical) + gtk_widget_set_vexpand(widget, FALSE); + else + gtk_widget_set_hexpand(widget, FALSE); + // TODO make the other dimension fill ptrArrayAppend(b->controls, bc); uiControlQueueResize(uiControl(b)); } @@ -112,7 +127,7 @@ static void boxSetPadded(uiBox *ss, int padded) uiControlQueueResize(uiControl(b)); } -static uiBox *finishNewBox(GtkOrientationType orientation) +static uiBox *finishNewBox(GtkOrientation orientation) { struct box *b; @@ -131,11 +146,9 @@ static uiBox *finishNewBox(GtkOrientationType orientation) b->controls = newPtrArray(); + uiUnixMakeSingleWidgetControl(uiControl(b), b->widget); + uiControl(b)->Handle = boxHandle; - uiControl(b)->PreferredSize = boxPreferredSize; - b->baseResize = uiControl(b)->Resize; - uiControl(b)->Resize = boxResize; - uiControl(b)->HasTabStops = boxHasTabStops; b->baseCommitDestroy = uiControl(b)->CommitDestroy; uiControl(b)->CommitDestroy = boxCommitDestroy; uiControl(b)->ContainerUpdateState = boxContainerUpdateState; diff --git a/redo/unix/window.c b/redo/unix/window.c index 51845ca2..1eed1f4d 100644 --- a/redo/unix/window.c +++ b/redo/unix/window.c @@ -144,8 +144,6 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar) { struct window *w; - finalizeMenus(); - w = (struct window *) uiNewControl(uiTypeWindow()); w->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);