mirror of
https://github.com/Insality/druid
synced 2025-06-27 18:37:45 +02:00
616 lines
15 KiB
HTML
616 lines
15 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
<head>
|
|
<title>Defold Druid UI Library</title>
|
|
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
|
|
</head>
|
|
<body>
|
|
|
|
<div id="container">
|
|
|
|
<div id="product">
|
|
<div id="product_logo"></div>
|
|
<div id="product_name"><big><b></b></big></div>
|
|
<div id="product_description"></div>
|
|
</div> <!-- id="product" -->
|
|
|
|
|
|
<div id="main">
|
|
|
|
|
|
<!-- Menu -->
|
|
|
|
<div id="navigation">
|
|
<br/>
|
|
<h1>Druid</h1>
|
|
|
|
<ul>
|
|
<li><a href="../index.html">Index</a></li>
|
|
</ul>
|
|
|
|
<h2>Contents</h2>
|
|
<ul>
|
|
<li><a href="#Functions">Functions</a></li>
|
|
<li><a href="#Fields">Fields</a></li>
|
|
</ul>
|
|
|
|
|
|
<h2>Modules</h2>
|
|
<ul class="nowrap">
|
|
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
|
|
<li><a href="../modules/Blocker.html">Blocker</a></li>
|
|
<li><a href="../modules/Button.html">Button</a></li>
|
|
<li><a href="../modules/Drag.html">Drag</a></li>
|
|
<li><a href="../modules/Hover.html">Hover</a></li>
|
|
<li><a href="../modules/Scroll.html">Scroll</a></li>
|
|
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
|
|
<li><a href="../modules/Swipe.html">Swipe</a></li>
|
|
<li><a href="../modules/Text.html">Text</a></li>
|
|
<li><strong>BaseComponent</strong></li>
|
|
<li><a href="../modules/druid.html">druid</a></li>
|
|
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
|
|
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
|
|
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
|
|
<li><a href="../modules/DataList.html">DataList</a></li>
|
|
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
|
|
<li><a href="../modules/Input.html">Input</a></li>
|
|
<li><a href="../modules/LangText.html">LangText</a></li>
|
|
<li><a href="../modules/Progress.html">Progress</a></li>
|
|
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
|
|
<li><a href="../modules/Slider.html">Slider</a></li>
|
|
<li><a href="../modules/Timer.html">Timer</a></li>
|
|
<li><a href="../modules/druid.helper.html">druid.helper</a></li>
|
|
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<h1>Module <code>BaseComponent</code></h1>
|
|
<p>Basic class for all Druid components.</p>
|
|
<p>
|
|
To create you component, use `component.create`</p>
|
|
|
|
|
|
<h2><a href="#Functions">Functions</a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#set_style">set_style(self, druid_style)</a></td>
|
|
<td class="summary">Set current component style table.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#set_template">set_template(self, template)</a></td>
|
|
<td class="summary">Set current component template name</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#set_nodes">set_nodes(self, nodes)</a></td>
|
|
<td class="summary">Set current component nodes</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_context">get_context(self)</a></td>
|
|
<td class="summary">Get current component context</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_node">get_node(self, node_or_name)</a></td>
|
|
<td class="summary">Get node for component by name.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_druid">get_druid(self)</a></td>
|
|
<td class="summary">Return druid with context of calling component.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_name">get_name(self)</a></td>
|
|
<td class="summary">Return component name</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_input_priority">get_input_priority(self)</a></td>
|
|
<td class="summary">Return component input priority</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#set_input_priority">set_input_priority(self, value)</a></td>
|
|
<td class="summary">Set component input priority</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#reset_input_priority">reset_input_priority(self)</a></td>
|
|
<td class="summary">Reset component input priority to default value</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_uid">get_uid(self)</a></td>
|
|
<td class="summary">Return component uid.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#set_input_enabled">set_input_enabled(self, state)</a></td>
|
|
<td class="summary">Set component input state.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_parent_component">get_parent_component(self)</a></td>
|
|
<td class="summary">Return the parent for current component</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#setup_component">setup_component(self, druid_instance, context, style)</a></td>
|
|
<td class="summary">Setup component context and his style table</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#get_childrens">get_childrens(self)</a></td>
|
|
<td class="summary">Return all children components, recursive</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#Fields">Fields</a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#ALL">ALL</a></td>
|
|
<td class="summary">Component Interests</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
|
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "set_style"></a>
|
|
<strong>set_style(self, druid_style)</strong>
|
|
</dt>
|
|
<dd>
|
|
Set current component style table.
|
|
Invoke `on_style_change` on component, if exist. BaseComponent should handle
|
|
their style changing and store all style params
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
<li><span class="parameter">druid_style</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
|
Druid style module
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "set_template"></a>
|
|
<strong>set_template(self, template)</strong>
|
|
</dt>
|
|
<dd>
|
|
Set current component template name
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
<li><span class="parameter">template</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
|
BaseComponent template name
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "set_nodes"></a>
|
|
<strong>set_nodes(self, nodes)</strong>
|
|
</dt>
|
|
<dd>
|
|
Set current component nodes
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
<li><span class="parameter">nodes</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
|
BaseComponent nodes table
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_context"></a>
|
|
<strong>get_context(self)</strong>
|
|
</dt>
|
|
<dd>
|
|
Get current component context
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
|
BaseComponent context
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_node"></a>
|
|
<strong>get_node(self, node_or_name)</strong>
|
|
</dt>
|
|
<dd>
|
|
Get node for component by name.
|
|
If component has nodes, node_or_name should be string
|
|
It auto pick node by template name or from nodes by clone_tree
|
|
if they was setup via component:set_nodes, component:set_template
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
<li><span class="parameter">node_or_name</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a> or <span class="type">node</span></span>
|
|
Node name or node itself
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">node</span></span>
|
|
Gui node
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_druid"></a>
|
|
<strong>get_druid(self)</strong>
|
|
</dt>
|
|
<dd>
|
|
Return druid with context of calling component.
|
|
Use it to create component inside of other components.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">Druid</span></span>
|
|
Druid instance with component context
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_name"></a>
|
|
<strong>get_name(self)</strong>
|
|
</dt>
|
|
<dd>
|
|
Return component name
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a></span>
|
|
The component name
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_input_priority"></a>
|
|
<strong>get_input_priority(self)</strong>
|
|
</dt>
|
|
<dd>
|
|
Return component input priority
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">number</span></span>
|
|
The component input priority
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "set_input_priority"></a>
|
|
<strong>set_input_priority(self, value)</strong>
|
|
</dt>
|
|
<dd>
|
|
Set component input priority
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
<li><span class="parameter">value</span>
|
|
<span class="types"><span class="type">number</span></span>
|
|
The new input priority value
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">number</span></span>
|
|
The component input priority
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "reset_input_priority"></a>
|
|
<strong>reset_input_priority(self)</strong>
|
|
</dt>
|
|
<dd>
|
|
Reset component input priority to default value
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">number</span></span>
|
|
The component input priority
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_uid"></a>
|
|
<strong>get_uid(self)</strong>
|
|
</dt>
|
|
<dd>
|
|
Return component uid. UID generated in component creation order
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">number</span></span>
|
|
The component uid
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "set_input_enabled"></a>
|
|
<strong>set_input_enabled(self, state)</strong>
|
|
</dt>
|
|
<dd>
|
|
Set component input state. By default it enabled
|
|
You can disable any input of component by this function
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
<li><span class="parameter">state</span>
|
|
<span class="types"><span class="type">bool</span></span>
|
|
The component input state
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
BaseComponent itself
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_parent_component"></a>
|
|
<strong>get_parent_component(self)</strong>
|
|
</dt>
|
|
<dd>
|
|
Return the parent for current component
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">druid.base_component</span> or <span class="type">nil</span></span>
|
|
The druid component instance or nil
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "setup_component"></a>
|
|
<strong>setup_component(self, druid_instance, context, style)</strong>
|
|
</dt>
|
|
<dd>
|
|
Setup component context and his style table
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
<li><span class="parameter">druid_instance</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
|
The parent druid instance
|
|
</li>
|
|
<li><span class="parameter">context</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
|
Druid context. Usually it is self of script
|
|
</li>
|
|
<li><span class="parameter">style</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
|
Druid style module
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><span class="type">component</span></span>
|
|
BaseComponent itself
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "get_childrens"></a>
|
|
<strong>get_childrens(self)</strong>
|
|
</dt>
|
|
<dd>
|
|
Return all children components, recursive
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
<span class="types"><span class="type">BaseComponent</span></span>
|
|
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
|
Array of childrens if the Druid component instance
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
|
|
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "ALL"></a>
|
|
<strong>ALL</strong>
|
|
</dt>
|
|
<dd>
|
|
Component Interests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
</div> <!-- id="content" -->
|
|
</div> <!-- id="main" -->
|
|
<div id="about">
|
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
|
<i style="float:right;">Last updated 2021-10-23 17:32:40 </i>
|
|
</div> <!-- id="about" -->
|
|
</div> <!-- id="container" -->
|
|
</body>
|
|
</html>
|