summaryrefslogtreecommitdiff
path: root/xmake/core/ui/menubar.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/menubar.lua
parentd81f894af27987981ef3fe39e013ad3f1fadfbcf (diff)
add event to ui
Diffstat (limited to 'xmake/core/ui/menubar.lua')
-rw-r--r--xmake/core/ui/menubar.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/xmake/core/ui/menubar.lua b/xmake/core/ui/menubar.lua
index 1bc7e9eb6..1148909aa 100644
--- a/xmake/core/ui/menubar.lua
+++ b/xmake/core/ui/menubar.lua
@@ -28,14 +28,21 @@ $Id: menubar.lua 18 2007-06-21 20:43:52Z tngd $
--------------------------------------------------------------------------]]
-- load modules
-local view = require("ui/view")
+local log = require("ui/log")
+local view = require("ui/view")
+local curses = require("ui/curses")
-- define module
local menubar = menubar or view()
-- init menubar
function menubar:init(name, bounds)
+
+ -- init view
view.init(self, name, bounds)
+
+ -- init color
+ self:attr_set("color", curses.color_pair("red", "white"))
end
-- exit menubar
@@ -43,5 +50,17 @@ function menubar:exit()
view.exit(self)
end
+-- draw view
+function menubar:draw()
+ local c = self:canvas()
+ c:attr(self:attr("color")):move(0, 0):write(string.rep(' ', self:width() * self:height()))
+ c:move(1, 0):write('Menu Bar')
+end
+
+-- do event
+function menubar:do_event(e)
+ view.do_event(self, e)
+end
+
-- return module
return menubar