//////////////////////////////////////////////////////////////////////////////// // // 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.core { import flash.display.DisplayObject; import flash.geom.Point; /** * The IChildList interface defines the properties and methods * for accessing and manipulating child lists, which are subsets * of a DisplayObjectContainer's children. * *
As an example, consider the Container class.
* It overrides DisplayObjectContainer APIs such as the
* numChildren
and getChildAt()
methods
* to access only "content" children, which are the controls
* and other containers that you put inside it.
* But a Container can also have additional children
* created automatically by the framework, such as a background or border
* skin and scrollbars.
* So Container exposes a property called rawChildren
* of type IChildList, which lets you access all its children,
* not just the content children.
As another example, the SystemManager class is a DisplayObjectContainer
* whose children are partitioned into various layers:
* normal children like the Application are on the bottom,
* popups above them, tooltips above them, and cursors on the top.
* The SystemManager class has properties named popUpChildren
,
* toolTipChildren
, and cursorChildren
* which let you access these layers, and the type of each of these
* properties is IChildList.
* Therefore, you can count the number of popups using the
* systemManager.popUpChildren.numChildren
property,
* insert another DisplayObject into the tooltip layer using the
* systemManager.toolTipChildren.addChild()
method, and so on.
Calling childList.addChild(child)
is the same as calling
* childList.addChild(child, childList.numChildren)
* After it has been added, its index of the new child
* will be (child.numChildren - 1)
numChildren
represents the end.
*
* Adding a child anywhere except at the end of a child list * will increment the indexes of children that were previously * at that index or at higher indices.
* * @param child The DisplayObject to add as a child. * * @param index The index to add the child at. * * @return The child that was added; this is the same * as thechild
argument passed in.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function addChildAt(child:DisplayObject, index:int):DisplayObject;
/**
* Removes the specified child DisplayObject from this child list.
*
* Removing a child anywhere except from the end of a child list * will decrement the indexes of children that were at higher indices.
* *The removed child will have its parent set to null and will be * garbage collected if no other references to it exist.
* * @param child The DisplayObject to remove. * * @return The child that was removed; this is the same * as the argument passed in. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function removeChild(child:DisplayObject):DisplayObject; /** * Removes the child DisplayObject at the specified index * from this child list. * *Removing a child anywhere except from the end of a child list * will decrement the indexes of children that were at higher indices.
* *The removed child will have its parent set to null and will be * garbage collected if no other references to it exist.
* * @param index The child index of the DisplayObject to remove. * * @return The child that was removed. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ function removeChildAt(index:int):DisplayObject; /** * Gets the child DisplayObject at the specified index in this child list. * * @param index An integer from 0 to(numChildren - 1)
* that specifies the index of a child in this child list.
*
* @return The child at the specified index.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function getChildAt(index:int):DisplayObject;
/**
* Gets the child DisplayObject with the specified name
* in this child list.
*
* @param name The name of the child to return.
*
* @return The child with the specified name.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function getChildByName(name:String):DisplayObject;
/**
* Gets the index of a specific child in this child list.
*
* The first child in the child list has an index of 0,
* the second child has an index of 1, and the last child
* has an index of (numChildren - 1)
.
If getChildIndex(myChild)
returns 5,
* then myView.getChildAt(5)
returns
* myChild
.
If you add a child by calling the addChild()
method,
* the new child's index is equal to the largest index among the
* existing children plus one.
You can insert a child at a specified index by using the
* addChildAt()
method
* In that case the children previously at that index and higher
* indices have their index increased by 1 so that all
* children are indexed from 0 to (numChildren - 1)
.
If you remove a child by calling the removeChild()
* or removeChildAt()
method, then the children
* at higher indices have their index decreased by 1 so that
* all children are indexed from 0 to (numChildren - 1)
.
If you change a child's index by calling the
* setChildIndex()
method, then the children between
* the old index and the new index, inclusive, have their indexes
* adjusted so that all children are indexed from
* 0 to (numChildren - 1)
.
(numChildren - 1)
.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function getChildIndex(child:DisplayObject):int;
/**
* Changes the index of a particular child in this child list.
* See the getChildIndex()
method for a
* description of the child's index.
*
* @param child The child whose index to set.
*
* @param newIndex The new index for the specified child.
* This must be an integer between zero and (numChildren - 1)
.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function setChildIndex(child:DisplayObject, newIndex:int):void;
/**
* Returns an array of DisplayObjects that lie under the specified point
* and are in this child list.
*
* @param point The point under which to look.
*
* @return An array of object that lie under the specified point
* that are children of this Container.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function getObjectsUnderPoint(point:Point):Array;
/**
* Determines if a DisplayObject is in this child list,
* or is a descendant of an child in this child list.
*
* @param child The DisplayObject to test.
*
* @return true
if the DisplayObject is in this child list
* or is a descendant of an child in this child list;
* false
otherwise.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function contains(child:DisplayObject):Boolean;
}
}