add page counting in touchmenu & bug fix for sub_item_table

pull/2/merge
Qingping Hou 11 years ago
parent e44bedfea2
commit a4b17061a5

@ -159,7 +159,7 @@ TouchMenu widget
TouchMenu = InputContainer:new{
tab_item_table = {},
-- for returnning in multi-level menus
item_table_stack = {},
item_table_stack = nil,
item_table = nil,
--@TODO replace getDPI call (houqp)
item_height = scaleByDPI(50),
@ -215,15 +215,20 @@ function TouchMenu:init()
align = "left",
}
self.footer_page = TextWidget:new{
face = Font:getFace("ffont", 20),
text = "",
}
self.footer = HorizontalGroup:new{
IconButton:new{
invert = true,
icon_file = "resources/icons/appbar.chevron.left.png",
icon_file = "resources/icons/appbar.chevron.up.png",
show_parent = self.show_parent,
callback = function()
self:backToUpperMenu()
end,
}
},
self.footer_page,
}
self[1] = FrameContainer:new{
@ -305,6 +310,7 @@ function TouchMenu:updateItems()
table.insert(self.item_group, VerticalSpan:new{width = scaleByDPI(2)})
table.insert(self.item_group, self.footer)
self.footer_page.text = "Page "..self.page.."/"..self.page_num
-- FIXME: this is a dirty hack to clear previous menus
-- refert to issue #664
UIManager.repaint_all = true
@ -312,6 +318,10 @@ end
function TouchMenu:switchMenuTab(tab_num)
if self.cur_tab ~= tab_num then
-- it's like getting a new menu everytime we switch tab!
self.page = 1
-- clear item table stack
self.item_table_stack = {}
self.cur_tab = tab_num
self.item_table = self.tab_item_table[tab_num]
self:updateItems()

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" width="76" height="76" viewBox="0 0 76.00 76.00" enable-background="new 0 0 76.00 76.00" xml:space="preserve">
<path fill="#000000" fill-opacity="1" stroke-width="0.2" stroke-linejoin="round" d="M 37.8516,35.625L 34.6849,38.7917L 23.6016,50.2708L 23.6016,39.9792L 37.8516,24.9375L 52.1016,39.9792L 52.1016,50.2708L 41.0182,38.7917L 37.8516,35.625 Z "/>
</svg>
Loading…
Cancel
Save