Author: bklaas
Date: Tue Jun 8 07:42:41 2010
New Revision: 8849
URL: http://svn.slimdevices.com/jive?rev=8849&view=rev
Log:
r39...@daddymac (orig r8847): bklaas | 2010-06-07 15:14:31 -0500
Bug: n/a
Description: add Wire Frame prototype applet
note-- the squeezeplay_test area is not used for any firmware, so will not
affect any builds
Added:
7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/
7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameApplet.lua
7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameMeta.lua
Modified:
7.6/trunk/ (props changed)
Propchange: 7.6/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Tue Jun 8 07:42:41 2010
@@ -13,7 +13,7 @@
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-skin:4552
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/new-alsa:6567
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8423
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8837
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8847
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378
Added:
7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameApplet.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameApplet.lua?rev=8849&view=auto
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameApplet.lua
(added)
+++
7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameApplet.lua
Tue Jun 8 07:42:41 2010
@@ -1,0 +1,201 @@
+--[[
+
+Wire Frame Applet
+
+--]]
+
+local string, pairs, ipairs, tostring = string, pairs, ipairs, tostring
+
+local oo = require("loop.simple")
+
+local Applet = require("jive.Applet")
+local Group = require("jive.ui.Group")
+local Event = require("jive.ui.Event")
+local Framework = require("jive.ui.Framework")
+local Icon = require("jive.ui.Icon")
+local Button = require("jive.ui.Button")
+local Label = require("jive.ui.Label")
+local Choice = require("jive.ui.Choice")
+local Checkbox = require("jive.ui.Checkbox")
+local RadioButton = require("jive.ui.RadioButton")
+local RadioGroup = require("jive.ui.RadioGroup")
+local Popup = require("jive.ui.Popup")
+local Keyboard = require("jive.ui.Keyboard")
+local SimpleMenu = require("jive.ui.SimpleMenu")
+local Slider = require("jive.ui.Slider")
+local Surface = require("jive.ui.Surface")
+local Textarea = require("jive.ui.Textarea")
+local Textinput = require("jive.ui.Textinput")
+local Timeinput = require("jive.ui.Timeinput")
+local Window = require("jive.ui.Window")
+local datetime = require("jive.utils.datetime")
+local jiveMain = jiveMain
+
+local debug = require("jive.utils.debug")
+
+
+module(..., Framework.constants)
+oo.class(_M, Applet)
+
+-- define a table of items to be rendered
+-- edit this to whatever you want to render
+function details(self)
+
+ local data = {
+ sync1 = {
+ enabled = true,
+ windowStyle = 'text_list',
+ titleText = 'Synchronization',
+ helpText = 'This is some test help text to show that
this works',
+ items = {
+ { text = 'Player A', radio = 1},
+ { text = 'Player B', radio = 1},
+ { text = 'Player C', radio = 1},
+ { text = 'Player D', radio = 1},
+ },
+ },
+ sync2 = {
+ enabled = true,
+ windowStyle = 'text_list',
+ titleText = 'Synchronization',
+ items = {
+ { text = 'Player A', checkbox = 1},
+ { text = 'Player B', checkbox = 1, checked =
true},
+ { text = 'Player C', checkbox = 1},
+ { text = 'Player D', checkbox = 1},
+ },
+ },
+ sync3 = {
+ enabled = true,
+ windowStyle = 'text_list',
+ titleText = 'Synchronization',
+ items = {
+ { text = 'Player A', choice = 1, choices = {
'foo', 'bar', 'wtf' }, whichChoice = 3 },
+ { text = 'Player B'},
+ { text = 'Player C'},
+ { text = 'Player D'},
+ },
+ },
+ }
+ return data
+end
+
+
+function showMenu(self)
+ self.data = self:details()
+
+ local window = Window('text_list', 'Wire Frames')
+ local menu = SimpleMenu('menu')
+ for k, v in pairs(self.data) do
+ menu:addItem({
+ text = k,
+ callback = function()
+ self:showWireFrame(k)
+ end,
+ })
+ end
+ menu:setComparator(SimpleMenu.itemComparatorAlpha)
+ window:addWidget(menu)
+ window:show()
+ return window
+end
+
+
+function showWireFrame(self, key)
+
+ local data = self.data[key]
+
+ local window = Window(data.windowStyle or 'text_list', data.titleText)
+ self.menu = SimpleMenu('menu')
+
+ for i, item in ipairs(data.items) do
+ if item.radio then
+ if not self.group then
+ self.group = RadioGroup()
+ end
+ self:addRadioItem(item)
+ elseif item.checkbox then
+ self:addCheckboxItem(item)
+ elseif item.choice then
+ self:addChoiceItem(item)
+ else
+ self:addItem(item)
+ end
+ end
+ if data.helpText then
+ self:addHelpText(data.helpText)
+ end
+
+ window:addWidget(self.menu)
+ window:show()
+end
+
+
+function addHelpText(self, helpText)
+
+ local headerText = Textarea('help_text', helpText)
+ self.menu:setHeaderWidget(headerText)
+end
+
+function addItem(self, item)
+ self.menu:addItem(
+ {
+ text = item.text,
+ style = item.style or 'item',
+ }
+ )
+end
+
+function addRadioItem(self, item)
+ self.menu:addItem(
+ {
+ text = item.text,
+ style = 'item_choice',
+ sound = "WINDOWSHOW",
+ check = RadioButton("radio",
+ self.group,
+ function()
+ log:warn('whoop there it is')
+ end,
+ item.checked or false
+ ),
+ }
+ )
+end
+
+function addCheckboxItem(self, item)
+ self.menu:addItem(
+ {
+ text = item.text,
+ style = 'item_choice',
+ sound = "WINDOWSHOW",
+ check = Checkbox("checkbox",
+ function()
+ log:warn('whoop there it is')
+ end,
+ item.checked or false
+ ),
+ }
+ )
+
+end
+
+
+function addChoiceItem(self, item)
+ self.menu:addItem(
+ {
+ text = item.text,
+ style = 'item_choice',
+ sound = "WINDOWSHOW",
+ check = Choice("choice",
+ item.choices,
+ function()
+ log:warn('whoop there it is')
+ end,
+ item.whichChoice or 1
+ ),
+ }
+ )
+end
+
+
Added:
7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameMeta.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameMeta.lua?rev=8849&view=auto
==============================================================================
---
7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameMeta.lua
(added)
+++
7.6/trunk/squeezeplay/src/squeezeplay_test/share/applets/WireFrame/WireFrameMeta.lua
Tue Jun 8 07:42:41 2010
@@ -1,0 +1,38 @@
+--[[
+
+Wire Frame demo applet
+
+--]]
+
+
+local oo = require("loop.simple")
+
+local AppletMeta = require("jive.AppletMeta")
+
+local appletManager = appletManager
+local jiveMain = jiveMain
+
+
+module(...)
+oo.class(_M, AppletMeta)
+
+
+function jiveVersion(meta)
+ return 1, 1
+end
+
+
+function registerApplet(meta)
+ jiveMain:addItem(meta:menuItem('wireFrame', 'home', "Window
Prototyper", function(applet, ...) applet:showMenu(...) end, 1))
+end
+
+
+--[[
+
+=head1 LICENSE
+
+This source code is public domain. It is intended for you to use as a starting
+point to create your own applet.
+
+=cut
+--]]
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins