summaryrefslogtreecommitdiff
path: root/xmake/core/ui/view.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-12-16 00:57:23 +0800
committerruki <[email protected]>2017-12-15 23:44:19 +0800
commite5ed897840214b66fd746292fff15c56606d3251 (patch)
tree6a5820bfcb1acf95536b673cd79587aff198dab5 /xmake/core/ui/view.lua
parentd81f894af27987981ef3fe39e013ad3f1fadfbcf (diff)
add event to ui
Diffstat (limited to 'xmake/core/ui/view.lua')
-rw-r--r--xmake/core/ui/view.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/xmake/core/ui/view.lua b/xmake/core/ui/view.lua
index 73539a854..58be1774f 100644
--- a/xmake/core/ui/view.lua
+++ b/xmake/core/ui/view.lua
@@ -80,6 +80,10 @@ function view:init(name, bounds)
options.validate = false -- validate
self._OPTIONS = options
+ -- init attributes
+ local attrs = object()
+ self._ATTRS = attrs
+
-- init name
self._NAME = name
@@ -222,6 +226,20 @@ function view:show(visible)
end
end
+-- do event (abstract)
+function view:do_event(e)
+end
+
+-- get the current event
+function view:event()
+ return self:parent() and self:parent():event()
+end
+
+-- put an event to view
+function view:event_put(e)
+ return self:parent() and self:parent():event_put(e)
+end
+
-- get state
function view:state(name)
return self._STATE[name]
@@ -263,6 +281,16 @@ function view:option_set(name, enable)
self._OPTIONS[name] = enable
end
+-- get attribute
+function view:attr(name)
+ return self._ATTRS[name]
+end
+
+-- set attribute
+function view:attr_set(name, attr)
+ self._ATTRS[name] = attr
+end
+
-- update screen
function view:_update_screen()