ui/ui/tree.h

branch
newapi
changeset 196
320d85f3cd14
parent 150
5cee4cb5ad79
child 201
7f67ebbb0c1c
equal deleted inserted replaced
195:0f2e69873875 196:320d85f3cd14
36 #endif 36 #endif
37 37
38 typedef struct UiModel UiModel; 38 typedef struct UiModel UiModel;
39 typedef struct UiListCallbacks UiListCallbacks; 39 typedef struct UiListCallbacks UiListCallbacks;
40 typedef struct UiListSelection UiListSelection; 40 typedef struct UiListSelection UiListSelection;
41
42 typedef struct UiListArgs UiListArgs;
41 43
42 typedef enum UiModelType { 44 typedef enum UiModelType {
43 UI_STRING = 0, 45 UI_STRING = 0,
44 UI_INTEGER, 46 UI_INTEGER,
45 UI_ICON, 47 UI_ICON,
106 * indices of selected rows 108 * indices of selected rows
107 */ 109 */
108 int *rows; 110 int *rows;
109 }; 111 };
110 112
113 struct UiListArgs {
114 UiTri fill;
115 UiBool hexpand;
116 UiBool vexpand;
117 int colspan;
118 int rowspan;
119
120 UiList* list;
121 const char* varname;
122 UiModel* model;
123 ui_getvaluefunc getvalue;
124 ui_callback onactivate;
125 void* onactivatedata;
126 ui_callback onselection;
127 void* onselectiondata;
128 UiBool multiselection;
129 };
130
111 UiModel* ui_model(UiContext *ctx, ...); 131 UiModel* ui_model(UiContext *ctx, ...);
112 void ui_model_free(UiContext *ctx, UiModel *mi); 132 void ui_model_free(UiContext *ctx, UiModel *mi);
113 133
114 UIWIDGET ui_listview(UiObject *obj, UiList *list, ui_getvaluefunc getvalue, ui_callback f, void *udata); 134 #define ui_listview(obj, ...) ui_listview_create(obj, (UiListArgs) { __VA_ARGS__ } )
115 UIWIDGET ui_listview_str(UiObject *obj, UiList *list, ui_callback f, void *udata); 135 #define ui_table(obj, ...) ui_table_create(obj, (UiListArgs) { __VA_ARGS__ } )
116 UIWIDGET ui_listview_nv(UiObject *obj, char *listname, ui_getvaluefunc getvalue, ui_callback f, void *udata); 136 #define ui_combobox(obj, ...) ui_combobox_create(obj, (UiListArgs) { __VA_ARGS__ } )
117 137
118 UIWIDGET ui_table(UiObject *obj, UiList *data, UiModel *model, UiListCallbacks cb); 138 UIWIDGET ui_listview_create(UiObject* obj, UiListArgs args);
119 UIWIDGET ui_table_nv(UiObject *obj, char *varname, UiModel *model, UiListCallbacks cb); 139 UIWIDGET ui_table_create(UiObject* obj, UiListArgs args);
140 UIWIDGET ui_combobox_create(UiObject* obj, UiListArgs);
141
142 UIWIDGET ui_listview_deprecated(UiObject *obj, UiList *list, ui_getvaluefunc getvalue, ui_callback f, void *udata);
143 UIWIDGET ui_listview_str_deprecated(UiObject *obj, UiList *list, ui_callback f, void *udata);
144 UIWIDGET ui_listview_nv_deprecated(UiObject *obj, char *listname, ui_getvaluefunc getvalue, ui_callback f, void *udata);
145
146 UIWIDGET ui_table_deprecated(UiObject *obj, UiList *data, UiModel *model, UiListCallbacks cb);
147 UIWIDGET ui_table_nv_deprecated(UiObject *obj, char *varname, UiModel *model, UiListCallbacks cb);
120 148
121 void ui_table_dragsource(UIWIDGET tablewidget, int actions, char *target0, ...); 149 void ui_table_dragsource(UIWIDGET tablewidget, int actions, char *target0, ...);
122 void ui_table_dragsource_a(UIWIDGET tablewidget, int actions, char **targets, int nelm); 150 void ui_table_dragsource_a(UIWIDGET tablewidget, int actions, char **targets, int nelm);
123 void ui_table_dragdest(UIWIDGET tablewidget, int actions, char *target0, ...); 151 void ui_table_dragdest(UIWIDGET tablewidget, int actions, char *target0, ...);
124 void ui_table_dragdest_a(UIWIDGET tablewidget, int actions, char **targets, int nelm); 152 void ui_table_dragdest_a(UIWIDGET tablewidget, int actions, char **targets, int nelm);
125 153
126 UIWIDGET ui_combobox(UiObject *obj, UiList *list, ui_getvaluefunc getvalue, ui_callback f, void *udata); 154 UIWIDGET ui_combobox_deprecated(UiObject *obj, UiList *list, ui_getvaluefunc getvalue, ui_callback f, void *udata);
127 UIWIDGET ui_combobox_str(UiObject *obj, UiList *list, ui_callback f, void *udata); 155 UIWIDGET ui_combobox_str_deprecated(UiObject *obj, UiList *list, ui_callback f, void *udata);
128 UIWIDGET ui_combobox_nv(UiObject *obj, char *varname, ui_getvaluefunc getvalue, ui_callback f, void *udata); 156 UIWIDGET ui_combobox_nv_deprecated(UiObject *obj, char *varname, ui_getvaluefunc getvalue, ui_callback f, void *udata);
129 157
130 #ifdef __cplusplus 158 #ifdef __cplusplus
131 } 159 }
132 #endif 160 #endif
133 161

mercurial