#pragma once
#include "../ui/tree.h"
#include "toolkit.h"
#include "dnd.h"
#include "../ui/container.h"
typedef struct UiTableColumn {
winrt::Microsoft::
UI::Xaml::Controls::Border header;
} UiTableColumn;
typedef struct UiTable {
winrt::Microsoft::
UI::Xaml::Controls::ScrollViewer scrollw;
winrt::Microsoft::
UI::Xaml::Controls::Grid grid;
winrt::Microsoft::
UI::Xaml::Media::SolidColorBrush defaultBrush;
winrt::Microsoft::
UI::Xaml::Media::SolidColorBrush highlightBrush;
winrt::Microsoft::
UI::Xaml::Media::SolidColorBrush selectedBrush;
winrt::Microsoft::
UI::Xaml::Media::SolidColorBrush selectedBorderBrush;
winrt::Microsoft::
UI::Xaml::Controls::Border resizedCol{ nullptr };
bool resize = false;
UiObject* obj;
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;
UiModel* model = nullptr;
std::vector<UiTableColumn> header;
ui_getvaluefunc getvalue = nullptr;
int maxrows =
0;
int lastSelection =
0;
ULONG64 lastPointerPress =
0;
std::vector<
int> selection;
UiTable(UiObject *obj, winrt::Microsoft::
UI::Xaml::Controls::ScrollViewer scrollW, winrt::Microsoft::
UI::Xaml::Controls::Grid grid);
~UiTable();
void add_header(UiModel* model);
void update(UiList* list,
int i);
void clear();
void row_background(
int row, winrt::Microsoft::
UI::Xaml::Media::Brush brush, winrt::Microsoft::
UI::Xaml::Media::Brush borderBrush);
void change_rows_bg(std::vector<
int> rows, winrt::Microsoft::
UI::Xaml::Media::Brush brush, winrt::Microsoft::
UI::Xaml::Media::Brush borderBrush);
bool is_row_selected(
int row);
void remove_from_selection(
int row);
UiListSelection uiselection();
void call_handler(ui_callback cb,
void *cbdata);
} UiTable;
extern "C" void ui_table_update(UiList * list,
int i);
extern "C" UiListSelection ui_table_selection(UiList * list);