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
EffectiveStyle
Style in effect.
public VectorStyle EffectiveStyle { get; }
Property Value
IsPressed
true while the primary button is held on the control.
[Browsable(false)]
public bool IsPressed { get; protected set; }
Property Value
Label
Caption drawn by the control (null = none).
public string? Label { get; set; }
Property Value
Skin
Skin drawing the widget instead of the vector renderer (null = vector).
public IControlSkin? Skin { get; set; }
Property Value
Style
Per-instance style (null = theme style for this control type).
public VectorStyle? Style { get; set; }
Property Value
ValueText
Text drawn in the value area (null = no value area).
public virtual string? ValueText { get; }
Property Value
Methods
CornerRadiusFor(Rect, VectorStyle)
Corner radius for a rectangle according to Roundness.
protected static float CornerRadiusFor(Rect r, VectorStyle style)
Parameters
rRectstyleVectorStyle
Returns
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
dcDrawingContextrRectstyleVectorStylepressedboolhoveredboolfillOverrideColor?
GetSkinState(Rect)
State passed to skins.
protected virtual SkinState GetSkinState(Rect widgetBounds)
Parameters
widgetBoundsRect
Returns
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
styleVectorStylelabelRectwidgetRectvalueRect
MeasureOverride(Size)
Natural size of the content for the available size (margins excluded).
protected override Size MeasureOverride(Size available)
Parameters
availableSize
Returns
OnRender(DrawingContext)
Draws the element (below its children).
protected override void OnRender(DrawingContext dc)
Parameters
OnRenderOverlay(DrawingContext)
Draws the keyboard focus ring.
protected override void OnRenderOverlay(DrawingContext dc)
Parameters
RenderLabel(DrawingContext, Rect, VectorStyle)
Draws the label.
protected virtual void RenderLabel(DrawingContext dc, Rect area, VectorStyle style)
Parameters
dcDrawingContextareaRectstyleVectorStyle
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
dcDrawingContextareaRectstyleVectorStyle
RenderVector(DrawingContext, Rect, VectorStyle)
Vector rendering of the widget area.
protected abstract void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)
Parameters
dcDrawingContextwidgetRectstyleVectorStyle