mirror of
https://github.com/kepler155c/opus
synced 2024-11-15 13:14:49 +00:00
21 lines
427 B
Lua
21 lines
427 B
Lua
local class = require('class')
|
|
local UI = require('ui')
|
|
local Util = require('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
|