You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2016/05/26 23:05:29 UTC
[45/51] [abbrv] git commit: [flex-asjs] [refs/heads/spark] - more
attempts to get Application and Label to compile
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/controls/scrollClasses/ScrollBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/controls/scrollClasses/ScrollBar.as b/frameworks/projects/MX/src/main/flex/mx/controls/scrollClasses/ScrollBar.as
deleted file mode 100644
index 29c5ab1..0000000
--- a/frameworks/projects/MX/src/main/flex/mx/controls/scrollClasses/ScrollBar.as
+++ /dev/null
@@ -1,1719 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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.controls.scrollClasses
-{
-
-COMPILE::AS3
-{
- import flash.display.DisplayObject;
- import flash.events.Event;
- import flash.events.EventDispatcher;
- import flash.events.MouseEvent;
- import flash.events.TimerEvent;
- import flash.geom.Point;
- import flash.ui.Keyboard;
- import flash.utils.Timer;
-}
-COMPILE::JS
-{
- import flex.display.DisplayObject;
- import flex.events.Event;
- import flex.events.EventDispatcher;
- import flex.events.MouseEvent;
- import flex.events.TimerEvent;
- import flex.geom.Point;
- import flex.ui.Keyboard;
- import flex.utils.Timer;
-}
-
-import mx.controls.Button;
-import mx.core.UIComponent;
-import mx.core.mx_internal;
-import mx.events.FlexEvent;
-COMPILE::LATER
-{
- import mx.events.SandboxMouseEvent;
-}
-import mx.events.ScrollEvent;
-import mx.events.ScrollEventDetail;
-import mx.managers.ISystemManager;
-import mx.styles.ISimpleStyleClient;
-import mx.styles.StyleProxy;
-
-use namespace mx_internal;
-
-//--------------------------------------
-// Styles
-//--------------------------------------
-
-include "../../styles/metadata/SkinStyles.as"
-
-/**
- * Name of the class to use as the default skin for the down arrow button of
- * the scroll bar.
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarDownButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="downArrowSkin", type="Class", inherit="no", states="up, over, down, disabled")]
-
-/**
- * Name of the class to use as the skin for the down arrow button of the
- * scroll bar when it is disabled.
- *
- * <p>If you change the skin, either graphically or programmatically,
- * you should ensure that the new skin is the same height
- * (for horizontal ScrollBars) or width (for vertical ScrollBars) as the track.</p>
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarDownButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="downArrowDisabledSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the down arrow button of the
- * scroll bar when you click the arrow button
- * .
- * <p>If you change the skin, either graphically or programmatically,
- * you should ensure that the new skin is the same height
- * (for horizontal ScrollBars) or width (for vertical ScrollBars) as the track.</p>
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarDownButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="downArrowDownSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the down arrow button of the
- * scroll bar when the mouse pointer is over the arrow button.
- *
- * <p>If you change the skin, either graphically or programmatically,
- * you should ensure that the new skin is the same height
- * (for horizontal ScrollBars) or width (for vertical ScrollBars) as the track.</p>
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarDownButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="downArrowOverSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the down arrow button of
- * the scroll bar.
- *
- * <p>If you change the skin, either graphically or programmatically,
- * you should ensure that the new skin is the same height
- * (for horizontal ScrollBars) or width (for vertical ScrollBars) as the track.</p>
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarDownButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="downArrowUpSkin", type="Class", inherit="no")]
-
-/**
- * Color of any symbol of a component. Examples include the check mark of a CheckBox or
- * the arrow of a ScrollBar button.
- *
- * @default 0x000000
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 1.5
- * @productversion Flex 4
- */
-[Style(name="symbolColor", type="uint", format="Color", inherit="yes", theme="spark")]
-
-/**
- * Name of the class to use as the default skin for the down arrow button of
- * the scroll bar.
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollThumbSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarThumbSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="thumbSkin", type="Class", inherit="no", states="up, over, down")]
-
-/**
- * Name of the class to use as the skin for the thumb of the scroll bar
- * when you click the thumb.
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollThumbSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarThumbSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="thumbDownSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the icon for the thumb of the scroll bar.
- *
- * @default "undefined"
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="thumbIcon", type="Class", inherit="no")]
-
-/**
- * The number of pixels to offset the scroll thumb from the center of the scroll bar.
- *
- * @default 0
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="thumbOffset", type="Number", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the thumb of the scroll bar
- * when the mouse pointer is over the thumb.
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollThumbSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarThumbSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="thumbOverSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the thumb of the scroll bar.
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollThumbSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarThumbSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="thumbUpSkin", type="Class", inherit="no")]
-
-/**
- * The colors of the track, as an array of two colors.
- * You can use the same color twice for a solid track color.
- *
- * @default [0x94999b, 0xe7e7e7]
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="trackColors", type="Array", arrayType="uint", format="Color", inherit="no", theme="halo")]
-
-
-/**
- * Name of the class to use as the default skin for the track of the scroll bar.
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollTrackSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.ScrollBarTrackSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="trackSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the track of the scroll bar
- * when the scroll bar is disabled.
- *
- * @default undefined
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="trackDisabledSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the track of the scroll bar
- * when you click on the track.
- *
- * @default undefined
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="trackDownSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the track of the scroll bar
- * when the mouse pointer is over the scroll bar.
- *
- * @default undefined
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="trackOverSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the track of the scroll bar.
- *
- * @default undefined
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="trackUpSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the default skin for the up arrow button of the scroll bar.
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.mx.skins.spark.ScrollBarUpButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="upArrowSkin", type="Class", inherit="no", states="up, over, down, disabled")]
-
-/**
- * Name of the class to use as the skin for the up arrow button of the scroll bar
- * when it is disabled.
- *
- * <p>If you change the skin, either graphically or programmatically,
- * you should ensure that the new skin is the same height
- * (for horizontal ScrollBars) or width (for vertical ScrollBars) as the track.</p>
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.mx.skins.spark.ScrollBarUpButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="upArrowDisabledSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the up arrow button of the scroll bar
- * when you click the arrow button.
- *
- * <p>If you change the skin, either graphically or programmatically,
- * you should ensure that the new skin is the same height
- * (for horizontal ScrollBars) or width (for vertical ScrollBars) as the track.</p>
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.mx.skins.spark.ScrollBarUpButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="upArrowDownSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the up arrow button of the scroll bar
- * when the mouse pointer is over the arrow button.
- *
- * <p>If you change the skin, either graphically or programmatically,
- * you should ensure that the new skin is the same height
- * (for horizontal ScrollBars) or width (for vertical ScrollBars) as the track.</p>
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.mx.skins.spark.ScrollBarUpButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="upArrowOverSkin", type="Class", inherit="no")]
-
-/**
- * Name of the class to use as the skin for the up arrow button of the
- * scroll bar.
- *
- * <p>If you change the skin, either graphically or programmatically,
- * you should ensure that the new skin is the same height
- * (for horizontal ScrollBars) or width (for vertical ScrollBars) as the track.</p>
- *
- * <p>The default skin class is based on the theme. For example, with the Halo theme,
- * the default skin class is <code>mx.skins.halo.ScrollArrowSkin</code>. For the Spark theme, the default skin
- * class is <code>mx.skins.spark.mx.skins.spark.ScrollBarUpButtonSkin</code>.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="upArrowUpSkin", type="Class", inherit="no")]
-
-//--------------------------------------
-// Excluded APIs
-//--------------------------------------
-
-[Exclude(name="doubleClickEnabled", kind="property")]
-
-[Exclude(name="errorColor", kind="style")]
-[Exclude(name="focusBlendMode", kind="style")]
-[Exclude(name="focusSkin", kind="style")]
-[Exclude(name="focusThickness", kind="style")]
-
-/**
- * The ScrollBar class is the base class for the HScrollBar and VScrollBar
- * controls.
- * A ScrollBar consists of two arrow buttons, a track between them,
- * and a variable-size scroll thumb. The scroll thumb can move by
- * clicking on either of the two arrow buttons, dragging the scroll thumb
- * along the track, or clicking on the track.
- *
- * <p>The width of a scroll bar is equal to the largest width of its subcomponents
- * (up arrow, down arrow, thumb, and track).
- * Every subcomponent is centered in the scroll bar.</p>
- *
- * @mxml
- *
- * <p>The <code><mx:ScrollBar></code> tag inherits all of the tag attributes
- * of its superclass, and adds the following tag attributes:</p>
- *
- * <pre>
- * <mx:ScrollBar
- * <strong>Properties</strong>
- * direction="vertical|horizontal"
- * lineScrollSize="1"
- * maxScrollPosition="0"
- * minScrollPosition="0"
- * pageScrollSize="<i>Reset to the pageSize parameter of setScrollProperties</i>"
- * pageSize="0"
- * scrollPosition="0"
- *
- * <strong>Styles</strong>
- * borderColor="0xB7BABC"
- * cornerRadius="0"
- * disabledIconColor="0x999999"
- * downArrowDisabledSkin="mx.skins.halo.ScrollArrowSkin"
- * downArrowDownSkin="mx.skins.halo.ScrollArrowSkin"
- * downArrowOverSkin="mx.skins.halo.ScrollArrowSkin"
- * downArrowUpSkin="mx.skins.halo.ScrollArrowSkin"
- * fillAlphas="[0.6, 0.4]"
- * fillColors="[0xFFFFFF, 0xCCCCCC]"
- * highlightAlphas="[0.3, 0.0]"
- * iconColor="0x111111"
- * thumbDownSkin="mx.skins.halo.ScrollThumbSkin"
- * thumbIcon="undefined"
- * thumbOffset="0"
- * thumbOverSkin="mx.skins.halo.ScrollThumbSkin"
- * thumbUpSkin="mx.skins.halo.ScrollThumbSkin"
- * trackColors="[0x94999b, 0xe7e7e7]"
- * trackSkin="mx.skins.halo.ScrollTrackSkin"
- * upArrowDisabledSkin="mx.skins.halo.ScrollArrowSkin"
- * upArrowDownSkin="mx.skins.halo.ScrollArrowSkin"
- * upArrowOverSkin="mx.skins.halo.ScrollArrowSkin"
- * upArrowUpSkin="mx.skins.halo.ScrollArrowSkin"
- * />
- * </pre>
- *
- * @see mx.controls.HScrollBar
- * @see mx.controls.VScrollBar
- * @see mx.controls.Button
- * @see mx.controls.scrollClasses.ScrollThumb
- *
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-public class ScrollBar extends UIComponent
-{
- include "../../core/Version.as";
-
- //--------------------------------------------------------------------------
- //
- // Class constants
- //
- //--------------------------------------------------------------------------
-
- /**
- * The width of a vertical scrollbar, or the height of a horizontal
- * scrollbar, in pixels.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public static const THICKNESS:Number = 16;
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function ScrollBar()
- {
- super();
- }
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- * The up arrow button.
- */
- mx_internal var upArrow:Button;
-
- /**
- * @private
- * The down arrow button.
- */
- mx_internal var downArrow:Button;
-
- /**
- * @private
- * The scroll track
- */
- mx_internal var scrollTrack:Button;
-
- /**
- * @private
- * The scroll thumb
- */
- mx_internal var scrollThumb:ScrollThumb;
-
- /**
- * @private
- * Used to keep track of minimums because of the orientation change.
- */
- mx_internal var _minWidth:Number = 16;
-
- /**
- * @private
- */
- mx_internal var _minHeight:Number = 32;
-
- /**
- * @private
- * true if servicing a scroll event.
- */
- mx_internal var isScrolling:Boolean;
-
- /**
- * @private
- * Timer used to autoscroll when holding the mouse down on the track.
- */
- private var trackScrollTimer:Timer;
-
- /**
- * @private
- * The direction we're going when in track scroll repeat.
- */
- private var trackScrollRepeatDirection:int;
-
- /**
- * @private
- * The direction we're going when in track scroll repeat.
- */
- private var trackScrolling:Boolean = false;
-
- /**
- * @private
- * Where the mouse is on the track.
- */
- private var trackPosition:Number;
-
- /**
- * @private
- * Old position, used to compute deltas when button presses are auto
- * repeated
- */
- mx_internal var oldPosition:Number;
-
- //--------------------------------------------------------------------------
- //
- // Overridden properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // doubleClickEnabled
- //----------------------------------
-
- /**
- * @private
- * Scrollbars cannot be doubleClickEnabled.
- * It messes up fast clicking on its buttons.
- */
- override public function set doubleClickEnabled(value:Boolean):void
- {
- }
-
- //----------------------------------
- // enabled
- //----------------------------------
-
- /**
- * @private
- * Turn off buttons, or turn on buttons and resync thumb.
- */
- override public function set enabled(value:Boolean):void
- {
- super.enabled = value;
-
- invalidateDisplayList();
- }
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // direction
- //----------------------------------
-
- /**
- * @private
- * Storage for the direction property.
- */
- private var _direction:String = ScrollBarDirection.VERTICAL;
-
- [Bindable("directionChanged")]
- [Inspectable(category="General", enumeration="vertical,horizontal", defaultValue="vertical")]
-
- /**
- * Specifies whether the ScrollBar is for horizontal or vertical scrolling.
- * Valid values in MXML are <code>"vertical"</code> and <code>"horizontal"</code>.
- *
- * <p>In ActionScript, you use the following constants
- * to set this property:
- * <code>ScrollBarDirection.VERTICAL</code> and
- * <code>ScrollBarDirection.HORIZONTAL</code>.</p>
- *
- * @default ScrollBarDirection.VERTICAL
- *
- * @see mx.controls.scrollClasses.ScrollBarDirection
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get direction():String
- {
- return _direction;
- }
-
- /**
- * @private
- */
- public function set direction(value:String):void
- {
- _direction = value;
-
- invalidateSize();
- invalidateDisplayList();
-
- dispatchEvent(new Event("directionChanged"));
- }
-
- //----------------------------------
- // downArrowStyleFilters
- //----------------------------------
-
- /**
- * Set of styles to pass from the ScrollBar to the down arrow.
- * @see mx.styles.StyleProxy
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- protected function get downArrowStyleFilters():Object
- {
- return null;
- }
-
- //----------------------------------
- // lineMinusDetail
- //----------------------------------
-
- /**
- * @private
- * String used to set the detail property of a ScrollEvent.
- */
- mx_internal function get lineMinusDetail():String
- {
- return direction == ScrollBarDirection.VERTICAL ?
- ScrollEventDetail.LINE_UP :
- ScrollEventDetail.LINE_LEFT;
- }
-
- //----------------------------------
- // linePlusDetail
- //----------------------------------
-
- /**
- * @private
- * String used to set the detail property of a ScrollEvent.
- */
- mx_internal function get linePlusDetail():String
- {
- return direction == ScrollBarDirection.VERTICAL ?
- ScrollEventDetail.LINE_DOWN :
- ScrollEventDetail.LINE_RIGHT;
- }
-
- //----------------------------------
- // lineScrollSize
- //----------------------------------
-
- /**
- * @private
- * Storage for the lineScrollSize property.
- */
- private var _lineScrollSize:Number = 1;
-
- [Inspectable(category="Other", defaultValue="1")]
-
- /**
- * Amount to scroll when an arrow button is pressed, in pixels.
- *
- * @default 1
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get lineScrollSize():Number
- {
- return _lineScrollSize;
- }
-
- /**
- * @private
- */
- public function set lineScrollSize(value:Number):void
- {
- _lineScrollSize = value;
- }
-
- //----------------------------------
- // maxDetail
- //----------------------------------
-
- /**
- * @private
- * String used to set the detail property of a ScrollEvent.
- */
- private function get maxDetail():String
- {
- return direction == ScrollBarDirection.VERTICAL ?
- ScrollEventDetail.AT_BOTTOM :
- ScrollEventDetail.AT_RIGHT;
- }
-
- //----------------------------------
- // maxScrollPosition
- //----------------------------------
-
- /**
- * @private
- * Storage for the maxScrollPosition property.
- */
- private var _maxScrollPosition:Number = 0;
-
- [Inspectable(category="Other", defaultValue="0")]
-
- /**
- * Number which represents the maximum scroll position.
- *
- * @default 0
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get maxScrollPosition():Number
- {
- return _maxScrollPosition;
- }
-
- /**
- * @private
- */
- public function set maxScrollPosition(value:Number):void
- {
- _maxScrollPosition = value;
- invalidateDisplayList();
- }
-
- //----------------------------------
- // minDetail
- //----------------------------------
-
- /**
- * @private
- * String used to set the detail property of a ScrollEvent.
- */
- private function get minDetail():String
- {
- return direction == ScrollBarDirection.VERTICAL ?
- ScrollEventDetail.AT_TOP :
- ScrollEventDetail.AT_LEFT;
- }
-
- //----------------------------------
- // minScrollPosition
- //----------------------------------
-
- /**
- * @private
- * Storage for the minScrollPosition property.
- */
- private var _minScrollPosition:Number = 0;
-
- [Inspectable(category="Other", defaultValue="0")]
-
- /**
- * Number that represents the minimum scroll position.
- *
- * @default 0
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get minScrollPosition():Number
- {
- return _minScrollPosition;
- }
-
- /**
- * @private
- */
- public function set minScrollPosition(value:Number):void
- {
- _minScrollPosition = value;
- invalidateDisplayList();
- }
-
- //----------------------------------
- // pageMinusDetail
- //----------------------------------
-
- /**
- * @private
- * String used to set the detail property of a ScrollEvent.
- */
- mx_internal function get pageMinusDetail():String
- {
- return direction == ScrollBarDirection.VERTICAL ?
- ScrollEventDetail.PAGE_UP :
- ScrollEventDetail.PAGE_LEFT;
- }
-
- //----------------------------------
- // pagePlusDetail
- //----------------------------------
-
- /**
- * @private
- * String used to set the detail property of a ScrollEvent.
- * Can be <code>ScrollEventDetail.PAGE_RIGHT</code> or
- * <code>ScrollEventDetail.PAGE_DOWN</code>.
- */
- mx_internal function get pagePlusDetail():String
- {
- return direction == ScrollBarDirection.VERTICAL ?
- ScrollEventDetail.PAGE_DOWN :
- ScrollEventDetail.PAGE_RIGHT;
- }
-
- //----------------------------------
- // pageSize
- //----------------------------------
-
- /**
- * @private
- * Storage for the pageSize property.
- */
- private var _pageSize:Number = 0;
-
- [Inspectable(category="Other", defaultValue="0")]
-
- /**
- * The number of lines equivalent to one page.
- *
- * @default 0
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get pageSize():Number
- {
- return _pageSize;
- }
-
- /**
- * @private
- */
- public function set pageSize(value:Number):void
- {
- _pageSize = value;
- }
-
- //----------------------------------
- // pageScrollSize
- //----------------------------------
-
- /**
- * @private
- * Storage for the pageScrollSize property.l
- */
- private var _pageScrollSize:Number = 0;
-
- [Inspectable(category="Other", defaultValue="0")]
-
- /**
- * Amount to move the scroll thumb when the scroll bar
- * track is pressed, in pixels.
- *
- * @default 0
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get pageScrollSize():Number
- {
- return _pageScrollSize;
- }
-
- /**
- * @private
- */
- public function set pageScrollSize(value:Number):void
- {
- _pageScrollSize = value;
- }
-
- //----------------------------------
- // scrollPosition
- //----------------------------------
-
- /**
- * @private
- * Storage for the scrollPosition property.
- */
- private var _scrollPosition:Number = 0;
-
- [Inspectable(category="Other", defaultValue="0")]
-
- /**
- * Number that represents the current scroll position.
- *
- * The value is between <code>minScrollPosition</code> and
- * <code>maxScrollPosition</code> inclusively.
- *
- * @default 0
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get scrollPosition():Number
- {
- return _scrollPosition;
- }
-
- /**
- * @private
- */
- public function set scrollPosition(value:Number):void
- {
- _scrollPosition = value;
-
- if (scrollThumb)
- {
- // Turn on bitmap caching whenever we start scrolling. Turn it
- // off whenever we resize the scrollbar (because caching hurts
- // performance during a resize animation)
- if (!cacheAsBitmap)
- cacheHeuristic = scrollThumb.cacheHeuristic = true;
-
- if (!isScrolling)
- {
- // Update thumb.
- value = Math.min(value, maxScrollPosition);
- value = Math.max(value, minScrollPosition);
-
- var denom:Number = maxScrollPosition - minScrollPosition;
- var y:Number = (denom == 0 || isNaN(denom)) ? 0 :
- ((value - minScrollPosition) * (trackHeight - scrollThumb.height) /
- (denom)) + trackY;
-
- var x:Number = (virtualWidth - scrollThumb.width) / 2 + getStyle("thumbOffset");
- scrollThumb.move(Math.round(x), Math.round(y));
- }
- }
- }
-
- //----------------------------------
- // thumbStyleFilters
- //----------------------------------
-
- /**
- * Set of styles to pass from the ScrollBar to the thumb.
- * @see mx.styles.StyleProxy
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- protected function get thumbStyleFilters():Object
- {
- return null;
- }
-
- //----------------------------------
- // trackHeight
- //----------------------------------
-
- /**
- * @private
- */
- private function get trackHeight():Number
- {
- return virtualHeight -
- (upArrow.getExplicitOrMeasuredHeight() +
- downArrow.getExplicitOrMeasuredHeight());
- }
-
- //----------------------------------
- // trackY
- //----------------------------------
-
- /**
- * @private
- */
- private function get trackY():Number
- {
- return upArrow.getExplicitOrMeasuredHeight();
- }
-
- //----------------------------------
- // upArrowStyleFilters
- //----------------------------------
-
- /**
- * Set of styles to pass from the ScrollBar to the up arrow.
- * @see mx.styles.StyleProxy
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- protected function get upArrowStyleFilters():Object
- {
- return null;
- }
-
- //----------------------------------
- // virtualHeight
- //----------------------------------
-
- /**
- * @private
- * For internal use only.
- * Used by horizontal bar to deal with rotation.
- */
- mx_internal function get virtualHeight():Number
- {
- return unscaledHeight;
- }
-
- //----------------------------------
- // virtualWidth
- //----------------------------------
-
- /**
- * @private
- * For internal use only.
- * Used by horizontal bar to deal with rotation.
- */
- mx_internal function get virtualWidth():Number
- {
- return unscaledWidth;
- }
- //--------------------------------------------------------------------------
- //
- // Overridden methods: UIComponent
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- * Create child objects.
- */
- override protected function createChildren():void
- {
- super.createChildren();
-
- // Create the scroll track.
- if (!scrollTrack)
- {
- scrollTrack = new Button();
- scrollTrack.focusEnabled = false;
- scrollTrack.tabEnabled = false;
- scrollTrack.skinName = "trackSkin";
- scrollTrack.upSkinName = "trackUpSkin";
- scrollTrack.overSkinName = "trackOverSkin";
- scrollTrack.downSkinName = "trackDownSkin";
- scrollTrack.disabledSkinName = "trackDisabledSkin";
-
- if (scrollTrack is ISimpleStyleClient)
- ISimpleStyleClient(scrollTrack).styleName = this;
-
- addChild(scrollTrack);
-
- scrollTrack.validateProperties();
- }
-
- // Create the up-arrow button, layered above the track.
- if (!upArrow)
- {
- upArrow = new Button();
-
- // It will get enabled later in setScrollProperties().
- upArrow.enabled = false;
-
- // Holding it down will cause continuous scrolling.
- upArrow.autoRepeat = true;
-
- upArrow.focusEnabled = false;
- upArrow.tabEnabled = false;
-
- // This button is a 4-state Button
- // that by default uses the ScrollArrowSkin.
- upArrow.upSkinName = "upArrowUpSkin";
- upArrow.overSkinName = "upArrowOverSkin";
- upArrow.downSkinName = "upArrowDownSkin";
- upArrow.disabledSkinName = "upArrowDisabledSkin";
- upArrow.skinName = "upArrowSkin";
- upArrow.upIconName = "";
- upArrow.overIconName = "";
- upArrow.downIconName = "";
- upArrow.disabledIconName = "";
-
- addChild(upArrow);
-
- upArrow.styleName = new StyleProxy(this, upArrowStyleFilters);
-
- upArrow.validateProperties();
- upArrow.addEventListener(FlexEvent.BUTTON_DOWN, upArrow_buttonDownHandler);
- }
-
- // Create the down-arrow button, layered above the track.
- if (!downArrow)
- {
- downArrow = new Button();
-
- // It will get enabled later in setScrollProperties().
- downArrow.enabled = false;
-
- // Holding it down will cause continuous scrolling.
- downArrow.autoRepeat = true;
-
- downArrow.focusEnabled = false;
- downArrow.tabEnabled = false;
-
- // This button is a 4-state Button
- // that by default uses the ScrollArrowSkin.
- downArrow.upSkinName = "downArrowUpSkin";
- downArrow.overSkinName = "downArrowOverSkin";
- downArrow.downSkinName = "downArrowDownSkin";
- downArrow.disabledSkinName = "downArrowDisabledSkin";
- downArrow.skinName = "downArrowSkin";
- downArrow.upIconName = "";
- downArrow.overIconName = "";
- downArrow.downIconName = "";
- downArrow.disabledIconName = "";
-
- addChild(downArrow);
-
- downArrow.styleName = new StyleProxy(this, downArrowStyleFilters);
-
- downArrow.validateProperties();
- downArrow.addEventListener(FlexEvent.BUTTON_DOWN, downArrow_buttonDownHandler);
- }
- }
-
- /**
- * @private
- * Determine our min width/height based on the up and down
- * arrow sizes.
- */
- override protected function measure():void
- {
- super.measure();
-
- //make sure arrows have required values
- upArrow.validateSize();
- downArrow.validateSize();
- scrollTrack.validateSize();
-
- _minWidth = scrollThumb ? scrollThumb.getExplicitOrMeasuredWidth() : 0;
- _minWidth = Math.max(scrollTrack.getExplicitOrMeasuredWidth(), upArrow.getExplicitOrMeasuredWidth(),
- downArrow.getExplicitOrMeasuredWidth(), _minWidth);
- _minHeight = upArrow.getExplicitOrMeasuredHeight() +
- downArrow.getExplicitOrMeasuredHeight();
- }
-
- /**
- * @private
- * Size changed so re-position everything.
- */
- override protected function updateDisplayList(unscaledWidth:Number,
- unscaledHeight:Number):void
- {
- if ($height == 1)
- return;
-
- if (!upArrow)
- return;
-
- super.updateDisplayList(unscaledWidth, unscaledHeight);
-
- // Turn on bitmap caching whenever we start scrolling. Turn it
- // off whenever we resize the scrollbar (because caching hurts
- // performance during a resize animation)
- if (cacheAsBitmap)
- {
- cacheHeuristic = false;
- if (scrollThumb)
- scrollThumb.cacheHeuristic = false;
- }
-
- upArrow.setActualSize(upArrow.getExplicitOrMeasuredWidth(),
- upArrow.getExplicitOrMeasuredHeight());
- upArrow.move((virtualWidth - upArrow.width) / 2, 0);
-
- scrollTrack.setActualSize(scrollTrack.getExplicitOrMeasuredWidth(), virtualHeight);
-
- scrollTrack.x = (virtualWidth - scrollTrack.width) / 2;
- scrollTrack.y = 0;
-
- downArrow.setActualSize(downArrow.getExplicitOrMeasuredWidth(),
- downArrow.getExplicitOrMeasuredHeight());
- downArrow.move((virtualWidth - downArrow.width) / 2,
- virtualHeight - downArrow.getExplicitOrMeasuredHeight());
-
-
- setScrollProperties(pageSize, minScrollPosition,
- maxScrollPosition, _pageScrollSize);
-
- // Reset thumb position.
- scrollPosition = _scrollPosition;
- }
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Sets the range and viewport size of the ScrollBar control.
- *
- * The ScrollBar control updates the state of the arrow buttons and
- * size of the scroll thumb accordingly.
- *
- * @param pageSize Number which represents the size of one page.
- *
- * @param minScrollPosition Number which represents the bottom of the
- * scrolling range.
- *
- * @param maxScrollPosition Number which represents the top of the
- * scrolling range.
- *
- * @param pageScrollSize Number which represents the increment to move when
- * the scroll track is pressed.
- *
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function setScrollProperties(pageSize:Number,
- minScrollPosition:Number,
- maxScrollPosition:Number,
- pageScrollSize:Number = 0):void
- {
- var thumbHeight:Number;
-
- this.pageSize = pageSize;
-
- _pageScrollSize = (pageScrollSize > 0) ? pageScrollSize : pageSize;
-
- this.minScrollPosition = Math.max(minScrollPosition, 0);
- this.maxScrollPosition = Math.max(maxScrollPosition, 0);
-
- _scrollPosition = Math.max(this.minScrollPosition, _scrollPosition);
- _scrollPosition = Math.min(this.maxScrollPosition, _scrollPosition);
-
- // If the ScrollBar is enabled and has a nonzero range ...
- if (this.maxScrollPosition - this.minScrollPosition > 0 && enabled)
- {
- upArrow.enabled = true;
- downArrow.enabled = true;
- scrollTrack.enabled = true;
-
- addEventListener(MouseEvent.MOUSE_DOWN,
- scrollTrack_mouseDownHandler);
- addEventListener(MouseEvent.MOUSE_OVER,
- scrollTrack_mouseOverHandler);
- addEventListener(MouseEvent.MOUSE_OUT,
- scrollTrack_mouseOutHandler);
-
- if (!scrollThumb)
- {
- scrollThumb = new ScrollThumb();
-
- scrollThumb.focusEnabled = false;
- scrollThumb.tabEnabled = false;
-
- // Add the thumb above the up arrow but below the down arrow
- addChildAt(scrollThumb, getChildIndex(downArrow));
-
- scrollThumb.styleName = new StyleProxy(this, thumbStyleFilters);
-
- // This button is a 4-state Button
- // that by default uses the ScrollThumbSkin.
- scrollThumb.upSkinName = "thumbUpSkin";
- scrollThumb.overSkinName = "thumbOverSkin";
- scrollThumb.downSkinName = "thumbDownSkin";
- scrollThumb.iconName = "thumbIcon";
- scrollThumb.skinName = "thumbSkin";
- }
-
- thumbHeight = trackHeight < 0 ? 0 : Math.round(
- pageSize /
- (this.maxScrollPosition - this.minScrollPosition + pageSize) *
- trackHeight);
-
- if (thumbHeight < scrollThumb.minHeight)
- {
- if (trackHeight < scrollThumb.minHeight)
- {
- scrollThumb.visible = false;
- }
- else
- {
- thumbHeight = scrollThumb.minHeight;
- scrollThumb.visible = true;
- scrollThumb.setActualSize(scrollThumb.measuredWidth, scrollThumb.minHeight);
- }
- }
- else
- {
- scrollThumb.visible = true;
- scrollThumb.setActualSize(scrollThumb.measuredWidth, thumbHeight);
- }
-
- scrollThumb.setRange(upArrow.getExplicitOrMeasuredHeight() + 0,
- virtualHeight -
- downArrow.getExplicitOrMeasuredHeight() -
- scrollThumb.height,
- this.minScrollPosition,
- this.maxScrollPosition);
-
- scrollPosition = Math.max(Math.min(scrollPosition, this.maxScrollPosition), this.minScrollPosition);
- }
- else
- {
- upArrow.enabled = false;
- downArrow.enabled = false;
- scrollTrack.enabled = false;
-
- if (scrollThumb)
- scrollThumb.visible = false;
- }
- }
-
- /**
- * @private
- */
- mx_internal function lineScroll(direction:int):void
- {
- var delta:Number = _lineScrollSize;
-
- var newPos:Number = _scrollPosition + direction * delta;
- if (newPos > maxScrollPosition)
- newPos = maxScrollPosition;
- else if (newPos < minScrollPosition)
- newPos = minScrollPosition;
-
- if (newPos != scrollPosition)
- {
- var oldPosition:Number = scrollPosition;
- scrollPosition = newPos;
- var detail:String = direction < 0 ? lineMinusDetail : linePlusDetail;
- dispatchScrollEvent(oldPosition, detail);
- }
- }
-
- /**
- * @private
- */
- mx_internal function pageScroll(direction:int):void
- {
- var delta:Number = _pageScrollSize != 0 ? _pageScrollSize : pageSize;
-
- var newPos:Number = _scrollPosition + direction * delta;
- if (newPos > maxScrollPosition)
- newPos = maxScrollPosition;
- else if (newPos < minScrollPosition)
- newPos = minScrollPosition;
-
- if (newPos != scrollPosition)
- {
- var oldPosition:Number = scrollPosition;
- scrollPosition = newPos;
- var detail:String = direction < 0 ? pageMinusDetail : pagePlusDetail;
- dispatchScrollEvent(oldPosition, detail);
- }
- }
-
- /**
- * @private
- * Dispatch a scroll event.
- */
- mx_internal function dispatchScrollEvent(oldPosition:Number,
- detail:String):void
- {
- var event:ScrollEvent = new ScrollEvent(ScrollEvent.SCROLL);
- event.detail = detail;
- event.position = scrollPosition;
- event.delta = scrollPosition - oldPosition;
- event.direction = direction;
- dispatchEvent(event);
- }
-
- /**
- * @private
- * Returns true if it is a scrollbar key.
- * It will execute the equivalent code for that key as well.
- */
- mx_internal function isScrollBarKey(key:uint):Boolean
- {
- var oldPosition:Number;
-
- if (key == Keyboard.HOME)
- {
- if (scrollPosition != 0)
- {
- oldPosition = scrollPosition;
- scrollPosition = 0;
- dispatchScrollEvent(oldPosition, minDetail);
- }
- return true;
- }
-
- else if (key == Keyboard.END)
- {
- if (scrollPosition < maxScrollPosition)
- {
- oldPosition = scrollPosition;
- scrollPosition = maxScrollPosition;
- dispatchScrollEvent(oldPosition, maxDetail);
- }
- return true;
- }
-
- return false;
- }
-
- //--------------------------------------------------------------------------
- //
- // Event handlers
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- * Callback when the up-arrow button is pressed or autorepeated.
- */
- private function upArrow_buttonDownHandler(event:FlexEvent):void
- {
- if (isNaN(oldPosition))
- oldPosition = scrollPosition;
-
- lineScroll(-1);
- }
-
- /**
- * @private
- * Callback when the down-arrow button is pressed or autorepeated.
- */
- private function downArrow_buttonDownHandler(event:FlexEvent):void
- {
- if (isNaN(oldPosition))
- oldPosition = scrollPosition;
-
- lineScroll(1);
- }
-
- /**
- * @private
- * Show the over skin of the scrollTrack if there is one.
- */
- private function scrollTrack_mouseOverHandler(event:MouseEvent):void
- {
- if (!(event.target == this || event.target == scrollTrack) || !enabled)
- return;
-
- if (trackScrolling)
- trackScrollTimer.start();
- }
-
- /**
- * @private
- * Hide the over skin of the scrollTrack.
- */
- private function scrollTrack_mouseOutHandler(event:MouseEvent):void
- {
- if (trackScrolling && enabled)
- trackScrollTimer.stop();
- }
-
- /**
- * @private
- * Set up the repeating events when pressing on the track.
- */
- private function scrollTrack_mouseDownHandler(event:MouseEvent):void
- {
- if (!(event.target == this || event.target == scrollTrack) || !enabled)
- return;
-
- trackScrolling = true;
-
- var sbRoot:DisplayObject = systemManager.getSandboxRoot();
- sbRoot.addEventListener(
- MouseEvent.MOUSE_UP, scrollTrack_mouseUpHandler, true);
- sbRoot.addEventListener(
- MouseEvent.MOUSE_MOVE, scrollTrack_mouseMoveHandler, true);
- COMPILE::LATER
- {
- // in case we go offscreen
- sbRoot.addEventListener(
- SandboxMouseEvent.MOUSE_UP_SOMEWHERE, scrollTrack_mouseLeaveHandler);
- systemManager.deployMouseShields(true);
- }
- var pt:Point = new Point(event.localX, event.localY);
- pt = event.target.localToGlobal(pt);
- pt = globalToLocal(pt);
-
- trackPosition = pt.y;
-
- if (isNaN(oldPosition))
- oldPosition = scrollPosition;
-
- trackScrollRepeatDirection =
- scrollThumb.y + scrollThumb.height < pt.y ? 1 :
- scrollThumb.y > pt.y ? -1 : 0;
- pageScroll(trackScrollRepeatDirection);
-
- if (!trackScrollTimer)
- {
- trackScrollTimer = new Timer(getStyle("repeatDelay"), 1);
- trackScrollTimer.addEventListener(TimerEvent.TIMER, trackScrollTimerHandler);
- }
- else
- {
- trackScrollTimer.delay = getStyle("repeatDelay");
- trackScrollTimer.repeatCount = 1;
- }
-
- trackScrollTimer.start();
- }
-
- /**
- * @private
- * This gets called at certain intervals
- * to repeat the scroll event when pressing the track.
- */
- private function trackScrollTimerHandler(event:Event):void
- {
- if (trackScrollRepeatDirection == 1)
- if (scrollThumb.y + scrollThumb.height > trackPosition)
- return;
-
- if (trackScrollRepeatDirection == -1)
- if (scrollThumb.y < trackPosition)
- return;
-
- pageScroll(trackScrollRepeatDirection);
- if (trackScrollTimer && trackScrollTimer.repeatCount == 1)
- {
- trackScrollTimer.delay = getStyle("repeatInterval");
- trackScrollTimer.repeatCount = 0;
- }
- }
-
- /**
- * @private
- * Stop repeating events because the track is no longer pressed
- * special case to restore focus when we've released the mouse
- */
- private function scrollTrack_mouseUpHandler(event:MouseEvent):void
- {
- scrollTrack_mouseLeaveHandler(event);
- }
- private function scrollTrack_mouseLeaveHandler(event:Event):void
- {
- trackScrolling = false;
-
- var sbRoot:DisplayObject = systemManager.getSandboxRoot();
- sbRoot.removeEventListener(
- MouseEvent.MOUSE_UP, scrollTrack_mouseUpHandler, true);
- sbRoot.removeEventListener(
- MouseEvent.MOUSE_MOVE, scrollTrack_mouseMoveHandler, true);
- // in case we go offscreen
- COMPILE::LATER
- {
- sbRoot.removeEventListener(
- SandboxMouseEvent.MOUSE_UP_SOMEWHERE, scrollTrack_mouseLeaveHandler);
- }
- systemManager.deployMouseShields(false);
-
- if (trackScrollTimer)
- trackScrollTimer.reset();
-
- if (event.target != scrollTrack)
- return;
-
- var detail:String = oldPosition > scrollPosition ?
- pageMinusDetail :
- pagePlusDetail;
- dispatchScrollEvent(oldPosition, detail);
-
- oldPosition = NaN;
- }
-
- /**
- * @private
- * Stop repeating events because the track is no longer pressed
- * special case to restore focus when we've released the mouse
- */
- private function scrollTrack_mouseMoveHandler(event:MouseEvent):void
- {
- if (trackScrolling)
- {
- var pt:Point = new Point(event.stageX, event.stageY);
- pt = globalToLocal(pt);
- trackPosition = pt.y;
- }
- }
-
-}
-
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/Application.as b/frameworks/projects/MX/src/main/flex/mx/core/Application.as
index ec69d69..57cd9ec 100644
--- a/frameworks/projects/MX/src/main/flex/mx/core/Application.as
+++ b/frameworks/projects/MX/src/main/flex/mx/core/Application.as
@@ -1048,9 +1048,17 @@ public class Application extends LayoutContainer
var sm:ISystemManager = systemManager;
- _url = LoaderUtil.normalizeURL(sm.loaderInfo);
- _parameters = sm.loaderInfo.parameters;
-
+ COMPILE::AS3
+ {
+ _url = LoaderUtil.normalizeURL(root.loaderInfo);
+ _parameters = root.loaderInfo.parameters;
+ }
+ COMPILE::JS
+ {
+ _url = LoaderUtil.normalizeURL(window.location.href);
+ _parameters = makeParameters(window.location.search);
+ }
+
initManagers(sm);
_descriptor = null;
@@ -1205,6 +1213,8 @@ public class Application extends LayoutContainer
objData.width = width;
objData.height = height;
+ COMPILE::LATER
+ {
objData.verticalScrollPosition = verticalScrollPosition;
objData.horizontalScrollPosition = horizontalScrollPosition;
@@ -1223,7 +1233,7 @@ public class Application extends LayoutContainer
if (verticalScrollBar)
verticalScrollBar.visible = false;
-
+ }
if (whiteBox)
whiteBox.visible = false;
@@ -1247,6 +1257,8 @@ public class Application extends LayoutContainer
{
setActualSize(obj.width, obj.height);
+ COMPILE::LATER
+ {
if (horizontalScrollBar)
horizontalScrollBar.visible = obj.horizontalScrollBarVisible;
if (verticalScrollBar)
@@ -1257,7 +1269,7 @@ public class Application extends LayoutContainer
horizontalScrollPosition = obj.horizontalScrollPosition;
verticalScrollPosition = obj.verticalScrollPosition;
-
+ }
updateDisplayList(unscaledWidth, unscaledHeight);
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/core/Container.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/Container.as b/frameworks/projects/MX/src/main/flex/mx/core/Container.as
index fe02073..86dab78 100644
--- a/frameworks/projects/MX/src/main/flex/mx/core/Container.as
+++ b/frameworks/projects/MX/src/main/flex/mx/core/Container.as
@@ -28,12 +28,8 @@ COMPILE::AS3
import flash.display.InteractiveObject;
import flash.display.Loader;
import flash.display.Shape;
- import flash.display.Sprite;
import flash.events.Event;
- import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
- import flash.geom.Point;
- import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextLineMetrics;
import flash.ui.Keyboard;
@@ -46,16 +42,17 @@ COMPILE::JS
import flex.display.InteractiveObject;
import flex.display.Loader;
import flex.display.Shape;
- import flex.display.Sprite;
import flex.events.Event;
- import flex.events.KeyboardEvent;
import flex.events.MouseEvent;
- import flex.geom.Point;
- import flex.geom.Rectangle;
import flex.text.TextField;
import flex.text.TextLineMetrics;
import flex.ui.Keyboard;
}
+import flex.display.Sprite;
+import org.apache.flex.geom.Point;
+import org.apache.flex.geom.Rectangle;
+import org.apache.flex.utils.PointUtils;
+import mx.events.KeyboardEvent;
import flex.system.DefinitionManager;
import org.apache.flex.reflection.getDefinitionByName;
@@ -529,7 +526,11 @@ public class Container extends UIComponent
mx_internal function getLayoutChildAt(index:int):IUIComponent
{
+ COMPILE::LATER
+ {
return PostScaleAdapter.getCompatibleIUIComponent(getChildAt(index));
+ }
+ return getChildAt(index) as IUIComponent;
}
//--------------------------------------------------------------------------
@@ -832,12 +833,15 @@ public class Container extends UIComponent
{
super.enabled = value;
+ COMPILE::LATER
+ {
// Scrollbars must be enabled/disabled when this container is.
if (horizontalScrollBar)
horizontalScrollBar.enabled = value;
if (verticalScrollBar)
verticalScrollBar.enabled = value;
-
+ }
+
invalidateProperties();
if (border && border is IInvalidating)
@@ -1570,6 +1574,7 @@ public class Container extends UIComponent
* @private
* The horizontal scrollbar (null if not present).
*/
+ COMPILE::LATER
private var _horizontalScrollBar:ScrollBar;
/**
@@ -1586,6 +1591,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.1
* @productversion Flex 3
*/
+ COMPILE::LATER
public function get horizontalScrollBar():ScrollBar
{
return _horizontalScrollBar;
@@ -1594,6 +1600,7 @@ public class Container extends UIComponent
/**
* @private
*/
+ COMPILE::LATER
public function set horizontalScrollBar(value:ScrollBar):void
{
_horizontalScrollBar = value;
@@ -1607,6 +1614,7 @@ public class Container extends UIComponent
* @private
* Storage for the horizontalScrollPosition property.
*/
+ COMPILE::LATER
private var _horizontalScrollPosition:Number = 0;
[Bindable("scroll")]
@@ -1626,6 +1634,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.1
* @productversion Flex 3
*/
+ COMPILE::LATER
public function get horizontalScrollPosition():Number
{
if (!isNaN(horizontalScrollPositionPending))
@@ -1636,6 +1645,7 @@ public class Container extends UIComponent
/**
* @private
*/
+ COMPILE::LATER
public function set horizontalScrollPosition(value:Number):void
{
if (_horizontalScrollPosition == value)
@@ -1668,6 +1678,7 @@ public class Container extends UIComponent
* @private
* Storage for the horizontalScrollPolicy property.
*/
+ COMPILE::LATER
mx_internal var _horizontalScrollPolicy:String = ScrollPolicy.AUTO;
[Bindable("horizontalScrollPolicyChanged")]
@@ -1704,6 +1715,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.1
* @productversion Flex 3
*/
+ COMPILE::LATER
public function get horizontalScrollPolicy():String
{
return _horizontalScrollPolicy;
@@ -1712,6 +1724,7 @@ public class Container extends UIComponent
/**
* @private
*/
+ COMPILE::LATER
public function set horizontalScrollPolicy(value:String):void
{
if (_horizontalScrollPolicy != value)
@@ -1835,6 +1848,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.1
* @productversion Flex 3
*/
+ COMPILE::LATER
public function get maxHorizontalScrollPosition():Number
{
return horizontalScrollBar ?
@@ -1856,6 +1870,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.1
* @productversion Flex 3
*/
+ COMPILE::LATER
public function get maxVerticalScrollPosition():Number
{
return verticalScrollBar ?
@@ -2106,6 +2121,7 @@ public class Container extends UIComponent
* @private
* The vertical scrollbar (null if not present).
*/
+ COMPILE::LATER
private var _verticalScrollBar:ScrollBar;
/**
@@ -2122,6 +2138,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.1
* @productversion Flex 3
*/
+ COMPILE::LATER
public function get verticalScrollBar():ScrollBar
{
return _verticalScrollBar;
@@ -2130,6 +2147,7 @@ public class Container extends UIComponent
/**
* @private
*/
+ COMPILE::LATER
public function set verticalScrollBar(value:ScrollBar):void
{
_verticalScrollBar = value;
@@ -2143,6 +2161,7 @@ public class Container extends UIComponent
* @private
* Storage for the verticalScrollPosition property.
*/
+ COMPILE::LATER
private var _verticalScrollPosition:Number = 0;
[Bindable("scroll")]
@@ -2162,6 +2181,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.1
* @productversion Flex 3
*/
+ COMPILE::LATER
public function get verticalScrollPosition():Number
{
if (!isNaN(verticalScrollPositionPending))
@@ -2173,6 +2193,7 @@ public class Container extends UIComponent
/**
* @private
*/
+ COMPILE::LATER
public function set verticalScrollPosition(value:Number):void
{
if (_verticalScrollPosition == value)
@@ -2205,6 +2226,7 @@ public class Container extends UIComponent
* @private
* Storage for the verticalScrollPolicy property.
*/
+ COMPILE::LATER
mx_internal var _verticalScrollPolicy:String = ScrollPolicy.AUTO;
[Bindable("verticalScrollPolicyChanged")]
@@ -2241,6 +2263,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.1
* @productversion Flex 3
*/
+ COMPILE::LATER
public function get verticalScrollPolicy():String
{
return _verticalScrollPolicy;
@@ -2249,6 +2272,7 @@ public class Container extends UIComponent
/**
* @private
*/
+ COMPILE::LATER
public function set verticalScrollPolicy(value:String):void
{
if (_verticalScrollPolicy != value)
@@ -2312,6 +2336,8 @@ public class Container extends UIComponent
// out our children. That way, children that have a percentage width or
// percentage height will only expand to consume space that's left over
// after leaving room for the scrollbars.
+ COMPILE::LATER
+ {
var verticalScrollBarIncluded:Boolean =
verticalScrollBar != null &&
(doingLayout || verticalScrollPolicy == ScrollPolicy.ON);
@@ -2320,7 +2346,7 @@ public class Container extends UIComponent
(doingLayout || horizontalScrollPolicy == ScrollPolicy.ON);
if (!verticalScrollBarIncluded && !horizontalScrollBarIncluded)
return bm;
-
+ }
// The viewMetrics property needs to return its own object.
// Rather than allocating a new one each time, we'll allocate one once
// and then hold a reference to it.
@@ -2336,11 +2362,13 @@ public class Container extends UIComponent
_viewMetrics.bottom = bm.bottom;
}
+ COMPILE::LATER
+ {
if (verticalScrollBarIncluded)
_viewMetrics.right += verticalScrollBar.minWidth;
if (horizontalScrollBarIncluded)
_viewMetrics.bottom += horizontalScrollBar.minHeight;
-
+ }
return _viewMetrics;
}
@@ -2381,6 +2409,8 @@ public class Container extends UIComponent
// depending on whether we're doing layout or not.
// In that case, we can't use a cached value.
// In all other cases, use the cached value if it exists.
+ COMPILE::LATER
+ {
if (_viewMetricsAndPadding &&
(!horizontalScrollBar ||
horizontalScrollPolicy == ScrollPolicy.ON) &&
@@ -2389,7 +2419,8 @@ public class Container extends UIComponent
{
return _viewMetricsAndPadding;
}
-
+ }
+
if (!_viewMetricsAndPadding)
_viewMetricsAndPadding = new EdgeMetrics();
@@ -2963,22 +2994,9 @@ public class Container extends UIComponent
* @playerversion AIR 1.5
* @productversion Flex 4
*/
- public function get numElements():int
+ override public function getElementAt(index:int):IVisualElement
{
- return numChildren;
- }
-
- /**
- * @inheritDoc
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 1.5
- * @productversion Flex 4
- */
- public function getElementAt(index:int):IVisualElement
- {
- return getChildAt(index) as IVisualElement;
+ return super.getElementAt(index) as IVisualElement;
}
/**
@@ -2989,12 +3007,9 @@ public class Container extends UIComponent
* @playerversion AIR 1.5
* @productversion Flex 4
*/
- public function getElementIndex(element:IVisualElement):int
+ override public function getElementIndex(element:IVisualElement):int
{
- if (! (element is DisplayObject) )
- throw ArgumentError(element + " is not found in this Container");
-
- return getChildIndex(element as DisplayObject);
+ return super.getElementIndex(element);
}
/**
@@ -3066,7 +3081,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.5
* @productversion Flex 4
*/
- public function removeAllElements():void
+ override public function removeAllElements():void
{
for (var i:int = numElements - 1; i >= 0; i--)
{
@@ -3174,6 +3189,8 @@ public class Container extends UIComponent
// Create the border/background object.
createBorder();
+ COMPILE::LATER
+ {
// To save ourselves an extra layout pass, check to see
// if the scrollbars will definitely be needed.
// If so, create them now.
@@ -3182,7 +3199,8 @@ public class Container extends UIComponent
verticalScrollPolicy == ScrollPolicy.ON,
horizontalScrollPolicy == ScrollPolicy.ON ||
verticalScrollPolicy == ScrollPolicy.ON);
-
+ }
+
// Determine the child-creation policy (ContainerCreationPolicy.AUTO,
// ContainerCreationPolicy.ALL, or ContainerCreationPolicy.NONE).
// If the author has specified a policy, use it.
@@ -3281,7 +3299,10 @@ public class Container extends UIComponent
changedStyles = null;
}
+ COMPILE::LATER
+ {
createOrDestroyBlocker();
+ }
}
/**
@@ -3305,7 +3326,10 @@ public class Container extends UIComponent
ILayoutManagerClient (child).validateSize(true);
}
}
+ COMPILE::LATER
+ {
adjustSizesForScaleChanges();
+ }
}
else
{
@@ -3365,9 +3389,11 @@ public class Container extends UIComponent
// is resized to be larger, the new max scroll positions
// are reduced and the current scroll positions
// will be invalid unless we clamp them.
+ COMPILE::LATER
+ {
if (clampScrollPositions())
scrollChildren();
-
+ }
if (contentPane)
{
vm = viewMetrics;
@@ -3381,6 +3407,8 @@ public class Container extends UIComponent
effectOverlay.height = unscaledHeight;
}
+ COMPILE::LATER
+ {
// Set the positions and sizes of the scrollbars.
if (horizontalScrollBar || verticalScrollBar)
{
@@ -3436,7 +3464,6 @@ public class Container extends UIComponent
whiteBox.y = horizontalScrollBar.y;
}
}
-
contentPane.x = vm.left;
contentPane.y = vm.top;
@@ -3447,6 +3474,7 @@ public class Container extends UIComponent
}
scrollChildren();
+ }
}
invalidateDisplayListFlag = false;
@@ -3527,6 +3555,8 @@ public class Container extends UIComponent
layoutChrome(unscaledWidth, unscaledHeight);
+ COMPILE::LATER
+ {
if (scrollPositionChanged)
{
clampScrollPositions();
@@ -3594,6 +3624,7 @@ public class Container extends UIComponent
// text anti-aliasing issue with device text on Windows).
contentPane.cacheAsBitmap = (backgroundColor != null);
}
+ }
}
/**
@@ -3607,9 +3638,9 @@ public class Container extends UIComponent
override public function contentToGlobal(point:Point):Point
{
if (contentPane)
- return contentPane.localToGlobal(point);
+ return PointUtils.localToGlobal(point, contentPane);
- return localToGlobal(point);
+ return PointUtils.localToGlobal(point, this);
}
/**
@@ -3623,9 +3654,9 @@ public class Container extends UIComponent
override public function globalToContent(point:Point):Point
{
if (contentPane)
- return contentPane.globalToLocal(point);
+ return PointUtils.globalToLocal(point, contentPane);
- return globalToLocal(point);
+ return PointUtils.globalToLocal(point, this);
}
/**
@@ -3642,7 +3673,7 @@ public class Container extends UIComponent
return point;
point = contentToGlobal(point);
- return globalToLocal(point);
+ return PointUtils.globalToLocal(point, this);
}
/**
@@ -3658,7 +3689,7 @@ public class Container extends UIComponent
if (!contentPane)
return point;
- point = localToGlobal(point);
+ point = PointUtils.localToGlobal(point, this);
return globalToContent(point);
}
@@ -3713,6 +3744,8 @@ public class Container extends UIComponent
invalidateViewMetricsAndPadding();
}
+ COMPILE::LATER
+ {
if (allStyles || styleProp == "horizontalScrollBarStyleName")
{
if (horizontalScrollBar && horizontalScrollBar is ISimpleStyleClient)
@@ -3734,6 +3767,7 @@ public class Container extends UIComponent
verticalScrollBarStyleName;
}
}
+ }
}
/**
@@ -3916,14 +3950,21 @@ public class Container extends UIComponent
*/
override public function prepareToPrint(target:IFlexDisplayObject):Object
{
+ COMPILE::LATER
+ {
var rect:Rectangle = (contentPane && contentPane.scrollRect) ? contentPane.scrollRect : null;
if (rect)
contentPane.scrollRect = null;
-
+ }
+
super.prepareToPrint(target);
+ COMPILE::LATER
+ {
return rect;
+ }
+ return null;
}
/**
@@ -4447,14 +4488,19 @@ public class Container extends UIComponent
// This should be the last step in initializing the child, so that
// it can't be referenced until initialization is complete.
// However, it must be done before executing executeBindings().
+ COMPILE::LATER
+ {
child.createReferenceOnParentDocument(
IFlexDisplayObject(childDescriptor.document));
+ }
if (!child.document)
child.document = childDescriptor.document;
// Repeaters don't get added as children of the Container,
// so they have their own initialization sequence.
+ COMPILE::LATER
+ {
if (child is IRepeater)
{
// Add this repeater to the list maintained by the parent
@@ -4484,6 +4530,19 @@ public class Container extends UIComponent
creationCompleteHandler);
}
}
+ }
+ // This needs to run before child.executeBindings(), because
+ // executeBindings() depends on the parent being set.
+ addChild(DisplayObject(child));
+
+ child.executeBindings();
+
+ if (creationPolicy == ContainerCreationPolicy.QUEUED ||
+ creationPolicy == ContainerCreationPolicy.NONE)
+ {
+ child.addEventListener(FlexEvent.CREATION_COMPLETE,
+ creationCompleteHandler);
+ }
// Return a reference to the child UIComponent that was just created.
return child;
@@ -4900,6 +4959,7 @@ public class Container extends UIComponent
/**
* @private
*/
+ COMPILE::LATER
private function createOrDestroyBlocker():void
{
// If this container is being enabled and a blocker exists,
@@ -5015,8 +5075,11 @@ public class Container extends UIComponent
}
else
{
+ COMPILE::LATER
+ {
changed = createOrDestroyScrollbars(false, false, false);
-
+ }
+
// Get scrollableWidth and scrollableHeight for scrollChildren()
bounds = getScrollableRect();
scrollableWidth = bounds.right;
@@ -5052,7 +5115,11 @@ public class Container extends UIComponent
{
if (!IUIComponent(child).includeInLayout)
continue;
+ COMPILE::LATER
+ {
var uic:IUIComponent = PostScaleAdapter.getCompatibleIUIComponent(child);
+ }
+ var uic:IUIComponent = child as IUIComponent;
width = uic.width;
height = uic.height;
x = uic.x;
@@ -5131,19 +5198,27 @@ public class Container extends UIComponent
newScrollableWidth = Math.floor(newScrollableWidth);
newScrollableHeight = Math.floor(newScrollableHeight);
+ COMPILE::LATER
+ {
if (horizontalScrollBar && horizontalScrollPolicy != ScrollPolicy.ON)
newViewableHeight -= horizontalScrollBar.minHeight;
if (verticalScrollBar && verticalScrollPolicy != ScrollPolicy.ON)
newViewableWidth -= verticalScrollBar.minWidth;
-
+ }
+
newViewableWidth -= (vm.left + vm.right);
newViewableHeight -= (vm.top + vm.bottom);
+ COMPILE::LATER
+ {
var needHorizontal:Boolean =
horizontalScrollPolicy == ScrollPolicy.ON;
var needVertical:Boolean =
verticalScrollPolicy == ScrollPolicy.ON;
-
+ }
+
+ COMPILE::LATER
+ {
var needContentPane:Boolean =
needHorizontal ||
needVertical ||
@@ -5151,6 +5226,12 @@ public class Container extends UIComponent
effectOverlay != null ||
vm.left > 0 ||
vm.top > 0;
+ }
+ var needContentPane:Boolean =
+ hasNegativeCoords ||
+ effectOverlay != null ||
+ vm.left > 0 ||
+ vm.top > 0;
// These "if" statements are tuned for the most common case,
// which is that the Container does not need scrollbars.
@@ -5161,25 +5242,33 @@ public class Container extends UIComponent
// Don't display scrollbars if the Container is so small
// that scrollbars would occlude everything else
// or the scrollbar buttons would overlap.
+ COMPILE::LATER
+ {
if (horizontalScrollPolicy == ScrollPolicy.AUTO &&
unscaledHeight - vm.top - vm.bottom >= 18 &&
unscaledWidth - vm.left - vm.right >= 32)
{
needHorizontal = true;
}
+ }
}
if (newViewableHeight < newScrollableHeight)
{
needContentPane = true;
+ COMPILE::LATER
+ {
if (verticalScrollPolicy == ScrollPolicy.AUTO &&
unscaledWidth - vm.left - vm.right >= 18 &&
unscaledHeight - vm.top - vm.bottom >= 32)
{
needVertical = true;
}
+ }
}
+ COMPILE::LATER
+ {
// Fix for 106095. The logic here says "if removing the scrollbars
// would make enough room to display the view's children, then remove
// the scrollbars".
@@ -5210,7 +5299,6 @@ public class Container extends UIComponent
var changed:Boolean = createOrDestroyScrollbars(
needHorizontal, needVertical, needContentPane);
-
if ((scrollableWidth != newScrollableWidth ||
viewableWidth != newViewableWidth) ||
changed)
@@ -5246,11 +5334,14 @@ public class Container extends UIComponent
}
return changed;
+ }
+ return false
}
/**
* @private
*/
+ COMPILE::LATER
private function createOrDestroyScrollbars(
needHorizontal:Boolean,
needVertical:Boolean,
@@ -5426,6 +5517,7 @@ public class Container extends UIComponent
* Returns true if either horizontalScrollPosition or
* verticalScrollPosition was changed to ensure this.
*/
+ COMPILE::LATER
private function clampScrollPositions():Boolean
{
var changed:Boolean = false;
@@ -5491,7 +5583,11 @@ public class Container extends UIComponent
// because that changes logic of how many children we have
var n:int = numChildren;
- var newPane:Sprite = new FlexSprite();
+ COMPILE::LATER
+ {
+ var newPane:Sprite = new FlexSprite();
+ }
+ var newPane:Sprite = new Sprite();
newPane.name = "contentPane";
// Place content pane above border and background image but below
@@ -5541,6 +5637,7 @@ public class Container extends UIComponent
* @playerversion AIR 1.1
* @productversion Flex 3
*/
+ COMPILE::LATER
protected function scrollChildren():void
{
if (!contentPane)
@@ -5600,6 +5697,7 @@ public class Container extends UIComponent
/**
* @private
*/
+ COMPILE::LATER
private function dispatchScrollEvent(direction:String,
oldPosition:Number,
newPosition:Number,
@@ -5629,7 +5727,10 @@ public class Container extends UIComponent
_forceClippingCount--;
createContentPane();
+ COMPILE::LATER
+ {
scrollChildren();
+ }
}
}
@@ -5696,6 +5797,8 @@ public class Container extends UIComponent
var direction:String;
var oldPos:Number;
+ COMPILE::LATER
+ {
if (verticalScrollBar)
{
direction = ScrollEventDirection.VERTICAL;
@@ -5800,6 +5903,7 @@ public class Container extends UIComponent
}
}
}
+ }
}
//--------------------------------------------------------------------------
@@ -5812,6 +5916,7 @@ public class Container extends UIComponent
* @private
* This method copied verbatim from mx.core.ScrollControlBase.
*/
+ COMPILE::LATER
private function mouseWheelHandler(event:MouseEvent):void
{
// If this Container has a vertical scrollbar, then handle the event
@@ -5853,6 +5958,8 @@ public class Container extends UIComponent
FlexEvent.UPDATE_COMPLETE, layoutCompleteHandler);
forceLayout = false;
+ COMPILE::LATER
+ {
var needToScrollChildren:Boolean = false;
if (!isNaN(horizontalScrollPositionPending))
@@ -5898,6 +6005,8 @@ public class Container extends UIComponent
if (needToScrollChildren)
scrollChildren();
+ }
+
}
/**
@@ -5915,6 +6024,7 @@ public class Container extends UIComponent
* This method is called if the user interactively moves
* the horizontal scrollbar thumb.
*/
+ COMPILE::LATER
private function horizontalScrollBar_scrollHandler(event:Event):void
{
// TextField.scroll bubbles so you might see it here
@@ -5935,6 +6045,7 @@ public class Container extends UIComponent
* This method is called if the user interactively moves
* the vertical scrollbar thumb.
*/
+ COMPILE::LATER
private function verticalScrollBar_scrollHandler(event:Event):void
{
// TextField.scroll bubbles so you might see it here
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c4cb764e/frameworks/projects/MX/src/main/flex/mx/core/ContainerRawChildrenList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/core/ContainerRawChildrenList.as b/frameworks/projects/MX/src/main/flex/mx/core/ContainerRawChildrenList.as
new file mode 100644
index 0000000..d668440
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/core/ContainerRawChildrenList.as
@@ -0,0 +1,227 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
+
+use namespace mx_internal;
+
+[ExcludeClass]
+
+/**
+ * @private
+ * Helper class for the rawChildren property of the Container class.
+ * For descriptions of the properties and methods,
+ * see the IChildList interface.
+ *
+ * @see mx.core.Container
+ */
+public class ContainerRawChildrenList implements IChildList
+{
+ include "../core/Version.as";
+
+ //--------------------------------------------------------------------------
+ //
+ // Notes
+ //
+ //--------------------------------------------------------------------------
+
+ /*
+
+ Although at the level of a Flash DisplayObjectContainer, all
+ children are equal, in a Flex Container some children are "more
+ equal than others". (George Orwell, "Animal Farm")
+
+ In particular, Flex distinguishes between content children and
+ non-content (or "chrome") children. Content children are the kind
+ that can be specified in MXML. If you put several controls
+ into a VBox, those are its content children. Non-content children
+ are the other ones that you get automatically, such as a
+ background/border, scrollbars, the titlebar of a Panel,
+ AccordionHeaders, etc.
+
+ Most application developers are uninterested in non-content children,
+ so Container overrides APIs such as numChildren and getChildAt()
+ to deal only with content children. For example, Container, keeps
+ its own _numChildren counter.
+
+ However, developers of custom containers need to be able to deal
+ with both content and non-content children, so they require similar
+ APIs that operate on all children.
+
+ For the public API, it would be ugly to have double APIs on Container
+ such as getChildAt() and all_getChildAt(). Instead, Container has
+ a public rawChildren property which lets you access APIs which
+ operate on all the children, in the same way that the
+ DisplayObjectContainer APIs do. For example, getChildAt(0) returns
+ the first content child, while rawChildren.getChildAt(0) returns
+ the first child (either content or non-content).
+
+ This ContainerRawChildrenList class implements the rawChildren
+ property. Note that it simply calls a second set of parallel
+ mx_internal APIs in Container. (They're named, for example,
+ _getChildAt() instead of all_getChildAt()).
+
+ Many of the all-children APIs in Container such as _getChildAt()
+ simply call super.getChildAt() in order to get the implementation
+ in DisplayObjectContainer. It would be nice if we could eliminate
+ _getChildAt() in Container and simply implement the all-children
+ version in this class by calling the DisplayObjectContainer method.
+ But once Container overrides getChildAt(), there is no way
+ to call the supermethod through an instance.
+
+ */
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ * Constructor.
+ */
+ public function ContainerRawChildrenList(owner:Container)
+ {
+ super();
+
+ this.owner = owner;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Variables
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ private var owner:Container;
+
+ //--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+ //--------------------------------------------------------------------------
+
+ //----------------------------------
+ // numChildren
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ public function get numChildren():int
+ {
+ return owner.$numChildren;
+ }
+
+ //--------------------------------------------------------------------------
+ //
+ // Methods
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ public function addChild(child:DisplayObject):DisplayObject
+ {
+ return owner.rawChildren_addChild(child);
+ }
+
+ /**
+ * @private
+ */
+ public function addChildAt(child:DisplayObject, index:int):DisplayObject
+ {
+ return owner.rawChildren_addChildAt(child, index);
+ }
+
+ /**
+ * @private
+ */
+ public function removeChild(child:DisplayObject):DisplayObject
+ {
+ return owner.rawChildren_removeChild(child);
+ }
+
+ /**
+ * @private
+ */
+ public function removeChildAt(index:int):DisplayObject
+ {
+ return owner.rawChildren_removeChildAt(index);
+ }
+
+ /**
+ * @private
+ */
+ public function getChildAt(index:int):DisplayObject
+ {
+ return owner.rawChildren_getChildAt(index);
+ }
+
+ /**
+ * @private
+ */
+ public function getChildByName(name:String):DisplayObject
+ {
+ return owner.rawChildren_getChildByName(name);
+ }
+
+ /**
+ * @private
+ */
+ public function getChildIndex(child:DisplayObject):int
+ {
+ return owner.rawChildren_getChildIndex(child);
+ }
+
+ /**
+ * @private
+ */
+ public function setChildIndex(child:DisplayObject, newIndex:int):void
+ {
+ owner.rawChildren_setChildIndex(child, newIndex);
+ }
+
+ /**
+ * @private
+ */
+ public function getObjectsUnderPoint(point:Point):Array
+ {
+ return owner.rawChildren_getObjectsUnderPoint(point);
+ }
+
+ /**
+ * @private
+ */
+ public function contains(child:DisplayObject):Boolean
+ {
+ return owner.rawChildren_contains(child);
+ }
+}
+
+}