Add an 'hide()' method for menus

This commit is contained in:
Emmanuel Lepage Vallee 2014-08-02 18:04:47 -04:00
parent 52fdd8a1f2
commit f4e5f84c58
2 changed files with 12 additions and 0 deletions

View File

@ -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 | --- |

View File

@ -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