Theater-Gui/examples/src/Program.bf

74 lines
1.7 KiB
Beef

namespace examples;
using System;
using TheaterGui;
using TheaterGui.Core;
using TheaterGui.Components;
using TheaterGui.Components.Internal;
class Program
{
public static void Main()
{
scope App()
..SetName("TheaterGui Application")
..SetStartingSize(1280, 720)
..SetPlatformLayer(new raylib_backend.PlatformRaylib())
.Run(new MainScreen());
}
}
class MainScreen : Screen
{
public this()
{
Toolbar toAdd = new .();
toAdd.AddEntry("File", "Open File", new (rt) => {Console.WriteLine("Open file");});
toAdd.AddEntry("Edit", "Go back", new (rt) => {Console.WriteLine("Go back");});
toAdd.AddEntry("Edit", "Open File", new (rt) => {Console.WriteLine("Open File");});
toAdd.AddEntry("Window", "Open File", new (rt) => {Console.WriteLine("Open File");});
AddChild("Toolbar", toAdd);
AddChild("Button", new Button(new (val) => {Console.WriteLine("Hellau :)");}));
AddChild("dd", new Dropdown("One", "Two", "Three"));
AddChild("Label", new Label("LMAO"));
AddChild("CBox", new Checkbox("Box"));
RadioButton r = new .();
r.Label.Add(new .("One"));
r.Label.Add(new .("Two"));
r.Label.Add(new .("Three"));
AddChild("radio", r);
AddChild("hslider", new HSlider());
AddChild("vslider", new VSlider());
AddChild("lb", new Label("""
Labels can also be used to
contain some larger text since this also
works fine
and without any
issues
"""));
Layout = new (val, width) =>
{
val.Component("Toolbar");
val.Component("Label", 10);
val.Linebreak();
val.Component("Button");
val.Component("CBox", 5);
val.Linebreak();
val.Component("radio", 5);
val.Component("hslider");
val.Component("vslider");
val.Component("lb");
val.Linebreak();
val.Component("dd", 5);
};
}
}