Files
sbox-public/engine/Launcher/StandaloneTest/Widgets/SidebarWidget.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

53 lines
795 B
C#

namespace Editor;
class SidebarWidget : Widget
{
public SidebarWidget( Widget parent ) : base( parent )
{
Layout = Layout.Column();
Layout.Margin = 16;
Layout.Spacing = 4;
FixedWidth = 200;
}
public T Add<T>( T widget ) where T : Widget
{
return Layout.Add( widget );
}
public void AddSpacer()
{
Layout.AddSpacingCell( 8 );
}
public void AddStretchCell()
{
Layout.AddStretchCell();
}
public void AddSeparator()
{
AddSpacer();
Layout.AddSeparator( true );
AddSpacer();
}
protected override Vector2 SizeHint()
{
return new Vector2( 64, 64 );
}
protected override void OnPaint()
{
Paint.ClearPen();
Paint.ClearBrush();
Paint.SetDefaultFont();
var r = LocalRect;
Paint.SetBrush( Theme.SidebarBackground );
Paint.DrawRect( r );
}
}