Abstract attributes for typical, rectangular, resizable user input objects such as sliders, pickers and swatches. Inherit your own attributes for your custom input objects from this class whenever possible to ensure a consistent look and feel.
T where IParameter

Constructors

UserInputAttributes

#
protected UserInputAttributes(T owner, int verticalUnits = 1)
Base class constructor.
owner (T)
verticalUnits (int = 1)

Properties

AggregateBounds

public RectangleF AggregateBounds { get; }
Gets the aggregate bounds of this object. This will include the bounds of all objects attached in some way to this object.
inherited fromAttributes<T>
AggregateBounds

AllowVerticalResize

#
public virtual bool AllowVerticalResize { get; }
Gets whether these attributes can be resized vertically.

Bounds

public RectangleF Bounds { get; protected set; }
Gets the total outer bounds of the attributes. The attributes are assumed not to exist beyond this limit. Note that the bounds are updated during calls to Layout(), so may be out-of-date or even unset when called outside of the usual process.
inherited fromAttributes<T>
Bounds

DrawOnTop

#
protected virtual bool DrawOnTop { get; }
Override this property if the hosted control ought to be drawn on top of the underlying attributes.
This is added so that these attributes can be included in the ResizeAction unto mechanism.
Size

HasInlet

#
public override bool HasInlet { get; }

HasOutlet

#
public override bool HasOutlet { get; }

HostingBounds

#
protected RectangleF HostingBounds { get; }
Gets the hosting bounds as currently layed out.

Inlet

#
public override PointF Inlet { get; }

IntegerPivot

protected virtual bool IntegerPivot { get; }
Gets whether the pivot of these attributes is always rounded to integer coordinates. By default this property returns true, as the vast majority of objects ought to be laid out in integer coordinates.
inherited fromAttributes<T>

MaximumHeightUnits

#
public virtual int MaximumHeightUnits { get; }
Gets the maximum number of height units for resizable attributes. By default this value is 10.

MinimumHostingWidth

#
public virtual int MinimumHostingWidth { get; }
Gets the minimum allowed width of the hosting region.

Outlet

#
public override PointF Outlet { get; }

Owner

public T Owner { get; }
inherited fromAttributes<T>

Pivot

public PointF Pivot { get; set; }
Gets or sets the pivot point for these attributes. The pivot is the main point around which the attribute geometry is positioned during layout.
inherited fromAttributes<T>
Pivot

Responder

#
public Responses Responder { get; }
Gets the Responses dispatcher for these attributes. Subclasses can subscribe to the hook events on the returned object to extend interaction behaviour beyond what the HostMouseDown(ResponseMouseArgs) family covers.
Responder

ShowUiButton

#
public bool ShowUiButton { get; }

Snappable

public virtual bool Snappable { get; }
Gets whether these attributes can be used to align other objects on the canvas. Return false specifically when your object shape is not rectangular.
inherited fromAttributes<T>
Snappable

Stack

protected StackF Stack { get; set; }
The horizontal layout stack along the apex row. Derived classes typically (re)assign this during Attributes<T>.Layout(Shape) and reference sub-regions via class-local index constants. The default Attributes<T>.PivotMoved(PointF, PointF) translates the stack along with Attributes<T>.Bounds.
inherited fromAttributes<T>

UiButtonBounds

#
public RectangleF UiButtonBounds { get; }
Gets the bounds of the UI popup button. Empty if the button is not shown. Exposed so external consumers (such as canvas hints) can target the button without reaching into the protected layout stack.

VerticalUnits

#
public int VerticalUnits { get; set; }

Methods

DefaultTooltipContent

protected bool DefaultTooltipContent(PointF point, out IIcon icon, out string caption, out string message, out object details, out bool warnings, out bool errors)
Create the tooltip fields which are associated with this object by default.
inherited fromAttributes<T>
point (PointF)Point for tooltip.
icon (out IIcon)Icon.
caption (out string)Caption text.
message (out string)Message text.
details (out object)Either text or an Action<Context, Rectangle> or null.
warnings (out bool)Boolean flag indicating the existence of warnings.
errors (out bool)Boolean flag indicating the existence of errors.
True if a tooltip ought to be shown for this object at the given location.

Draw

protected virtual void Draw(Context context, Skin skin, Capsule capsule)
Internal drawing method. Consider overriding this one instead of Attributes<T>.Draw(Context, Skin).
inherited fromAttributes<T>
context (Context)Graphics context.
skin (Skin)Skin.
capsule (Capsule)Provided as a courtesy. There is no expectation this is the shape that must be drawn.

Draw

#
public override void Draw(Context context, Skin skin)
context (Context)
skin (Skin)

DrawHostedControl

#
protected abstract void DrawHostedControl(Context context, Skin skin, RectangleF bounds)
context (Context)
skin (Skin)
bounds (RectangleF)
Explicit

ICursorAwareAttributes.CursorAt

#
Cursor ICursorAwareAttributes.CursorAt(PointF point)
point (PointF)
CursorAt

