CrabUI
Loading...
Searching...
No Matches
Layout Props.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Reflection;
5using System.Diagnostics;
6using System.Runtime.CompilerServices;
7using System.IO;
8
9using Barotrauma;
10using Microsoft.Xna.Framework;
11using Microsoft.Xna.Framework.Input;
12using Microsoft.Xna.Framework.Graphics;
13
14using System.Xml;
15using System.Xml.Linq;
16
17namespace CrabUI
18{
19 public partial class CUIComponent
20 {
21 /// <summary>
22 /// Should children be cut off by scissor rect, this is just visual, it's not the same as culling
23 /// </summary>
24 [CUISerializable] public bool HideChildrenOutsideFrame { get; set; }
25 /// <summary>
26 /// if child rect doesn't intersect with parent it won't be drawn and won't consume fps
27 /// It also sets HideChildrenOutsideFrame
28 /// </summary>
29 [CUISerializable]
30 public bool CullChildren
31 {
32 get => CUIProps.CullChildren.Value;
33 set => CUIProps.CullChildren.SetValue(value);
34 }
35
36 /// <summary>
37 /// It shouldn't be culled off even outside of parent bounds and even if parent demands so
38 /// </summary>
39 [CUISerializable] public bool UnCullable { get; set; }
40 /// <summary>
41 /// Will shift all children by this much, e.g. this is how scroll works
42 /// It's also 3D
43 /// </summary>
44 [CUISerializable]
46 {
47 get => CUIProps.ChildrenOffset.Value;
48 set => CUIProps.ChildrenOffset.SetValue(value);
49 }
50
51 /// <summary>
52 /// Limits to children positions
53 /// </summary>
54 public Func<CUIRect, CUIBoundaries> ChildrenBoundaries { get; set; }
55
56 /// <summary>
57 /// Should it ignore child offset?
58 /// </summary>
59 [CUISerializable] public bool Fixed { get; set; }
60 /// <summary>
61 /// this point of this component
62 /// </summary>
63 [CUISerializable] public Vector2 Anchor { get; set; }
64 /// <summary>
65 /// will be attached to this point of parent
66 /// </summary>
67 [CUISerializable] public Vector2? ParentAnchor { get; set; }
68
69 /// <summary>
70 /// Ghost components don't affect layout
71 /// </summary>
72 [CUISerializable]
74 {
75 get => CUIProps.Ghost.Value;
76 set => CUIProps.Ghost.SetValue(value);
77 }
78 /// <summary>
79 /// Components are drawn in order of their ZIndex
80 /// Normally it's derived from component position in the tree,
81 /// but this will override it
82 /// </summary>
83 [CUISerializable]
84 public int? ZIndex
85 {
86 get => CUIProps.ZIndex.Value;
87 set => CUIProps.ZIndex.SetValue(value);
88 }
89
90
91 /// <summary>
92 /// If true component will set it's Absolute size to sprite texture size
93 /// </summary>
94 [CUISerializable]
95 public bool ResizeToSprite
96 {
97 get => CUIProps.ResizeToSprite.Value;
98 set => CUIProps.ResizeToSprite.SetValue(value);
99 }
100
101 /// <summary>
102 /// Will be resized to fill empty space in list components
103 /// </summary>
104 [CUISerializable]
106 {
107 get => CUIProps.FillEmptySpace.Value;
108 set => CUIProps.FillEmptySpace.SetValue(value);
109 }
110 /// <summary>
111 /// Will resize itself to fit components with absolute size, e.g. text
112 /// </summary>
113 [CUISerializable]
115 {
116 get => CUIProps.FitContent.Value;
117 set => CUIProps.FitContent.SetValue(value);
118 }
119 /// <summary>
120 /// Absolute size and position in pixels
121 /// </summary>
122 [CUISerializable]
124 {
125 get => CUIProps.Absolute.Value;
126 set => CUIProps.Absolute.SetValue(value);
127 }
128 [CUISerializable]
129 public CUINullRect AbsoluteMin
130 {
131 get => CUIProps.AbsoluteMin.Value;
132 set => CUIProps.AbsoluteMin.SetValue(value);
133 }
134 [CUISerializable]
135 public CUINullRect AbsoluteMax
136 {
137 get => CUIProps.AbsoluteMax.Value;
138 set => CUIProps.AbsoluteMax.SetValue(value);
139 }
140 /// <summary>
141 /// Relative to parent size and position, [0..1]
142 /// </summary>
143 [CUISerializable]
145 {
146 get => CUIProps.Relative.Value;
147 set => CUIProps.Relative.SetValue(value);
148 }
149 [CUISerializable]
150 public CUINullRect RelativeMin
151 {
152 get => CUIProps.RelativeMin.Value;
153 set => CUIProps.RelativeMin.SetValue(value);
154 }
155 [CUISerializable]
156 public CUINullRect RelativeMax
157 {
158 get => CUIProps.RelativeMax.Value;
159 set => CUIProps.RelativeMax.SetValue(value);
160 }
161 /// <summary>
162 /// It's like Relative, but to the opposite dimension
163 /// E.g. Real.Width = CrossRelative.Width * Parent.Real.Height
164 /// Handy for creating square things
165 /// </summary>
166 [CUISerializable]
168 {
169 get => CUIProps.CrossRelative.Value;
170 set => CUIProps.CrossRelative.SetValue(value);
171 }
172
173 /// <summary>
174 /// Used in Grid, space separated Row sizes, either in pixels (123) or in % (123%)
175 /// </summary>
176 [CUISerializable] public string GridTemplateRows { get; set; }
177 /// <summary>
178 /// Used in Grid, space separated Columns sizes, either in pixels (123) or in % (123%)
179 /// </summary>
180 [CUISerializable] public string GridTemplateColumns { get; set; }
181 /// <summary>
182 /// Component will be placed in this cell in the grid component
183 /// </summary>
184 [CUISerializable] public Point? GridStartCell { get; set; }
185 /// <summary>
186 /// And resized to fit cells from GridStartCell to GridEndCell
187 /// </summary>
188 [CUISerializable] public Point? GridEndCell { get; set; }
189 /// <summary>
190 /// Sets both GridStartCell and GridEndCell at once
191 /// </summary>
192 public Point? GridCell
193 {
194 get => GridStartCell;
195 set
196 {
197 GridStartCell = value;
198 GridEndCell = value;
199 }
200 }
201
202
203 }
204}
CUIBool2 FillEmptySpace
Will be resized to fill empty space in list components.
CUINullRect Relative
Relative to parent size and position, [0..1].
CUI3DOffset ChildrenOffset
Will shift all children by this much, e.g. this is how scroll works It's also 3D.
Point? GridCell
Sets both GridStartCell and GridEndCell at once.
bool ResizeToSprite
If true component will set it's Absolute size to sprite texture size.
CUIComponentProps CUIProps
Just a wrapper for CUIProps idk how to separate them better.
Definition CUIProps.cs:27
string GridTemplateColumns
Used in Grid, space separated Columns sizes, either in pixels (123) or in % (123%)
Vector2 Anchor
this point of this component
bool HideChildrenOutsideFrame
Should children be cut off by scissor rect, this is just visual, it's not the same as culling.
CUIBool2 FitContent
Will resize itself to fit components with absolute size, e.g. text.
string GridTemplateRows
Used in Grid, space separated Row sizes, either in pixels (123) or in % (123%)
bool Fixed
Should it ignore child offset?
CUINullRect CrossRelative
It's like Relative, but to the opposite dimension E.g. Real.Width = CrossRelative....
Point? GridStartCell
Component will be placed in this cell in the grid component.
bool UnCullable
It shouldn't be culled off even outside of parent bounds and even if parent demands so.
Func< CUIRect, CUIBoundaries > ChildrenBoundaries
Limits to children positions.
Vector2? ParentAnchor
will be attached to this point of parent
bool CullChildren
if child rect doesn't intersect with parent it won't be drawn and won't consume fps It also sets Hi...
Point? GridEndCell
And resized to fit cells from GridStartCell to GridEndCell.
CUIBool2 Ghost
Ghost components don't affect layout.
int? ZIndex
Components are drawn in order of their ZIndex Normally it's derived from component position in the ...
CUINullRect Absolute
Absolute size and position in pixels.
Offset of child components with X, Y, Z.
Vector2 but with bools.
Definition CUIBool2.cs:17
Rectangle with float?
Definition CUIRect.cs:104