ColumnStyle.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #if UNITY_2019_4_OR_NEWER
  2. using System;
  3. using UnityEditor;
  4. using UnityEngine;
  5. using UnityEditor.UIElements;
  6. using UnityEngine.UIElements;
  7. namespace YooAsset.Editor
  8. {
  9. public class ColumnStyle
  10. {
  11. public const float MaxValue = 8388608f;
  12. /// <summary>
  13. /// 单元列宽度
  14. /// </summary>
  15. public Length Width;
  16. /// <summary>
  17. /// 单元列最小宽度
  18. /// </summary>
  19. public Length MinWidth;
  20. /// <summary>
  21. /// 单元列最大宽度
  22. /// </summary>
  23. public Length MaxWidth;
  24. /// <summary>
  25. /// 可伸缩
  26. /// </summary>
  27. public bool Stretchable = false;
  28. /// <summary>
  29. /// 可搜索
  30. /// </summary>
  31. public bool Searchable = false;
  32. /// <summary>
  33. /// 可排序
  34. /// </summary>
  35. public bool Sortable = false;
  36. /// <summary>
  37. /// 统计数量
  38. /// </summary>
  39. public bool Counter = false;
  40. /// <summary>
  41. /// 展示单位
  42. /// </summary>
  43. public string Units = string.Empty;
  44. public ColumnStyle(Length width)
  45. {
  46. if (width.value > MaxValue)
  47. width = MaxValue;
  48. Width = width;
  49. MinWidth = width;
  50. MaxWidth = width;
  51. }
  52. public ColumnStyle(Length width, Length minWidth, Length maxWidth)
  53. {
  54. if (maxWidth.value > MaxValue)
  55. maxWidth = MaxValue;
  56. Width = width;
  57. MinWidth = minWidth;
  58. MaxWidth = maxWidth;
  59. }
  60. }
  61. }
  62. #endif