http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d43c133c/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-FlowLayout/srcview/src/skins/TDFPanelSkin.mxml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-FlowLayout/srcview/src/skins/TDFPanelSkin.mxml b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-FlowLayout/srcview/src/skins/TDFPanelSkin.mxml new file mode 100644 index 0000000..f9151dc --- /dev/null +++ b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-FlowLayout/srcview/src/skins/TDFPanelSkin.mxml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + /* Define the skin elements that should not be colorized. + For panel, border and title backround are skinned, but the content area and title text are not. */ + static private const exclusions:Array = ["background", "titleDisplay", "contentGroup", "bgFill"]; + + /** + * @copy spark.skins.SparkSkin#colorizeExclusions + */ + override public function get colorizeExclusions():Array {return exclusions;} + + /* Define the content fill items that should be colored by the "contentBackgroundColor" style. */ + static private const contentFill:Array = []; + + /** + * @inheritDoc + */ + override public function get contentItems():Array {return contentFill}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d43c133c/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/sample.html ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/sample.html b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/sample.html new file mode 100644 index 0000000..8d05dc2 --- /dev/null +++ b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/sample.html @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + +
+

+ To view this page ensure that Adobe Flash Player version + 10.0.0 or greater is installed. +

+ +
+ + + + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d43c133c/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceIndex.xml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceIndex.xml b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceIndex.xml new file mode 100644 index 0000000..08821ae --- /dev/null +++ b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceIndex.xml @@ -0,0 +1,47 @@ + + + + Source of Sample-Flex4-CustomLayout-HLayoutBaseline + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d43c133c/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceStyles.css ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceStyles.css b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceStyles.css new file mode 100644 index 0000000..9d5210f --- /dev/null +++ b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceStyles.css @@ -0,0 +1,155 @@ +/* + * 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. + */ +body { + font-family: Courier New, Courier, monospace; + font-size: medium; +} + +.ActionScriptASDoc { + color: #3f5fbf; +} + +.ActionScriptBracket/Brace { +} + +.ActionScriptComment { + color: #009900; + font-style: italic; +} + +.ActionScriptDefault_Text { +} + +.ActionScriptMetadata { + color: #0033ff; + font-weight: bold; +} + +.ActionScriptOperator { +} + +.ActionScriptReserved { + color: #0033ff; + font-weight: bold; +} + +.ActionScriptString { + color: #990000; + font-weight: bold; +} + +.ActionScriptclass { + color: #9900cc; + font-weight: bold; +} + +.ActionScriptfunction { + color: #339966; + font-weight: bold; +} + +.ActionScriptinterface { + color: #9900cc; + font-weight: bold; +} + +.ActionScriptpackage { + color: #9900cc; + font-weight: bold; +} + +.ActionScripttrace { + color: #cc6666; + font-weight: bold; +} + +.ActionScriptvar { + color: #6699cc; + font-weight: bold; +} + +.MXMLASDoc { + color: #3f5fbf; +} + +.MXMLComment { + color: #800000; +} + +.MXMLComponent_Tag { + color: #0000ff; +} + +.MXMLDefault_Text { +} + +.MXMLProcessing_Instruction { +} + +.MXMLSpecial_Tag { + color: #006633; +} + +.MXMLString { + color: #990000; +} + +.CSS@font-face { + color: #990000; + font-weight: bold; +} + +.CSS@import { + color: #006666; + font-weight: bold; +} + +.CSS@media { + color: #663333; + font-weight: bold; +} + +.CSS@namespace { + color: #923196; +} + +.CSSComment { + color: #999999; +} + +.CSSDefault_Text { +} + +.CSSDelimiters { +} + +.CSSProperty_Name { + color: #330099; +} + +.CSSProperty_Value { + color: #3333cc; +} + +.CSSSelector { + color: #ff00ff; +} + +.CSSString { + color: #990000; +} + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d43c133c/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceTree.html ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceTree.html b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceTree.html new file mode 100644 index 0000000..80281a9 --- /dev/null +++ b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/SourceTree.html @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + +
+

+ To view this page ensure that Adobe Flash Player version + 10.0.0 or greater is installed. +

+ +
+ + + + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d43c133c/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/index.html ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/index.html b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/index.html new file mode 100644 index 0000000..0bdfafb --- /dev/null +++ b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/index.html @@ -0,0 +1,32 @@ + + + + + + +Source of Sample-Flex4-CustomLayout-HLayoutBaseline + + + + + + + <body> + </body> + + http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d43c133c/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/source/HBaselineLayout.as.html ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/source/HBaselineLayout.as.html b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/source/HBaselineLayout.as.html new file mode 100644 index 0000000..7867059 --- /dev/null +++ b/TourDeFlex/TourDeFlex_content/flex4.0/CustomLayout-HLayoutBaseline/srcview/source/HBaselineLayout.as.html @@ -0,0 +1,207 @@ + + + + + + +HBaselineLayout.as + + + +
package {
+
+import mx.core.ILayoutElement;
+import mx.events.PropertyChangeEvent;
+import mx.formatters.NumberBase;
+
+import spark.components.supportClasses.GroupBase;
+import spark.layouts.HorizontalLayout;
+
+public class HBaselineLayout extends HorizontalLayout
+{
+    public function HBaselineLayout()
+    {
+        super();
+    }
+
+    //----------------------------------
+    //  globalBaseline
+    //----------------------------------
+    
+    [Inspectable("General")]
+
+    private var _globalBaseline:Number = NaN;
+    public function get globalBaseline():Number
+    {
+        return _globalBaseline;
+    }
+
+    public function set globalBaseline(value:Number):void
+    {
+        _globalBaseline = value;
+        var target:GroupBase = this.target;
+        if (target)
+        {
+            target.invalidateSize();
+            target.invalidateDisplayList();
+        }
+    }
+
+    //----------------------------------
+    //  actualBaseline
+    //----------------------------------
+    
+    private var _actualBaseline:Number;
+    
+    [Bindable("propertyChange")]
+    [Inspectable("General")]
+    
+    public function get actualBaseline():Number
+    {
+        return _actualBaseline;
+    }
+    
+    private function setActualBaseline(value:Number):void
+    {
+        if (value == _actualBaseline)
+            return;
+
+        var oldValue:Number = _actualBaseline;
+        _actualBaseline = value;
+        dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "actualBaseline", oldValue, value));
+    }
+    
+    //----------------------------------
+    //  verticalAlign
+    //----------------------------------
+    
+    [Inspectable("General", enumeration="top,bottom,middle,justify,contentJustify,baseline", defaultValue="top")]
+    override public function get verticalAlign():String
+    {
+        return super.verticalAlign;        
+    }
+
+    /**
+     *  @private 
+     */
+    override public function measure():void
+    {
+        super.measure();
+        
+        var target:GroupBase = this.target;
+        if (!target || verticalAlign != "baseline")
+            return;
+        
+        measureBaseline(true /*usePreferredSize*/);
+        if (!isNaN(_globalBaseline))
+            measuredBaselineTop = _globalBaseline;
+        
+        // The measured height is the sum of the space above and below the baseline
+        if (isNaN(paddingTop))
+            measuredBaselineTop += paddingTop;
+        if (isNaN(paddingBottom))
+            measuredBaselineBottom += paddingBottom;
+        target.measuredHeight = Math.round(measuredBaselineTop + measuredBaselineBottom);
+    }
+    
+    /**
+     *  @private 
+     */
+    override public function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
+    {
+        super.updateDisplayList(unscaledWidth, unscaledHeight);
+        
+        var target:GroupBase = this.target;
+        if (!target || verticalAlign != "baseline")
+            return;
+
+        measureBaseline(false /*usePreferredSize*/);
+        if (!isNaN(_globalBaseline))
+            measuredBaselineTop = _globalBaseline;
+
+        if (isNaN(paddingTop))
+            measuredBaselineTop += paddingTop;
+        
+        // Adjust the position of the elements
+        var contentHeight:Number = 0;
+        var count:int = target.numElements;
+        for (var i:int = 0; i < count; i++)
+        {
+            var element:ILayoutElement = target.getElementAt(i);
+            if (!element || !element.includeInLayout)
+                continue;
+            
+            var elementBaseline:Number = element.baseline as Number;
+            if (isNaN(elementBaseline))
+                elementBaseline = 0;
+
+            var baselinePosition:Number = element.baselinePosition;
+            var y:Number = measuredBaselineTop + (elementBaseline - baselinePosition);
+            element.setLayoutBoundsPosition(element.getLayoutBoundsX(), y);
+            contentHeight = Math.max(contentHeight, element.getLayoutBoundsHeight() + y);
+        }
+
+        // Adjust the content height
+        if (isNaN(paddingBottom))
+            contentHeight += paddingBottom;
+        target.setContentSize(target.contentWidth, contentHeight);
+        
+        // Update the baseline
+        setActualBaseline(measuredBaselineTop);
+    }
+
+    private var measuredBaselineTop:Number = 0;            // How much space is needed above the baseline to fit all the elements
+    private var measuredBaselineBottom:Number = 0;        // How much space is needed below the baseline to fit all the elements
+    
+    /**
+     *  @private 
+     */
+    private function measureBaseline(usePreferredSize:Boolean):void
+    {
+        var elementBaseline:Number = 0;             // The current element's explicit baseline constraint
+        var elementBaselineTop:Number = 0;            // The portiono of the current element that's above the baseline
+        var elementBaselineBottom:Number = 0;        // The portion of the current element that's below the baseline
+
+        measuredBaselineTop = 0;
+        measuredBaselineBottom = 0;
+
+        var count:int = target.numElements;
+        for (var i:int = 0; i < count; i++)
+        {
+            var element:ILayoutElement = target.getElementAt(i);
+            if (!element || !element.includeInLayout)
+                continue;
+            
+            var elementHeight:Number = usePreferredSize ? element.getPreferredBoundsHeight() :
+                                                          element.getLayoutBoundsHeight();
+            elementBaseline = element.baseline as Number;
+            if (isNaN(elementBaseline))
+                elementBaseline = 0;
+            
+            var baselinePosition:Number = element.baselinePosition;
+            
+            elementBaselineTop = baselinePosition - elementBaseline;
+            elementBaselineBottom = elementHeight - elementBaselineTop;
+            
+            measuredBaselineTop = Math.max(elementBaselineTop, measuredBaselineTop);
+            measuredBaselineBottom = Math.max(elementBaselineBottom, measuredBaselineBottom);
+        }
+    }
+}
+}
+