Editor UI widget that draws a small rounded status indicator dot. It stores a Color, has fixed size 10, repaints when the Color property is set, and draws a rounded rectangle with antialiasing in OnPaint.
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Linq;
using Editor;
using Sandbox;
namespace HumanoidRetargeter.EditorTools;
/// <summary>A small round light before the status text: blue while working, green when fine, red on errors.</summary>
internal sealed class RtStatusDot : Widget
{
Color _color = Theme.TextLight;
public RtStatusDot( Widget parent ) : base( parent )
{
FixedSize = 10;
}
public Color Color
{
get => _color;
set
{
_color = value;
Update();
}
}
protected override void OnPaint()
{
Paint.Antialiasing = true;
Paint.ClearPen();
Paint.SetBrush( _color );
Paint.DrawRect( LocalRect.Shrink( 1 ), 4 );
}
}