|
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: Implements MID edit indicator container. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMIDEDITINGSTATEINDICATOR_H |
|
20 #define CMIDEDITINGSTATEINDICATOR_H |
|
21 |
|
22 // EXTERNAL INCLUDES |
|
23 #include <AknIndicatorContainer.h> |
|
24 #include <aknEditStateIndicator.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MMIDCustomComponentContainer; |
|
28 |
|
29 // CLASS DESCRIPTION |
|
30 /** |
|
31 * Implements MID edit indicator container. |
|
32 */ |
|
33 NONSHARABLE_CLASS(CMIDEditingStateIndicator) : |
|
34 public CAknIndicatorContainer, |
|
35 public MAknEditingStateIndicator |
|
36 { |
|
37 public: // Type definitions |
|
38 |
|
39 /** |
|
40 * Indicator's state |
|
41 */ |
|
42 enum TIndicatorState |
|
43 { |
|
44 // Disabled. Should not be shown |
|
45 EIndicatorStateDisabled = 0, |
|
46 // Relative to a component. |
|
47 EIndicatorStateRelative, |
|
48 // Freely positioned. |
|
49 EIndicatorStateAbsolute |
|
50 }; |
|
51 |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. Creates an instance from this class |
|
56 * The caller takes the ownership of the returned instance |
|
57 * |
|
58 * @return New instance from this class |
|
59 */ |
|
60 static CMIDEditingStateIndicator* NewL(); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 virtual ~CMIDEditingStateIndicator(); |
|
66 |
|
67 public: // From CCoeControl |
|
68 |
|
69 /** |
|
70 * Sets the container window for this UI control. |
|
71 * |
|
72 * @param aParent The container window for this control. |
|
73 * @since S60 5.0 |
|
74 */ |
|
75 void SetContainerWindowL(CCoeControl* aParent); |
|
76 |
|
77 /** |
|
78 * Sets the size of this indicator container. |
|
79 * |
|
80 * Note: Some parameters for the size can be constant. |
|
81 * Note: Calling this function results in a call to SizeChanged(). |
|
82 * Note: Calling this function results in a call to PositionChanged(). |
|
83 * |
|
84 * @param aWidth The width of the indicator in pixels. |
|
85 * @param aHeight The height of the indicator in pixels. |
|
86 * @since S60 5.0 |
|
87 */ |
|
88 void SetSize(TInt aWidth, TInt aHeight); |
|
89 |
|
90 public: // From CCoeControl |
|
91 |
|
92 /** |
|
93 * Draws the background for this indicator container. |
|
94 * |
|
95 * @param aRect The rect to which to draw. |
|
96 * @since S60 5.0 |
|
97 */ |
|
98 void Draw(const TRect& aRect) const; |
|
99 |
|
100 public: // From MAknEditingStateIndicator |
|
101 |
|
102 /** |
|
103 * Sets editing state indicator state. |
|
104 * |
|
105 * @param aState State of the editing indicator. |
|
106 * @since S60 5.0 |
|
107 */ |
|
108 void SetState(TAknEditingState aState); |
|
109 |
|
110 /** |
|
111 * Gets pointer to indicator container that contains |
|
112 * the editing state indicators. |
|
113 * |
|
114 * @return Indicator container of the editing indicators. |
|
115 * @since S60 5.0 |
|
116 */ |
|
117 CAknIndicatorContainer* IndicatorContainer(); |
|
118 |
|
119 public: // New methods |
|
120 |
|
121 /** |
|
122 * Gets an object whose type is encapsulated by the |
|
123 * specified <code>TTypeUid object</code>. |
|
124 * |
|
125 * @param aId Encapsulates the Uid that identifies the type |
|
126 * of object required. |
|
127 * @return Encapsulates the pointer to the object provided. |
|
128 * Note that the encapsulated pointer may be NULL. |
|
129 * @since S60 5.0 |
|
130 */ |
|
131 TTypeUid::Ptr SupplyIndicatorMopObject(TTypeUid aId); |
|
132 |
|
133 /** |
|
134 * Sets the position of this indicator component. |
|
135 * |
|
136 * Position is relative to the parent object. |
|
137 * |
|
138 * @param aX The x coordinate of the anchor point. |
|
139 * @param aY The y coordinate of the anchor point. |
|
140 * @since S60 5.0 |
|
141 */ |
|
142 void SetPosition(TInt aX, TInt aY); |
|
143 |
|
144 /** |
|
145 * Sets this indicator component visible if it is hidden. |
|
146 * |
|
147 * Depending on the current status of the indicator, this operation |
|
148 * is no-op if there is nothing to do. (i.e. the indicator is set |
|
149 * hidden when it is already hidden). |
|
150 * |
|
151 * @param aVisible Indicates the visibility status of the indicator. |
|
152 * @since S60 5.0 |
|
153 */ |
|
154 void SetVisibleL(TBool aVisible); |
|
155 |
|
156 /** |
|
157 * Returns the state of this indicator. |
|
158 * |
|
159 * @return The state of this indicator. |
|
160 * @since S60 5.0 |
|
161 */ |
|
162 TIndicatorState EnabledState() const; |
|
163 |
|
164 /** |
|
165 * Sets a new state for this indicator. |
|
166 * |
|
167 * @param aState The new state. |
|
168 * @since S60 5.0 |
|
169 */ |
|
170 void SetEnabledState(TIndicatorState aState); |
|
171 |
|
172 public: // New methods |
|
173 |
|
174 /** |
|
175 * Redraws the indicator's content correctly. |
|
176 * |
|
177 * Note that this method must be used to redraw the indicator correctly |
|
178 * in situations that the background color is transparent. |
|
179 * @since S60 5.0 |
|
180 */ |
|
181 void Redraw() const; |
|
182 |
|
183 /** |
|
184 * Used to override default colors. |
|
185 * |
|
186 * @see CCoeControl::OverrideColorL() |
|
187 * |
|
188 * @param aLogicalColor The logical colour. Indicates which part of a |
|
189 * control the physical colour maps to. The set of logical |
|
190 * colours for a standard application are defined in |
|
191 * TLogicalColor. |
|
192 * |
|
193 * @param aColor The new physical colour to which the logical colour |
|
194 * should be mapped. |
|
195 * @since S60 5.0 |
|
196 */ |
|
197 void OverrideColorL(TInt aLogicalColor, TRgb aColor); |
|
198 |
|
199 /** |
|
200 * Sets flag if scaling is on now. |
|
201 * |
|
202 * @param Flag if scaling is on now. |
|
203 * |
|
204 * @since S60 5.0 |
|
205 */ |
|
206 inline void SetScalingOn(TBool aScaling); |
|
207 |
|
208 /** |
|
209 * Sets current fullscreen canvas size. |
|
210 * |
|
211 * @param Current fullscreen canvas size. |
|
212 * |
|
213 * @since S60 5.0 |
|
214 */ |
|
215 inline void SetCanvasRect(const TRect& aRect); |
|
216 |
|
217 private: // From CAknIndicatorContainer |
|
218 |
|
219 /** |
|
220 * Needs to be defined here for linking compatibility. |
|
221 * @since S60 5.0 |
|
222 */ |
|
223 void Reserved_1(); |
|
224 |
|
225 private: // Construtors |
|
226 |
|
227 /** |
|
228 * C++ constructor. |
|
229 */ |
|
230 CMIDEditingStateIndicator(); |
|
231 |
|
232 /** |
|
233 * Second phase constructor |
|
234 */ |
|
235 void ConstructL(); |
|
236 |
|
237 private: // New methods |
|
238 |
|
239 /** |
|
240 * Sets new indicator to container |
|
241 * |
|
242 * @param aIndicator Indicator id. |
|
243 * @param aState State of the indicator. |
|
244 * @param aDrawNow Should the indicator be drawn now. |
|
245 * @since S60 5.0 |
|
246 */ |
|
247 void SetIndicator(TInt aIndicator, TInt aState, TBool aDrawNow); |
|
248 |
|
249 private: // Data |
|
250 |
|
251 // State of the indicators. |
|
252 TIndicatorState iState; |
|
253 // Editing state. |
|
254 TAknEditingState iEditingState; |
|
255 // Background color of the indicator. |
|
256 TRgb iBackgroundColor; |
|
257 // Top parent of this control. Not owned. |
|
258 CCoeControl* iParent; |
|
259 // Flag if scaling is on now. |
|
260 TBool iIsScalingOn; |
|
261 // Canvas fullscreen size |
|
262 TRect iOnScreenCanvasRect; |
|
263 }; |
|
264 |
|
265 void CMIDEditingStateIndicator::SetScalingOn(TBool aScaling) |
|
266 { |
|
267 iIsScalingOn = aScaling; |
|
268 } |
|
269 |
|
270 void CMIDEditingStateIndicator::SetCanvasRect(const TRect& aRect) |
|
271 { |
|
272 iOnScreenCanvasRect = aRect; |
|
273 } |
|
274 |
|
275 #endif // CMIDEDITINGSTATEINDICATOR_H |
|
276 |
|
277 // End of file |