Add support for titles in menus.

Added an addTitle() convenience method.
Unfortunately, styling the background of the title either
impossible or so deep down the rabbit hole... deeper than this???


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@806 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Ray Greenwell
2009-04-16 01:42:48 +00:00
parent 73954bafc5
commit 05cbe9db64
2 changed files with 36 additions and 0 deletions
@@ -24,6 +24,8 @@ package com.threerings.flex.menuClasses {
import flash.display.DisplayObject;
import mx.controls.Menu;
import mx.controls.menuClasses.IMenuDataDescriptor;
import mx.controls.menuClasses.MenuItemRenderer;
public class CommandMenuItemRenderer extends MenuItemRenderer
@@ -43,6 +45,17 @@ public class CommandMenuItemRenderer extends MenuItemRenderer
addChild(DisplayObject(icon));
}
}
if (label.visible) {
var dataDescriptor :IMenuDataDescriptor = Menu(listData.owner).dataDescriptor;
var typeVal :String = dataDescriptor.getType(data);
if (typeVal == "title") {
dataDescriptor.setEnabled(data, false);
label.enabled = false;
label.styleName = "menuTitle";
invalidateDisplayList();
}
}
}
}
}