mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-25 00:38:53 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
53 lines
795 B
C#
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 );
|
|
}
|
|
}
|