Just playing around with yoga and unity to see if we could build a ui with it
This commit is contained in:
1 parent
15d5b17fd2
commit
6ad1cd7aa8
60 files changed
+3930
-3
No files matched your search
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Vocaluxe.UI.AbstractElements;
|
||||
using Vocaluxe.UI.BasicElements.Text;
|
||||
|
||||
namespace Vocaluxe.UI.BasicElements.Button
|
||||
{
|
||||
public class CControllerElementButton: CController
|
||||
{
|
||||
private CControllerElementText _DescriptionController;
|
||||
|
||||
public override void RegisterChild(CController child, string id)
|
||||
{
|
||||
Enum.TryParse(id, out EElementButtonComponents parsedId);
|
||||
|
||||
switch (parsedId)
|
||||
{
|
||||
case EElementButtonComponents.TxtDescription:
|
||||
_DescriptionController = child as CControllerElementText ?? throw new ArgumentException("TxtDescription must be a text element");
|
||||
break;
|
||||
case EElementButtonComponents.Unknown:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler Clicked;
|
||||
|
||||
public void RaiseClicked()
|
||||
{
|
||||
Clicked?.Invoke(this, null);
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get => _DescriptionController.Text;
|
||||
set => _DescriptionController.Text = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using Vocaluxe.UI.AbstractElements;
|
||||
|
||||
namespace Vocaluxe.UI.BasicElements.Button
|
||||
{
|
||||
public class CUiElementButton:CUiElement
|
||||
{
|
||||
public CControllerElementButton Controller => new CControllerElementButton();
|
||||
public override CController BasicController => Controller;
|
||||
|
||||
public static CUiElementButton CreateInstance(Dictionary<string, string> properties, IEnumerable<(CUiElement, string)> children)
|
||||
{
|
||||
return CUiElement.CreateInstance<CUiElementButton>(properties, children);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
namespace Vocaluxe.UI.BasicElements.Button
|
||||
{
|
||||
public enum EElementButtonComponents
|
||||
{
|
||||
Unknown,
|
||||
TxtDescription
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user