Add an 'hide()' method for menus
This commit is contained in:
parent
52fdd8a1f2
commit
f4e5f84c58
|
@ -261,6 +261,7 @@ here is the list:
|
|||
| clear | Remove all items | --- | --- |
|
||||
| scroll_down | If the menu is cropped, scroll down | --- | --- |
|
||||
| scroll_up | If the menu is cropped, scroll up | --- | --- |
|
||||
| hide | Hide a menu and all sub menus | --- | --- |
|
||||
| swap | Swap 2 items | both items | --- |
|
||||
| move | Move an item | the item, the new idx | --- |
|
||||
| remove | Remove the item | the item | --- |
|
||||
|
|
11
base.lua
11
base.lua
|
@ -544,6 +544,17 @@ local function new(args)
|
|||
end
|
||||
end
|
||||
|
||||
function data:hide()
|
||||
data.visible = false
|
||||
if data.parent_geometry and data.parent_geometry.is_menu then
|
||||
local parent = data.parent_geometry
|
||||
while parent do
|
||||
parent.visible = false
|
||||
parent = parent.parent_geometry and parent.parent_geometry.is_menu and parent.parent_geometry
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if private_data.layout then
|
||||
private_data.layout:setup_key_hooks(data)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue