Merge pull request #22 from chrox/master

add time information in menu footer by neoquest in hi-pda forum
pull/23/merge
{Qingping,Dave} Hou 11 years ago
commit ba780e734a

@ -164,6 +164,7 @@ TouchMenu = InputContainer:new{
item_height = scaleByDPI(50), item_height = scaleByDPI(50),
bordersize = scaleByDPI(2), bordersize = scaleByDPI(2),
padding = scaleByDPI(5), padding = scaleByDPI(5),
footer_height = scaleByDPI(50),
width = nil, width = nil,
height = nil, height = nil,
page = 1, page = 1,
@ -218,16 +219,31 @@ function TouchMenu:init()
face = Font:getFace("ffont", 20), face = Font:getFace("ffont", 20),
text = "", text = "",
} }
self.time_info = TextWidget:new{
face = Font:getFace("ffont", 20),
text = "",
}
local footer_width = self.width - self.padding*2 - self.bordersize*2 - 20
self.footer = HorizontalGroup:new{ self.footer = HorizontalGroup:new{
IconButton:new{ LeftContainer:new{
invert = true, dimen = Geom:new{ w = footer_width*0.33, h = self.footer_height},
icon_file = "resources/icons/appbar.chevron.up.png", IconButton:new{
show_parent = self.show_parent, invert = true,
callback = function() icon_file = "resources/icons/appbar.chevron.up.png",
self:backToUpperMenu() show_parent = self.show_parent,
end, callback = function()
self:backToUpperMenu()
end,
},
}, },
self.footer_page, CenterContainer:new{
dimen = Geom:new{ w = self.width*0.33, h = self.footer_height},
self.footer_page,
},
RightContainer:new{
dimen = Geom:new{ w = self.width*0.33, h = self.footer_height},
self.time_info,
}
} }
self[1] = FrameContainer:new{ self[1] = FrameContainer:new{
@ -310,6 +326,7 @@ function TouchMenu:updateItems()
table.insert(self.item_group, VerticalSpan:new{width = scaleByDPI(2)}) table.insert(self.item_group, VerticalSpan:new{width = scaleByDPI(2)})
table.insert(self.item_group, self.footer) table.insert(self.item_group, self.footer)
self.footer_page.text = "Page "..self.page.."/"..self.page_num self.footer_page.text = "Page "..self.page.."/"..self.page_num
self.time_info.text = os.date(" %H:%M ")
-- FIXME: this is a dirty hack to clear previous menus -- FIXME: this is a dirty hack to clear previous menus
-- refert to issue #664 -- refert to issue #664
UIManager.repaint_all = true UIManager.repaint_all = true

Loading…
Cancel
Save