Editor/SFXRNoteWidget.cs
using Sandbox;
using Editor;
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox.UI;

namespace SFXR.Editor;

public class SFXRNoteSheet : Widget
{
    public SFXRNoteSheet( SerializedObject obj ) : base( null )
    {
        var propertySheet = new PropertyControlSheet();
        propertySheet.AddObject( obj );

        Layout = Layout.Column();
        Layout.Add( propertySheet );
    }

    protected override void OnPaint()
    {
        base.OnPaint();

        Color color = Color.FromRgb( 0x111111 );
        Paint.SetBrush( color );
        Paint.SetPen( color );

        Paint.DrawRect( new Rect( 0, 0, Width, Height ), 2 );
    }

}

//[CustomEditor( typeof( SFXRFloat ) )]
// public class SFXRFloatControlWidget : ControlWidget
// {

//     SerializedObject Target;

//     public SFXRFloatControlWidget( SerializedProperty property ) : base( property )
//     {
//         SetSizeMode( SizeMode.Ignore, SizeMode.Default );

//         if ( !property.TryGetAsObject( out Target ) )
//             return;

//         Layout = Layout.Row();
//         Layout.Spacing = 2;

//         var value = Target.GetProperty( "Value" );
//         FloatControlWidget valueWidget = new FloatControlWidget( value );

//         if ( property.TryGetAttribute<RangeAttribute>( out var attribute ) )
//         {
//             valueWidget.Range = new Vector2( attribute.Min, attribute.Max );
//             valueWidget.RangeStep = attribute.Step;
//             valueWidget.HasRange = attribute.Slider;
//             // if ( attribute.Slider )
//             // {
//             //     sliderWidget = new FloatSlider( this );
//             //     sliderWidget.HighlightColor = Theme.Grey;
//             //     sliderWidget.Minimum = attribute.Min;
//             //     sliderWidget.Maximum = attribute.Max;
//             //     sliderWidget.Step = attribute.S;
//             //     sliderWidget.OnValueEdited = delegate
//             //     {
//             //         base.SerializedProperty.As.Float = sliderWidget.Value;
//             //     };
//             // }
//         }

//         Layout.Add( valueWidget );

//         var locked = Target.GetProperty( "Locked" );
//         IconButton lockedButton = new IconButton( "lock_open" );
//         lockedButton.OnClick = () =>
//         {
//             if ( Target.Targets.First() is SFXRFloat sfxrFloat )
//             {
//                 sfxrFloat.Locked = !sfxrFloat.Locked;
//                 Log.Info( sfxrFloat.Locked );
//                 lockedButton.Icon = sfxrFloat.Locked ? "lock" : "lock_open";
//                 lockedButton.Update();
//             }
//         };
//         lockedButton.ToolTip = "Lock/Unlock this value";
//         Layout.Add( lockedButton );
//     }

//     protected override void OnPaint()
//     {

//     }

// }

// public class SFXRFloatControlWidget : FloatControlWidget
// {

//     SerializedObject Target;

//     public SFXRFloatControlWidget( SerializedProperty property ) : base( property )
//     {
//         if ( !property.TryGetAsObject( out Target ) )
//             return;

//         var locked = Target.GetProperty( "Locked" );
//         IconButton lockedButton = new IconButton( "lock_open" );
//         lockedButton.OnClick = () =>
//         {
//             // if ( Target.Targets.First() is SFXRFloat sfxrFloat )
//             // {
//             //     sfxrFloat.Locked = !sfxrFloat.Locked;
//             //     Log.Info( sfxrFloat.Locked );
//             //     lockedButton.Icon = sfxrFloat.Locked ? "lock" : "lock_open";
//             //     lockedButton.Update();
//             // }
//         };
//         lockedButton.ToolTip = "Lock/Unlock this value";
//         //Layout.Add( lockedButton );
//     }

//     protected override void PaintControl()
//     {
//         if ( Target is null ) return;

//         base.PaintControl();
//     }

//     protected override void OnPaint()
//     {
//         if ( Target is null ) return;

//         base.OnPaint();
//     }
// }