diff options
author | unknown <Pixel@.(none)> | 2010-01-05 22:22:01 -0800 |
---|---|---|
committer | unknown <Pixel@.(none)> | 2010-01-05 22:22:01 -0800 |
commit | 628ed8138210d0f67cc35835f6fba96fcc7d932f (patch) | |
tree | 0357420e905b42533170ad2d71961373d82c7803 /dalos-textview.lua | |
parent | 36624b05efae3fa82280a945fa2eb1dedc84e0b0 (diff) | |
parent | 69836d15333d9d48aecf3e0aef139c7eacf59214 (diff) |
Merge branch 'master' of ssh+git://git.grumpycoder.net/pub/repo.git/Dalos
Diffstat (limited to 'dalos-textview.lua')
-rw-r--r-- | dalos-textview.lua | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/dalos-textview.lua b/dalos-textview.lua new file mode 100644 index 0000000..2bd0be5 --- /dev/null +++ b/dalos-textview.lua @@ -0,0 +1,53 @@ +dalosp.textview = { + get_settings = function (self) + return { } + end, + + input_change = function (self) + local h = self:get_linked_input(1) + + if h then + self.extra.txt.value = h:readfile() + else + self.extra.txt.value = "" + end + end, + + activate = function (self) + self.extra.dlg:show() + end, + + create = function (d, tab, settings) + tab.ninputs = 1 + tab.noutputs = 0 + tab.otype = dalos.objtype.LUA_VIEWER + tab.activate = dalosp.textview.activate + tab.input_change = dalosp.textview.input_change + tab.default_name = "Text View" + tab.ntype = "Text View" + tab.get_settings = dalosp.textview.get_settings + local extra = { } + + local obj = dalos.object(d, tab, extra) + + local txt = iup.text { + multiline = "Yes", + readonly = "Yes", + expand = "Yes", + font = "Courier, 8" + } + local dlg = iup.dialog { + txt, + size = "320x200", + title = obj.name, + shrink = "Yes", + } + extra.dlg = dlg + extra.txt = txt + + return obj + end, +} + +dalos.textview = dalosp.textview.create +dalos:register_obj("Text View", dalos.textview, "Basic Viewers") |