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

scaffold.libs_as.feathers.skins.FunctionStyleProvider.as Maven / Gradle / Ivy

/*
Feathers
Copyright 2012-2016 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.skins
{
	import feathers.core.IFeathersControl;

	/**
	 * Sets styles on a Feathers UI component by passing the component to a
	 * function when the style provider's applyStyles() is called.
	 *
	 * 

In the following example, a FunctionStyleProvider is * created:

* * var button:Button = new Button(); * button.label = "Click Me"; * button.styleProvider = new FunctionStyleProvider( function( target:Button ):void * { * target.defaultSkin = new Image( texture ); * // set other styles... * }); * this.addChild( button ); * * @see ../../../help/skinning.html Skinning Feathers components */ public class FunctionStyleProvider implements IStyleProvider { /** * Constructor. */ public function FunctionStyleProvider(skinFunction:Function) { this._styleFunction = skinFunction; } /** * @private */ protected var _styleFunction:Function; /** * The target Feathers UI component is passed to this function when * applyStyles() is called. * *

The function is expected to have the following signature:

*
function( item:IFeathersControl ):void
*/ public function get styleFunction():Function { return this._styleFunction; } /** * @private */ public function set styleFunction(value:Function):void { this._styleFunction = value; } /** * @inheritDoc */ public function applyStyles(target:IFeathersControl):void { if(this._styleFunction == null) { return; } this._styleFunction(target); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy