diff options
| author | ruki <[email protected]> | 2017-12-14 21:00:56 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-12-14 00:05:36 +0800 |
| commit | 54a0bf3c8688589708af4cc22bd7bbe8a83365d1 (patch) | |
| tree | bb020ca9a376b07682282edec1051d205cb99462 /xmake/core/ui/group.lua | |
| parent | 42cc615918ee1e4cc3ce435172e9f91dc1df1086 (diff) | |
impl view and group tostring
Diffstat (limited to 'xmake/core/ui/group.lua')
| -rw-r--r-- | xmake/core/ui/group.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/xmake/core/ui/group.lua b/xmake/core/ui/group.lua index a1f6d3bc7..9588eb3a4 100644 --- a/xmake/core/ui/group.lua +++ b/xmake/core/ui/group.lua @@ -71,6 +71,31 @@ end function group:execute() end +-- tostring(group, level) +function group:_tostring(level) + local str = "" + if self.views then + str = str .. string.format("<%s %s>", self:name(), tostring(self:bounds())) + if not self:views():empty() then + str = str .. "\n" + end + for v in self:views():items() do + for l = 1, level do + str = str .. " " + end + str = str .. group._tostring(v, level + 1) .. "\n" + end + else + str = tostring(self) + end + return str +end + +-- tostring(group) +function group:__tostring() + return self:_tostring(1) +end + -- return module return group |
