ui/gtk/list.h

changeset 101
7b3a3130be44
parent 100
d2bd73d28ff1
equal deleted inserted replaced
100:d2bd73d28ff1 101:7b3a3130be44
35 #include <cx/array_list.h> 35 #include <cx/array_list.h>
36 36
37 #ifdef __cplusplus 37 #ifdef __cplusplus
38 extern "C" { 38 extern "C" {
39 #endif 39 #endif
40
41 typedef struct UiColData UiColData;
40 42
41 typedef struct UiListView { 43 typedef struct UiListView {
42 UiObject *obj; 44 UiObject *obj;
43 GtkWidget *widget; 45 GtkWidget *widget;
44 UiVar *var; 46 UiVar *var;
45 UiModel *model; 47 UiModel *model;
46 ui_callback ondragstart; 48 #if GTK_CHECK_VERSION(4, 10, 0)
47 void *ondragstartdata; 49 GListStore *liststore;
48 ui_callback ondragcomplete; 50 GtkSelectionModel *selectionmodel;
49 void *ondragcompletedata; 51 UiColData *columns;
50 ui_callback ondrop; 52 #endif
51 void *ondropdata; 53 ui_callback onactivate;
54 void *onactivatedata;
55 ui_callback onselection;
56 void *onselectiondata;
57 ui_callback ondragstart;
58 void *ondragstartdata;
59 ui_callback ondragcomplete;
60 void *ondragcompletedata;
61 ui_callback ondrop;
62 void *ondropdata;
63 UiListSelection selection;
52 64
53 } UiListView; 65 } UiListView;
66
67 struct UiColData {
68 UiListView *listview;
69 int model_column;
70 int data_column;
71 };
54 72
55 typedef struct UiTreeEventData { 73 typedef struct UiTreeEventData {
56 UiObject *obj; 74 UiObject *obj;
57 ui_callback activate; 75 ui_callback activate;
58 ui_callback selection; 76 ui_callback selection;
84 void *onbuttonclickdata; 102 void *onbuttonclickdata;
85 103
86 GtkListBoxRow *first_row; 104 GtkListBoxRow *first_row;
87 }; 105 };
88 106
107
108 #if GTK_CHECK_VERSION(4, 10, 0)
109
110 void ui_update_liststore(GListStore *liststore, UiList *list);
111
112 void ui_listview_update2(UiList *list, int i);
113 UiListSelection ui_listview_getselection2(UiList *list);
114 void ui_listview_setselection2(UiList *list, UiListSelection selection);
115
116 void ui_columnview_activate(void *ignore, guint position, gpointer userdata);
117 void ui_listview_selection_changed(GtkSelectionModel* self, guint position, guint n_items, gpointer user_data);
118
119 void ui_dropdown_activate(GtkDropDown* self, gpointer userdata);
120
121 #endif
122
89 void* ui_strmodel_getvalue(void *elm, int column); 123 void* ui_strmodel_getvalue(void *elm, int column);
90 124
91 UIWIDGET ui_listview_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata); 125 UIWIDGET ui_listview_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata);
92 UIWIDGET ui_table_var(UiObject *obj, UiVar *var, UiModel *model, UiListCallbacks cb); 126 UIWIDGET ui_table_var(UiObject *obj, UiVar *var, UiModel *model, UiListCallbacks cb);
93 127
98 void ui_listview_setselection(UiList *list, UiListSelection selection); 132 void ui_listview_setselection(UiList *list, UiListSelection selection);
99 133
100 void ui_combobox_destroy(GtkWidget *w, UiListView *v); 134 void ui_combobox_destroy(GtkWidget *w, UiListView *v);
101 void ui_listview_destroy(GtkWidget *w, UiListView *v); 135 void ui_listview_destroy(GtkWidget *w, UiListView *v);
102 136
137 #if GTK_CHECK_VERSION(4, 10, 0)
138
139 #else
103 void ui_listview_activate_event( 140 void ui_listview_activate_event(
104 GtkTreeView *tree_view, 141 GtkTreeView *tree_view,
105 GtkTreePath *path, 142 GtkTreePath *path,
106 GtkTreeViewColumn *column, 143 GtkTreeViewColumn *column,
107 UiTreeEventData *event); 144 UiTreeEventData *event);
110 UiTreeEventData *event); 147 UiTreeEventData *event);
111 UiListSelection ui_listview_selection( 148 UiListSelection ui_listview_selection(
112 GtkTreeSelection *selection, 149 GtkTreeSelection *selection,
113 UiTreeEventData *event); 150 UiTreeEventData *event);
114 int ui_tree_path_list_index(GtkTreePath *path); 151 int ui_tree_path_list_index(GtkTreePath *path);
152 #endif
115 153
116 void ui_listview_add_dnd(UiListView *listview, UiListArgs *args); 154 void ui_listview_add_dnd(UiListView *listview, UiListArgs *args);
117 void ui_listview_enable_drop(UiListView *listview, UiListArgs *args); 155 void ui_listview_enable_drop(UiListView *listview, UiListArgs *args);
118 156
119 UIWIDGET ui_combobox_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata); 157 UIWIDGET ui_combobox_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata);

mercurial