1////////////////////////////////////////////////////////////////////////////////
2//
3//  ADOBE SYSTEMS INCORPORATED
4//  Copyright 2003-2006 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 haloclassic
13{
14
15import flash.display.Graphics;
16import mx.skins.ProgrammaticSkin;
17import mx.styles.StyleManager;
18import mx.utils.ColorUtil;
19
20/**
21 *  The skin for a TitleWindow.
22 */
23public class TitleBackground extends ProgrammaticSkin
24{
25	include "../mx/core/Version.as";
26
27	//--------------------------------------------------------------------------
28	//
29	//  Constructor
30	//
31	//--------------------------------------------------------------------------
32
33	/**
34	 *  Constructor.
35	 */
36	public function TitleBackground()
37	{
38		super();
39	}
40
41	//--------------------------------------------------------------------------
42	//
43	//  Overridden methods
44	//
45	//--------------------------------------------------------------------------
46
47	/**
48	 *  @private
49	 */
50	override protected function updateDisplayList(w:Number, h:Number):void
51	{
52		super.updateDisplayList(w, h);
53
54		var cornerRadius:Number = getStyle("cornerRadius");
55		var headerColors:Array = getStyle("headerColors");
56        StyleManager.getColorNames(headerColors);
57
58		var g:Graphics = graphics;
59
60		g.clear();
61
62		if (h < 3)
63			return;
64
65		if (cornerRadius > 0)
66			cornerRadius--;
67
68		// bottom
69		g.lineStyle(0, headerColors[0], 100);
70		g.moveTo(0, h);
71		g.lineTo(w, h);
72		g.lineStyle(0, 0, 0);
73
74		drawRoundRect(
75			0, 0, w, h,
76			{ tl: cornerRadius, tr: cornerRadius, bl: 0, br: 0 },
77			headerColors, 1,
78			verticalGradientMatrix(0, 0, w, h));
79
80		if (headerColors.length > 1 && headerColors[0] != headerColors[1])
81		{
82			drawRoundRect(
83				0, 0, w, h,
84				{ tl: cornerRadius, tr: cornerRadius, bl: 0, br: 0 },
85				[ 0xFFFFFF, 0xFFFFFF ], [ 0.80, 0.20 ],
86				verticalGradientMatrix(0, 0, w, h));
87
88			drawRoundRect(
89				1, 1, w - 2, h - 2,
90				{ tl: cornerRadius - 1, tr: cornerRadius - 1, bl: 0, br: 0 },
91				headerColors, 1,
92				verticalGradientMatrix(0, 0, w, h));
93		}
94	}
95}
96
97}
98