# dlangui.widgets.widget

DLANGUI library.
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));

License:
Boost License 1.0
Authors:
Vadim Lopatin, coolreader.org@gmail.com

enum Visibility: ubyte;
  Visibility (see Android View Visibility)
  Visible
    Visible on screen (default)
  Invisible
    Not visible, but occupies a space in layout
  Gone
    Completely hidden, as not has been added
interface OnClickHandler;
  interface - slot for onClick
interface OnCheckHandler;
  interface - slot for onCheckChanged
interface OnFocusHandler;
  interface - slot for onFocusChanged
enum FocusMovement: int;
  focus movement options
  None
    no focus movement
  Next
    next focusable (Tab)
  Previous
    previous focusable (Shift+Tab)
  Up
    move to nearest above
  Down
    move to nearest below
  Left
    move to nearest at left
  Right
    move to nearest at right
enum CursorType: int;
  standard mouse cursor types
  Parent
    use parent's cursor
struct WidgetList;
  widget list holder
  const @property int count();
    returns count of items
  Widget get(int index);
    get item by index
  Widget add(Widget item);
    add item to list
  Widget insert(Widget item, int index = -1);
    add item to list
  int indexOf(Widget item);
    find child index for item, return -1 if not found
  int indexOf(string id);
    find child index for item by id, return -1 if not found
  Widget remove(int index);
    remove item from list, return removed item
  void clear();
    remove and destroy all items
class WidgetGroup: dlangui.widgets.widget.Widget;
  base class for widgets which have children
  @property int childCount();
    returns number of children of this widget
  Widget child(int index);
    returns child by index
  Widget addChild(Widget item);
    adds child, returns added item
  Widget removeChild(int index);
    removes child, returns removed item
  Widget removeChild(string ID);
    removes child by ID, returns removed item
  int childIndex(Widget item);
    returns index of widget in child list, -1 if passed widget is not a child of this widget

Page generated by Ddoc. Vadim Lopatin, 2014