ui_table(obj, .model = model, .varname = "notes");
// splitpane right: content
- ui_grid(obj, .columnspacing = 10, .rowspacing = 10) {
+ ui_grid(obj, .columnspacing = 10, .rowspacing = 10, .def_vfill = TRUE) {
ui_label(obj, .label = "Title", .vfill = TRUE);
ui_textfield(obj, .varname = "note_title", .hexpand = TRUE, .groups = UI_GROUPS(APP_STATE_NOTE_SELECTED));
ui_newline(obj);
case UI_CONTAINER_GRID: {
sub = ui_create_grid_widget(columnspacing, rowspacing);
add = ui_box_set_margin(sub, margin);
- newobj->container = ui_grid_container(newobj, sub);
+ newobj->container = ui_grid_container(newobj, sub, FALSE, FALSE, FALSE, FALSE);
newobj->widget = sub;
break;
}
ct->current = widget;
}
-UiContainer* ui_grid_container(UiObject *obj, GtkWidget *grid) {
+UiContainer* ui_grid_container(
+ UiObject *obj,
+ GtkWidget *grid,
+ UiBool def_hexpand,
+ UiBool def_vexpand,
+ UiBool def_hfill,
+ UiBool def_vfill)
+{
UiGridContainer *ct = cxCalloc(
obj->ctx->allocator,
1,
sizeof(UiGridContainer));
+ ct->def_hexpand = def_hexpand;
+ ct->def_vexpand = def_vexpand;
+ ct->def_hfill = def_hfill;
+ ct->def_vfill = def_vfill;
ct->container.widget = grid;
ct->container.add = ui_grid_container_add;
UI_GTK_V2(ct->width = 0);
int vexpand = FALSE;
int hfill = FALSE;
int vfill = FALSE;
+ if(!ct->layout.override_defaults) {
+ if(grid->def_hexpand) {
+ hexpand = TRUE;
+ hfill = TRUE;
+ } else if(grid->def_hfill) {
+ hfill = TRUE;
+ }
+ if(grid->def_vexpand) {
+ vexpand = TRUE;
+ vfill = TRUE;
+ } else if(grid->def_vfill) {
+ vfill = TRUE;
+ }
+ }
+
if(ct->layout.fill != UI_LAYOUT_UNDEFINED) {
fill = ui_lb2bool(ct->layout.fill);
}
- if(ct->layout.hexpand != UI_LAYOUT_UNDEFINED) {
- hexpand = ct->layout.hexpand;
+ if(ct->layout.hexpand) {
+ hexpand = TRUE;
+ hfill = TRUE;
+ } else if(ct->layout.hfill) {
hfill = TRUE;
}
- if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) {
- vexpand = ct->layout.vexpand;
+ if(ct->layout.vexpand) {
+ vexpand = TRUE;
+ vfill = TRUE;
+ } else if(ct->layout.vfill) {
vfill = TRUE;
}
if(fill) {
int hexpand = FALSE;
int vexpand = FALSE;
- if(ct->layout.hexpand != UI_LAYOUT_UNDEFINED) {
- hexpand = ct->layout.hexpand;
+ int hfill = FALSE;
+ int vfill = FALSE;
+ if(!ct->layout.override_defaults) {
+ if(grid->def_hexpand) {
+ hexpand = TRUE;
+ hfill = TRUE;
+ } else if(grid->def_hfill) {
+ hfill = TRUE;
+ }
+ if(grid->def_vexpand) {
+ vexpand = TRUE;
+ vfill = TRUE;
+ } else if(grid->def_vfill) {
+ vfill = TRUE;
+ }
+ }
+
+ if(ct->layout.fill != UI_LAYOUT_UNDEFINED) {
+ fill = ui_lb2bool(ct->layout.fill);
+ }
+ if(ct->layout.hexpand) {
+ hexpand = TRUE;
+ hfill = TRUE;
+ } else if(ct->layout.hfill) {
+ hfill = TRUE;
+ }
+ if(ct->layout.vexpand) {
+ vexpand = TRUE;
+ vfill = TRUE;
+ } else if(ct->layout.vfill) {
+ vfill = TRUE;
+ }
+ if(fill) {
+ hfill = TRUE;
+ vfill = TRUE;
+ }
+
+ GtkAttachOptions xoptions = 0;
+ GtkAttachOptions yoptions = 0;
+ if(hexpand) {
+ xoptions = GTK_EXPAND;
+ }
+ if(hfill) {
+ xoptions |= GTK_FILL;
}
- if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) {
- vexpand = ct->layout.vexpand;
+ if(vexpand) {
+ yoptions = GTK_EXPAND;
+ }
+ if(vfill) {
+ yoptions |= GTK_FILL;
}
- GtkAttachOptions xoptions = hexpand ? GTK_FILL | GTK_EXPAND : GTK_FILL;
- GtkAttachOptions yoptions = vexpand ? GTK_FILL | GTK_EXPAND : GTK_FILL;
int colspan = ct->layout.colspan > 0 ? ct->layout.colspan : 1;
int rowspan = ct->layout.rowspan > 0 ? ct->layout.rowspan : 1;
current->container->add(current->container, widget, TRUE);
UiObject *newobj = uic_object_new(obj, grid);
- newobj->container = ui_grid_container(obj, grid);
+ newobj->container = ui_grid_container(obj, grid, args.def_hexpand, args.def_vexpand, args.def_hfill, args.def_vfill);
uic_obj_add(obj, newobj);
return widget;
}
case UI_CONTAINER_GRID: {
sub = ui_create_grid_widget(data->columnspacing, data->rowspacing);
- newobj->container = ui_grid_container(newobj, sub);
+ newobj->container = ui_grid_container(newobj, sub, FALSE, FALSE, FALSE, FALSE);
break;
}
}
ct->layout.vfill = fill;
}
+UIEXPORT void ui_layout_override_defaults(UiObject *obj, UiBool d) {
+ UiContainer *ct = uic_get_current_container(obj);
+ ct->layout.override_defaults = d;
+}
+
void ui_layout_colspan(UiObject* obj, int cols) {
UiContainer* ct = uic_get_current_container(obj);
ct->layout.colspan = cols;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int width;
int colspan;
int rowspan;
typedef struct UiGridContainer {
UiContainer container;
+ UiBool def_hexpand;
+ UiBool def_vexpand;
+ UiBool def_hfill;
+ UiBool def_vfill;
int x;
int y;
#ifdef UI_GTK2
void ui_box_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill);
GtkWidget* ui_create_grid_widget(int colspacing, int rowspacing);
-UiContainer* ui_grid_container(UiObject *obj, GtkWidget *grid);
+UiContainer* ui_grid_container(
+ UiObject *obj,
+ GtkWidget *grid,
+ UiBool def_hexpand,
+ UiBool def_vexpand,
+ UiBool def_hfill,
+ UiBool def_vfill);
void ui_grid_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill);
UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame);
GTKOBJ += entry.o
GTKOBJ += dnd.o
GTKOBJ += headerbar.o
+GTKOBJ += webview.o
TOOLKITOBJS += $(GTKOBJ:%=$(GTK_OBJPRE)%)
TOOLKITSOURCE += $(GTKOBJ:%.o=gtk/%.c)
--- /dev/null
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2025 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "toolkit.h"
+#include "container.h"
+#include "../ui/webview.h"
+
+#ifdef UI_WEBVIEW
+
+#include <webkit/webkit.h>
+
+UIWIDGET ui_webview_create(UiObject *obj, UiWebviewArgs args) {
+ UiObject* current = uic_current_obj(obj);
+
+ GtkWidget *webview = webkit_web_view_new();
+ webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview), "https://code.unixwork.de");
+
+ ui_set_name_and_style(webview, args.name, args.style_class);
+
+ ui_set_widget_groups(obj->ctx, webview, args.groups);
+ UI_APPLY_LAYOUT1(current, args);
+ current->container->add(current->container, webview, FALSE);
+
+ return webview;
+}
+
+
+#endif
--- /dev/null
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2025 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef WEBVIEW_H
+#define WEBVIEW_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WEBVIEW_H */
+
Dimension actual_width, actual_height;
w->mywidget.sizerequest = TRUE;
+ //printf("sizerequest: %d x %d\n", (int)req_width, (int)req_height);
+
//XtWidgetGeometry request;
//request.width = req_width;
//request.request_mode = CWWidth;
/* -------------------------- TabView Container -------------------------- */
static void ui_tabbar_resize(Widget widget, XtPointer udata, XtPointer cdata) {
- printf("ui_tabbar_resize\n");
-
UiMotifTabView *tabview = udata;
int width = 0;
int height = 0;
XtVaGetValues(widget, XmNwidth, &width, XmNheight, &height, NULL);
- int button_width = width / 4;
+ int numbuttons = cxListSize(tabview->tabs);
+ if(numbuttons == 0) {
+ return;
+ }
+ int button_width = width / numbuttons;
int x = 0;
- printf("width: %d\n", (int)width);
-
CxIterator i = cxListIterator(tabview->tabs);
cx_foreach(UiTab *, tab, i) {
+ if(i.index + 1 == numbuttons) {
+ button_width = width - x;
+ }
XtVaSetValues(
tab->tab_button,
XmNx, x,
}
static void ui_tabbar_expose(Widget widget, XtPointer udata, XtPointer cdata) {
- printf("ui_tabbar_expose\n");
-
UiMotifTabView *tabview = udata;
- CxIterator i = cxListIterator(tabview->tabs);
- cx_foreach(UiTab *, tab, i) {
- printf("y: %d\n", (int)tab->tab_button->core.y);
- }
-
XmDrawingAreaCallbackStruct *cbs = (XmDrawingAreaCallbackStruct *)cdata;
XEvent *event = cbs->event;
Display *dpy = XtDisplay(widget);
- printf("width: %d\n", (int)widget->core.width);
+ if(!tabview->gc_initialized) {
+ XGCValues gcvals;
+ gcvals.foreground = tabview->fg1;
+ tabview->gc = XCreateGC(XtDisplay(tabview->tabbar), XtWindow(tabview->tabbar), (GCForeground), &gcvals);
+ }
+
+ if(tabview->current_tab) {
+ Widget tab = tabview->current_tab->tab_button;
+ XFillRectangle(dpy, XtWindow(widget), tabview->gc, tab->core.x, tab->core.height, tab->core.width, 4);
+ }
}
UIWIDGET ui_tabview_create(UiObject *obj, UiTabViewArgs args) {
Widget content = XmCreateFrame(form, "tabviewcontent", xargs, n);
// setup tabview object, that holds all relevant objects
+ tabview->obj = obj;
tabview->form = form;
tabview->tabbar = tabbar;
tabview->content = content;
tabview->select = ui_motif_tabview_select;
tabview->add = ui_motif_tabview_add_tab;
tabview->remove = ui_motif_tabview_remove;
- tabview->tabs = cxArrayListCreateSimple(sizeof(UiTab), 8);
+ tabview->tabs = cxArrayListCreate(obj->ctx->allocator, NULL, sizeof(UiTab), 8);
UiTabViewContainer *ct = ui_malloc(obj->ctx, sizeof(UiTabViewContainer));
ct->container.widget = form;
tabview->add(tabview, -1, title, child);
}
+void ui_tabview_select(UIWIDGET tabview, int tab) {
+ UiMotifTabView *tabviewdata = NULL;
+ XtVaGetValues(tabview, XmNuserData, &tabviewdata, NULL);
+ if(tabviewdata) {
+ ui_motif_tabview_select(tabviewdata, tab);
+ } else {
+ fprintf(stderr, "ui_tabview_select: widget is not a tabview\n");
+ }
+}
+
+void ui_tabview_remove(UIWIDGET tabview, int tab) {
+ UiMotifTabView *tabviewdata = NULL;
+ XtVaGetValues(tabview, XmNuserData, &tabviewdata, NULL);
+ if(tabviewdata) {
+ ui_motif_tabview_remove(tabviewdata, tab);
+ } else {
+ fprintf(stderr, "ui_tabview_select: widget is not a tabview\n");
+ }
+}
+
+UiObject* ui_tabview_add(UIWIDGET tabview, const char *name, int tab_index) {
+ UiMotifTabView *tabviewdata = NULL;
+ XtVaGetValues(tabview, XmNuserData, &tabviewdata, NULL);
+ if(tabviewdata) {
+ Arg args[16];
+ int n = 0;
+
+ XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++;
+ XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++;
+ XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++;
+ XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
+ XtSetArg(args[n], XmNtopWidget, tabviewdata->tabbar); n++;
+
+ Widget grid = XtCreateManagedWidget("vbox", gridClass, tabviewdata->content, args, n);
+
+ UiObject *newobj = ui_calloc(tabviewdata->obj->ctx, 1, sizeof(UiObject));
+ newobj->ctx = tabviewdata->obj->ctx;
+ newobj->widget = grid;
+ UiContainerX *container = ui_box_container(newobj, grid, UI_BOX_VERTICAL);
+ newobj->container_begin = container;
+ newobj->container_end = container;
+ return newobj;
+ } else {
+ fprintf(stderr, "ui_tabview_select: widget is not a tabview\n");
+ return NULL;
+ }
+}
+
void ui_motif_tabview_select(UiMotifTabView *tabview, int tab) {
-
+ UiTab *t = cxListAt(tabview->tabs, tab);
+ if(t) {
+ ui_motif_tabview_change_tab(tabview, t);
+ }
+}
+
+static void ui_tab_button_callback(Widget widget, UiTab *tab, XtPointer d) {
+ UiMotifTabView *tabview = NULL;
+ XtVaGetValues(widget, XmNuserData, &tabview, NULL);
+ ui_motif_tabview_change_tab(tabview, tab);
}
void ui_motif_tabview_add_tab(UiMotifTabView *tabview, int index, const char *name, Widget child) {
XtSetArg(args[n], XmNlabelString, label); n++;
XtSetArg(args[n], XmNshadowThickness, 0); n++;
XtSetArg(args[n], XmNhighlightThickness, 0); n++;
+ XtSetArg(args[n], XmNuserData, tabview); n++;
- Widget button = XmCreatePushButton(tabview->tabbar, "tab_button", args, 3);
+ Widget button = XmCreatePushButton(tabview->tabbar, "tab_button", args, n);
XtManageChild(button);
if(tabview->height == 0) {
&tabview->bg1,
XmNbackground,
&tabview->bg2,
+ XmNhighlightColor,
+ &tabview->fg1,
XmNheight,
&h,
NULL);
tabview->height = h + 2; // border
+
+ XtVaSetValues(tabview->tabbar, XmNbackground, tabview->bg1, NULL);
}
tab.tab_button = button;
tab.child = child;
+ size_t newtab_index = cxListSize(tabview->tabs);
cxListAdd(tabview->tabs, &tab);
+ UiTab *newtab = cxListAt(tabview->tabs, newtab_index);
+
+ XtAddCallback(
+ button,
+ XmNactivateCallback,
+ (XtCallbackProc)ui_tab_button_callback,
+ newtab);
+
+ if(newtab_index == 0) {
+ ui_motif_tabview_change_tab(tabview, newtab);
+ } else {
+ XtVaSetValues(button, XmNbackground, tabview->bg1, NULL);
+ }
}
void ui_motif_tabview_remove(UiMotifTabView *tabview, int index) {
-
+ UiTab *tab = cxListAt(tabview->tabs, index);
+ if(tab) {
+ if(tab == tabview->current_tab) {
+ if(index > 0) {
+ ui_motif_tabview_select(tabview, index-1);
+ } else {
+ if(index < cxListSize(tabview->tabs)) {
+ ui_motif_tabview_select(tabview, index+1);
+ } else {
+ tabview->current_tab = NULL;
+ }
+ }
+ }
+ XtDestroyWidget(tab->tab_button);
+ XtDestroyWidget(tab->child);
+ cxListRemove(tabview->tabs, index);
+ }
+}
+
+void ui_motif_tabview_change_tab(UiMotifTabView *tabview, UiTab *tab) {
+ if(tabview->current_tab) {
+ XtVaSetValues(tabview->current_tab->tab_button, XmNshadowThickness, 0, XmNbackground, tabview->bg1, NULL);
+ XtUnmanageChild(tabview->current_tab->child);
+ }
+ XtVaSetValues(tab->tab_button, XmNshadowThickness, 1, XmNbackground, tabview->bg2, NULL);
+ tabview->current_tab = tab;
+ XtManageChild(tab->child);
}
Widget ui_tabview_container_prepare(UiContainerPrivate *ctn, Arg *args, int *n) {
Dimension y;
} UiGridContainer;
+typedef struct UiTab {
+ Widget tab_button;
+ Widget child;
+} UiTab;
+
typedef struct UiMotifTabView UiMotifTabView;
struct UiMotifTabView {
+ UiObject *obj;
Widget form;
Widget tabbar;
Widget content;
Widget current;
+ UiTab *current_tab;
int height;
Pixel bg1;
Pixel bg2;
+ Pixel fg1;
+ GC gc;
+ int gc_initialized;
UiTabViewType tabview;
UiSubContainerType subcontainer;
CxList *tabs;
void (*remove)(UiMotifTabView *tabview, int index);
};
-typedef struct UiTab {
- Widget tab_button;
- Widget child;
-} UiTab;
-
typedef struct UiTabViewContainer {
UiContainerPrivate container;
UiMotifTabView *tabview;
void ui_motif_tabview_select(UiMotifTabView *tabview, int tab);
void ui_motif_tabview_add_tab(UiMotifTabView *tabview, int index, const char *name, Widget child);
void ui_motif_tabview_remove(UiMotifTabView *tabview, int index);
+void ui_motif_tabview_change_tab(UiMotifTabView *tabview, UiTab *tab);
Widget ui_tabview_container_prepare(UiContainerPrivate *ctn, Arg *args, int *n);
void ui_tabview_container_add(UiContainerPrivate *ctn, Widget widget);
void* ui_strmodel_getvalue(void *elm, int column) {
return column == 0 ? elm : NULL;
}
+
+/* ------------------------------- Drop Down ------------------------------- */
+
+static void ui_dropdown_selection(
+ Widget w,
+ UiListView *listview,
+ XmComboBoxCallbackStruct *cb)
+{
+ UiListSelection sel = { 0, NULL };
+ if(cb->item_position > 0) {
+ sel.count = 1;
+ sel.rows = malloc(sizeof(int));
+ sel.rows[0] = cb->item_position-1;
+ }
+ UiEvent event;
+ event.obj = listview->obj;
+ event.window = event.obj->window;
+ event.document = event.obj->ctx->document;
+ event.eventdata = &sel;
+ event.intval = 0;
+ if(listview->onactivate) {
+ listview->onactivate(&event, listview->onactivatedata);
+ }
+ if(listview->onselection) {
+ listview->onselection(&event, listview->onselectiondata);
+ }
+}
+
+UIWIDGET ui_combobox_create(UiObject* obj, UiListArgs args) {
+ Arg xargs[16];
+ int n = 0;
+
+ UiContainerPrivate *ctn = ui_obj_container(obj);
+ UI_APPLY_LAYOUT(ctn->layout, args);
+
+ char *name = args.name ? (char*)args.name : "dropdown";
+ Widget parent = ctn->prepare(ctn, xargs, &n);
+ Widget widget = XmCreateDropDownList(parent, name, xargs, n);
+ XtManageChild(widget);
+
+ UiVar* var = uic_widget_var(obj->ctx, obj->ctx, args.list, args.varname, UI_VAR_LIST);
+
+ UiListView *listview = malloc(sizeof(UiListView));
+ memset(listview, 0, sizeof(UiListView));
+ listview->obj = obj;
+ listview->widget = widget;
+ listview->getvalue = args.getvalue ? args.getvalue : ui_strmodel_getvalue;
+ listview->var = var;
+ listview->onactivate = args.onactivate;
+ listview->onactivatedata = args.onactivatedata;
+ listview->onselection = args.onselection;
+ listview->onselectiondata = args.onselectiondata;
+
+ if(var) {
+ UiList *list = var->value;
+ list->obj = listview;
+ list->update = ui_listview_update;
+ list->getselection = ui_listview_getselection;
+ list->setselection = ui_listview_setselection;
+ ui_listview_update(list, 0);
+ }
+
+ XtAddCallback(
+ widget,
+ XmNdestroyCallback,
+ (XtCallbackProc)ui_listview_destroy,
+ listview);
+ XtAddCallback(
+ widget,
+ XmNselectionCallback,
+ (XtCallbackProc)ui_dropdown_selection,
+ listview);
+
+ return widget;
+}
Widget parent = ctn->prepare(ctn, xargs, &n);
char *name = args.name ? (char*)args.name : "textarea";
+ XtSetArg(xargs[n], XmNwidth, 100); n++;
Widget widget = XmCreateScrolledText(parent, name, xargs, n);
XtManageChild(widget);
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
int spacing;
int columnspacing;
int rowspacing;
+ UiBool def_hfill;
+ UiBool def_vfill;
+ UiBool def_hexpand;
+ UiBool def_vexpand;
} UiContainerArgs;
typedef struct UiFrameArgs {
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
#define ui_headerbar0(obj) for(ui_headerbar_create(obj, (UiHeaderbarArgs){ 0 });ui_container_finish(obj);ui_container_begin_close(obj))
#define ui_sidebar0(obj) for(ui_sidebar_create(obj, (UiSidebarArgs){ 0 });ui_container_finish(obj);ui_container_begin_close(obj))
+#define ui_tabview_w(obj, w, ...) for(w = ui_tabview_create(obj, (UiTabViewArgs){ __VA_ARGS__ });ui_container_finish(obj);ui_container_begin_close(obj))
+
#define ui_hsplitpane(obj, ...) for(ui_hsplitpane_create(obj, (UiSplitPaneArgs){ __VA_ARGS__ });ui_container_finish(obj);ui_container_begin_close(obj))
#define ui_vsplitpane(obj, ...) for(ui_vsplitpane_create(obj, (UiSplitPaneArgs){ __VA_ARGS__ });ui_container_finish(obj);ui_container_begin_close(obj))
#define ui_hsplitpane0(obj) for(ui_hsplitpane_create(obj, (UiSplitPaneArgs){ 0 });ui_container_finish(obj);ui_container_begin_close(obj))
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_override_defaults(UiObject *obj, UiBool d);
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);
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.override_defaults) ui_layout_override_defaults(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
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
int width;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
extern "C" {
#endif
-UIWIDGET ui_hscrollbar(UiObject *obj, UiRange *range, ui_callback f, void *userdata);
-UIWIDGET ui_vscrollbar(UiObject *obj, UiRange *range, ui_callback f, void *userdata);
+UIWIDGET ui_hscrollbar(UiObject *obj, UiRange *range, ui_callback f, void *userdata); // TODO
+UIWIDGET ui_vscrollbar(UiObject *obj, UiRange *range, ui_callback f, void *userdata); // TODO
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
int width;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
int width;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
UiBool vexpand;
UiBool hfill;
UiBool vfill;
+ UiBool override_defaults;
int colspan;
int rowspan;
const char *name;
#include "dnd.h"
#include "icons.h"
+#include "webview.h"
+
#endif /* UI_H */
--- /dev/null
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2025 Olaf Wintermann. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UI_WEBVIEW_H
+#define UI_WEBVIEW_H
+
+#include "toolkit.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct UiWebviewArgs {
+ UiTri fill;
+ UiBool hexpand;
+ UiBool vexpand;
+ UiBool hfill;
+ UiBool vfill;
+ UiBool override_defaults;
+ int colspan;
+ int rowspan;
+ const char *name;
+ const char *style_class;
+
+ const int* groups;
+} UiWebviewArgs;
+
+#define ui_webview(obj, ...) ui_webview_create(obj, (UiWebviewArgs){ __VA_ARGS__ } )
+
+UIWIDGET ui_webview_create(UiObject *obj, UiWebviewArgs args);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* UI_WEBVIEW_H */
+