Table of Contents

Class Control

Namespace
PluginUI
Assembly
PluginUI.dll

Base class of interactive widgets: vector style, optional skin (bitmap, film-strip, SVG, custom), label, pressed/hover state and the label/value layout helpers shared by most controls.

public abstract class Control : UIElement
Inheritance
Control
Derived
Inherited Members

Remarks

Rendering: if Skin is set it draws the widget, otherwise RenderVector(DrawingContext, Rect, VectorStyle) does. Labels and values are drawn by the control in both cases (see ShowLabel).

Constructors

Control()

Creates a control.

protected Control()

Properties

DefaultSize

Natural size used when no explicit size is given.

protected virtual Size DefaultSize { get; }

Property Value

Size

EffectiveStyle

Style in effect.

public VectorStyle EffectiveStyle { get; }

Property Value

VectorStyle

IsPressed

true while the primary button is held on the control.

[Browsable(false)]
public bool IsPressed { get; protected set; }

Property Value

bool

Label

Caption drawn by the control (null = none).

public string? Label { get; set; }

Property Value

string

Skin

Skin drawing the widget instead of the vector renderer (null = vector).

public IControlSkin? Skin { get; set; }

Property Value

IControlSkin

Style

Per-instance style (null = theme style for this control type).

public VectorStyle? Style { get; set; }

Property Value

VectorStyle

ValueText

Text drawn in the value area (null = no value area).

public virtual string? ValueText { get; }

Property Value

string

Methods

CornerRadiusFor(Rect, VectorStyle)

Corner radius for a rectangle according to Roundness.

protected static float CornerRadiusFor(Rect r, VectorStyle style)

Parameters

r Rect
style VectorStyle

Returns

float

DrawBox(DrawingContext, Rect, VectorStyle, bool, bool, Color?)

Draws a standard raised box (shadow, fill, hover overlay, frame) used by buttons and boxes.

protected void DrawBox(DrawingContext dc, Rect r, VectorStyle style, bool pressed, bool hovered, Color? fillOverride = null)

Parameters

dc DrawingContext
r Rect
style VectorStyle
pressed bool
hovered bool
fillOverride Color?

GetSkinState(Rect)

State passed to skins.

protected virtual SkinState GetSkinState(Rect widgetBounds)

Parameters

widgetBounds Rect

Returns

SkinState

LayoutParts(VectorStyle, out Rect, out Rect, out Rect)

Splits the bounds into label (top), widget and value (bottom) areas according to the style. Override to change the arrangement (e.g. label on the left for sliders).

protected virtual void LayoutParts(VectorStyle style, out Rect label, out Rect widget, out Rect value)

Parameters

style VectorStyle
label Rect
widget Rect
value Rect

MeasureOverride(Size)

Natural size of the content for the available size (margins excluded).

protected override Size MeasureOverride(Size available)

Parameters

available Size

Returns

Size

OnRender(DrawingContext)

Draws the element (below its children).

protected override void OnRender(DrawingContext dc)

Parameters

dc DrawingContext

OnRenderOverlay(DrawingContext)

Draws the keyboard focus ring.

protected override void OnRenderOverlay(DrawingContext dc)

Parameters

dc DrawingContext

RenderLabel(DrawingContext, Rect, VectorStyle)

Draws the label.

protected virtual void RenderLabel(DrawingContext dc, Rect area, VectorStyle style)

Parameters

dc DrawingContext
area Rect
style VectorStyle

RenderValue(DrawingContext, Rect, VectorStyle)

Draws the value text (controls with a value override ValueText).

protected virtual void RenderValue(DrawingContext dc, Rect area, VectorStyle style)

Parameters

dc DrawingContext
area Rect
style VectorStyle

RenderVector(DrawingContext, Rect, VectorStyle)

Vector rendering of the widget area.

protected abstract void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)

Parameters

dc DrawingContext
widget Rect
style VectorStyle