velox/Editor/ESEditor/ParametersWidget.cs
2025-06-11 20:19:35 +07:00

45 lines
1.2 KiB
C#

using Editor;
using Sandbox;
namespace VeloX;
internal sealed class ParametersWidget : ControlObjectWidget
{
public ParametersWidget( SerializedProperty property ) : base( property, true )
{
Layout = Layout.Column();
Layout.Spacing = 6;
Layout.Margin = new Sandbox.UI.Margin( 8, 8, 16, 8 );
Layout.Alignment = TextFlag.Top;
Layout.SizeConstraint = SizeConstraint.SetMinimumSize;
var title = new Label( "Stream Parameters" );
title.SetStyles( "background-color:rgba(29, 62, 81, 200);" );
title.Alignment = TextFlag.CenterHorizontally;
title.Margin = 4;
Layout.Add( title );
if ( !property.TryGetAsObject( out var so ) )
return;
var StreamTabs = Layout.Add( new ScrollArea( this ) );
StreamTabs.Canvas = new Widget( StreamTabs )
{
Layout = Layout.Column(),
VerticalSizeMode = (SizeMode)3,
};
StreamTabs.Canvas.Layout.Margin = new Sandbox.UI.Margin( 8, 8, 16, 8 );
StreamTabs.Canvas.Layout.Alignment = TextFlag.Top;
foreach ( var item in TypeLibrary.GetType<StreamParameters>().Properties )
{
var row = StreamTabs.Canvas.Layout.AddColumn();
var propetry = so.GetProperty( item.Name );
row.Add( new Label( propetry.DisplayName ) );
row.Add( Create( propetry ) );
}
}
}