Get RAPTOR

RaptorSuiteModuleDialog

The base class for a module's dialog in the RAPTOR Suite.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0

Module dialogs use the same card as the core dialogs, with a title and a close button. Enter calls Confirm, and Esc or a click outside closes a modal dialog. Open one with RaptorSuiteApi.OpenDialog.

public abstract class RaptorSuiteModuleDialog

Fields

ButtonHeight

public const float ButtonHeight;

The height of the dialog buttons (Cancel and the primary action), in points.

FieldHeight

public const float FieldHeight;

The height of a text or number field, in points.

Gap

public const float Gap;

The standard gap between dialog rows, in points.

LabelHeight

public const float LabelHeight;

The height of a field label row, in points.

Padding

public const float Padding;

The card padding around the title and body, in points.

TitleHeight

public const float TitleHeight;

The height of the title row, in points.

Properties

IsOpen

public bool IsOpen { get; }

Whether a Suite is showing this dialog.

Label

public static GUIStyle Label { get; }

The dialog's 14-pt label style.

public virtual bool Modal { get; }

Whether the dialog is modal. Defaults to true. A modal dialog dims the Suite and closes on a click outside. A non-modal dialog floats under the options band and lets clicks reach the views; use it for a dialog with a live preview.

RAPTOR calls it.

Note

public static GUIStyle Note { get; }

The dialog's 13-pt wrapping note style.

RequestClose

public Action RequestClose { get; }

Closes this dialog. Null while the dialog is not open, so call it as RequestClose?.Invoke().

Size

public abstract Vector2 Size { get; }

The card size in points. The Suite shrinks it to fit a small window.

RAPTOR calls it.

Title

public abstract string Title { get; }

The text in the card's title row.

RAPTOR calls it.

TitleStyle

public static GUIStyle TitleStyle { get; }

The dialog's 18-pt title style.

Methods

Buttons

public bool Buttons(Rect body, string primaryText, bool canConfirm)

Draws Cancel and the primary button, right-aligned along the bottom of body. Cancel closes the dialog.

ParameterTypeDescription
bodyRectThe dialog's body.
primaryTextstringThe primary button's text.
canConfirmboolWhether the primary button is enabled.

Returns: True when the primary button was clicked while canConfirm is true.

Closed

public virtual void Closed()

Called once when the dialog closes, for any reason. RequestClose is already null.

RAPTOR calls it.

Confirm

public abstract bool Confirm()

Runs the primary action, from Enter or the primary button.

Returns: True to close the dialog.

RAPTOR calls it.

ConsumeEscape

public virtual bool ConsumeEscape()

Called when Esc is pressed, before the Suite handles it. Override it to handle Esc yourself, for example to end a drag.

Returns: True when the dialog used the key. False lets the Suite close the dialog.

RAPTOR calls it.

DrawBody

public abstract void DrawBody(Rect body)

Draws everything below the title, inside body, in the dialog pane's GUI coordinates.

ParameterTypeDescription
bodyRectThe area below the title.

RAPTOR calls it.

Opened

public virtual void Opened()

Called once when the Suite shows the dialog. RequestClose is already set.

RAPTOR calls it.

PrimaryButton

public static bool PrimaryButton(Rect r, string text)

Draws the standard primary button.

ParameterTypeDescription
rRectThe button's area.
textstringThe button text.

Returns: True when clicked.

  • RaptorSuiteApi: The Suite's state and actions for modules in other assemblies.