RaptorSuiteControls
Suite-style controls for tools in other assemblies, such as RAPTOR Render's Ray-traced preview settings.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
Each member forwards to RaptorSuiteTheme, RaptorSuiteSettingsPage or RaptorSuiteStepField, where the look is defined.
public static class RaptorSuiteControlsFields
ActionChipGap
public const float ActionChipGap;The gap between an empty state's message row and its action chip, in points. It matches the panel button gap.
ActionChipHeight
public const float ActionChipHeight;The height of the RAPTOR action chip and of an empty state's message row, in points.
CategoryGap
public const float CategoryGap;The space above a folding category header.
CategoryHeight
public const float CategoryHeight;The height of a folding category header.
ContextChipSize
public const float ContextChipSize;The side length of a context bar icon button.
ContextGlyph
public const float ContextGlyph;The glyph size of a context bar icon button.
ControlHeight
public const float ControlHeight;The height of a tile, chip or fused row.
ControlRadius
public const float ControlRadius;A control's corner radius.
EmptyGlyph
public const string EmptyGlyph;The empty-state glyph, a dashed box (nv-square-dashed).
FieldHeight
public const float FieldHeight;The height of a number field in a form. Inspector rows use 24.
FoldSeconds
public const float FoldSeconds;The category fold duration, in seconds.
FormGap
public const float FormGap;The gap after a form row's label column.
FormLabelWidth
public const float FormLabelWidth;The width of a form row's label column.
FormRowHeight
public const float FormRowHeight;The height of a form row.
GroupLabelGap
public const float GroupLabelGap;The space above a group label.
GroupLabelHeight
public const float GroupLabelHeight;The height of a group label.
HeadChipHeight
public const float HeadChipHeight;The height of a tool panel's head chip.
IconButtonSize
public const float IconButtonSize;The side length of a bare icon button.
IconButtonSmall
public const float IconButtonSmall;The side length of a small bare icon button, as used in the bottom bar and panel headers.
LockedGlyph
public const string LockedGlyph;The locked chip's glyph, the Suite's Locked icon (st-locked).
ModuleGap
public const float ModuleGap;The gap between tiles, and between label rows.
ModulePadLeft
public const float ModulePadLeft;A tool panel's left margin.
ModulePadRight
public const float ModulePadRight;A tool panel's right margin, including the scrollbar gutter.
PanelFieldHeight
public const float PanelFieldHeight;The height of a number field in a label row.
PanelRadius
public const float PanelRadius;A panel's corner radius.
PanelRowHeight
public const float PanelRowHeight;The height of a label row.
PanelRowLabel
public const float PanelRowLabel;The width of a label row's label column.
TagHeight
public const float TagHeight;The height of a dark thumbnail tag, in points. An icon-only tag is also this wide.
TickGap
public const float TickGap;The gap between tick boxes on one row.
TickHeight
public const float TickHeight;The height of a tick box row.
Properties
InputText
public static GUIStyle InputText { get; }The text style inside an InputBox. It is based on the label style, so Unity's field skin does not draw a second box.
PanelLabel
public static GUIStyle PanelLabel { get; }The 13 pt secondary text style for setting labels on tool panels.
QuietTileFill
public static bool QuietTileFill { get; set; }Whether tiles have a quiet fill at rest. Always on: the choice left Settings, and a stored value is not read. A set lasts for the session.
Surface
public static Color Surface { get; }The panel background colour. It is the docked panel colour, or the drawer colour while the panel is shown in a drawer.
Methods
ActionButton
public static bool ActionButton(Rect r, string words, string iconGlyph, bool enabled = true, string tooltip = null)Draws an in-panel action button with a left-aligned glyph and label on a Suite chip. The ink is white when the button is enabled.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
words | string | The label. | |
iconGlyph | string | The icon name. | |
enabled | bool | true | Whether the button is enabled. A disabled button is dimmed and ignores clicks. |
tooltip | string | null | The tooltip, or null. |
Returns: True when clicked.
AskName
public static bool AskName(string title, string initial, string action, System.Func<string, string> run)Shows a single-field name dialog inside the Suite, as used for RAPTOR Light presets.
| Parameter | Type | Description |
|---|---|---|
title | string | The dialog's title. |
initial | string | The starting text. |
action | string | The confirm button label. |
run | System.Func<string, string> | Receives the trimmed name and returns null to accept it, or an error message to show under the field. |
Returns: False when no Suite is open to host the dialog.
Button
public static bool Button(Rect r, string label, string iconGlyph = null)Draws a secondary button in the Settings page style.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
label | string | The label. | |
iconGlyph | string | null | The icon name, or null. |
Returns: True when clicked.
CapsRow
public static float CapsRow(Rect row, bool shown, Action<Rect> draw, float gap = ActionChipGap)Draws the row only when shown is true. The bool form of CapsRow{T}.
| Parameter | Type | Default | Description |
|---|---|---|---|
row | Rect | The row's rect. | |
shown | bool | Whether to draw the row. | |
draw | Action<Rect> | Draws the row. | |
gap | float | ActionChipGap | The gap after the row. |
Returns: The row's height plus gap, or 0 when the row is hidden.
CapsRow
public static float CapsRow<T>(Rect row, T caps, T need, Action<Rect> draw, float gap = ActionChipGap) where T : struct, EnumDraws a row only when the active backend supports it. If caps has every flag in need, calls draw with row. Add the returned height to your y position. An unsupported row is not shown and takes no space.
| Parameter | Type | Default | Description |
|---|---|---|---|
row | Rect | The row's rect. | |
caps | T | The active backend's capabilities. | |
need | T | The flags the row needs. | |
draw | Action<Rect> | Draws the row. | |
gap | float | ActionChipGap | The gap after the row. |
Returns: The row's height plus gap, or 0 when the row is hidden.
CapsRowLayout
public static bool CapsRowLayout<T>(T caps, T need, float height, Action<Rect> draw) where T : struct, EnumThe GUILayout form of CapsRow. If caps has every flag in need, reserves a full-width row height tall and draws it. Otherwise reserves nothing.
| Parameter | Type | Description |
|---|---|---|
caps | T | The active backend's capabilities. |
need | T | The flags the row needs. |
height | float | The row's height. |
draw | Action<Rect> | Draws the row. |
Returns: True when the row was shown.
CapsRowsHeight
public static float CapsRowsHeight<T>(T caps, float rowHeight, float gap, params T[] needs) where T : struct, EnumReturns the total height of a stack of caps rows, for sizing a popup. Adds rowHeight plus gap for each entry in needs that caps covers.
| Parameter | Type | Description |
|---|---|---|
caps | T | The active backend's capabilities. |
rowHeight | float | One row's height. |
gap | float | The gap after each row. |
needs | params T[] | One entry per row. |
Returns: The total height.
Chip
public static bool Chip(Rect r, string icon, string words, bool on = false, bool enabled = true, string tooltip = null, bool caret = false)Draws a chip. It is lighter with a ring on hover, darker when pressed, light blue with a blue ring and ink when on, and outlined when disabled. With no label, the glyph is centred. Rects 28 pt tall or less use the small padding.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
icon | string | The icon name, or null. | |
words | string | The label, or null. | |
on | bool | false | Whether the chip is on. |
enabled | bool | true | Whether the chip is enabled. A disabled chip is outlined and ignores clicks. |
tooltip | string | null | The tooltip, or null. |
caret | bool | false | Whether to draw a dropdown chevron on the right. |
Returns: True when clicked.
ChipFill
public static void ChipFill(Rect r, bool active, bool hovered, bool pressed = false)Draws the chip fill of a button-like control, such as an options-bar choice or a dropdown.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
active | bool | Whether the control is active. | |
hovered | bool | Whether the pointer is over the control. | |
pressed | bool | false | Whether the control is pressed. |
ColourMenuField
public static void ColourMenuField(Rect rect, Color[] colours, string[] names, int current, System.Action<int> choose, bool dimmed = false)Draws a Suite colour dropdown. The chip shows the current swatch, name and a chevron. Each menu row shows a swatch and name, and the current row is ticked.
| Parameter | Type | Default | Description |
|---|---|---|---|
rect | Rect | The rect in GUI coordinates of the current view. | |
colours | Color[] | One colour per row. | |
names | string[] | One name per row. | |
current | int | The chosen index. | |
choose | System.Action<int> | Runs with the chosen index on the next editor tick. | |
dimmed | bool | false | Whether to dim the chip, for a colour that is set but overridden, such as by a Random toggle. |
ColourMenuField
public static void ColourMenuField(Rect rect, Color[] colours, string[] names, int current, System.Action<int> choose, string emptyIcon, string emptyLabel)Draws a Suite colour dropdown. When current is not a valid index, the chip shows emptyIcon and emptyLabel.
| Parameter | Type | Description |
|---|---|---|
rect | Rect | The rect in GUI coordinates of the current view. |
colours | Color[] | One colour per row. |
names | string[] | One name per row. |
current | int | The chosen index. |
choose | System.Action<int> | Runs with the chosen index on the next editor tick. |
emptyIcon | string | The icon when nothing is chosen. |
emptyLabel | string | The label when nothing is chosen. |
ColourMenuFieldWidth
public static float ColourMenuFieldWidth(string label)Returns the preferred width of a ColourMenuField showing label.
| Parameter | Type | Description |
|---|---|---|
label | string | The label. |
Returns: The width.
ColourSwatch
public static Color ColourSwatch(Rect r, Color colour, bool hdr = false)Draws a colour swatch in the Settings page style (RaptorSuiteSettingsPage.Swatch). Clicking it opens Unity's colour picker without alpha, or the HDR picker when hdr is true. The picker reports edits asynchronously, so wrap the call in BeginChangeCheck and EndChangeCheck to detect them.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
colour | Color | The colour. | |
hdr | bool | false | Whether to allow HDR values. |
Returns: The current colour.
Confirm
public static void Confirm(string title, string message, string action, System.Action run)Shows a small confirmation dialog inside the Suite, with Cancel and action buttons. If no Suite is open, run is called immediately.
| Parameter | Type | Description |
|---|---|---|
title | string | The dialog's title. |
message | string | The message. |
action | string | The confirm button label. |
run | System.Action | Runs when the user confirms. |
ContextIconButton
public static bool ContextIconButton(Rect r, string icon, string tooltip = null, bool on = false, bool enabled = true)Draws a context bar icon button, 40 pt square with corner radius 8 and a 24 pt glyph.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
icon | string | The icon name. | |
tooltip | string | null | The tooltip, or null. |
on | bool | false | Whether the button is current. |
enabled | bool | true | Whether the button is enabled. A disabled button draws in Disabled ink and ignores clicks. |
Returns: True when clicked.
EmptyState
public static bool EmptyState(Rect r, string words, string actionWords = null, string actionIcon = null, bool actionEnabled = true, string actionTooltip = null)Draws the placeholder for an empty list. It shows the dashed-box glyph and words, such as "No packs", in grey on a 32 pt row. When actionWords is set, such as "Add pack", a full-width ActionButton is shown below it. Size r with EmptyStateHeight.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
words | string | The message. | |
actionWords | string | null | The action chip's label, or null for no chip. |
actionIcon | string | null | The action chip's icon. |
actionEnabled | bool | true | Whether the action chip is enabled. A disabled chip is dimmed. |
actionTooltip | string | null | The action chip's tooltip. |
Returns: True when the action was clicked.
EmptyStateHeight
public static float EmptyStateHeight(bool withAction)Returns the height of an EmptyState, including the gap and action chip when withAction is true.
| Parameter | Type | Description |
|---|---|---|
withAction | bool | Whether the empty state has an action chip. |
Returns: The height.
EndModuleCategories
public static void EndModuleCategories(ref float y)Closes the category left open by ModuleCategory. Does nothing when no category is open.
| Parameter | Type | Description |
|---|---|---|
| y | ref float | The list's running y position, moved below the closed category. |
Fill
public static void Fill(Rect r, Color colour, float radius = ControlRadius)Draws an anti-aliased rounded fill on Repaint.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
colour | Color | The fill colour. | |
radius | float | ControlRadius | The corner radius, in points. |
FoldAmount
public static float FoldAmount(string key, bool open)Returns how open a folding category is, from 0 to 1. The amount animates over 0.12 s when open changes, or jumps to its end when Reduce motion is on. The view repaints while it animates. To animate the fold, multiply the list height by this amount and clip the list.
| Parameter | Type | Description |
|---|---|---|
key | string | The category's key, as given to PanelSection. |
open | bool | Whether the section is open. |
Returns: The open amount.
FoldChevron
public static void FoldChevron(Rect slot, bool open, Color ink)Draws a fold chevron that points down when open and right when closed. It rotates over 0.12 s when open changes, and tracks its state between passes.
| Parameter | Type | Description |
|---|---|---|
slot | Rect | The glyph's 12 pt rect. Pass the same rect every pass. |
open | bool | Whether the section is open. |
ink | Color | The glyph's colour. |
FormFused
public static int FormFused(Rect row, string label, FusedAction[] items, bool enabled = true)Draws a form row containing a FusedRow, as used for the Shift, Scale, Justify, Fit, Rotate and Align rows.
| Parameter | Type | Default | Description |
|---|---|---|---|
row | Rect | The whole row's rect, 32 pt tall. | |
label | string | The label. | |
items | FusedAction[] | The buttons. Reuse the same array, as it is read on every event. | |
enabled | bool | true | Whether the row is enabled. A disabled row ignores clicks. |
Returns: The clicked button's index, or -1.
FormRow
public static Rect FormRow(Rect row, string label)Draws a form row's label in a 64 pt column with an 8 pt gap after it, and returns the remaining rect for the control.
| Parameter | Type | Description |
|---|---|---|
row | Rect | The whole row's rect. |
label | string | The label. |
Returns: The control's rect.
FusedRow
public static int FusedRow(Rect r, FusedAction[] items, bool enabled = true)Draws a fused action row, the standard control for a set of actions. Buttons have equal widths and are joined by 1 pt gaps, with only the row's ends rounded. Each glyph and label is centred. Icon-only rows use 32 pt cells from the left.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view, 32 pt tall. | |
items | FusedAction[] | The buttons. Reuse the same array, as it is read on every event. | |
enabled | bool | true | Whether the row is enabled. A disabled row ignores clicks. |
Returns: The clicked button's index, or -1.
Glyph
public static void Glyph(Rect r, string iconGlyph, Color tint, float size = 16f)Draws an icon glyph at the given size.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
iconGlyph | string | The icon name. | |
tint | Color | The tint colour. | |
size | float | 16f | The glyph size, in points. |
GradientSwatch
public static Gradient GradientSwatch(Rect r, Gradient gradient, bool hdr = false)Draws a gradient swatch in the ColourSwatch style. Clicking it opens Unity's gradient editor. Wrap the call in BeginChangeCheck and EndChangeCheck to detect edits.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
gradient | Gradient | The gradient. | |
hdr | bool | false | Whether to allow HDR values. |
Returns: The current gradient.
GroupLabel
public static void GroupLabel(Rect r, string words)Draws a 12 pt group label with no chevron or rule. Group labels do not fold.
| Parameter | Type | Description |
|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view, 20 pt tall. |
words | string | The label. |
HasCaps
public static bool HasCaps<T>(T caps, T need) where T : struct, EnumWhether caps has every flag in need. Always true when need is zero.
| Parameter | Type | Description |
|---|---|---|
caps | T | The active backend's capabilities. |
need | T | The flags the row needs. |
Returns: True when every flag is present.
HeaderIconButton
public static bool HeaderIconButton(Rect r, string icon, string tooltip = null, bool on = false, bool enabled = true)Draws a panel header icon button (.ph .ib), with a chip fill on hover and no fill otherwise. When on, the ink is blue.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
icon | string | The icon name. | |
tooltip | string | null | The tooltip, or null. |
on | bool | false | Whether the button is on. |
enabled | bool | true | Whether the button is enabled. A disabled button draws in Disabled ink and ignores clicks. |
Returns: True when clicked.
IconButton
public static bool IconButton(Rect r, string icon, string tooltip = null, bool on = false, bool enabled = true, float glyph = 16f, float radius = ControlRadius)Draws a bare icon button, with no fill at rest, a pill on hover, and a light blue fill with blue ink when current.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
icon | string | The icon name. | |
tooltip | string | null | The tooltip, or null. |
on | bool | false | Whether the button is current. |
enabled | bool | true | Whether the button is enabled. A disabled button draws in Disabled ink and ignores clicks. |
glyph | float | 16f | The glyph size, in points. |
radius | float | ControlRadius | The pill's corner radius. |
Returns: True when clicked.
InputBox
public static void InputBox(Rect r, bool focused)Draws a recessed input box for a number or text field on Repaint. It has a dark fill and a thin ring that lightens on hover and turns to the accent colour when focused.
| Parameter | Type | Description |
|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. |
focused | bool | Whether the field has keyboard focus. |
Keycaps
public static float Keycaps(float right, float midY, string binding, float alpha = 1f)Draws keycaps for binding, such as "Ctrl+click" or "Esc", right-aligned to right and centred on midY.
| Parameter | Type | Default | Description |
|---|---|---|---|
right | float | The right edge, in points. | |
midY | float | The vertical centre, in points. | |
binding | string | The keys, such as Ctrl+click. | |
alpha | float | 1f | The opacity, 0 to 1. |
Returns: The keycaps' left edge.
KeycapsWidth
public static float KeycapsWidth(string binding)Returns the width of Keycaps for binding.
| Parameter | Type | Description |
|---|---|---|
binding | string | The keys, such as Ctrl+click. |
Returns: The width.
MaterialPreviewTexture
public static Texture MaterialPreviewTexture(Material material)Returns a material's base texture (_BaseMap, baseColorTexture, _MainTex or _BaseColorMap), or null. It does not use AssetPreview renders. When it returns null, draw the material's flat colour, as MaterialSwatch does.
| Parameter | Type | Description |
|---|---|---|
material | Material | The material. |
Returns: The texture, or null.
MaterialSwatch
public static void MaterialSwatch(Rect r, Material material, float radius, Color tint)Draws a material swatch on Repaint. It shows the material's texture at its original aspect ratio, or its flat colour if it has no texture, rounded by radius and multiplied by tint.
| Parameter | Type | Description |
|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. |
material | Material | The material. |
radius | float | The corner radius, in points. |
tint | Color | The tint colour. |
MenuField
public static void MenuField(Rect rect, string iconGlyph, string label, System.Func<Menu> build)Draws a Suite dropdown field that builds and opens a grouped Menu when clicked, like the Workspace field.
| Parameter | Type | Description |
|---|---|---|
rect | Rect | The rect in GUI coordinates of the current view. |
iconGlyph | string | The icon name. |
label | string | The label. |
build | System.Func<Menu> | Builds the menu when it opens. |
MenuField
public static void MenuField(Rect rect, string iconGlyph, string label, string[] itemIcons, string[] itemLabels, int current, System.Action<int> choose)Draws a Suite dropdown field with an icon, label and chevron that opens a Suite menu.
| Parameter | Type | Description |
|---|---|---|
rect | Rect | The rect in GUI coordinates of the current view. |
iconGlyph | string | The icon name. |
label | string | The label. |
itemIcons | string[] | One icon name per row. |
itemLabels | string[] | One label per row. |
current | int | The chosen index. |
choose | System.Action<int> | Runs with the chosen index on the next editor tick. |
ModuleCategory
public static bool ModuleCategory(ref float y, float x, float w, string title, string key, bool defaultOpen = true)Starts a folding category in a tool panel's list and closes the previous one. The header has 16 pt of space above it, except for the first category.
| Parameter | Type | Default | Description |
|---|---|---|---|
| y | ref float | The list's running y position, advanced past the header. | |
| x | float | The list's left edge. | |
| w | float | The list's width. | |
title | string | The category's name. | |
key | string | The key that stores the fold state and tracks its animation. | |
defaultOpen | bool | true | Whether it starts open. |
Returns: True when the caller should draw the list, including while it folds closed.
Call EndModuleCategories after the last category.
ModuleHead
public static Rect ModuleHead(Rect area, string icon, string title, string meta = null)Draws a tool panel's head chip at the top of area.
| Parameter | Type | Default | Description |
|---|---|---|---|
area | Rect | The whole panel rect. | |
icon | string | The icon name. | |
title | string | The tool's name. | |
meta | string | null | A count shown on the right, or null. |
Returns: The panel area below the chip.
ModuleLockedChip
public static void ModuleLockedChip(Rect r, string word, string tooltip = null)Draws an outlined chip with the lock glyph and word in grey, for a feature whose module or package is not installed. The chip has no hover state and consumes clicks, so they do not reach a control beneath it. Draw it before the control it covers.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
word | string | The label. | |
tooltip | string | null | The tooltip naming what is missing, such as "Needs HAZE", or null. |
ModuleLockedChipWidth
public static float ModuleLockedChipWidth(string word)Returns the width a ModuleLockedChip needs for word, including padding, glyph and gap.
| Parameter | Type | Description |
|---|---|---|
word | string | The label. |
Returns: The width.
NumberField
public static float NumberField(Rect box, string controlName, float value, float step, string axis = null, string unit = null, float min = float.NegativeInfinity, float max = float.PositiveInfinity, string tooltip = null)Draws a number field with monospaced digits in a recessed box, an optional axis letter before the value, an optional unit after it, and a drag handle on hover.
| Parameter | Type | Default | Description |
|---|---|---|---|
box | Rect | The field's rect, 28 pt tall in forms or 24 pt in Inspector rows. | |
controlName | string | A control name, unique in the view. | |
value | float | The current value. | |
step | float | The step size. | |
axis | string | null | The axis letter, such as U, V or X, or null. |
unit | string | null | The unit label, or null. |
min | float | float.NegativeInfinity | The minimum value. |
max | float | float.PositiveInfinity | The maximum value. |
tooltip | string | null | The tooltip, or null. |
Returns: The new value.
NumberField
public static int NumberField(Rect box, string controlName, int value, int step, int min, int max, string axis = null, string tooltip = null)Draws an integer NumberField.
| Parameter | Type | Default | Description |
|---|---|---|---|
box | Rect | The field's rect, 28 pt tall in forms or 24 pt in Inspector rows. | |
controlName | string | A control name, unique in the view. | |
value | int | The current value. | |
step | int | The step size. | |
min | int | The minimum value. | |
max | int | The maximum value. | |
axis | string | null | The axis letter, or null. |
tooltip | string | null | The tooltip, or null. |
Returns: The new value.
Outline
public static void Outline(Rect r, Color colour, float width, float radius)Draws a rounded ring width points thick inside r, on Repaint.
| Parameter | Type | Description |
|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. |
colour | Color | The ring colour. |
width | float | The ring thickness, in points. |
radius | float | The corner radius, in points. |
PanelRow
public static Rect PanelRow(Rect row, string label, string tooltip = null, float controlHeight = PanelFieldHeight)Draws a label row's 13 pt label in a 96 pt column with an 8 pt gap after it, and returns the rect for the control.
| Parameter | Type | Default | Description |
|---|---|---|---|
row | Rect | The whole row's rect. | |
label | string | The label. | |
tooltip | string | null | The tooltip, or null. |
controlHeight | float | PanelFieldHeight | The control's height, centred on the row. |
Returns: The control's rect.
PanelSection
public static bool PanelSection(Rect r, string title, bool open)Draws a tool panel section title with a fold chevron.
| Parameter | Type | Description |
|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. |
title | string | The section title. |
open | bool | Whether the section is open. |
Returns: The new open state.
PanelSection
public static bool PanelSection(Rect r, string title, bool open, string foldKey, string tooltip = null)Draws the standard folding category header, with a 14 pt medium title at the panel's left edge, a 12 pt chevron on the right and no rule. The title turns white on hover, and the chevron rotates over 0.12 s.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view, 28 pt tall. | |
title | string | The section title. | |
open | bool | Whether the section is open. | |
foldKey | string | The key that tracks the fold animation, or null to use the title. | |
tooltip | string | null | The tooltip, or null. |
Returns: The new open state.
PanelTile
public static bool PanelTile(Rect r, string iconGlyph, string words, string keys = null, bool enabled = true, string tooltip = null, bool lit = false, bool labelled = true)Draws a single-line tool panel tile with a 16 pt glyph at x +10, a 14 pt title at x +36, and keys as keycaps right-aligned 8 pt from the edge. The keycaps are hidden when the title would not fit. The tile has no fill at rest and a pill on hover. A disabled tile uses Disabled ink with no pill, and a lit tile is light blue with a blue ring (see TileLook). Clicks register on release.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
iconGlyph | string | The icon name. | |
words | string | The label. | |
keys | string | null | The hotkey text, or null. |
enabled | bool | true | Whether the tile is enabled. A disabled tile draws in Disabled ink and ignores clicks. |
tooltip | string | null | The tooltip, or null. |
lit | bool | false | Whether the tile is lit. |
labelled | bool | true | Whether to draw the title and keycaps. Pass false for icon-only panels. |
Returns: True when clicked.
PrimaryChip
public static bool PrimaryChip(Rect r, string icon, string words, string meta = null, bool caret = false, string tooltip = null)Draws the solid primary chip. Use at most one per surface. It is 36 pt tall with corner radius 8, a primary fill and dark ink, with an optional monospaced meta label and chevron on the right.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
icon | string | The icon name, or null. | |
words | string | The label. | |
meta | string | null | A count shown on the right, or null. |
caret | bool | false | Whether to draw a dropdown chevron on the right. |
tooltip | string | null | The tooltip, or null. |
Returns: True when clicked.
Ring
public static void Ring(Rect r, Color colour, float radius = ControlRadius)Draws an anti-aliased rounded outline on Repaint, as used for billboard rings.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
colour | Color | The ring colour. | |
radius | float | ControlRadius | The corner radius, in points. |
RowFill
public static void RowFill(Rect row, bool hovered, bool selected, bool pressed = false)Draws a row's pill without its content, with a 2 pt margin above and below and corner radius 8. A hovered row gets a pill fill. The current row gets a blue tint that fades out across the row.
| Parameter | Type | Default | Description |
|---|---|---|---|
row | Rect | The whole row's rect. | |
hovered | bool | Whether the pointer is over the row. | |
selected | bool | Whether this is the current row. | |
pressed | bool | false | Whether the row is pressed. |
RowPill
public static bool RowPill(Rect r, string icon, string words, string meta = null, bool selected = false, bool enabled = true, string tooltip = null)Draws a row pill with a glyph, a label and a monospaced count on the right. Rows are 28 pt tall when compact and 36 pt tall for Settings navigation.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
icon | string | The icon name, or null. | |
words | string | The label. | |
meta | string | null | A count shown on the right, or null. |
selected | bool | false | Whether this is the current row. |
enabled | bool | true | Whether the row is enabled. A disabled row draws in Disabled ink and ignores clicks. |
tooltip | string | null | The tooltip, or null. |
Returns: True when clicked.
Segment
public static int Segment(Rect r, string[] words, int current, string[] icons = null, bool enabled = true, string[] tooltips = null)Draws a segmented control, the standard control for choosing one of several options. Cells have equal widths on a Muted track with a 2 pt inset, and the chosen cell is light blue with blue ink. A cell is chosen on mouse release.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view, 32 pt tall. | |
words | string[] | One label per cell. | |
current | int | The chosen index. | |
icons | string[] | null | One icon name per cell, or null. |
enabled | bool | true | Whether the control is enabled. A disabled control draws in Disabled ink and ignores clicks. |
tooltips | string[] | null | One tooltip per cell, or null. |
Returns: The chosen index.
SegmentCellWidth
public static float SegmentCellWidth(string word, bool hasIcon)Returns a cell's preferred width in SegmentHugging, including 8 pt of padding on each side.
| Parameter | Type | Description |
|---|---|---|
word | string | The label. |
hasIcon | bool | Whether the cell has a glyph. |
Returns: The width, in points.
Segmented
public static int Segmented(Rect r, string[] labels, int index)Draws a segmented choice in the Settings page style. Options are sized to their labels and right-aligned. The chosen option uses the Selected chip fill, an edge and accent text.
| Parameter | Type | Description |
|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. |
labels | string[] | One label per option. |
index | int | The chosen index. |
Returns: The chosen index.
SegmentHugging
public static int SegmentHugging(Rect r, string[] words, int current, string[] icons = null)Draws a Segment whose cells fit their labels instead of sharing the width equally (seg() in a group that shrinks to fit). It is placed at the left of r.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
words | string[] | One label per cell. | |
current | int | The chosen index. | |
icons | string[] | null | One icon name per cell, or null. |
Returns: The chosen index.
SegmentNaturalWidth
public static float SegmentNaturalWidth(string[] labels)Returns the width a segmented track needs for labels.
| Parameter | Type | Description |
|---|---|---|
labels | string[] | One label per option. |
Returns: The width.
ShowMenu
public static void ShowMenu(Menu menu, Rect? activator = null)Opens a grouped Menu under activator, or at the pointer when activator is null. Use it for right-click menus on tiles and chips, such as a module's presets.
| Parameter | Type | Default | Description |
|---|---|---|---|
menu | Menu | The menu. | |
activator | Rect? | null | The rect the menu opens under, or null to open at the pointer. |
ShowMenuStayOpen
public static void ShowMenuStayOpen(Rect activator, System.Func<Menu> build, float minWidth = 0f)Opens a menu that stays open while its rows are clicked. build creates the rows when the menu opens and after each click. The menu closes on Esc or a click outside.
| Parameter | Type | Default | Description |
|---|---|---|---|
activator | Rect | The rect of the control the menu opens from. | |
build | System.Func<Menu> | Builds the menu rows. | |
minWidth | float | 0f | The minimum menu width. |
Slider
public static float Slider(Rect r, float value, float min, float max, float notch = float.NaN)Draws a Suite slider with an accent fill and a white knob that turns to the accent colour while held. Clicking or dragging sets the value between min and max, rounded to 0.01. notch adds a soft detent, shown as a tick. The value snaps to it within 7 pt and can be dragged past it. Sets GUI.changed when the value is edited.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
value | float | The current value. | |
min | float | The minimum value. | |
max | float | The maximum value. | |
notch | float | float.NaN | A detent value, or NaN for none. |
Returns: The new value.
Snap
public static Rect Snap(Rect r)Snaps a rect to whole device pixels.
| Parameter | Type | Description |
|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. |
Returns: The snapped rect.
StepFloat
public static float StepFloat(Rect box, string controlName, float value, float step, float min, float max, string unit = null, string tooltip = null)Draws a draggable float field with an up/down handle that steps by step between min and max. An optional unit is shown inside the box.
| Parameter | Type | Default | Description |
|---|---|---|---|
box | Rect | The field's rect. | |
controlName | string | A control name, unique in the view. | |
value | float | The current value. | |
step | float | The step size. | |
min | float | The minimum value. | |
max | float | The maximum value. | |
unit | string | null | The unit label shown inside the box, or null. |
tooltip | string | null | The tooltip, or null. |
Returns: The new value.
StepInt
public static int StepInt(Rect box, string controlName, int value, int step, int min, int max, string tooltip = null)Draws a draggable integer field with an up/down handle that steps by step between min and max.
| Parameter | Type | Default | Description |
|---|---|---|---|
box | Rect | The field's rect. | |
controlName | string | A control name, unique in the view. | |
value | int | The current value. | |
step | int | The step size. | |
min | int | The minimum value. | |
max | int | The maximum value. | |
tooltip | string | null | The tooltip, or null. |
Returns: The new value.
Switch
public static bool Switch(Rect area, bool on, float width = 46, float height = 26)Draws a Settings switch. The knob position and track colour show the state.
| Parameter | Type | Default | Description |
|---|---|---|---|
area | Rect | The area. The switch is placed at its right edge. | |
on | bool | The current state. | |
width | float | 46 | The switch's width. |
height | float | 26 | The switch's height. |
Returns: The new state.
TagWidth
public static float TagWidth(string text)Returns a text tag's width, which is the text plus 8 pt of padding on each side.
| Parameter | Type | Description |
|---|---|---|
text | string | The text. |
Returns: The width.
TextField
public static string TextField(Rect r, string value, string placeholder, string controlName = null)Draws a Settings page text box.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
value | string | The current value. | |
placeholder | string | The text shown while the field is empty. | |
controlName | string | null | A control name for keyboard focus, unique in the view. |
Returns: The new text.
TextPrompt
public static void TextPrompt(Rect activator, string title, string initial, string okWords, Func<string, string> validate, Action<string> commit)Opens a small Suite text prompt under activator, with a title, one field, and OK and Cancel buttons. Enter confirms and Esc cancels. validate returns null for valid text, or a reason that is shown under the field while OK stays disabled. commit receives the trimmed text on the next editor tick.
| Parameter | Type | Description |
|---|---|---|
activator | Rect | The rect the prompt opens under, in GUI coordinates of the current view. |
title | string | The dialog's title. |
initial | string | The starting text. |
okWords | string | The OK button label. |
validate | Func<string, string> | Returns why the text is invalid, or null when it is valid. |
commit | Action<string> | Runs with the accepted text. |
TextPromptAtPointer
public static void TextPromptAtPointer(string title, string initial, string okWords, Func<string, string> validate, Action<string> commit)Opens a TextPrompt at the pointer. Use it from a menu item's action, after the menu row has closed.
| Parameter | Type | Description |
|---|---|---|
title | string | The dialog's title. |
initial | string | The starting text. |
okWords | string | The OK button label. |
validate | Func<string, string> | Returns why the text is invalid, or null when it is valid. |
commit | Action<string> | Runs with the accepted text. |
Tick
public static bool Tick(Rect r, string words, bool on, bool enabled = true, string tooltip = null)Draws a tick box, the standard control for an on/off option. The 16 pt box has corner radius 4, is outlined when off and solid primary with a tick when on, and is followed by a 13 pt label.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view, TickWidth wide and 28 pt tall. | |
words | string | The label. | |
on | bool | The current state. | |
enabled | bool | true | Whether the tick box is enabled. A disabled tick box draws in Disabled ink and ignores clicks. |
tooltip | string | null | The tooltip, or null. |
Returns: The new state.
TickWidth
public static float TickWidth(string words)Returns the width a Tick needs.
| Parameter | Type | Description |
|---|---|---|
words | string | The label. |
Returns: The width.
Tile
public static bool Tile(Rect r, string icon, string words, string keys = null, bool enabled = true, string tooltip = null, bool lit = false)Draws a tile, the same as PanelTile.
| Parameter | Type | Default | Description |
|---|---|---|---|
| r | Rect | The rect in GUI coordinates of the current view. | |
icon | string | The icon name. | |
words | string | The label. | |
keys | string | null | The hotkey text, or null. |
enabled | bool | true | Whether the tile is enabled. A disabled tile draws in Disabled ink and ignores clicks. |
tooltip | string | null | The tooltip, or null. |
lit | bool | false | Whether the tile is lit. |
Returns: True when clicked.
TileLook
public static (Color fill, Color ink, float title) TileLook(bool built, bool usable, bool mouseOver, bool lit, bool pressed)Returns the fill, glyph ink and title opacity of a Mesh tool panel tile for its state. Only usable tiles highlight on hover. Tiles that are not built yet are darker.
| Parameter | Type | Description |
|---|---|---|
built | bool | Whether the tool is built. |
usable | bool | Whether the tool can be used now. |
mouseOver | bool | Whether the pointer is over the tile. |
lit | bool | Whether the tile is lit. |
pressed | bool | Whether the tile is pressed. |
Returns: The fill, ink and title opacity.
TileLookEased
public static (Color fill, Color ink, float title, float ring, bool moving) TileLookEased(Rect r, bool built, bool usable, bool mouseOver, bool lit, bool pressed)Returns an animated TileLook for a tile you draw yourself, with the fill and ink blended between states and the strength of the lit ring. It matches TileLook when nothing is animating.
| Parameter | Type | Description |
|---|---|---|
| r | Rect | The tile's rect. |
built | bool | Whether the tool is built. |
usable | bool | Whether the tool can be used now. |
mouseOver | bool | Whether the pointer is over the tile. |
lit | bool | Whether the tile is lit. |
pressed | bool | Whether the tile is pressed. |
Returns: The fill, ink, title opacity, ring strength, and whether the tile is animating.
Tip
public static string Tip(string tooltip)Wraps a control's tooltip so it is hidden while a Suite menu is open.
| Parameter | Type | Description |
|---|---|---|
tooltip | string | The tooltip, or null. |
Returns: The tooltip, or null while a menu is open.
Related types
- RaptorSuiteControls.DrawerEase: The Suite drawer slide easing, for modules that animate a drawer's width.
- RaptorSuiteControls.FusedAction: One button of a FusedRow.
- RaptorSuiteControls.Menu: A grouped Suite menu built on RaptorSuiteMenu.Builder, with a header per group and separators between groups.
- RaptorSuiteSettingsPage: The Suite's Settings page.
- RaptorSuiteTheme: Colours, sizes, fonts and drawing helpers for the RAPTOR Suite.