1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #ifndef LIST_H
30 #define LIST_H
31
32 #include "../ui/list.h"
33 #include "toolkit.h"
34
35 #include <cx/array_list.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 typedef struct UiListView UiListView;
42 typedef struct UiColData UiColData;
43
44 #if GTK_CHECK_VERSION(
4,
10,
0)
45 typedef struct UiRowItems {
46 int bound;
47 GtkListItem *items[];
48 } UiRowItems;
49 #endif
50
51 struct UiColData {
52 UiListView *listview;
53 int column;
54 };
55
56 struct UiListView {
57 UiObject *obj;
58 GtkWidget *widget;
59 UiVar *var;
60 UiModel *model;
61 UiBool multiselection;
62 ui_getvaluefunc2 getvalue;
63 void *getvaluedata;
64 ui_getstylefunc getstyle;
65 void *getstyledata;
66 char **elements;
67 size_t nelm;
68 int current_row;
69 UiTextStyle row_style;
70 UiBool apply_row_style;
71 #if GTK_CHECK_VERSION(
4,
10,
0)
72 CxMap *bound_rows;
73 GListStore *liststore;
74 GtkSelectionModel *selectionmodel;
75 int *columns;
76 int numcolumns;
77 UiColData coldata;
78 PangoAttrList *current_row_attributes;
79 #else
80 int style_offset;
81 #endif
82 ui_callback onactivate;
83 void *onactivatedata;
84 ui_callback onselection;
85 void *onselectiondata;
86 ui_callback ondragstart;
87 void *ondragstartdata;
88 ui_callback ondragcomplete;
89 void *ondragcompletedata;
90 ui_callback ondrop;
91 void *ondropdata;
92 ui_list_savefunc onsave;
93 void *onsavedata;
94 UiListSelection selection;
95
96 };
97
98 typedef struct UiTreeEventData {
99 UiObject *obj;
100 ui_callback activate;
101 ui_callback selection;
102 void *activatedata;
103 void *selectiondata;
104 } UiTreeEventData;
105
106 typedef struct UiListBox UiListBox;
107
108 typedef struct UiListBoxSubList {
109 UiVar *var;
110 size_t numitems;
111 char *header;
112 UiBool separator;
113 CxList *widgets;
114 UiListBox *listbox;
115 void *userdata;
116 size_t index;
117 size_t startpos;
118 } UiListBoxSubList;
119
120 struct UiListBox {
121 UiObject *obj;
122 GtkListBox *listbox;
123 CxList *sublists;
124 ui_sublist_getvalue_func getvalue;
125 void *getvaluedata;
126 ui_callback onactivate;
127 void *onactivatedata;
128 ui_callback onbuttonclick;
129 void *onbuttonclickdata;
130 GtkListBoxRow *first_row;
131 UiBool header_is_item;
132 UiSubListEventData current_eventdata;
133 };
134
135
136 #if GTK_CHECK_VERSION(
4,
10,
0)
137
138 void ui_update_liststore(GListStore *liststore, UiList *list);
139 void ui_update_liststore_static(GListStore *liststore,
char **elm,
size_t nelm);
140
141 void ui_listview_update_model(UiModel *model,
void *userdata,
int insert_index,
int delete_index);
142 void ui_listview_update2(UiList *list,
int i);
143 UiListSelection ui_listview_getselection2(UiList *list);
144 void ui_listview_setselection2(UiList *list, UiListSelection selection);
145
146 void ui_dropdown_notify(GtkWidget *dropdown, GObject *pspec, gpointer userdata);
147 void ui_columnview_activate(
void *ignore, guint position, gpointer userdata);
148 void ui_listview_selection_changed(GtkSelectionModel* self, guint position, guint n_items, gpointer user_data);
149
150 void ui_dropdown_activate(GtkDropDown* self, gpointer userdata);
151
152 #endif
153
154 void* ui_strmodel_getvalue(
void *elm,
int column);
155
156 UIWIDGET ui_listview_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f,
void *udata);
157 UIWIDGET ui_table_var(UiObject *obj, UiVar *var, UiModel *model, UiListCallbacks cb);
158
159 GtkWidget* ui_get_tree_widget(
UIWIDGET widget);
160
161 void ui_listview_update_model(UiModel *model,
void *userdata,
int insert_index,
int delete_index);
162 void ui_listview_update(UiList *list,
int i);
163 UiListSelection ui_listview_getselection(UiList *list);
164 void ui_listview_setselection(UiList *list, UiListSelection selection);
165
166 void ui_combobox_destroy(GtkWidget *w, UiListView *v);
167 void ui_listview_destroy(GtkWidget *w, UiListView *v);
168
169 #if GTK_CHECK_VERSION(
4,
10,
0)
170
171 #else
172 void ui_listview_activate_event(
173 GtkTreeView *tree_view,
174 GtkTreePath *path,
175 GtkTreeViewColumn *column,
176 UiTreeEventData *event);
177 void ui_listview_selection_event(
178 GtkTreeSelection *treeselection,
179 UiTreeEventData *event);
180 UiListSelection ui_listview_selection(
181 GtkTreeSelection *selection,
182 UiTreeEventData *event);
183 int ui_tree_path_list_index(GtkTreePath *path);
184 #endif
185
186 void ui_listview_add_dnd(UiListView *listview, UiListArgs *args);
187 void ui_listview_enable_drop(UiListView *listview, UiListArgs *args);
188
189 UIWIDGET ui_combobox_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f,
void *udata);
190 GtkWidget* ui_create_combobox(UiObject *obj, UiModel *model, UiVar *var,
char **elm,
size_t nelm, ui_callback f,
void *udata);
191 void ui_combobox_change_event(GtkComboBox *widget, UiEventData *e);
192 void ui_combobox_modelupdate(UiList *list,
int i);
193 UiListSelection ui_dropdown_getselection(UiList *list);
194 void ui_dropdown_setselection(UiList *list, UiListSelection selection);
195
196 void ui_listbox_dynamic_update(UiList *list,
int i);
197 void ui_listbox_dynamic_setselection(UiList *list, UiListSelection sel);
198 UiListSelection ui_listbox_dynamic_getselection(UiList *list);
199
200 void ui_listbox_update(UiListBox *listbox,
int from,
int to);
201 void ui_listbox_update_sublist(UiListBox *listbox, UiListBoxSubList *sublist,
size_t listbox_insert_index);
202 void ui_listbox_list_update(UiList *list,
int i);
203 void ui_listbox_list_setselection(UiList *list, UiListSelection sel);
204 UiListSelection ui_listbox_list_getselection(UiList *list);
205
206 void ui_listbox_row_activate(GtkListBox *self, GtkListBoxRow *row, gpointer user_data);
207
208 #ifdef __cplusplus
209 }
210 #endif
211
212 #endif
213
214