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

pull/4232/head
Robert 6 years ago committed by poire-z
parent a706fde2d7
commit eed3a4b5a2

@ -83,7 +83,7 @@ function Button:init()
}
}
if self.preselect then
self:onFocus()
self.frame.invert = true
end
self.dimen = self.frame:getSize()
self[1] = self.frame
@ -120,11 +120,13 @@ function Button:setIcon(icon)
end
function Button:onFocus()
if self.no_focus then return end
self.frame.invert = true
return true
end
function Button:onUnfocus()
if self.no_focus then return end
self.frame.invert = false
return true
end

@ -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

Loading…
Cancel
Save