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 #pragma once
30
31 #include "../ui/tree.h"
32 #include "toolkit.h"
33 #include "dnd.h"
34
35 #include "../ui/container.h"
36
37
38 typedef struct UiTableColumn {
39 winrt::Microsoft::
UI::Xaml::Controls::Border header;
40
41 } UiTableColumn;
42
43 typedef struct UiTable {
44 winrt::Microsoft::
UI::Xaml::Controls::ScrollViewer scrollw;
45 winrt::Microsoft::
UI::Xaml::Controls::Grid grid;
46 winrt::Microsoft::
UI::Xaml::Media::SolidColorBrush defaultBrush;
47 winrt::Microsoft::
UI::Xaml::Media::SolidColorBrush highlightBrush;
48 winrt::Microsoft::
UI::Xaml::Media::SolidColorBrush selectedBrush;
49 winrt::Microsoft::
UI::Xaml::Media::SolidColorBrush selectedBorderBrush;
50
51 winrt::Microsoft::
UI::Xaml::Controls::Border resizedCol{ nullptr };
52 bool resize = false;
53
54 UiObject* obj;
55 ui_callback onactivate;
56 void* onactivatedata;
57 ui_callback onselection;
58 void* onselectiondata;
59 ui_callback ondragstart;
60 void* ondragstartdata;
61 ui_callback ondragcomplete;
62 void* ondragcompletedata;
63 ui_callback ondrop;
64 void* ondropdata;
65 UiModel* model = nullptr;
66 std::vector<UiTableColumn> header;
67 ui_getvaluefunc getvalue = nullptr;
68 int maxrows =
0;
69 int lastSelection =
0;
70 ULONG64 lastPointerPress =
0;
71 std::vector<
int> selection;
72
73 UiTable(UiObject *obj, winrt::Microsoft::
UI::Xaml::Controls::ScrollViewer scrollW, winrt::Microsoft::
UI::Xaml::Controls::Grid grid);
74
75 ~UiTable();
76
77 void add_header(UiModel* model);
78
79 void update(UiList* list,
int i);
80
81 void clear();
82
83 void row_background(
int row, winrt::Microsoft::
UI::Xaml::Media::Brush brush, winrt::Microsoft::
UI::Xaml::Media::Brush borderBrush);
84
85 void change_rows_bg(std::vector<
int> rows, winrt::Microsoft::
UI::Xaml::Media::Brush brush, winrt::Microsoft::
UI::Xaml::Media::Brush borderBrush);
86
87 bool is_row_selected(
int row);
88
89 void remove_from_selection(
int row);
90
91 UiListSelection uiselection();
92
93 void call_handler(ui_callback cb,
void *cbdata);
94 } UiTable;
95
96 extern "C" void ui_table_update(UiList * list,
int i);
97
98 extern "C" UiListSelection ui_table_selection(UiList * list);
99