Get RAPTOR

RaptorSuiteMenuCard

Rows for a menu with a custom body (RaptorSuiteMenu.ShowDrawn), each ending in a switch, number field or segment.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0

Draws rows for a menu with a custom body (RaptorSuiteMenu.ShowDrawn). Rows use the same section labels, dividers, hover pill, 16 pt icon and label as Suite menu rows, and each ends in a switch, a number field or a segment. Call on every event from IMGUI drawing code. Rows respect GUI.enabled.

public static class RaptorSuiteMenuCard

Fields

ControlHeight

public const float ControlHeight;

The height of a row's number field or segment.

FieldWidth

public const float FieldWidth;

The width of a row's number field.

HeaderHeight

public const float HeaderHeight;

The height of a section label.

Inset

public const float Inset;

The distance from a row's edge to its icon. Use it to align other content with the icons.

Pad

public const float Pad;

The card's padding around its rows.

RowHeight

public const float RowHeight;

The height of a row.

SeparatorHeight

public const float SeparatorHeight;

The height of a divider.

Methods

public static void Header(Rect row, string words)

Draws a small grey section label. The label does not dim when the rows below it are disabled.

ParameterTypeDescription
rowRectThe label's rect, HeaderHeight tall.
wordsstringThe text.

Note

public static void Note(Rect rect, string words)

Draws small, wrapped secondary text.

ParameterTypeDescription
rectRectThe text rect.
wordsstringThe text.

NoteHeight

public static float NoteHeight(string words, float width)

Returns the height Note needs for the text.

ParameterTypeDescription
wordsstringThe text.
widthfloatThe wrap width.

Returns: The height.

NumberField

public static float NumberField(Rect box, string controlName, float value, float step, string unit = null, float min = float.NegativeInfinity, float max = float.PositiveInfinity)

Draws a row's number field. When disabled, only the digits dim.

ParameterTypeDefaultDescription
boxRectThe rect from Row.
controlNamestringA control name, unique in the view.
valuefloatThe current value.
stepfloatThe step size.
unitstringnullThe unit label, or null.
minfloatfloat.NegativeInfinityThe minimum value.
maxfloatfloat.PositiveInfinityThe maximum value.

Returns: The new value.

NumberField

public static int NumberField(Rect box, string controlName, int value, int step, int min, int max)

Draws a row's integer number field. When disabled, only the digits dim.

ParameterTypeDescription
boxRectThe rect from Row.
controlNamestringA control name, unique in the view.
valueintThe current value.
stepintThe step size.
minintThe minimum value.
maxintThe maximum value.

Returns: The new value.

Row

public static Rect Row(Rect row, string icon, string words, float controlWidth, float controlHeight = ControlHeight)

Draws a row's hover pill, icon and label. Draw the row's control in the returned rect.

ParameterTypeDefaultDescription
rowRectThe row's rect, RowHeight tall.
iconstringThe option's icon, or null to leave the icon space empty.
wordsstringThe option's label.
controlWidthfloatThe preferred control width. A narrow row may give it less.
controlHeightfloatControlHeightThe control's height.

Returns: The control's rect, at the row's right edge.

Segment

public static int Segment(Rect control, string[] labels, int index)

Draws a row's segmented control, with labels at menu-row text size.

ParameterTypeDescription
controlRectThe rect from Row.
labelsstring[]One label per option.
indexintThe selected index.

Returns: The selected index.

SegmentWidth

public static float SegmentWidth(string[] labels)

Returns the preferred width of a row's Segment.

ParameterTypeDescription
labelsstring[]One label per option.

Returns: The width.

Separator

public static void Separator(Rect row)

Draws a thin divider between sections.

ParameterTypeDescription
rowRectThe divider's rect, SeparatorHeight tall.

SwitchRow

public static bool SwitchRow(Rect row, string icon, string words, bool on)

Draws a row that ends in a Suite switch. A left click anywhere on the row toggles it.

ParameterTypeDescription
rowRectThe row's rect, RowHeight tall.
iconstringThe option's icon, or null to leave the icon space empty.
wordsstringThe option's label.
onboolThe current state.

Returns: The new state.

  • RaptorSuiteMenu: The menu used by every RAPTOR dropdown, with icon and label rows, ticks, hotkeys and section headers.