separated dialog.lua into source files for each individual function

This commit is contained in:
HW
2012-06-10 17:52:09 +02:00
parent 1e9fdd818f
commit 5025be971d
9 changed files with 271 additions and 260 deletions

45
frontend/ui/button.lua Normal file
View File

@@ -0,0 +1,45 @@
require "ui/widget"
--[[
a button widget
]]
Button = WidgetContainer:new{
text = nil, -- mandatory
preselect = false
}
function Button:init()
-- set FrameContainer content
self[1] = FrameContainer:new{
margin = 0,
bordersize = 3,
background = 0,
radius = 15,
padding = 2,
HorizontalGroup:new{
HorizontalSpan:new{ width = 8 },
TextWidget:new{
text = self.text,
face = Font:getFace("cfont", 20)
},
HorizontalSpan:new{ width = 8 },
}
}
if self.preselect then
self[1].color = 15
else
self[1].color = 5
end
end
function Button:onFocus()
self[1].color = 15
return true
end
function Button:onUnfocus()
self[1].color = 5
return true
end