using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Diagnostics; using System.Runtime.CompilerServices; using System.IO; using Barotrauma; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Graphics; using System.Xml; using System.Xml.Linq; namespace QICrabUI { public partial class CUIComponent { /// /// Should children be cut off by scissor rect, this is just visual, it's not the same as culling /// [CUISerializable] public bool HideChildrenOutsideFrame { get; set; } /// /// if child rect doesn't intersect with parent it won't be drawn and won't consume fps /// It also sets HideChildrenOutsideFrame /// [CUISerializable] public bool CullChildren { get => CUIProps.CullChildren.Value; set => CUIProps.CullChildren.SetValue(value); } /// /// It shouldn't be culled off even outside of parent bounds and even if parent demands so /// [CUISerializable] public bool UnCullable { get; set; } /// /// Will shift all children by this much, e.g. this is how scroll works /// It's also 3D /// [CUISerializable] public CUI3DOffset ChildrenOffset { get => CUIProps.ChildrenOffset.Value; set => CUIProps.ChildrenOffset.SetValue(value); } /// /// Limits to children positions /// public Func ChildrenBoundaries { get; set; } /// /// Should it ignore child offset? /// [CUISerializable] public bool Fixed { get; set; } /// /// this point of this component /// [CUISerializable] public Vector2 Anchor { get; set; } /// /// will be attached to this point of parent /// [CUISerializable] public Vector2? ParentAnchor { get; set; } /// /// Ghost components don't affect layout /// [CUISerializable] public CUIBool2 Ghost { get => CUIProps.Ghost.Value; set => CUIProps.Ghost.SetValue(value); } /// /// Components are drawn in order of their ZIndex /// Normally it's derived from component position in the tree, /// but this will override it /// [CUISerializable] public int? ZIndex { get => CUIProps.ZIndex.Value; set => CUIProps.ZIndex.SetValue(value); } /// /// If true component will set it's Absolute size to sprite texture size /// [CUISerializable] public bool ResizeToSprite { get => CUIProps.ResizeToSprite.Value; set => CUIProps.ResizeToSprite.SetValue(value); } /// /// Will be resized to fill empty space in list components /// [CUISerializable] public CUIBool2 FillEmptySpace { get => CUIProps.FillEmptySpace.Value; set => CUIProps.FillEmptySpace.SetValue(value); } /// /// Will resize itself to fit components with absolute size, e.g. text /// [CUISerializable] public CUIBool2 FitContent { get => CUIProps.FitContent.Value; set => CUIProps.FitContent.SetValue(value); } /// /// Absolute size and position in pixels /// [CUISerializable] public CUINullRect Absolute { get => CUIProps.Absolute.Value; set => CUIProps.Absolute.SetValue(value); } [CUISerializable] public CUINullRect AbsoluteMin { get => CUIProps.AbsoluteMin.Value; set => CUIProps.AbsoluteMin.SetValue(value); } [CUISerializable] public CUINullRect AbsoluteMax { get => CUIProps.AbsoluteMax.Value; set => CUIProps.AbsoluteMax.SetValue(value); } /// /// Relative to parent size and position, [0..1] /// [CUISerializable] public CUINullRect Relative { get => CUIProps.Relative.Value; set => CUIProps.Relative.SetValue(value); } [CUISerializable] public CUINullRect RelativeMin { get => CUIProps.RelativeMin.Value; set => CUIProps.RelativeMin.SetValue(value); } [CUISerializable] public CUINullRect RelativeMax { get => CUIProps.RelativeMax.Value; set => CUIProps.RelativeMax.SetValue(value); } /// /// It's like Relative, but to the opposite dimension /// E.g. Real.Width = CrossRelative.Width * Parent.Real.Height /// Handy for creating square things /// [CUISerializable] public CUINullRect CrossRelative { get => CUIProps.CrossRelative.Value; set => CUIProps.CrossRelative.SetValue(value); } /// /// Used in Grid, space separated Row sizes, either in pixels (123) or in % (123%) /// [CUISerializable] public string GridTemplateRows { get; set; } /// /// Used in Grid, space separated Columns sizes, either in pixels (123) or in % (123%) /// [CUISerializable] public string GridTemplateColumns { get; set; } /// /// Component will be placed in this cell in the grid component /// [CUISerializable] public Point? GridStartCell { get; set; } /// /// And resized to fit cells from GridStartCell to GridEndCell /// [CUISerializable] public Point? GridEndCell { get; set; } /// /// Sets both GridStartCell and GridEndCell at once /// public Point? GridCell { get => GridStartCell; set { GridStartCell = value; GridEndCell = value; } } } }