All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scaffold.libs_as.feathers.controls.ButtonGroup.as Maven / Gradle / Ivy

/*
Feathers
Copyright 2012-2015 Bowler Hat LLC. All Rights Reserved.

This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/
package feathers.controls
{
	import feathers.core.FeathersControl;
	import feathers.core.PropertyProxy;
	import feathers.data.ListCollection;
	import feathers.events.CollectionEventType;
	import feathers.events.FeathersEventType;
	import feathers.layout.Direction;
	import feathers.layout.FlowLayout;
	import feathers.layout.HorizontalAlign;
	import feathers.layout.HorizontalLayout;
	import feathers.layout.ILayout;
	import feathers.layout.IVirtualLayout;
	import feathers.layout.LayoutBoundsResult;
	import feathers.layout.VerticalAlign;
	import feathers.layout.VerticalLayout;
	import feathers.layout.ViewPortBounds;
	import feathers.skins.IStyleProvider;

	import starling.display.DisplayObject;
	import starling.events.Event;

	/**
	 * Dispatched when one of the buttons is triggered. The data
	 * property of the event contains the item from the data provider that is
	 * associated with the button that was triggered.
	 *
	 * 

The following example listens to Event.TRIGGERED on the * button group instead of on individual buttons:

* * * group.dataProvider = new ListCollection( * [ * { label: "Yes" }, * { label: "No" }, * { label: "Cancel" }, * ]); * group.addEventListener( Event.TRIGGERED, function( event:Event, data:Object ):void * { * trace( "The button with label \"" + data.label + "\" was triggered." ); * } * *

The properties of the event object have the following values:

* * * * * * *
PropertyValue
bubblesfalse
currentTargetThe Object that defines the * event listener that handles the event. For example, if you use * myButton.addEventListener() to register an event listener, * myButton is the value of the currentTarget.
dataThe item associated with the button * that was triggered.
targetThe Object that dispatched the event; * it is not always the Object listening for the event. Use the * currentTarget property to always access the Object * listening for the event.
* * @eventType starling.events.Event.TRIGGERED */ [Event(name="triggered", type="starling.events.Event")] /** * A set of related buttons with layout, customized using a data provider. * *

The following example creates a button group with a few buttons:

* * * var group:ButtonGroup = new ButtonGroup(); * group.dataProvider = new ListCollection( * [ * { label: "Yes", triggered: yesButton_triggeredHandler }, * { label: "No", triggered: noButton_triggeredHandler }, * { label: "Cancel", triggered: cancelButton_triggeredHandler }, * ]); * this.addChild( group ); * * @see ../../../help/button-group.html How to use the Feathers ButtonGroup component * @see feathers.controls.TabBar */ public class ButtonGroup extends FeathersControl { /** * The default IStyleProvider for all ButtonGroup * components. * * @default null * @see feathers.core.FeathersControl#styleProvider */ public static var globalStyleProvider:IStyleProvider; /** * @private */ protected static const INVALIDATION_FLAG_BUTTON_FACTORY:String = "buttonFactory"; /** * @private */ protected static const LABEL_FIELD:String = "label"; /** * @private */ protected static const ENABLED_FIELD:String = "isEnabled"; /** * @private */ private static const DEFAULT_BUTTON_FIELDS:Vector. = new [ "defaultIcon", "upIcon", "downIcon", "hoverIcon", "disabledIcon", "defaultSelectedIcon", "selectedUpIcon", "selectedDownIcon", "selectedHoverIcon", "selectedDisabledIcon", "isSelected", "isToggle", "isLongPressEnabled", "name", ]; /** * @private */ private static const DEFAULT_BUTTON_EVENTS:Vector. = new [ Event.TRIGGERED, Event.CHANGE, FeathersEventType.LONG_PRESS, ]; /** * @private * DEPRECATED: Replaced by feathers.layout.Direction.HORIZONTAL. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const DIRECTION_HORIZONTAL:String = "horizontal"; /** * @private * DEPRECATED: Replaced by feathers.layout.Direction.VERTICAL. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const DIRECTION_VERTICAL:String = "vertical"; /** * @private * DEPRECATED: Replaced by feathers.layout.HorizontalAlign.LEFT. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const HORIZONTAL_ALIGN_LEFT:String = "left"; /** * @private * DEPRECATED: Replaced by feathers.layout.HorizontalAlign.CENTER. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const HORIZONTAL_ALIGN_CENTER:String = "center"; /** * @private * DEPRECATED: Replaced by feathers.layout.HorizontalAlign.RIGHT. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const HORIZONTAL_ALIGN_RIGHT:String = "right"; /** * @private * DEPRECATED: Replaced by feathers.layout.HorizontalAlign.JUSTIFY. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const HORIZONTAL_ALIGN_JUSTIFY:String = "justify"; /** * @private * DEPRECATED: Replaced by feathers.layout.VerticalAlign.TOP. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const VERTICAL_ALIGN_TOP:String = "top"; /** * @private * DEPRECATED: Replaced by feathers.layout.VerticalAlign.MIDDLE. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const VERTICAL_ALIGN_MIDDLE:String = "middle"; /** * @private * DEPRECATED: Replaced by feathers.layout.VerticalAlign.BOTTOM. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const VERTICAL_ALIGN_BOTTOM:String = "bottom"; /** * @private * DEPRECATED: Replaced by feathers.layout.VerticalAlign.JUSTIFY. * *

DEPRECATION WARNING: This constant is deprecated * starting with Feathers 3.0. It will be removed in a future version of * Feathers according to the standard * Feathers deprecation policy.

*/ public static const VERTICAL_ALIGN_JUSTIFY:String = "justify"; /** * The default value added to the styleNameList of the buttons. * * @see feathers.core.FeathersControl#styleNameList */ public static const DEFAULT_CHILD_STYLE_NAME_BUTTON:String = "feathers-button-group-button"; /** * @private */ protected static function defaultButtonFactory():Button { return new Button(); } /** * Constructor. */ public function ButtonGroup() { super(); } /** * The value added to the styleNameList of the buttons. * This variable is protected so that sub-classes can * customize the button style name in their constructors instead of * using the default style name defined by * DEFAULT_CHILD_STYLE_NAME_BUTTON. * *

To customize the button style name without subclassing, see * customButtonStyleName.

* * @see #customButtonStyleName * @see feathers.core.FeathersControl#styleNameList */ protected var buttonStyleName:String = DEFAULT_CHILD_STYLE_NAME_BUTTON; /** * The value added to the styleNameList of the first button. * *

To customize the first button name without subclassing, see * customFirstButtonStyleName.

* * @see #customFirstButtonStyleName * @see feathers.core.FeathersControl#styleNameList */ protected var firstButtonStyleName:String = DEFAULT_CHILD_STYLE_NAME_BUTTON; /** * The value added to the styleNameList of the last button. * *

To customize the last button style name without subclassing, see * customLastButtonStyleName.

* * @see #customLastButtonStyleName * @see feathers.core.FeathersControl#styleNameList */ protected var lastButtonStyleName:String = DEFAULT_CHILD_STYLE_NAME_BUTTON; /** * @private */ protected var activeFirstButton:Button; /** * @private */ protected var inactiveFirstButton:Button; /** * @private */ protected var activeLastButton:Button; /** * @private */ protected var inactiveLastButton:Button; /** * @private */ protected var _layoutItems:Vector. = new []; /** * @private */ protected var activeButtons:Vector.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy