QtTitleWindow.mxml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. ADOBE SYSTEMS INCORPORATED
  4. Copyright 2008 Adobe Systems Incorporated
  5. All Rights Reserved.
  6. NOTICE: Adobe permits you to use, modify, and distribute this file
  7. in accordance with the terms of the license agreement accompanying it.
  8. -->
  9. <!--- The default skin class for a Spark TitleWindow container.
  10. @see spark.skins.spark.TitleWindowCloseButtonSkin
  11. @see spark.components.TitleWindow
  12. @langversion 3.0
  13. @playerversion Flash 10
  14. @playerversion AIR 1.5
  15. @productversion Flex 4
  16. -->
  17. <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
  18. xmlns:fb="http://ns.adobe.com/flashbuilder/2009" blendMode="normal" mouseEnabled="false"
  19. minWidth="76" minHeight="76" alpha.disabled="0.5" alpha.disabledWithControlBar="0.5">
  20. <fx:Metadata>
  21. <![CDATA[
  22. /**
  23. * @copy spark.skins.spark.ApplicationSkin#hostComponent
  24. */
  25. [HostComponent("spark.components.TitleWindow")]
  26. ]]>
  27. </fx:Metadata>
  28. <fx:Script fb:purpose="styling">
  29. <![CDATA[
  30. import mx.core.FlexVersion;
  31. /* Define the skin elements that should not be colorized.
  32. For panel, border and title background are skinned, but the content area, background, border, and title text are not. */
  33. static private const exclusions:Array = ["background", "titleDisplay", "contentGroup", "border"];
  34. /* exclusions before Flex 4.5 for backwards-compatibility purposes */
  35. static private const exclusions_4_0:Array = ["background", "titleDisplay", "contentGroup"];
  36. /**
  37. * @private
  38. */
  39. override public function get colorizeExclusions():Array
  40. {
  41. // Since border is styleable via borderColor, no need to allow chromeColor to affect
  42. // the border. This is wrapped in a compatibility flag since this change was added
  43. // in Flex 4.5
  44. if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_4_5)
  45. {
  46. return exclusions_4_0;
  47. }
  48. return exclusions;
  49. }
  50. /**
  51. * @private
  52. */
  53. override protected function initializationComplete():void
  54. {
  55. useChromeColor = true;
  56. super.initializationComplete();
  57. }
  58. /**
  59. * @private
  60. */
  61. override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
  62. {
  63. if (getStyle("borderVisible") == true)
  64. {
  65. border.visible = true;
  66. background.left = background.top = background.right = background.bottom = 1;
  67. contents.left = contents.top = contents.right = contents.bottom = 1;
  68. }
  69. else
  70. {
  71. border.visible = false;
  72. background.left = background.top = background.right = background.bottom = 0;
  73. contents.left = contents.top = contents.right = contents.bottom = 0;
  74. }
  75. dropShadow.visible = getStyle("dropShadowVisible");
  76. var cr:Number = getStyle("cornerRadius");
  77. var withControls:Boolean =
  78. (currentState == "disabledWithControlBar" ||
  79. currentState == "normalWithControlBar" ||
  80. currentState == "inactiveWithControlBar");
  81. if (cornerRadius != cr)
  82. {
  83. cornerRadius = cr;
  84. dropShadow.tlRadius = cornerRadius;
  85. dropShadow.trRadius = cornerRadius;
  86. dropShadow.blRadius = withControls ? cornerRadius : 0;
  87. dropShadow.brRadius = withControls ? cornerRadius : 0;
  88. setPartCornerRadii(topMaskRect, withControls);
  89. setPartCornerRadii(border, withControls);
  90. setPartCornerRadii(background, withControls);
  91. }
  92. if (bottomMaskRect) setPartCornerRadii(bottomMaskRect, withControls);
  93. borderStroke.color = getStyle("borderColor");
  94. borderStroke.alpha = getStyle("borderAlpha");
  95. backgroundFill.color = getStyle("backgroundColor");
  96. backgroundFill.alpha = getStyle("backgroundAlpha");
  97. super.updateDisplayList(unscaledWidth, unscaledHeight);
  98. }
  99. /**
  100. * @private
  101. */
  102. private function setPartCornerRadii(target:Rect, includeBottom:Boolean):void
  103. {
  104. target.topLeftRadiusX = cornerRadius;
  105. target.topRightRadiusX = cornerRadius;
  106. target.bottomLeftRadiusX = includeBottom ? cornerRadius : 0;
  107. target.bottomRightRadiusX = includeBottom ? cornerRadius : 0;
  108. }
  109. private var cornerRadius:Number;
  110. ]]>
  111. </fx:Script>
  112. <s:states>
  113. <s:State name="normal" />
  114. <s:State name="inactive" stateGroups="inactiveGroup" />
  115. <s:State name="disabled" />
  116. <s:State name="normalWithControlBar" stateGroups="withControls" />
  117. <s:State name="inactiveWithControlBar" stateGroups="withControls, inactiveGroup" />
  118. <s:State name="disabledWithControlBar" stateGroups="withControls" />
  119. </s:states>
  120. <!--- drop shadow can't be hittable so it stays sibling of other graphics @private-->
  121. <s:RectangularDropShadow id="dropShadow" blurX="20" blurY="20" alpha="0.32"
  122. alpha.inactiveGroup="0.22" distance="11" distance.inactiveGroup="7"
  123. angle="90" color="0x000000" left="0" top="0" right="0" bottom="0"/>
  124. <!--- drop shadow can't be hittable so all other graphics go in this group -->
  125. <s:Group left="0" right="0" top="0" bottom="0">
  126. <!--- top group mask @private-->
  127. <s:Group left="1" top="1" right="1" bottom="1" id="topGroupMask">
  128. <!--- @private-->
  129. <s:Rect id="topMaskRect" left="0" top="0" right="0" bottom="0">
  130. <s:fill>
  131. <s:SolidColor alpha="0"/>
  132. </s:fill>
  133. </s:Rect>
  134. </s:Group>
  135. <!--- bottom group mask @private-->
  136. <s:Group left="1" top="1" right="1" bottom="1" id="bottomGroupMask"
  137. includeIn="withControls">
  138. <!--- @private-->
  139. <s:Rect id="bottomMaskRect" left="0" top="0" right="0" bottom="0">
  140. <s:fill>
  141. <s:SolidColor alpha="0"/>
  142. </s:fill>
  143. </s:Rect>
  144. </s:Group>
  145. <!--- layer 1: border @private -->
  146. <s:Rect id="border" left="0" right="0" top="0" bottom="0" >
  147. <s:stroke>
  148. <!--- Defines the TitleWindowSkin class's border stroke. The default value is 1. -->
  149. <s:SolidColorStroke id="borderStroke" weight="1" />
  150. </s:stroke>
  151. </s:Rect>
  152. <!-- layer 2: background fill -->
  153. <!--- Defines the appearance of the TitleWindowSkin class's background. -->
  154. <s:Rect id="background" left="1" top="1" right="1" bottom="1">
  155. <s:fill>
  156. <!--- Defines the TitleWindowSkin class's background fill. The default color is 0xFFFFFF. -->
  157. <s:SolidColor id="backgroundFill" color="#FFFFFF"/>
  158. </s:fill>
  159. </s:Rect>
  160. <!-- layer 3: contents -->
  161. <!--- Contains the vertical stack of title bar content and control bar. -->
  162. <s:Group left="1" right="1" top="1" bottom="1" id="contents">
  163. <s:layout>
  164. <s:VerticalLayout gap="0" horizontalAlign="justify" />
  165. </s:layout>
  166. <!--- @private -->
  167. <s:Group id="topGroup" mask="{topGroupMask}">
  168. <!--- layer 0: title bar fill @private -->
  169. <s:Rect id="tbFill" left="0" right="0" top="0" bottom="1">
  170. <s:fill>
  171. <s:LinearGradient rotation="90">
  172. <s:GradientEntry color="0x29A8E2"
  173. color.inactiveGroup="0x29A8E2"/>
  174. <s:GradientEntry color="0x3E76A8"
  175. color.inactiveGroup="0x3E76A8"/>
  176. </s:LinearGradient>
  177. </s:fill>
  178. </s:Rect>
  179. <!--- layer 1: title bar highlight @private -->
  180. <s:Rect id="tbHilite" left="0" right="0" top="0" bottom="0">
  181. <s:stroke>
  182. <s:LinearGradientStroke rotation="90" weight="1">
  183. <s:GradientEntry color="0xE6E6E6" />
  184. <s:GradientEntry color="0xFFFFFF" alpha="0.22"/>
  185. </s:LinearGradientStroke>
  186. </s:stroke>
  187. <s:fill>
  188. <s:LinearGradient rotation="90">
  189. <s:GradientEntry color="0xFFFFFF" alpha="0.15" />
  190. <s:GradientEntry color="0xFFFFFF" alpha="0.15" ratio="0.44"/>
  191. <s:GradientEntry color="0xFFFFFF" alpha="0" ratio="0.4401"/>
  192. </s:LinearGradient>
  193. </s:fill>
  194. </s:Rect>
  195. <!--- layer 2: title bar divider @private -->
  196. <s:Rect id="tbDiv" left="0" right="0" height="1" bottom="0">
  197. <s:fill>
  198. <s:SolidColor color="0x000000" alpha="0.75" />
  199. </s:fill>
  200. </s:Rect>
  201. <!-- layer 3: text -->
  202. <!--- @copy spark.components.Panel#titleDisplay -->
  203. <s:Label id="titleDisplay" maxDisplayedLines="1"
  204. left="9" right="36" top="1" bottom="0" minHeight="30" fontSize="18" color="#FFFFFF" textAlign="left" fontFamily="微软雅黑"
  205. verticalAlign="middle" fontWeight="bold" />
  206. <!-- layer 4: moveArea -->
  207. <!--- @copy spark.components.TitleWindow#moveArea -->
  208. <s:Group id="moveArea" left="0" right="0" top="0" bottom="0" />
  209. <!--- @copy spark.components.TitleWindow#closeButton -->
  210. <s:Button id="closeButton" skinClass="com.skins.TitleWindowCloseButtonSkin"
  211. width="20" height="20" right="5" top="5" />
  212. </s:Group>
  213. <!--
  214. Note: setting the minimum size to 0 here so that changes to the host component's
  215. size will not be thwarted by this skin part's minimum size. This is a compromise,
  216. more about it here: http://bugs.adobe.com/jira/browse/SDK-21143
  217. -->
  218. <!--- @copy spark.components.SkinnableContainer#contentGroup -->
  219. <s:Group id="contentGroup" width="100%" height="100%" minWidth="0" minHeight="0">
  220. </s:Group>
  221. <!--- @private -->
  222. <s:Group id="bottomGroup" minWidth="0" minHeight="0"
  223. includeIn="withControls">
  224. <s:Group left="0" right="0" top="0" bottom="0" mask="{bottomGroupMask}">
  225. <!-- layer 0: control bar divider line -->
  226. <s:Rect left="0" right="0" top="0" height="1" alpha="0.22">
  227. <s:fill>
  228. <s:SolidColor color="0x000000" />
  229. </s:fill>
  230. </s:Rect>
  231. <!-- layer 1: control bar highlight -->
  232. <s:Rect left="0" right="0" top="1" bottom="0">
  233. <s:stroke>
  234. <s:LinearGradientStroke rotation="90" weight="1">
  235. <s:GradientEntry color="0xFFFFFF" />
  236. <s:GradientEntry color="0xD8D8D8" />
  237. </s:LinearGradientStroke>
  238. </s:stroke>
  239. </s:Rect>
  240. <!-- layer 2: control bar fill -->
  241. <s:Rect left="1" right="1" top="2" bottom="1">
  242. <s:fill>
  243. <s:LinearGradient rotation="90">
  244. <s:GradientEntry color="0xEDEDED"/>
  245. <s:GradientEntry color="0xCDCDCD"/>
  246. </s:LinearGradient>
  247. </s:fill>
  248. </s:Rect>
  249. </s:Group>
  250. <!--- @copy spark.components.Panel#controlBarGroup -->
  251. <s:Group id="controlBarGroup" left="0" right="0" top="1" bottom="1" minWidth="0" minHeight="0">
  252. <s:layout>
  253. <s:HorizontalLayout paddingLeft="10" paddingRight="10" paddingTop="7" paddingBottom="7" gap="10" />
  254. </s:layout>
  255. </s:Group>
  256. </s:Group>
  257. </s:Group>
  258. </s:Group>
  259. </s:SparkSkin>