| 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 26 * POSSIBILITY OF SUCH DAMAGE. |
26 * POSSIBILITY OF SUCH DAMAGE. |
| 27 */ |
27 */ |
| 28 |
28 |
| 29 #ifndef TREE_H |
29 #ifndef LIST_H |
| 30 #define TREE_H |
30 #define LIST_H |
| 31 |
31 |
| 32 #include "../ui/tree.h" |
32 #include "../ui/list.h" |
| 33 #include "toolkit.h" |
33 #include "toolkit.h" |
| 34 |
34 |
| 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 |
40 |
| |
41 typedef struct UiListView UiListView; |
| 41 typedef struct UiColData UiColData; |
42 typedef struct UiColData UiColData; |
| 42 |
43 |
| 43 #if GTK_CHECK_VERSION(4, 10, 0) |
44 #if GTK_CHECK_VERSION(4, 10, 0) |
| 44 typedef struct UiRowItems { |
45 typedef struct UiRowItems { |
| 45 int bound; |
46 int bound; |
| 46 GtkListItem *items[]; |
47 GtkListItem *items[]; |
| 47 } UiRowItems; |
48 } UiRowItems; |
| 48 #endif |
49 #endif |
| 49 |
50 |
| 50 typedef struct UiListView { |
51 struct UiColData { |
| |
52 UiListView *listview; |
| |
53 int column; |
| |
54 }; |
| |
55 |
| |
56 struct UiListView { |
| 51 UiObject *obj; |
57 UiObject *obj; |
| 52 GtkWidget *widget; |
58 GtkWidget *widget; |
| 53 UiVar *var; |
59 UiVar *var; |
| 54 UiModel *model; |
60 UiModel *model; |
| |
61 UiBool multiselection; |
| 55 ui_getvaluefunc2 getvalue; |
62 ui_getvaluefunc2 getvalue; |
| 56 void *getvaluedata; |
63 void *getvaluedata; |
| 57 ui_getstylefunc getstyle; |
64 ui_getstylefunc getstyle; |
| 58 void *getstyledata; |
65 void *getstyledata; |
| 59 char **elements; |
66 char **elements; |
| 63 UiBool apply_row_style; |
70 UiBool apply_row_style; |
| 64 #if GTK_CHECK_VERSION(4, 10, 0) |
71 #if GTK_CHECK_VERSION(4, 10, 0) |
| 65 CxMap *bound_rows; |
72 CxMap *bound_rows; |
| 66 GListStore *liststore; |
73 GListStore *liststore; |
| 67 GtkSelectionModel *selectionmodel; |
74 GtkSelectionModel *selectionmodel; |
| 68 UiColData *columns; |
75 int *columns; |
| 69 int numcolumns; |
76 int numcolumns; |
| |
77 UiColData coldata; |
| 70 PangoAttrList *current_row_attributes; |
78 PangoAttrList *current_row_attributes; |
| 71 #else |
79 #else |
| 72 int style_offset; |
80 int style_offset; |
| 73 #endif |
81 #endif |
| 74 ui_callback onactivate; |
82 ui_callback onactivate; |
| 134 #if GTK_CHECK_VERSION(4, 10, 0) |
136 #if GTK_CHECK_VERSION(4, 10, 0) |
| 135 |
137 |
| 136 void ui_update_liststore(GListStore *liststore, UiList *list); |
138 void ui_update_liststore(GListStore *liststore, UiList *list); |
| 137 void ui_update_liststore_static(GListStore *liststore, char **elm, size_t nelm); |
139 void ui_update_liststore_static(GListStore *liststore, char **elm, size_t nelm); |
| 138 |
140 |
| |
141 void ui_listview_update_model(UiModel *model, void *userdata, int insert_index, int delete_index); |
| 139 void ui_listview_update2(UiList *list, int i); |
142 void ui_listview_update2(UiList *list, int i); |
| 140 UiListSelection ui_listview_getselection2(UiList *list); |
143 UiListSelection ui_listview_getselection2(UiList *list); |
| 141 void ui_listview_setselection2(UiList *list, UiListSelection selection); |
144 void ui_listview_setselection2(UiList *list, UiListSelection selection); |
| 142 |
145 |
| 143 void ui_dropdown_notify(GtkWidget *dropdown, GObject *pspec, gpointer userdata); |
146 void ui_dropdown_notify(GtkWidget *dropdown, GObject *pspec, gpointer userdata); |
| 153 UIWIDGET ui_listview_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata); |
156 UIWIDGET ui_listview_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata); |
| 154 UIWIDGET ui_table_var(UiObject *obj, UiVar *var, UiModel *model, UiListCallbacks cb); |
157 UIWIDGET ui_table_var(UiObject *obj, UiVar *var, UiModel *model, UiListCallbacks cb); |
| 155 |
158 |
| 156 GtkWidget* ui_get_tree_widget(UIWIDGET widget); |
159 GtkWidget* ui_get_tree_widget(UIWIDGET widget); |
| 157 |
160 |
| |
161 void ui_listview_update_model(UiModel *model, void *userdata, int insert_index, int delete_index); |
| 158 void ui_listview_update(UiList *list, int i); |
162 void ui_listview_update(UiList *list, int i); |
| 159 UiListSelection ui_listview_getselection(UiList *list); |
163 UiListSelection ui_listview_getselection(UiList *list); |
| 160 void ui_listview_setselection(UiList *list, UiListSelection selection); |
164 void ui_listview_setselection(UiList *list, UiListSelection selection); |
| 161 |
165 |
| 162 void ui_combobox_destroy(GtkWidget *w, UiListView *v); |
166 void ui_combobox_destroy(GtkWidget *w, UiListView *v); |
| 184 |
188 |
| 185 UIWIDGET ui_combobox_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata); |
189 UIWIDGET ui_combobox_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f, void *udata); |
| 186 GtkWidget* ui_create_combobox(UiObject *obj, UiModel *model, UiVar *var, char **elm, size_t nelm, 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); |
| 187 void ui_combobox_change_event(GtkComboBox *widget, UiEventData *e); |
191 void ui_combobox_change_event(GtkComboBox *widget, UiEventData *e); |
| 188 void ui_combobox_modelupdate(UiList *list, int i); |
192 void ui_combobox_modelupdate(UiList *list, int i); |
| 189 UiListSelection ui_combobox_getselection(UiList *list); |
193 UiListSelection ui_dropdown_getselection(UiList *list); |
| 190 void ui_combobox_setselection(UiList *list, UiListSelection selection); |
194 void ui_dropdown_setselection(UiList *list, UiListSelection selection); |
| 191 |
195 |
| 192 void ui_listbox_dynamic_update(UiList *list, int i); |
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 |
| 193 void ui_listbox_update(UiListBox *listbox, int from, int to); |
200 void ui_listbox_update(UiListBox *listbox, int from, int to); |
| 194 void ui_listbox_update_sublist(UiListBox *listbox, UiListBoxSubList *sublist, size_t listbox_insert_index); |
201 void ui_listbox_update_sublist(UiListBox *listbox, UiListBoxSubList *sublist, size_t listbox_insert_index); |
| 195 void ui_listbox_list_update(UiList *list, int i); |
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); |
| 196 |
205 |
| 197 void ui_listbox_row_activate(GtkListBox *self, GtkListBoxRow *row, gpointer user_data); |
206 void ui_listbox_row_activate(GtkListBox *self, GtkListBoxRow *row, gpointer user_data); |
| 198 |
207 |
| 199 #ifdef __cplusplus |
208 #ifdef __cplusplus |
| 200 } |
209 } |
| 201 #endif |
210 #endif |
| 202 |
211 |
| 203 #endif /* TREE_H */ |
212 #endif /* LIST_H */ |
| 204 |
213 |