1
0
mirror of https://github.com/kepler155c/opus synced 2024-06-14 17:29:59 +00:00
opus/sys/modules/opus/ui/components/Text.lua
2019-06-28 13:50:02 -04:00

21 lines
442 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:setParent()
if not self.width and not self.ex then
self.width = #tostring(self.value)
end
UI.Window.setParent(self)
end
function UI.Text:draw()
self:write(1, 1, Util.widthify(self.value, self.width, self.align))
end