mirror of
https://github.com/airstruck/luigi.git
synced 2026-01-09 15:58:22 +00:00
support vertical slider
This commit is contained in:
@@ -165,7 +165,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ found, and focuses that widget.
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ This table is identical to the constructed widget.
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -741,7 +741,7 @@ child widgets appear.
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -68,22 +68,22 @@ but themes should give buttons an appropriate appearance.</p>
|
|||||||
<h3>Usage:</h3>
|
<h3>Usage:</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<pre class="example">
|
<pre class="example">
|
||||||
-- create a layout containing only a button
|
-- create a layout containing only a button
|
||||||
local layout = Layout {
|
local layout = Layout {
|
||||||
type = 'button',
|
type = 'button',
|
||||||
id = 'exampleButton',
|
id = 'exampleButton',
|
||||||
text = 'Press me',
|
text = 'Press me',
|
||||||
width = 100,
|
width = 100,
|
||||||
height = 32,
|
height = 32,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- handle Press events
|
-- handle Press events
|
||||||
layout.exampleButton:onPress(function (event)
|
layout.exampleButton:onPress(function (event)
|
||||||
print 'You pressed the button.'
|
print 'You pressed the button.'
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- show the layout
|
-- show the layout
|
||||||
layout:show()
|
layout:show()
|
||||||
</pre>
|
</pre>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ but themes should give buttons an appropriate appearance.</p>
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ standard themes, the widget's value should be indicated in some other way.</p>
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ not be explicitly created.</p>
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ between 0 and 1 (inclusive) to change the width of the bar.</p>
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ standard themes, the widget's value should be indicated in some other way.</p>
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -73,16 +73,16 @@ should have a specified <a href="../modules/attribute.html#width">width</a> attr
|
|||||||
<h3>Usage:</h3>
|
<h3>Usage:</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<pre class="example">
|
<pre class="example">
|
||||||
-- create a layout containing two widgets separated by a sash
|
-- create a layout containing two widgets separated by a sash
|
||||||
local layout = Layout {
|
local layout = Layout {
|
||||||
type = 'panel', flow = 'x',
|
type = 'panel', flow = 'x',
|
||||||
{ text = 'This is the left side', wrap = true, width = 100 },
|
{ text = 'This is the left side', wrap = true, width = 100 },
|
||||||
{ type = 'sash' },
|
{ type = 'sash' },
|
||||||
{ text = 'This is the right side', wrap = true },
|
{ text = 'This is the right side', wrap = true },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- show the layout
|
-- show the layout
|
||||||
layout:show()
|
layout:show()
|
||||||
</pre>
|
</pre>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ should have a specified <a href="../modules/attribute.html#width">width</a> attr
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ number between 0 and 1, inclusive.</p>
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -70,17 +70,17 @@ display status messages.</p>
|
|||||||
<h3>Usage:</h3>
|
<h3>Usage:</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<pre class="example">
|
<pre class="example">
|
||||||
-- create a layout containing some buttons and a status bar
|
-- create a layout containing some buttons and a status bar
|
||||||
local layout = Layout {
|
local layout = Layout {
|
||||||
{ type = 'panel', flow = 'x',
|
{ type = 'panel', flow = 'x',
|
||||||
{ text = 'Do stuff', status = 'Press to do stuff' },
|
{ text = 'Do stuff', status = 'Press to do stuff' },
|
||||||
{ text = 'Quit', status = 'Press to quit' },
|
{ text = 'Quit', status = 'Press to quit' },
|
||||||
},
|
},
|
||||||
{ type = 'status', height = 24 },
|
{ type = 'status', height = 24 },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- show the layout
|
-- show the layout
|
||||||
layout:show()
|
layout:show()
|
||||||
</pre>
|
</pre>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ display status messages.</p>
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ item displayed in the content area.</p>
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.3</a></i>
|
||||||
<i style="float:right;">Last updated 2015-12-07 03:00:19 </i>
|
<i style="float:right;">Last updated 2015-12-07 05:47:24 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ return { id = 'mainWindow', type = 'panel',
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type = 'panel', id = 'toolbar', style = 'toolbar', flow = 'x',
|
{ type = 'panel', id = 'toolbar', style = 'toolbar', flow = 'x',
|
||||||
{ type = 'button', id = 'newButton', style = 'toolButton', key = 'z',
|
{ id = 'newButton', style = 'toolButton', key = 'z',
|
||||||
icon = 'icon/32px/Blueprint.png',
|
icon = 'icon/32px/Blueprint.png',
|
||||||
status = 'Create a new thing' },
|
status = 'Create a new thing' },
|
||||||
{ type = 'button', id = 'loadButton', style = 'toolButton',
|
{ id = 'loadButton', style = 'toolButton',
|
||||||
icon = 'icon/32px/Calendar.png',
|
icon = 'icon/32px/Calendar.png',
|
||||||
status = 'Load a thing' },
|
status = 'Load a thing' },
|
||||||
{ type = 'button', id = 'saveButton', style = 'toolButton',
|
{ id = 'saveButton', style = 'toolButton',
|
||||||
icon = 'icon/32px/Harddrive.png',
|
icon = 'icon/32px/Harddrive.png',
|
||||||
status = 'Save a thing' },
|
status = 'Save a thing' },
|
||||||
},
|
},
|
||||||
@@ -48,34 +48,43 @@ return { id = 'mainWindow', type = 'panel',
|
|||||||
align = 'top center' },
|
align = 'top center' },
|
||||||
{ text = 'A man, a plan, a canal: Panama!', style = 'listThing' },
|
{ text = 'A man, a plan, a canal: Panama!', style = 'listThing' },
|
||||||
},
|
},
|
||||||
{ type = 'sash', width = 4, },
|
{ type = 'sash' },
|
||||||
{ type = 'panel', id = 'mainCanvas' },
|
{ type = 'panel', id = 'mainCanvas' },
|
||||||
{ type = 'sash', width = 4, },
|
{ type = 'sash' },
|
||||||
{ type = 'panel', id = 'rightSideBox', width = 200, minwidth = 64,
|
{ type = 'panel', id = 'rightSideBox', width = 200, minwidth = 64, scroll = true,
|
||||||
{ type = 'panel', text = 'A slider', align = 'bottom', height = 24, padding = 4 },
|
{ id = 'flowTest',
|
||||||
{ type = 'slider', height = 32, margin = 4, id = 'slidey', value = 0 },
|
{ minheight = 64,
|
||||||
{ type = 'panel', text = 'A stepper', align = 'bottom', height = 24, padding = 4 },
|
{ type = 'label', text = 'Slider' },
|
||||||
{ type = 'stepper', height = 32, margin = 4,
|
{ type = 'slider', id = 'slidey', value = 0 },
|
||||||
{ value = 1, text = 'Thing One' },
|
},
|
||||||
{ value = 2, text = 'Thing Two' },
|
{ minheight = 64,
|
||||||
{ value = 3, text = 'Thing Three' },
|
{ type = 'label', text = 'Stepper' },
|
||||||
|
{ type = 'stepper',
|
||||||
|
{ value = 1, text = 'Thing One' },
|
||||||
|
{ value = 2, text = 'Thing Two' },
|
||||||
|
{ value = 3, text = 'Thing Three' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ minheight = 64,
|
||||||
|
{ type = 'label', text = 'Progress' },
|
||||||
|
{ type = 'progress', id = 'progressBar', },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{ type = 'panel', text = 'A progress bar', align = 'bottom', height = 24, padding = 4 },
|
{
|
||||||
{ type = 'progress', height = 32, margin = 4, id = 'progressBar', },
|
{ type = 'label', text = 'Above layout' },
|
||||||
{ type = 'panel', text = 'A check box', align = 'bottom', height = 24, padding = 4 },
|
{ type = 'check', text = 'Flow horizontal', id = 'flowToggle', },
|
||||||
{ type = 'check', text = 'Check it out', height = 32, padding = 4, id = 'checkBox', },
|
{ type = 'label', text = 'Some radio widgets' },
|
||||||
{ type = 'panel', text = 'Some radio widgets', align = 'bottom', height = 24, padding = 4 },
|
{ type = 'radio', text = 'One fish' },
|
||||||
{ type = 'radio', text = 'One fish', height = 32, padding = 4, },
|
{ type = 'radio', text = 'Two fish' },
|
||||||
{ type = 'radio', text = 'Two fish', height = 32, padding = 4, wrap = true },
|
{ type = 'radio', text = 'Red fish' },
|
||||||
{ type = 'radio', text = 'Red fish', height = 32, padding = 4, },
|
{ type = 'radio', text = 'Blue fish' },
|
||||||
{ type = 'radio', text = 'Blue fish', height = 32, padding = 4, },
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type = 'sash', height = 4, },
|
{ type = 'sash' },
|
||||||
{ type = 'panel', flow = 'x', height = 48, padding = 2,
|
{ type = 'panel', flow = 'x', height = 64,
|
||||||
{ type = 'text', id = 'aTextField', text = 'Testing «ταБЬℓσ»: 1<2 & 4+1>3, now 20% off!' },
|
{ type = 'text', id = 'aTextField', text = 'Testing «ταБЬℓσ»: 1<2 & 4+1>3, now 20% off!' },
|
||||||
{ type = 'button', key='return', width = 80, id = 'aButton', text = 'Styling!',
|
{ type = 'button', width = 90, id = 'aButton', text = 'Press me!' },
|
||||||
font = 'font/DejaVuSansMono.ttf' },
|
|
||||||
},
|
},
|
||||||
{ type = 'status', id = 'statusbar', height = 24, padding = 4, color = { 255, 0, 0 } },
|
{ type = 'status', id = 'statusbar' },
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ layout.slidey:onChange(function (event)
|
|||||||
layout.progressBar.value = event.value
|
layout.progressBar.value = event.value
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
layout.flowToggle:onChange(function (event)
|
||||||
|
layout.flowTest.flow = event.value and 'x' or 'y'
|
||||||
|
layout.slidey.flow = event.value and 'y' or 'x'
|
||||||
|
end)
|
||||||
|
|
||||||
layout.newButton:onPress(function (event)
|
layout.newButton:onPress(function (event)
|
||||||
print('creating a new thing!')
|
print('creating a new thing!')
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ return {
|
|||||||
style = 'short',
|
style = 'short',
|
||||||
},
|
},
|
||||||
toolButton = {
|
toolButton = {
|
||||||
|
type = 'button',
|
||||||
align = 'center middle',
|
align = 'center middle',
|
||||||
width = 48,
|
width = 48,
|
||||||
slices = function (self)
|
slices = function (self)
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ function Style:getProperty (object, property, original)
|
|||||||
local rule = rules[lookupValue]
|
local rule = rules[lookupValue]
|
||||||
if rule then
|
if rule then
|
||||||
local value = self:getProperty(rule, property, original)
|
local value = self:getProperty(rule, property, original)
|
||||||
|
if type(value) == 'function' then
|
||||||
|
value = value(original)
|
||||||
|
end
|
||||||
if value ~= nil then return value end
|
if value ~= nil then return value end
|
||||||
end
|
end
|
||||||
end -- lookup values
|
end -- lookup values
|
||||||
|
|||||||
@@ -38,6 +38,14 @@ return function (config)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function getControlHeight (self)
|
||||||
|
return self.flow == 'x' and 32
|
||||||
|
end
|
||||||
|
|
||||||
|
local function getControlWidth (self)
|
||||||
|
return self.flow ~= 'x' and 32
|
||||||
|
end
|
||||||
|
|
||||||
local function getMenuItemBackground (self)
|
local function getMenuItemBackground (self)
|
||||||
return self.active and highlight
|
return self.active and highlight
|
||||||
end
|
end
|
||||||
@@ -46,13 +54,30 @@ return function (config)
|
|||||||
return self.hovered and highlight or lineColor
|
return self.hovered and highlight or lineColor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function getSashHeight (self)
|
||||||
|
return self.parent.flow ~= 'x' and 4
|
||||||
|
end
|
||||||
|
|
||||||
|
local function getSashWidth (self)
|
||||||
|
return self.parent.flow == 'x' and 4
|
||||||
|
end
|
||||||
|
|
||||||
local function getTextSlices (self)
|
local function getTextSlices (self)
|
||||||
return self.focused and resources .. 'text_focused.png'
|
return self.focused and resources .. 'text_focused.png'
|
||||||
or resources .. 'text.png'
|
or resources .. 'text.png'
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
control = {
|
||||||
|
flow = 'x',
|
||||||
|
height = getControlHeight,
|
||||||
|
width = getControlWidth,
|
||||||
|
color = textColor,
|
||||||
|
minheight = 28,
|
||||||
|
minwidth = 28,
|
||||||
|
},
|
||||||
button = {
|
button = {
|
||||||
|
type = 'control',
|
||||||
align = 'center middle',
|
align = 'center middle',
|
||||||
padding = 6,
|
padding = 6,
|
||||||
slices = getButtonSlices,
|
slices = getButtonSlices,
|
||||||
@@ -61,26 +86,83 @@ return function (config)
|
|||||||
focusable = true,
|
focusable = true,
|
||||||
color = textColor,
|
color = textColor,
|
||||||
},
|
},
|
||||||
|
check = {
|
||||||
['stepper.left'] = {
|
type = 'control',
|
||||||
type = 'button',
|
focusable = true,
|
||||||
icon = resources .. 'triangle_left.png',
|
color = textColor,
|
||||||
|
icon = getCheckOrRadioIcon,
|
||||||
|
padding = 4,
|
||||||
},
|
},
|
||||||
|
label = {
|
||||||
['stepper.right'] = {
|
type = 'control',
|
||||||
type = 'button',
|
background = backColor,
|
||||||
icon = resources .. 'triangle_right.png',
|
padding = 4,
|
||||||
},
|
},
|
||||||
menu = {
|
menu = {
|
||||||
height = 24,
|
height = 24,
|
||||||
},
|
},
|
||||||
|
['menu.expander'] = {
|
||||||
|
icon = resources .. 'triangle_right.png',
|
||||||
|
},
|
||||||
['menu.item'] = {
|
['menu.item'] = {
|
||||||
padding = 4,
|
padding = 4,
|
||||||
align = 'left middle',
|
align = 'left middle',
|
||||||
color = textColor,
|
color = textColor,
|
||||||
background = getMenuItemBackground,
|
background = getMenuItemBackground,
|
||||||
},
|
},
|
||||||
['menu.expander'] = {
|
panel = {
|
||||||
|
background = backColor,
|
||||||
|
color = textColor,
|
||||||
|
},
|
||||||
|
progress = {
|
||||||
|
type = 'control',
|
||||||
|
slices = resources .. 'button_pressed.png',
|
||||||
|
padding = 0,
|
||||||
|
},
|
||||||
|
['progress.bar'] = {
|
||||||
|
type = 'control',
|
||||||
|
slices = resources .. 'progress.png',
|
||||||
|
padding = 0,
|
||||||
|
minwidth = 12,
|
||||||
|
},
|
||||||
|
radio = {
|
||||||
|
type = 'control',
|
||||||
|
focusable = true,
|
||||||
|
color = textColor,
|
||||||
|
icon = getCheckOrRadioIcon,
|
||||||
|
padding = 4,
|
||||||
|
},
|
||||||
|
sash = {
|
||||||
|
background = getSashBackground,
|
||||||
|
height = getSashHeight,
|
||||||
|
width = getSashWidth,
|
||||||
|
},
|
||||||
|
slider = {
|
||||||
|
type = 'control',
|
||||||
|
slices = resources .. 'button_pressed.png',
|
||||||
|
padding = 0,
|
||||||
|
},
|
||||||
|
status = {
|
||||||
|
type = 'panel',
|
||||||
|
align = 'left middle',
|
||||||
|
padding = 4,
|
||||||
|
height = 22,
|
||||||
|
},
|
||||||
|
stepper = {
|
||||||
|
type = 'control',
|
||||||
|
slices = resources .. 'button_pressed.png',
|
||||||
|
},
|
||||||
|
['stepper.item'] = {
|
||||||
|
type = 'control',
|
||||||
|
align = 'center middle',
|
||||||
|
color = textColor,
|
||||||
|
},
|
||||||
|
['stepper.left'] = {
|
||||||
|
type = 'button',
|
||||||
|
icon = resources .. 'triangle_left.png',
|
||||||
|
},
|
||||||
|
['stepper.right'] = {
|
||||||
|
type = 'button',
|
||||||
icon = resources .. 'triangle_right.png',
|
icon = resources .. 'triangle_right.png',
|
||||||
},
|
},
|
||||||
submenu = {
|
submenu = {
|
||||||
@@ -89,60 +171,14 @@ return function (config)
|
|||||||
slices = resources .. 'submenu.png',
|
slices = resources .. 'submenu.png',
|
||||||
color = textColor,
|
color = textColor,
|
||||||
},
|
},
|
||||||
sash = {
|
|
||||||
background = getSashBackground
|
|
||||||
},
|
|
||||||
slider = {
|
|
||||||
slices = resources .. 'button_pressed.png',
|
|
||||||
padding = 0,
|
|
||||||
minwidth = 24,
|
|
||||||
minheight = 24
|
|
||||||
},
|
|
||||||
panel = {
|
|
||||||
background = backColor,
|
|
||||||
color = textColor,
|
|
||||||
},
|
|
||||||
progress = {
|
|
||||||
slices = resources .. 'button_pressed.png',
|
|
||||||
padding = 0,
|
|
||||||
minwidth = 24,
|
|
||||||
minheight = 24
|
|
||||||
},
|
|
||||||
['progress.bar'] = {
|
|
||||||
slices = resources .. 'progress.png',
|
|
||||||
padding = 0,
|
|
||||||
minwidth = 12,
|
|
||||||
},
|
|
||||||
stepper = {
|
|
||||||
slices = resources .. 'button_pressed.png',
|
|
||||||
},
|
|
||||||
['stepper.item'] = {
|
|
||||||
align = 'center middle',
|
|
||||||
color = textColor,
|
|
||||||
},
|
|
||||||
status = {
|
|
||||||
type = 'panel',
|
|
||||||
},
|
|
||||||
text = {
|
text = {
|
||||||
|
type = 'control',
|
||||||
align = 'left middle',
|
align = 'left middle',
|
||||||
slices = getTextSlices,
|
slices = getTextSlices,
|
||||||
padding = 6,
|
padding = 6,
|
||||||
minwidth = 24,
|
|
||||||
minheight = 24,
|
|
||||||
focusable = true,
|
focusable = true,
|
||||||
cursor = 'ibeam',
|
cursor = 'ibeam',
|
||||||
highlight = highlight,
|
highlight = highlight,
|
||||||
color = textColor,
|
|
||||||
},
|
|
||||||
check = {
|
|
||||||
focusable = true,
|
|
||||||
color = textColor,
|
|
||||||
icon = getCheckOrRadioIcon
|
|
||||||
},
|
|
||||||
radio = {
|
|
||||||
focusable = true,
|
|
||||||
color = textColor,
|
|
||||||
icon = getCheckOrRadioIcon
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -47,30 +47,30 @@ function Widget.register (name, decorator)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function maybeCall (something, ...)
|
local function maybeCall (something, ...)
|
||||||
if type(something) == 'function' then
|
|
||||||
return something(...)
|
|
||||||
end
|
|
||||||
return something
|
return something
|
||||||
end
|
end
|
||||||
|
|
||||||
-- look for properties in attributes, Widget, style, and theme
|
-- look for properties in attributes, Widget, style, and theme
|
||||||
local function metaIndex (self, property)
|
local function metaIndex (self, property)
|
||||||
|
-- look in widget's own attributes
|
||||||
local A = Attribute[property]
|
local A = Attribute[property]
|
||||||
if A then
|
if A then
|
||||||
local value = A.get and A.get(self) or self.attributes[property]
|
local value = A.get and A.get(self) or self.attributes[property]
|
||||||
if value ~= nil then return maybeCall(value, self) end
|
if type(value) == 'function' then value = value(self) end
|
||||||
|
if value ~= nil then return value end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- look in Widget class properties
|
||||||
local value = Widget[property]
|
local value = Widget[property]
|
||||||
if value ~= nil then return value end
|
if value ~= nil then return value end
|
||||||
|
|
||||||
|
-- look in style
|
||||||
local layout = self.layout
|
local layout = self.layout
|
||||||
local style = layout:getStyle()
|
value = layout:getStyle():getProperty(self, property)
|
||||||
value = style and maybeCall(style:getProperty(self, property), self)
|
|
||||||
if value ~= nil then return value end
|
if value ~= nil then return value end
|
||||||
|
|
||||||
local theme = layout:getTheme()
|
-- look in theme
|
||||||
return theme and maybeCall(theme:getProperty(self, property), self)
|
return layout:getTheme():getProperty(self, property)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- setting attributes triggers special behavior
|
-- setting attributes triggers special behavior
|
||||||
|
|||||||
@@ -5,22 +5,22 @@ Buttons have no special behavior beyond that of generic widgets,
|
|||||||
but themes should give buttons an appropriate appearance.
|
but themes should give buttons an appropriate appearance.
|
||||||
|
|
||||||
@usage
|
@usage
|
||||||
-- create a layout containing only a button
|
-- create a layout containing only a button
|
||||||
local layout = Layout {
|
local layout = Layout {
|
||||||
type = 'button',
|
type = 'button',
|
||||||
id = 'exampleButton',
|
id = 'exampleButton',
|
||||||
text = 'Press me',
|
text = 'Press me',
|
||||||
width = 100,
|
width = 100,
|
||||||
height = 32,
|
height = 32,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- handle Press events
|
-- handle Press events
|
||||||
layout.exampleButton:onPress(function (event)
|
layout.exampleButton:onPress(function (event)
|
||||||
print 'You pressed the button.'
|
print 'You pressed the button.'
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- show the layout
|
-- show the layout
|
||||||
layout:show()
|
layout:show()
|
||||||
|
|
||||||
@widget button
|
@widget button
|
||||||
--]]--
|
--]]--
|
||||||
|
|||||||
@@ -10,16 +10,16 @@ then either or both of the siblings adjacent to the sash
|
|||||||
should have a specified @{attribute.width|width} attribute.
|
should have a specified @{attribute.width|width} attribute.
|
||||||
|
|
||||||
@usage
|
@usage
|
||||||
-- create a layout containing two widgets separated by a sash
|
-- create a layout containing two widgets separated by a sash
|
||||||
local layout = Layout {
|
local layout = Layout {
|
||||||
type = 'panel', flow = 'x',
|
type = 'panel', flow = 'x',
|
||||||
{ text = 'This is the left side', wrap = true, width = 100 },
|
{ text = 'This is the left side', wrap = true, width = 100 },
|
||||||
{ type = 'sash' },
|
{ type = 'sash' },
|
||||||
{ text = 'This is the right side', wrap = true },
|
{ text = 'This is the right side', wrap = true },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- show the layout
|
-- show the layout
|
||||||
layout:show()
|
layout:show()
|
||||||
|
|
||||||
@widget sash
|
@widget sash
|
||||||
--]]--
|
--]]--
|
||||||
|
|||||||
@@ -8,21 +8,18 @@ number between 0 and 1, inclusive.
|
|||||||
--]]--
|
--]]--
|
||||||
|
|
||||||
return function (self)
|
return function (self)
|
||||||
|
|
||||||
local function clamp (value)
|
local function clamp (value)
|
||||||
return value < 0 and 0 or value > 1 and 1 or value
|
return value < 0 and 0 or value > 1 and 1 or value
|
||||||
end
|
end
|
||||||
|
|
||||||
self.value = clamp(self.value or 0.5)
|
self.value = clamp(self.value or 0.5)
|
||||||
self.step = self.step or 0.01
|
self.step = self.step or 0.01
|
||||||
self.flow = 'x' -- TODO: support vertical slider
|
|
||||||
|
|
||||||
local spacer = self:addChild()
|
local spacer = self:addChild()
|
||||||
|
|
||||||
local thumb = self:addChild {
|
local thumb = self:addChild {
|
||||||
type = 'button',
|
type = 'button',
|
||||||
align = 'middle center',
|
align = 'middle center',
|
||||||
width = 0,
|
|
||||||
margin = 0,
|
margin = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,9 +43,15 @@ return function (self)
|
|||||||
local function press (event)
|
local function press (event)
|
||||||
local x1, y1, w, h = self:getRectangle(true, true)
|
local x1, y1, w, h = self:getRectangle(true, true)
|
||||||
local x2, y2 = x1 + w, y1 + h
|
local x2, y2 = x1 + w, y1 + h
|
||||||
local halfThumb = thumb:getWidth() / 2
|
if self.flow == 'x' then
|
||||||
x1, x2 = x1 + halfThumb, x2 - halfThumb
|
local halfThumb = thumb:getWidth() / 2
|
||||||
self.value = clamp((event.x - x1) / (x2 - x1))
|
x1, x2 = x1 + halfThumb, x2 - halfThumb
|
||||||
|
self.value = clamp((event.x - x1) / (x2 - x1))
|
||||||
|
else
|
||||||
|
local halfThumb = thumb:getHeight() / 2
|
||||||
|
y1, y2 = y1 + halfThumb, y2 - halfThumb
|
||||||
|
self.value = 1 - clamp((event.y - y1) / (y2 - y1))
|
||||||
|
end
|
||||||
thumb:focus()
|
thumb:focus()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -68,11 +71,22 @@ return function (self)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
self:onReshape(function (event)
|
self:onReshape(function (event)
|
||||||
-- TODO: eliminate redundancy with `press`
|
|
||||||
local x1, y1, w, h = self:getRectangle(true, true)
|
local x1, y1, w, h = self:getRectangle(true, true)
|
||||||
local x2, y2 = x1 + w, y1 + h
|
local x2, y2 = x1 + w, y1 + h
|
||||||
local halfThumb = thumb:getWidth() / 2
|
if self.flow == 'x' then
|
||||||
x1, x2 = x1 + halfThumb, x2 - halfThumb
|
thumb.width = 0
|
||||||
spacer.width = self.value * (x2 - x1)
|
thumb.height = false
|
||||||
|
local halfThumb = thumb:getWidth() / 2
|
||||||
|
x1, x2 = x1 + halfThumb, x2 - halfThumb
|
||||||
|
spacer.width = self.value * (x2 - x1)
|
||||||
|
spacer.height = false
|
||||||
|
else
|
||||||
|
thumb.width = false
|
||||||
|
thumb.height = 0
|
||||||
|
local halfThumb = thumb:getHeight() / 2
|
||||||
|
y1, y2 = y1 + halfThumb, y2 - halfThumb
|
||||||
|
spacer.width = false
|
||||||
|
spacer.height = (1 - self.value) * (y2 - y1)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,21 +7,20 @@ status widgets exist in the same layout, only the last one created will
|
|||||||
display status messages.
|
display status messages.
|
||||||
|
|
||||||
@usage
|
@usage
|
||||||
-- create a layout containing some buttons and a status bar
|
-- create a layout containing some buttons and a status bar
|
||||||
local layout = Layout {
|
local layout = Layout {
|
||||||
{ type = 'panel', flow = 'x',
|
{ type = 'panel', flow = 'x',
|
||||||
{ text = 'Do stuff', status = 'Press to do stuff' },
|
{ text = 'Do stuff', status = 'Press to do stuff' },
|
||||||
{ text = 'Quit', status = 'Press to quit' },
|
{ text = 'Quit', status = 'Press to quit' },
|
||||||
},
|
},
|
||||||
{ type = 'status', height = 24 },
|
{ type = 'status', height = 24 },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- show the layout
|
-- show the layout
|
||||||
layout:show()
|
layout:show()
|
||||||
|
|
||||||
@widget status
|
@widget status
|
||||||
--]]--
|
--]]--
|
||||||
|
|
||||||
return function (self)
|
return function (self)
|
||||||
self.layout.statusWidget = self
|
self.layout.statusWidget = self
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user