mirror of
https://github.com/9ParsonsB/Pulsar.git
synced 2025-06-30 16:23:41 -04:00
Initial Commit
This commit is contained in:
@ -1,210 +1,101 @@
|
||||
using System;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace Observatory.Framework;
|
||||
|
||||
namespace Observatory.Framework
|
||||
#region Setting property attributes
|
||||
|
||||
/// <summary>
|
||||
/// Specifies text to display as the name of the setting in the UI instead of the property name.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class SettingDisplayName : Attribute
|
||||
{
|
||||
|
||||
#region Settings class attributes
|
||||
/// <summary>
|
||||
/// Specifies the width of a settings column in the settings view. There are two columns.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||
public class SettingSuggestedColumnWidth : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the width of a settings column in the settings view. There are two columns.
|
||||
/// </summary>
|
||||
/// <param name="width">Provides a hint of the width of a settings column.</param>
|
||||
public SettingSuggestedColumnWidth(int width)
|
||||
{
|
||||
Width = width;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a hint of the width of a settings column.
|
||||
/// </summary>
|
||||
public int Width { get; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Setting property attributes
|
||||
private string name;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies text to display as the name of the setting in the UI instead of the property name.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class SettingDisplayName : Attribute
|
||||
/// <param name="name">Name to display</param>
|
||||
public SettingDisplayName(string name)
|
||||
{
|
||||
private string name;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies text to display as the name of the setting in the UI instead of the property name.
|
||||
/// </summary>
|
||||
/// <param name="name">Name to display</param>
|
||||
public SettingDisplayName(string name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accessor to get/set displayed name.
|
||||
/// </summary>
|
||||
public string DisplayName
|
||||
{
|
||||
get => name;
|
||||
set => name = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts a new visual group of settings beginning with the current setting with an optional label.
|
||||
/// Accessor to get/set displayed name.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class SettingNewGroup : Attribute
|
||||
public string DisplayName
|
||||
{
|
||||
/// <summary>
|
||||
/// Starts a new visual group of settings beginning with the current setting with an optional label.
|
||||
/// </summary>
|
||||
/// <param name="label">An optional label describing the group.</param>
|
||||
public SettingNewGroup(string label = "")
|
||||
{
|
||||
Label = label;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An optional label describing the group.
|
||||
/// </summary>
|
||||
public string Label { get; }
|
||||
get => name;
|
||||
set => name = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the property should not be displayed to the user in the UI.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class SettingIgnore : Attribute
|
||||
{ }
|
||||
/// <summary>
|
||||
/// Indicates numeric properly should use a slider control instead of a numeric textbox with roller.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class SettingNumericUseSlider : Attribute
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates numeric properly should use a slider control instead of a numeric textbox with roller.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class SettingNumericUseSlider : Attribute
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Specify backing value used by Dictionary<string, object> to indicate selected option.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class SettingBackingValue : Attribute
|
||||
{
|
||||
private string property;
|
||||
|
||||
/// <summary>
|
||||
/// Specify backing value used by Dictionary<string, object> to indicate selected option.
|
||||
/// </summary>
|
||||
/// <param name="property">Property name for backing value.</param>
|
||||
public SettingBackingValue(string property)
|
||||
{
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accessor to get/set backing value property name.
|
||||
/// </summary>
|
||||
public string BackingProperty
|
||||
{
|
||||
get => property;
|
||||
set => property = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Specify bounds for numeric inputs.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class SettingNumericBounds : Attribute
|
||||
{
|
||||
private double minimum;
|
||||
private double maximum;
|
||||
private double increment;
|
||||
private int precision;
|
||||
|
||||
/// <summary>
|
||||
/// Specify bounds for numeric inputs.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class SettingNumericBounds : Attribute
|
||||
/// <param name="minimum">Minimum allowed value.</param>
|
||||
/// <param name="maximum">Maximum allowed value.</param>
|
||||
/// <param name="increment">Increment between allowed values in slider/roller inputs.</param>
|
||||
/// <param name="precision">The number of digits to display for non integer values.</param>
|
||||
public SettingNumericBounds(double minimum, double maximum, double increment = 1.0, int precision = 1)
|
||||
{
|
||||
private double minimum;
|
||||
private double maximum;
|
||||
private double increment;
|
||||
private int precision;
|
||||
|
||||
/// <summary>
|
||||
/// Specify bounds for numeric inputs.
|
||||
/// </summary>
|
||||
/// <param name="minimum">Minimum allowed value.</param>
|
||||
/// <param name="maximum">Maximum allowed value.</param>
|
||||
/// <param name="increment">Increment between allowed values in slider/roller inputs.</param>
|
||||
/// <param name="precision">The number of digits to display for non integer values.</param>
|
||||
public SettingNumericBounds(double minimum, double maximum, double increment = 1.0, int precision = 1)
|
||||
{
|
||||
this.minimum = minimum;
|
||||
this.maximum = maximum;
|
||||
this.increment = increment;
|
||||
this.precision = precision;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Minimum allowed value.
|
||||
/// </summary>
|
||||
public double Minimum
|
||||
{
|
||||
get => minimum;
|
||||
set => minimum = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum allowed value.
|
||||
/// </summary>
|
||||
public double Maximum
|
||||
{
|
||||
get => maximum;
|
||||
set => maximum = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Increment between allowed values in slider/roller inputs.
|
||||
/// </summary>
|
||||
public double Increment
|
||||
{
|
||||
get => increment;
|
||||
set => increment = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The number of digits to display for non integer values.
|
||||
/// </summary>
|
||||
public int Precision
|
||||
{
|
||||
get => precision;
|
||||
set => precision = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region BasicUI attributes
|
||||
/// <summary>
|
||||
/// Suggests default column width when building basic plugin grid UI.
|
||||
/// Minimum allowed value.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public class ColumnSuggestedWidth : Attribute
|
||||
public double Minimum
|
||||
{
|
||||
/// <summary>
|
||||
/// Suggests default column width when building basic plugin grid UI.
|
||||
/// </summary>
|
||||
/// <param name="width">The suggested width of the annotated column.</param>
|
||||
public ColumnSuggestedWidth(int width)
|
||||
{
|
||||
Width = width;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The suggested width of the annotated column.
|
||||
/// </summary>
|
||||
public int Width { get; }
|
||||
get => minimum;
|
||||
set => minimum = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum allowed value.
|
||||
/// </summary>
|
||||
public double Maximum
|
||||
{
|
||||
get => maximum;
|
||||
set => maximum = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Increment between allowed values in slider/roller inputs.
|
||||
/// </summary>
|
||||
public double Increment
|
||||
{
|
||||
get => increment;
|
||||
set => increment = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The number of digits to display for non integer values.
|
||||
/// </summary>
|
||||
public int Precision
|
||||
{
|
||||
get => precision;
|
||||
set => precision = value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
Reference in New Issue
Block a user