RaptorSuiteSettingsSwitches
Switch rows a project adds to the Suite's Settings pages.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
public static class RaptorSuiteSettingsSwitchesProperties
Count
public static int Count { get; }Gets the number of switches.
Ids
public static IReadOnlyList<string> Ids { get; }Gets the ids in display order (order, then registration).
Version
public static int Version { get; }Gets a counter that increases by one on every change.
Methods
IsRegistered
public static bool IsRegistered(string id)Whether a switch with this id is registered.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's stable id. |
Returns: True when registered.
Register
public static bool Register(string id, string section, string group, string title, string description, Func<bool> get, Action<bool> set, string keywords = "", int order = 0, params string[] after)Registers a Settings switch. Throws ArgumentException for a blank id, section, group or title, and ArgumentNullException for a null get or set.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | The row's stable id. | |
section | string | The Settings page. | |
group | string | The group on that page. | |
title | string | The row's title. | |
description | string | A few words shown as the row's tooltip, or "" for none. | |
get | Func<bool> | Returns the switch state. | |
set | Action<bool> | Sets the switch state. | |
keywords | string | "" | Extra words the search matches. |
order | int | 0 | Lower comes first; ties keep registration order. |
after | params string[] | Anchor titles in fallback order. |
Returns: False when the id is taken.
Call from an [InitializeOnLoad] static constructor on the main thread. A get or set that throws is logged, and a failing get reads as off.
TryGet
public static bool TryGet(string id, out Switch value)Gets the registered switch with this id.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's stable id. |
value | out Switch | The switch. |
Returns: False when the id is not registered.
Related types
- RaptorSuiteSettingsSwitches.Switch: A registered switch (read-only).