Mon, 06 Oct 2025 19:29:41 +0200
add width/height args to the textarea, listview and table (GTK)
| ui/gtk/list.c | file | annotate | diff | comparison | revisions | |
| ui/gtk/text.c | file | annotate | diff | comparison | revisions | |
| ui/ui/tree.h | file | annotate | diff | comparison | revisions |
--- a/ui/gtk/list.c Mon Oct 06 16:50:42 2025 +0200 +++ b/ui/gtk/list.c Mon Oct 06 19:29:41 2025 +0200 @@ -511,6 +511,18 @@ GTK_POLICY_AUTOMATIC); // GTK_POLICY_ALWAYS SCROLLEDWINDOW_SET_CHILD(scroll_area, view); + if(args->width > 0 || args->height > 0) { + int width = args->width; + int height = args->height; + if(width == 0) { + width = -1; + } + if(height == 0) { + height = -1; + } + gtk_widget_set_size_request(scroll_area, width, height); + } + UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end; UiLayout layout = UI_ARGS2LAYOUT(args); ct->add(ct, scroll_area, &layout); @@ -546,6 +558,9 @@ GtkWidget *view = gtk_drop_down_new(G_LIST_MODEL(ls), NULL); gtk_drop_down_set_factory(GTK_DROP_DOWN(view), factory); + if(args->width > 0) { + gtk_widget_set_size_request(view, args->width, -1); + } UiVar* var = uic_widget_var(obj->ctx, obj->ctx, args->list, args->varname, UI_VAR_LIST); @@ -690,6 +705,18 @@ GTK_POLICY_AUTOMATIC); // GTK_POLICY_ALWAYS SCROLLEDWINDOW_SET_CHILD(scroll_area, view); + if(args->width > 0 || args->height > 0) { + int width = args->width; + int height = args->height; + if(width == 0) { + width = -1; + } + if(height == 0) { + height = -1; + } + gtk_widget_set_size_request(scroll_area, width, height); + } + UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end; UiLayout layout = UI_ARGS2LAYOUT(args); ct->add(ct, scroll_area, &layout); @@ -1209,6 +1236,18 @@ GTK_POLICY_AUTOMATIC); // GTK_POLICY_ALWAYS SCROLLEDWINDOW_SET_CHILD(scroll_area, view); + if(args->width > 0 || args->height > 0) { + int width = args->width; + int height = args->height; + if(width == 0) { + width = -1; + } + if(height == 0) { + height = -1; + } + gtk_widget_set_size_request(scroll_area, width, height); + } + UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end; UiLayout layout = UI_ARGS2LAYOUT(args); ct->add(ct, scroll_area, &layout); @@ -1399,6 +1438,18 @@ GTK_POLICY_AUTOMATIC); // GTK_POLICY_ALWAYS SCROLLEDWINDOW_SET_CHILD(scroll_area, view); + if(args->width > 0 || args->height > 0) { + int width = args->width; + int height = args->height; + if(width == 0) { + width = -1; + } + if(height == 0) { + height = -1; + } + gtk_widget_set_size_request(scroll_area, width, height); + } + if(args->contextmenu) { UIMENU menu = ui_contextmenu_create(args->contextmenu, obj, scroll_area); #if GTK_MAJOR_VERSION >= 4 @@ -1457,6 +1508,9 @@ UIWIDGET ui_combobox_create(UiObject *obj, UiListArgs *args) { GtkWidget *combobox = gtk_combo_box_new(); + if(args->width > 0) { + gtk_widget_set_size_request(scroll_area, args->width, -1); + } ui_set_name_and_style(combobox, args->name, args->style_class); ui_set_widget_groups(obj->ctx, combobox, args->groups);
--- a/ui/gtk/text.c Mon Oct 06 16:50:42 2025 +0200 +++ b/ui/gtk/text.c Mon Oct 06 19:29:41 2025 +0200 @@ -144,6 +144,18 @@ GTK_POLICY_AUTOMATIC); // GTK_POLICY_ALWAYS SCROLLEDWINDOW_SET_CHILD(scroll_area, text_area); + if(args->width > 0 || args->height > 0) { + int width = args->width; + int height = args->height; + if(width == 0) { + width = -1; + } + if(height == 0) { + height = -1; + } + gtk_widget_set_size_request(scroll_area, width, height); + } + // font and padding //PangoFontDescription *font; //font = pango_font_description_from_string("Monospace");
--- a/ui/ui/tree.h Mon Oct 06 16:50:42 2025 +0200 +++ b/ui/ui/tree.h Mon Oct 06 19:29:41 2025 +0200 @@ -125,9 +125,11 @@ int margin_bottom; int colspan; int rowspan; + int width; + int height; + const char *name; const char *style_class; - UiList* list; const char* varname; UiModel* model; @@ -203,6 +205,8 @@ int margin_bottom; int colspan; int rowspan; + int width; + int height; const char *name; const char *style_class;