2019-06-28 17:50:02 +00:00
|
|
|
local class = require('opus.class')
|
|
|
|
local UI = require('opus.ui')
|
|
|
|
local Util = require('opus.util')
|
2019-02-06 04:03:57 +00:00
|
|
|
|
|
|
|
UI.Text = class(UI.Window)
|
|
|
|
UI.Text.defaults = {
|
|
|
|
UIElement = 'Text',
|
|
|
|
value = '',
|
|
|
|
height = 1,
|
|
|
|
}
|
2020-04-22 04:40:59 +00:00
|
|
|
function UI.Text:layout()
|
2019-02-06 04:03:57 +00:00
|
|
|
if not self.width and not self.ex then
|
|
|
|
self.width = #tostring(self.value)
|
|
|
|
end
|
2020-04-22 04:40:59 +00:00
|
|
|
UI.Window.layout(self)
|
2019-02-06 04:03:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function UI.Text:draw()
|
2019-03-06 16:48:09 +00:00
|
|
|
self:write(1, 1, Util.widthify(self.value, self.width, self.align))
|
2019-02-06 04:03:57 +00:00
|
|
|
end
|