From 1b14473f25af22c3024f6bf86c4acb89ebcbd1d6 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 3 Mar 2009 00:13:13 +0000 Subject: [PATCH] Added addSeparator(). git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@777 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/as/com/threerings/flex/CommandMenu.as | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/as/com/threerings/flex/CommandMenu.as b/src/as/com/threerings/flex/CommandMenu.as index bbfe4cc9..2268717e 100644 --- a/src/as/com/threerings/flex/CommandMenu.as +++ b/src/as/com/threerings/flex/CommandMenu.as @@ -105,6 +105,18 @@ public class CommandMenu extends Menu return menu; } + /** + * Add a separator to the specified menu, unless it would not make sense to do so, because + * the menu is empty or already ends with a separator. + */ + public static function addSeparator (menuItems :Array) :void + { + const len :int = menuItems.length; + if (len > 0 && menuItems[len - 1].type != "separator") { + menuItems.push({ type: "separator" }); + } + } + /** * The mx.controls.Menu class overrides setting and getting the verticalScrollPolicy * basically setting the verticalScrollPolicy did nothing, and getting it always returned