IDynamicGridUIComponent.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. IEnumerable<Tuple<object?, string>>? GetColumnFilterItems(DynamicColumnBase column);
  45. }
  46. public interface IDynamicGridUIComponent<T>
  47. where T : BaseObject, new()
  48. {
  49. IDynamicGridUIComponentParent<T> Parent { get; set; }
  50. FrameworkElement Control { get; }
  51. CoreRow[] SelectedRows { get; set; }
  52. double RowHeight { get; set; }
  53. double HeaderRowHeight { get; set; }
  54. int DesiredWidth();
  55. /// <summary>
  56. /// Do any required updates when the options list is changed.
  57. /// </summary>
  58. /// <returns>Whether the columns need to be reloaded.</returns>
  59. bool OptionsChanged();
  60. void UpdateRow(CoreRow row);
  61. void UpdateCell(CoreRow row, string column, object? value);
  62. void UpdateCell(CoreRow row, DynamicColumnBase column);
  63. void AddVisualFilter(string column, string value, FilterType filtertype = FilterType.Contains);
  64. List<Tuple<string, Func<CoreRow, bool>>> GetFilterPredicates();
  65. void BeforeRefresh();
  66. void RefreshColumns(IEnumerable<DynamicColumnBase> columns, DynamicGridColumnGroupings groupings);
  67. void RefreshData(CoreTable data);
  68. void AddPage(IEnumerable<CoreRow> page);
  69. void InvalidateRow(CoreRow row);
  70. void ScrollIntoView(CoreRow row);
  71. CoreRow[] GetVisibleRows();
  72. }