IDynamicGridUIComponent.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using InABox.Core;
  2. using InABox.Wpf;
  3. using Syncfusion.Data;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  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 CanFilter();
  18. bool CanSort();
  19. DynamicGridRowStyleSelector<T> RowStyleSelector { get; }
  20. void BeforeSelection(CancelEventArgs cancel);
  21. void SelectItems(CoreRow[] rows);
  22. void HandleKey(KeyEventArgs args);
  23. void LoadColumnsMenu(ContextMenu menu);
  24. BaseEditor CustomiseEditor(DynamicGridColumn column, BaseEditor editor);
  25. void DoubleClickCell(CoreRow? row, DynamicColumnBase? column);
  26. void ExecuteActionColumn(DynamicActionColumn column, CoreRow[]? rows);
  27. void OpenColumnMenu(DynamicColumnBase column);
  28. void UpdateData(T obj, CoreRow row, string changedColumn, Dictionary<CoreColumn, object?> updates);
  29. void EntityChanged(T obj, CoreRow row, string changedColumn, Dictionary<string, object?> changes);
  30. void UpdateRecordCount(int count);
  31. public bool IsDirectEditMode();
  32. void DragOver(object sender, DragEventArgs e);
  33. void Drop(object sender, DragEventArgs e);
  34. void DragStart(object? sender, CoreRow[] rows);
  35. /// <summary>
  36. /// Move the given rows from where they are, inserting them at <paramref name="index"/>. (i.e., before the row at the given index).
  37. /// To insert at the end, set <paramref name="index"/> to the number of rows.
  38. /// </summary>
  39. /// <remarks>
  40. /// Only applicable if <typeparamref name="T"/> is <see cref="ISequenceable"/>.
  41. /// </remarks>
  42. void MoveRows(CoreRow[] rows, int index);
  43. void UIFilterChanged(object sender);
  44. }
  45. public interface IDynamicGridUIComponent<T>
  46. where T : BaseObject, new()
  47. {
  48. IDynamicGridUIComponentParent<T> Parent { get; set; }
  49. FrameworkElement Control { get; }
  50. CoreRow[] SelectedRows { get; set; }
  51. double RowHeight { get; set; }
  52. double HeaderRowHeight { get; set; }
  53. int DesiredWidth();
  54. /// <summary>
  55. /// Do any required updates when the options list is changed.
  56. /// </summary>
  57. /// <returns>Whether the columns need to be reloaded.</returns>
  58. bool OptionsChanged();
  59. void UpdateRow(CoreRow row);
  60. void UpdateCell(CoreRow row, string column, object? value);
  61. void UpdateCell(CoreRow row, DynamicColumnBase column);
  62. void AddVisualFilter(string column, string value, FilterType filtertype = FilterType.Contains);
  63. List<Tuple<string, Func<CoreRow, bool>>> GetFilterPredicates();
  64. void BeforeRefresh();
  65. void RefreshColumns(IEnumerable<DynamicColumnBase> columns, DynamicGridColumnGroupings groupings);
  66. void RefreshData(CoreTable data);
  67. void AddPage(IEnumerable<CoreRow> page);
  68. void InvalidateRow(CoreRow row);
  69. void ScrollIntoView(CoreRow row);
  70. CoreRow[] GetVisibleRows();
  71. }