summaryrefslogtreecommitdiff
path: root/xmake/core/ui/menubar.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-12-19 22:38:24 +0800
committerruki <[email protected]>2017-12-19 09:50:27 +0800
commit5924ef4adbe4b084c465bc9604254be60d147074 (patch)
tree93c00311a46d3ac7034b775ba4fa6b69212bff9f /xmake/core/ui/menubar.lua
parentb061bd17789d582771c77778e17a4f5576e1a01f (diff)
remove some redraw ops
Diffstat (limited to 'xmake/core/ui/menubar.lua')
-rw-r--r--xmake/core/ui/menubar.lua16
1 files changed, 13 insertions, 3 deletions
diff --git a/xmake/core/ui/menubar.lua b/xmake/core/ui/menubar.lua
index 1148909aa..1c770d64c 100644
--- a/xmake/core/ui/menubar.lua
+++ b/xmake/core/ui/menubar.lua
@@ -41,8 +41,8 @@ function menubar:init(name, bounds)
-- init view
view.init(self, name, bounds)
- -- init color
- self:attr_set("color", curses.color_pair("red", "white"))
+ -- init title
+ self._TITLE = ""
end
-- exit menubar
@@ -54,7 +54,7 @@ end
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')
+ c:move(1, 0):write(self:title())
end
-- do event
@@ -62,5 +62,15 @@ function menubar:do_event(e)
view.do_event(self, e)
end
+-- get title
+function menubar:title()
+ return self._TITLE
+end
+
+-- set title
+function menubar:title_set(title)
+ self._TITLE = title or ""
+end
+
-- return module
return menubar