diff options
| author | ruki <[email protected]> | 2017-12-27 21:03:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-12-27 00:20:57 +0800 |
| commit | 663308b956fb9cedbd002e980d716818f0b5e7b2 (patch) | |
| tree | bc0e3aee5a547db50ff61d3a7cb793d2f7f36714 /xmake/core/ui/statusbar.lua | |
| parent | 603f29d146a735671c90d7430e7e5a200b749f74 (diff) | |
improve menubar and statusbar
Diffstat (limited to 'xmake/core/ui/statusbar.lua')
| -rw-r--r-- | xmake/core/ui/statusbar.lua | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/xmake/core/ui/statusbar.lua b/xmake/core/ui/statusbar.lua index 18688e86f..c0e0814dc 100644 --- a/xmake/core/ui/statusbar.lua +++ b/xmake/core/ui/statusbar.lua @@ -24,44 +24,29 @@ -- load modules local log = require("ui/log") -local view = require("ui/view") +local rect = require("ui/rect") +local group = require("ui/group") +local label = require("ui/label") local event = require("ui/event") local curses = require("ui/curses") -- define module -local statusbar = statusbar or view() +local statusbar = statusbar or group() -- init statusbar -function statusbar:init(name, bounds, commands) +function statusbar:init(name, bounds) - -- init view - view.init(self, name, bounds) + -- init group + group.init(self, name, bounds) -- init info - self:info_set("") + self._INFO = label:new("statusbar.info", rect{0, 0, self:width(), self:height()}) + self:insert(self:info()) + self:info():text_set("Status Bar") + self:info():textattr_set("blue") -- init background - self:background_set(curses.color_pair("blue", "white")) -end - --- exit statusbar -function statusbar:exit() - view.exit(self) -end - --- draw view -function statusbar:draw() - - -- draw background - view.draw(self) - - -- draw status info - self:canvas():move(1, 0):write(self:info()) -end - --- on event -function statusbar:event_on(e) - view.event_on(self, e) + self:background_set("white") end -- get status info @@ -69,11 +54,5 @@ function statusbar:info() return self._INFO end --- set status info -function statusbar:info_set(info) - self._INFO = info or "" - self:invalidate() -end - -- return module return statusbar |
