// Copyright (c) Wojciech Figat. All rights reserved. using FlaxEngine; using FlaxEngine.GUI; namespace FlaxEditor.GUI { /// /// Table column descriptor. /// [HideInEditor] public class ColumnDefinition { /// /// Converts raw cell value to the string used by the column formatting policy. /// /// The value. /// The value string. public delegate string ValueFormatDelegate(object value); /// /// True if use expand/collapse rows feature for this column. See property which is used to describe the rows hierarchy. /// public bool UseExpandCollapseMode; /// /// The cell text alignment horizontally. /// public TextAlignment CellAlignment = TextAlignment.Far; /// /// The column title. /// public string Title; /// /// The title font. /// public Font TitleFont; /// /// The column title text color. /// public Color TitleColor = Color.White; /// /// The column title background color. /// public Color TitleBackgroundColor = Color.Brown; /// /// The column title horizontal text alignment /// public TextAlignment TitleAlignment = TextAlignment.Center; /// /// The column title margin. /// public Margin TitleMargin = new Margin(4, 4, 0, 0); /// /// The minimum size (in pixels) of the column. /// public float MinSize = 10.0f; /// /// The minimum size percentage of the column (in range 0-100). /// public float MinSizePercentage = 0.0f; /// /// The maximum size (in pixels) of the column. /// public float MaxSize = float.MaxValue; /// /// The maximum size percentage of the column (in range 0-100). /// public float MaxSizePercentage = 1.0f; /// /// The value formatting delegate. /// public ValueFormatDelegate FormatValue; /// /// Clamps the size of the column (in percentage size of the table). /// /// The percentage size of the column (split value). /// Size of the table (width in pixels). /// The clamped percentage size of the column (split value). public float ClampColumnSize(float value, float tableSize) { float width = Mathf.Clamp(value, MinSizePercentage, MaxSizePercentage) * tableSize; return Mathf.Clamp(width, MinSize, MaxSize) / tableSize; } } }