| 30 #include "list.h" |
30 #include "list.h" |
| 31 #include "container.h" |
31 #include "container.h" |
| 32 |
32 |
| 33 #include "../common/context.h" |
33 #include "../common/context.h" |
| 34 |
34 |
| 35 |
35 UiListView* ui_create_treeview(UiObject *obj, UiTreeArgs *args) { |
| |
36 UiListView *treeview = malloc(sizeof(UiListView)); |
| |
37 memset(treeview, 0, sizeof(UiListView)); |
| |
38 treeview->obj = obj; |
| |
39 treeview->model = args->model; |
| |
40 treeview->multiselection = args->multiselection; |
| |
41 treeview->onactivate = args->onactivate; |
| |
42 treeview->onactivatedata = args->onactivatedata; |
| |
43 treeview->onactivate_action = args->onactivate_action ? strdup(args->onactivate_action) : NULL; |
| |
44 treeview->onselection = args->onselection; |
| |
45 treeview->onselectiondata = args->onselectiondata; |
| |
46 treeview->onselection_action = args->onselection_action ? strdup(args->onselection_action) : NULL; |
| |
47 treeview->ondragstart = args->ondragstart; |
| |
48 treeview->ondragstartdata = args->ondragstartdata; |
| |
49 treeview->ondragstart_action = args->ondragstart_action ? strdup(args->ondragstart_action) : NULL; |
| |
50 treeview->ondragcomplete = args->ondragcomplete; |
| |
51 treeview->ondragcompletedata = args->ondragcompletedata; |
| |
52 treeview->ondragcomplete_action = args->ondragcomplete_action ? strdup(args->ondragcomplete_action) : NULL; |
| |
53 treeview->ondrop = args->ondrop; |
| |
54 treeview->ondropdata = args->ondropdata; |
| |
55 treeview->ondrop_action = args->ondrop_action ? strdup(args->ondrop_action) : NULL; |
| |
56 treeview->selection.count = 0; |
| |
57 treeview->selection.rows = NULL; |
| |
58 treeview->current_row = -1; |
| |
59 |
| |
60 #if GTK_CHECK_VERSION(4, 0, 0) |
| |
61 treeview->coldata.listview = treeview; |
| |
62 treeview->coldata.column = 0; |
| |
63 #endif |
| |
64 |
| |
65 if(args->getvalue != NULL) { |
| |
66 treeview->getvalue = args->getvalue; |
| |
67 treeview->getvaluedata = args->getvaluedata; |
| |
68 } else { |
| |
69 args->getvalue = ui_null_getvalue; |
| |
70 } |
| |
71 |
| |
72 treeview->istreeview = TRUE; |
| |
73 treeview->getdepth = args->getdepth; |
| |
74 treeview->getdepthdata = args->getdepthdata; |
| |
75 |
| |
76 return treeview; |
| |
77 } |