diff options
| author | ruki <[email protected]> | 2017-12-16 00:57:23 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-12-15 23:44:19 +0800 |
| commit | e5ed897840214b66fd746292fff15c56606d3251 (patch) | |
| tree | 6a5820bfcb1acf95536b673cd79587aff198dab5 /xmake/core/ui/group.lua | |
| parent | d81f894af27987981ef3fe39e013ad3f1fadfbcf (diff) | |
add event to ui
Diffstat (limited to 'xmake/core/ui/group.lua')
| -rw-r--r-- | xmake/core/ui/group.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/xmake/core/ui/group.lua b/xmake/core/ui/group.lua index 80f0d991c..45baa8e14 100644 --- a/xmake/core/ui/group.lua +++ b/xmake/core/ui/group.lua @@ -30,6 +30,7 @@ $Id: group.lua 18 2007-06-21 20:43:52Z tngd $ -- load modules local view = require("ui/view") local rect = require("ui/rect") +local event = require("ui/event") local point = require("ui/point") local curses = require("ui/curses") local dlist = require("base/dlist") @@ -240,8 +241,43 @@ function group:select_next(forward, start) end end +-- do event +function group:do_event(e) + -- TODO +end + -- execute group function group:execute() + + -- show this group + self:show(true) + + -- do message loop + local e = nil + local sleep = true + local app = self:application() + while true do + + -- get the current event + e = self:event() + + -- do event + if e then + self:do_event(e) + sleep = false + else + -- do idle event + app:do_event(event.idle()) + end + + -- wait some time, 50ms + if sleep then + curses.napms(50) + end + end + + -- hide this group + self:show(false) end -- draw group |
