jf-roku/components/ListPoster.xml
2019-03-11 11:59:15 -05:00

56 lines
1.3 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<component name="ListPoster" extends="Group">
<children>
<Poster id="poster"
translation="[2, 0]"
/>
<Label id="title"
horizAlign="center"
font="font:SmallSystemFont"
/>
</children>
<interface>
<field id="itemContent" type="node" onChange="itemContentChanged"/>
<field id="itemWidth" type="integer" />
</interface>
<script type="text/brightscript">
<![CDATA[
sub init()
m.title = m.top.findNode("title")
m.poster = m.top.findNode("poster")
updateSize()
end sub
sub updateSize()
m.title = m.top.findNode("title")
m.poster = m.top.findNode("poster")
' TODO - abstract this in case the parent doesnt have itemSize
maxSize = m.top.getParent().itemSize
m.poster.width = int(maxSize[0]) - 4
m.poster.height = m.poster.width * 1.5
m.title.width = m.poster.width
m.title.height = int(maxSize[1]) - m.poster.height
m.title.translation = [0, m.poster.height]
end sub
function itemContentChanged() as void
updateSize()
m.title = m.top.findNode("title")
m.poster = m.top.findNode("poster")
itemData = m.top.itemContent
m.title.text = itemData.title
m.poster.uri = itemData.posterUrl
end function
]]>
</script>
</component>