Class SerenityUiWireframePainter
Draws SerenityUiPreviewWindow's structural wireframe mode: labeled boxes for a UnityCompositeViewDefinition's flexbox tree, and a menu-shaped block of option rows for a leaf UnityMenuSettingsDefinition. Extracted from the window verbatim (zero behaviour change) purely to keep the window under the project's file-size ratchet.
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Editor
Assembly: Serenity.UnityUi.Infrastructure.Editor.dll
Syntax
public sealed class SerenityUiWireframePainter
Remarks
A handful of members stay public static because the window's own live-render mode (a completely
separate drawing path) already called them directly before the split: Inset(Rect, float),
DrawScreenBorder(Rect) and DrawOutline(Rect, Color, float) are generic rect-drawing helpers with no
wireframe-specific state, and DefName(UnityViewDefinition) is a pure formatter the window's toolbar and footer
also need. ResolveActiveChildId(UnityCompositeViewDefinition, List<UnityCompositeViewChild>) is the one instance member exposed the same way, because
the window's live-render path resolves a composite's active switcher tab through the same
Serenity.Ui.Infrastructure.Editor.SerenityUiWireframePainter._activeOverrides a wireframe tab click writes to — the two modes share one notion of
"which tab is active", not two independent ones.
Constructors
SerenityUiWireframePainter(Func<UnityViewDefinition>, Action<Rect>)
Declaration
public SerenityUiWireframePainter(Func<UnityViewDefinition> selectedProvider, Action<Rect> drawBackdrop)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<UnityViewDefinition> | selectedProvider | Returns the definition to draw, live at draw time. |
| Action<Rect> | drawBackdrop | Paints whatever backdrop the window has configured behind the wireframe. |
Methods
DefName(UnityViewDefinition)
The definition's id, falling back to its asset name — the one formatter both the wireframe and the window's own toolbar/footer need.
Declaration
public static string DefName(UnityViewDefinition def)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityViewDefinition | def |
Returns
| Type | Description |
|---|---|
| string |
Draw(Rect)
Draws the wireframe for whatever Serenity.Ui.Infrastructure.Editor.SerenityUiWireframePainter._selectedProvider currently returns, inside canvasRect.
Declaration
public void Draw(Rect canvasRect)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | canvasRect |
DrawOutline(Rect, Color, float)
Draws a rectangular outline of thickness t. Public: the window's live-render mode draws its selection highlight with it too.
Declaration
public static void DrawOutline(Rect r, Color c, float t)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | r | |
| Color | c | |
| float | t |
DrawScreenBorder(Rect)
Thin 1px outline around the whole rendered frame. Public: the window's live-render mode draws its own screen border with it too.
Declaration
public static void DrawScreenBorder(Rect r)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | r |
Inset(Rect, float)
Shrinks a rect by by on every side. Public: the window's live-render mode insets its own rects with it too.
Declaration
public static Rect Inset(Rect r, float by)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | r | |
| float | by |
Returns
| Type | Description |
|---|---|
| Rect |
ResolveActiveChildId(UnityCompositeViewDefinition, List<UnityCompositeViewChild>)
The element id an active switcher child resolves to: an author's own tab click in this painter's
wireframe, then the definition's own InitialActiveChildId, then the first child. Public
because the window's live-render mode resolves the same switcher's active tab the same way, so the
two drawing paths agree on which child is showing.
Declaration
public string ResolveActiveChildId(UnityCompositeViewDefinition def, List<UnityCompositeViewChild> children)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityCompositeViewDefinition | def | |
| List<UnityCompositeViewChild> | children |
Returns
| Type | Description |
|---|---|
| string |