When a menu open attempt occurs:
-
Check if menu is opened already:
-
If not opened:
-
Hide the last menu in the stack
-
Add the new menu to the stack and show it
-
Create a new mll, connect it's back button to the menu
return function, and add it to the titlebar
-
If opened AND the menu is not the last menu in the stack:
-
Hide the last menu in the stack
-
Find the opening menu's index in the menu stack
-
Remove all menu's in the stack past the opening menu's
index
-
Show the opening menu
-
Have the titlebar remove all mll's past the opening
menu's index - 1
When a Menu Label Layer is added to the Titlebar:
-
Check if there are any mll's in the mll stack:
-
If there is NO mlls in the stack:
-
Set the added mll as the base mll
-
If there is mlls in the stack:
-
Set the added mll as the child of the last mll in the
stack
-
Add the mll to the stack
When mlls are to be removed from the titlebar:
-
Call remove child mll from the removing mll index, and this
should recursively remove the mlls down the line
-
Remove all mlls past the removing mll index from the stack