#ifndef TREE_H
#define TREE_H
#include "../ui/tree.h"
#include "toolkit.h"
#include <cx/array_list.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct UiColData UiColData;
typedef struct UiListView {
UiObject *obj;
GtkWidget *widget;
UiVar *var;
UiModel *model;
#if GTK_CHECK_VERSION(
4,
10,
0)
GListStore *liststore;
GtkSelectionModel *selectionmodel;
UiColData *columns;
#endif
ui_callback onactivate;
void *onactivatedata;
ui_callback onselection;
void *onselectiondata;
ui_callback ondragstart;
void *ondragstartdata;
ui_callback ondragcomplete;
void *ondragcompletedata;
ui_callback ondrop;
void *ondropdata;
UiListSelection selection;
} UiListView;
struct UiColData {
UiListView *listview;
int model_column;
int data_column;
};
typedef struct UiTreeEventData {
UiObject *obj;
ui_callback activate;
ui_callback selection;
void *activatedata;
void *selectiondata;
} UiTreeEventData;
typedef struct UiListBox UiListBox;
typedef struct UiListBoxSubList {
UiVar *var;
size_t numitems;
char *header;
UiBool separator;
CxList *widgets;
UiListBox *listbox;
void *userdata;
size_t index;
} UiListBoxSubList;
struct UiListBox {
UiObject *obj;
GtkListBox *listbox;
CxList *sublists;
ui_sublist_getvalue_func getvalue;
ui_callback onactivate;
void *onactivatedata;
ui_callback onbuttonclick;
void *onbuttonclickdata;
GtkListBoxRow *first_row;
};
#if GTK_CHECK_VERSION(
4,
10,
0)
void ui_update_liststore(GListStore *liststore, UiList *list);
void ui_listview_update2(UiList *list,
int i);
UiListSelection ui_listview_getselection2(UiList *list);
void ui_listview_setselection2(UiList *list, UiListSelection selection);
void ui_columnview_activate(
void *ignore, guint position, gpointer userdata);
void ui_listview_selection_changed(GtkSelectionModel* self, guint position, guint n_items, gpointer user_data);
void ui_dropdown_activate(GtkDropDown* self, gpointer userdata);
#endif
void* ui_strmodel_getvalue(
void *elm,
int column);
UIWIDGET ui_listview_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f,
void *udata);
UIWIDGET ui_table_var(UiObject *obj, UiVar *var, UiModel *model, UiListCallbacks cb);
GtkWidget* ui_get_tree_widget(
UIWIDGET widget);
void ui_listview_update(UiList *list,
int i);
UiListSelection ui_listview_getselection(UiList *list);
void ui_listview_setselection(UiList *list, UiListSelection selection);
void ui_combobox_destroy(GtkWidget *w, UiListView *v);
void ui_listview_destroy(GtkWidget *w, UiListView *v);
#if GTK_CHECK_VERSION(
4,
10,
0)
#else
void ui_listview_activate_event(
GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
UiTreeEventData *event);
void ui_listview_selection_event(
GtkTreeSelection *treeselection,
UiTreeEventData *event);
UiListSelection ui_listview_selection(
GtkTreeSelection *selection,
UiTreeEventData *event);
int ui_tree_path_list_index(GtkTreePath *path);
#endif
void ui_listview_add_dnd(UiListView *listview, UiListArgs *args);
void ui_listview_enable_drop(UiListView *listview, UiListArgs *args);
UIWIDGET ui_combobox_var(UiObject *obj, UiVar *var, ui_getvaluefunc getvalue, ui_callback f,
void *udata);
GtkWidget* ui_create_combobox(UiObject *obj, UiModel *model, UiVar *var, ui_callback f,
void *udata);
void ui_combobox_change_event(GtkComboBox *widget, UiEventData *e);
void ui_combobox_modelupdate(UiList *list,
int i);
UiListSelection ui_combobox_getselection(UiList *list);
void ui_combobox_setselection(UiList *list, UiListSelection selection);
void ui_listbox_update(UiListBox *listbox,
int from,
int to);
void ui_listbox_update_sublist(UiListBox *listbox, UiListBoxSubList *sublist,
size_t listbox_insert_index);
void ui_listbox_list_update(UiList *list,
int i);
void ui_listbox_row_activate(GtkListBox *self, GtkListBoxRow *row, gpointer user_data);
#ifdef __cplusplus
}
#endif
#endif