ui/motif/container.h

changeset 455
391d8c7223d1
parent 452
a0620cf552a6
child 460
1274d84f44de
equal deleted inserted replaced
454:57a2c6c04966 455:391d8c7223d1
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 UiMotifTabView UiMotifTabView;
108 struct UiMotifTabView {
109 Widget form;
110 Widget tabbar;
111 Widget content;
112 Widget current;
113 int height;
114 Pixel bg1;
115 Pixel bg2;
116 UiTabViewType tabview;
117 UiSubContainerType subcontainer;
118 CxList *tabs;
119 void (*select)(UiMotifTabView *tabview, int tab);
120 void (*add)(UiMotifTabView *tabview, int index, const char *name, Widget child);
121 void (*remove)(UiMotifTabView *tabview, int index);
122 };
123
124 typedef struct UiTab {
125 Widget tab_button;
126 Widget child;
127 } UiTab;
128
129 typedef struct UiTabViewContainer {
130 UiContainerPrivate container;
131 UiMotifTabView *tabview;
132 } UiTabViewContainer;
133
134 void ui_motif_tabview_select(UiMotifTabView *tabview, int tab);
135 void ui_motif_tabview_add_tab(UiMotifTabView *tabview, int index, const char *name, Widget child);
136 void ui_motif_tabview_remove(UiMotifTabView *tabview, int index);
137
138 Widget ui_tabview_container_prepare(UiContainerPrivate *ctn, Arg *args, int *n);
139 void ui_tabview_container_add(UiContainerPrivate *ctn, Widget widget);
99 140
100 UiContainerX* ui_box_container(UiObject *obj, Widget grid, UiBoxOrientation orientation); 141 UiContainerX* ui_box_container(UiObject *obj, Widget grid, UiBoxOrientation orientation);
101 Widget ui_vbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n); 142 Widget ui_vbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n);
102 Widget ui_hbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n); 143 Widget ui_hbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n);
103 void ui_box_container_add(UiContainerPrivate *ctn, Widget widget); 144 void ui_box_container_add(UiContainerPrivate *ctn, Widget widget);

mercurial