- Allow the override dispatcher to be specified in our factory convenience method.

- Style changes.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@503 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Ray Greenwell
2008-05-23 02:35:20 +00:00
parent bde434eb88
commit c243740190
+12 -8
View File
@@ -83,14 +83,18 @@ public class CommandMenu extends Menu
* Factory method to create a command menu. * Factory method to create a command menu.
* *
* @param items an array of menu items. * @param items an array of menu items.
* @param dispatcher an override event dispatcher to use for command events, rather than
* our parent.
*/ */
public static function createMenu (items :Array) :CommandMenu public static function createMenu (
items :Array, dispatcher :IEventDispatcher = null) :CommandMenu
{ {
var menu :CommandMenu = new CommandMenu(); var menu :CommandMenu = new CommandMenu();
menu.owner = DisplayObjectContainer(Application.application); menu.owner = DisplayObjectContainer(Application.application);
menu.tabEnabled = false; menu.tabEnabled = false;
menu.showRoot = true; menu.showRoot = true;
Menu.popUpMenu(menu, null, items); menu.setDispatcher(dispatcher);
Menu.popUpMenu(menu, null, items); // does not actually pop up, but needed.
return menu; return menu;
} }
@@ -105,8 +109,8 @@ public class CommandMenu extends Menu
} }
/** /**
* Configures the event dispatcher to be used when dispatching this menu's events. By default * Configures the event dispatcher to be used when dispatching this menu's command events.
* they will be dispatched on the stage. * Normally they will be dispatched on our parent (usually the SystemManager or something).
*/ */
public function setDispatcher (dispatcher :IEventDispatcher) :void public function setDispatcher (dispatcher :IEventDispatcher) :void
{ {
@@ -116,8 +120,8 @@ public class CommandMenu extends Menu
/** /**
* Actually pop up the menu. This can be used instead of show(). * Actually pop up the menu. This can be used instead of show().
*/ */
public function popUp (trigger :DisplayObject, popUpwards :Boolean = false, public function popUp (
popLeftwards :Boolean = false) :void trigger :DisplayObject, popUpwards :Boolean = false, popLeftwards :Boolean = false) :void
{ {
_upping = popUpwards; _upping = popUpwards;
_lefting = popLeftwards; _lefting = popLeftwards;
@@ -129,8 +133,8 @@ public class CommandMenu extends Menu
/** /**
* Shows the menu at the specified mouse coordinates. * Shows the menu at the specified mouse coordinates.
*/ */
public function popUpAt (mx :int, my :int, popUpwards :Boolean = false, public function popUpAt (
popLeftwards :Boolean = false) :void mx :int, my :int, popUpwards :Boolean = false, popLeftwards :Boolean = false) :void
{ {
_upping = popUpwards; _upping = popUpwards;
_lefting = popLeftwards; _lefting = popLeftwards;