ILayoutable.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using Avalonia.Metadata;
  2. using Avalonia.VisualTree;
  3. namespace Avalonia.Layout
  4. {
  5. /// <summary>
  6. /// Defines layout-related functionality for a control.
  7. /// </summary>
  8. [NotClientImplementable]
  9. public interface ILayoutable : IVisual
  10. {
  11. /// <summary>
  12. /// Gets the size that this element computed during the measure pass of the layout process.
  13. /// </summary>
  14. Size DesiredSize { get; }
  15. /// <summary>
  16. /// Gets the width of the element.
  17. /// </summary>
  18. double Width { get; }
  19. /// <summary>
  20. /// Gets the height of the element.
  21. /// </summary>
  22. double Height { get; }
  23. /// <summary>
  24. /// Gets the minimum width of the element.
  25. /// </summary>
  26. double MinWidth { get; }
  27. /// <summary>
  28. /// Gets the maximum width of the element.
  29. /// </summary>
  30. double MaxWidth { get; }
  31. /// <summary>
  32. /// Gets the minimum height of the element.
  33. /// </summary>
  34. double MinHeight { get; }
  35. /// <summary>
  36. /// Gets the maximum height of the element.
  37. /// </summary>
  38. double MaxHeight { get; }
  39. /// <summary>
  40. /// Gets the margin around the element.
  41. /// </summary>
  42. Thickness Margin { get; }
  43. /// <summary>
  44. /// Gets the element's preferred horizontal alignment in its parent.
  45. /// </summary>
  46. HorizontalAlignment HorizontalAlignment { get; }
  47. /// <summary>
  48. /// Gets the element's preferred vertical alignment in its parent.
  49. /// </summary>
  50. VerticalAlignment VerticalAlignment { get; }
  51. /// <summary>
  52. /// Gets a value indicating whether the control's layout measure is valid.
  53. /// </summary>
  54. bool IsMeasureValid { get; }
  55. /// <summary>
  56. /// Gets a value indicating whether the control's layouts arrange is valid.
  57. /// </summary>
  58. bool IsArrangeValid { get; }
  59. /// <summary>
  60. /// Gets the available size passed in the previous layout pass, if any.
  61. /// </summary>
  62. Size? PreviousMeasure { get; }
  63. /// <summary>
  64. /// Gets the layout rect passed in the previous layout pass, if any.
  65. /// </summary>
  66. Rect? PreviousArrange { get; }
  67. /// <summary>
  68. /// Creates the visual children of the control, if necessary
  69. /// </summary>
  70. void ApplyTemplate();
  71. /// <summary>
  72. /// Carries out a measure of the control.
  73. /// </summary>
  74. /// <param name="availableSize">The available size for the control.</param>
  75. void Measure(Size availableSize);
  76. /// <summary>
  77. /// Arranges the control and its children.
  78. /// </summary>
  79. /// <param name="rect">The control's new bounds.</param>
  80. void Arrange(Rect rect);
  81. /// <summary>
  82. /// Invalidates the measurement of the control and queues a new layout pass.
  83. /// </summary>
  84. void InvalidateMeasure();
  85. /// <summary>
  86. /// Invalidates the arrangement of the control and queues a new layout pass.
  87. /// </summary>
  88. void InvalidateArrange();
  89. /// <summary>
  90. /// Called when a child control's desired size changes.
  91. /// </summary>
  92. /// <param name="control">The child control.</param>
  93. void ChildDesiredSizeChanged(ILayoutable control);
  94. /// <summary>
  95. /// Used by the <see cref="LayoutManager"/> to notify the control that its effective
  96. /// viewport is changed.
  97. /// </summary>
  98. /// <param name="e">The viewport information.</param>
  99. void EffectiveViewportChanged(EffectiveViewportChangedEventArgs e);
  100. }
  101. }