Module dlangui.widgets.widget

This module contains 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 dlangui.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

Name Description
generatePropertySetter use in mixin to set this object property with name propName with value of variable value if variable name matches propName
generatePropertySetters use in mixin to set this object properties with names from parameter list with value of variable value if variable name matches propName
generatePropertySettersMethodOverride 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

Name Description
OnCheckHandler interface - slot for onCheckChanged
OnClickHandler interface - slot for onClick
OnFocusHandler interface - slot for onFocusChanged
OnKeyHandler interface - slot for onKey
OnMouseHandler interface - slot for onMouse

Classes

Name Description
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

Name Description
AnimationHelper Helper to handle animation progress

Enums

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

Templates

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

Enum values

Name Type Description
ONE_SECOND

Aliases

Name Type Description
WidgetList Widget list holder.

Authors

Vadim Lopatin, coolreader.org@gmail.com

Copyright

Vadim Lopatin, 2014

License

Boost License 1.0