|
| 1 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| 2 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 3 | +<html> |
| 4 | +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
| 5 | +<head> |
| 6 | + <title>likeliHUD</title> |
| 7 | + <link rel="stylesheet" href="../ldoc.css" type="text/css" /> |
| 8 | +</head> |
| 9 | +<body> |
| 10 | + |
| 11 | +<div id="container"> |
| 12 | + |
| 13 | +<div id="product"> |
| 14 | + <div id="product_logo"></div> |
| 15 | + <div id="product_name"><big><b></b></big></div> |
| 16 | + <div id="product_description"></div> |
| 17 | +</div> <!-- id="product" --> |
| 18 | + |
| 19 | + |
| 20 | +<div id="main"> |
| 21 | + |
| 22 | + |
| 23 | +<!-- Menu --> |
| 24 | + |
| 25 | +<div id="navigation"> |
| 26 | +<br/> |
| 27 | +<h1>likeliHUD</h1> |
| 28 | + |
| 29 | + |
| 30 | +<ul> |
| 31 | + <li><a href="../index.html">Index</a></li> |
| 32 | +</ul> |
| 33 | + |
| 34 | +<h2>Contents</h2> |
| 35 | +<ul> |
| 36 | +<li><a href="#Class_ImageButton">Class ImageButton </a></li> |
| 37 | +</ul> |
| 38 | + |
| 39 | + |
| 40 | +<h2>Classes</h2> |
| 41 | +<ul class="nowrap"> |
| 42 | + <li><a href="../classes/Block.html">Block</a></li> |
| 43 | + <li><a href="../classes/Layout.html">Layout</a></li> |
| 44 | + <li><a href="../classes/Rectangle.html">Rectangle</a></li> |
| 45 | + <li><a href="../classes/Image.html">Image</a></li> |
| 46 | + <li><a href="../classes/Stack.html">Stack</a></li> |
| 47 | + <li><a href="../classes/Label.html">Label</a></li> |
| 48 | + <li><strong>ImageButton</strong></li> |
| 49 | + <li><a href="../classes/TextField.html">TextField</a></li> |
| 50 | +</ul> |
| 51 | +<h2>Modules</h2> |
| 52 | +<ul class="nowrap"> |
| 53 | + <li><a href="../modules/Utils.html">Utils</a></li> |
| 54 | +</ul> |
| 55 | +<h2>Topics</h2> |
| 56 | +<ul class=""> |
| 57 | + <li><a href="../topics/README.md.html">README</a></li> |
| 58 | +</ul> |
| 59 | +<h2>Examples</h2> |
| 60 | +<ul class="nowrap"> |
| 61 | + <li><a href="../examples/buttons.lua.html">buttons.lua</a></li> |
| 62 | + <li><a href="../examples/events.lua.html">events.lua</a></li> |
| 63 | + <li><a href="../examples/fill.lua.html">fill.lua</a></li> |
| 64 | + <li><a href="../examples/focus.lua.html">focus.lua</a></li> |
| 65 | + <li><a href="../examples/inside.lua.html">inside.lua</a></li> |
| 66 | + <li><a href="../examples/layout.lua.html">layout.lua</a></li> |
| 67 | + <li><a href="../examples/o.lua.html">o.lua</a></li> |
| 68 | + <li><a href="../examples/simple.lua.html">simple.lua</a></li> |
| 69 | + <li><a href="../examples/squares.lua.html">squares.lua</a></li> |
| 70 | + <li><a href="../examples/start.lua.html">start.lua</a></li> |
| 71 | +</ul> |
| 72 | + |
| 73 | +</div> |
| 74 | + |
| 75 | +<div id="content"> |
| 76 | + |
| 77 | +<h1>Class <code>ImageButton</code></h1> |
| 78 | +<p>An image button.</p> |
| 79 | +<p> Internally it is an <a href="../classes/Image.html#">Image</a> with a predefined <code>mouse</code> field.</p> |
| 80 | + |
| 81 | + |
| 82 | +<h2><a href="#Class_ImageButton">Class ImageButton </a></h2> |
| 83 | +<table class="function_list"> |
| 84 | + <tr> |
| 85 | + <td class="name" nowrap><a href="#imagebutton:new">imagebutton:new ()</a></td> |
| 86 | + <td class="summary">Constructor.</td> |
| 87 | + </tr> |
| 88 | +</table> |
| 89 | + |
| 90 | +<br/> |
| 91 | +<br/> |
| 92 | + |
| 93 | + |
| 94 | + <h2 class="section-header has-description"><a name="Class_ImageButton"></a>Class ImageButton </h2> |
| 95 | + |
| 96 | + <div class="section-description"> |
| 97 | + Represents an image button. |
| 98 | + </div> |
| 99 | + <dl class="function"> |
| 100 | + <dt> |
| 101 | + <a name = "imagebutton:new"></a> |
| 102 | + <strong>imagebutton:new ()</strong> |
| 103 | + </dt> |
| 104 | + <dd> |
| 105 | + Constructor. </p> |
| 106 | + |
| 107 | +<p> It is <a href="../classes/Image.html#">Image</a> under the hood so it has same fields as described in |
| 108 | + <a href="../classes/Image.html#image:new">Image:new</a>.</p> |
| 109 | + |
| 110 | +<ul> |
| 111 | + <li><p><code>quad</code> : ⚠️ The number of quads <em>must</em> be equal to 3. |
| 112 | +These quads are supposed to display different states of the button: the |
| 113 | +current quad is set according to the state of the button as follows |
| 114 | +(see also the <code>mouse</code> property in <a href="../classes/Block.html#block:new">Block:new</a>): </p> |
| 115 | + |
| 116 | +<pre><code> | onExit | onEnter | onPress | onClick | |
| 117 | + |--------|---------|---------|---------| |
| 118 | +quad.current | 1 | 2 | 3 | 2 | |
| 119 | +</code></pre></li> |
| 120 | + <li><p><code>onClick</code> : a function. Called whenever the button is clicked. The button object itself |
| 121 | + is passed to that function on call.</p></li> |
| 122 | + <li><p><code>mouse</code> : ⚠️ Don't override this property. If you want a button with |
| 123 | + a custom mouse |
| 124 | + better to create it from scratch as a user-defined block.</p></li> |
| 125 | +</ul> |
| 126 | + |
| 127 | +<p> <em>NOTE</em> : this is not a text button - use the <code>inside</code> (see <a href="../classes/Block.html#block:new">Block:new</a>) |
| 128 | + property to place a <a href="../classes/Label.html#">Label</a> inside a button. |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + <h3>Usage:</h3> |
| 136 | + <ul> |
| 137 | + <pre class="example"><span class="keyword">local</span> UI = ui.<span class="function-name">ImageButton</span> { |
| 138 | + path = <span class="string">'/path/to/button.png'</span>, |
| 139 | + |
| 140 | + quad = { |
| 141 | + layout = { |
| 142 | + rows = <span class="number">3</span>, |
| 143 | + columns = <span class="number">1</span>, |
| 144 | + }, |
| 145 | + }, |
| 146 | + |
| 147 | + <span class="comment">-- Make the button display text |
| 148 | +</span> inside = { |
| 149 | + ui.<span class="function-name">Label</span> { |
| 150 | + text = <span class="string">'Ok'</span> |
| 151 | + } |
| 152 | + } |
| 153 | +}</pre> |
| 154 | + </ul> |
| 155 | + |
| 156 | +</dd> |
| 157 | +</dl> |
| 158 | + |
| 159 | + |
| 160 | +</div> <!-- id="content" --> |
| 161 | +</div> <!-- id="main" --> |
| 162 | +<div id="about"> |
| 163 | +<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> |
| 164 | +<i style="float:right;">Last updated 2026-06-08 14:52:17 </i> |
| 165 | +</div> <!-- id="about" --> |
| 166 | +</div> <!-- id="container" --> |
| 167 | +</body> |
| 168 | +</html> |
0 commit comments