2020-04-06 06:12:46 +00:00
|
|
|
local class = require('opus.class')
|
|
|
|
local UI = require('opus.ui')
|
|
|
|
|
|
|
|
UI.Question = class(UI.MiniSlideOut)
|
|
|
|
UI.Question.defaults = {
|
|
|
|
UIElement = 'Question',
|
|
|
|
accelerators = {
|
|
|
|
y = 'question_yes',
|
|
|
|
n = 'question_no',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function UI.Question:postInit()
|
|
|
|
local x = self.label and #self.label + 3 or 1
|
|
|
|
|
|
|
|
self.yes_button = UI.Button {
|
|
|
|
x = x,
|
|
|
|
text = 'Yes',
|
2020-04-22 04:32:12 +00:00
|
|
|
backgroundColor = 'primary',
|
2020-04-06 06:12:46 +00:00
|
|
|
event = 'question_yes',
|
|
|
|
}
|
|
|
|
self.no_button = UI.Button {
|
|
|
|
x = x + 5,
|
|
|
|
text = 'No',
|
2020-04-22 04:32:12 +00:00
|
|
|
backgroundColor = 'primary',
|
2020-04-06 06:12:46 +00:00
|
|
|
event = 'question_no',
|
|
|
|
}
|
|
|
|
end
|