1////////////////////////////////////////////////////////////////////////////////
2//
3//  ADOBE SYSTEMS INCORPORATED
4//  Copyright 2005-2007 Adobe Systems Incorporated
5//  All Rights Reserved.
6//
7//  NOTICE: Adobe permits you to use, modify, and distribute this file
8//  in accordance with the terms of the license agreement accompanying it.
9//
10////////////////////////////////////////////////////////////////////////////////
11
12package mx.skins.halo
13{
14
15import flash.display.Graphics;
16import mx.core.FlexVersion;
17import mx.skins.Border;
18import mx.utils.ColorUtil;
19
20/**
21 *  The skin for all the states of the next-year and previous-year
22 *  buttons in a DateChooser.
23 */
24public class DateChooserYearArrowSkin extends Border
25{
26	include "../../core/Version.as";
27
28	//--------------------------------------------------------------------------
29	//
30	//  Constructor
31	//
32	//--------------------------------------------------------------------------
33
34	/**
35	 *  Constructor.
36	 */
37	public function DateChooserYearArrowSkin()
38	{
39		super();
40	}
41
42	//--------------------------------------------------------------------------
43	//
44	//  Overridden properties
45	//
46	//--------------------------------------------------------------------------
47
48	//----------------------------------
49	//  measuredWidth
50	//----------------------------------
51
52	/**
53	 *  @private
54	 */
55	override public function get measuredWidth():Number
56	{
57		return 6;
58	}
59
60	//----------------------------------
61	//  measuredHeight
62	//----------------------------------
63
64	/**
65	 *  @private
66	 */
67	override public function get measuredHeight():Number
68	{
69		return FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0 ? 4 : 6;
70	}
71
72	//--------------------------------------------------------------------------
73	//
74	//  Overridden methods
75	//
76	//--------------------------------------------------------------------------
77
78	/**
79	 *  @private
80	 */
81	override protected function updateDisplayList(w:Number, h:Number):void
82	{
83		super.updateDisplayList(w, h);
84
85		var themeColor:uint = getStyle("themeColor");
86
87		var themeColorDrk1:Number =
88			ColorUtil.adjustBrightness2(themeColor, -25);
89
90		var arrowColor:uint = getStyle("iconColor");
91
92		var g:Graphics = graphics;
93
94		g.clear();
95
96		switch (name)
97		{
98			case "prevYearUpSkin":
99			case "nextYearUpSkin":
100			{
101				break;
102			}
103
104			case "prevYearOverSkin":
105			case "nextYearOverSkin":
106			{
107				arrowColor = themeColor;
108				break;
109			}
110
111			case "prevYearDownSkin":
112			case "nextYearDownSkin":
113			{
114				arrowColor = themeColorDrk1;
115				break;
116			}
117
118			case "prevYearDisabledSkin":
119			case "nextYearDisabledSkin":
120			{
121				arrowColor = getStyle("disabledIconColor");
122				break;
123			}
124		}
125
126		// Viewable Button area
127		g.beginFill(arrowColor);
128		if (name.charAt(0) == "p")
129		{
130			g.moveTo(w / 2, h / 2 + 2);
131			g.lineTo(w / 2 - 3, h / 2 - 2);
132			g.lineTo(w / 2 + 3, h / 2 - 2);
133			g.lineTo(w / 2, h / 2 + 2);
134		}
135		else
136		{
137			g.moveTo(w / 2, h / 2 - 2);
138			g.lineTo(w / 2 - 3, h / 2 + 2);
139			g.lineTo(w / 2 + 3, h / 2 + 2);
140			g.lineTo(w / 2, h / 2 - 2);
141		}
142		g.endFill();
143	}
144}
145
146}
147