using System;
namespace OpenNest.PostSettings
{
///
/// Places a post-processor config property in a section of the desktop
/// settings editor. A config type opts into the sectioned editor by marking
/// at least one property; unmarked configs keep the generic PropertyGrid.
/// Label and help text come from DisplayName and Description.
///
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class PostSettingAttribute : Attribute
{
public PostSettingAttribute(string section, int order = 0)
{
Section = section;
Order = order;
}
public string Section { get; }
public int Order { get; }
/// Lower bound for numeric fields; NaN uses the kind's default.
public double Minimum { get; set; } = double.NaN;
/// Upper bound for numeric fields; NaN uses the kind's default.
public double Maximum { get; set; } = double.NaN;
/// Decimal places for decimal fields; negative uses the default.
public int DecimalPlaces { get; set; } = -1;
/// Column header for the key of a name/value table.
public string KeyHeader { get; set; }
/// Column header for the value of a name/value table.
public string ValueHeader { get; set; }
}
/// Declares a settings section's order and description.
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class PostSettingsSectionAttribute : Attribute
{
public PostSettingsSectionAttribute(string name, int order)
{
Name = name;
Order = order;
}
public string Name { get; }
public int Order { get; }
public string Description { get; set; }
}
}