IDynamicGridUIComponent.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using InABox.Core;
  2. using Syncfusion.Data;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Input;
  12. namespace InABox.DynamicGrid;
  13. public interface IDynamicGridUIComponentParent<T> : IDynamicGrid<T>
  14. where T : BaseObject, new()
  15. {
  16. bool IsRefreshing { get; }
  17. bool CanSort();
  18. DynamicGridRowStyleSelector<T> RowStyleSelector { get; }
  19. void BeforeSelection(CancelEventArgs cancel);
  20. void SelectItems(CoreRow[] rows);
  21. void HandleKey(KeyEventArgs args);
  22. void LoadColumnsMenu(ContextMenu menu);
  23. BaseEditor CustomiseEditor(DynamicGridColumn column, BaseEditor editor);
  24. void DoubleClickCell(CoreRow? row, DynamicColumnBase? column);
  25. void ExecuteActionColumn(DynamicActionColumn column, CoreRow[]? rows);
  26. void OpenColumnMenu(DynamicColumnBase column);
  27. void UpdateData(T obj, CoreRow row, string changedColumn, Dictionary<CoreColumn, object?> updates);
  28. void EntityChanged(T obj, CoreRow row, string changedColumn, Dictionary<string, object?> changes);
  29. void UpdateRecordCount(int count);
  30. public bool IsDirectEditMode();
  31. void DragOver(object sender, DragEventArgs e);
  32. void Drop(object sender, DragEventArgs e);
  33. void DragStart(object? sender, CoreRow[] rows);
  34. void UIFilterChanged(object sender);
  35. IEnumerable<string>? GetColumnFilterItems(DynamicColumnBase column);
  36. }
  37. public interface IDynamicGridUIComponent<T>
  38. where T : BaseObject, new()
  39. {
  40. IDynamicGridUIComponentParent<T> Parent { get; set; }
  41. FrameworkElement Control { get; }
  42. CoreRow[] SelectedRows { get; set; }
  43. double RowHeight { get; set; }
  44. double HeaderRowHeight { get; set; }
  45. int DesiredWidth();
  46. /// <summary>
  47. /// Do any required updates when the options list is changed.
  48. /// </summary>
  49. /// <returns>Whether the columns need to be reloaded.</returns>
  50. bool OptionsChanged();
  51. void UpdateRow(CoreRow row);
  52. void UpdateCell(CoreRow row, string column, object? value);
  53. void UpdateCell(CoreRow row, DynamicColumnBase column);
  54. void AddVisualFilter(string column, string value, FilterType filtertype = FilterType.Contains);
  55. List<Tuple<string, Func<CoreRow, bool>>> GetFilterPredicates();
  56. void BeforeRefresh();
  57. void RefreshColumns(DynamicGridColumns columns, DynamicActionColumns actionColumns, DynamicGridColumnGroupings groupings);
  58. void RefreshData(CoreTable data);
  59. void AddPage(IEnumerable<CoreRow> page);
  60. void InvalidateRow(CoreRow row);
  61. void ScrollIntoView(CoreRow row);
  62. CoreRow[] GetVisibleRows();
  63. }