diff options
| author | ruki <[email protected]> | 2017-12-28 22:34:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-12-28 09:27:28 +0800 |
| commit | c29bf9dde01066325f2a8734a6fda6cd1bc40549 (patch) | |
| tree | fe8acf0ba4192578e318f31dffa7e3a3d6831eaf | |
| parent | f37f8f9a1588348b042b1df69a805dc614f0fbbc (diff) | |
rename group to panel
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/ui/panel.lua (renamed from xmake/core/sandbox/modules/import/core/ui/group.lua) | 6 | ||||
| -rw-r--r-- | xmake/core/ui/desktop.lua | 8 | ||||
| -rw-r--r-- | xmake/core/ui/menubar.lua | 8 | ||||
| -rw-r--r-- | xmake/core/ui/panel.lua (renamed from xmake/core/ui/group.lua) | 74 | ||||
| -rw-r--r-- | xmake/core/ui/program.lua | 16 | ||||
| -rw-r--r-- | xmake/core/ui/statusbar.lua | 8 | ||||
| -rw-r--r-- | xmake/core/ui/view.lua | 2 |
7 files changed, 61 insertions, 61 deletions
diff --git a/xmake/core/sandbox/modules/import/core/ui/group.lua b/xmake/core/sandbox/modules/import/core/ui/panel.lua index 952a9c17b..bf20d610a 100644 --- a/xmake/core/sandbox/modules/import/core/ui/group.lua +++ b/xmake/core/sandbox/modules/import/core/ui/panel.lua @@ -19,8 +19,8 @@ -- Copyright (C) 2015 - 2017, TBOOX Open Source Group. -- -- @author ruki --- @file group.lua +-- @file panel.lua -- --- return module: group -return require("ui/group") +-- return module: panel +return require("ui/panel") diff --git a/xmake/core/ui/desktop.lua b/xmake/core/ui/desktop.lua index 3682a230f..0715252b7 100644 --- a/xmake/core/ui/desktop.lua +++ b/xmake/core/ui/desktop.lua @@ -26,17 +26,17 @@ local log = require("ui/log") local rect = require("ui/rect") local view = require("ui/view") -local group = require("ui/group") +local panel = require("ui/panel") local curses = require("ui/curses") -- define module -local desktop = desktop or group() +local desktop = desktop or panel() -- init desktop function desktop:init(name, bounds) - -- init group - group.init(self, name, bounds) + -- init panel + panel.init(self, name, bounds) -- init background self:background_set("blue") diff --git a/xmake/core/ui/menubar.lua b/xmake/core/ui/menubar.lua index 6fdcad24f..ad3f2b4ae 100644 --- a/xmake/core/ui/menubar.lua +++ b/xmake/core/ui/menubar.lua @@ -26,17 +26,17 @@ local log = require("ui/log") local rect = require("ui/rect") local label = require("ui/label") -local group = require("ui/group") +local panel = require("ui/panel") local curses = require("ui/curses") -- define module -local menubar = menubar or group() +local menubar = menubar or panel() -- init menubar function menubar:init(name, bounds) - -- init group - group.init(self, name, bounds) + -- init panel + panel.init(self, name, bounds) -- init title self._TITLE = label:new("menubar.title", rect{0, 0, self:width(), self:height()}) diff --git a/xmake/core/ui/group.lua b/xmake/core/ui/panel.lua index 5315b1b4e..a48612b28 100644 --- a/xmake/core/ui/group.lua +++ b/xmake/core/ui/panel.lua @@ -19,7 +19,7 @@ -- Copyright (C) 2015 - 2017, TBOOX Open Source Group. -- -- @author ruki --- @file group.lua +-- @file panel.lua -- -- load modules @@ -32,16 +32,16 @@ local curses = require("ui/curses") local dlist = require("base/dlist") -- define module -local group = group or view() +local panel = panel or view() --- init group -function group:init(name, bounds) +-- init panel +function panel:init(name, bounds) -- init view view.init(self, name, bounds) - -- mark as group - self:type_set("group") + -- mark as panel + self:type_set("panel") -- mark as selectable self:option_set("selectable", true) @@ -50,55 +50,55 @@ function group:init(name, bounds) self._VIEWS = dlist() end --- exit group -function group:exit() +-- exit panel +function panel:exit() -- exit view view.exit(self) end -- get all child views -function group:views() +function panel:views() return self._VIEWS:items() end -- get views count -function group:count() +function panel:count() return self._VIEWS:size() end -- is empty? -function group:empty() +function panel:empty() return self._VIEWS:empty() end -- get the first view -function group:first() +function panel:first() return self._VIEWS:first() end -- get the next view -function group:next(v) +function panel:next(v) return self._VIEWS:next(v) end -- get the previous view -function group:prev(v) +function panel:prev(v) return self._VIEWS:prev(v) end -- get the current selected child view -function group:current() +function panel:current() return self._CURRENT end -- insert view -function group:insert(v, opt) +function panel:insert(v, opt) -- check assert(not v:parent() or v:parent() == self) - -- this view has been inserted into this group? remove it first + -- this view has been inserted into this panel? remove it first if v:parent() == self then self:remove(v) end @@ -131,7 +131,7 @@ function group:insert(v, opt) end -- remove view -function group:remove(v) +function panel:remove(v) -- check assert(v:parent() == self) @@ -156,7 +156,7 @@ function group:remove(v) end -- select the child view -function group:select(v) +function panel:select(v) -- check assert(v == nil or (v:parent() == self and v:option("selectable"))) @@ -198,7 +198,7 @@ function group:select(v) end -- select the next view -function group:select_next(start) +function panel:select_next(start) -- is empty? if self:empty() then @@ -220,7 +220,7 @@ function group:select_next(start) end -- select the previous view -function group:select_prev(start) +function panel:select_prev(start) -- is empty? if self:empty() then @@ -242,7 +242,7 @@ function group:select_prev(start) end -- on event -function group:event_on(e) +function panel:event_on(e) -- is empty views? if self:empty() then @@ -257,13 +257,13 @@ function group:event_on(e) end end --- draw group -function group:draw() +-- draw panel +function panel:draw() - -- redraw group? + -- redraw panel? local redraw = self:state("redraw") - -- draw group background first + -- draw panel background first if redraw then view.draw(self) end @@ -273,14 +273,14 @@ function group:draw() if redraw then v:state_set("redraw", true) end - if v:state("visible") and (v:state("redraw") or v:type() == "group") then + if v:state("visible") and (v:state("redraw") or v:type() == "panel") then v:draw() end end end --- refresh group -function group:refresh() +-- refresh panel +function panel:refresh() -- need not refresh? do not refresh it if not self:state("refresh") then @@ -303,12 +303,12 @@ function group:refresh() end -- dump all views -function group:dump() +function panel:dump() log:print("%s", self:_tostring(1)) end --- tostring(group, level) -function group:_tostring(level) +-- tostring(panel, level) +function panel:_tostring(level) local str = "" if self.views then str = str .. string.format("<%s %s>", self:name(), tostring(self:bounds())) @@ -319,7 +319,7 @@ function group:_tostring(level) for l = 1, level do str = str .. " " end - str = str .. group._tostring(v, level + 1) .. "\n" + str = str .. panel._tostring(v, level + 1) .. "\n" end else str = tostring(self) @@ -327,11 +327,11 @@ function group:_tostring(level) return str end --- tostring(group) -function group:__tostring() - return string.format("<group(%s) %s>", self:name(), tostring(self:bounds())) +-- tostring(panel) +function panel:__tostring() + return string.format("<panel(%s) %s>", self:name(), tostring(self:bounds())) end -- return module -return group +return panel diff --git a/xmake/core/ui/program.lua b/xmake/core/ui/program.lua index 014168ef3..0d1bed84f 100644 --- a/xmake/core/ui/program.lua +++ b/xmake/core/ui/program.lua @@ -31,12 +31,12 @@ $Id: program.lua 18 2007-06-21 20:43:52Z tngd $ local log = require("ui/log") local rect = require("ui/rect") local point = require("ui/point") -local group = require("ui/group") +local panel = require("ui/panel") local event = require("ui/event") local curses = require("ui/curses") -- define module -local program = program or group() +local program = program or panel() -- init program function program:init(name) @@ -78,15 +78,15 @@ function program:init(name) -- get 8-bits character for getch() main_window:meta(true) - -- init group - group.init(self, name, rect {0, 0, curses.columns(), curses.lines()}) + -- init panel + panel.init(self, name, rect {0, 0, curses.columns(), curses.lines()}) end -- exit program function program:exit() - -- exit group - group.exit(self) + -- exit panel + panel.exit(self) -- (attempt to) make sure the screen will be cleared -- if not restored by the curses driver @@ -212,7 +212,7 @@ function program:refresh() end -- refresh views - group.refresh(self) + panel.refresh(self) -- trace log:print("%s: refresh ..", self) @@ -369,7 +369,7 @@ function program:_refresh_cursor() -- get the top focused view local focused_view = self - while focused_view:type() == "group" and focused_view:current() do + while focused_view:type() == "panel" and focused_view:current() do focused_view = focused_view:current() end diff --git a/xmake/core/ui/statusbar.lua b/xmake/core/ui/statusbar.lua index c0e0814dc..ba4206958 100644 --- a/xmake/core/ui/statusbar.lua +++ b/xmake/core/ui/statusbar.lua @@ -25,19 +25,19 @@ -- load modules local log = require("ui/log") local rect = require("ui/rect") -local group = require("ui/group") +local panel = require("ui/panel") local label = require("ui/label") local event = require("ui/event") local curses = require("ui/curses") -- define module -local statusbar = statusbar or group() +local statusbar = statusbar or panel() -- init statusbar function statusbar:init(name, bounds) - -- init group - group.init(self, name, bounds) + -- init panel + panel.init(self, name, bounds) -- init info self._INFO = label:new("statusbar.info", rect{0, 0, self:width(), self:height()}) diff --git a/xmake/core/ui/view.lua b/xmake/core/ui/view.lua index 5b8449641..3312a3f50 100644 --- a/xmake/core/ui/view.lua +++ b/xmake/core/ui/view.lua @@ -60,7 +60,7 @@ function view:init(name, bounds) state.visible = true -- view visibility state.cursor_visible = false -- cursor visibility state.block_cursor = false -- block cursor - state.selected = false -- current selected window inside group + state.selected = false -- current selected window inside panel state.focused = false -- true if parent is also focused state.redraw = true -- need redraw state.refresh = true -- need refresh |
