diff options
Diffstat (limited to 'dalos-textbuffer.lua')
-rw-r--r-- | dalos-textbuffer.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/dalos-textbuffer.lua b/dalos-textbuffer.lua new file mode 100644 index 0000000..2bda77f --- /dev/null +++ b/dalos-textbuffer.lua @@ -0,0 +1,35 @@ +dalosp.textbuffer = { + get_settings = function (self) + return { text = self.extra.text } + end, + + activate = function (self) + local text = self.extra.text or "" + text = iup.GetText(self.name, text) + if text then + self.extra.text = text + local b = Buffer(true) + b:write(text) + self:set_houtput(b) + end + end, + + create = function (d, tab, settings) + tab.ninputs = 0 + tab.noutputs = 1 + tab.otype = dalos.objtype.HANDLE + tab.activate = dalosp.textbuffer.activate + tab.default_name = "Text Buffer" + tab.ntype = "Text Buffer" + tab.get_settings = dalosp.textbuffer.get_settings + local extra = { } + if settings then extra.text = settings.text end + + local obj = dalos.object(d, tab, extra) + + return obj + end, +} + +dalos.textbuffer = dalosp.textbuffer.create +dalos:register_obj("Text Buffer", dalos.textbuffer, "Basic Inputs") |