components_tvshows_TVEpisodeRow.bs

import "pkg:/source/utils/misc.bs"
sub init()
  m.top.itemComponentName = "TVListDetails"
  m.top.content = setData()

  ' override defaults from JRRowList
  m.top.focusXOffset = [0]
  m.top.showRowLabel = [false]
  m.top.showRowCounter = [false]
  m.top.itemSpacing = [0, 40]

  updateSize()

  m.top.setFocus(true)
end sub

sub updateSize()
  m.top.translation = [450, 180]

  rowWidth = 1360
  itemWidth = 350
  itemHeight = 300

  ' Size of the individual rows
  m.top.itemSize = [rowWidth, itemHeight]
  ' Size of items in the row
  m.top.rowItemSize = [itemWidth, itemHeight]

  m.top.visible = true
end sub

sub setupRows()
  updateSize()
  objects = m.top.objects
  m.top.numRows = objects.items.count()
  m.top.content = setData()
end sub

function setData()
  data = CreateObject("roSGNode", "ContentNode")
  if not isValid(m.top.objects)
    ' Return an empty node just to return something; we'll update once we have data
    return data
  end if

  for each item in m.top.objects.items
    row = data.CreateChild("ContentNode")
    row.appendChild(item)
  end for

  m.top.doneLoading = true

  return data
end function