summaryrefslogtreecommitdiff
path: root/xmake/core/ui/menuconf.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-25 22:32:19 +0800
committerruki <[email protected]>2018-01-25 09:13:54 +0800
commit231320f8fc52bd03ab88f048a6e0efa027346c83 (patch)
treed57ae0bddd4d446dae0e4f085f3966bdc5a35027 /xmake/core/ui/menuconf.lua
parent630c94df8a7b3b51a35c166c6a310a97c754989b (diff)
fix tab event for dialog
Diffstat (limited to 'xmake/core/ui/menuconf.lua')
-rw-r--r--xmake/core/ui/menuconf.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/xmake/core/ui/menuconf.lua b/xmake/core/ui/menuconf.lua
index 3e7e53af3..db34e4b99 100644
--- a/xmake/core/ui/menuconf.lua
+++ b/xmake/core/ui/menuconf.lua
@@ -39,6 +39,22 @@ function menuconf:init(name, bounds)
-- init panel
panel.init(self, name, bounds)
+
+ -- init configs
+ self._CONFIGS = {}
+end
+
+-- on event
+function menuconf:event_on(e)
+
+ -- select config
+ if e.type == event.ev_keyboard then
+ if e.key_name == "Down" then
+ return self:select_next()
+ elseif e.key_name == "Up" then
+ return self:select_prev()
+ end
+ end
end
-- insert a config item
@@ -76,10 +92,31 @@ function menuconf:insert(config)
-- insert this config item
panel.insert(self, item)
+ -- select the first item
+ self:select(self:first())
+
-- invalidate
self:invalidate()
end
+-- load configs
+function menuconf:load(configs)
+
+ -- clear the views first
+ self:clear()
+
+ -- save configs
+ self._CONFIGS = configs
+
+ -- invalidate
+ self:invalidate()
+end
+
+-- get configs
+function menuconf:configs()
+ return self._CONFIGS
+end
+
-- get text from the given config
function menuconf:_text(config)