//////////////////////////////////////////////////////////////////////////////// // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // The ASF licenses this file to You under the Apache License, Version 2.0 // (the "License"); you may not use this file except in compliance with // the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// package mx.styles { import flash.events.IEventDispatcher; import flash.system.ApplicationDomain; import flash.system.SecurityDomain; /** * The IStyleManager class manages the following: *
If the selector parameter starts with a period (.),
* the returned CSSStyleDeclaration is a class selector and applies only to those instances
* whose styleName property specifies that selector
* (not including the period).
* For example, the class selector ".bigMargins"
* applies to any UIComponent whose styleName
* is "bigMargins".
If the selector parameter does not start with a period,
* the returned CSSStyleDeclaration is a type selector and applies to all instances
* of that type.
* For example, the type selector "Button"
* applies to all instances of Button and its subclasses.
The global selector is similar to a type selector
* and does not start with a period.
selector property.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function getStyleDeclaration(selector:String):CSSStyleDeclaration;
/**
* Sets the CSSStyleDeclaration object that stores the rules
* for the specified CSS selector.
*
* If the selector parameter starts with a period (.),
* the specified selector is a "class selector" and applies only to those instances
* whose styleName property specifies that selector
* (not including the period).
* For example, the class selector ".bigMargins"
* applies to any UIComponent whose styleName
* is "bigMargins".
If the selector parameter does not start with a period,
* the specified selector is a "type selector" and applies to all instances
* of that type.
* For example, the type selector "Button"
* applies to all instances of Button and its subclasses.
The global selector is similar to a type selector
* and does not start with a period.
true to force an immediate update of the styles; internally, Flex
* calls the styleChanged() method of UIComponent.
* Set to false to avoid an immediate update of the styles in the application.
*
* The styles will be updated the next time one of the following methods is called with
* the update property set to true:
*
clearStyleDeclaration()loadStyleDeclarations()setStyleDeclaration()unloadStyleDeclarations()Typically, if you call the one of these methods multiple times,
* you set this property to true only on the last call,
* so that Flex does not call the styleChanged() method multiple times.
If you call the getStyle() method, Flex returns the style value
* that was last applied to the UIComponent through a call to the styleChanged() method.
* The component's appearance might not reflect the value returned by the getStyle() method. This occurs
* because one of these style declaration methods might not yet have been called with the
* update property set to true.
If the specified selector is a class selector (for example, ".bigMargins" or ".myStyle"),
* you must be sure to start the
* selector property with a period (.).
If the specified selector is a type selector (for example, "Button"), do not start the
* selector property with a period.
The global selector is similar to a type selector
* and does not start with a period.
true to force an immediate update of the styles.
* Set to false to avoid an immediate update of the styles in the application.
* For more information about this method, see the description in the setStyleDeclaration()
* method.
*
* @see #setStyleDeclaration()
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function clearStyleDeclaration(selector:String, update:Boolean):void;
/**
* Adds to the list of styles that can inherit values
* from their parents.
*
* Note: Ensure that you avoid using duplicate style names, as name * collisions can result in decreased performance if a style that is * already used becomes inheriting.
* * @param styleName The name of the style that is added to the list of styles that can inherit values. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function registerInheritingStyle(styleName:String):void; /** * Tests to see if a style is inheriting. * * @param styleName The name of the style that you test to see if it is inheriting. * * @return Returnstrue if the specified style is inheriting.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function isInheritingStyle(styleName:String):Boolean;
/**
* Test to see if a TextFormat style is inheriting.
*
* @param styleName The name of the style that you test to see if it is inheriting.
*
* @return Returns true if the specified TextFormat style
* is inheriting.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function isInheritingTextFormatStyle(styleName:String):Boolean;
/**
* Adds to the list of styles which may affect the measured size
* of the component.
* When one of these styles is set with setStyle(),
* the invalidateSize() method is automatically called on the component
* to make its measured size get recalculated later.
*
* @param styleName The name of the style that you add to the list.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function registerSizeInvalidatingStyle(styleName:String):void;
/**
* Tests to see if a style changes the size of a component.
*
* When one of these styles is set with the setStyle() method,
* the invalidateSize() method is automatically called on the component
* to make its measured size get recalculated later.
true if the specified style is one
* which may affect the measured size of the component.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function isSizeInvalidatingStyle(styleName:String):Boolean;
/**
* Adds to the list of styles which may affect the measured size
* of the component's parent container.
* When one of these styles is set with setStyle(),
* the invalidateSize() method is automatically called on the component's
* parent container to make its measured size get recalculated
* later.
When one of these styles is set with setStyle(),
* the invalidateSize() method is automatically called on the component's
* parent container to make its measured size get recalculated
* later.
true if the specified style is one
* which may affect the measured size of the component's
* parent container.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function isParentSizeInvalidatingStyle(styleName:String):Boolean;
/**
* Adds to the list of styles which may affect the appearance
* or layout of the component's parent container.
* When one of these styles is set with setStyle(),
* the invalidateDisplayList() method is auomatically called on the component's
* parent container to make it redraw and/or relayout its children.
*
* @param styleName The name of the style to register.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function registerParentDisplayListInvalidatingStyle(styleName:String):void;
/**
* Tests to see if this style affects the component's parent container in
* such a way as to require that the parent container redraws itself when this style changes.
*
* When one of these styles is set with setStyle(),
* the invalidateDisplayList() method is auomatically called on the component's
* parent container to make it redraw and/or relayout its children.
true if the specified style is one
* which may affect the appearance or layout of the component's
* parent container.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function isParentDisplayListInvalidatingStyle(styleName:String):Boolean;
/**
* Adds a color name to the list of aliases for colors.
*
* @param colorName The name of the color to add to the list; for example, "blue".
* If you later access this color name, the value is not case-sensitive.
*
* @param colorValue Color value, for example, 0x0000FF.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function registerColorName(colorName:String, colorValue:uint):void;
/**
* Tests to see if the given String is an alias for a color value. For example,
* by default, the String "blue" is an alias for 0x0000FF.
*
* @param colorName The color name to test. This parameter is not case-sensitive.
*
* @return Returns true if colorName is an alias
* for a color.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function isColorName(colorName:String):Boolean;
/**
* Returns the numeric RGB color value that corresponds to the
* specified color string.
* The color string can be either a case-insensitive color name
* such as "red", "Blue", or
* "haloGreen", a hexadecimal value such as 0xFF0000, or a #-hexadecimal String
* such as "#FF0000".
*
* This method returns a uint, such as 4521830, that represents a color. You can convert
* this uint to a hexadecimal value by passing the numeric base (in this case, 16), to
* the uint class's toString() method, as the following example shows:
* import mx.styles.StyleManager;
* private function getNewColorName():void {
* StyleManager.registerColorName("soylentGreen",0x44FF66);
* trace(StyleManager.getColorName("soylentGreen").toString(16));
* }
*
*
* @param colorName The color name.
*
* @return Returns a uint that represents the color value or NOT_A_COLOR
* if the value of the colorName property is not an alias for a color.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function getColorName(colorName:Object):uint;
/**
* Converts each element of the colors Array from a color name
* to a numeric RGB color value.
* Each color String can be either a case-insensitive color name
* such as "red", "Blue", or
* "haloGreen", a hexadecimal value such as 0xFF0000, or a #-hexadecimal String
* such as "#FF0000"..
*
* @param colors An Array of color names.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function getColorNames(colors:Array /* of Number or String */):void;
/**
* Determines if a specified parameter is a valid style property. For example:
*
*
* trace(StyleManager.isValidStyleValue(myButton.getStyle("color")).toString());
*
*
* This can be useful because some styles can be set to values
* such as 0, NaN,
* the empty String (""), or null, which can
* cause an if (value) test to fail.
getStyle() method call
* to this method, it returns true if the style
* was set and false if it was not set.
*
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function isValidStyleValue(value:*):Boolean;
/**
* Loads a style SWF.
*
* @param url Location of the style SWF.
*
* @param update Set to true to force
* an immediate update of the styles.
* Set to false to avoid an immediate update
* of the styles in the application.
* This parameter is optional and defaults to true
* For more information about this parameter, see the description
* in the setStyleDeclaration() method.
*
* @param trustContent Obsolete, no longer used.
* This parameter is optional and defaults to false.
*
* @param applicationDomain The ApplicationDomain passed to the
* load() method of the IModuleInfo that loads the style SWF.
* This parameter is optional and defaults to null.
*
* @param securityDomain The SecurityDomain passed to the
* load() method of the IModuleInfo that loads the style SWF.
* This parameter is optional and defaults to null.
*
* @return An IEventDispatcher implementation that supports
* StyleEvent.PROGRESS, StyleEvent.COMPLETE, and
* StyleEvent.ERROR.
*
* @see #setStyleDeclaration()
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 4
*/
function loadStyleDeclarations(
url:String, update:Boolean = true,
trustContent:Boolean = false,
applicationDomain:ApplicationDomain = null,
securityDomain:SecurityDomain = null):IEventDispatcher;
/**
* Unloads a style SWF.
*
* @param url Location of the style SWF.
* @param update Set to true to force an immediate update of the styles.
* Set to false to avoid an immediate update of the styles in the application.
* For more information about this method, see the description in the setStyleDeclaration()
* method.
*
* @see #setStyleDeclaration()
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function unloadStyleDeclarations(
url:String, update:Boolean = true):void;
/**
* @private
* This method is called by code autogenerated by the MXML compiler,
* after StyleManager.styles is popuplated with CSSStyleDeclarations.
*/
function initProtoChainRoots():void;
/**
* @private
* After an entire selector is added, replaced, or removed,
* this method updates all the DisplayList trees.
*/
function styleDeclarationsChanged():void;
}
}