--- a/ui/motif/container.h Sat Feb 01 09:56:01 2025 +0100 +++ b/ui/motif/container.h Sat Feb 01 12:22:47 2025 +0100 @@ -48,6 +48,12 @@ layout.rowspan = args.rowspan typedef enum UiBoxOrientation UiBoxOrientation; + +enum UiContainerType { + UI_CONTAINER_GENERIC = 0, + UI_CONTAINER_TABVIEW +}; +typedef enum UiContainerType UiContainerType; #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout)) #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE) @@ -79,11 +85,12 @@ struct UiContainerPrivate { - UiContainerX container; - Widget (*prepare)(UiContainerPrivate*, Arg *, int*); - void (*add)(UiContainerPrivate*, Widget); - Widget widget; - UiLayout layout; + UiContainerX container; + Widget (*prepare)(UiContainerPrivate*, Arg *, int*); + void (*add)(UiContainerPrivate*, Widget); + Widget widget; + UiContainerType type; + UiLayout layout; }; typedef struct UiBoxContainer { @@ -97,6 +104,40 @@ Dimension y; } UiGridContainer; +typedef struct UiMotifTabView UiMotifTabView; +struct UiMotifTabView { + Widget form; + Widget tabbar; + Widget content; + Widget current; + int height; + Pixel bg1; + Pixel bg2; + UiTabViewType tabview; + UiSubContainerType subcontainer; + CxList *tabs; + void (*select)(UiMotifTabView *tabview, int tab); + void (*add)(UiMotifTabView *tabview, int index, const char *name, Widget child); + void (*remove)(UiMotifTabView *tabview, int index); +}; + +typedef struct UiTab { + Widget tab_button; + Widget child; +} UiTab; + +typedef struct UiTabViewContainer { + UiContainerPrivate container; + UiMotifTabView *tabview; +} UiTabViewContainer; + +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); + +Widget ui_tabview_container_prepare(UiContainerPrivate *ctn, Arg *args, int *n); +void ui_tabview_container_add(UiContainerPrivate *ctn, Widget widget); + UiContainerX* ui_box_container(UiObject *obj, Widget grid, UiBoxOrientation orientation); Widget ui_vbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n); Widget ui_hbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n);