CrabUI
Loading...
Searching...
No Matches
CUITextInputTest.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;
12using System.IO;
13
14using CrabUI;
15
16namespace CrabUITest
17{
18 public partial class ComponentTest : FillMethods
19 {
20 public static void CUITextInput(CUIComponent Host)
21 {
22 CUIFrame frame = new CUIFrame(0.6f, 0.2f, 0.3f, 0.4f);
23
25 {
26 Absolute = new CUINullRect(x: 50, y: 50),
27 });
28
30 {
31 Absolute = new CUINullRect(x: 50, y: 75, w: 200),
32 FitContent = new CUIBool2(false, true),
33 });
34
36 {
37 Absolute = new CUINullRect(x: 50, y: 100),
38 Relative = new CUINullRect(w: 0.75f),
39 FitContent = new CUIBool2(false, true),
40 });
41
42 CUITextInput t4 = (CUITextInput)frame.Append(new CUITextInput("bebebebebebebe")
43 {
44 Absolute = new CUINullRect(x: 50, y: 125),
45 Relative = new CUINullRect(w: 0.75f),
46 FitContent = new CUIBool2(false, true),
47 Disabled = true,
48 });
49
50 t3.OnTextChanged += (t) => t2.Text = t;
51 t1.OnTextAdded += (t) => CUI.Log(t);
52
53 Host.Append(frame);
54 }
55 }
56}
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
In fact a static class managing static things.
Definition CUIErrors.cs:16
static void Log(object msg, Color? color=null, [CallerFilePath] string source="", [CallerLineNumber] int lineNumber=0)
Prints a message to console.
Vector2 but with bools.
Definition CUIBool2.cs:17
Rectangle with float?
Definition CUIRect.cs:104