- Moved common code to internal static methods in CommandButton.

- Fixed CommandButton to turn off buttonMode when disabled.
- Created CommandCheckBox.
All CommandButtons that are toggle buttons will use their 'selected' state as
their arg if they have no regular arg. CommandCheckBoxes are of course always
toggles.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@409 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Ray Greenwell
2008-02-06 01:41:10 +00:00
parent a6e1fbe468
commit 7d400e45f2
3 changed files with 111 additions and 25 deletions
@@ -44,10 +44,7 @@ public class CommandLinkButton extends LinkButton
*/
public function CommandLinkButton (label :String = null, cmdOrFn :* = null, arg :Object = null)
{
if (cmdOrFn != null && !(cmdOrFn is String) && !(cmdOrFn is Function)) {
// runtime errors suck, but this is actionscript
throw new Error("cmdOrFn must be a String or Function.");
}
CommandButton.validateCmd(cmdOrFn);
this.label = label;
_cmdOrFn = cmdOrFn;
_arg = arg;
@@ -74,14 +71,7 @@ public class CommandLinkButton extends LinkButton
override protected function clickHandler (event :MouseEvent) :void
{
super.clickHandler(event);
if (enabled) {
// stop the click event
event.stopImmediatePropagation();
// dispatch the command event
CommandEvent.dispatch(this, _cmdOrFn, _arg);
}
CommandButton.processCommandClick(this, event, _cmdOrFn, _arg);
}
/** The command (String) to submit, or the function (Function) to call