CrabUI
Loading...
Searching...
No Matches
CrabUI.CUILayoutGrid Class Reference

A Grid containing children in its cells
Dividing host into rows and columns basing on GridTemplate
And then placing children basin on their GridCell. More...

Inheritance diagram for CrabUI.CUILayoutGrid:
CrabUI.CUILayout

Public Types

enum  TrackSizeType { Unknown , Absolute , Relative , Fractional }
 

Public Member Functions

void CalculateTracks ()
 
 CUILayoutGrid (CUIComponent host)
 
- Public Member Functions inherited from CrabUI.CUILayout
void ForceMarkUnchanged ()
 This is just for debug, don't use it.
 
 CUILayout (CUIComponent host)
 
override string ToString ()
 

Additional Inherited Members

- Static Public Member Functions inherited from CrabUI.CUILayout
static CUILayout Parse (string raw)
 
- Public Attributes inherited from CrabUI.CUILayout
CUIComponent Host
 
- Protected Attributes inherited from CrabUI.CUILayout
bool changed = true
 
bool absoluteChanged = true
 
bool decorChanged = true
 
- Package Functions inherited from CrabUI.CUILayout
- Properties inherited from CrabUI.CUILayout
bool Changed [get, set]
 
bool SelfAndParentChanged [set]
 It doesn't optimize anything.
 
bool ChildChanged [set]
 
bool AbsoluteChanged [get, set]
 
bool DecorChanged [get, set]
 

Detailed Description

A Grid containing children in its cells
Dividing host into rows and columns basing on GridTemplate
And then placing children basin on their GridCell.

Definition at line 18 of file CUILayoutGrid.cs.

Member Enumeration Documentation

◆ TrackSizeType

enum CrabUI.CUILayoutGrid.TrackSizeType

Definition at line 20 of file CUILayoutGrid.cs.

21 {
22 Unknown,
23 Absolute,
24 Relative,
25 Fractional,
26 }

Constructor & Destructor Documentation

◆ CUILayoutGrid() [1/2]

CrabUI.CUILayoutGrid.CUILayoutGrid ( )

Definition at line 181 of file CUILayoutGrid.cs.

181: base() { }

◆ CUILayoutGrid() [2/2]

CrabUI.CUILayoutGrid.CUILayoutGrid ( CUIComponent host)

Definition at line 182 of file CUILayoutGrid.cs.

182: base(host) { }

Member Function Documentation

◆ CalculateTracks()

void CrabUI.CUILayoutGrid.CalculateTracks ( )

Definition at line 87 of file CUILayoutGrid.cs.

88 {
89 Rows.Clear();
90 Columns.Clear();
91
92 if (Host.GridTemplateRows != null)
93 {
94 foreach (string s in Host.GridTemplateRows.Split(' '))
95 {
96 Rows.Add(new GridTrack(s));
97 }
98 }
99
100 if (Host.GridTemplateColumns != null)
101 {
102 foreach (string s in Host.GridTemplateColumns.Split(' '))
103 {
104 Columns.Add(new GridTrack(s));
105 }
106 }
107
108 if (Rows.Count == 0) Rows.Add(new GridTrack("100%"));
109 if (Columns.Count == 0) Columns.Add(new GridTrack("100%"));
110
111 float x = 0;
112 foreach (GridTrack track in Columns)
113 {
114 track.Start = x;
115 track.Size = track.RealSize(Host.Real.Width);
116 x += track.Size;
117 track.End = x;
118 }
119
120 float y = 0;
121 foreach (GridTrack track in Rows)
122 {
123 track.Start = y;
124 track.Size = track.RealSize(Host.Real.Height);
125 y += track.Size;
126 track.End = y;
127 }
128
129 }
string GridTemplateColumns
Used in Grid, space separated Columns sizes, either in pixels (123) or in % (123%)
string GridTemplateRows
Used in Grid, space separated Row sizes, either in pixels (123) or in % (123%)
CUIRect Real
Calculated prop, position on real screen in pixels Should be fully calculated after CUIMainComponent....

The documentation for this class was generated from the following file: