|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Definition of the class CFMRadioLogo. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef FMRADIOALFLOGO_H |
|
20 #define FMRADIOALFLOGO_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <alf/alfcontrol.h> |
|
25 |
|
26 #include "fmradioidlecontrolinterface.h" |
|
27 // FORWARD DECLARATIONS |
|
28 |
|
29 class CAlfImageVisual; |
|
30 class MFMRadioLogoObserver; |
|
31 class CAlfAnchorLayout; |
|
32 |
|
33 // CLASS DEFINITION |
|
34 |
|
35 /** |
|
36 * Class for handling the radio icon |
|
37 * |
|
38 */ |
|
39 class CFMRadioLogo : public CAlfControl, |
|
40 public MFMRadioIdleControlInterface |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 /** |
|
44 * Epoc two-phased constructor. |
|
45 * @param aEnv Reference to the Alf environment instance. |
|
46 * @return Pointer to this Indicator component. |
|
47 */ |
|
48 static CFMRadioLogo* NewL( CAlfEnv& aEnv ); |
|
49 |
|
50 /** |
|
51 * Destructor |
|
52 */ |
|
53 virtual ~CFMRadioLogo(); |
|
54 |
|
55 public: // New functions |
|
56 /** |
|
57 * Sets the indicator opacity in visible state. |
|
58 * @param aOpacity The indicator opacity |
|
59 */ |
|
60 void SetOpacityInVisibleState( const TReal aOpacity ); |
|
61 |
|
62 /** |
|
63 * Sets the indicator opacity in hidden state. |
|
64 * @param aOpacity The indicator opacity |
|
65 */ |
|
66 void SetOpacityInHiddenState( const TReal aOpacity ); |
|
67 |
|
68 /** |
|
69 * Sets the indicator rectangle |
|
70 * @param aRect Rectangle to the indicator |
|
71 */ |
|
72 void SetRect( const TRect& aRect ); |
|
73 |
|
74 /** |
|
75 * Sets the Observer |
|
76 * @param aObserver The object to observe the control |
|
77 */ |
|
78 void SetObserver( MFMRadioLogoObserver* aObserver ); |
|
79 |
|
80 /** |
|
81 * Removes the observer |
|
82 */ |
|
83 void RemoveObserver( MFMRadioLogoObserver* aObserver ); |
|
84 |
|
85 /** |
|
86 * Switch to landscape image. |
|
87 * @param aShow. ETrue for landscape, EFalse for portrait |
|
88 */ |
|
89 void SwitchToLandscapeImage( TBool aShow ); |
|
90 |
|
91 private: |
|
92 /** |
|
93 * C++ default constructor |
|
94 */ |
|
95 CFMRadioLogo (); |
|
96 |
|
97 /** |
|
98 * EPOC second phase constructor. |
|
99 * @param aEnv Reference to the Hitchcock environment instance. |
|
100 */ |
|
101 void ConstructL( CAlfEnv& aEnv ); |
|
102 |
|
103 private: // Functions from base classes |
|
104 /** |
|
105 * from MFMRadioIdleControlInterface |
|
106 */ |
|
107 void Show(); |
|
108 |
|
109 /** |
|
110 * from MFMRadioIdleControlInterface |
|
111 */ |
|
112 void Hide(); |
|
113 |
|
114 /** |
|
115 * from MFMRadioIdleControlInterface |
|
116 */ |
|
117 void Deactivate(); |
|
118 |
|
119 /** |
|
120 * from CAlfControl |
|
121 */ |
|
122 TBool OfferEventL( const TAlfEvent& aEvent ); |
|
123 |
|
124 private: // New functions |
|
125 /** |
|
126 * Sets the fading animation to the CAlfVisual object. |
|
127 * @param aVisual a pointer to the visual object |
|
128 * @param aFadingTime Time duration after the visual object has been faded. Fading duration in milliseconds. |
|
129 * @param aOpacity Target opacity value |
|
130 */ |
|
131 void Fade( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity ); |
|
132 |
|
133 /** |
|
134 * Sets absolute rect of the anchor by top left and bottom right points. |
|
135 * @param aAnchor Anchor layout for setting placement |
|
136 * @param aOrdinal Index of visual element |
|
137 * @param aTopLeftPosition Top left point of the rect |
|
138 * @param aBottomRightPosition Bottom right point of the rect |
|
139 */ |
|
140 void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor, |
|
141 TInt aOrdinal, |
|
142 const TPoint& aTopLeftPosition, |
|
143 const TPoint& aBottomRightPosition ); |
|
144 /** |
|
145 * Creates the needed drawing layers and visual objects |
|
146 * for the logo. |
|
147 */ |
|
148 void CreateImageVisualsL(); |
|
149 |
|
150 private: |
|
151 /** |
|
152 * Alf custom events for the logo fade effects. |
|
153 * Logo stays visible couple of seconds after the |
|
154 * fade in event. |
|
155 */ |
|
156 enum TFadeCustomEvent |
|
157 { |
|
158 EFadeInCompleted, // Fade in completed. |
|
159 ELogoDisplayTimerCompleted // Visibility time ended. |
|
160 }; |
|
161 |
|
162 private:// Data |
|
163 /** Anchor layout for the logo. Not owned */ |
|
164 CAlfAnchorLayout* iLogoAnchor; |
|
165 /** logo opacity in visible state */ |
|
166 TReal iOpacityInVisibleState; |
|
167 /** logo opacity in hidden state */ |
|
168 TReal iOpacityInHiddenState; |
|
169 /** logo rectangle */ |
|
170 TRect iRect; |
|
171 /** Array of observers. */ |
|
172 RPointerArray<MFMRadioLogoObserver> iObservers; |
|
173 // visual containing the default radio icon. Not owned |
|
174 CAlfImageVisual* iImageVisual; |
|
175 // default radio icon in portrait mode |
|
176 TAlfImage iPortraitImage; |
|
177 // default radio icon in landscape mode |
|
178 TAlfImage iLandscapeImage; |
|
179 /** File name for the background bitmap. Owned. */ |
|
180 HBufC* iBackgroundBitmapFileName; |
|
181 // flag for visibility status |
|
182 TBool iIsVisible; |
|
183 }; |
|
184 |
|
185 #endif //FMRADIOALFLOGO_H |