diff options
Diffstat (limited to 'lua/backstack.lua')
| -rw-r--r-- | lua/backstack.lua | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lua/backstack.lua b/lua/backstack.lua deleted file mode 100644 index c54fbac4..00000000 --- a/lua/backstack.lua +++ /dev/null @@ -1,37 +0,0 @@ -local lvgl = require("lvgl") - -local backstack = { - root = lvgl.Object(nil, { - w = lvgl.HOR_RES(), - h = lvgl.VER_RES(), - }), - stack = {}, -} - -function backstack:Top() - return self.stack[#self.stack] -end - -function backstack:SetTopParent(parent) - local top = self:Top() - if top and top.root then - top.root:set_parent(parent) - end -end - -function backstack:Push(screen) - self:SetTopParent(nil) - table.insert(self.stack, screen) - self:SetTopParent(self.root) -end - -function backstack:Pop(num) - num = num or 1 - for _ = 1, num do - local removed = table.remove(self.stack) - removed.root:delete() - end - self:SetTopParent(self.root) -end - -return backstack |
