mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 12:42:11 +00:00
39 lines
1.2 KiB
Lua
39 lines
1.2 KiB
Lua
|
local ui = require('openmw.ui')
|
||
|
local async = require('openmw.async')
|
||
|
local I = require('openmw.interfaces')
|
||
|
|
||
|
return function(registerRenderer)
|
||
|
registerRenderer('textLine', function(value, set)
|
||
|
return {
|
||
|
template = I.MWUI.templates.textEditLine,
|
||
|
props = {
|
||
|
text = tostring(value),
|
||
|
},
|
||
|
events = {
|
||
|
textChanged = async:callback(function(s) set(s) end),
|
||
|
},
|
||
|
}
|
||
|
end)
|
||
|
|
||
|
registerRenderer('yesNo', function(value, set)
|
||
|
return {
|
||
|
template = I.MWUI.templates.box,
|
||
|
content = ui.content {
|
||
|
{
|
||
|
template = I.MWUI.templates.padding,
|
||
|
content = ui.content {
|
||
|
{
|
||
|
template = I.MWUI.templates.textNormal,
|
||
|
props = {
|
||
|
text = value and 'Yes' or 'No',
|
||
|
},
|
||
|
events = {
|
||
|
mouseClick = async:callback(function() set(not value) end),
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
end)
|
||
|
end
|