ui/gtk/container.h

changeset 431
bb7da585debc
parent 422
c1354a29a7e9
--- a/ui/gtk/container.h	Sun May 23 09:44:43 2021 +0200
+++ b/ui/gtk/container.h	Sat Jan 04 16:38:48 2025 +0100
@@ -33,6 +33,9 @@
 #include "../ui/container.h"
 #include <string.h>
 
+#include <cx/allocator.h>
+#include <cx/hash_map.h>
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -60,13 +63,16 @@
     char         *label;
     UiBool       hexpand;
     UiBool       vexpand;
+    UiBool       hfill;
+    UiBool       vfill;
     int          width;
-    int          gridwidth;
+    int          colspan;
+    int          rowspan;
 };
 
 struct UiContainer {
     GtkWidget *widget;
-    GtkMenu *menu;
+    UIMENU menu;
     GtkWidget *current;
     
     void (*add)(UiContainer*, GtkWidget*, UiBool);
@@ -77,6 +83,7 @@
 
 typedef struct UiBoxContainer {
     UiContainer container;
+    UiSubContainerType type;
     UiBool has_fill;
 } UiBoxContainer;
 
@@ -90,6 +97,7 @@
 #endif
 } UiGridContainer;
 
+/*
 typedef struct UiPanedContainer {
     UiContainer container;
     GtkWidget *current_pane;
@@ -97,23 +105,80 @@
     int max;
     int cur;
 } UiPanedContainer;
+*/
 
 typedef struct UiTabViewContainer {
     UiContainer container;
 } UiTabViewContainer;
 
+typedef void (*ui_select_tab_func)(UIWIDGET widget, int tab);
+typedef void (*ui_add_tab_func)(UIWIDGET widget, int index, const char *name, UIWIDGET child);
+
+typedef struct UiGtkTabView {
+    UiObject *obj;
+    GtkWidget *widget;
+    ui_select_tab_func select_tab;
+    ui_select_tab_func remove_tab;
+    ui_add_tab_func add_tab;
+    UiSubContainerType subcontainer;
+    int margin;
+    int spacing;
+    int columnspacing;
+    int rowspacing;
+} UiGtkTabView;
+
+typedef struct UiHeaderbarContainer {
+    UiContainer container;
+    GtkWidget *centerbox;
+    int part;
+    UiHeaderbarAlternative alternative; /* only used by fallback headerbar */
+} UiHeaderbarContainer;
+
+typedef struct UiGtkItemListContainer {
+    UiObject *parent;
+    GtkWidget *widget;
+    UiContainer *container;
+    void (*create_ui)(UiObject *, int, void *, void *);
+    void *userdata;
+    UiSubContainerType subcontainer;
+    CxMap *current_items;
+    int margin;
+    int spacing;
+    int columnspacing;
+    int rowspacing;
+    bool remove_items;
+} UiGtkItemListContainer;
+
 GtkWidget* ui_gtk_vbox_new(int spacing);
 GtkWidget* ui_gtk_hbox_new(int spacing);
 
+GtkWidget* ui_subcontainer_create(
+        UiSubContainerType type,
+        UiObject *newobj,
+        int spacing,
+        int columnspacing,
+        int rowspacing,
+        int margin);
+
 UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame);
 void ui_frame_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill);
 
-UiContainer* ui_box_container(UiObject *obj, GtkWidget *box);
+GtkWidget* ui_box_set_margin(GtkWidget *box, int margin);
+UIWIDGET ui_box_create(UiObject *obj, UiContainerArgs args, UiSubContainerType type);
+
+UiContainer* ui_box_container(UiObject *obj, GtkWidget *box, UiSubContainerType type);
 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);
 void ui_grid_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill);
 
+UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame);
+void ui_frame_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill);
+
+UiContainer* ui_expander_container(UiObject *obj, GtkWidget *expander);
+void ui_expander_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill);
+
 UiContainer* ui_scrolledwindow_container(UiObject *obj, GtkWidget *scrolledwindow);
 void ui_scrolledwindow_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill);
 
@@ -125,10 +190,17 @@
 void ui_split_container_add1(UiContainer *ct, GtkWidget *widget, UiBool fill);
 void ui_split_container_add2(UiContainer *ct, GtkWidget *widget, UiBool fill);
 
+UiGtkTabView* ui_widget_get_tabview_data(UIWIDGET tabview);
 
-UiObject* ui_add_document_tab(UiDocumentView *view);
-void ui_tab_set_document(UiContext *ctx, void *document);
-void ui_tab_detach_document(UiContext *ctx);
+void ui_gtk_notebook_select_tab(GtkWidget *widget, int tab);
+
+#if GTK_CHECK_VERSION(3, 10, 0)
+UiContainer* ui_headerbar_container(UiObject *obj, GtkWidget *headerbar);
+void ui_headerbar_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill);
+#endif
+
+UiContainer* ui_headerbar_fallback_container(UiObject *obj, GtkWidget *headerbar);
+void ui_headerbar_fallback_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill);
 
 #ifdef	__cplusplus
 }

mercurial