94 lines
2.0 KiB
C#
94 lines
2.0 KiB
C#
|
|
||
|
using Godot;
|
||
|
|
||
|
namespace Rokojori
|
||
|
{
|
||
|
[Tool]
|
||
|
[GlobalClass]
|
||
|
public partial class UIRegion : Control, UIStylePropertyContainer
|
||
|
{
|
||
|
[Export]
|
||
|
public UIStyle parent;
|
||
|
|
||
|
[ExportCategory("Layout")]
|
||
|
[Export]
|
||
|
public UILayout layout;
|
||
|
|
||
|
[Export]
|
||
|
public UINumber horizontalAlignment;
|
||
|
[Export]
|
||
|
public UINumber verticalAlignment;
|
||
|
|
||
|
[Export]
|
||
|
public UINumber elementSpacing;
|
||
|
[Export]
|
||
|
public UINumber lineSpacing;
|
||
|
|
||
|
|
||
|
[ExportCategory("Size & Margins")]
|
||
|
[Export]
|
||
|
public UINumber width;
|
||
|
[Export]
|
||
|
public UINumber height;
|
||
|
|
||
|
|
||
|
[Export]
|
||
|
public UINumber margin;
|
||
|
|
||
|
[Export]
|
||
|
public UINumber marginLeft;
|
||
|
[Export]
|
||
|
public UINumber marginTop;
|
||
|
[Export]
|
||
|
public UINumber marginRight;
|
||
|
[Export]
|
||
|
public UINumber marginBottom;
|
||
|
|
||
|
[ExportCategory("Position")]
|
||
|
[Export]
|
||
|
public UIPosition position;
|
||
|
[Export]
|
||
|
public UINumber left;
|
||
|
[Export]
|
||
|
public UINumber top;
|
||
|
[Export]
|
||
|
public UINumber right;
|
||
|
[Export]
|
||
|
public UINumber bottom;
|
||
|
|
||
|
|
||
|
public UINumber GetUIStyleNumberProperty( UIStyleNumberProperty property )
|
||
|
{
|
||
|
switch ( property )
|
||
|
{
|
||
|
case UIStyleNumberProperty.Left: return left;
|
||
|
case UIStyleNumberProperty.Right: return right;
|
||
|
case UIStyleNumberProperty.Top: return top;
|
||
|
case UIStyleNumberProperty.Bottom: return bottom;
|
||
|
|
||
|
case UIStyleNumberProperty.Width: return width;
|
||
|
case UIStyleNumberProperty.Height: return height;
|
||
|
|
||
|
case UIStyleNumberProperty.Margin: return margin;
|
||
|
|
||
|
case UIStyleNumberProperty.MarginLeft: return marginLeft;
|
||
|
case UIStyleNumberProperty.MarginRight: return marginRight;
|
||
|
case UIStyleNumberProperty.MarginTop: return marginTop;
|
||
|
case UIStyleNumberProperty.MarginBottom: return marginBottom;
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
|
||
|
public void Layout()
|
||
|
{
|
||
|
switch ( layout )
|
||
|
{
|
||
|
case UILayout.Flow_Left_Top: UIFlowLayout.Apply( this ); break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|