Module dcanvas.widgets.widget

Declaration of Widget class - base class for all widgets.

Widgets are styleable. Use styleId property to set style to use from current Theme.

When any of styleable attributes is being overriden, widget's own copy of style is being created to hold modified attributes (defaults to parent style).

Two phase layout model (like in Android UI) is used - measure() call is followed by layout() is used to measure and layout widget and its children.abstract

Method onDraw will be called to draw widget on some surface. Widget.onDraw() draws widget background (if any).

Synopsis

import dcanvas.widgets.widget;

// access attributes as properties
auto w = new Widget("id1");
w.backgroundColor = 0xFFFF00;
w.layoutWidth = FILL_PARENT;
w.layoutHeight = FILL_PARENT;
w.padding(Rect(10,10,10,10));
// same, but using chained method call
auto w = new Widget("id1").backgroundColor(0xFFFF00).layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT).padding(Rect(10,10,10,10));

Functions

NameDescription
generatePropertySetter(propName) use in mixin to set this object property with name propName with value of variable value if variable name matches propName
generatePropertySetters(propNames) use in mixin to set this object properties with names from parameter list with value of variable value if variable name matches propName
generatePropertySettersMethodOverride(methodName, typeName, propNames) use in mixin for method override to set this object properties with names from parameter list with value of variable value if variable name matches propName

Interfaces

NameDescription
OnActionHandler interface - slot for onAction
OnCheckHandler interface - slot for onCheckChanged
OnClickHandler interface - slot for onClick
OnDoubleClickHandler Interface slot for OnDoubleClick
OnFocusHandler interface - slot for onFocusChanged
OnKeyActionHandler interface - slot for keyToAction
OnKeyHandler interface - slot for onKey
OnMouseHandler interface - slot for onMouse

Classes

NameDescription
Widget Base class for all widgets.
WidgetGroup Base class for widgets which have children.
WidgetGroupDefaultDrawing WidgetGroup with default drawing of children (just draw all children)

Structs

NameDescription
AnimationHelper Helper to handle animation progress
TextTypingShortcutHelper helper for locating items in list, tree, table or other controls by typing their name

Enums

NameDescription
CursorType standard mouse cursor types
FocusMovement focus movement options
FocusReason
Orientation
Visibility Visibility (see Android View Visibility)

Templates

NameDescription
ActionTooltipSupport mixin this to widget class to support tooltips based on widget's action label

Manifest constants

NameTypeDescription
ONE_SECOND

Global variables

NameTypeDescription
TOUCH_MODE bool

Aliases

NameTypeDescription
WidgetList ObjectList!(dcanvas.widgets.widget.Widget) Widget list holder.