ui/motif/container.h

changeset 102
64ded9f6a6c6
parent 100
d2bd73d28ff1
equal deleted inserted replaced
101:7b3a3130be44 102:64ded9f6a6c6
46 layout.vfill = args.vfill; \ 46 layout.vfill = args.vfill; \
47 layout.colspan = args.colspan; \ 47 layout.colspan = args.colspan; \
48 layout.rowspan = args.rowspan 48 layout.rowspan = args.rowspan
49 49
50 typedef enum UiBoxOrientation UiBoxOrientation; 50 typedef enum UiBoxOrientation UiBoxOrientation;
51
52 enum UiContainerType {
53 UI_CONTAINER_GENERIC = 0,
54 UI_CONTAINER_TABVIEW
55 };
56 typedef enum UiContainerType UiContainerType;
51 57
52 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout)) 58 #define ui_reset_layout(layout) memset(&(layout), 0, sizeof(UiLayout))
53 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE) 59 #define ui_lb2bool(b) ((b) == UI_LAYOUT_TRUE ? TRUE : FALSE)
54 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE) 60 #define ui_bool2lb(b) ((b) ? UI_LAYOUT_TRUE : UI_LAYOUT_FALSE)
55 61
77 83
78 typedef struct UiContainerPrivate UiContainerPrivate; 84 typedef struct UiContainerPrivate UiContainerPrivate;
79 85
80 86
81 struct UiContainerPrivate { 87 struct UiContainerPrivate {
82 UiContainerX container; 88 UiContainerX container;
83 Widget (*prepare)(UiContainerPrivate*, Arg *, int*); 89 Widget (*prepare)(UiContainerPrivate*, Arg *, int*);
84 void (*add)(UiContainerPrivate*, Widget); 90 void (*add)(UiContainerPrivate*, Widget);
85 Widget widget; 91 Widget widget;
86 UiLayout layout; 92 UiContainerType type;
93 UiLayout layout;
87 }; 94 };
88 95
89 typedef struct UiBoxContainer { 96 typedef struct UiBoxContainer {
90 UiContainerPrivate container; 97 UiContainerPrivate container;
91 Dimension n; 98 Dimension n;
94 typedef struct UiGridContainer { 101 typedef struct UiGridContainer {
95 UiContainerPrivate container; 102 UiContainerPrivate container;
96 Dimension x; 103 Dimension x;
97 Dimension y; 104 Dimension y;
98 } UiGridContainer; 105 } UiGridContainer;
106
107 typedef struct UiTab {
108 Widget tab_button;
109 Widget child;
110 } UiTab;
111
112 typedef struct UiMotifTabView UiMotifTabView;
113 struct UiMotifTabView {
114 UiObject *obj;
115 Widget form;
116 Widget tabbar;
117 Widget content;
118 Widget current;
119 UiTab *current_tab;
120 int current_index;
121 int height;
122 Pixel bg1;
123 Pixel bg2;
124 Pixel fg1;
125 GC gc;
126 int gc_initialized;
127 UiTabViewType tabview;
128 UiSubContainerType subcontainer;
129 CxList *tabs;
130 void (*select)(UiMotifTabView *tabview, int tab);
131 void (*add)(UiMotifTabView *tabview, int index, const char *name, Widget child);
132 void (*remove)(UiMotifTabView *tabview, int index);
133 };
134
135 typedef struct UiTabViewContainer {
136 UiContainerPrivate container;
137 UiMotifTabView *tabview;
138 } UiTabViewContainer;
139
140 void ui_motif_tabview_select(UiMotifTabView *tabview, int tab);
141 void ui_motif_tabview_add_tab(UiMotifTabView *tabview, int index, const char *name, Widget child);
142 void ui_motif_tabview_remove(UiMotifTabView *tabview, int index);
143 void ui_motif_tabview_change_tab(UiMotifTabView *tabview, UiTab *tab);
144 int64_t ui_tabview_get(UiInteger *i);
145 void ui_tabview_set(UiInteger *i, int64_t value);
146
147 Widget ui_tabview_container_prepare(UiContainerPrivate *ctn, Arg *args, int *n);
148 void ui_tabview_container_add(UiContainerPrivate *ctn, Widget widget);
99 149
100 UiContainerX* ui_box_container(UiObject *obj, Widget grid, UiBoxOrientation orientation); 150 UiContainerX* ui_box_container(UiObject *obj, Widget grid, UiBoxOrientation orientation);
101 Widget ui_vbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n); 151 Widget ui_vbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n);
102 Widget ui_hbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n); 152 Widget ui_hbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n);
103 void ui_box_container_add(UiContainerPrivate *ctn, Widget widget); 153 void ui_box_container_add(UiContainerPrivate *ctn, Widget widget);

mercurial