modules/menusystem: separate activity and visibility locks

This commit is contained in:
Kazhnuz 2019-04-07 12:38:33 +02:00
parent 81f6b940a4
commit 10fb299158
2 changed files with 18 additions and 7 deletions

View file

@ -51,10 +51,10 @@ function MenuSystem:switchMenu(menu)
if k == menu then
v:getFocus()
v:setVisibility(true)
v.isActive = true
v:setActivity(true)
else
v:setVisibility(false)
v.isActive = false
v:setActivity(false)
end
end
end

View file

@ -16,10 +16,11 @@ function Menu:new(menusystem, name, x, y, w, h)
self.widget.cancel = 0
self:updateWidgetSize()
self.isDestroyed = false
self.isVisible = true
self.isActive = true
self.isLocked = false
self.isDestroyed = false
self.isVisible = true
self.isActive = true
self.isLocked = false
self.isAlwaysVisible = false
self.depth = 0
@ -35,13 +36,23 @@ function Menu:setDepth(depth)
end
function Menu:setVisibility(visibility)
if self.isLocked == false then
if self.isLocked == false and self.isAlwaysVisible == false then
-- if the menu is locked (thus is always active), it should also
-- be always visible.
self.isVisible = visibility
else
self.isVisible = true
end
end
function Menu:setActivity(activity)
if self.isLocked == false then
self.isActive = activity
else
self.isActive = true
end
end
function Menu:getFocus()
self.menusystem.focusedMenu = self.name
end