47 {
48 calculator = new Calculator();
49
53
54
56 {
59
60
61 };
62
64 {
66 BackgroundColor = Color.Blue,
67 };
68
69 mainframe[
"list"][
"Header"] = Header =
new CUIComponent()
70 {
71 BackgroundColor = Color.Green,
72 FitContent =
new CUIBool2(
false,
true),
73 };
74
75 mainframe[
"list"][
"ButtonGrid"] = ButtonGrid =
new CUIGrid()
76 {
77 FillEmptySpace =
new CUIBool2(
false,
true),
78 BackgroundColor = Color.Brown,
79 GridTemplateColumns = "25% 25% 25% 25%",
80 GridTemplateRows = "25% 25% 25% 25%",
81 };
82
83
85
86
87 calculator.OnValueChange += (value) =>
88 {
89 tb.Text = value.ToString();
90 };
91
92 void addNumButton(int i, int x, int y)
93 {
95 {
96 GridCell = new Point(x, y),
97 AddOnClick = (e) => calculator.SetDigit(i),
98 });
99 }
100
101 addNumButton(1, 0, 0);
102 addNumButton(2, 1, 0);
103 addNumButton(3, 2, 0);
104 addNumButton(4, 0, 1);
105 addNumButton(5, 1, 1);
106 addNumButton(6, 2, 1);
107 addNumButton(7, 0, 2);
108 addNumButton(8, 1, 2);
109 addNumButton(9, 2, 2);
110
112 {
113 GridCell = new Point(3, 2),
114 });
115
117 {
118 GridCell = new Point(3, 1),
119 });
120
122 {
123 GridStartCell = new Point(2, 3),
124 GridEndCell = new Point(3, 3),
125 });
126
127 FakeMain.
Append(mainframe);
128 }
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.
A Grid containing children in its cells.
Resizing components to it's Width and placing them sequentially.