1////////////////////////////////////////////////////////////////////////////////
2//
3//  ADOBE SYSTEMS INCORPORATED
4//  Copyright 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.system.Capabilities;
16import mx.controls.Image;
17import mx.core.UIComponent;
18import mx.states.SetProperty;
19import mx.states.State;
20
21/**
22 *  The skin for the restore button in the TitleBar
23 *  of a WindowedApplication or Window.
24 *
25 *  @playerversion AIR 1.1
26 */
27public class WindowRestoreButtonSkin extends UIComponent
28{
29    include "../../core/Version.as";
30
31	//--------------------------------------------------------------------------
32	//
33	//  Class assets
34	//
35	//--------------------------------------------------------------------------
36
37    [Embed(source="../../../../assets/win_restore_up.png")]
38    private static var winRestoreUpSkin:Class;
39
40   	[Embed(source="../../../../assets/win_restore_down.png")]
41    private static var winRestoreDownSkin:Class;
42
43    [Embed(source="../../../../assets/win_restore_over.png")]
44    private static var winRestoreOverSkin:Class;
45
46	//--------------------------------------------------------------------------
47	//
48	//  Constructor
49	//
50	//--------------------------------------------------------------------------
51
52	/**
53	 *  Constructor.
54	 */
55	public function WindowRestoreButtonSkin()
56	{
57		super();
58	}
59
60	//--------------------------------------------------------------------------
61	//
62	//  Variables
63	//
64	//--------------------------------------------------------------------------
65
66	/**
67	 *  @private
68	 */
69	private var skinImage:Image;
70
71	//--------------------------------------------------------------------------
72	//
73	//  Overridden properties: UIComponent
74	//
75	//--------------------------------------------------------------------------
76
77	//----------------------------------
78	//  measuredHeight
79	//----------------------------------
80
81	/**
82	 *  @private
83	 */
84	override public function get measuredHeight():Number
85	{
86		if (skinImage.measuredHeight)
87			return skinImage.measuredHeight;
88		else
89			return 13;
90	}
91
92	//----------------------------------
93	//  measuredWidth
94	//----------------------------------
95
96	/**
97	 *  @private
98	 */
99	override public function get measuredWidth():Number
100	{
101		if (skinImage.measuredWidth)
102			return skinImage.measuredWidth;
103		else
104			return 12;
105	}
106
107	//--------------------------------------------------------------------------
108	//
109	//  Overridden methods: UIComponent
110	//
111	//--------------------------------------------------------------------------
112
113	/**
114	 *  @private
115	 */
116	override protected function createChildren():void
117	{
118		skinImage = new Image();
119		addChild(skinImage);
120
121		initializeStates();
122
123		skinImage.setActualSize(12, 13);
124		skinImage.move(0, 0);
125	}
126
127	//--------------------------------------------------------------------------
128	//
129	//  Methods
130	//
131	//--------------------------------------------------------------------------
132
133	/**
134	 *  @private
135	 */
136	private function initializeStates():void
137	{
138		var upState:State = new State();
139		upState.name = "up";
140		var upProp:SetProperty = new SetProperty();
141		upProp.name = "source";
142		upProp.target = skinImage;
143		upProp.value = winRestoreUpSkin;
144		upState.overrides.push(upProp);
145		states.push(upState);
146
147		var downState:State = new State();
148		downState.name = "down";
149		var downProp:SetProperty = new SetProperty();
150		downProp.name = "source";
151		downProp.target = skinImage;
152		downProp.value = winRestoreDownSkin;
153		downState.overrides.push(downProp);
154		states.push(downState);
155
156		var overState:State = new State();
157		overState.name = "over";
158		var overProp:SetProperty = new SetProperty();
159		overProp.name = "source";
160		overProp.target = skinImage;
161		overProp.value = winRestoreOverSkin;
162		overState.overrides.push(overProp);
163		states.push(overState);
164	}
165}
166
167}
168