simplify ui
This commit is contained in:
@@ -36,6 +36,31 @@ elseif device.monitor then
|
||||
})
|
||||
end
|
||||
|
||||
--[[-- ScrollingText --]]--
|
||||
UI.ScrollingText = class(UI.Window)
|
||||
UI.ScrollingText.defaults = {
|
||||
UIElement = 'ScrollingText',
|
||||
backgroundColor = colors.black,
|
||||
buffer = { },
|
||||
}
|
||||
function UI.ScrollingText:appendLine(text)
|
||||
if #self.buffer+1 >= self.height then
|
||||
table.remove(self.buffer, 1)
|
||||
end
|
||||
table.insert(self.buffer, text)
|
||||
end
|
||||
|
||||
function UI.ScrollingText:clear()
|
||||
self.buffer = { }
|
||||
UI.Window.clear(self)
|
||||
end
|
||||
|
||||
function UI.ScrollingText:draw()
|
||||
for k,text in ipairs(self.buffer) do
|
||||
self:write(1, k, Util.widthify(text, self.width), self.backgroundColor)
|
||||
end
|
||||
end
|
||||
|
||||
terminal:clear()
|
||||
|
||||
function getClient(id)
|
||||
|
||||
Reference in New Issue
Block a user