helper for 'hide all children, then show THIS menu'

This commit is contained in:
Chris Forbes
2010-03-23 08:09:21 +13:00
parent f3394d3c7c
commit c3fcfa776f
2 changed files with 21 additions and 18 deletions

View File

@@ -143,7 +143,19 @@ namespace OpenRA.Widgets
return null;
}
public Widget GetCurrentMenu() { return Children.FirstOrDefault(c => c.Visible); }
public Widget ShowMenu(string menu)
{
GetCurrentMenu().Visible = false;
var widget = GetWidget(menu);
if (widget != null)
widget.Visible = true;
return widget;
}
}
class ContainerWidget : Widget { }