diff options
| -rw-r--r-- | xmake/core/ui/group.lua | 5 | ||||
| -rw-r--r-- | xmake/core/ui/view.lua | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/xmake/core/ui/group.lua b/xmake/core/ui/group.lua index 571064260..61ce7f8d7 100644 --- a/xmake/core/ui/group.lua +++ b/xmake/core/ui/group.lua @@ -40,6 +40,9 @@ function group:init(name, bounds) -- init view view.init(self, name, bounds) + -- mark as group + self:type_set("group") + -- mark as selectable self:option_set("selectable", true) @@ -259,7 +262,7 @@ function group:draw() if redraw then v:state_set("redraw", true) end - if v:state("visible") and v:state("redraw") then + if v:state("visible") and (v:state("redraw") or v:type() == "group") then v:draw() end end diff --git a/xmake/core/ui/view.lua b/xmake/core/ui/view.lua index 6af29906e..593fdccb4 100644 --- a/xmake/core/ui/view.lua +++ b/xmake/core/ui/view.lua @@ -51,6 +51,9 @@ function view:init(name, bounds) -- check assert(name and type(bounds) == 'table') + -- init type + self._TYPE = "view" + -- init state local state = object() state.visible = true -- view visibility @@ -247,6 +250,16 @@ function view:event_register(etype) self._EVENTS[etype] = true end +-- get type +function view:type() + return self._TYPE +end + +-- set type +function view:type_set(t) + self._TYPE = t or "view" +end + -- get state function view:state(name) return self._STATE[name] |
