@ -101,7 +101,6 @@ function TitleBar:init()
-- No button on non-touch device
-- No button on non-touch device
local left_icon_reserved_width = 0
local left_icon_reserved_width = 0
local right_icon_reserved_width = 0
local right_icon_reserved_width = 0
if Device : isTouchDevice ( ) then
if self.left_icon then
if self.left_icon then
self.has_left_icon = true
self.has_left_icon = true
left_icon_reserved_width = left_icon_size + self.button_padding
left_icon_reserved_width = left_icon_size + self.button_padding
@ -110,7 +109,6 @@ function TitleBar:init()
self.has_right_icon = true
self.has_right_icon = true
right_icon_reserved_width = right_icon_size + self.button_padding
right_icon_reserved_width = right_icon_size + self.button_padding
end
end
end
if self.align == " center " then
if self.align == " center " then
-- Keep title and subtitle text centered even if single button
-- Keep title and subtitle text centered even if single button
@ -457,4 +455,31 @@ function TitleBar:setRightIcon(icon)
UIManager : setDirty ( self.show_parent , " ui " , self.dimen )
UIManager : setDirty ( self.show_parent , " ui " , self.dimen )
end
end
end
end
-- layout for FocusManager
function TitleBar : generateHorizontalLayout ( )
local row = { }
if self.left_button then
table.insert ( row , self.left_button )
end
if self.right_button then
table.insert ( row , self.right_button )
end
local layout = { }
if # row > 0 then
table.insert ( layout , row )
end
return layout
end
function TitleBar : generateVerticalLayout ( )
local layout = { }
if self.left_button then
table.insert ( layout , { self.left_button } )
end
if self.right_button then
table.insert ( layout , { self.right_button } )
end
return layout
end
return TitleBar
return TitleBar