OverviewFilesCommitsIssuesDocsReleasesPeers

ifsrenderer-linux / AvaloniaShell / Controls / ValueSliderSettings.cs

55 lines · csharp ref:
using System;

namespace IFSRenderer.AvaloniaShell.Controls;

/// <summary>
/// Per-parameter configuration for a <see cref="ValueSlider"/>.
/// </summary>
/// <remarks>
/// A direct port of <c>WpfDisplay/ViewModels/ValueSliderSettings.cs</c>. Every member is
/// nullable so that "not specified" is distinguishable from "specified as the default" —
/// the slider only overwrites its own properties for the values that were supplied.
/// <para>
/// This type is why the Windows sliders have correct ranges and the Linux ones did not:
/// range, increment and default come from the parameter itself, not from a literal in XAML.
/// </para>
/// </remarks>
public sealed class ValueSliderSettings
{
    /// <summary>Invoked immediately before a change, so the host can snapshot for undo.</summary>
    public Action ValueWillChange { get; init; }

    /// <summary>Invoked after every change, including each tick of a drag.</summary>
    public Action<double> ValueChanged { get; init; }

    /// <summary>Invoked once when a drag-scrub begins.</summary>
    public Action ValueDraggingStarted { get; init; }

    /// <summary>Invoked once when a drag-scrub ends.</summary>
    public Action<double> ValueDraggingCompleted { get; init; }

    /// <summary>Dopesheet channel path. Null means this parameter cannot be animated.</summary>
    public string AnimationPath { get; init; }

    /// <summary>Reset target. Reset sets the value here, or to 0 if it is already here.</summary>
    public double? DefaultValue { get; init; }

    public string Label { get; init; }

    /// <summary>
    /// When false the label row is omitted and the keyframe diamond moves inline, to the
    /// right of the -/value/+ row. Used where a group heading already names the values
    /// (camera Position and Orientation).
    /// </summary>
    public bool? IsLabelShown { get; init; }

    public string ToolTip { get; init; }

    /// <summary>Step per button press, and per pixel of drag. Also picks the display format.</summary>
    public double? Increment { get; init; }

    public double? MinValue { get; init; }

    public double? MaxValue { get; init; }
}