Fix setting contrast on non-touch devices (#4219)

This commit is contained in:
Robert
2018-09-13 13:49:23 +02:00
committed by poire-z
parent a706fde2d7
commit eed3a4b5a2
2 changed files with 31 additions and 3 deletions

View File

@@ -28,8 +28,6 @@ function ButtonProgressWidget:init()
bordersize = 0,
padding = Size.padding.small,
dim = not self.enabled,
width = self.width,
height = self.height,
}
self.buttonprogress_content = HorizontalGroup:new{}
@@ -68,6 +66,7 @@ function ButtonProgressWidget:update()
self.position = i
self:update()
end,
no_focus = true,
hold_callback = function()
self.hold_callback(i)
end,
@@ -85,4 +84,31 @@ function ButtonProgressWidget:setPosition(position)
self:update()
end
function ButtonProgressWidget:onFocus()
self.buttonprogress_frame.background = Blitbuffer.COLOR_BLACK
return true
end
function ButtonProgressWidget:onUnfocus()
self.buttonprogress_frame.background = Blitbuffer.COLOR_WHITE
return true
end
function ButtonProgressWidget:onTapSelect(arg, gev)
if gev == nil then
self:circlePosition()
end
end
function ButtonProgressWidget:circlePosition()
if self.position then
self.position = self.position+1
if self.position > self.num_buttons then
self.position = 1
end
self.callback(self.position)
self:update()
end
end
return ButtonProgressWidget