1
0
mirror of https://github.com/kepler155c/opus synced 2024-06-18 11:20:01 +00:00
opus/sys/modules/opus/ui/components/Text.lua
2020-04-09 16:08:54 -06:00

21 lines
436 B
Lua

local class = require('opus.class')
local UI = require('opus.ui')
local Util = require('opus.util')
UI.Text = class(UI.Window)
UI.Text.defaults = {
UIElement = 'Text',
value = '',
height = 1,
}
function UI.Text:layout()
if not self.width and not self.ex then
self.width = #tostring(self.value)
end
UI.Window.layout(self)
end
function UI.Text:draw()
self:write(1, 1, Util.widthify(self.value, self.width, self.align))
end