CrabUI
Loading...
Searching...
No Matches
FillEmptySpace.cs
1using System;
2using System.Reflection;
3using System.Runtime.CompilerServices;
4using System.Collections.Generic;
5using System.Collections.Immutable;
6using System.Linq;
7
8using Barotrauma;
9using HarmonyLib;
10using Microsoft.Xna.Framework;
11using Microsoft.Xna.Framework.Graphics;
12
13using CrabUI;
14
15namespace CrabUITest
16{
17 /// <summary>
18 /// Testing separate props
19 /// </summary>
20 public partial class PropTest : FillMethods
21 {
22 public static void FillEmptySpace(CUIComponent Main)
23 {
24 CUIFrame frame = new CUIFrame(0.6f, 0.2f, 0.2f, 0.4f);
25 frame["list"] = new CUIVerticalList()
26 {
27 Relative = new CUINullRect(0, 0, 1, 1),
28 BackgroundColor = Color.Blue,
29 };
30
31 frame["header"] = frame["list"].Append(new CUITextBlock("header")
32 {
33 TextAlign = new Vector2(0.5f, 0.5f),
34 });
35 frame["middle"] = frame["list"].Append(new CUIHorizontalList()
36 {
37 FillEmptySpace = new CUIBool2(false, true),
38 BackgroundColor = Color.Brown,
39 });
40 frame["footer"] = frame["list"].Append(new CUITextBlock("footer")
41 {
42 TextAlign = new Vector2(0.5f, 0.5f),
43 });
44
45 frame["leftmenu"] = frame["middle"].Append(new CUITextBlock("left menu")
46 {
47 Wrap = true,
48 Vertical = true,
49 Relative = new CUINullRect(w: 0.2f),
50 });
51
52 frame["content"] = frame["middle"].Append(new CUIComponent()
53 {
54 BackgroundColor = Color.Green,
55 FillEmptySpace = new CUIBool2(true, false),
56 });
57
58 frame["rightmenu"] = frame["middle"].Append(new CUITextBlock("right menu")
59 {
60 Wrap = true,
61 Vertical = false,
62 Relative = new CUINullRect(w: 0.2f),
63 });
64
65 Main.Append(frame);
66 }
67
68 public static void FillEmptySpace2(CUIComponent Main)
69 {
70 CUIFrame frame = new CUIFrame(0.6f, 0.2f, 0.2f, 0.4f);
71 frame["list"] = new CUIVerticalList()
72 {
73 Relative = new CUINullRect(0, 0, 1, 1),
74 BackgroundColor = Color.Blue,
75 };
76
77 frame["header"] = frame["list"].Append(new CUITextBlock("header")
78 {
79 TextAlign = new Vector2(0.5f, 0.5f),
80 FillEmptySpace = new CUIBool2(false, true),
81 });
82 frame["middle"] = frame["list"].Append(new CUIHorizontalList()
83 {
84 Absolute = new CUINullRect(h: 100f),
85 BackgroundColor = Color.Brown,
86 });
87 frame["footer"] = frame["list"].Append(new CUITextBlock("footer")
88 {
89 TextAlign = new Vector2(0.5f, 0.5f),
90 FillEmptySpace = new CUIBool2(false, true),
91 });
92
93
94 frame["leftmenu"] = frame["middle"].Append(new CUITextBlock("left menu")
95 {
96 FillEmptySpace = new CUIBool2(true, false),
97 Wrap = true,
98 });
99
100 frame["content"] = frame["middle"].Append(new CUIComponent()
101 {
102 BackgroundColor = Color.Green,
103 Absolute = new CUINullRect(w: 100f),
104 });
105
106 frame["rightmenu"] = frame["middle"].Append(new CUITextBlock("right menu")
107 {
108 FillEmptySpace = new CUIBool2(true, false),
109 Wrap = true,
110 });
111
112
113
114 Main.Append(frame);
115 }
116 }
117}
Base class for all components.
virtual CUIComponent Append(CUIComponent child, string name=null, [CallerMemberName] string memberName="")
Adds children to the end of the list.
Draggable and resizable container for other components.
Definition CUIFrame.cs:16
Resizing components to it's Height and placing them sequentially.
Passive block of text.
Resizing components to it's Width and placing them sequentially.
Vector2 but with bools.
Definition CUIBool2.cs:17
Rectangle with float?
Definition CUIRect.cs:104