HandleDoubleClick

public virtual bool HandleDoubleClick(PointF point)
Handle a double click operation on these attributes. Since this is such a common operation it is provided by the base interface, rather than requiring an IResponseAttribues implementation.
inherited fromAttributes<T>
point (PointF)
HandleDoubleClick

HostCursorAt

#
protected virtual Cursor HostCursorAt(PointF point)
Override to supply a cursor for a point over the hosted control, e.g. hover feedback over interactive elements the host draws. Called by the ICursorAwareAttributes implementation once the resize-grip cursors have been ruled out. Return null (the default) for the standard cursor.
point (PointF)Cursor location in content coordinates.

HostingBoundsChanged

#
protected virtual void HostingBoundsChanged(RectangleF newBounds)
Invoked when the bounds of the hosting control are changed. Override this method if you want to take action upon a resize.
newBounds (RectangleF)

HostKeyDown

#
protected virtual Response HostKeyDown(KeyEventArgs e)
e (KeyEventArgs)

HostKeyUp

#
protected virtual Response HostKeyUp(KeyEventArgs e)
e (KeyEventArgs)

HostMouseDoubleClick

#
protected virtual Response HostMouseDoubleClick(ResponseMouseArgs e)
e (ResponseMouseArgs)

HostMouseDown

#
protected virtual Response HostMouseDown(ResponseMouseArgs e)
e (ResponseMouseArgs)

HostMouseDrag

#
protected virtual Response HostMouseDrag(ResponseMouseArgs e)
e (ResponseMouseArgs)

HostMouseLeave

#
protected virtual void HostMouseLeave()
Override to react to the cursor moving off this attribute, e.g. by clearing any cached mouseover index. Default: no-op.

HostMouseOver

#
protected virtual void HostMouseOver(ResponseMouseArgs e)
Override to respond to mouseover cursor motion (no buttons held). Called on every cursor motion while the cursor is coincident with this attribute. Default: no-op.
e (ResponseMouseArgs)Mouse event in content coordinates.

HostMouseSingleClick

#
protected virtual Response HostMouseSingleClick(ResponseMouseArgs e)
e (ResponseMouseArgs)

HostMouseUp

#
protected virtual Response HostMouseUp(ResponseMouseArgs e)
e (ResponseMouseArgs)

HostRotation

#
protected virtual Response HostRotation(ResponseRotationArgs e)
Override to respond to a rotation gesture (trackpad two-finger rotate) over the host region. Default: no-op.
e (ResponseRotationArgs)Rotation event in content coordinates.

Intersects

public virtual bool Intersects(RectangleF box)
Test whether a given rectangle intersects the shape of these attributes.
inherited fromAttributes<T>
box (RectangleF)Intersection box.
True if rectangle intersects these attributes.
Intersects

InvalidateDisplay

public virtual void InvalidateDisplay()
Signals that the attribute's visual appearance has changed without affecting layout. Fires the owner's DocumentObject.OnDisplayChanged(), which propagates through the document to the canvas redraw subscription.
inherited fromAttributes<T>
InvalidateDisplay

InvalidateLayout

#
public override void InvalidateLayout()
Marks the layout as dirty so it gets recomputed on the next draw cycle. Subclasses typically flip an internal _layoutValid flag. Most callers should also raise OnLayoutChanged on the owner to actually trigger a canvas redraw.

IsCoincident

public virtual bool IsCoincident(PointF point)
Test whether a given point is considered to be on the interior of these attributes.
inherited fromAttributes<T>
point (PointF)Test point.
True if point is on the object.
IsCoincident

IsContained

public virtual bool IsContained(RectangleF box)
Test whether the shape of these attributes is fully contained within a given rectangle.
inherited fromAttributes<T>
box (RectangleF)Containment box.
True if rectangle contains these attributes.
IsContained

Layout

#
public override void Layout(Shape shape)
shape (Shape)

Move

public virtual void Move(float dx, float dy)
Move these attributes a certain amount in X and Y.
inherited fromAttributes<T>
dx (float)Motion in X. Positive is towards the right.
dy (float)Motion in Y. Positive is downwards.
Move

PivotMoved

#
protected override void PivotMoved(PointF oldPivot, PointF newPivot)
Override this method if your attributes need to handle pivot motion. The default implementation translates Bounds and Stack by the pivot delta. Overrides should typically chain to this base implementation.
oldPivot (PointF)
newPivot (PointF)

ShowTooltipAt

#
public override bool ShowTooltipAt(PointF point)
point (PointF)

ShowUi

#
protected virtual void ShowUi()
Override this method to handle clicks on the UI button.

TooltipDetails

protected virtual object TooltipDetails(PointF point, ObjectSolutionState state)
Override this method to return custom details for a tooltip.
inherited fromAttributes<T>
point (PointF)
state (ObjectSolutionState)
One of the acceptable types of data for details. For example an array of LazyStrings or a Action<Context, RectangleF>.