RaptorSuiteMenuCard
Rows for a menu with a custom body (RaptorSuiteMenu.ShowDrawn), each ending in a switch, number field or segment.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, 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 RaptorSuiteMenuCardFields
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
Header
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.
| Parameter | Type | Description |
|---|---|---|
row | Rect | The label's rect, HeaderHeight tall. |
words | string | The text. |
Note
public static void Note(Rect rect, string words)Draws small, wrapped secondary text.
| Parameter | Type | Description |
|---|---|---|
rect | Rect | The text rect. |
words | string | The text. |
NoteHeight
public static float NoteHeight(string words, float width)Returns the height Note needs for the text.
| Parameter | Type | Description |
|---|---|---|
words | string | The text. |
width | float | The 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
box | Rect | The rect from Row. | |
controlName | string | A control name, unique in the view. | |
value | float | The current value. | |
step | float | The step size. | |
unit | string | null | The unit label, or null. |
min | float | float.NegativeInfinity | The minimum value. |
max | float | float.PositiveInfinity | The 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.
| Parameter | Type | Description |
|---|---|---|
box | Rect | The rect from Row. |
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. |
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.
| Parameter | Type | Default | Description |
|---|---|---|---|
row | Rect | The row's rect, RowHeight tall. | |
icon | string | The option's icon, or null to leave the icon space empty. | |
words | string | The option's label. | |
controlWidth | float | The preferred control width. A narrow row may give it less. | |
controlHeight | float | ControlHeight | The 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.
| Parameter | Type | Description |
|---|---|---|
control | Rect | The rect from Row. |
labels | string[] | One label per option. |
index | int | The selected index. |
Returns: The selected index.
SegmentWidth
public static float SegmentWidth(string[] labels)Returns the preferred width of a row's Segment.
| Parameter | Type | Description |
|---|---|---|
labels | string[] | One label per option. |
Returns: The width.
Separator
public static void Separator(Rect row)Draws a thin divider between sections.
| Parameter | Type | Description |
|---|---|---|
row | Rect | The 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.
| Parameter | Type | Description |
|---|---|---|
row | Rect | The row's rect, RowHeight tall. |
icon | string | The option's icon, or null to leave the icon space empty. |
words | string | The option's label. |
on | bool | The current state. |
Returns: The new state.
Related types
- RaptorSuiteMenu: The menu used by every RAPTOR dropdown, with icon and label rows, ticks, hotkeys and section headers.