DynamicGridCommon.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using InABox.Core;
  5. namespace InABox.DynamicGrid
  6. {
  7. public abstract class DynamicColumnBase : BaseObject
  8. {
  9. }
  10. public enum DynamicGridOption
  11. {
  12. AddRows,
  13. EditRows,
  14. DeleteRows,
  15. FilterRows,
  16. SelectColumns,
  17. ExportData,
  18. ImportData,
  19. MultiSelect,
  20. DragSource,
  21. DragTarget,
  22. DirectEdit,
  23. ShowHelp,
  24. Print,
  25. RecordCount
  26. }
  27. public delegate bool OnFilterRecord(CoreRow row);
  28. public delegate void OnCreateItem(object sender, object item);
  29. public delegate T OnCreateItem<T>();
  30. public delegate void OnDefineLookup(ILookupEditorControl editor);
  31. public delegate void OnGridCustomiseEditor(DynamicEditorGrid sender, DynamicGridColumn column, BaseEditor editor);
  32. public delegate void OnFormCustomiseEditor(IDynamicEditorForm sender, object[] items, DynamicGridColumn column, BaseEditor editor);
  33. /// <summary>
  34. ///
  35. /// </summary>
  36. /// <typeparam name="T"></typeparam>
  37. /// <param name="sender"></param>
  38. /// <param name="items">The array of items being edited; <see langword="null"/> is synonymous with an empty array.</param>
  39. /// <param name="column"></param>
  40. /// <param name="editor"></param>
  41. public delegate void OnCustomiseEditor<T>(IDynamicEditorForm sender, T[]? items, DynamicGridColumn column, BaseEditor editor);
  42. public delegate void OnReconfigureEditors(DynamicEditorGrid sender);
  43. public delegate Dictionary<String,object?>? OnAfterEditorValueChanged(DynamicEditorGrid sender, String columnname);
  44. public delegate void OnGridChanged(IDynamicGrid sender);
  45. public delegate void OnLoadPage(IDynamicEditorPage page);
  46. public delegate void OnSelectPage(DynamicEditorGrid sender, BaseObject[]? items);
  47. public delegate void OnUnloadPage(IDynamicEditorPage page, bool saved);
  48. public delegate void OnCustomiseColumns(object sender, DynamicGridColumns columns);
  49. public delegate BaseEditor? OnGetEditor(DynamicGridColumn column);
  50. public delegate decimal OnGetEditorSequence(DynamicGridColumn column);
  51. public delegate IFilter? OnDefineFilter(Type type);
  52. public delegate IList<string>? OnValidateData(object sender, BaseObject[] items);
  53. public delegate void OnPrintData(object sender);
  54. public delegate void EntitySaveEvent(IDynamicEditorForm editor, BaseObject[] items);
  55. public class DynamicGridSelectionEventArgs : EventArgs
  56. {
  57. public DynamicGridSelectionEventArgs(CoreRow[]? rows)
  58. {
  59. Rows = rows;
  60. }
  61. public CoreRow[]? Rows { get; }
  62. }
  63. public delegate void SelectItemHandler(object sender, DynamicGridSelectionEventArgs e);
  64. public delegate void OnDoubleClick(object sender, HandledEventArgs args);
  65. public class DynamicGridCellClickEventArgs : HandledEventArgs
  66. {
  67. public CoreRow Row { get; set; }
  68. public DynamicGridColumn Column { get; set; }
  69. public DynamicGridCellClickEventArgs(CoreRow row, DynamicGridColumn column)
  70. {
  71. Row = row;
  72. Column = column;
  73. }
  74. }
  75. public delegate void OnCellDoubleClick(object sender, DynamicGridCellClickEventArgs args);
  76. public class BeforeRefreshEventArgs : CancelEventArgs { }
  77. public delegate void BeforeRefreshEventHandler(object sender, BeforeRefreshEventArgs args);
  78. public class AfterRefreshEventArgs : EventArgs { }
  79. public delegate void AfterRefreshEventHandler(object sender, AfterRefreshEventArgs args);
  80. }