using InABox.Core; using InABox.Wpf; using Syncfusion.Data; using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace InABox.DynamicGrid; public interface IDynamicGridUIComponentParent : IBaseDynamicGrid { bool IsRefreshing { get; } bool CanFilter(); bool CanSort(); DynamicGridRowStyleSelector RowStyleSelector { get; } void BeforeSelection(CancelEventArgs cancel); void SelectItems(CoreRow[] rows); void HandleKey(KeyEventArgs args); void LoadColumnsMenu(ContextMenu menu); BaseEditor CustomiseEditor(DynamicGridColumn column, BaseEditor editor); void DoubleClickCell(CoreRow? row, DynamicColumnBase? column); void ExecuteActionColumn(DynamicActionColumn column, CoreRow[]? rows); void OpenColumnMenu(DynamicColumnBase column); void UpdateRecordCount(int count); public bool IsDirectEditMode(); void DragOver(object sender, DragEventArgs e); void Drop(object sender, DragEventArgs e); void DragStart(object? sender, CoreRow[] rows); /// /// Move the given rows from where they are, inserting them at . (i.e., before the row at the given index). /// To insert at the end, set to the number of rows. /// /// /// Only applicable if is . /// void MoveRows(CoreRow[] rows, int index); void UIFilterChanged(object sender); void UpdateData(CoreRow row, string changedColumn, Dictionary updates); } public interface IDynamicGridUIComponentParent : IDynamicGrid, IDynamicGridUIComponentParent where T : BaseObject, new() { void UpdateData(T obj, CoreRow row, string changedColumn, Dictionary updates); void EntityChanged(T obj, CoreRow row, string changedColumn, Dictionary changes); } public interface IDynamicGridUIComponent { IDynamicGridUIComponentParent Parent { get; set; } FrameworkElement Control { get; } CoreRow[] SelectedRows { get; set; } double RowHeight { get; set; } double HeaderRowHeight { get; set; } int DesiredWidth(); /// /// Do any required updates when the options list is changed. /// /// Whether the columns need to be reloaded. bool OptionsChanged(); void UpdateRow(CoreRow row); void UpdateCell(CoreRow row, string column, object? value); void UpdateCell(CoreRow row, DynamicColumnBase column); void AddVisualFilter(string column, string value, FilterType filtertype = FilterType.Contains); List>> GetFilterPredicates(); void BeforeRefresh(); void RefreshColumns(IEnumerable columns, DynamicGridColumnGroupings groupings); void RefreshData(CoreTable data); void AddPage(IEnumerable page); void InvalidateRow(CoreRow row); void ScrollIntoView(CoreRow row); CoreRow[] GetVisibleRows(); } public interface IDynamicGridUIComponent : IDynamicGridUIComponent where T : BaseObject, new() { new IDynamicGridUIComponentParent Parent { get; set; } IDynamicGridUIComponentParent IDynamicGridUIComponent.Parent { get => Parent; set => Parent = (IDynamicGridUIComponentParent)value; } }