|
|
|
@ -5,6 +5,7 @@ require "ui/widget/text"
|
|
|
|
|
require "ui/widget/group"
|
|
|
|
|
require "ui/widget/span"
|
|
|
|
|
require "ui/font"
|
|
|
|
|
require "dbg"
|
|
|
|
|
|
|
|
|
|
--[[
|
|
|
|
|
Widget that displays a shortcut icon for menu item
|
|
|
|
@ -91,6 +92,7 @@ Widget that displays an item for menu
|
|
|
|
|
--]]
|
|
|
|
|
MenuItem = InputContainer:new{
|
|
|
|
|
text = nil,
|
|
|
|
|
show_parent = nil,
|
|
|
|
|
detail = nil,
|
|
|
|
|
face = Font:getFace("cfont", 22),
|
|
|
|
|
dimen = nil,
|
|
|
|
@ -188,7 +190,14 @@ function MenuItem:onShowItemDetail()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function MenuItem:onTapSelect()
|
|
|
|
|
self.menu:onMenuSelect(self.table)
|
|
|
|
|
self[1].invert = true
|
|
|
|
|
LvDEBUG(1, "----------------", self.show_parent, 3)
|
|
|
|
|
UIManager:setDirty(self.show_parent, "partial")
|
|
|
|
|
UIManager:scheduleIn(0.1, function()
|
|
|
|
|
self[1].invert = false
|
|
|
|
|
UIManager:setDirty(self.show_parent, "partial")
|
|
|
|
|
self.menu:onMenuSelect(self.table)
|
|
|
|
|
end)
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -197,6 +206,7 @@ end
|
|
|
|
|
Widget that displays menu
|
|
|
|
|
--]]
|
|
|
|
|
Menu = FocusManager:new{
|
|
|
|
|
show_parent = nil,
|
|
|
|
|
-- face for displaying item contents
|
|
|
|
|
cface = Font:getFace("cfont", 22),
|
|
|
|
|
-- face for menu title
|
|
|
|
@ -256,6 +266,7 @@ function Menu:_recalculateDimen()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function Menu:init()
|
|
|
|
|
self.show_parent = self.show_parent or self
|
|
|
|
|
self.item_table_stack = {}
|
|
|
|
|
self:_recalculateDimen()
|
|
|
|
|
self.page = 1
|
|
|
|
@ -389,6 +400,7 @@ function Menu:updateItems(select_number)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local item_tmp = MenuItem:new{
|
|
|
|
|
show_parent = self.show_parent,
|
|
|
|
|
text = self.item_table[i].text,
|
|
|
|
|
face = self.cface,
|
|
|
|
|
dimen = self.item_dimen:new(),
|
|
|
|
|