|
1 /* |
|
2 * Copyright (c) 2008-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: Info Bubble Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C__GLXINFOBUBBLE_H__ |
|
22 #define C__GLXINFOBUBBLE_H__ |
|
23 |
|
24 //Includes |
|
25 |
|
26 #include <alf/alfcontrol.h> //base class for Alf control |
|
27 #include <alf/alfimage.h> //for TAlfImage |
|
28 #include <mglxskinchangeobserver.h> //for interface MGlxSkinChangeObserver |
|
29 #include <glxmedia.h> |
|
30 |
|
31 #include <mglxtextureobserver.h> |
|
32 |
|
33 //Forward Declaration |
|
34 class CGlxUiUtility; |
|
35 class CAlfAnchorLayout; |
|
36 class CAlfBorderBrush; |
|
37 class CAlfDeckLayout; |
|
38 class CAlfTexture; |
|
39 class CAlfImageVisual; |
|
40 class CAlfTextVisual; |
|
41 |
|
42 /** |
|
43 * CGlxInfoBubble is a common calss based on Alf Control. |
|
44 *It draws a bitmap and two lines on text. |
|
45 *It has a position logic of its own. |
|
46 */ |
|
47 class CGlxInfoBubble : public CAlfControl,public MGlxSkinChangeObserver, |
|
48 public MGlxTextureObserver |
|
49 { |
|
50 public: |
|
51 |
|
52 /* Constructors. */ |
|
53 |
|
54 /** |
|
55 * @Default c++ contructor |
|
56 * @since S60 3.2 |
|
57 * Perform the two phase construction |
|
58 * @param aEnv - Env Variable of Alf |
|
59 */ |
|
60 IMPORT_C CGlxInfoBubble(); |
|
61 |
|
62 /** |
|
63 * @function ConstructL |
|
64 * @since S60 3.2 |
|
65 * Perform the two phase construction |
|
66 * @param aOwnerControl - Owner control which will be the parent of Infobubble |
|
67 * @param aEnv - Env Variable of Alf |
|
68 */ |
|
69 IMPORT_C void BaseConstructL(CAlfControl &aOwnerControl, CAlfEnv &aEnv); |
|
70 |
|
71 /** |
|
72 * Destructor. |
|
73 */ |
|
74 IMPORT_C virtual ~CGlxInfoBubble(); |
|
75 |
|
76 protected: |
|
77 |
|
78 /** |
|
79 * @function DisplayBubbleL |
|
80 * @since S60 3.2 |
|
81 * @param aPos - Position of Visual for which InfoBubble will be shown |
|
82 * @param aTexture - Thumbnail texture associated with an item |
|
83 * @param aTitle - title of a tag |
|
84 * @param aSubTitle - subtitle of a tag |
|
85 */ |
|
86 IMPORT_C void DisplayBubbleL(TPoint aPos, CAlfTexture& aTexture, |
|
87 const TDesC& aTitle, const TDesC& aSubTitle); |
|
88 |
|
89 /** |
|
90 * @function UpdateTextureL |
|
91 * @since S60 3.2 |
|
92 * @param aTexture - AlfTexture associated with an item thumbnail |
|
93 */ |
|
94 IMPORT_C void UpdateTextureL(CAlfTexture& aTexture); |
|
95 |
|
96 |
|
97 /** |
|
98 * @function DisapperBubble |
|
99 * Animates when bubble becomes out of context |
|
100 * @since S60 3.2 |
|
101 */ |
|
102 IMPORT_C void DisappearBubble(); |
|
103 |
|
104 /** |
|
105 * @function CreateThumbnailTextureL |
|
106 * creates the thumbnailtexture |
|
107 * @param aMedia,media |
|
108 * @param aIdSpaceId,Id-space identifier |
|
109 * @param aSize,thumbnail size |
|
110 */ |
|
111 IMPORT_C CAlfTexture& CreateThumbnailTextureL(const TGlxMedia& aMedia, |
|
112 const TGlxIdSpaceId& aIdSpaceId,const TSize& aSize); |
|
113 |
|
114 /** |
|
115 * @function ResetImage() |
|
116 * Resets the image |
|
117 */ |
|
118 IMPORT_C void ResetImage(); |
|
119 |
|
120 private: // From MGlxTextureObserver |
|
121 void TextureContentChangedL( TBool aHasContent, CAlfTexture* aNewTexture ); |
|
122 |
|
123 private: |
|
124 |
|
125 /** |
|
126 * @function DrawBubbleFirstQuad |
|
127 * @since S60 3.2 |
|
128 * @param aReferencepos - reference postion for tail |
|
129 * @param aQuadrantId - determines the bubble type |
|
130 */ |
|
131 void DrawBubbleFirstQuadL(TPoint aReferencepos); |
|
132 |
|
133 |
|
134 /** |
|
135 * @function DrawBubbleSecondQuad |
|
136 * @since S60 3.2 |
|
137 * @param aReferencepos - reference postion for tail |
|
138 * @param aQuadrantId - determines the bubble type |
|
139 */ |
|
140 void DrawBubbleSecondQuadL(TPoint aReferencepos); |
|
141 |
|
142 |
|
143 /** |
|
144 * @function DrawBubbleThirdQuad |
|
145 * @since S60 3.2 |
|
146 * @param aReferencepos - reference postion for tail |
|
147 * @param aQuadrantId - determines the bubble type |
|
148 */ |
|
149 void DrawBubbleThirdQuadL(TPoint aReferencepos); |
|
150 |
|
151 |
|
152 /** |
|
153 * @function DrawBubbleFourthQuad |
|
154 * @since S60 3.2 |
|
155 * @param aReferencepos - reference postion for tail |
|
156 * @param aQuadrantId - determines the bubble type |
|
157 */ |
|
158 void DrawBubbleFourthQuadL(TPoint aReferencepos); |
|
159 |
|
160 |
|
161 /** |
|
162 * @function DrawBubbleLeftComponent |
|
163 * @since S60 3.2 |
|
164 */ |
|
165 void DrawBubbleLeftComponentL(); |
|
166 |
|
167 |
|
168 /** |
|
169 * @function DrawBubbleRightComponent |
|
170 * @since S60 3.2 |
|
171 */ |
|
172 void DrawBubbleRightComponentL(); |
|
173 |
|
174 |
|
175 /** |
|
176 * @function DrawBubbleExtemsibleComponent |
|
177 * @since S60 3.2 |
|
178 * @param aQuadrantId - determines the bubble type |
|
179 */ |
|
180 void DrawBubbleExtensibleComponentL(TInt aSlots); |
|
181 |
|
182 |
|
183 /** |
|
184 * @function DrawBubbleTailComponent() |
|
185 * @since S60 3.2 |
|
186 */ |
|
187 void DrawBubbleTailComponentL(); |
|
188 |
|
189 |
|
190 /** |
|
191 * @function ResetBubbleComponent() |
|
192 * @since S60 3.2 |
|
193 */ |
|
194 void ResetBubbleComponent(); |
|
195 |
|
196 |
|
197 /** |
|
198 * @function LoadTailAssembly() |
|
199 * @since S60 3.2 |
|
200 */ |
|
201 void LoadTailAssemblyL(TInt aTailEnumId, TInt aTailStripEnumId); |
|
202 |
|
203 void CreateItemContainerLayoutL(); |
|
204 |
|
205 void SetVariableVisualCountL(); |
|
206 |
|
207 //from MGlxSkinChangeObserver |
|
208 void HandleSkinChanged(); |
|
209 |
|
210 /** |
|
211 * @function SetThumbnailBorderColor() |
|
212 * @since S60 3.2 |
|
213 * Sets the color for thumbnail border |
|
214 */ |
|
215 void SetThumbnailBorderColor(); |
|
216 |
|
217 protected: |
|
218 /**UI Utility */ |
|
219 CGlxUiUtility* iUiUtility; |
|
220 |
|
221 private: |
|
222 //Enum for deciding the location of bubble |
|
223 enum TGlxBubbleQuadrantFlags |
|
224 { |
|
225 EQuadrantFirst = 0, |
|
226 EQuadrantSecond , |
|
227 EQuadrantThird, |
|
228 EQuadrantFourth |
|
229 }; |
|
230 |
|
231 /**Anchor layout for Bubble container */ |
|
232 CAlfAnchorLayout *iInfoBubbleContainer; |
|
233 |
|
234 /**Anchor layout for Bubble */ |
|
235 CAlfAnchorLayout *iInfoBubble; |
|
236 |
|
237 /**deck layout which is base layout for Bubble */ |
|
238 CAlfDeckLayout *iInfoDeck; |
|
239 |
|
240 /**Visual for centre Image of Bubble */ |
|
241 CAlfImageVisual *iDeckCentreimage; |
|
242 |
|
243 /**Visual for first line of text in Bubble */ |
|
244 CAlfTextVisual *iBubbleTextTitle; |
|
245 |
|
246 /**Visual for second line of text in Bubble */ |
|
247 CAlfTextVisual *iBubbleTextSubTitle; |
|
248 |
|
249 /**Image variable of bubble components */ |
|
250 TAlfImage iImageThumb, iImageBubbleLeft, iImageBubbleRight; |
|
251 TAlfImage iImageBubbleStrip, iImageBubbleExpand, iImageBubbleTail; |
|
252 |
|
253 /**Border brush */ |
|
254 CAlfBorderBrush *iThumbnailBorderBrush; |
|
255 |
|
256 /**Visual array for expandable middle bubble component */ |
|
257 RPointerArray <CAlfImageVisual> iBubbleExpandStrip; // |
|
258 |
|
259 /**Visual for left arc of Bubble */ |
|
260 CAlfImageVisual *iBubbleLeft; |
|
261 |
|
262 /**Visual for rightarc of Bubble */ |
|
263 CAlfImageVisual *iBubbleRight; |
|
264 |
|
265 /**Visual for strip that connects to tail of Bubble */ |
|
266 CAlfImageVisual *iBubbleTailStrip; |
|
267 |
|
268 /**Visual for tail of Bubble */ |
|
269 CAlfImageVisual *iBubbleTail; |
|
270 |
|
271 /**number of times centre bubble image is needed */ |
|
272 TReal iRoudedSlotValue; |
|
273 |
|
274 /**flag to decide iInfoBubbleContainer position */ |
|
275 TInt iTailPositionUp; |
|
276 |
|
277 /**flag to indicate whether tail will be drawn on normal position or not */ |
|
278 TInt iTailNormalPosition; |
|
279 |
|
280 /**point from which the drawing of bubble will start */ |
|
281 TPoint iBubbleRectDrawPoint; |
|
282 |
|
283 /**Storing screen width */ |
|
284 TInt iScreenWidth; |
|
285 |
|
286 /** storing screen height*/ |
|
287 TInt iScreenHeight; |
|
288 |
|
289 /**offset for bubble drawing */ |
|
290 TInt iPositionOffset; |
|
291 |
|
292 /** Stores Size of bubble*/ |
|
293 TSize iBubbleSize; |
|
294 |
|
295 /**stores counter of bubble component drawn */ |
|
296 TInt iBubbleComponentCount; |
|
297 |
|
298 /**Increment variable for X axis */ |
|
299 TPoint iPos; |
|
300 |
|
301 TInt iBubbleXaxisInc; |
|
302 |
|
303 //mif file |
|
304 TFileName iMifFile; |
|
305 CAlfTexture *iTexture; |
|
306 |
|
307 /**temporary object to store Bubble Text*/ |
|
308 CAlfTextVisual *iTempTitleText; |
|
309 }; |
|
310 |
|
311 #endif // C__GLXINFOBUBBLE_H__ |
|
312 |