|
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: Utils |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "BMUtils.h" // definition |
|
21 #include "BMBubbleHeader.h" // CBubbleHeader |
|
22 #include "BMBubbleImageManager.h"// CBubbleImageManager |
|
23 #include "BMResourceManager.h" // Resource pool |
|
24 #include "BMPanic.h" // Panic |
|
25 #include "BMLayout.h" |
|
26 #include "BMLayout2.h" |
|
27 #include "BubbleManagerPaths.h" |
|
28 #include "BMCallObjectManager.h" |
|
29 #include "BMCallObjectUtils.h" |
|
30 #include "telbubblecustomelement.h" |
|
31 |
|
32 #include <eikimage.h> // CEikImage |
|
33 #include <eiklabel.h> // CEikLabel |
|
34 #include <bldvariant.hrh> |
|
35 #include <AknsUtils.h> |
|
36 #include <AknBidiTextUtils.h> |
|
37 #include <featmgr.h> |
|
38 #include <aknlayoutscalable_apps.cdl.h> |
|
39 #include <AknLayout2ScalableDef.h> |
|
40 #include <applayout.cdl.h> |
|
41 #include <layoutmetadata.cdl.h> |
|
42 |
|
43 #include <AknsDrawUtils.h> |
|
44 #include <akniconconfig.h> |
|
45 |
|
46 // ========================= MEMBER FUNCTIONS ================================ |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // BubbleUtils::SetCallTypePane |
|
50 // Selects item for call type pane (small bubbles and connected big bubbles) |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 TBool BubbleUtils::SetCallTypePane( const CBubbleHeader& aHeader, |
|
54 CEikImage*& aTypeImage1, |
|
55 CEikImage*& aTypeImage2, |
|
56 CBubbleManager& aBubbleManager ) |
|
57 { |
|
58 CBubbleManager::TPhoneCallState callState = aHeader.CallState( ); |
|
59 TUint32 callFlags = aHeader.CallFlags( ); |
|
60 |
|
61 TInt picture1 = KErrNotFound; |
|
62 TInt picture2 = KErrNotFound; |
|
63 TInt picture1mask = KErrNotFound; |
|
64 TInt picture2mask = KErrNotFound; |
|
65 |
|
66 switch ( callState ) |
|
67 { |
|
68 case CBubbleManager::EWaiting: |
|
69 case CBubbleManager::EIncoming: |
|
70 case CBubbleManager::EOutgoing: |
|
71 case CBubbleManager::EAlertToDisconnected: |
|
72 case CBubbleManager::EAlerting: |
|
73 case CBubbleManager::EDisconnected: |
|
74 case CBubbleManager::EActive: |
|
75 case CBubbleManager::EOnHold: |
|
76 if ( callFlags&CBubbleManager::ELine2 ) |
|
77 { |
|
78 picture1 = EQgn_indi_call_line2; |
|
79 picture1mask = EQgn_indi_call_line2_mask; |
|
80 } |
|
81 |
|
82 break; |
|
83 case CBubbleManager::ENone: |
|
84 default: |
|
85 picture1 = KErrNotFound; |
|
86 picture2 = KErrNotFound; |
|
87 break; |
|
88 } |
|
89 |
|
90 if ( picture1 == KErrNotFound ) |
|
91 { |
|
92 return EFalse; |
|
93 } |
|
94 |
|
95 __ASSERT_DEBUG( aTypeImage1 == NULL , |
|
96 Panic( EBMPanicErrorInResourceManager ) ); |
|
97 |
|
98 aTypeImage1 = aBubbleManager.ResourceManager().ReserveEikImage(); |
|
99 |
|
100 __ASSERT_DEBUG( aTypeImage1 != NULL , |
|
101 Panic( EBMPanicErrorInResourceManager ) ); |
|
102 |
|
103 if ( aTypeImage1 == NULL ) |
|
104 { |
|
105 return EFalse; |
|
106 } |
|
107 |
|
108 aBubbleManager.ImageManager().SetBitmapToImage( aTypeImage1 , |
|
109 (TBMIcons)picture1,(TBMIcons)picture1mask ); |
|
110 |
|
111 if ( picture2 != KErrNotFound ) |
|
112 { |
|
113 __ASSERT_DEBUG( aTypeImage2 == NULL , |
|
114 Panic( EBMPanicErrorInResourceManager ) ); |
|
115 |
|
116 aTypeImage2 = aBubbleManager.ResourceManager().ReserveEikImage(); |
|
117 |
|
118 __ASSERT_DEBUG( aTypeImage2 != NULL , |
|
119 Panic( EBMPanicErrorInResourceManager ) ); |
|
120 |
|
121 aBubbleManager.ImageManager().SetBitmapToImage( aTypeImage2 , |
|
122 (TBMIcons)picture2 , (TBMIcons)picture2mask ); |
|
123 |
|
124 } |
|
125 return ETrue; |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------------------------- |
|
129 // BubbleUtils::SetCyphOffImage |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 TBool BubbleUtils::SetCyphOffImage( const CBubbleHeader& aHeader, |
|
133 CEikImage*& aCypfOffImage, |
|
134 CBubbleManager& aBubbleManager ) |
|
135 { |
|
136 TUint32 callFlags = aHeader.CallFlags(); |
|
137 if ( callFlags&CBubbleManager::ENoCiphering ) |
|
138 { |
|
139 aCypfOffImage = aBubbleManager.ResourceManager().ReserveEikImage(); |
|
140 __ASSERT_DEBUG( aCypfOffImage != NULL , |
|
141 Panic( EBMPanicErrorInResourceManager ) ); |
|
142 |
|
143 aBubbleManager.ImageManager().SetBitmapToImage( aCypfOffImage , |
|
144 EQgn_indi_call_cyphering_off, |
|
145 EQgn_indi_call_cyphering_off_mask ); |
|
146 return ETrue; |
|
147 } |
|
148 return EFalse; |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // BubbleUtils::ChooseTextsToTwoLines |
|
153 // --------------------------------------------------------------------------- |
|
154 // |
|
155 void BubbleUtils::ChooseTextsToTwoLines( const CBubbleHeader& aHeader, |
|
156 TPtrC& aFirstLineText, |
|
157 TPtrC& aSecondLineText, |
|
158 CEikLabel*& aTimerCost, |
|
159 CEikLabel*& aTextLine1, |
|
160 CEikLabel*& aTextLine2, |
|
161 CBubbleManager& aBubbleManager, |
|
162 CBubbleManager::TPhoneClippingDirection& aFirstLineDir, |
|
163 CBubbleManager::TPhoneClippingDirection& aSecondLineDir, |
|
164 TUint8& aTextLineNumber ) |
|
165 { |
|
166 CBubbleManager::TPhoneCallState callState = aHeader.CallState( ); |
|
167 TUint32 callFlags = aHeader.CallFlags( ); |
|
168 |
|
169 __ASSERT_DEBUG( aTextLine1 == NULL , |
|
170 Panic( EBMPanicErrorInResourceManager ) ); |
|
171 __ASSERT_DEBUG( aTextLine2 == NULL , |
|
172 Panic( EBMPanicErrorInResourceManager ) ); |
|
173 __ASSERT_DEBUG( aTimerCost == NULL , |
|
174 Panic( EBMPanicErrorInResourceManager ) ); |
|
175 |
|
176 switch ( callState ) |
|
177 { |
|
178 case CBubbleManager::EWaiting: // 1.cli 2.text |
|
179 case CBubbleManager::EIncoming: // 1.cli 2.text |
|
180 // if there is arriving data or fax call and there is |
|
181 // cli -> there is something in text field, swap texts |
|
182 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
183 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
184 |
|
185 aFirstLineText.Set( aHeader.CLI() ); |
|
186 aFirstLineDir = aHeader.CLIClipDirection( ); |
|
187 aSecondLineText.Set( aHeader.Text() ); |
|
188 aSecondLineDir = aHeader.TextClipDirection( ); |
|
189 aTextLineNumber = 2; // Bubble text line number |
|
190 break; |
|
191 case CBubbleManager::EAlertToDisconnected: |
|
192 case CBubbleManager::EDisconnected: |
|
193 case CBubbleManager::EOnHold: |
|
194 case CBubbleManager::EAlerting: // 1.cli 2.text |
|
195 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
196 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
197 aFirstLineText.Set( aHeader.CLI() ); |
|
198 aFirstLineDir = aHeader.CLIClipDirection( ); |
|
199 aSecondLineText.Set( aHeader.Text() ); |
|
200 aSecondLineDir = aHeader.TextClipDirection( ); |
|
201 aTextLineNumber = 2; // Bubble text line number |
|
202 break; |
|
203 case CBubbleManager::EActive: // 1.cli 2.timer |
|
204 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
205 aTimerCost = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
206 aFirstLineText.Set( aHeader.CLI() ); |
|
207 aFirstLineDir = aHeader.CLIClipDirection( ); |
|
208 AddTextToEikLabel( *aTimerCost , aHeader.TimerCost( ) ); |
|
209 aSecondLineText.Set( NULL , 0 ); |
|
210 aTextLineNumber = 0; // no text is used |
|
211 break; |
|
212 case CBubbleManager::EOutgoing: // 2.cli 1.text |
|
213 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
214 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
215 aSecondLineText.Set( aHeader.CLI() ); |
|
216 aSecondLineDir = aHeader.CLIClipDirection( ); |
|
217 aFirstLineText.Set( aHeader.Text() ); |
|
218 aFirstLineDir = aHeader.TextClipDirection( ); |
|
219 aTextLineNumber = 1; // Bubble text line number |
|
220 break; |
|
221 case CBubbleManager::ENone: // flow through |
|
222 default: |
|
223 aFirstLineText.Set( NULL , 0 ); |
|
224 aSecondLineText.Set( NULL , 0 ); |
|
225 aTextLineNumber = 0; // no text is used |
|
226 break; |
|
227 } |
|
228 |
|
229 __ASSERT_DEBUG( aTextLine1 != NULL , |
|
230 Panic( EBMPanicErrorInResourceManager ) ); |
|
231 __ASSERT_DEBUG( aTextLine2 != NULL || aTimerCost != NULL , |
|
232 Panic( EBMPanicErrorInResourceManager ) ); |
|
233 |
|
234 } |
|
235 |
|
236 // --------------------------------------------------------------------------- |
|
237 // BubbleUtils::ChooseTextsToTwoLines |
|
238 // --------------------------------------------------------------------------- |
|
239 // |
|
240 void BubbleUtils::ChooseTextsToThreeLines( const CBubbleHeader& aHeader, |
|
241 TPtrC& aFirstLineText, |
|
242 TPtrC& aSecondLineText, |
|
243 TPtrC& aThirdLineText, |
|
244 CEikLabel*& aTimerCost, |
|
245 CEikLabel*& aTextLine1, |
|
246 CEikLabel*& aTextLine2, |
|
247 CEikLabel*& aTextLine3, |
|
248 CBubbleManager& aBubbleManager, |
|
249 CBubbleManager::TPhoneClippingDirection& aFirstLineDir, |
|
250 CBubbleManager::TPhoneClippingDirection& aSecondLineDir, |
|
251 CBubbleManager::TPhoneClippingDirection& aThirdLineDir, |
|
252 TUint8& aTextLineNumber ) |
|
253 { |
|
254 CBubbleManager::TPhoneCallState callState = aHeader.CallState( ); |
|
255 TUint8 callFlags = aHeader.CallFlags( ); |
|
256 |
|
257 __ASSERT_DEBUG( aTextLine1 == NULL , |
|
258 Panic( EBMPanicErrorInResourceManager ) ); |
|
259 __ASSERT_DEBUG( aTextLine2 == NULL , |
|
260 Panic( EBMPanicErrorInResourceManager ) ); |
|
261 __ASSERT_DEBUG( aTimerCost == NULL , |
|
262 Panic( EBMPanicErrorInResourceManager ) ); |
|
263 |
|
264 switch ( callState ) |
|
265 { |
|
266 case CBubbleManager::EWaiting: // 1.cli 2.cnap 3.text |
|
267 case CBubbleManager::EIncoming: // 1.cli 2.cnap 3.text |
|
268 // if there is arriving data or fax call and there is |
|
269 // cli -> there is something in text field, swap texts |
|
270 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
271 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
272 aTextLine3 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
273 |
|
274 aFirstLineText.Set( aHeader.CLI() ); |
|
275 aFirstLineDir = aHeader.CLIClipDirection( ); |
|
276 aSecondLineText.Set( aHeader.CNAP() ); |
|
277 aSecondLineDir = aHeader.CNAPClipDirection( ); |
|
278 aThirdLineText.Set( aHeader.Text() ); |
|
279 aThirdLineDir = aHeader.TextClipDirection( ); |
|
280 aTextLineNumber = 3; // Bubble text line number |
|
281 break; |
|
282 case CBubbleManager::EActive: // 1.cli 2.cnap, 3.timer |
|
283 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
284 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
285 aTextLine3 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
286 aTimerCost = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
287 AddTextToEikLabel( *aTimerCost , aHeader.TimerCost( ) ); |
|
288 aFirstLineText.Set( aHeader.CLI() ); |
|
289 aFirstLineDir = aHeader.CLIClipDirection( ); |
|
290 aSecondLineText.Set( aHeader.CNAP() ); |
|
291 aSecondLineDir = aHeader.CNAPClipDirection( ); |
|
292 aThirdLineText.Set( NULL, 0 ); |
|
293 aTextLineNumber = 0; // no text is used |
|
294 break; |
|
295 case CBubbleManager::EDisconnected: |
|
296 case CBubbleManager::EOnHold: |
|
297 case CBubbleManager::EAlerting: |
|
298 case CBubbleManager::EAlertToDisconnected: |
|
299 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
300 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
301 aTextLine3 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
302 aFirstLineText.Set( aHeader.CLI() ); |
|
303 aFirstLineDir = aHeader.CLIClipDirection( ); |
|
304 aSecondLineText.Set( aHeader.CNAP() ); |
|
305 aSecondLineDir = aHeader.CNAPClipDirection( ); |
|
306 aThirdLineText.Set( aHeader.Text() ); |
|
307 aThirdLineDir = aHeader.TextClipDirection( ); |
|
308 aTextLineNumber = 3; // text is used |
|
309 break; |
|
310 case CBubbleManager::EOutgoing: |
|
311 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
312 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
313 aTextLine3 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
314 aFirstLineText.Set( aHeader.Text() ); |
|
315 aFirstLineDir = aHeader.TextClipDirection( ); |
|
316 aSecondLineText.Set( aHeader.CLI() ); |
|
317 aSecondLineDir = aHeader.CLIClipDirection( ); |
|
318 aThirdLineText.Set( aHeader.CNAP() ); |
|
319 aThirdLineDir = aHeader.CNAPClipDirection( ); |
|
320 aTextLineNumber = 1; // Bubble text line number |
|
321 break; |
|
322 case CBubbleManager::ENone: // flow through |
|
323 default: |
|
324 aFirstLineText.Set( NULL , 0 ); |
|
325 aSecondLineText.Set( NULL , 0 ); |
|
326 aThirdLineText.Set( NULL , 0 ); |
|
327 aTextLineNumber = 0; // no text is used |
|
328 break; |
|
329 } |
|
330 |
|
331 __ASSERT_DEBUG( aTextLine1 != NULL , |
|
332 Panic( EBMPanicErrorInResourceManager ) ); |
|
333 __ASSERT_DEBUG( aTextLine2 != NULL , |
|
334 Panic( EBMPanicErrorInResourceManager ) ); |
|
335 __ASSERT_DEBUG( aTextLine3 != NULL || aTimerCost != NULL , |
|
336 Panic( EBMPanicErrorInResourceManager ) ); |
|
337 |
|
338 } |
|
339 |
|
340 // --------------------------------------------------------------------------- |
|
341 // BubbleUtils::ChooseTextsToFiveLines |
|
342 // --------------------------------------------------------------------------- |
|
343 // |
|
344 void BubbleUtils::ChooseTextsToFiveLines( |
|
345 const CBubbleHeader& aHeader, |
|
346 TPtrC& aFirstLineText, |
|
347 TPtrC& aSecondLineText, |
|
348 TPtrC& aThirdLineText, |
|
349 CEikLabel*& aTextLine1, |
|
350 CEikLabel*& aTextLine2, |
|
351 CEikLabel*& aTextLine3, |
|
352 CEikLabel*& aTextLine4, |
|
353 CEikLabel*& aTextLine5, |
|
354 CBubbleManager& aBubbleManager, |
|
355 CBubbleManager::TPhoneClippingDirection& aFirstLineDir, |
|
356 CBubbleManager::TPhoneClippingDirection& aSecondLineDir, |
|
357 CBubbleManager::TPhoneClippingDirection& aThirdLineDir, |
|
358 TUint8& aTextLineNumber, |
|
359 TBool aThreeLinesOfText ) |
|
360 { |
|
361 CBubbleManager::TPhoneCallState callState = aHeader.CallState( ); |
|
362 TUint8 callFlags = aHeader.CallFlags( ); |
|
363 |
|
364 __ASSERT_DEBUG( aTextLine1 == NULL , |
|
365 Panic( EBMPanicErrorInResourceManager ) ); |
|
366 __ASSERT_DEBUG( aTextLine2 == NULL , |
|
367 Panic( EBMPanicErrorInResourceManager ) ); |
|
368 __ASSERT_DEBUG( aTextLine3 == NULL , |
|
369 Panic( EBMPanicErrorInResourceManager ) ); |
|
370 __ASSERT_DEBUG( aTextLine4 == NULL , |
|
371 Panic( EBMPanicErrorInResourceManager ) ); |
|
372 __ASSERT_DEBUG( aTextLine5 == NULL , |
|
373 Panic( EBMPanicErrorInResourceManager ) ); |
|
374 |
|
375 switch ( callState ) |
|
376 { |
|
377 case CBubbleManager::EIncoming: |
|
378 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
379 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
380 aTextLine3 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
381 aTextLine4 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
382 aTextLine5 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
383 |
|
384 aFirstLineText.Set( aHeader.CLI() ); |
|
385 aFirstLineDir = aHeader.CLIClipDirection( ); |
|
386 |
|
387 if ( aThreeLinesOfText ) |
|
388 { |
|
389 aSecondLineText.Set( aHeader.CNAP() ); |
|
390 aSecondLineDir = aHeader.CNAPClipDirection( ); |
|
391 aThirdLineText.Set( aHeader.Text() ); |
|
392 aThirdLineDir = aHeader.TextClipDirection( ); |
|
393 aTextLineNumber = 3; // Bubble text line number |
|
394 } |
|
395 else |
|
396 { |
|
397 aSecondLineText.Set( aHeader.Text() ); |
|
398 aSecondLineDir = aHeader.TextClipDirection( ); |
|
399 aTextLineNumber = 2; // Bubble text line number |
|
400 } |
|
401 break; |
|
402 |
|
403 case CBubbleManager::EOutgoing: |
|
404 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
405 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
406 aTextLine3 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
407 aTextLine4 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
408 aTextLine5 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
409 |
|
410 if ( aThreeLinesOfText ) |
|
411 { |
|
412 aFirstLineText.Set( aHeader.Text() ); |
|
413 aFirstLineDir = aHeader.TextClipDirection( ); |
|
414 aSecondLineText.Set( aHeader.CLI() ); |
|
415 aSecondLineDir = aHeader.CLIClipDirection( ); |
|
416 aThirdLineText.Set( aHeader.CNAP() ); |
|
417 aThirdLineDir = aHeader.CNAPClipDirection( ); |
|
418 aTextLineNumber = 1; // Bubble text line number |
|
419 } |
|
420 else |
|
421 { |
|
422 aFirstLineText.Set( aHeader.Text() ); |
|
423 aFirstLineDir = aHeader.TextClipDirection( ); |
|
424 aSecondLineText.Set( aHeader.CLI() ); |
|
425 aSecondLineDir = aHeader.CLIClipDirection( ); |
|
426 aTextLineNumber = 1; // Bubble text line number |
|
427 } |
|
428 |
|
429 break; |
|
430 |
|
431 case CBubbleManager::EAlertToDisconnected: |
|
432 case CBubbleManager::EDisconnected: |
|
433 case CBubbleManager::EAlerting: // 1.cli 2.text |
|
434 aTextLine1 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
435 aTextLine2 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
436 aTextLine3 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
437 aTextLine4 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
438 aTextLine5 = aBubbleManager.ResourceManager().ReserveEikLabel(); |
|
439 |
|
440 if ( aThreeLinesOfText ) |
|
441 { |
|
442 aFirstLineText.Set( aHeader.CLI() ); |
|
443 aFirstLineDir = aHeader.CLIClipDirection( ); |
|
444 aSecondLineText.Set( aHeader.CNAP() ); |
|
445 aSecondLineDir = aHeader.CNAPClipDirection( ); |
|
446 aThirdLineText.Set( aHeader.Text() ); |
|
447 aThirdLineDir = aHeader.TextClipDirection( ); |
|
448 aTextLineNumber = 3; // Bubble text line number |
|
449 } |
|
450 else |
|
451 { |
|
452 aFirstLineText.Set( aHeader.CLI() ); |
|
453 aFirstLineDir = aHeader.CLIClipDirection( ); |
|
454 aSecondLineText.Set( aHeader.Text() ); |
|
455 aSecondLineDir = aHeader.TextClipDirection( ); |
|
456 aTextLineNumber = 2; // Bubble text line number |
|
457 } |
|
458 break; |
|
459 |
|
460 case CBubbleManager::ENone: // flow through |
|
461 default: |
|
462 aFirstLineText.Set( NULL , 0 ); |
|
463 aSecondLineText.Set( NULL , 0 ); |
|
464 aThirdLineText.Set( NULL , 0 ); |
|
465 aTextLineNumber = 0; // no text is used |
|
466 break; |
|
467 } |
|
468 |
|
469 __ASSERT_DEBUG( aTextLine1 != NULL , |
|
470 Panic( EBMPanicErrorInResourceManager ) ); |
|
471 __ASSERT_DEBUG( aTextLine2 != NULL , |
|
472 Panic( EBMPanicErrorInResourceManager ) ); |
|
473 __ASSERT_DEBUG( aTextLine3 != NULL , |
|
474 Panic( EBMPanicErrorInResourceManager ) ); |
|
475 __ASSERT_DEBUG( aTextLine4 != NULL , |
|
476 Panic( EBMPanicErrorInResourceManager ) ); |
|
477 __ASSERT_DEBUG( aTextLine5 != NULL , |
|
478 Panic( EBMPanicErrorInResourceManager ) ); |
|
479 } |
|
480 |
|
481 // --------------------------------------------------------------------------- |
|
482 // BubbleUtils::SetTextInLabel |
|
483 // --------------------------------------------------------------------------- |
|
484 // |
|
485 void BubbleUtils::SetTextInLabel( |
|
486 const TDesC16& aText, |
|
487 CEikLabel*& aLabel , |
|
488 const CBubbleManager::TPhoneClippingDirection& aClipDir ) |
|
489 { |
|
490 __ASSERT_DEBUG( aLabel , Panic( EBMPanicErrorInResourceManager ) ); |
|
491 if ( aLabel == NULL ) |
|
492 { |
|
493 return; |
|
494 } |
|
495 SetTextInLabel( aText, *aLabel, aClipDir ); |
|
496 } |
|
497 |
|
498 // --------------------------------------------------------------------------- |
|
499 // BubbleUtils::SetTextInLabel |
|
500 // Gets usable text from given buffer. There might be long and short version. |
|
501 // --------------------------------------------------------------------------- |
|
502 // |
|
503 void BubbleUtils::SetTextInLabel( |
|
504 const TDesC16& aText, |
|
505 CEikLabel& aLabel , |
|
506 const CBubbleManager::TPhoneClippingDirection& aClipDir ) |
|
507 { |
|
508 // Trivial case |
|
509 if ( aText.Length() == 0 || aText == KNullDesC ) |
|
510 { |
|
511 AddTextToEikLabel( aLabel , KNullDesC ); |
|
512 return; |
|
513 } |
|
514 |
|
515 // Find text separator (/t) if long and short text are both added to the |
|
516 // same descriptor. |
|
517 TInt separator = KErrNotFound; |
|
518 for ( TInt i = 0 ; i < aText.Length() ; i++ ) |
|
519 { |
|
520 if ( aText[i] == KBubbleTextSeparator()[0] ) |
|
521 { |
|
522 separator = i; |
|
523 break; |
|
524 } |
|
525 } |
|
526 |
|
527 TPtrC longText( NULL ,0 ); |
|
528 TPtrC shortText( NULL ,0 ); |
|
529 TPtrC usedText( NULL , 0 ); |
|
530 if ( separator != KErrNotFound ) |
|
531 { |
|
532 // The buffer is like 'LongText'+'/t'(+'ShortText'). |
|
533 longText.Set( aText.Left( separator ) ); |
|
534 if ( separator != aText.Length()-1 ) |
|
535 { |
|
536 shortText.Set( aText.Right( aText.Length() - separator -1 ) ); |
|
537 } |
|
538 } |
|
539 else |
|
540 { |
|
541 longText.Set( aText ); |
|
542 } |
|
543 |
|
544 // does the long text fit in label? |
|
545 if ( aLabel.Font()->TextWidthInPixels( longText ) > aLabel.Size().iWidth ) |
|
546 { |
|
547 //no. Use short text if there is one |
|
548 if ( shortText.Length() > 0 ) |
|
549 { |
|
550 usedText.Set( shortText ); |
|
551 } |
|
552 else |
|
553 { |
|
554 usedText.Set( longText ); |
|
555 } |
|
556 } |
|
557 else |
|
558 { |
|
559 //yes - so use the long text |
|
560 usedText.Set( longText ); |
|
561 } |
|
562 |
|
563 // fit the used text in label - clip if needed |
|
564 ClipToLabel( usedText , aLabel , aClipDir ); |
|
565 } |
|
566 |
|
567 // --------------------------------------------------------------------------- |
|
568 // BubbleUtils::ClipToLabel |
|
569 // --------------------------------------------------------------------------- |
|
570 // |
|
571 void BubbleUtils::ClipToLabel( |
|
572 const TDesC16& aText, |
|
573 CEikLabel*& aLabel , |
|
574 const CBubbleManager::TPhoneClippingDirection& aClipDir ) |
|
575 { |
|
576 __ASSERT_DEBUG( aLabel , Panic( EBMPanicErrorInResourceManager ) ); |
|
577 if ( aLabel == NULL ) |
|
578 { |
|
579 return; |
|
580 } |
|
581 ClipToLabel( aText, *aLabel, aClipDir ); |
|
582 } |
|
583 |
|
584 // --------------------------------------------------------------------------- |
|
585 // BubbleUtils::ClipToLabel |
|
586 // --------------------------------------------------------------------------- |
|
587 // |
|
588 void BubbleUtils::ClipToLabel( |
|
589 const TDesC16& aText, |
|
590 CEikLabel& aLabel , |
|
591 const CBubbleManager::TPhoneClippingDirection& aClipDir ) |
|
592 { |
|
593 // Trivial case |
|
594 if ( aText.Length() == 0 || aText == KNullDesC ) |
|
595 { |
|
596 AddTextToEikLabel( aLabel , KNullDesC ); |
|
597 return; |
|
598 } |
|
599 |
|
600 // allocations not leaving |
|
601 HBufC* textBuffer = |
|
602 HBufC::New( aText.Length() + KAknBidiExtraSpacePerLine ); |
|
603 HBufC* visualBuffer = |
|
604 HBufC::New( aText.Length() + KAknBidiExtraSpacePerLine ); |
|
605 |
|
606 if( visualBuffer && textBuffer && aClipDir == CBubbleManager::ERight ) |
|
607 { |
|
608 *textBuffer = aText; |
|
609 TPtr ptr1 = textBuffer->Des(); |
|
610 TPtr ptr2 = visualBuffer->Des(); |
|
611 // fit the used text in label - clip if needed |
|
612 AknBidiTextUtils::ConvertToVisualAndClip( |
|
613 ptr1, |
|
614 ptr2, |
|
615 *aLabel.Font(), |
|
616 aLabel.Size().iWidth, |
|
617 aLabel.Size().iWidth ); |
|
618 aLabel.UseLogicalToVisualConversion( EFalse ); |
|
619 AddTextToEikLabel( aLabel , ptr2 ); |
|
620 } |
|
621 else |
|
622 { |
|
623 CBubbleManager::TBubbleLabelString usedText = aText; |
|
624 AknTextUtils::TClipDirection dir = |
|
625 AknTextUtils::EClipFromBeginning; |
|
626 if ( aClipDir == CBubbleManager::ERight ) |
|
627 { |
|
628 dir = AknTextUtils::EClipFromEnd; |
|
629 } |
|
630 else |
|
631 { |
|
632 ConvertToArabicIndic( usedText ); |
|
633 } |
|
634 AknTextUtils::ClipToFit( |
|
635 usedText, |
|
636 *aLabel.Font(), |
|
637 aLabel.Size().iWidth, |
|
638 dir ); |
|
639 AddTextToEikLabel( aLabel, usedText ); |
|
640 } |
|
641 |
|
642 delete textBuffer; |
|
643 delete visualBuffer; |
|
644 } |
|
645 |
|
646 |
|
647 |
|
648 // --------------------------------------------------------------------------- |
|
649 // BubbleUtils::DrawMaskedImage |
|
650 // --------------------------------------------------------------------------- |
|
651 // |
|
652 TBool BubbleUtils::DrawMaskedImage( CBitmapContext& aGc , CEikImage* aImage ) |
|
653 { |
|
654 if ( aImage == NULL ) |
|
655 { |
|
656 return EFalse; |
|
657 } |
|
658 |
|
659 // Bitmap is initialized |
|
660 if ( aImage->Bitmap() && aImage->Bitmap()->Handle() ) |
|
661 { |
|
662 DrawMaskedImage( aGc , *aImage ); |
|
663 return ETrue; |
|
664 } |
|
665 else |
|
666 { |
|
667 return EFalse; |
|
668 } |
|
669 } |
|
670 |
|
671 // --------------------------------------------------------------------------- |
|
672 // BubbleUtils::DrawMaskedImage |
|
673 // --------------------------------------------------------------------------- |
|
674 // |
|
675 void BubbleUtils::DrawMaskedImage( CBitmapContext& aGc , CEikImage& aImage ) |
|
676 { |
|
677 TSize imageSize = aImage.MinimumSize(); |
|
678 if ( aImage.Mask() ) |
|
679 { |
|
680 aGc.BitBltMasked( |
|
681 aImage.Rect().iTl, |
|
682 aImage.Bitmap(), |
|
683 TRect( TPoint( 0 , 0 ) , |
|
684 TPoint( imageSize.iWidth , imageSize.iHeight ) ), |
|
685 aImage.Mask(), |
|
686 ETrue ); |
|
687 } |
|
688 else |
|
689 { |
|
690 aGc.BitBlt |
|
691 ( |
|
692 aImage.Rect().iTl, |
|
693 aImage.Bitmap(), |
|
694 TRect( TPoint( 0 , 0 ) , |
|
695 TPoint( imageSize.iWidth , imageSize.iHeight ) ) |
|
696 ); |
|
697 } |
|
698 } |
|
699 |
|
700 // --------------------------------------------------------------------------- |
|
701 // BubbleUtils::AddTextToEikLabel |
|
702 // --------------------------------------------------------------------------- |
|
703 // |
|
704 void BubbleUtils::AddTextToEikLabel( CEikLabel& aLabel , const TDesC& aText ) |
|
705 { |
|
706 if ( aText.Length() > KBubbleLabelMaxLength ) |
|
707 { |
|
708 TRAPD ( error, aLabel.SetBufferReserveLengthL( aText.Length() ) ); |
|
709 if ( error != KErrNone ) |
|
710 { |
|
711 aLabel.SetTextL( aText.Left( KBubbleLabelMaxLength ) ); |
|
712 return; |
|
713 } |
|
714 } |
|
715 aLabel.SetTextL( aText ); |
|
716 } |
|
717 |
|
718 // --------------------------------------------------------------------------- |
|
719 // BubbleUtils::AddTextToEikLabel |
|
720 // --------------------------------------------------------------------------- |
|
721 // |
|
722 void BubbleUtils::AddTextToEikLabel( CEikLabel*& aLabel , const TDesC& aText ) |
|
723 { |
|
724 if ( aLabel == NULL ) |
|
725 { |
|
726 return; |
|
727 } |
|
728 AddTextToEikLabel( *aLabel, aText ); |
|
729 } |
|
730 |
|
731 // --------------------------------------------------------------------------- |
|
732 // BubbleUtils::AddTextToHeader |
|
733 // --------------------------------------------------------------------------- |
|
734 // |
|
735 void BubbleUtils::AddTextToHeader( |
|
736 CBubbleHeader& aHeader, |
|
737 const KBubbleUtilsHeaderTextPlace aTextPlace, |
|
738 const TDesC& aTextToSet, |
|
739 const TInt aMaxLength, |
|
740 const CBubbleManager::TPhoneClippingDirection aClipDirection ) |
|
741 { |
|
742 |
|
743 TPtrC buffer( NULL , 0 ); |
|
744 |
|
745 if ( aTextToSet.Length() > aMaxLength ) |
|
746 { |
|
747 if ( aClipDirection == CBubbleManager::ERight ) |
|
748 { |
|
749 buffer.Set( aTextToSet.Left( aMaxLength ) ); |
|
750 } |
|
751 else |
|
752 { |
|
753 buffer.Set( aTextToSet.Right( aMaxLength ) ); |
|
754 } |
|
755 } |
|
756 else |
|
757 { |
|
758 buffer.Set( aTextToSet ); |
|
759 } |
|
760 |
|
761 switch ( aTextPlace ) |
|
762 { |
|
763 case EBubbleHeaderCLI: |
|
764 aHeader.SetCLI( buffer, aClipDirection ); |
|
765 break; |
|
766 case EBubbleHeaderLabel: |
|
767 aHeader.SetText( buffer, aClipDirection ); |
|
768 break; |
|
769 case EBubbleHeaderTimerCost: |
|
770 aHeader.SetTimerCost( buffer ); |
|
771 break; |
|
772 case EBubbleHeaderCNAP: |
|
773 aHeader.SetCNAP( buffer, aClipDirection ); |
|
774 break; |
|
775 default: |
|
776 Panic( EBMPanicUnhandledSwitchCase ); |
|
777 break; |
|
778 |
|
779 } |
|
780 |
|
781 } |
|
782 |
|
783 // --------------------------------------------------------------------------- |
|
784 // BubbleUtils::LayoutControl |
|
785 // --------------------------------------------------------------------------- |
|
786 // |
|
787 void BubbleUtils::LayoutControl( CCoeControl* aControl, |
|
788 const TRect& aControlParent, |
|
789 const TAknWindowLineLayout& aLayout ) |
|
790 { |
|
791 if ( aControl == NULL ) |
|
792 { |
|
793 return; |
|
794 } |
|
795 AknLayoutUtils::LayoutControl( aControl, aControlParent, aLayout ); |
|
796 } |
|
797 |
|
798 // --------------------------------------------------------------------------- |
|
799 // BubbleUtils::LayoutBackgroundImage |
|
800 // --------------------------------------------------------------------------- |
|
801 // |
|
802 void BubbleUtils::LayoutBackgroundImage( CEikImage* aImage, |
|
803 const TRect& aParent, |
|
804 const TAknWindowLineLayout& aLayout ) |
|
805 { |
|
806 if ( aImage == NULL ) |
|
807 { |
|
808 return; |
|
809 } |
|
810 |
|
811 AknLayoutUtils::LayoutControl( aImage, aParent, aLayout ); |
|
812 if ( aImage->Bitmap() ) |
|
813 { |
|
814 AknIconUtils::SetSize( const_cast<CFbsBitmap*>( aImage->Bitmap() ), |
|
815 aImage->Rect().Size(), |
|
816 EAspectRatioNotPreserved ); |
|
817 } |
|
818 } |
|
819 |
|
820 // --------------------------------------------------------------------------- |
|
821 // BubbleUtils::LayoutImage |
|
822 // --------------------------------------------------------------------------- |
|
823 // |
|
824 void BubbleUtils::LayoutImage( CEikImage* aImage, |
|
825 const TRect& aParent, |
|
826 const TAknWindowLineLayout& aLayout ) |
|
827 { |
|
828 if ( aImage == NULL ) |
|
829 { |
|
830 return; |
|
831 } |
|
832 AknLayoutUtils::LayoutImage( aImage, aParent, aLayout ); |
|
833 } |
|
834 |
|
835 void BubbleUtils::LayoutImage( CEikImage* aImage, |
|
836 const TRect& aParent, |
|
837 const AknLayoutUtils::SAknLayoutControl& aLayout ) |
|
838 { |
|
839 if ( aImage == NULL ) |
|
840 { |
|
841 return; |
|
842 } |
|
843 AknLayoutUtils::LayoutImage( aImage, aParent, aLayout ); |
|
844 } |
|
845 |
|
846 // --------------------------------------------------------------------------- |
|
847 // BubbleUtils::LayoutLabel |
|
848 // --------------------------------------------------------------------------- |
|
849 // |
|
850 void BubbleUtils::LayoutLabel( CEikLabel* aLabel, |
|
851 const TRect& aLabelParent, |
|
852 const TAknTextLineLayout& aLayout ) |
|
853 { |
|
854 if ( aLabel == NULL ) |
|
855 { |
|
856 return; |
|
857 } |
|
858 AknLayoutUtils::LayoutLabel( aLabel, aLabelParent, aLayout ); |
|
859 |
|
860 // Check skinnig colour for the text: |
|
861 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
862 TRgb skinColor; |
|
863 TInt error = |
|
864 AknsUtils::GetCachedColor( |
|
865 skin, |
|
866 skinColor, |
|
867 KAknsIIDQsnTextColors, |
|
868 EAknsCIQsnTextColorsCG51 ); |
|
869 if ( error == KErrNone ) |
|
870 { |
|
871 // Ignore error |
|
872 TRAP_IGNORE( aLabel->OverrideColorL( EColorLabelText, skinColor ) ); |
|
873 } |
|
874 } |
|
875 |
|
876 // --------------------------------------------------------------------------- |
|
877 // BubbleUtils::LayoutCustomElement |
|
878 // --------------------------------------------------------------------------- |
|
879 // |
|
880 void BubbleUtils::LayoutCustomElement( |
|
881 CTelBubbleCustomElement* aElement, |
|
882 const TRect& aParent, |
|
883 const TAknWindowLineLayout& aLayout) |
|
884 { |
|
885 if ( aElement == NULL ) |
|
886 { |
|
887 return; |
|
888 } |
|
889 |
|
890 if ( aElement->ControlType() == CTelBubbleCustomElement::EBubbleImage ) |
|
891 { |
|
892 BubbleUtils::LayoutImage( |
|
893 static_cast<CEikImage*>( aElement->Control() ), |
|
894 aParent, |
|
895 aLayout ); |
|
896 } |
|
897 else |
|
898 { |
|
899 BubbleUtils::LayoutControl( |
|
900 aElement->Control(), |
|
901 aParent, |
|
902 aLayout ); |
|
903 } |
|
904 } |
|
905 |
|
906 // --------------------------------------------------------------------------- |
|
907 // BubbleUtils::ConvertToArabicIndic |
|
908 // |
|
909 // --------------------------------------------------------------------------- |
|
910 // |
|
911 void BubbleUtils::ConvertToArabicIndic( |
|
912 TDes& aResult, |
|
913 const TDesC& aSource ) |
|
914 { |
|
915 __ASSERT_DEBUG( aResult.MaxLength() >= aSource.Length(), |
|
916 User::Invariant()); |
|
917 if ( aResult.MaxLength() < aSource.Length() ) |
|
918 { |
|
919 return; |
|
920 } |
|
921 |
|
922 aResult = aSource; |
|
923 ConvertToArabicIndic( aResult ); |
|
924 } |
|
925 |
|
926 // --------------------------------------------------------------------------- |
|
927 // BubbleUtils::ConvertToArabicIndic |
|
928 // |
|
929 // --------------------------------------------------------------------------- |
|
930 // |
|
931 void BubbleUtils::ConvertToArabicIndic( TDes& aDes ) |
|
932 { |
|
933 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aDes ); |
|
934 } |
|
935 |
|
936 // --------------------------------------------------------------------------- |
|
937 // BubbleUtils::ConvertToArabicIndic |
|
938 // |
|
939 // --------------------------------------------------------------------------- |
|
940 // |
|
941 HBufC* BubbleUtils::ConvertToArabicIndic( const TDesC& aDes ) |
|
942 { |
|
943 HBufC* buffer = HBufC::New( aDes.Length() ); |
|
944 if ( !buffer ) |
|
945 { |
|
946 return NULL; |
|
947 } |
|
948 TPtr ptr = buffer->Des(); |
|
949 ConvertToArabicIndic( ptr , aDes ); |
|
950 return buffer; |
|
951 } |
|
952 |
|
953 // --------------------------------------------------------------------------- |
|
954 // BubbleUtils::SetLayoutForCellTypePane |
|
955 // |
|
956 // --------------------------------------------------------------------------- |
|
957 // |
|
958 void BubbleUtils::SetLayoutForCellTypePane( |
|
959 const CBubblePlace::TPhoneBubblePlace& aBubblePlace, |
|
960 const TRect& aParent, |
|
961 CEikImage* aTypeIndication1, |
|
962 CEikImage* aTypeIndication2 ) |
|
963 { |
|
964 CCoeControl* cellTypePane = new CCoeControl; |
|
965 if ( !cellTypePane ) |
|
966 { |
|
967 return; |
|
968 } |
|
969 |
|
970 switch ( aBubblePlace ) |
|
971 { |
|
972 case CBubblePlace::EBottom: |
|
973 case CBubblePlace::EBottomCnap: |
|
974 LayoutControl( cellTypePane , aParent , |
|
975 BubbleLayout::popup_call_audio_first_window_1_elements_2() ); |
|
976 break; |
|
977 case CBubblePlace::EBottomRightActive: |
|
978 case CBubblePlace::EBottomRightHeld: |
|
979 case CBubblePlace::EBottomRightCnap: |
|
980 case CBubblePlace::EBottomRightActiveTouch: |
|
981 case CBubblePlace::EBottomRightActiveCnapTouch: |
|
982 LayoutControl( cellTypePane , aParent , |
|
983 BubbleLayout::popup_call_audio_second_window_1_elements_2() ); |
|
984 break; |
|
985 case CBubblePlace::EMiddleActive: |
|
986 case CBubblePlace::EMiddleHeld: |
|
987 case CBubblePlace::EMiddleCnap: |
|
988 LayoutControl( cellTypePane , aParent , |
|
989 BubbleLayout::popup_call_audio_first_window_2_elements_2() ); |
|
990 break; |
|
991 case CBubblePlace::ETopLeft: |
|
992 case CBubblePlace::EMiddleHeldTouch: |
|
993 LayoutControl( cellTypePane , aParent , |
|
994 BubbleLayout::popup_call_audio_first_window_4_elements_2() ); |
|
995 break; |
|
996 case CBubblePlace::ETopRight: |
|
997 LayoutControl( cellTypePane , aParent , |
|
998 BubbleLayout::popup_call_audio_second_window_3_elements_2() ); |
|
999 break; |
|
1000 default: |
|
1001 break; |
|
1002 } |
|
1003 |
|
1004 LayoutImage( aTypeIndication1 , cellTypePane->Rect() , |
|
1005 BubbleLayout::call_type_pane_elements_1() ); |
|
1006 LayoutImage( aTypeIndication2 , cellTypePane->Rect() , |
|
1007 BubbleLayout::call_type_pane_elements_2() ); |
|
1008 |
|
1009 delete cellTypePane; |
|
1010 } |
|
1011 |
|
1012 // --------------------------------------------------------------------------- |
|
1013 // BubbleUtils::SetLayoutFofCypheringOffIcon |
|
1014 // |
|
1015 // --------------------------------------------------------------------------- |
|
1016 // |
|
1017 void BubbleUtils::SetLayoutFofCypheringOffIcon( |
|
1018 const CBubbleHeader& aHeader, |
|
1019 const CBubblePlace::TPhoneBubblePlace& aBubblePlace, |
|
1020 const TRect& aParent, |
|
1021 CEikImage* aCyphOffImage ) |
|
1022 { |
|
1023 const CBubbleManager::TPhoneCallState callState = aHeader.CallState(); |
|
1024 |
|
1025 const TBool connected = |
|
1026 callState == CBubbleManager::EOnHold || |
|
1027 callState == CBubbleManager::EDisconnected || |
|
1028 callState == CBubbleManager::EActive; |
|
1029 |
|
1030 switch ( aBubblePlace ) |
|
1031 { |
|
1032 case CBubblePlace::EBottomCnap: |
|
1033 case CBubblePlace::EBottom: |
|
1034 if ( connected ) |
|
1035 { |
|
1036 LayoutImage( aCyphOffImage, aParent, |
|
1037 BubbleLayout::popup_call_audio_first_window_1_elements_3() ); |
|
1038 } |
|
1039 else |
|
1040 { |
|
1041 LayoutImage( aCyphOffImage, aParent, |
|
1042 BubbleLayout::popup_call_audio_in_window_1_elements_15() ); |
|
1043 } |
|
1044 break; |
|
1045 case CBubblePlace::EBottomRightActive: |
|
1046 case CBubblePlace::EBottomRightHeld: |
|
1047 case CBubblePlace::EBottomRightCnap: |
|
1048 case CBubblePlace::EBottomRightActiveTouch: |
|
1049 case CBubblePlace::EBottomRightActiveCnapTouch: |
|
1050 if ( connected ) |
|
1051 { |
|
1052 LayoutImage( aCyphOffImage, aParent, |
|
1053 BubbleLayout::popup_call_audio_second_window_1_elements_3() ); |
|
1054 } |
|
1055 else |
|
1056 { |
|
1057 LayoutImage( aCyphOffImage, aParent, |
|
1058 BubbleLayout::popup_call_audio_out_window_1_elements_15() ); |
|
1059 } |
|
1060 break; |
|
1061 case CBubblePlace::EMiddleActive: |
|
1062 case CBubblePlace::EMiddleHeld: |
|
1063 case CBubblePlace::EMiddleCnap: |
|
1064 if ( connected ) |
|
1065 { |
|
1066 LayoutImage( aCyphOffImage, aParent, |
|
1067 BubbleLayout::popup_call_audio_first_window_2_elements_15() ); |
|
1068 } |
|
1069 else |
|
1070 { |
|
1071 LayoutImage( aCyphOffImage, aParent, |
|
1072 BubbleLayout::popup_call_audio_in_window_2_elements_15() ); |
|
1073 } |
|
1074 break; |
|
1075 case CBubblePlace::ETopLeft: |
|
1076 case CBubblePlace::EMiddleHeldTouch: |
|
1077 if ( connected ) |
|
1078 { |
|
1079 LayoutImage( aCyphOffImage, aParent, |
|
1080 BubbleLayout::popup_call_audio_first_window_4_elements_3() ); |
|
1081 } |
|
1082 else |
|
1083 { |
|
1084 LayoutImage( aCyphOffImage, aParent, |
|
1085 BubbleLayout::popup_call_audio_wait_window_3_elements_3() ); |
|
1086 } |
|
1087 break; |
|
1088 case CBubblePlace::ETopRight: |
|
1089 if ( connected ) |
|
1090 { |
|
1091 LayoutImage( aCyphOffImage, aParent, |
|
1092 BubbleLayout::popup_call_audio_second_window_3_elements_3() ); |
|
1093 } |
|
1094 else |
|
1095 { |
|
1096 LayoutImage( aCyphOffImage, aParent, |
|
1097 BubbleLayout::popup_call_audio_out_window_2_elements_15() ); |
|
1098 } |
|
1099 break; |
|
1100 case CBubblePlace::EBottomText: |
|
1101 if ( connected ) |
|
1102 { |
|
1103 LayoutImage( aCyphOffImage, aParent, |
|
1104 BubbleLayout2::popup_call2_audio_in_ciphering_icon( 0 ) ); |
|
1105 } |
|
1106 break; |
|
1107 default: |
|
1108 break; |
|
1109 } |
|
1110 } |
|
1111 |
|
1112 // --------------------------------------------------------------------------- |
|
1113 // BubbleUtils::PlaceThumbnail |
|
1114 // |
|
1115 // --------------------------------------------------------------------------- |
|
1116 // |
|
1117 void BubbleUtils::PlaceThumbnail( |
|
1118 const CBubblePlace::TPhoneBubblePlace& aBubblePlace, |
|
1119 CEikImage* aImage , |
|
1120 TBubbleLayoutRect& aShadow, |
|
1121 const TRect& aParentRect, |
|
1122 CFbsBitmap* aThumbNailBitmap ) |
|
1123 { |
|
1124 if ( !( aImage && aImage->Bitmap() ) ) |
|
1125 { |
|
1126 return; |
|
1127 } |
|
1128 |
|
1129 TAknLayoutRect thumbnailLayoutRect; |
|
1130 TAknLayoutRect shadowLayoutRect; |
|
1131 TAknWindowLineLayout thumbnailShadowLine; |
|
1132 |
|
1133 // Bitmap is resized separately, not via AknLayoutUtils::LayoutImage() |
|
1134 aImage->SetPicture( NULL ); |
|
1135 |
|
1136 // wrong layout data within AppLayout::Incoming_call_pop_up_window_elements_Line_14() |
|
1137 switch ( aBubblePlace ) |
|
1138 { |
|
1139 case CBubblePlace::EBottom: |
|
1140 case CBubblePlace::EBottomCnap: |
|
1141 AknLayoutUtils::LayoutImage( aImage, aParentRect, |
|
1142 AppLayout::Incoming_call_pop_up_window_elements_Line_12() ); |
|
1143 thumbnailLayoutRect.LayoutRect( aParentRect, |
|
1144 AppLayout::Incoming_call_pop_up_window_elements_Line_12() ); |
|
1145 thumbnailShadowLine = |
|
1146 AppLayout::Incoming_call_pop_up_window_elements_Line_11(); |
|
1147 shadowLayoutRect.LayoutRect( aParentRect, thumbnailShadowLine ); |
|
1148 break; |
|
1149 case CBubblePlace::EBottomRightActive: |
|
1150 case CBubblePlace::EBottomRightHeld: |
|
1151 case CBubblePlace::EBottomRightCnap: |
|
1152 case CBubblePlace::EBottomRightActiveTouch: |
|
1153 case CBubblePlace::EBottomRightActiveCnapTouch: |
|
1154 AknLayoutUtils::LayoutImage( aImage, aParentRect, |
|
1155 AppLayout::Outgoing_call_pop_up_window_elements__held__Line_12() ); |
|
1156 thumbnailLayoutRect.LayoutRect( aParentRect, |
|
1157 AppLayout::Outgoing_call_pop_up_window_elements__held__Line_12() ); |
|
1158 thumbnailShadowLine = |
|
1159 AppLayout::Outgoing_call_pop_up_window_elements__held__Line_11(); |
|
1160 shadowLayoutRect.LayoutRect( aParentRect, thumbnailShadowLine ); |
|
1161 break; |
|
1162 case CBubblePlace::EMiddleActive: |
|
1163 case CBubblePlace::EMiddleHeld: |
|
1164 case CBubblePlace::EMiddleCnap: |
|
1165 AknLayoutUtils::LayoutImage( aImage, aParentRect, |
|
1166 AppLayout::Incoming_call_pop_up_window_elements__NE__Line_12() ); |
|
1167 thumbnailLayoutRect.LayoutRect( aParentRect, |
|
1168 AppLayout::Incoming_call_pop_up_window_elements__NE__Line_12() ); |
|
1169 thumbnailShadowLine = |
|
1170 AppLayout::Incoming_call_pop_up_window_elements__NE__Line_11(); |
|
1171 shadowLayoutRect.LayoutRect( aParentRect, thumbnailShadowLine ); |
|
1172 break; |
|
1173 default: |
|
1174 break; |
|
1175 } |
|
1176 |
|
1177 AknIconUtils::SetSize( aThumbNailBitmap, thumbnailLayoutRect.Rect().Size(), |
|
1178 EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
1179 aImage->SetPicture( aThumbNailBitmap ); |
|
1180 aShadow.SetColor( AKN_LAF_COLOR(221) ); |
|
1181 // aShadow.SetColor( shadowLayoutRect.Color() ); |
|
1182 // int leftGap = shadowLayoutRect.Rect().iTl.iX - thumbnailLayoutRect.Rect().iTl.iX; |
|
1183 // int topGap = shadowLayoutRect.Rect().iTl.iY - thumbnailLayoutRect.Rect().iTl.iY; |
|
1184 int leftGap = 1; |
|
1185 int topGap = 1; |
|
1186 aShadow.SetRect( aImage->Position() + TPoint( leftGap, topGap ), |
|
1187 aImage->MinimumSize() ); |
|
1188 |
|
1189 } |
|
1190 |
|
1191 // --------------------------------------------------------------------------- |
|
1192 // BubbleUtils::IsCustomImageWidth |
|
1193 // --------------------------------------------------------------------------- |
|
1194 // |
|
1195 TBool BubbleUtils::IsCustomizedImage( const TRect& aParent, const TInt aWidth ) |
|
1196 { |
|
1197 TInt type = GetThumbnailImageType( aParent, aWidth ); |
|
1198 TBool ret = EFalse; |
|
1199 if( ( type == 0 ) && ( aWidth != 0 ) ) // Customized |
|
1200 { |
|
1201 ret = ETrue; |
|
1202 } |
|
1203 return ret; |
|
1204 } |
|
1205 |
|
1206 // --------------------------------------------------------------------------- |
|
1207 // BubbleUtils::LabelExtent |
|
1208 // --------------------------------------------------------------------------- |
|
1209 // |
|
1210 void BubbleUtils::LabelExtent( CEikLabel* aLabel, |
|
1211 const TRect& aParent, |
|
1212 const TInt aWidth ) |
|
1213 { |
|
1214 if ( aLabel == NULL ) |
|
1215 { |
|
1216 return; |
|
1217 } |
|
1218 |
|
1219 if( BubbleUtils::IsCustomizedImage( aParent, aWidth ) ) |
|
1220 { |
|
1221 TInt width = aLabel->Size().iWidth - aWidth; |
|
1222 if( width > 0 ) |
|
1223 { |
|
1224 TRect rect = aLabel->Rect(); |
|
1225 |
|
1226 if( AknLayoutUtils::LayoutMirrored() ) |
|
1227 { |
|
1228 rect.iTl.iX += aWidth; |
|
1229 } |
|
1230 rect.SetWidth( width ); |
|
1231 |
|
1232 aLabel->SetRect( rect ); |
|
1233 } |
|
1234 } |
|
1235 } |
|
1236 |
|
1237 // --------------------------------------------------------------------------- |
|
1238 // BubbleUtils::GetThumbnailImageType |
|
1239 // --------------------------------------------------------------------------- |
|
1240 // |
|
1241 TInt BubbleUtils::GetThumbnailImageType( const TRect& /*aParent*/, |
|
1242 const TInt aWidth ) |
|
1243 { |
|
1244 /* Scalable UI uses only one image size. |
|
1245 TAknLayoutRect rectVGAturned; |
|
1246 rectVGAturned.LayoutRect( aParent, AppLayout::VGA_turned_90() ); |
|
1247 const TInt widthVGAturned = rectVGAturned.Rect().Width(); |
|
1248 |
|
1249 TAknLayoutRect rectCIFturned; |
|
1250 rectCIFturned.LayoutRect( aParent, AppLayout::CIF_turned_90() ); |
|
1251 const TInt widthCIFturned = rectCIFturned.Rect().Width(); |
|
1252 |
|
1253 TAknLayoutRect rectVGAnormal; |
|
1254 rectVGAnormal.LayoutRect( aParent, AppLayout::VGA() ); |
|
1255 const TInt widthVGAnormal = rectVGAnormal.Rect().Width(); |
|
1256 |
|
1257 TAknLayoutRect rectCIFnormal; |
|
1258 rectCIFnormal.LayoutRect( aParent, AppLayout::CIF() ); |
|
1259 const TInt widthCIFnormal = rectCIFnormal.Rect().Width(); |
|
1260 |
|
1261 TAknLayoutRect rectCommmunicator; |
|
1262 rectCommmunicator.LayoutRect( aParent, |
|
1263 AppLayout::Communicator_personal_image() ); |
|
1264 const TInt widthCommmunicator = rectCommmunicator.Rect().Width(); |
|
1265 |
|
1266 TInt ret; |
|
1267 if( aWidth == widthVGAturned ) |
|
1268 { |
|
1269 ret = 1; |
|
1270 } |
|
1271 else if( aWidth == widthCIFturned ) |
|
1272 { |
|
1273 ret = 2; |
|
1274 } |
|
1275 else if( aWidth == widthVGAnormal || aWidth == widthCommmunicator ) |
|
1276 { |
|
1277 ret = 3; |
|
1278 } |
|
1279 else if( aWidth == widthCIFnormal ) |
|
1280 { |
|
1281 ret = 4; |
|
1282 } |
|
1283 else // no image. |
|
1284 { |
|
1285 ret = 0; |
|
1286 }*/ |
|
1287 |
|
1288 TInt ret(0); // no thumbnail |
|
1289 if ( aWidth > 0 ) |
|
1290 { |
|
1291 // see First_call_pop_up_window_texts__one_call__Line_1 in |
|
1292 // Adaptation_Layer_AppLayout_Elaf |
|
1293 ret = 4; |
|
1294 } |
|
1295 |
|
1296 return ret; |
|
1297 } |
|
1298 |
|
1299 // --------------------------------------------------------------------------- |
|
1300 // BubbleUtils::BubbleIconFileName |
|
1301 // --------------------------------------------------------------------------- |
|
1302 // |
|
1303 void BubbleUtils::BubbleIconFileName( TDes& aFileName ) |
|
1304 { |
|
1305 aFileName = KBMMbmZDrive; |
|
1306 aFileName.Append( KDC_APP_BITMAP_DIR ); |
|
1307 aFileName.Append( KBMBitmapFile ); |
|
1308 aFileName.ZeroTerminate(); |
|
1309 } |
|
1310 |
|
1311 // --------------------------------------------------------------------------- |
|
1312 // BubbleUtils::BubbleResourceFileName |
|
1313 // --------------------------------------------------------------------------- |
|
1314 // |
|
1315 void BubbleUtils::BubbleResourceFileName( TDes& aFileName ) |
|
1316 { |
|
1317 aFileName = KBMMbmZDrive; |
|
1318 aFileName.Append( KDC_RESOURCE_FILES_DIR ); |
|
1319 aFileName.Append( KBMResourcesFile ); |
|
1320 aFileName.ZeroTerminate(); |
|
1321 } |
|
1322 |
|
1323 // ---------------------------------------------------------------------------- |
|
1324 // BubbleUtils::::DrawBackgroundRect |
|
1325 // ---------------------------------------------------------------------------- |
|
1326 // |
|
1327 void BubbleUtils::DrawBackgroundRect( CBitmapContext& aGc, |
|
1328 const TRect& aRect ) |
|
1329 { |
|
1330 TRect bgRect( aRect ); |
|
1331 bgRect.Shrink( aRect.Width() / 48, aRect.Height() / 24 ); |
|
1332 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
1333 aGc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
1334 |
|
1335 bgRect.Move(2,2); |
|
1336 aGc.SetBrushColor( AKN_LAF_COLOR(221) ); |
|
1337 aGc.DrawRect( bgRect ); |
|
1338 bgRect.Move(-2,-2); |
|
1339 aGc.SetBrushColor( AKN_LAF_COLOR(0) ); |
|
1340 aGc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
1341 aGc.SetPenColor( AKN_LAF_COLOR(217) ); |
|
1342 aGc.DrawRect( bgRect ); |
|
1343 |
|
1344 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
1345 } |
|
1346 |
|
1347 // ---------------------------------------------------------------------------- |
|
1348 // TBubbleLayoutRect::TBubbleLayoutRect |
|
1349 // ---------------------------------------------------------------------------- |
|
1350 // |
|
1351 TBubbleLayoutRect::TBubbleLayoutRect() {} |
|
1352 |
|
1353 // ---------------------------------------------------------------------------- |
|
1354 // TBubbleLayoutRect::SetRect |
|
1355 // ---------------------------------------------------------------------------- |
|
1356 // |
|
1357 void TBubbleLayoutRect::SetRect( const TPoint& aPoint, const TSize& aSize ) |
|
1358 { |
|
1359 iRect.SetRect( aPoint, aSize ); |
|
1360 } |
|
1361 |
|
1362 // ---------------------------------------------------------------------------- |
|
1363 // TBubbleLayoutRect::Rect |
|
1364 // ---------------------------------------------------------------------------- |
|
1365 // |
|
1366 TRect TBubbleLayoutRect::Rect() const |
|
1367 { |
|
1368 return iRect; |
|
1369 } |
|
1370 |
|
1371 // ---------------------------------------------------------------------------- |
|
1372 // TBubbleLayoutRect::SetColor |
|
1373 // ---------------------------------------------------------------------------- |
|
1374 // |
|
1375 void TBubbleLayoutRect::SetColor( const TRgb aColor ) |
|
1376 { |
|
1377 iColor = aColor; |
|
1378 } |
|
1379 |
|
1380 // ---------------------------------------------------------------------------- |
|
1381 // TBubbleLayoutRect::Color |
|
1382 // ---------------------------------------------------------------------------- |
|
1383 // |
|
1384 TRgb TBubbleLayoutRect::Color() const |
|
1385 { |
|
1386 return iColor; |
|
1387 } |
|
1388 |
|
1389 // --------------------------------------------------------------------------- |
|
1390 // BubbleUtils::PrepareBubbleImageL |
|
1391 // --------------------------------------------------------------------------- |
|
1392 // |
|
1393 void BubbleUtils::PrepareBubbleImageL( |
|
1394 const TAknsItemID& aFrameID, |
|
1395 const TRect& aOuterRect, |
|
1396 const TRect& aInnerRect, |
|
1397 CEikImage*& aBubble ) |
|
1398 { |
|
1399 /////////////////////////////////////////////////////// |
|
1400 // Create bitmap |
|
1401 /////////////////////////////////////////////////////// |
|
1402 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap; |
|
1403 CleanupStack::PushL( bitmap ); |
|
1404 |
|
1405 // create bitmap to target size |
|
1406 AknIconConfig::TPreferredDisplayMode mode; |
|
1407 AknIconConfig::PreferredDisplayMode( mode, |
|
1408 AknIconConfig::EImageTypeIcon); |
|
1409 User::LeaveIfError( bitmap->Create( aOuterRect.Size(), |
|
1410 mode.iBitmapMode ) ); |
|
1411 |
|
1412 // create context |
|
1413 CFbsBitmapDevice* bitmapDev = CFbsBitmapDevice::NewL( bitmap ); |
|
1414 CleanupStack::PushL( bitmapDev ); |
|
1415 CFbsBitGc* bitmapCtx; |
|
1416 User::LeaveIfError( bitmapDev->CreateContext( bitmapCtx ) ); |
|
1417 CleanupStack::PushL( bitmapCtx ); |
|
1418 |
|
1419 // draw frame |
|
1420 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1421 |
|
1422 AknsDrawUtils::DrawFrame( skin, |
|
1423 *bitmapCtx, |
|
1424 aOuterRect, |
|
1425 aInnerRect, |
|
1426 aFrameID, |
|
1427 KAknsIIDDefault, |
|
1428 KAknsDrawParamRGBOnly ); |
|
1429 |
|
1430 aBubble->SetBitmap( bitmap ); |
|
1431 |
|
1432 CleanupStack::PopAndDestroy( 2, bitmapDev ); |
|
1433 CleanupStack::Pop( bitmap ); |
|
1434 |
|
1435 /////////////////////////////////////////////////////// |
|
1436 // Create mask |
|
1437 /////////////////////////////////////////////////////// |
|
1438 CFbsBitmap* mask = new(ELeave) CFbsBitmap; |
|
1439 CleanupStack::PushL( mask ); |
|
1440 |
|
1441 // create bitmap to target size |
|
1442 User::LeaveIfError( mask->Create( aOuterRect.Size(), |
|
1443 mode.iMaskMode ) ); |
|
1444 |
|
1445 // create context |
|
1446 CFbsBitmapDevice* maskDev = CFbsBitmapDevice::NewL( mask ); |
|
1447 CleanupStack::PushL( maskDev ); |
|
1448 CFbsBitGc* maskCtx; |
|
1449 User::LeaveIfError( maskDev->CreateContext( maskCtx ) ); |
|
1450 CleanupStack::PushL( maskCtx ); |
|
1451 |
|
1452 // draw frame |
|
1453 AknsDrawUtils::DrawFrame( skin, |
|
1454 *maskCtx, |
|
1455 aOuterRect, |
|
1456 aInnerRect, |
|
1457 aFrameID, |
|
1458 KAknsIIDDefault, |
|
1459 KAknsSDMAlphaOnly ); |
|
1460 |
|
1461 aBubble->SetMask( mask ); |
|
1462 |
|
1463 CleanupStack::PopAndDestroy( 2, maskDev ); |
|
1464 CleanupStack::Pop( mask ); |
|
1465 } |
|
1466 |
|
1467 // --------------------------------------------------------------------------- |
|
1468 // BubbleUtils::AddTransparencyToBubbleImageL |
|
1469 // --------------------------------------------------------------------------- |
|
1470 // |
|
1471 void BubbleUtils::AddTransparencyToBubbleImageL( |
|
1472 const TAknsItemID& aFrameID, |
|
1473 const TRect& aOuterRect, |
|
1474 const TRect& aInnerRect, |
|
1475 CEikImage*& aBubble ) |
|
1476 { |
|
1477 |
|
1478 const CFbsBitmap* currentMask = aBubble->Mask(); |
|
1479 TSize maskSize( currentMask->SizeInPixels() ); |
|
1480 TRect rect( maskSize ); |
|
1481 |
|
1482 // create transparency frame |
|
1483 CFbsBitmap* transparency = new(ELeave) CFbsBitmap; |
|
1484 CleanupStack::PushL( transparency ); |
|
1485 User::LeaveIfError( transparency->Create( aOuterRect.Size(), |
|
1486 EGray256 ) ); |
|
1487 CFbsBitmapDevice* transparencyDev = CFbsBitmapDevice::NewL( transparency ); |
|
1488 CleanupStack::PushL( transparencyDev ); |
|
1489 CFbsBitGc* transparencyCtx; |
|
1490 User::LeaveIfError( transparencyDev->CreateContext( transparencyCtx ) ); |
|
1491 CleanupStack::PushL( transparencyCtx ); |
|
1492 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1493 AknsDrawUtils::DrawFrame( skin, |
|
1494 *transparencyCtx, |
|
1495 aOuterRect, |
|
1496 aInnerRect, |
|
1497 aFrameID, |
|
1498 KAknsIIDDefault, |
|
1499 KAknsDrawParamDefault ); |
|
1500 |
|
1501 CleanupStack::PopAndDestroy( 2, transparencyDev ); |
|
1502 |
|
1503 // create solid black mask |
|
1504 CFbsBitmap* solidBlack = new(ELeave) CFbsBitmap; |
|
1505 CleanupStack::PushL( solidBlack ); |
|
1506 User::LeaveIfError( solidBlack->Create( maskSize, EGray256 ) ); |
|
1507 CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL( solidBlack ); |
|
1508 CleanupStack::PushL( dev ); |
|
1509 CFbsBitGc* gc; |
|
1510 User::LeaveIfError( dev->CreateContext( gc ) ); |
|
1511 CleanupStack::PushL( gc ); |
|
1512 |
|
1513 gc->SetBrushColor( KRgbBlack ); |
|
1514 gc->SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
1515 gc->DrawRect( rect ); |
|
1516 |
|
1517 // blit original mask on the black mask using transparency mask |
|
1518 gc->BitBltMasked( TPoint(0,0), |
|
1519 currentMask, |
|
1520 TRect( currentMask->SizeInPixels() ), |
|
1521 transparency, |
|
1522 ETrue ); |
|
1523 |
|
1524 CleanupStack::PopAndDestroy( 2, dev); |
|
1525 |
|
1526 CleanupStack::Pop(solidBlack); |
|
1527 aBubble->SetMask( solidBlack ); |
|
1528 |
|
1529 CleanupStack::PopAndDestroy( transparency ); |
|
1530 delete currentMask; |
|
1531 } |
|
1532 |
|
1533 // --------------------------------------------------------------------------- |
|
1534 // BubbleUtils::PrepareCallObjectToBubbleImageL |
|
1535 // --------------------------------------------------------------------------- |
|
1536 // |
|
1537 void BubbleUtils::PrepareCallObjectToBubbleImageL( |
|
1538 const CFbsBitmap* aCOImage, |
|
1539 const CFbsBitmap* aCOImageMask, |
|
1540 const TRect& /*aCallObjectRect*/, |
|
1541 const TAknsItemID& aFrameID, |
|
1542 const TRect& aOuterRect, |
|
1543 const TRect& aInnerRect, |
|
1544 CEikImage*& aBubble, |
|
1545 TBool aDimmed ) |
|
1546 { |
|
1547 const CFbsBitmap* bubbleBitmap = aBubble->Bitmap(); |
|
1548 TSize callObjectSize( aCOImage->SizeInPixels() ); |
|
1549 |
|
1550 // set source rectangle, clip from center if bigger than target |
|
1551 TRect srcRect( aCOImage->SizeInPixels() ); |
|
1552 TInt clipX = ( callObjectSize.iWidth > aOuterRect.Width() ) ? |
|
1553 ( callObjectSize.iWidth - aOuterRect.Width() ) : 0; |
|
1554 TInt clipY = ( callObjectSize.iHeight > aOuterRect.Height() ) ? |
|
1555 ( callObjectSize.iHeight - aOuterRect.Height() ) : 0; |
|
1556 srcRect.Shrink( clipX / 2, clipY / 2 ); |
|
1557 |
|
1558 // set offset/alignment for image |
|
1559 TPoint offset(0,0); |
|
1560 if ( ( callObjectSize.iWidth > aOuterRect.Width() ) ) |
|
1561 { |
|
1562 // Not usual situation, only if smaller image is under scaling. |
|
1563 // Set horizontally centered. |
|
1564 offset.iX = (aOuterRect.Width() - callObjectSize.iWidth) / 2; |
|
1565 } |
|
1566 else if ( !Layout_Meta_Data::IsMirrored() ) |
|
1567 { |
|
1568 // Align image horizontally right |
|
1569 offset.iX = ( callObjectSize.iWidth < aOuterRect.Width() ) ? |
|
1570 (aOuterRect.Width() - callObjectSize.iWidth ) : 0; |
|
1571 } |
|
1572 // vertically centered |
|
1573 offset.iY = (aOuterRect.Height() - callObjectSize.iHeight) / 2; |
|
1574 |
|
1575 // create gradient mask |
|
1576 CFbsBitmap* gradientMask = new(ELeave) CFbsBitmap; |
|
1577 CleanupStack::PushL( gradientMask ); |
|
1578 // mask has to be in same size than call object |
|
1579 User::LeaveIfError( gradientMask->Create( callObjectSize, |
|
1580 EGray256 ) ); |
|
1581 CFbsBitmapDevice* gradientMaskDev = CFbsBitmapDevice::NewL( gradientMask ); |
|
1582 CleanupStack::PushL( gradientMaskDev ); |
|
1583 CFbsBitGc* gradientMaskCtx; |
|
1584 User::LeaveIfError( gradientMaskDev->CreateContext( gradientMaskCtx ) ); |
|
1585 CleanupStack::PushL( gradientMaskCtx ); |
|
1586 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1587 // initialize mask to black color |
|
1588 gradientMaskCtx->SetBrushColor( AKN_LAF_COLOR(215) ); // black |
|
1589 gradientMaskCtx->SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
1590 gradientMaskCtx->SetPenStyle( CGraphicsContext::ENullPen ); |
|
1591 gradientMaskCtx->DrawRect( callObjectSize ); |
|
1592 // shift origin |
|
1593 gradientMaskCtx->SetOrigin( -offset ); |
|
1594 AknsDrawUtils::DrawFrame( skin, |
|
1595 *gradientMaskCtx, |
|
1596 aOuterRect, |
|
1597 aInnerRect, |
|
1598 aFrameID, |
|
1599 KAknsIIDDefault, |
|
1600 KAknsDrawParamDefault ); |
|
1601 |
|
1602 CleanupStack::PopAndDestroy( 2, gradientMaskDev ); |
|
1603 |
|
1604 if ( aCOImageMask ) |
|
1605 { |
|
1606 // combine image and gradient mask |
|
1607 CFbsBitmap* combinedMask = CreateCombinedMaskL( |
|
1608 gradientMask, aCOImageMask ); |
|
1609 // switch to combined mask |
|
1610 CleanupStack::PopAndDestroy(gradientMask); |
|
1611 gradientMask = combinedMask; |
|
1612 CleanupStack::PushL( gradientMask ); |
|
1613 } |
|
1614 |
|
1615 // blit image to bubble through gradient mask |
|
1616 CFbsBitmapDevice* bubbleDev = |
|
1617 CFbsBitmapDevice::NewL( const_cast<CFbsBitmap*>(bubbleBitmap) ); |
|
1618 CleanupStack::PushL( bubbleDev ); |
|
1619 CFbsBitGc* bubbleGc; |
|
1620 User::LeaveIfError( bubbleDev->CreateContext( bubbleGc ) ); |
|
1621 CleanupStack::PushL( bubbleGc ); |
|
1622 |
|
1623 |
|
1624 TPoint blitOffset; |
|
1625 blitOffset.iX = ( offset.iX < 0 ) ? 0 : offset.iX; |
|
1626 blitOffset.iY = ( offset.iY < 0 ) ? 0 : offset.iY; |
|
1627 |
|
1628 bubbleGc->SetFaded( aDimmed ); |
|
1629 bubbleGc->BitBltMasked( aOuterRect.iTl + blitOffset, |
|
1630 aCOImage, |
|
1631 srcRect, |
|
1632 gradientMask, |
|
1633 ETrue ); |
|
1634 |
|
1635 CleanupStack::PopAndDestroy( 3, gradientMask ); |
|
1636 } |
|
1637 |
|
1638 // --------------------------------------------------------------------------- |
|
1639 // BubbleUtils::LayoutCallTypeIndicators |
|
1640 // --------------------------------------------------------------------------- |
|
1641 // |
|
1642 void BubbleUtils::LayoutCallTypeIndicators( |
|
1643 const TRect& aParent, |
|
1644 const TAknWindowLineLayout& aCallTypePane, |
|
1645 CEikImage* aTypeIndication1, |
|
1646 CEikImage* aTypeIndication2 ) |
|
1647 { |
|
1648 if ( !aTypeIndication1 && !aTypeIndication2 ) |
|
1649 { |
|
1650 return; |
|
1651 } |
|
1652 |
|
1653 // split pane |
|
1654 TAknLayoutRect callTypePaneRect; |
|
1655 callTypePaneRect.LayoutRect( aParent, |
|
1656 aCallTypePane ); |
|
1657 |
|
1658 TRect paneRect = callTypePaneRect.Rect(); |
|
1659 TInt paneWidth = paneRect.Width(); |
|
1660 TInt paneHeight = paneRect.Height(); |
|
1661 TSize indSize( paneWidth/2, paneHeight ); |
|
1662 |
|
1663 TRect indRect1 = TRect( TPoint( paneRect.iTl ), indSize ); |
|
1664 |
|
1665 TRect indRect2 = TRect( TPoint( paneRect.iTl.iX + ( paneWidth / 2 ), |
|
1666 paneRect.iTl.iY ), indSize ); |
|
1667 |
|
1668 if ( Layout_Meta_Data::IsMirrored() ) |
|
1669 { |
|
1670 // switch positions |
|
1671 TRect tmp = indRect2; |
|
1672 indRect2 = indRect1; |
|
1673 indRect1 = tmp; |
|
1674 } |
|
1675 |
|
1676 if ( aTypeIndication1 ) |
|
1677 { |
|
1678 aTypeIndication1->SetRect( indRect1 ); |
|
1679 } |
|
1680 |
|
1681 if ( aTypeIndication2 ) |
|
1682 { |
|
1683 if ( aTypeIndication1 ) |
|
1684 { |
|
1685 aTypeIndication2->SetRect( indRect2 ); |
|
1686 } |
|
1687 else |
|
1688 { |
|
1689 aTypeIndication2->SetRect( indRect1 ); |
|
1690 } |
|
1691 } |
|
1692 } |
|
1693 |
|
1694 // --------------------------------------------------------------------------- |
|
1695 // BubbleUtils::PrepareCallObjectImageL |
|
1696 // --------------------------------------------------------------------------- |
|
1697 // |
|
1698 void BubbleUtils::PrepareCallObjectImageL( |
|
1699 CBubbleHeader& aHeader, |
|
1700 const TSize& aSize ) |
|
1701 { |
|
1702 CFbsBitmap* bitmap = aHeader.CallObjectImage(); |
|
1703 |
|
1704 if ( bitmap ) |
|
1705 { |
|
1706 CBubbleHeader::TBMCallObjectImageType imageType = |
|
1707 aHeader.CallObjectImageType(); |
|
1708 |
|
1709 if ( imageType == CBubbleHeader::EThemeImage && |
|
1710 AknIconUtils::IsMifIcon( bitmap ) ) |
|
1711 { |
|
1712 // This does nothing, if icon is already in requested size. |
|
1713 TInt err = AknIconUtils::SetSize( |
|
1714 bitmap, |
|
1715 aSize, |
|
1716 EAspectRatioPreservedSlice ); |
|
1717 |
|
1718 if ( err != KErrNone ) // out of memory |
|
1719 { |
|
1720 aHeader.SetCallObjectImage( NULL ); |
|
1721 aHeader.SetCallObjectImageMask( NULL ); |
|
1722 User::Leave( err ); |
|
1723 } |
|
1724 } |
|
1725 else if ( imageType == CBubbleHeader::EGalleryImage && |
|
1726 aHeader.TnBitmap() ) |
|
1727 { |
|
1728 TSize thumbnailSize = aHeader.TnBitmap()->SizeInPixels(); |
|
1729 |
|
1730 // Allow one pixel rounding inaccuracy |
|
1731 if ( thumbnailSize.iWidth >= (aSize.iWidth - 1) && |
|
1732 thumbnailSize.iHeight >= (aSize.iHeight - 1) ) |
|
1733 { |
|
1734 aHeader.SwitchToThumbnailImage(); |
|
1735 } |
|
1736 } |
|
1737 } |
|
1738 } |
|
1739 |
|
1740 // --------------------------------------------------------------------------- |
|
1741 // BubbleUtils::CreateCombinedMaskL |
|
1742 // --------------------------------------------------------------------------- |
|
1743 // |
|
1744 CFbsBitmap* BubbleUtils::CreateCombinedMaskL( |
|
1745 const CFbsBitmap* aPrimaryMask, |
|
1746 const CFbsBitmap* aSecondaryMask ) |
|
1747 { |
|
1748 __ASSERT_DEBUG( aPrimaryMask != NULL, |
|
1749 Panic( EBMPanicErrorInResourceManager ) ); |
|
1750 __ASSERT_DEBUG( aSecondaryMask != NULL, |
|
1751 Panic( EBMPanicErrorInResourceManager ) ); |
|
1752 |
|
1753 TSize size = aPrimaryMask->SizeInPixels(); |
|
1754 |
|
1755 // create combined mask |
|
1756 CFbsBitmap* combinedMask = new(ELeave) CFbsBitmap; |
|
1757 CleanupStack::PushL( combinedMask ); |
|
1758 User::LeaveIfError( combinedMask->Create( size, |
|
1759 EGray256 ) ); |
|
1760 |
|
1761 CFbsBitmapDevice* combinedMaskDev = |
|
1762 CFbsBitmapDevice::NewL( combinedMask ); |
|
1763 CleanupStack::PushL( combinedMaskDev ); |
|
1764 CFbsBitGc* combinedMaskCtx; |
|
1765 User::LeaveIfError( combinedMaskDev->CreateContext( |
|
1766 combinedMaskCtx ) ); |
|
1767 CleanupStack::PushL( combinedMaskCtx ); |
|
1768 |
|
1769 // initialize mask to black color |
|
1770 combinedMaskCtx->SetBrushColor( AKN_LAF_COLOR(215) ); // black |
|
1771 combinedMaskCtx->SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
1772 combinedMaskCtx->SetPenStyle( CGraphicsContext::ENullPen ); |
|
1773 combinedMaskCtx->DrawRect( size ); |
|
1774 |
|
1775 // blit secondary mask through primary mask |
|
1776 combinedMaskCtx->BitBltMasked( TPoint(0,0), |
|
1777 aSecondaryMask, |
|
1778 size, |
|
1779 aPrimaryMask, |
|
1780 ETrue ); |
|
1781 |
|
1782 CleanupStack::PopAndDestroy( 2, combinedMaskDev ); |
|
1783 CleanupStack::Pop( combinedMask ); |
|
1784 |
|
1785 return combinedMask; |
|
1786 } |
|
1787 |
|
1788 // End of File |