add calling item.callback() as default onMenuChoice action

pull/2/merge
Qingping Hou 11 years ago
parent 9468b504c1
commit 22c3043959

@ -480,9 +480,13 @@ function Menu:onMenuSelect(item)
end end
--[[ --[[
override this function to handle the choice default to call item callback
]]-- override this function to handle the choice
--]]
function Menu:onMenuChoice(item) function Menu:onMenuChoice(item)
if item.callback then
item.callback()
end
return true return true
end end

@ -99,11 +99,6 @@ function ReaderFont:onShowFontMenu()
item_table = self.face_table, item_table = self.face_table,
width = Screen:getWidth() - 100, width = Screen:getWidth() - 100,
} }
function main_menu:onMenuChoice(item)
if item.callback then
item.callback()
end
end
-- build container -- build container
local menu_container = CenterContainer:new{ local menu_container = CenterContainer:new{
main_menu, main_menu,

@ -73,11 +73,6 @@ function ReaderMenu:onShowMenu()
item_table = self.item_table, item_table = self.item_table,
width = Screen:getWidth() - 100, width = Screen:getWidth() - 100,
} }
function main_menu:onMenuChoice(item)
if item.callback then
item.callback()
end
end
local menu_container = CenterContainer:new{ local menu_container = CenterContainer:new{
ignore = "height", ignore = "height",

Loading…
Cancel
Save