add all zoom modes support to reader menu

This commit is contained in:
Qingping Hou
2012-11-26 15:30:24 +08:00
parent cf3cc65c03
commit ba3973b2ac
3 changed files with 69 additions and 16 deletions

View File

@@ -4,6 +4,12 @@ ReaderMenu = InputContainer:new{
},
}
function ReaderMenu:genSetZoomModeCallBack(mode)
return function()
self.ui:handleEvent(Event:new("SetZoomMode", mode))
end
end
function ReaderMenu:onShowMenu()
local item_table = {}
@@ -14,14 +20,16 @@ function ReaderMenu:onShowMenu()
text = "rotate 90 degree clockwise",
callback = function()
Screen:screenRotate("clockwise")
self.ui:handleEvent(Event:new("SetDimensions", Screen:getSize()))
self.ui:handleEvent(
Event:new("SetDimensions", Screen:getSize()))
end
},
{
text = "rotate 90 degree anticlockwise",
callback = function()
Screen:screenRotate("anticlockwise")
self.ui:handleEvent(Event:new("SetDimensions", Screen:getSize()))
self.ui:handleEvent(
Event:new("SetDimensions", Screen:getSize()))
end
},
}
@@ -33,9 +41,27 @@ function ReaderMenu:onShowMenu()
sub_item_table = {
{
text = "Zoom to fit content width",
callback = self:genSetZoomModeCallBack("contentwidth")
},
{
text = "Zoom to fit content height",
callback = self:genSetZoomModeCallBack("contentheight")
},
{
text = "Zoom to fit page width",
callback = self:genSetZoomModeCallBack("pagewidth")
},
{
text = "Zoom to fit page height",
callback = self:genSetZoomModeCallBack("pageheight")
},
{
text = "Zoom to fit content",
callback = self:genSetZoomModeCallBack("content")
},
{
text = "Zoom to fit page",
callback = self:genSetZoomModeCallBack("page")
},
}
})