mirror of https://github.com/buggins/dlangui.git
212 lines
6.5 KiB
HTML
212 lines
6.5 KiB
HTML
<html><head>
|
|
<META http-equiv="content-type" content="text/html; charset=utf-8">
|
|
<title>dlangui.widgets.widget</title>
|
|
</head><body>
|
|
<h1>dlangui.widgets.widget</h1>
|
|
<!-- Generated by Ddoc from src/dlangui/widgets/widget.d -->
|
|
DLANGUI library.
|
|
<br><br>
|
|
This module contains declaration of Widget class - base class for all widgets.
|
|
<br><br>
|
|
|
|
Widgets are styleable. Use styleId property to set style to use from current Theme.
|
|
<br><br>
|
|
|
|
When any of styleable attributes is being overriden, <u>widget</u>'s own copy of style is being created to hold modified attributes (defaults to parent style).
|
|
<br><br>
|
|
|
|
Two phase layout model (like in Android UI) is used - measure() call is followed by layout() is used to measure and layout <u>widget</u> and its children.abstract
|
|
<br><br>
|
|
|
|
Method onDraw will be called to draw <u>widget</u> on some surface. Widget.onDraw() draws <u>widget</u> background (if any).
|
|
<br><br>
|
|
|
|
|
|
<br><br>
|
|
<b>Synopsis:</b><br>
|
|
<pre class="d_code"><font color=blue>import</font> dlangui.widgets.<u>widget</u>;
|
|
|
|
<font color=green>// access attributes as properties
|
|
</font><font color=blue>auto</font> w = <font color=blue>new</font> Widget(<font color=red>"id1"</font>);
|
|
w.backgroundColor = 0xFFFF00;
|
|
w.layoutWidth = FILL_PARENT;
|
|
w.layoutHeight = FILL_PARENT;
|
|
w.padding(Rect(10,10,10,10));
|
|
<font color=green>// same, but using chained method call
|
|
</font><font color=blue>auto</font> w = <font color=blue>new</font> Widget(<font color=red>"id1"</font>).backgroundColor(0xFFFF00).layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT).padding(Rect(10,10,10,10));
|
|
|
|
|
|
</pre>
|
|
|
|
<br><br>
|
|
<b>License:</b><br>
|
|
Boost License 1.0
|
|
<br><br>
|
|
<b>Authors:</b><br>
|
|
Vadim Lopatin, coolreader.org@gmail.com<br><br>
|
|
|
|
<dl><dt><big><a name="Visibility"></a>enum <u>Visibility</u>: ubyte;
|
|
</big></dt>
|
|
<dd><u>Visibility</u> (see Android View <u>Visibility</u>)<br><br>
|
|
|
|
<dl><dt><big><a name="Visibility.Visible"></a><u>Visible</u></big></dt>
|
|
<dd><u>Visible</u> on screen (default)<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="Visibility.Invisible"></a><u>Invisible</u></big></dt>
|
|
<dd>Not visible, but occupies a space in layout<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="Visibility.Gone"></a><u>Gone</u></big></dt>
|
|
<dd>Completely hidden, as not has been added<br><br>
|
|
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt><big><a name="OnClickHandler"></a>interface <u>OnClickHandler</u>;
|
|
</big></dt>
|
|
<dd>interface - slot for onClick<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="OnCheckHandler"></a>interface <u>OnCheckHandler</u>;
|
|
</big></dt>
|
|
<dd>interface - slot for onCheckChanged<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="OnFocusHandler"></a>interface <u>OnFocusHandler</u>;
|
|
</big></dt>
|
|
<dd>interface - slot for onFocusChanged<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="FocusMovement"></a>enum <u>FocusMovement</u>: int;
|
|
</big></dt>
|
|
<dd>focus movement options<br><br>
|
|
|
|
<dl><dt><big><a name="FocusMovement.None"></a><u>None</u></big></dt>
|
|
<dd>no focus movement<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="FocusMovement.Next"></a><u>Next</u></big></dt>
|
|
<dd>next focusable (Tab)<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="FocusMovement.Previous"></a><u>Previous</u></big></dt>
|
|
<dd>previous focusable (Shift+Tab)<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="FocusMovement.Up"></a><u>Up</u></big></dt>
|
|
<dd>move to nearest above<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="FocusMovement.Down"></a><u>Down</u></big></dt>
|
|
<dd>move to nearest below<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="FocusMovement.Left"></a><u>Left</u></big></dt>
|
|
<dd>move to nearest at left<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="FocusMovement.Right"></a><u>Right</u></big></dt>
|
|
<dd>move to nearest at right<br><br>
|
|
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt><big><a name="CursorType"></a>enum <u>CursorType</u>: int;
|
|
</big></dt>
|
|
<dd>standard mouse cursor types<br><br>
|
|
|
|
<dl><dt><big><a name="CursorType.Parent"></a><u>Parent</u></big></dt>
|
|
<dd>use parent's cursor<br><br>
|
|
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt><big><a name="WidgetList"></a>struct <u>WidgetList</u>;
|
|
</big></dt>
|
|
<dd>widget list holder<br><br>
|
|
|
|
<dl><dt><big><a name="WidgetList.count"></a>const @property int <u>count</u>();
|
|
</big></dt>
|
|
<dd>returns <u>count</u> of items<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetList.get"></a>Widget <u>get</u>(int <i>index</i>);
|
|
</big></dt>
|
|
<dd><u>get</u> item by <i>index</i><br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetList.add"></a>Widget <u>add</u>(Widget <i>item</i>);
|
|
</big></dt>
|
|
<dd><u>add</u> <i>item</i> to list<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetList.insert"></a>Widget <u>insert</u>(Widget <i>item</i>, int <i>index</i> = -1);
|
|
</big></dt>
|
|
<dd>add <i>item</i> to list<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetList.indexOf"></a>int <u>indexOf</u>(Widget <i>item</i>);
|
|
</big></dt>
|
|
<dd>find child index for <i>item</i>, return -1 if not found<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetList.indexOf"></a>int <u>indexOf</u>(string <i>id</i>);
|
|
</big></dt>
|
|
<dd>find child index for item by <i>id</i>, return -1 if not found<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetList.remove"></a>Widget <u>remove</u>(int <i>index</i>);
|
|
</big></dt>
|
|
<dd><u>remove</u> item from list, return removed item<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetList.clear"></a>void <u>clear</u>();
|
|
</big></dt>
|
|
<dd>remove and destroy all items<br><br>
|
|
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt><big><a name="WidgetGroup"></a>class <u>WidgetGroup</u>: dlangui.widgets.widget.Widget;
|
|
</big></dt>
|
|
<dd>base class for widgets which have children<br><br>
|
|
|
|
<dl><dt><big><a name="WidgetGroup.childCount"></a>@property int <u>childCount</u>();
|
|
</big></dt>
|
|
<dd>returns number of children of this widget<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetGroup.child"></a>Widget <u>child</u>(int <i>index</i>);
|
|
</big></dt>
|
|
<dd>returns <u>child</u> by <i>index</i><br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetGroup.addChild"></a>Widget <u>addChild</u>(Widget <i>item</i>);
|
|
</big></dt>
|
|
<dd>adds child, returns added <i>item</i><br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetGroup.removeChild"></a>Widget <u>removeChild</u>(int <i>index</i>);
|
|
</big></dt>
|
|
<dd>removes child, returns removed item<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetGroup.removeChild"></a>Widget <u>removeChild</u>(string <i>ID</i>);
|
|
</big></dt>
|
|
<dd>removes child by <i>ID</i>, returns removed item<br><br>
|
|
|
|
</dd>
|
|
<dt><big><a name="WidgetGroup.childIndex"></a>int <u>childIndex</u>(Widget <i>item</i>);
|
|
</big></dt>
|
|
<dd>returns index of widget in child list, -1 if passed widget is not a child of this widget<br><br>
|
|
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
</dl>
|
|
|
|
<hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. Vadim Lopatin, 2014
|
|
</small>
|
|
</body></html>
|