# HG changeset patch # User Olaf Wintermann # Date 1731226350 -3600 # Node ID 73c8a3780c7228e91b27705e98a96fe113adf3ab # Parent 4466ebbd9fd56f5cac05886efd05ad64648a4957 toolkit update, small UI adjustments diff -r 4466ebbd9fd5 -r 73c8a3780c72 application/settings.c --- a/application/settings.c Tue Oct 29 20:30:00 2024 +0100 +++ b/application/settings.c Sun Nov 10 09:12:30 2024 +0100 @@ -677,9 +677,7 @@ ui_scrolledwindow(obj, .hexpand = TRUE, .vexpand = TRUE, .subcontainer = UI_CONTAINER_NO_SUB) { ui_grid(obj, .margin = 10, .columnspacing = 10, .rowspacing = 10) { ui_llabel(obj, .label = "Name"); - ui_hbox0(obj) { - ui_textfield(obj, .value = wdata->repo_name, .width = 15); - } + ui_textfield(obj, .value = wdata->repo_name, .width = 15); ui_newline(obj); ui_llabel(obj, .label = "URL"); ui_textfield(obj, .value = wdata->repo_url, .hexpand = TRUE); @@ -689,9 +687,7 @@ ui_newline(obj); ui_hbox(obj, .spacing = 4, .colspan = 2) { ui_combobox(obj, .list = wdata->repo_credentials); - ui_hbox0(obj) { - ui_button(obj, .label = "New Credentials", .onclick = credentials_new); - } + ui_button(obj, .label = "New Credentials", .onclick = credentials_new); } ui_newline(obj); ui_expander(obj, .spacing = 10, .colspan = 2, .label = "Unencrypted User/Password", .margin = 10) { @@ -806,19 +802,13 @@ ui_grid(obj, .columnspacing = 30, .rowspacing = 10) { ui_llabel(obj, .label = "Identifier"); - ui_hbox0(obj) { - ui_textfield(obj, .value = wdata->key_name, .groups = UI_GROUPS(SETTINGS_STATE_KEYS_SELECTED)); - } + ui_textfield(obj, .value = wdata->key_name, .groups = UI_GROUPS(SETTINGS_STATE_KEYS_SELECTED)); ui_newline(obj); ui_llabel(obj, .label = "Type"); - ui_hbox0(obj) { - ui_textfield(obj, .value = wdata->key_type, .groups = UI_GROUPS(SETTINGS_STATE_DISABLED)); - } + ui_textfield(obj, .value = wdata->key_type, .groups = UI_GROUPS(SETTINGS_STATE_DISABLED)); ui_newline(obj); ui_llabel(obj, .label = "File"); - ui_hbox0(obj) { - ui_textfield(obj, .value = wdata->key_file, .groups = UI_GROUPS(SETTINGS_STATE_KEYS_SELECTED)); - } + ui_textfield(obj, .value = wdata->key_file, .groups = UI_GROUPS(SETTINGS_STATE_KEYS_SELECTED)); } } } diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/common/context.c --- a/ui/common/context.c Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/common/context.c Sun Nov 10 09:12:30 2024 +0100 @@ -201,7 +201,7 @@ var->from = NULL; var->from_ctx = ctx; - cxMempoolRegister(ctx->mp, var, (cx_destructor_func)uic_unbind_var); + cxMempoolSetDestructor(var, (cx_destructor_func)uic_unbind_var); if(!ctx->vars_unbound) { ctx->vars_unbound = cxHashMapCreate(ctx->allocator, CX_STORE_POINTERS, 16); diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/gtk/container.c --- a/ui/gtk/container.c Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/gtk/container.c Sun Nov 10 09:12:30 2024 +0100 @@ -180,11 +180,29 @@ int hexpand = FALSE; int vexpand = FALSE; + int hfill = FALSE; + int vfill = FALSE; + if(ct->layout.fill != UI_LAYOUT_UNDEFINED) { + fill = ui_lb2bool(ct->layout.fill); + } if(ct->layout.hexpand != UI_LAYOUT_UNDEFINED) { hexpand = ct->layout.hexpand; + hfill = TRUE; } if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) { vexpand = ct->layout.vexpand; + vfill = TRUE; + } + if(fill) { + hfill = TRUE; + vfill = TRUE; + } + + if(!hfill) { + gtk_widget_set_halign(widget, GTK_ALIGN_START); + } + if(!vfill) { + gtk_widget_set_valign(widget, GTK_ALIGN_START); } gtk_widget_set_hexpand(widget, hexpand); @@ -917,6 +935,16 @@ ct->layout.vexpand = expand; } +void ui_layout_hfill(UiObject *obj, UiBool fill) { + UiContainer *ct = uic_get_current_container(obj); + ct->layout.hfill = fill; +} + +void ui_layout_vfill(UiObject *obj, UiBool fill) { + UiContainer *ct = uic_get_current_container(obj); + ct->layout.vfill = fill; +} + void ui_layout_colspan(UiObject* obj, int cols) { UiContainer* ct = uic_get_current_container(obj); ct->layout.colspan = cols; diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/gtk/container.h --- a/ui/gtk/container.h Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/gtk/container.h Sun Nov 10 09:12:30 2024 +0100 @@ -62,6 +62,8 @@ char *label; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int width; int colspan; int rowspan; diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/ui/button.h --- a/ui/ui/button.h Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/ui/button.h Sun Nov 10 09:12:30 2024 +0100 @@ -39,6 +39,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; @@ -58,6 +60,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/ui/container.h --- a/ui/ui/container.h Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/ui/container.h Sun Nov 10 09:12:30 2024 +0100 @@ -61,6 +61,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; @@ -76,6 +78,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; @@ -96,6 +100,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; @@ -121,6 +127,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; @@ -195,6 +203,8 @@ // grid container layout functions UIEXPORT void ui_layout_hexpand(UiObject *obj, UiBool expand); UIEXPORT void ui_layout_vexpand(UiObject *obj, UiBool expand); +UIEXPORT void ui_layout_hfill(UiObject *obj, UiBool fill); +UIEXPORT void ui_layout_vfill(UiObject *obj, UiBool fill); UIEXPORT void ui_layout_width(UiObject *obj, int width); UIEXPORT void ui_layout_height(UiObject* obj, int width); UIEXPORT void ui_layout_colspan(UiObject *obj, int cols); @@ -214,6 +224,8 @@ if(args.fill != UI_DEFAULT) ui_layout_fill(obj, args.fill == UI_ON ? 1 : 0 ); \ if(args.hexpand) ui_layout_hexpand(obj, 1); \ if(args.vexpand) ui_layout_vexpand(obj, 1); \ + if(args.hfill) ui_layout_hfill(obj, 1); \ + if(args.vfill) ui_layout_vfill(obj, 1); \ if(args.colspan > 0) ui_layout_colspan(obj, args.colspan); \ if(args.rowspan > 0) ui_layout_rowspan(obj, args.rowspan); \ /*force caller to add ';'*/(void)0 diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/ui/display.h --- a/ui/ui/display.h Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/ui/display.h Sun Nov 10 09:12:30 2024 +0100 @@ -61,6 +61,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; @@ -75,6 +77,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; int width; @@ -89,6 +93,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/ui/entry.h --- a/ui/ui/entry.h Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/ui/entry.h Sun Nov 10 09:12:30 2024 +0100 @@ -40,6 +40,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/ui/image.h --- a/ui/ui/image.h Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/ui/image.h Sun Nov 10 09:12:30 2024 +0100 @@ -41,6 +41,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/ui/text.h --- a/ui/ui/text.h Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/ui/text.h Sun Nov 10 09:12:30 2024 +0100 @@ -39,6 +39,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; int width; @@ -57,6 +59,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; int width; @@ -86,6 +90,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/ui/tree.h --- a/ui/ui/tree.h Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/ui/tree.h Sun Nov 10 09:12:30 2024 +0100 @@ -103,6 +103,8 @@ UiTri fill; UiBool hexpand; UiBool vexpand; + UiBool hfill; + UiBool vfill; int colspan; int rowspan; const char *name; diff -r 4466ebbd9fd5 -r 73c8a3780c72 ui/winui/container.cpp --- a/ui/winui/container.cpp Tue Oct 29 20:30:00 2024 +0100 +++ b/ui/winui/container.cpp Sun Nov 10 09:12:30 2024 +0100 @@ -678,6 +678,16 @@ ct->layout.vexpand = expand; } +void ui_layout_hfill(UiObject *obj, UiBool fill) { + UiContainer *ct = uic_get_current_container(obj); + ct->layout.hfill = fill; +} + +void ui_layout_vfill(UiObject *obj, UiBool fill) { + UiContainer *ct = uic_get_current_container(obj); + ct->layout.vfill = fill; +} + void ui_layout_width(UiObject* obj, int width) { UiContainer* ct = uic_get_current_container(obj); ct->layout.width = width;