'*************************************************************
'** Roku Xtream-ALL for XoceUnder
'** Copyright (c)2024 XoceUnder.  All rights reserved.
sub Init()
   'Dbg("MenuScreen Init")
    mBind(["homeGrid", "itemLabelMain1", "itemLabelMain2","itemHeader", ""])
    m.top.observeField("focusedChild","onFocusedChildChange")
  
    'Populate grid content
    buttons = []
	buttons.Push({id: "1", x: "300", y: "300", title: tr("Search"), shortdescriptionline1: tr("Search"), HDLISTITEMICONURL: "pkg:/images/menu/search.png", shortdescriptionline2: tr("Search content by title")})
    buttons.Push({id: "2", x: "300", y: "300", title: tr("Live"), shortdescriptionline1: tr("Live"), HDLISTITEMICONURL: "pkg:/images/menu/tv.png", shortdescriptionline2: tr("Live channels to watch")})
    buttons.Push({id: "3", x: "300", y: "300", title: tr("Movies"), shortdescriptionline1: tr("Movies"), HDLISTITEMICONURL: "pkg:/images/menu/movie.png", shortdescriptionline2: tr("Movies to watch by category")})
    buttons.Push({id: "4", x: "300", y: "300", title: tr("TV Shows"), shortdescriptionline1: tr("TV Shows"), HDLISTITEMICONURL: "pkg:/images/menu/series.png", shortdescriptionline2: tr("TV Shows to see by category")})
    buttons.Push({id: "5", x: "300", y: "300", title: tr("Account"), shortdescriptionline1: tr("Account"), HDLISTITEMICONURL: "pkg:/images/menu/account.png", shortdescriptionline2: tr("Account Information")})
	buttons.Push({id: "6", x: "300", y: "300", title: tr("My Favorites"), shortdescriptionline1: tr("My Favorites"), HDLISTITEMICONURL: "pkg:/images/menu/plus.png", shortdescriptionline2: tr("My selected list")})
    buttons.Push({id: "7", x: "300", y: "300", title: tr("Settings"), shortdescriptionline1: tr("Settings"), HDLISTITEMICONURL: "pkg:/images/menu/settings.png", shortdescriptionline2: tr("System Settings")})
	
    'Populate grid content
    m.homeGrid.content = List2ContentNode(buttons)

    'Center the MarkUp Box
    markupRect = m.homeGrid.boundingRect()
    centerx = (getScreenSize().width - markupRect.width ) / 2
    m.homeGrid.translation = [ centerx + 15, 400 ]
    
    'Select default item
    m.homeGrid.jumpToItem = 2
    m.homeGrid.focusColumn = 2
	
end sub

sub onFocusedChildChange()
    'print "top parent: " m.top.GetParent()
    'print "top scene: " m.top.GetScene()
  if m.top.hasFocus()
     m.top.visible = true
	 m.homeGrid.setFocus(true)
  end if
end sub

