| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| 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. |
| |
| --> |
| <!--- The default skin class for the textInput of a Spark ComboBox component. |
| |
| @see spark.components.ComboBox |
| |
| @langversion 3.0 |
| @playerversion Flash 10 |
| @playerversion AIR 1.5 |
| @productversion Flex 4 |
| --> |
| <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:fb="http://ns.adobe.com/flashbuilder/2009" |
| blendMode="normal"> |
| |
| <fx:Metadata> |
| <![CDATA[ |
| /** |
| * @copy spark.skins.spark.ApplicationSkin#hostComponent |
| */ |
| [HostComponent("spark.components.TextInput")] |
| ]]> |
| </fx:Metadata> |
| |
| <fx:Script fb:purpose="styling"> |
| <![CDATA[ |
| import flatspark.utils.ColorUtils; |
| |
| private var paddingChanged:Boolean; |
| private var cornerRadius:Number = 4; |
| |
| /* Define the skin elements that should not be colorized. */ |
| static private const exclusions:Array = ["background", "textDisplay", "promptDisplay"]; |
| |
| /** |
| * @private |
| */ |
| 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 = []; |
| |
| /** |
| * @private |
| */ |
| override public function get contentItems():Array {return contentFill; } |
| |
| /** |
| * @private |
| */ |
| override protected function commitProperties():void |
| { |
| super.commitProperties(); |
| |
| if (paddingChanged) |
| { |
| updatePadding(); |
| paddingChanged = false; |
| } |
| } |
| |
| /** |
| * @private |
| */ |
| override protected function initializationComplete():void |
| { |
| useChromeColor = true; |
| super.initializationComplete(); |
| } |
| |
| /** |
| * @private |
| */ |
| override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number) : void |
| { |
| if (promptDisplay) |
| { |
| promptDisplay.setLayoutBoundsSize(unscaledWidth, unscaledHeight); |
| promptDisplay.setLayoutBoundsPosition(8, 0); |
| } |
| |
| background.bottomLeftRadiusX = background.topLeftRadiusX = cornerRadius; |
| |
| super.updateDisplayList(unscaledWidth, unscaledHeight); |
| } |
| |
| /** |
| * @private |
| */ |
| private function updatePadding():void |
| { |
| if (!textDisplay) |
| return; |
| |
| // Push padding styles into the textDisplay |
| var padding:Number; |
| |
| padding = getStyle("paddingLeft"); |
| if (textDisplay.getStyle("paddingLeft") != padding) |
| textDisplay.setStyle("paddingLeft", padding); |
| |
| padding = getStyle("paddingTop"); |
| if (textDisplay.getStyle("paddingTop") != padding) |
| textDisplay.setStyle("paddingTop", padding); |
| |
| padding = getStyle("paddingRight"); |
| if (textDisplay.getStyle("paddingRight") != padding) |
| textDisplay.setStyle("paddingRight", padding); |
| |
| padding = getStyle("paddingBottom"); |
| if (textDisplay.getStyle("paddingBottom") != padding) |
| textDisplay.setStyle("paddingBottom", padding); |
| |
| if (!promptDisplay) |
| return; |
| |
| padding = getStyle("paddingLeft"); |
| if (promptDisplay.getStyle("paddingLeft") != padding) |
| promptDisplay.setStyle("paddingLeft", padding); |
| |
| padding = getStyle("paddingTop"); |
| if (promptDisplay.getStyle("paddingTop") != padding) |
| promptDisplay.setStyle("paddingTop", padding); |
| |
| padding = getStyle("paddingRight"); |
| if (promptDisplay.getStyle("paddingRight") != padding) |
| promptDisplay.setStyle("paddingRight", padding); |
| |
| padding = getStyle("paddingBottom"); |
| if (promptDisplay.getStyle("paddingBottom") != padding) |
| promptDisplay.setStyle("paddingBottom", padding); |
| } |
| |
| /** |
| * @private |
| */ |
| override public function styleChanged(styleProp:String):void |
| { |
| var allStyles:Boolean = !styleProp || styleProp == "styleName"; |
| |
| super.styleChanged(styleProp); |
| |
| if (allStyles || styleProp.indexOf("padding") == 0) |
| { |
| paddingChanged = true; |
| invalidateProperties(); |
| } |
| } |
| ]]> |
| </fx:Script> |
| |
| <fx:Script> |
| <![CDATA[ |
| /** |
| * @private |
| */ |
| private static const focusExclusions:Array = ["textDisplay"]; |
| |
| /** |
| * @private |
| */ |
| override public function get focusSkinExclusions():Array { return focusExclusions;}; |
| ]]> |
| </fx:Script> |
| |
| <s:states> |
| <s:State name="normal"/> |
| <s:State name="disabled" stateGroups="disabledStates"/> |
| <s:State name="normalWithPrompt"/> |
| <s:State name="disabledWithPrompt" stateGroups="disabledStates"/> |
| </s:states> |
| |
| <!-- fill --> |
| <!--- Defines the appearance of the TextInput component's background. --> |
| <s:Rect id="background" left="0" right="0" top="0" bottom="0"> |
| <s:fill> |
| <s:SolidColor id="bgFill" color="{ColorUtils.Turquoise}" /> |
| </s:fill> |
| </s:Rect> |
| |
| <!-- text --> |
| <!--- @copy spark.components.supportClasses.SkinnableTextBase#textDisplay --> |
| <!-- <s:RichEditableText id="textDisplay" |
| lineBreak="explicit" |
| widthInChars="10" verticalCenter="0"/>--> |
| <s:RichEditableText id="textDisplay" verticalAlign="middle" lineBreak="explicit" backgroundColor="{ColorUtils.Turquoise}" |
| widthInChars="10" fontFamily="Lato" fontWeight="normal" color="0xFFFFFF" |
| left="8" right="8" top="8" bottom="8" fontSize="15" verticalCenter="0"/> |
| <!--- Defines the Label that is used for prompt text. The includeInLayout property is false so the prompt text does not affect measurement. --> |
| <!-- <s:Label id="promptDisplay" maxDisplayedLines="1" |
| verticalAlign="middle" |
| mouseEnabled="false" mouseChildren="false" |
| includeIn="normalWithPrompt,disabledWithPrompt" |
| includeInLayout="false"/>--> |
| <s:Label id="promptDisplay" maxDisplayedLines="1" |
| verticalAlign="middle" fontFamily="Lato" fontSize="15" fontWeight="normal" fontStyle="italic" color="{ColorUtils.Clouds}" |
| mouseEnabled="false" mouseChildren="false" left="8" right="8" top="8" bottom="8" verticalCenter="0" |
| includeIn="normalWithPrompt,disabledWithPrompt" |
| includeInLayout="false"/> |
| |
| </s:SparkSkin> |