olympus-r-17plugins
Version:
A plugin of Olympus for 17zuoye.
1,632 lines • 487 kB
TypeScript
declare namespace eui.sys {
/**
* @private
* 失效验证管理器
*/
class Validator extends egret.EventDispatcher {
/**
* @private
* 创建一个Validator对象
*/
constructor();
/**
* @private
*/
private targetLevel;
/**
* @private
*/
private invalidatePropertiesFlag;
/**
* @private
*/
private invalidateClientPropertiesFlag;
/**
* @private
*/
private invalidatePropertiesQueue;
/**
* @private
* 标记组件属性失效
*/
invalidateProperties(client: UIComponent): void;
/**
* @private
* 验证失效的属性
*/
private validateProperties();
/**
* @private
*/
private invalidateSizeFlag;
/**
* @private
*/
private invalidateClientSizeFlag;
/**
* @private
*/
private invalidateSizeQueue;
/**
* @private
* 标记需要重新测量尺寸
*/
invalidateSize(client: UIComponent): void;
/**
* @private
* 测量尺寸
*/
private validateSize();
/**
* @private
*/
private invalidateDisplayListFlag;
/**
* @private
*/
private invalidateDisplayListQueue;
/**
* @private
* 标记需要重新布局
*/
invalidateDisplayList(client: UIComponent): void;
/**
* @private
* 重新布局
*/
private validateDisplayList();
/**
* @private
*/
private eventDisplay;
/**
* @private
* 是否已经添加了事件监听
*/
private listenersAttached;
/**
* @private
* 添加事件监听
*/
private attachListeners();
/**
* @private
* 执行属性应用
*/
private doPhasedInstantiationCallBack(event?);
/**
* @private
*
*/
private doPhasedInstantiation();
/**
* @private
* 使大于等于指定组件层级的元素立即应用属性
* @param target 要立即应用属性的组件
*/
validateClient(target: UIComponent): void;
}
}
declare namespace eui {
/**
* Register a property for a class definition in running,
* so that the EUI can get type of property accurate when parsing a EXML.
* This need not be called directly in most of time. Only when you have a custom UI
* component need to be described in EXML, you may invoke this method explicitly.
*
* Contains no following:
* When the property is the basic data type(boolean, number, string or Array), you only need set a correct initial value
* for he custom property then the EXML parser can get the correct property type in running.
*
* If you can not set the correct initial value (such as <code>null</code>), the EXML parser will treat this property as
* <code>string</code>. If there is no inital value, EUI will throw an error. But you can invoked this method to register
* a property in this case.
*
*
* @param classDefinition The class definition need to be registered.
* @param property The property need to be registered. Note that the property
* name cannot start with "_" or "$".
* @param type The type need to be registered,
* such as “boolean","number","string","Array","egret.Rectangle" and so on.
* @param asDefault Whether register this property as a default property of component.
* One component can register only on default property. And the default property can be spare in an EXML.
*
* @example:
* <pre>
* <s:Scroller>
* <s:viewport>
* <s:Group/>
* </e:viewport>
* </e:Scroller>
* </pre>
* Cuz <code>viewport</code> is the default property of Scroller. So you can write as follow:
* <pre>
* <s:Scroller>
* <s:Group/>
* </e:Scroller>
* </pre>
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 为一个类定义注册运行时属性类型,以便运行时的EXML文件解析过程能获取准确的属性类型。大多数情况下,您都不需要手动调用此方法显式注册属性类型。
* 仅当您有一个自定义的 UI 组件,需要在EXML中用标签描述时可能需要显式注册,但以下情况除外:
* 当属性类型为基本数据类型:boolean,number,string,Array这四种其中之一时,您只需要为自定义的属性赋值上正确的初始值,
* 运行时EXML解析器就能通过初始值自动分析出正确的属性类型。
* 若您无法为属性赋值上正确的初始值时(有初始值,比如null),运行时EXML解析器会把此属性当做string来处理,若完全没有初始值,将会报错找不到节点属性,
* 这种情况下可以手动调用此方法显式注册属性类型。
*
* @param classDefinition 要注册的类定义。
* @param property 要注册的属性,注意属性名不能以 _ 或 $ 符开头。
* @param type 要注册的类型,例如:“boolean","number","string","Array","egret.Rectangle"
* @param asDefault 是否将此属性注册为组件的默认属性,一个组件只可以设置一个默认属性。注册了组件默认属性后,在EXML中可以使用省略属性节点的写法,
* @example:
* <pre>
* <s:Scroller>
* <s:viewport>
* <s:Group/>
* </e:viewport>
* </e:Scroller>
* </pre>
* 因为 viewport 已经注册为 Scroller 的默认属性,上面的例子可以等效为:
* <pre>
* <s:Scroller>
* <s:Group/>
* </e:Scroller>
* </pre>
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
function registerProperty(classDefinition: any, property: string, type: string, asDefault?: boolean): void;
}
declare namespace eui {
/**
* The State class defines a view state, a particular view of a component.
*
* For example, a product thumbnail could have two view states;
* a base view state with minimal information, and a rich view state with
* additional information.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* State 类定义视图状态,即组件的特定视图。
*
* 例如,产品缩略图可以有两个视图状态,包含最少信息的基本视图状态和包含附加信息的丰富视图状态。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
class State extends egret.HashObject {
/**
* Constructor.
*
* @param name The name of the view state.
* State names must be unique for a given component.
* This property must be set.
* @param overrides The overrides for this view state, as an Array of objects that implement
* the IOverride interface. These overrides are applied in order when the
* state is entered, and removed in reverse order when the state is exited.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 创建一个State实例。
*
* @param name 视图状态的名称。给定组件的状态名称必须唯一。必须设置此属性。
* @param overrides 该视图状态的覆盖,表现为实现 IOverride 接口的对象的数组。
* 这些覆盖在进入状态时按顺序应用,在退出状态时按相反的顺序删除。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
constructor(name: string, overrides?: IOverride[]);
/**
* The name of the view state.
* State names must be unique for a given component.
* This property must be set.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 视图状态的名称。给定组件的状态名称必须唯一。必须设置此属性。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
name: string;
/**
* The overrides for this view state, as an Array of objects that implement
* the IOverride interface. These overrides are applied in order when the
* state is entered, and removed in reverse order when the state is exited.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 该视图状态的覆盖,表现为实现 IOverride 接口的对象的数组。
* 这些覆盖在进入状态时按顺序应用,在退出状态时按相反的顺序删除。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
overrides: IOverride[];
/**
* The state groups that this view state belongs to as an array of String.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 此视图状态作为 string 数组所属的状态组。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
stateGroups: string[];
/**
* Initialize this state and all of its overrides.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 初始化视图状态
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
initialize(host: any, stage: egret.Stage): void;
}
}
declare namespace eui.sys {
/**
* @private
*/
class StateClient {
/**
* @private
*/
$stateValues: StateValues;
/**
* @private
* 为此组件定义的视图状态。
*/
states: eui.State[];
/**
* @private
* 组件的当前视图状态。将其设置为 "" 或 null 可将组件重置回其基本状态。
*/
currentState: string;
/**
* @private
* 应用当前的视图状态。子类覆盖此方法在视图状态发生改变时执行相应更新操作。
*/
private commitCurrentState();
/**
* @private
* 返回是否含有指定名称的视图状态
* @param stateName 要检查的视图状态名称
*/
hasState(stateName: string): boolean;
/**
* @private
* 初始化所有视图状态
*/
private initializeStates(stage);
}
/**
* @private
*/
class StateValues {
/**
* @private
*/
intialized: boolean;
/**
* @private
*/
statesMap: any;
/**
* @private
*/
states: eui.State[];
/**
* @private
*/
oldState: string;
/**
* @private
*/
explicitState: string;
/**
* @private
*/
currentState: string;
/**
* @private
*/
parent: egret.DisplayObjectContainer;
/**
* @private
*/
stateIsDirty: boolean;
}
}
declare namespace eui {
function getAssets(source: string, callback: (content: any) => void): void;
function getTheme(source: string, callback: (content: any) => void): void;
/**
* The UIComponent class is the base class for all visual components, both skinnable and nonskinnable.
*
* @event egret.Event.RESIZE Dispatch when the component is resized.
* @event eui.UIEvent.MOVE Dispatch when the object has moved.
* @event eui.UIEvent.CREATION_COMPLETE Dispatch when the component has finished its construction,
* property processing, measuring, layout, and drawing.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* UIComponent 类是所有可视组件(可定制皮肤和不可定制皮肤)的基类。
*
* @event egret.Event.RESIZE 当UI组件的尺寸发生改变时调度
* @event eui.UIEvent.MOVE 当UI组件在父级容器中的位置发生改变时调度
* @event eui.UIEvent.CREATION_COMPLETE 当UI组件第一次被添加到舞台并完成初始化后调度
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
interface UIComponent extends egret.DisplayObject {
/**
* @private
*/
$UIComponent: Object;
/**
* @private
*/
$includeInLayout: boolean;
/**
* Specifies whether this component is included in the layout of the
* parent container.
* If <code>false</code>, the object size and position are not affected by its parent container's
* layout.
* This value is different with <code>visible</code>. the object size and position is still affected by its parent
* container's layout when the <code>visible</code> is false.
* @default true
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 指定此组件是否包含在父容器的布局中。若为false,则父级容器在测量和布局阶段都忽略此组件。
* 注意,visible属性与此属性不同,设置visible为false,父级容器仍会对其布局。
*
* @default true
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
includeInLayout: boolean;
/**
* The horizontal distance in pixels from the left edge of the component to the
* anchor target's left edge.
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 距父级容器离左边距离。
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
left: any;
/**
* The horizontal distance in pixels from the right edge of the component to the
* anchor target's right edge.
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 距父级容器右边距离。
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
right: any;
/**
* The vertical distance in pixels from the top edge of the component to the
* anchor target's top edge.
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 距父级容器顶部距离。
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
top: any;
/**
* The vertical distance in pixels from the bottom edge of the component to the
* anchor target's bottom edge.
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 距父级容器底部距离。
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
bottom: any;
/**
* The horizontal distance in pixels from the center of the component to the
* center of the anchor target's content area.
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 在父级容器中距水平中心位置的距离。
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
horizontalCenter: any;
/**
* The vertical distance in pixels from the center of the component to the
* center of the anchor target's content area.
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 在父级容器中距竖直中心位置的距离。
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
verticalCenter: any;
/**
* Specifies the width of a component as a percentage
* of its parent's size. Allowed values are 0-100.
* Setting the <code>width</code> or <code>explicitWidth</code> properties
* resets this property to NaN.
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 相对父级容器宽度的百分比。
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
percentWidth: number;
/**
* Specifies the height of a component as a percentage
* of its parent's size. Allowed values are 0-100.
* Setting the <code>height</code> or <code>explicitHeight</code> properties
* resets this property to NaN.
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 相对父级容器高度的百分比。
*
* @default NaN
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
percentHeight: number;
/**
* Number that specifies the explicit width of the component,
* in pixels, in the component's coordinates.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 外部显式指定的宽度。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
explicitWidth: number;
/**
* Number that specifies the explicit height of the component,
* in pixels, in the component's coordinates.
* @readOnly
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 外部显式指定的高度。
* @readOnly
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
explicitHeight: number;
/**
* The minimum recommended width of the component to be considered
* by the parent during layout. This value is in the
* component's coordinates, in pixels. The default value depends on
* the component's implementation.
* @readOnly
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 组件的最小宽度,此属性设置为大于maxWidth的值时无效。同时影响测量和自动布局的尺寸。
* @readOnly
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
minWidth: number;
/**
* The maximum recommended width of the component to be considered
* by the parent during layout. This value is in the
* component's coordinates, in pixels. The default value of this property is
* set by the component developer.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 组件的最大高度。同时影响测量和自动布局的尺寸。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
maxWidth: number;
/**
* The minimum recommended height of the component to be considered
* by the parent during layout. This value is in the
* component's coordinates, in pixels. The default value depends on
* the component's implementation.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 组件的最小高度,此属性设置为大于maxHeight的值时无效。同时影响测量和自动布局的尺寸。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
minHeight: number;
/**
* The maximum recommended height of the component to be considered
* by the parent during layout. This value is in the
* component's coordinates, in pixels. The default value of this property is
* set by the component developer.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 组件的最大高度,同时影响测量和自动布局的尺寸。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
maxHeight: number;
/**
* Set the result of measuring.
* @param width measured width
* @param height measured height
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 设置测量结果。
* @param width 测量宽度
* @param height 测量高度
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
setMeasuredSize(width: number, height: number): void;
/**
* Marks a component so that its <code>commitProperties()</code>
* method gets called during a later screen update.<p/>
*
* Invalidation is a useful mechanism for eliminating duplicate
* work by delaying processing of changes to a component until a
* later screen update.<p/>
*
* For example, if you want to change the text color and size,
* it would be wasteful to update the color immediately after you
* change it and then update the size when it gets set.
* It is more efficient to change both properties and then render
* the text with its new size and color once.<p/>
*
* Invalidation methods rarely get called.
* In general, setting a property on a component automatically
* calls the appropriate invalidation method.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 标记提交过需要延迟应用的属性,以便在稍后屏幕更新期间调用该组件的 commitProperties() 方法。<p/>
*
* 这是一个很有用的机制,可将组件更改延迟到稍后屏幕更新时进行处理,从而消除了重复的工作。<p/>
*
* 例如,要更改文本颜色和大小,如果在更改颜色后立即进行更新,然后在设置大小后再更新大小,就有些浪费。
* 同时更改两个属性后再使用新的大小和颜色一次性呈示文本,效率会更高。<p/>
*
* 很少调用 Invalidation 方法。通常,在组件上设置属性会自动调用合适的 invalidation 方法。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
invalidateProperties(): void;
/**
* Used by layout logic to validate the properties of a component
* by calling the <code>commitProperties()</code> method.
* In general, subclassers should
* override the <code>commitProperties()</code> method and not this method.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 由布局逻辑用于通过调用 commitProperties() 方法来验证组件的属性。
* 通常,子类应覆盖 commitProperties() 方法,而不是覆盖此方法。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
validateProperties(): void;
/**
* Marks a component so that its <code>measure()</code>
* method gets called during a later screen update.<p/>
*
* Invalidation is a useful mechanism for eliminating duplicate
* work by delaying processing of changes to a component until a
* later screen update.<p/>
*
* For example, if you want to change the text and font size,
* it would be wasteful to update the text immediately after you
* change it and then update the size when it gets set.
* It is more efficient to change both properties and then render
* the text with its new size once.<p/>
*
* Invalidation methods rarely get called.
* In general, setting a property on a component automatically
* calls the appropriate invalidation method.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 标记提交过需要验证组件尺寸,以便在稍后屏幕更新期间调用该组件的 measure() 方法。<p/>
*
* Invalidation 是一个很有用的机制,可将组件更改延迟到稍后屏幕更新时进行处理,从而消除了重复的工作。<p/>
*
* 例如,要更改文本和字体大小,如果在更改文本后立即进行更新,然后在设置大小后再更新大小,就有些浪费。
* 更改两个属性后再使用新的大小一次性呈示文本,效率会更高。<p/>
*
* 很少调用 Invalidation 方法。通常,在组件上设置属性会自动调用合适的 invalidation 方法。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
invalidateSize(): void;
/**
* Validates the measured size of the component.
* @param recursive If <code>true</code>, call this method
* on the objects children.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 验证组件的尺寸。
* @param recursive 如果为 true,则调用对象子项的此方法。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
validateSize(recursive?: boolean): void;
/**
* Marks a component so that its <code>updateDisplayList()</code>
* method gets called during a later screen update.<p/>
*
* Invalidation is a useful mechanism for eliminating duplicate
* work by delaying processing of changes to a component until a
* later screen update.<p/>
*
* For example, if you want to change the width and height,
* it would be wasteful to update the component immediately after you
* change the width and then update again with the new height.
* It is more efficient to change both properties and then render
* the component with its new size once.<p/>
*
* Invalidation methods rarely get called.
* In general, setting a property on a component automatically
* calls the appropriate invalidation method.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 标记需要验证显示列表,以便在稍后屏幕更新期间调用该组件的 updateDisplayList() 方法。<p/>
*
* Invalidation 是一个很有用的机制,可将组件更改延迟到稍后屏幕更新时进行处理,从而消除了重复的工作。<p/>
*
* 例如,要更改宽度和高度,如果在更改宽度后立即更新组件,然后在设置新高度后再次更新组件,就有些浪费。
* 更改两个属性后再使用新的大小一次性呈示组件,效率会更高。<p/>
*
* 很少调用 Invalidation 方法。通常,在组件上设置属性会自动调用合适的 invalidation 方法。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
invalidateDisplayList(): void;
/**
* Validates the position and size of children and draws other
* visuals.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 验证子项的位置和大小,并绘制其他可视内容。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
validateDisplayList(): void;
/**
* Validate and update the properties and layout of this object
* and redraw it, if necessary.<p/>
*
* Processing properties that require substantial computation are normally
* not processed until the script finishes executing.<p/>
*
* For example setting the <code>width</code> property is delayed, because it can
* require recalculating the widths of the objects children or its parent.
* Delaying the processing prevents it from being repeated
* multiple times if the script sets the <code>width</code> property more than once.
* This method lets you manually override this behavior.
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 验证并更新此对象的属性和布局,如果需要的话重绘对象。<p/>
*
* 通常只有当脚本执行完毕后,才会处理要求进行大量计算的处理属性。<p/>
*
* 例如,对 width 属性的设置可能会延迟,因为此设置需要重新计算这些对象的子项或父项的宽度。
* 如果脚本多次设置了 width 属性,则延迟处理可防止进行多次处理。此方法允许您手动覆盖此行为。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
validateNow(): void;
/**
* Sets the layout size of the element.
* This is the size that the element uses to draw on screen.<p/>
*
* If the <code>width</code> and/or <code>height</code> parameters are left unspecified (NaN),
* EUI sets the element's layout size to its preferred width and/or preferred height.<p/>
*
* Note that calls to the <code>setLayoutBoundSize()</code> method can affect the layout position, so
* call <code>setLayoutBoundPosition()</code> after calling <code>setLayoutBoundSize()</code>.<p/>
*
* @param layoutWidth The element's layout width.
* @param layoutHeight The element's layout height.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 设置元素的布局大小。这是元素在屏幕上进行绘制时所用的大小。<p/>
*
* 如果 width 和/或 height 参数尚未指定 (NaN)),则 EUI 会将该元素的布局大小设置为首选宽度和/或首选高度。<p/>
*
* 请注意,调用 setLayoutBoundSize() 方法会影响布局位置,因此请在调用 setLayoutBoundSize()
* 之后再调用 setLayoutBoundPosition()。
*
* @param layoutWidth 元素的布局宽度。
* @param layoutHeight 元素的布局高度。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
setLayoutBoundsSize(layoutWidth: number, layoutHeight: number): void;
/**
* Sets the coordinates that the element uses to draw on screen.<p/>
*
* Note that calls to the <code>setLayoutBoundSize()</code> method can affect the layout position, so
* call <code>setLayoutBoundPosition()</code> after calling <code>setLayoutBoundSize()</code>.<p/>
*
* @param x The x-coordinate of the top-left corner of the bounding box.
* @param y The y-coordinate of the top-left corner of the bounding box.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 设置元素在屏幕上进行绘制时所用的布局坐标。<p/>
*
* 请注意,调用 setLayoutBoundSize() 方法会影响布局位置,因此请在调用 setLayoutBoundSize()
* 之后再调用 setLayoutBoundPosition()。
*
* @param x 边框左上角的 X 坐标。
* @param y 边框左上角的 Y 坐标。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
setLayoutBoundsPosition(x: number, y: number): void;
/**
* Get the layout bounds that the element uses to draw on screen.
* Commonly used in the <code>updateDisplayList()</code> method in parent container.<p/>
* Priority: layout > explicit > measure.<p/>
* The result of this method is contains <code>scale</code> and <code>rotation</code>.
*
* @param bounds the instance of <code>egret.Rectangle</code> can set result.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 组件的布局尺寸,常用于父级的<code>updateDisplayList()</code>方法中。<p/>
* 按照:布局尺寸>外部显式设置尺寸>测量尺寸 的优先级顺序返回尺寸。<p/>
* 注意此方法返回值已经包含scale和rotation。
*
* @param bounds 可以放置结果的<code>egret.Rectangle</code>实例。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
getLayoutBounds(bounds: egret.Rectangle): void;
/**
* Get the element's preferred bounds。
* Commonly used in the <code>measure()</code> method in parent container.<p/>
* Priority: explicit > measure.<p/>
* The result of this method is contains <code>scale</code> and <code>rotation</code>.
*
* @param bounds the instance of <code>egret.Rectangle</code> can set result.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 获取组件的首选尺寸,常用于父级的<code>measure()</code>方法中。<p/>
* 按照:外部显式设置尺寸>测量尺寸 的优先级顺序返回尺寸。<p/>
* 注意此方法返回值已经包含scale和rotation。
*
* @param bounds 可以放置结果的<code>egret.Rectangle</code>实例。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
getPreferredBounds(bounds: egret.Rectangle): void;
}
}
declare namespace eui.sys {
/**
* @private
*/
const enum UIKeys {
left = 0,
right = 1,
top = 2,
bottom = 3,
horizontalCenter = 4,
verticalCenter = 5,
percentWidth = 6,
percentHeight = 7,
explicitWidth = 8,
explicitHeight = 9,
width = 10,
height = 11,
minWidth = 12,
maxWidth = 13,
minHeight = 14,
maxHeight = 15,
measuredWidth = 16,
measuredHeight = 17,
oldPreferWidth = 18,
oldPreferHeight = 19,
oldX = 20,
oldY = 21,
oldWidth = 22,
oldHeight = 23,
invalidatePropertiesFlag = 24,
invalidateSizeFlag = 25,
invalidateDisplayListFlag = 26,
layoutWidthExplicitlySet = 27,
layoutHeightExplicitlySet = 28,
initialized = 29,
}
/**
* @private
* EUI 显示对象基类模板。仅作为 UIComponent 的默认实现,为egret.sys.implemenetUIComponenet()方法提供代码模板。
* 注意:在此类里不允许直接使用super关键字访问父类方法。一律使用this.$super属性访问。
*/
class UIComponentImpl extends egret.DisplayObject implements eui.UIComponent {
/**
* @private
* 构造函数
*/
constructor();
/**
* @private
* UIComponentImpl 定义的所有变量请不要添加任何初始值,必须统一在此处初始化。
*/
private initializeUIValues();
/**
* @private
* 子类覆盖此方法可以执行一些初始化子项操作。此方法仅在组件第一次添加到舞台时回调一次。
* 请务必调用super.createChildren()以完成父类组件的初始化
*/
protected createChildren(): void;
/**
* @private
* 子项创建完成,此方法在createChildren()之后执行。
*/
protected childrenCreated(): void;
/**
* @private
* 提交属性,子类在调用完invalidateProperties()方法后,应覆盖此方法以应用属性
*/
protected commitProperties(): void;
/**
* @private
* 测量组件尺寸
*/
protected measure(): void;
/**
* @private
* 更新显示列表
*/
protected updateDisplayList(unscaledWidth: number, unscaledHeight: number): void;
$super: any;
$UIComponent: Object;
$includeInLayout: boolean;
/**
* @private
* 指定此组件是否包含在父容器的布局中。若为false,则父级容器在测量和布局阶段都忽略此组件。默认值为true。
* 注意,visible属性与此属性不同,设置visible为false,父级容器仍会对其布局。
*/
includeInLayout: boolean;
/**
* @private
*
* @param stage
* @param nestLevel
*/
$onAddToStage(stage: egret.Stage, nestLevel: number): void;
/**
* @private
* 检查属性失效标记并应用
*/
private checkInvalidateFlag(event?);
/**
* @private
* 距父级容器离左边距离
*/
left: any;
/**
* @private
* 距父级容器右边距离
*/
right: any;
/**
* @private
* 距父级容器顶部距离
*/
top: any;
/**
* @private
* 距父级容器底部距离
*/
bottom: any;
/**
* @private
* 在父级容器中距水平中心位置的距离
*/
horizontalCenter: any;
/**
* @private
* 在父级容器中距竖直中心位置的距离
*/
verticalCenter: any;
/**
* @private
* 相对父级容器宽度的百分比
*/
percentWidth: number;
/**
* @private
* 相对父级容器高度的百分比
*/
percentHeight: number;
/**
* @private
* 外部显式指定的宽度
*/
readonly explicitWidth: number;
/**
* @private
* 外部显式指定的高度
*/
readonly explicitHeight: number;
/**
* @private
* 组件宽度,默认值为egret.NaN,设置为NaN将使用组件的measure()方法自动计算尺寸
*/
$getWidth(): number;
/**
* @private
*
* @param value
*/
$setWidth(value: number): boolean;
/**
* @private
* 立即验证自身的尺寸。
*/
private validateSizeNow();
/**
* @private
* 组件高度,默认值为NaN,设置为NaN将使用组件的measure()方法自动计算尺寸
*/
$getHeight(): number;
/**
* @private
*
* @param value
*/
$setHeight(value: number): boolean;
/**
* @private
* 组件的最小宽度,此属性设置为大于maxWidth的值时无效。同时影响测量和自动布局的尺寸。
*/
minWidth: number;
/**
* @private
* 组件的最大高度。同时影响测量和自动布局的尺寸。
*/
maxWidth: number;
/**
* @private
* 组件的最小高度,此属性设置为大于maxHeight的值时无效。同时影响测量和自动布局的尺寸。
*/
minHeight: number;
/**
* @private
* 组件的最大高度,同时影响测量和自动布局的尺寸。
*/
maxHeight: number;
/**
* @private
* 设置测量结果。
* @param width 测量宽度
* @param height 测量高度
*/
setMeasuredSize(width: number, height: number): void;
/**
* @private
* 设置组件的宽高。此方法不同于直接设置width,height属性,
* 不会影响显式标记尺寸属性
*/
private setActualSize(w, h);
/**
* @private
*/
$invalidateMatrix(): void;
/**
* @private
*/
$setMatrix(matrix: egret.Matrix, needUpdateProperties?: boolean): boolean;
/**
* @private
*/
$setAnchorOffsetX(value: number): boolean;
/**
* @private
*/
$setAnchorOffsetY(value: number): boolean;
/**
* @private
*
* @param value
* @returns
*/
$setX(value: number): boolean;
/**
* @private
*
* @param value
* @returns
*/
$setY(value: number): boolean;
/**
* @private
* 标记属性失效
*/
invalidateProperties(): void;
/**
* @private
* 验证组件的属性
*/
validateProperties(): void;
/**
* @private
* 标记提交过需要验证组件尺寸
*/
invalidateSize(): void;
/**
* @private
* 验证组件的尺寸
*/
validateSize(recursive?: boolean): void;
/**
* @private
* 测量组件尺寸,返回尺寸是否发生变化
*/
private measureSizes();
/**
* @private
* 标记需要验证显示列表
*/
invalidateDisplayList(): void;
/**
* @private
* 验证子项的位置和大小,并绘制其他可视内容
*/
validateDisplayList(): void;
/**
* @private
* 更新最终的组件宽高
*/
private updateFinalSize();
/**
* @private
* 立即应用组件及其子项的所有属性
*/
validateNow(): void;
/**
* @private
* 标记父级容器的尺寸和显示列表为失效
*/
protected invalidateParentLayout(): void;
/**
* @private
* 设置组件的布局宽高
*/
setLayoutBoundsSize(layoutWidth: number, layoutHeight: number): void;
/**
* @private
* 设置组件的布局位置
*/
setLayoutBoundsPosition(x: number, y: number): void;
/**
* @private
* 组件的布局尺寸,常用于父级的updateDisplayList()方法中
* 按照:布局尺寸>外部显式设置尺寸>测量尺寸 的优先级顺序返回尺寸,
* 注意此方法返回值已经包含scale和rotation。
*/
getLayoutBounds(bounds: egret.Rectangle): void;
/**
* @private
*
* @returns
*/
private getPreferredUWidth();
/**
* @private
*
* @returns
*/
private getPreferredUHeight();
/**
* @private
* 获取组件的首选尺寸,常用于父级的measure()方法中
* 按照:外部显式设置尺寸>测量尺寸 的优先级顺序返回尺寸,
* 注意此方法返回值已经包含scale和rotation。
*/
getPreferredBounds(bounds: egret.Rectangle): void;
/**
* @private
*/
private applyMatrix(bounds, w, h);
/**
* @private
*/
private getAnchorMatrix();
}
/**
* @private
* 拷贝模板类的方法体和属性到目标类上。
* @param target 目标类
* @param template 模板类
*/
function mixin(target: any, template: any): void;
/**
* @private
* 自定义类实现UIComponent的步骤:
* 1.在自定义类的构造函数里调用:this.initializeUIValues();
* 2.拷贝UIComponent接口定义的所有内容(包括注释掉的protected函数)到自定义类,将所有子类需要覆盖的方法都声明为空方法体。
* 3.在定义类结尾的外部调用sys.implementUIComponent(),并传入自定义类。
* 4.若覆盖了某个UIComponent的方法,需要手动调用UIComponentImpl.prototype["方法名"].call(this);
* @param descendant 自定义的UIComponent子类
* @param base 自定义子类继承的父类
*/
function implementUIComponent(descendant: any, base: any, isContainer?: boolean): void;
}
declare namespace eui {
/**
* The Group class is defines the base class for layout component.
* If the contents of the sub items are too large to scroll to show, you can wrap a Scroller component outside the
* group (Give the instance of Group to <code>viewport</code> property of Scroller component).
* The scroller component can adds a scrolling touch operation for the Group.
*
* @see http://edn.egret.com/cn/article/index/id/608 Simple container
* @defaultProperty elementsContent
* @includeExample extension/eui/components/GroupExample.ts
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* Group 是自动布局的容器基类。如果包含的子项内容太大需要滚动显示,可以在在 Group 外部包裹一层 Scroller 组件
* (将 Group 实例赋值给 Scroller 组件的 viewport 属性)。Scroller 会为 Group 添加滚动的触摸操作功能,并显示垂直或水平的滚动条。
*
* @see http://edn.egret.com/cn/article/index/id/608 简单容器
* @defaultProperty elementsContent
* @includeExample extension/eui/components/GroupExample.ts
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
class Group extends egret.DisplayObjectContainer implements IViewport {
/**
* Constructor.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 构造函数。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
constructor();
$Group: Object;
/**
* This property is Usually invoked in resolving an EXML for adding multiple children quickly.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 此属性通常在 EXML 的解析器中调用,便于快速添加多个子项。
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
elementsContent: egret.DisplayObject[];
/**
* @private
*/
$layout: LayoutBase;
/**
* The layout object for this container.
* This object is responsible for the measurement and layout of
* the UIcomponent in the container.
*
* @default eui.BasicLayout
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 此容器的布局对象。
*
* s@default eui.BasicLayout
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
layout: LayoutBase;
/**
* @private
*
* @param value
*/
$setLayout(value: LayoutBase): boolean;
/**
* @copy eui.IViewport#contentWidth
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
*/
readonly contentWidth: number;
/**
* @copy eui.IViewport#contentHeight
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
*/
readonly contentHeight: number;
/**
*
* Sets the <code>contentWidth</code> and <code>contentHeight</code>
* properties.
*
* This method is intended for layout class developers who should
* call it from <code>updateDisplayList()</code> methods.
*
* @param width The new value of <code>contentWidth</code>.
* @param height The new value of <code>contentHeight</code>.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
*
* 设置 <code>contentWidth</code> 和 <code>contentHeight</code> 属性。
* 此方法由布局来调用,开发者应该在布局类的 <code>updateDisplayList()</code> 方法中对其进行调用。
*
* @param width <code>contentWidth</code> 的新值。
* @param height <code>contentHeight</code> 的新值。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
setContentSize(width: number, height: number): void;
/**
* @copy eui.IViewport#scrollEnabled
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
*/
scrollEnabled: boolean;
/**
* @copy eui.IViewport#scrollH
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
*/
scrollH: number;
/**
* @copy eui.IViewport#scrollV
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
*/
scrollV: number;
/**
* @private
*
* @returns
*/
private updateScrollRect();
/**
* The number of layout element in this container.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 布局元素子项的数量。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
readonly numElements: number;
/**
* Returns the layout element at the specified index.
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language en_US
*/
/**
* 获取一个布局元素子项。
*
* @version Egret 2.4
* @version eui 1.0
* @platform Web,Native
* @language zh_CN
*/
getElementAt(index: number): egret.DisplayObject;
getVirtualElementAt(index: number): egret.DisplayObject;
/**
* Set the index range of the sub Visual element in container which support virtual layout.
* This method is invalid in container which do not support virtual layout.
* This method is usually invoked before layout. Override this method to release the invisible elements.
*
* @param startIndex the start inde