|
1 /* |
|
2 * Copyright (c) 2007 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 CFMRadioAlfIndicator. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ALF_INDICATOR_H |
|
20 #define ALF_INDICATOR_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <AknUtils.h> |
|
25 #include <alf/alfcontrol.h> |
|
26 #include <alf/alfanchorlayout.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 |
|
30 class CAlfTextVisual; |
|
31 |
|
32 // CLASS DEFINITION |
|
33 |
|
34 /** |
|
35 * Text indicator control class |
|
36 * |
|
37 * Provides means to show and fade in/out a specific text inside the supplied "layout". |
|
38 * |
|
39 */ |
|
40 class CFMRadioAlfIndicator : public CAlfControl |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Epoc two-phased constructor. |
|
46 * @param aEnv Reference to the HitchCock environment instance. |
|
47 * @return Pointer to this Indicator component. |
|
48 */ |
|
49 static CFMRadioAlfIndicator* NewL( CAlfEnv& aEnv ); |
|
50 /** |
|
51 * Destructor |
|
52 */ |
|
53 virtual ~CFMRadioAlfIndicator(); |
|
54 public: // Functions from base classes |
|
55 /** |
|
56 * From CAlfControl, takes care of alfred event handling. |
|
57 * @param aEvent |
|
58 */ |
|
59 TBool OfferEventL( const TAlfEvent& aEvent ); |
|
60 public: // New functions |
|
61 /** |
|
62 * Shows the indicator with the defined opacity value. |
|
63 * @param aShowWithFading ETrue if the indicator will be shown with fading; EFalse otherwise. |
|
64 * @see SetOpacityInVisibleState() |
|
65 */ |
|
66 void Show( TBool aShowWithFading ); |
|
67 /** |
|
68 * Hides the indicator with the defined opacity value. |
|
69 * @param aHideWithFading ETrue if the indicator will be hidden with fading; EFalse otherwise. |
|
70 * @see SetOpacityInHiddenState() |
|
71 */ |
|
72 void Hide( TBool aHideWithFading ); |
|
73 /** |
|
74 * Sets the indicator opacity in visible state. |
|
75 * @param aOpacity The indicator opacity |
|
76 */ |
|
77 void SetOpacityInVisibleState( const TReal aOpacity ); |
|
78 /** |
|
79 * Sets the indicator opacity in hidden state. |
|
80 * @param aOpacity The indicator opacity |
|
81 */ |
|
82 void SetOpacityInHiddenState( const TReal aOpacity ); |
|
83 /** |
|
84 * Sets the indicator text. |
|
85 * @param aText The indicator text to be shown |
|
86 */ |
|
87 void SetTextL( const TDesC& aText ); |
|
88 /** |
|
89 * Changes indicator text color |
|
90 * @param aTextColor Color of the indicator text |
|
91 */ |
|
92 void SetTextColor( const TRgb& aTextColor ); |
|
93 /** |
|
94 * Sets the indicator rectangle |
|
95 * @param aRect Rectangle to the indicator |
|
96 */ |
|
97 void SetRect( const TRect& aRect ); |
|
98 private: |
|
99 /** |
|
100 * C++ default constructor |
|
101 */ |
|
102 CFMRadioAlfIndicator( ); |
|
103 /** |
|
104 * EPOC second phase constructor. |
|
105 * @param aEnv Reference to the Hitchcock environment instance. |
|
106 */ |
|
107 void ConstructL( CAlfEnv& aEnv ); |
|
108 private: // New functions |
|
109 /** |
|
110 * Sets the fading animation to the CAlfVisual object. |
|
111 * @param aVisual a pointer to the visual object |
|
112 * @param aFadingTime Time duration after the visual object has been faded. Fading duration in milliseconds. |
|
113 * @param aOpacity Target opacity value |
|
114 */ |
|
115 void Fade( CAlfVisual* aVisual, TInt aFadingTime, TReal aOpacity ) const; |
|
116 /** |
|
117 * Sets absolute rect of the anchor by top left and bottom right points. |
|
118 * @param aAnchor Anchor layout for setting placement |
|
119 * @param aOrdinal Index of visual element |
|
120 * @param aTopLeftPosition Top left point of the rect |
|
121 * @param aBottomRightPosition Bottom right point of the rect |
|
122 */ |
|
123 void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor, |
|
124 TInt aOrdinal, |
|
125 const TPoint& aTopLeftPosition, |
|
126 const TPoint& aBottomRightPosition ); |
|
127 /** |
|
128 * Sets absolute rect of the anchor by top left and size of the rect. |
|
129 * @param aAnchor Anchor layout for setting placement |
|
130 * @param aOrdinal Index of visual element |
|
131 * @param aTopLeftPosition Top left point of the rect |
|
132 * @param aSize Size of the rect |
|
133 */ |
|
134 void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor, |
|
135 TInt aOrdinal, |
|
136 const TPoint& aTopLeftPosition, |
|
137 const TSize& aSize ); |
|
138 /** |
|
139 * Sets relative rect of the anchor by top left and bottom right points. |
|
140 * @param aAnchor Anchor layout for setting placement |
|
141 * @param aOrdinal Index of visual element |
|
142 * @param aTopLeftPosition Top left point of the rect |
|
143 * @param aBottomRightPosition Bottom right point of the rect |
|
144 */ |
|
145 void SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor, |
|
146 TInt aOrdinal, |
|
147 const TAlfRealPoint& aTopLeftPosition, |
|
148 const TAlfRealPoint& aBottomRightPosition ); |
|
149 /** |
|
150 * Sets relative rect of the anchor by top left and size of the rect. |
|
151 * @param aAnchor Anchor layout for setting placement |
|
152 * @param aOrdinal Index of visual element |
|
153 * @param aTopLeftPosition Top left point of the rect |
|
154 * @param aSize Size of the rect |
|
155 */ |
|
156 void SetRelativeCornerAnchors( CAlfAnchorLayout* aAnchor, |
|
157 TInt aOrdinal, |
|
158 const TAlfRealPoint& aTopLeftPosition, |
|
159 const TAlfRealSize& aSize ); |
|
160 /** |
|
161 * Creates the needed drawing layers and visual objects |
|
162 * for the indicator. |
|
163 */ |
|
164 void AddIndicatorLayerL(); |
|
165 /** |
|
166 * Creates the text style for the indicator |
|
167 */ |
|
168 void SetTextStyleL(); |
|
169 |
|
170 private: // Data |
|
171 |
|
172 /** Anchor layout for indicator */ |
|
173 CAlfAnchorLayout* iIndicatorTextAnchor; |
|
174 /** Visual object of the indicator. Not owned. */ |
|
175 CAlfTextVisual* iText; |
|
176 /** Text color of the indicator text */ |
|
177 TRgb iTextColor; |
|
178 /** Text style id of the indicator text */ |
|
179 TInt iTextStyleId; |
|
180 /** Indicator opacity in visible state */ |
|
181 TReal iOpacityInVisibleState; |
|
182 /** Indicator opacity in hidden state */ |
|
183 TReal iOpacityInHiddenState; |
|
184 /** Indicator rectangle */ |
|
185 TRect iRect; |
|
186 }; |
|
187 |
|
188 #endif //ALF_INDICATOR_H |