fix backspace in text widget
@@ -4,5 +4,5 @@ full_description = 'A UI library'
|
||||
file = { 'luigi' }
|
||||
format = 'markdown'
|
||||
|
||||
new_type('widget', 'Widget Types', true)
|
||||
new_type('attrib', 'Widget Attributes', false)
|
||||
new_type('widget', 'Widgets', true)
|
||||
new_type('attrib', 'Attributes', false)
|
||||
|
||||
@@ -42,18 +42,19 @@
|
||||
<li><a href="../classes/Layout.html">Layout</a></li>
|
||||
<li><a href="../classes/Widget.html">Widget</a></li>
|
||||
</ul>
|
||||
<h2>Widget Types</h2>
|
||||
<h2>Widgets</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../widget types/button.html">button</a></li>
|
||||
<li><a href="../widget types/check.html">check</a></li>
|
||||
<li><a href="../widget types/menu.html">menu</a></li>
|
||||
<li><a href="../widget types/menu.item.html">menu.item</a></li>
|
||||
<li><a href="../widget types/progress.html">progress</a></li>
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
<li><a href="../widgets/button.html">button</a></li>
|
||||
<li><a href="../widgets/check.html">check</a></li>
|
||||
<li><a href="../widgets/menu.html">menu</a></li>
|
||||
<li><a href="../widgets/menu.item.html">menu.item</a></li>
|
||||
<li><a href="../widgets/progress.html">progress</a></li>
|
||||
<li><a href="../widgets/radio.html">radio</a></li>
|
||||
<li><a href="../widgets/sash.html">sash</a></li>
|
||||
<li><a href="../widgets/slider.html">slider</a></li>
|
||||
<li><a href="../widgets/status.html">status</a></li>
|
||||
<li><a href="../widgets/stepper.html">stepper</a></li>
|
||||
<li><a href="../widgets/text.html">text</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
@@ -147,6 +148,9 @@
|
||||
<li><span class="parameter">Change</span>
|
||||
A widget's value changed.
|
||||
</li>
|
||||
<li><span class="parameter">WheelMove</span>
|
||||
The scroll wheel on the mouse moved.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -161,7 +165,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-06 11:22:48 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -43,18 +43,19 @@
|
||||
<li><strong>Layout</strong></li>
|
||||
<li><a href="../classes/Widget.html">Widget</a></li>
|
||||
</ul>
|
||||
<h2>Widget Types</h2>
|
||||
<h2>Widgets</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../widget types/button.html">button</a></li>
|
||||
<li><a href="../widget types/check.html">check</a></li>
|
||||
<li><a href="../widget types/menu.html">menu</a></li>
|
||||
<li><a href="../widget types/menu.item.html">menu.item</a></li>
|
||||
<li><a href="../widget types/progress.html">progress</a></li>
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
<li><a href="../widgets/button.html">button</a></li>
|
||||
<li><a href="../widgets/check.html">check</a></li>
|
||||
<li><a href="../widgets/menu.html">menu</a></li>
|
||||
<li><a href="../widgets/menu.item.html">menu.item</a></li>
|
||||
<li><a href="../widgets/progress.html">progress</a></li>
|
||||
<li><a href="../widgets/radio.html">radio</a></li>
|
||||
<li><a href="../widgets/sash.html">sash</a></li>
|
||||
<li><a href="../widgets/slider.html">slider</a></li>
|
||||
<li><a href="../widgets/status.html">status</a></li>
|
||||
<li><a href="../widgets/stepper.html">stepper</a></li>
|
||||
<li><a href="../widgets/text.html">text</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
@@ -401,7 +402,7 @@ found, and focuses that widget.
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-06 11:22:48 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -44,18 +44,19 @@
|
||||
<li><a href="../classes/Layout.html">Layout</a></li>
|
||||
<li><strong>Widget</strong></li>
|
||||
</ul>
|
||||
<h2>Widget Types</h2>
|
||||
<h2>Widgets</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../widget types/button.html">button</a></li>
|
||||
<li><a href="../widget types/check.html">check</a></li>
|
||||
<li><a href="../widget types/menu.html">menu</a></li>
|
||||
<li><a href="../widget types/menu.item.html">menu.item</a></li>
|
||||
<li><a href="../widget types/progress.html">progress</a></li>
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
<li><a href="../widgets/button.html">button</a></li>
|
||||
<li><a href="../widgets/check.html">check</a></li>
|
||||
<li><a href="../widgets/menu.html">menu</a></li>
|
||||
<li><a href="../widgets/menu.item.html">menu.item</a></li>
|
||||
<li><a href="../widgets/progress.html">progress</a></li>
|
||||
<li><a href="../widgets/radio.html">radio</a></li>
|
||||
<li><a href="../widgets/sash.html">sash</a></li>
|
||||
<li><a href="../widgets/slider.html">slider</a></li>
|
||||
<li><a href="../widgets/status.html">status</a></li>
|
||||
<li><a href="../widgets/stepper.html">stepper</a></li>
|
||||
<li><a href="../widgets/text.html">text</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
@@ -127,6 +128,14 @@
|
||||
<td class="summary">Get the widget's calculated height.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Widget:getContentWidth">Widget:getContentWidth ()</a></td>
|
||||
<td class="summary">Get the content width.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Widget:getContentHeight">Widget:getContentHeight ()</a></td>
|
||||
<td class="summary">Get the content height.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#Widget:getRectangle">Widget:getRectangle (useMargin, usePadding)</a></td>
|
||||
<td class="summary">Get x/y/width/height values describing a rectangle within the widget.</td>
|
||||
</tr>
|
||||
@@ -432,6 +441,50 @@ Cycles back around to the last widget in the tree from the layout root.
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Widget:getContentWidth"></a>
|
||||
<strong>Widget:getContentWidth ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the content width. </p>
|
||||
|
||||
<p>Gets the combined width of the widget's children.
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The content width.
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Widget:getContentHeight"></a>
|
||||
<strong>Widget:getContentHeight ()</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Get the content height. </p>
|
||||
|
||||
<p>Gets the combined height of the widget's children.
|
||||
|
||||
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">number</span></span>
|
||||
The content height.
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "Widget:getRectangle"></a>
|
||||
@@ -568,7 +621,7 @@ This table is identical to the constructed widget.
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-06 11:22:48 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -29,18 +29,19 @@
|
||||
|
||||
|
||||
|
||||
<h2>Widget Types</h2>
|
||||
<h2>Widgets</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="widget types/button.html">button</a></li>
|
||||
<li><a href="widget types/check.html">check</a></li>
|
||||
<li><a href="widget types/menu.html">menu</a></li>
|
||||
<li><a href="widget types/menu.item.html">menu.item</a></li>
|
||||
<li><a href="widget types/progress.html">progress</a></li>
|
||||
<li><a href="widget types/radio.html">radio</a></li>
|
||||
<li><a href="widget types/sash.html">sash</a></li>
|
||||
<li><a href="widget types/slider.html">slider</a></li>
|
||||
<li><a href="widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="widget types/text.html">text</a></li>
|
||||
<li><a href="widgets/button.html">button</a></li>
|
||||
<li><a href="widgets/check.html">check</a></li>
|
||||
<li><a href="widgets/menu.html">menu</a></li>
|
||||
<li><a href="widgets/menu.item.html">menu.item</a></li>
|
||||
<li><a href="widgets/progress.html">progress</a></li>
|
||||
<li><a href="widgets/radio.html">radio</a></li>
|
||||
<li><a href="widgets/sash.html">sash</a></li>
|
||||
<li><a href="widgets/slider.html">slider</a></li>
|
||||
<li><a href="widgets/status.html">status</a></li>
|
||||
<li><a href="widgets/stepper.html">stepper</a></li>
|
||||
<li><a href="widgets/text.html">text</a></li>
|
||||
</ul>
|
||||
<h2>Modules</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
@@ -61,46 +62,50 @@
|
||||
<h2>Lovely User Interfaces for Game Inventors</h2>
|
||||
<p>A UI library</p>
|
||||
|
||||
<h2>Widget Types</h2>
|
||||
<h2>Widgets</h2>
|
||||
<table class="module_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/button.html">button</a></td>
|
||||
<td class="name" nowrap><a href="widgets/button.html">button</a></td>
|
||||
<td class="summary">A simple button.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/check.html">check</a></td>
|
||||
<td class="name" nowrap><a href="widgets/check.html">check</a></td>
|
||||
<td class="summary">A check box.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/menu.html">menu</a></td>
|
||||
<td class="name" nowrap><a href="widgets/menu.html">menu</a></td>
|
||||
<td class="summary">A menu bar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/menu.item.html">menu.item</a></td>
|
||||
<td class="name" nowrap><a href="widgets/menu.item.html">menu.item</a></td>
|
||||
<td class="summary">A menu item.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/progress.html">progress</a></td>
|
||||
<td class="name" nowrap><a href="widgets/progress.html">progress</a></td>
|
||||
<td class="summary">A progress bar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/radio.html">radio</a></td>
|
||||
<td class="name" nowrap><a href="widgets/radio.html">radio</a></td>
|
||||
<td class="summary">A radio button.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/sash.html">sash</a></td>
|
||||
<td class="name" nowrap><a href="widgets/sash.html">sash</a></td>
|
||||
<td class="summary">A sash.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/slider.html">slider</a></td>
|
||||
<td class="name" nowrap><a href="widgets/slider.html">slider</a></td>
|
||||
<td class="summary">A slider.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/stepper.html">stepper</a></td>
|
||||
<td class="name" nowrap><a href="widgets/status.html">status</a></td>
|
||||
<td class="summary">A status bar.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widgets/stepper.html">stepper</a></td>
|
||||
<td class="summary">A stepper.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="widget_types/text.html">text</a></td>
|
||||
<td class="name" nowrap><a href="widgets/text.html">text</a></td>
|
||||
<td class="summary">A text entry area.</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -131,7 +136,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-06 11:22:48 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Widget_Attributes">Widget Attributes</a></li>
|
||||
<li><a href="#Attributes">Attributes</a></li>
|
||||
<li><a href="#Keyboard_Attributes">Keyboard Attributes </a></li>
|
||||
<li><a href="#Size_Attributes">Size Attributes </a></li>
|
||||
<li><a href="#Font_Attributes">Font Attributes </a></li>
|
||||
<li><a href="#Text_Attributes">Text Attributes </a></li>
|
||||
@@ -44,18 +45,19 @@
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><strong>attribute</strong></li>
|
||||
</ul>
|
||||
<h2>Widget Types</h2>
|
||||
<h2>Widgets</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
<li><a href="../widget types/button.html">button</a></li>
|
||||
<li><a href="../widget types/check.html">check</a></li>
|
||||
<li><a href="../widget types/menu.html">menu</a></li>
|
||||
<li><a href="../widget types/menu.item.html">menu.item</a></li>
|
||||
<li><a href="../widget types/progress.html">progress</a></li>
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
<li><a href="../widgets/button.html">button</a></li>
|
||||
<li><a href="../widgets/check.html">check</a></li>
|
||||
<li><a href="../widgets/menu.html">menu</a></li>
|
||||
<li><a href="../widgets/menu.item.html">menu.item</a></li>
|
||||
<li><a href="../widgets/progress.html">progress</a></li>
|
||||
<li><a href="../widgets/radio.html">radio</a></li>
|
||||
<li><a href="../widgets/sash.html">sash</a></li>
|
||||
<li><a href="../widgets/slider.html">slider</a></li>
|
||||
<li><a href="../widgets/status.html">status</a></li>
|
||||
<li><a href="../widgets/stepper.html">stepper</a></li>
|
||||
<li><a href="../widgets/text.html">text</a></li>
|
||||
</ul>
|
||||
<h2>Classes</h2>
|
||||
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
||||
@@ -72,7 +74,7 @@
|
||||
<p>Widget attributes.</p>
|
||||
<p>This module defines "attributes" (special fields) that are
|
||||
recognized by all widgets. Their interpretation may vary
|
||||
depending on the <a href="http://www.lua.org/manual/5.1/manual.html#pdf-type">type</a> of widget. Some widget types may also
|
||||
depending on the <a href="../modules/attribute.html#type">type</a> of widget. Some widget types may also
|
||||
recognize additional attributes.</p>
|
||||
|
||||
<p>Setting attributes can have side effects. For example, setting
|
||||
@@ -80,24 +82,43 @@ recognize additional attributes.</p>
|
||||
to recalculate their size and position.</p>
|
||||
|
||||
|
||||
<h2><a href="#Widget_Attributes">Widget Attributes</a></h2>
|
||||
<h2><a href="#Attributes">Attributes</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#type">type</a></td>
|
||||
<td class="summary">Type of widget.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#id">id</a></td>
|
||||
<td class="summary">widget identifier.</td>
|
||||
<td class="summary">Widget identifier.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#value">value</a></td>
|
||||
<td class="summary">Widget value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#style">style</a></td>
|
||||
<td class="summary">Widget style.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#status">status</a></td>
|
||||
<td class="summary">Status message.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#scroll">scroll</a></td>
|
||||
<td class="summary">Scroll ability.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Keyboard_Attributes">Keyboard Attributes </a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#focusable">focusable</a></td>
|
||||
<td class="summary">Focusable.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#key">key</a></td>
|
||||
<td class="summary">Keyboard accelerator.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#value">value</a></td>
|
||||
<td class="summary">widget value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#style">style</a></td>
|
||||
<td class="summary">widget style.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Size_Attributes">Size Attributes </a></h2>
|
||||
<table class="function_list">
|
||||
@@ -184,15 +205,43 @@ to recalculate their size and position.</p>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Widget_Attributes"></a>Widget Attributes</h2>
|
||||
<h2 class="section-header "><a name="Attributes"></a>Attributes</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "type"></a>
|
||||
<strong>type</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Type of widget. </p>
|
||||
|
||||
<p>Should contain a string identifying the widget's type.
|
||||
After the layout is built, may be replaced by an array
|
||||
of strings identifying multiple types. This is used
|
||||
internally by some widgets to provide information about
|
||||
the widget's state to the theme (themes describe the
|
||||
appearance of widgets according to their type).</p>
|
||||
|
||||
<p>If a type is registered with the widget's layout, the registered
|
||||
type initializer function will run once when the widget is constructed.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
<a href="../classes/Widget.html#Widget.register">Widget.register</a>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "id"></a>
|
||||
<strong>id</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
widget identifier. </p>
|
||||
Widget identifier. </p>
|
||||
|
||||
<p>Should contain a unique string identifying the widget, if present.</p>
|
||||
|
||||
@@ -207,6 +256,118 @@ in a property having the same name as the widget's id.</p>
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "value"></a>
|
||||
<strong>value</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Widget value. </p>
|
||||
|
||||
<p>Some widget types expect the value to be of a specific type and
|
||||
within a specific range. For example, <a href="../widgets/slider.html#">slider</a> and <a href="../widgets/progress.html#">progress</a>
|
||||
widgets expect a normalized number, <a href="../widgets/text.html#">text</a> widgets expect
|
||||
a string, and <a href="../widgets/check.html#">check</a> and <a href="../widgets/radio.html#">radio</a> widgets expect a boolean.</p>
|
||||
|
||||
<p>Setting this attribute bubbles the <code>Change</code> event.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "style"></a>
|
||||
<strong>style</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Widget style. </p>
|
||||
|
||||
<p>Should contain a string or array of strings identifying
|
||||
style rules to be applied to the widget. When resolving
|
||||
any attribute with a <code>nil</code> value, these style rules are
|
||||
searched for a corresponding attribute.</p>
|
||||
|
||||
<p>Setting this attribute resets the <code>Font</code> and <code>Text</code> object
|
||||
associated with this widget.</p>
|
||||
|
||||
<p>Setting this attribute recalculates the size and position
|
||||
of the parent widget and its descendants.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "status"></a>
|
||||
<strong>status</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Status message. </p>
|
||||
|
||||
<p>Should contain a string with a short message describing the
|
||||
purpose or state of the widget.</p>
|
||||
|
||||
<p>This message will appear in the last created <a href="../widgets/status.html#">status</a> widget
|
||||
in the same layout, or in the master layout if one exists.</p>
|
||||
|
||||
<ul>
|
||||
<li>This attribute cascades.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "scroll"></a>
|
||||
<strong>scroll</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Scroll ability. </p>
|
||||
|
||||
<p>Should contain <code>true</code> or <code>false</code> (or <code>nil</code>).</p>
|
||||
|
||||
<p>If set to <code>true</code>, moving the scroll wheel over the widget will adjust
|
||||
its scroll position when the widget's contents overflow its boundary.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Keyboard_Attributes"></a>Keyboard Attributes </h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "focusable"></a>
|
||||
<strong>focusable</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Focusable. </p>
|
||||
|
||||
<p>Should contain <code>true</code> if the widget can be focused by pressing the tab key.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "key"></a>
|
||||
@@ -229,52 +390,6 @@ as if it had been pressed with a mouse or touch interface.</p>
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "value"></a>
|
||||
<strong>value</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
widget value. </p>
|
||||
|
||||
<p>Some widget types expect the value to be of a specific type and
|
||||
within a specific range. For example, <a href="../widget types/slider.html#">slider</a> and <a href="../widget types/progress.html#">progress</a>
|
||||
widgets expect a normalized number, and <a href="../widget types/text.html#">text</a> widgets expect
|
||||
a string.</p>
|
||||
|
||||
<p>Setting this attribute bubbles the <code>Change</code> event.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "style"></a>
|
||||
<strong>style</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
widget style. </p>
|
||||
|
||||
<p>Should contain a string or array of strings identifying
|
||||
style rules to be applied to the widget. When resolving
|
||||
any attribute with a <code>nil</code> value, these style rules are
|
||||
searched for a corresponding attribute.</p>
|
||||
|
||||
<p>Setting this attribute resets the <code>Font</code> and <code>Text</code> object
|
||||
associated with this widget.</p>
|
||||
|
||||
<p>Setting this attribute recalculates the size and position
|
||||
of the parent widget and its descendants.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header has-description"><a name="Size_Attributes"></a>Size Attributes </h2>
|
||||
@@ -391,10 +506,17 @@ objects associated with the widget.
|
||||
<strong>font</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Font path. </p>
|
||||
|
||||
<p>Font path. </p>
|
||||
|
||||
<p>Should contain a path to a TrueType font to use for displaying
|
||||
this widget's <a href="../widget types/text.html#">text</a>.
|
||||
this widget's <a href="../widgets/text.html#">text</a>.</p>
|
||||
|
||||
<ul>
|
||||
<li>This attribute cascades.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -408,10 +530,17 @@ this widget's <a href="../widget types/text.html#">text</a>.
|
||||
<strong>size</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Font size. </p>
|
||||
|
||||
<p>Font size. </p>
|
||||
|
||||
<p>Should contain a number representing the size of the font, in points.
|
||||
Defaults to 12.
|
||||
Defaults to 12.</p>
|
||||
|
||||
<ul>
|
||||
<li>This attribute cascades.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -447,9 +576,16 @@ associated with the widget.
|
||||
<strong>color</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Text color. </p>
|
||||
|
||||
<p>Should contain an array with 3 or 4 values (RGB or RGBA) from 0 to 255.
|
||||
<p>Text color. </p>
|
||||
|
||||
<p>Should contain an array with 3 or 4 values (RGB or RGBA) from 0 to 255.</p>
|
||||
|
||||
<ul>
|
||||
<li>This attribute cascades.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -463,7 +599,13 @@ associated with the widget.
|
||||
<strong>align</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Text and icon alignment.
|
||||
Text and icon alignment. </p>
|
||||
|
||||
<p>Should contain a string defining vertical and horizontal alignment.
|
||||
Vertical alignment is defined by either 'top', 'middle', or 'bottom',
|
||||
and horizontal alignment is defined by either 'left', 'center', or 'right'.</p>
|
||||
|
||||
<p>For example, <code>align = 'top left'</code>
|
||||
|
||||
|
||||
|
||||
@@ -566,7 +708,7 @@ as a single line when this attribute is not set to <code>true</code>.
|
||||
Padding size. </p>
|
||||
|
||||
<p>The padding area occupies space inside the <a href="../modules/attribute.html#outline">outline</a> and <a href="../modules/attribute.html#slices">slices</a>,
|
||||
and outside the space where the <a href="../modules/attribute.html#icon">icon</a> and <a href="../widget types/text.html#">text</a> and any
|
||||
and outside the space where the <a href="../modules/attribute.html#icon">icon</a> and <a href="../widgets/text.html#">text</a> and any
|
||||
child widgets appear.
|
||||
|
||||
|
||||
@@ -599,7 +741,7 @@ child widgets appear.
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-06 11:22:48 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
</ul>
|
||||
@@ -78,7 +79,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
</ul>
|
||||
@@ -78,7 +79,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
</ul>
|
||||
@@ -78,7 +79,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
</ul>
|
||||
@@ -78,7 +79,7 @@ not be explicitly created.</p>
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
</ul>
|
||||
@@ -77,7 +78,7 @@ between 0 and 1 (inclusive) to change the width of the bar.</p>
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><strong>radio</strong></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
</ul>
|
||||
@@ -78,7 +79,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><strong>sash</strong></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
</ul>
|
||||
@@ -82,7 +83,7 @@ must have a specified <code>width</code> property.</p>
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><strong>slider</strong></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
</ul>
|
||||
@@ -77,7 +78,7 @@ number between 0 and 1, inclusive.</p>
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><strong>stepper</strong></li>
|
||||
<li><a href="../widget types/text.html">text</a></li>
|
||||
</ul>
|
||||
@@ -80,7 +81,7 @@ item displayed in the content area.</p>
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<li><a href="../widget types/radio.html">radio</a></li>
|
||||
<li><a href="../widget types/sash.html">sash</a></li>
|
||||
<li><a href="../widget types/slider.html">slider</a></li>
|
||||
<li><a href="../widget types/status.html">status</a></li>
|
||||
<li><a href="../widget types/stepper.html">stepper</a></li>
|
||||
<li><strong>text</strong></li>
|
||||
</ul>
|
||||
@@ -78,7 +79,7 @@
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||
<i style="float:right;">Last updated 2015-11-29 23:24:00 </i>
|
||||
<i style="float:right;">Last updated 2015-12-05 16:15:11 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
||||
@@ -15,7 +15,26 @@ local ROOT = (...):gsub('[^.]*$', '')
|
||||
|
||||
local Attribute = {}
|
||||
|
||||
function Attribute.type (widget, value)
|
||||
--[[--
|
||||
Type of widget.
|
||||
|
||||
Should contain a string identifying the widget's type.
|
||||
After the layout is built, may be replaced by an array
|
||||
of strings identifying multiple types. This is used
|
||||
internally by some widgets to provide information about
|
||||
the widget's state to the theme (themes describe the
|
||||
appearance of widgets according to their type).
|
||||
|
||||
If a type is registered with the widget's layout, the registered
|
||||
type initializer function will run once when the widget is constructed.
|
||||
|
||||
@see Widget.register
|
||||
|
||||
@attrib type
|
||||
--]]--
|
||||
Attribute.type = {}
|
||||
|
||||
function Attribute.type.set (widget, value)
|
||||
local oldType = widget.attributes.type
|
||||
|
||||
widget.attributes.type = value
|
||||
@@ -43,7 +62,9 @@ Setting this attribute re-registers the widget with its layout.
|
||||
|
||||
@attrib id
|
||||
--]]--
|
||||
function Attribute.id (widget, value)
|
||||
Attribute.id = {}
|
||||
|
||||
function Attribute.id.set (widget, value)
|
||||
local layout = widget.layout.master or widget.layout
|
||||
local oldValue = widget.attributes.id
|
||||
|
||||
@@ -69,49 +90,21 @@ local function parseKeyCombo (value)
|
||||
return mainKey, modifierFlags
|
||||
end
|
||||
|
||||
--[[--
|
||||
Keyboard accelerator.
|
||||
|
||||
Should contain a string representing a key and optional modifiers,
|
||||
separated by dashes; for example `'ctrl-c'` or `'alt-shift-escape'`.
|
||||
|
||||
Pressing this key combination bubbles a `Press` event on the widget,
|
||||
as if it had been pressed with a mouse or touch interface.
|
||||
|
||||
Setting this attribute re-registers the widget with its layout.
|
||||
|
||||
@attrib key
|
||||
--]]--
|
||||
function Attribute.key (widget, value)
|
||||
local layout = widget.layout.master or widget.layout
|
||||
local oldValue = widget.attributes.key
|
||||
|
||||
if oldValue then
|
||||
local mainKey, modifierFlags = parseKeyCombo(oldValue)
|
||||
layout.accelerators[modifierFlags][mainKey] = nil
|
||||
end
|
||||
|
||||
if value then
|
||||
local mainKey, modifierFlags = parseKeyCombo(value)
|
||||
layout.accelerators[modifierFlags][mainKey] = widget
|
||||
end
|
||||
|
||||
widget.attributes.key = value
|
||||
end
|
||||
|
||||
--[[--
|
||||
Widget value.
|
||||
|
||||
Some widget types expect the value to be of a specific type and
|
||||
within a specific range. For example, `slider` and `progress`
|
||||
widgets expect a normalized number, and `text` widgets expect
|
||||
a string.
|
||||
widgets expect a normalized number, `text` widgets expect
|
||||
a string, and `check` and `radio` widgets expect a boolean.
|
||||
|
||||
Setting this attribute bubbles the `Change` event.
|
||||
|
||||
@attrib value
|
||||
--]]--
|
||||
function Attribute.value (widget, value)
|
||||
Attribute.value = {}
|
||||
|
||||
function Attribute.value.set (widget, value)
|
||||
local oldValue = widget.value
|
||||
widget.attributes.value = value
|
||||
widget:bubbleEvent('Change', { value = value, oldValue = oldValue })
|
||||
@@ -133,7 +126,9 @@ of the parent widget and its descendants.
|
||||
|
||||
@attrib style
|
||||
--]]--
|
||||
function Attribute.style (widget, value)
|
||||
Attribute.style = {}
|
||||
|
||||
function Attribute.style.set (widget, value)
|
||||
widget.attributes.style = value
|
||||
widget.fontData = nil
|
||||
widget.textData = nil
|
||||
@@ -143,16 +138,20 @@ end
|
||||
--[[--
|
||||
Status message.
|
||||
|
||||
Should contain a short, single-line string describing the
|
||||
Should contain a string with a short message describing the
|
||||
purpose or state of the widget.
|
||||
|
||||
This string will appear in any `status` type widgets
|
||||
This message will appear in the last created `status` widget
|
||||
in the same layout, or in the master layout if one exists.
|
||||
|
||||
- This attribute cascades.
|
||||
|
||||
@attrib status
|
||||
--]]--
|
||||
function Attribute.status (widget, value)
|
||||
widget.attributes.status = value
|
||||
Attribute.status = {}
|
||||
|
||||
function Attribute.status.get (widget, value)
|
||||
return widget.attributes.status or widget.parent and widget.parent.status
|
||||
end
|
||||
|
||||
--[[--
|
||||
@@ -165,8 +164,53 @@ its scroll position when the widget's contents overflow its boundary.
|
||||
|
||||
@attrib scroll
|
||||
--]]--
|
||||
function Attribute.scroll (widget, value)
|
||||
widget.attributes.scroll = value
|
||||
Attribute.scroll = {}
|
||||
|
||||
--[[--
|
||||
Keyboard Attributes.
|
||||
|
||||
@section keyboard
|
||||
--]]--
|
||||
|
||||
--[[--
|
||||
Focusable.
|
||||
|
||||
Should contain `true` if the widget can be focused by pressing the tab key.
|
||||
|
||||
@attrib focusable
|
||||
--]]--
|
||||
Attribute.focusable = {}
|
||||
|
||||
--[[--
|
||||
Keyboard accelerator.
|
||||
|
||||
Should contain a string representing a key and optional modifiers,
|
||||
separated by dashes; for example `'ctrl-c'` or `'alt-shift-escape'`.
|
||||
|
||||
Pressing this key combination bubbles a `Press` event on the widget,
|
||||
as if it had been pressed with a mouse or touch interface.
|
||||
|
||||
Setting this attribute re-registers the widget with its layout.
|
||||
|
||||
@attrib key
|
||||
--]]--
|
||||
Attribute.key = {}
|
||||
|
||||
function Attribute.key.set (widget, value)
|
||||
local layout = widget.layout.master or widget.layout
|
||||
local oldValue = widget.attributes.key
|
||||
|
||||
if oldValue then
|
||||
local mainKey, modifierFlags = parseKeyCombo(oldValue)
|
||||
layout.accelerators[modifierFlags][mainKey] = nil
|
||||
end
|
||||
|
||||
if value then
|
||||
local mainKey, modifierFlags = parseKeyCombo(value)
|
||||
layout.accelerators[modifierFlags][mainKey] = widget
|
||||
end
|
||||
|
||||
widget.attributes.key = value
|
||||
end
|
||||
|
||||
--[[--
|
||||
@@ -197,7 +241,9 @@ with this widget.
|
||||
|
||||
@attrib flow
|
||||
--]]--
|
||||
function Attribute.flow (widget, value)
|
||||
Attribute.flow = {}
|
||||
|
||||
function Attribute.flow.set (widget, value)
|
||||
widget.attributes.flow = value
|
||||
widget.textData = nil
|
||||
widget.reshape(widget.parent or widget)
|
||||
@@ -215,7 +261,9 @@ with this widget.
|
||||
|
||||
@attrib width
|
||||
--]]--
|
||||
function Attribute.width (widget, value)
|
||||
Attribute.width = {}
|
||||
|
||||
function Attribute.width.set (widget, value)
|
||||
value = value and math.max(value, widget.minwidth or 0)
|
||||
widget.attributes.width = value
|
||||
if widget.wrap then
|
||||
@@ -232,7 +280,9 @@ To get the calculated height, use `Widget:getHeight`.
|
||||
|
||||
@attrib height
|
||||
--]]--
|
||||
function Attribute.height (widget, value)
|
||||
Attribute.height = {}
|
||||
|
||||
function Attribute.height.set (widget, value)
|
||||
value = value and math.max(value, widget.minheight or 0)
|
||||
widget.attributes.height = value
|
||||
widget.reshape(widget.parent or widget)
|
||||
@@ -243,7 +293,9 @@ Minimum width.
|
||||
|
||||
@attrib minwidth
|
||||
--]]--
|
||||
function Attribute.minwidth (widget, value)
|
||||
Attribute.minwidth = {}
|
||||
|
||||
function Attribute.minwidth.set (widget, value)
|
||||
widget.attributes.minwidth = value
|
||||
widget.reshape(widget.parent or widget)
|
||||
end
|
||||
@@ -253,7 +305,9 @@ Minimum height.
|
||||
|
||||
@attrib minheight
|
||||
--]]--
|
||||
function Attribute.minheight (widget, value)
|
||||
Attribute.minheight = {}
|
||||
|
||||
function Attribute.minheight.set (widget, value)
|
||||
widget.attributes.minheight = value
|
||||
widget.reshape(widget.parent or widget)
|
||||
end
|
||||
@@ -273,28 +327,44 @@ Font path.
|
||||
Should contain a path to a TrueType font to use for displaying
|
||||
this widget's `text`.
|
||||
|
||||
- This attribute cascades.
|
||||
|
||||
@attrib font
|
||||
--]]--
|
||||
function Attribute.font (widget, value)
|
||||
Attribute.font = {}
|
||||
|
||||
function Attribute.font.set (widget, value)
|
||||
widget.attributes.font = value
|
||||
widget.fontData = nil
|
||||
widget.textData = nil
|
||||
end
|
||||
|
||||
function Attribute.font.get (widget)
|
||||
return widget.attributes.font or widget.parent and widget.parent.font
|
||||
end
|
||||
|
||||
--[[--
|
||||
Font size.
|
||||
|
||||
Should contain a number representing the size of the font, in points.
|
||||
Defaults to 12.
|
||||
|
||||
- This attribute cascades.
|
||||
|
||||
@attrib size
|
||||
--]]--
|
||||
function Attribute.size (widget, value)
|
||||
Attribute.size = {}
|
||||
|
||||
function Attribute.size.set (widget, value)
|
||||
widget.attributes.size = value
|
||||
widget.fontData = nil
|
||||
widget.textData = nil
|
||||
end
|
||||
|
||||
function Attribute.size.get (widget)
|
||||
return widget.attributes.size or widget.parent and widget.parent.size
|
||||
end
|
||||
|
||||
--[[--
|
||||
Text Attributes.
|
||||
|
||||
@@ -309,7 +379,9 @@ Text to display.
|
||||
|
||||
@attrib text
|
||||
--]]--
|
||||
function Attribute.text (widget, value)
|
||||
Attribute.text = {}
|
||||
|
||||
function Attribute.text.set (widget, value)
|
||||
widget.attributes.text = value
|
||||
widget.textData = nil
|
||||
end
|
||||
@@ -319,18 +391,35 @@ Text color.
|
||||
|
||||
Should contain an array with 3 or 4 values (RGB or RGBA) from 0 to 255.
|
||||
|
||||
- This attribute cascades.
|
||||
|
||||
@attrib color
|
||||
--]]--
|
||||
function Attribute.color (widget, value)
|
||||
Attribute.color = {}
|
||||
|
||||
function Attribute.color.set (widget, value)
|
||||
widget.attributes.color = value
|
||||
widget.textData = nil
|
||||
end
|
||||
|
||||
function Attribute.color.get (widget)
|
||||
return widget.attributes.color or widget.parent and widget.parent.color
|
||||
end
|
||||
|
||||
--[[--
|
||||
Text and icon alignment.
|
||||
|
||||
Should contain a string defining vertical and horizontal alignment.
|
||||
Vertical alignment is defined by either 'top', 'middle', or 'bottom',
|
||||
and horizontal alignment is defined by either 'left', 'center', or 'right'.
|
||||
|
||||
For example, `align = 'top left'`
|
||||
|
||||
@attrib align
|
||||
--]]--
|
||||
function Attribute.align (widget, value)
|
||||
Attribute.align = {}
|
||||
|
||||
function Attribute.align.set (widget, value)
|
||||
widget.attributes.align = value
|
||||
widget.textData = nil
|
||||
end
|
||||
@@ -344,7 +433,9 @@ as a single line when this attribute is not set to `true`.
|
||||
|
||||
@attrib wrap
|
||||
--]]--
|
||||
function Attribute.wrap (widget, value)
|
||||
Attribute.wrap = {}
|
||||
|
||||
function Attribute.wrap.set (widget, value)
|
||||
widget.attributes.wrap = value
|
||||
widget.textData = nil
|
||||
end
|
||||
@@ -362,9 +453,7 @@ Should contain an array with 3 or 4 values (RGB or RGBA) from 0 to 255.
|
||||
|
||||
@attrib background
|
||||
--]]--
|
||||
function Attribute.background (widget, value)
|
||||
widget.attributes.background = value
|
||||
end
|
||||
Attribute.background = {}
|
||||
|
||||
--[[--
|
||||
Outline color.
|
||||
@@ -373,9 +462,7 @@ Should contain an array with 3 or 4 values (RGB or RGBA) from 0 to 255.
|
||||
|
||||
@attrib outline
|
||||
--]]--
|
||||
function Attribute.outline (widget, value)
|
||||
widget.attributes.outline = value
|
||||
end
|
||||
Attribute.outline = {}
|
||||
|
||||
--[[--
|
||||
Slice image.
|
||||
@@ -384,9 +471,7 @@ Should contain a path to an image with "slices" to display for this widget.
|
||||
|
||||
@attrib slices
|
||||
--]]--
|
||||
function Attribute.slices (widget, value)
|
||||
widget.attributes.slices = value
|
||||
end
|
||||
Attribute.slices = {}
|
||||
|
||||
--[[--
|
||||
Margin size.
|
||||
@@ -395,7 +480,9 @@ The margin area occupies space outside of the `outline` and `slices`.
|
||||
|
||||
@attrib margin
|
||||
--]]--
|
||||
function Attribute.margin (widget, value)
|
||||
Attribute.margin = {}
|
||||
|
||||
function Attribute.margin.set (widget, value)
|
||||
widget.attributes.margin = value
|
||||
widget.textData = nil
|
||||
widget:reshape()
|
||||
@@ -410,7 +497,9 @@ child widgets appear.
|
||||
|
||||
@attrib padding
|
||||
--]]--
|
||||
function Attribute.padding (widget, value)
|
||||
Attribute.padding = {}
|
||||
|
||||
function Attribute.padding.set (widget, value)
|
||||
widget.attributes.padding = value
|
||||
widget.textData = nil
|
||||
widget:reshape()
|
||||
@@ -423,7 +512,9 @@ Should contain a path to an image file.
|
||||
|
||||
@attrib icon
|
||||
--]]--
|
||||
function Attribute.icon (widget, value)
|
||||
Attribute.icon = {}
|
||||
|
||||
function Attribute.icon.set (widget, value)
|
||||
widget.attributes.icon = value
|
||||
widget.textData = nil
|
||||
end
|
||||
|
||||
@@ -6,8 +6,8 @@ return function (config)
|
||||
local backColor = config.backColor or { 40, 40, 40 }
|
||||
local lineColor = config.lineColor or { 60, 60, 60 }
|
||||
local textColor = config.textColor or { 240, 240, 240 }
|
||||
local highlight = config.highlight or { 0xFF, 0x66, 0x00 }
|
||||
|
||||
local highlight = config.highlight or { 0x00, 0x5c, 0x94 }
|
||||
|
||||
return {
|
||||
button = {
|
||||
align = 'center middle',
|
||||
@@ -15,7 +15,7 @@ return function (config)
|
||||
slices = RESOURCE .. 'button.png',
|
||||
minwidth = 24,
|
||||
minheight = 24,
|
||||
canFocus = true,
|
||||
focusable = true,
|
||||
color = textColor,
|
||||
},
|
||||
button_hovered = {
|
||||
@@ -100,7 +100,7 @@ return function (config)
|
||||
padding = 6,
|
||||
minwidth = 24,
|
||||
minheight = 24,
|
||||
canFocus = true,
|
||||
focusable = true,
|
||||
cursor = 'ibeam',
|
||||
highlight = highlight,
|
||||
color = textColor,
|
||||
@@ -109,7 +109,7 @@ return function (config)
|
||||
slices = RESOURCE .. 'text_focused.png',
|
||||
},
|
||||
check = {
|
||||
canFocus = true,
|
||||
focusable = true,
|
||||
color = textColor,
|
||||
},
|
||||
['check.unchecked'] = {
|
||||
@@ -131,7 +131,7 @@ return function (config)
|
||||
icon = RESOURCE .. 'check_checked_focused.png',
|
||||
},
|
||||
radio = {
|
||||
canFocus = true,
|
||||
focusable = true,
|
||||
color = textColor,
|
||||
},
|
||||
['radio.unchecked'] = {
|
||||
|
||||
|
Before Width: | Height: | Size: 561 B After Width: | Height: | Size: 580 B |
|
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 305 B |
|
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 350 B |
|
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 701 B |
|
Before Width: | Height: | Size: 552 B After Width: | Height: | Size: 556 B |
|
Before Width: | Height: | Size: 538 B After Width: | Height: | Size: 556 B |
@@ -14,7 +14,7 @@ return function (config)
|
||||
slices = RESOURCE .. 'button.png',
|
||||
minwidth = 24,
|
||||
minheight = 24,
|
||||
canFocus = true
|
||||
focusable = true
|
||||
},
|
||||
button_hovered = {
|
||||
slices = RESOURCE .. 'button_hovered.png'
|
||||
@@ -94,7 +94,7 @@ return function (config)
|
||||
padding = 6,
|
||||
minwidth = 24,
|
||||
minheight = 24,
|
||||
canFocus = true,
|
||||
focusable = true,
|
||||
cursor = 'ibeam',
|
||||
highlight = highlight,
|
||||
},
|
||||
@@ -102,7 +102,7 @@ return function (config)
|
||||
slices = RESOURCE .. 'text_focused.png',
|
||||
},
|
||||
check = {
|
||||
canFocus = true,
|
||||
focusable = true,
|
||||
},
|
||||
['check.unchecked'] = {
|
||||
icon = RESOURCE .. 'check_unchecked.png',
|
||||
@@ -123,7 +123,7 @@ return function (config)
|
||||
icon = RESOURCE .. 'check_checked_focused.png',
|
||||
},
|
||||
radio = {
|
||||
canFocus = true,
|
||||
focusable = true,
|
||||
},
|
||||
['radio.unchecked'] = {
|
||||
icon = RESOURCE .. 'radio_unchecked.png',
|
||||
|
||||
|
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 735 B |
|
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 704 B |
@@ -55,14 +55,9 @@ end
|
||||
|
||||
-- look for properties in attributes, Widget, style, and theme
|
||||
local function metaIndex (self, property)
|
||||
local value = self.attributes[property]
|
||||
if value ~= nil then return maybeCall(value, self) end
|
||||
|
||||
-- cascading attributes
|
||||
-- TODO: custom accessors in attribute module?
|
||||
if property == 'color' or property == 'font' or property == 'size'
|
||||
or property == 'status' then
|
||||
local value = self.parent and self.parent[property]
|
||||
local A = Attribute[property]
|
||||
if A then
|
||||
local value = A.get and A.get(self) or self.attributes[property]
|
||||
if value ~= nil then return maybeCall(value, self) end
|
||||
end
|
||||
|
||||
@@ -80,11 +75,16 @@ end
|
||||
|
||||
-- setting attributes triggers special behavior
|
||||
local function metaNewIndex (self, property, value)
|
||||
if Attribute[property] then
|
||||
return Attribute[property](self, value)
|
||||
local A = Attribute[property]
|
||||
if A then
|
||||
if A.set then
|
||||
A.set(self, value)
|
||||
else
|
||||
self.attributes[property] = value
|
||||
end
|
||||
else
|
||||
rawset(self, property, value)
|
||||
end
|
||||
|
||||
rawset(self, property, value)
|
||||
end
|
||||
|
||||
local attributeNames = {}
|
||||
@@ -206,7 +206,7 @@ function Widget:focus ()
|
||||
layout.focusedWidget = nil
|
||||
end
|
||||
|
||||
if self.canFocus then
|
||||
if self.focusable then
|
||||
self.focused = true
|
||||
layout.focusedWidget = self
|
||||
return true
|
||||
|
||||
@@ -143,8 +143,8 @@ local function deleteCharacterLeft (self)
|
||||
end
|
||||
|
||||
-- delete character to the left
|
||||
local offset = utf8.offset(text, -1, first) or 0
|
||||
local left = text:sub(1, offset)
|
||||
local offset = utf8.offset(text, -1, last + 1) or 0
|
||||
local left = text:sub(1, offset - 1)
|
||||
text = left .. text:sub(first + 1)
|
||||
self.value = text
|
||||
setCaretFromText(self, left)
|
||||
@@ -183,7 +183,7 @@ return function (self)
|
||||
end
|
||||
|
||||
self.value = self.value or self.text or ''
|
||||
|
||||
|
||||
self.text = ''
|
||||
|
||||
if not self.highlight then
|
||||
|
||||