|
|
@ -252,6 +252,9 @@ function Button:enable()
|
|
|
|
if not self.enabled then
|
|
|
|
if not self.enabled then
|
|
|
|
if self.text then
|
|
|
|
if self.text then
|
|
|
|
self.label_widget.fgcolor = Blitbuffer.COLOR_BLACK
|
|
|
|
self.label_widget.fgcolor = Blitbuffer.COLOR_BLACK
|
|
|
|
|
|
|
|
if self.label_widget.update then -- using a TextBoxWidget
|
|
|
|
|
|
|
|
self.label_widget:update() -- needed to redraw with the new color
|
|
|
|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
self.label_widget.dim = false
|
|
|
|
self.label_widget.dim = false
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -263,6 +266,9 @@ function Button:disable()
|
|
|
|
if self.enabled then
|
|
|
|
if self.enabled then
|
|
|
|
if self.text then
|
|
|
|
if self.text then
|
|
|
|
self.label_widget.fgcolor = Blitbuffer.COLOR_DARK_GRAY
|
|
|
|
self.label_widget.fgcolor = Blitbuffer.COLOR_DARK_GRAY
|
|
|
|
|
|
|
|
if self.label_widget.update then
|
|
|
|
|
|
|
|
self.label_widget:update()
|
|
|
|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
self.label_widget.dim = true
|
|
|
|
self.label_widget.dim = true
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -289,6 +295,14 @@ function Button:enableDisable(enable)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Button:paintTo(bb, x, y)
|
|
|
|
|
|
|
|
if self.enabled_func then
|
|
|
|
|
|
|
|
-- state may change because of outside factors, so check it on each painting
|
|
|
|
|
|
|
|
self:enableDisable(self.enabled_func())
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
InputContainer.paintTo(self, bb, x, y)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function Button:hide()
|
|
|
|
function Button:hide()
|
|
|
|
if self.icon and not self.hidden then
|
|
|
|
if self.icon and not self.hidden then
|
|
|
|
self.frame.orig_background = self.frame.background
|
|
|
|
self.frame.orig_background = self.frame.background
|
|
|
|