|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Implementation of CBubbleOutlookOneLined class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "BMBubbleOutlookOneLined.h" |
|
21 #include "BMResourceManager.h" |
|
22 #include "BMBubbleHeader.h" |
|
23 #include "BMUtils.h" |
|
24 #include "BMCustomManager.h" |
|
25 #include "telbubbleanim.h" |
|
26 #include "BMLayout.h" |
|
27 |
|
28 #include <eiklabel.h> |
|
29 #include <eikimage.h> |
|
30 #include <featmgr.h> |
|
31 #include <AknsDrawUtils.h> |
|
32 |
|
33 // ================= MEMBER FUNCTIONS ======================= |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CBubbleOutlookOneLined::CBubbleOutlookOneLined( ) |
|
37 // |
|
38 // |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 CBubbleOutlookOneLined::CBubbleOutlookOneLined( |
|
42 CBubbleManager& aBubbleManager ) |
|
43 : CBubbleOutlook( aBubbleManager ) |
|
44 { |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CBubbleOutlookOneLined::ConstructL |
|
49 // |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 void CBubbleOutlookOneLined::ConstructL() |
|
53 { |
|
54 |
|
55 iHeader = NULL; |
|
56 CBubbleOutlook::ConstructL( ); |
|
57 ActivateL(); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CBubbleOutlookOneLined::~CBubbleOutlookOneLined() |
|
62 // |
|
63 // |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CBubbleOutlookOneLined::~CBubbleOutlookOneLined() |
|
67 { |
|
68 } |
|
69 |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CBubbleOutlookOneLined::Reset |
|
73 // |
|
74 // |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 void CBubbleOutlookOneLined::Reset( ) |
|
78 { |
|
79 |
|
80 iBubbleManager.ResourceManager().ReleaseEikImage( iBubble ); |
|
81 iBubbleManager.CustomManager().ReleaseCustomElement( iSmallCallIndication ); |
|
82 iBubbleManager.ResourceManager().ReleaseEikImage( iTypeIndication1 ); |
|
83 iBubbleManager.ResourceManager().ReleaseEikImage( iTypeIndication2 ); |
|
84 iBubbleManager.ResourceManager().ReleaseEikImage( iCyphOffImage ); |
|
85 iBubbleManager.ResourceManager().ReleaseEikLabel( iTextLine1 ); |
|
86 |
|
87 iFullText1.Set( NULL , 0 ); |
|
88 iHeader = NULL; |
|
89 } |
|
90 |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // CBubbleOutlookOneLined::ReadBubbleHeader |
|
94 // |
|
95 // |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void CBubbleOutlookOneLined::ReadBubbleHeader( CBubbleHeader& aHeader ) |
|
99 { |
|
100 iHeader = &aHeader; |
|
101 |
|
102 CBubbleManager::TPhoneCallState callState = iHeader->CallState( ); |
|
103 |
|
104 // Set small call indication icon |
|
105 TInt defaultCallIndicator; |
|
106 iSmallCallIndication = |
|
107 iBubbleManager.CustomManager().ReserveCustomElement( |
|
108 aHeader, |
|
109 CTelBubbleCustomElement::ESmallCallIndicator, |
|
110 defaultCallIndicator ); |
|
111 |
|
112 // Number type not shown with custom call indicator |
|
113 if ( defaultCallIndicator ) |
|
114 { |
|
115 // Set the additional icons |
|
116 BubbleUtils::SetCallTypePane( |
|
117 *iHeader , |
|
118 iTypeIndication1, |
|
119 iTypeIndication2, |
|
120 iBubbleManager ); |
|
121 } |
|
122 |
|
123 // Set Cyph off image |
|
124 BubbleUtils::SetCyphOffImage( *iHeader, iCyphOffImage, iBubbleManager ); |
|
125 |
|
126 |
|
127 |
|
128 // Get texts and possible timer/cost string. |
|
129 // Reserved text buffer is KBubbleLabelMaxLength. If new text |
|
130 // is longer it panics. |
|
131 // It is enough if text is cropped to fit (eg. '...1234567890') |
|
132 |
|
133 switch ( callState ) |
|
134 { |
|
135 |
|
136 case CBubbleManager::EOnHold: |
|
137 case CBubbleManager::EDisconnected: |
|
138 case CBubbleManager::EActive: |
|
139 case CBubbleManager::EWaiting: |
|
140 case CBubbleManager::EOutgoing: |
|
141 case CBubbleManager::EAlertToDisconnected: |
|
142 case CBubbleManager::EAlerting: |
|
143 iTextLine1 = iBubbleManager.ResourceManager().ReserveEikLabel(); |
|
144 iFullText1.Set( iHeader->CLI() ); |
|
145 iText1ClipDirection = iHeader->CLIClipDirection( ); |
|
146 break; |
|
147 case CBubbleManager::EIncoming: |
|
148 case CBubbleManager::ENone: |
|
149 default: |
|
150 iFullText1.Set( NULL , 0 ); |
|
151 break; |
|
152 } |
|
153 } |
|
154 |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // CBubbleOutlookOneLined::CountComponentControls() const |
|
158 // |
|
159 // |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 TInt CBubbleOutlookOneLined::CountComponentControls() const |
|
163 { |
|
164 TInt amount = 0; |
|
165 if ( iSmallCallIndication ) |
|
166 { |
|
167 amount++; |
|
168 } |
|
169 |
|
170 if ( iTypeIndication1 ) |
|
171 { |
|
172 amount++; |
|
173 } |
|
174 |
|
175 if ( iTypeIndication2 ) |
|
176 { |
|
177 amount++; |
|
178 } |
|
179 |
|
180 if ( iCyphOffImage ) |
|
181 { |
|
182 amount++; |
|
183 } |
|
184 |
|
185 if ( iTextLine1 ) |
|
186 { |
|
187 amount++; |
|
188 } |
|
189 return amount; |
|
190 } |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // CBubbleOutlookOneLined::ComponentControl |
|
194 // |
|
195 // |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 CCoeControl* CBubbleOutlookOneLined::ComponentControl( TInt aIndex ) const |
|
199 { |
|
200 TInt amount = -1; |
|
201 if ( iSmallCallIndication ) |
|
202 { |
|
203 amount++; |
|
204 } |
|
205 |
|
206 if ( aIndex == amount ) |
|
207 { |
|
208 return iSmallCallIndication->Control(); |
|
209 } |
|
210 |
|
211 if ( iTypeIndication1 ) |
|
212 { |
|
213 amount++; |
|
214 } |
|
215 |
|
216 if ( aIndex == amount ) |
|
217 { |
|
218 return iTypeIndication1; |
|
219 } |
|
220 |
|
221 if ( iTypeIndication2 ) |
|
222 { |
|
223 amount++; |
|
224 } |
|
225 |
|
226 if ( aIndex == amount ) |
|
227 { |
|
228 return iTypeIndication2; |
|
229 } |
|
230 |
|
231 if ( iCyphOffImage ) |
|
232 { |
|
233 amount++; |
|
234 } |
|
235 |
|
236 if ( aIndex == amount ) |
|
237 { |
|
238 return iCyphOffImage; |
|
239 } |
|
240 |
|
241 if ( iTextLine1 ) |
|
242 { |
|
243 amount++; |
|
244 } |
|
245 |
|
246 if ( aIndex == amount ) |
|
247 { |
|
248 return iTextLine1; |
|
249 } |
|
250 |
|
251 return NULL; |
|
252 |
|
253 } |
|
254 |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // CBubbleOutlookOneLined::Draw |
|
258 // |
|
259 // |
|
260 // --------------------------------------------------------------------------- |
|
261 // |
|
262 void CBubbleOutlookOneLined::Draw( const TRect& /*aRect*/ ) const |
|
263 { |
|
264 |
|
265 // Check that proper call header is set |
|
266 if ( iHeader == NULL ) |
|
267 { |
|
268 return; |
|
269 } |
|
270 |
|
271 if ( !iHeader->IsUsed( ) || iHeader->IsInConference( ) ) |
|
272 { |
|
273 return; |
|
274 } |
|
275 |
|
276 |
|
277 // Set texts to fit. |
|
278 BubbleUtils::ClipToLabel( iFullText1 , iTextLine1 , iText1ClipDirection ); |
|
279 |
|
280 } |
|
281 |
|
282 // --------------------------------------------------------------------------- |
|
283 // CBubbleOutlookOneLined::DrawTimerCostNow |
|
284 // |
|
285 // |
|
286 // --------------------------------------------------------------------------- |
|
287 // |
|
288 void CBubbleOutlookOneLined::DrawTimerCostNow() |
|
289 { |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------------------------- |
|
293 // CBubbleOutlookOneLined::DrawCLINow |
|
294 // |
|
295 // |
|
296 // --------------------------------------------------------------------------- |
|
297 // |
|
298 void CBubbleOutlookOneLined::DrawCLINow() |
|
299 { |
|
300 if ( iHeader == NULL ) |
|
301 { |
|
302 return; |
|
303 } |
|
304 |
|
305 iFullText1.Set( iHeader->CLI() ); |
|
306 |
|
307 CBubbleManager::TBubbleLabelString full = iHeader->CLI(); |
|
308 CBubbleManager::TPhoneClippingDirection clipDir = |
|
309 iHeader->CLIClipDirection(); |
|
310 |
|
311 // Set texts to fit. |
|
312 if ( full.Length() > 0 ) |
|
313 { |
|
314 BubbleUtils::ClipToLabel( full , iTextLine1 , clipDir ); |
|
315 BubbleUtils::AddTextToEikLabel( iTextLine1 , full ); |
|
316 } |
|
317 else |
|
318 { |
|
319 BubbleUtils::AddTextToEikLabel( iTextLine1 , KNullDesC ); |
|
320 } |
|
321 |
|
322 |
|
323 // First clear the area and then draw the new text |
|
324 DrawLabelNow( iTextLine1 ); |
|
325 } |
|
326 |
|
327 // --------------------------------------------------------------------------- |
|
328 // CBubbleOutlookOneLined::DrawBitmaps |
|
329 // |
|
330 // |
|
331 // --------------------------------------------------------------------------- |
|
332 // |
|
333 void CBubbleOutlookOneLined::DrawBitmaps( CBitmapContext& aGc ) const |
|
334 { |
|
335 // Check that proper call header is set |
|
336 if ( iHeader == NULL ) |
|
337 { |
|
338 return; |
|
339 } |
|
340 |
|
341 if ( !iHeader->IsUsed( ) || iHeader->IsInConference( ) ) |
|
342 { |
|
343 return; |
|
344 } |
|
345 |
|
346 if ( !iCallObjectDisplay ) |
|
347 { |
|
348 DrawCall1Bitmaps( aGc ); |
|
349 } |
|
350 else |
|
351 { |
|
352 DrawCall2Bitmaps( aGc ); |
|
353 } |
|
354 } |
|
355 |
|
356 // --------------------------------------------------------------------------- |
|
357 // CBubbleOutlookOneLined::HandleAnimationStartL |
|
358 // |
|
359 // |
|
360 // --------------------------------------------------------------------------- |
|
361 // |
|
362 void CBubbleOutlookOneLined::HandleAnimationStartL() const |
|
363 { |
|
364 if( iSmallCallIndication && |
|
365 iSmallCallIndication->ControlType() == CTelBubbleCustomElement::EBubbleAnimation ) |
|
366 { |
|
367 CTelBubbleAnim* anim = |
|
368 static_cast<CTelBubbleAnim*> ( iSmallCallIndication->Control() ); |
|
369 anim->StartAnimationL(); |
|
370 } |
|
371 |
|
372 } |
|
373 |
|
374 // --------------------------------------------------------------------------- |
|
375 // CBubbleOutlookOneLined::ReleaseBitmaps |
|
376 // --------------------------------------------------------------------------- |
|
377 // |
|
378 void CBubbleOutlookOneLined::ReleaseBitmaps() |
|
379 { |
|
380 |
|
381 } |
|
382 |
|
383 // --------------------------------------------------------------------------- |
|
384 // CBubbleOutlookOneLined::RebuildBitmaps |
|
385 // --------------------------------------------------------------------------- |
|
386 // |
|
387 void CBubbleOutlookOneLined::RebuildBitmaps() |
|
388 { |
|
389 |
|
390 } |
|
391 |
|
392 // --------------------------------------------------------------------------- |
|
393 // CBubbleOutlookOneLined::DrawCallHeaderText |
|
394 // --------------------------------------------------------------------------- |
|
395 // |
|
396 void CBubbleOutlookOneLined::DrawCallHeaderText() |
|
397 { |
|
398 } |
|
399 |
|
400 // --------------------------------------------------------------------------- |
|
401 // CBubbleOutlookTwoLined::DrawCall1Bitmaps |
|
402 // --------------------------------------------------------------------------- |
|
403 // |
|
404 void CBubbleOutlookOneLined::DrawCall1Bitmaps( CBitmapContext& aGc ) const |
|
405 { |
|
406 |
|
407 aGc.SetBrushColor( AKN_LAF_COLOR( BubbleLayout::LayoutColourWhite() ) ); |
|
408 if ( !BubbleUtils::DrawMaskedImage( aGc , iBubble ) ) |
|
409 { |
|
410 BubbleUtils::DrawBackgroundRect( aGc, Rect() ); |
|
411 } |
|
412 } |
|
413 |
|
414 // --------------------------------------------------------------------------- |
|
415 // CBubbleOutlookTwoLined::DrawCall2Bitmaps |
|
416 // --------------------------------------------------------------------------- |
|
417 // |
|
418 void CBubbleOutlookOneLined::DrawCall2Bitmaps( CBitmapContext& aGc ) const |
|
419 { |
|
420 if ( iBubble->Bitmap() ) |
|
421 { |
|
422 BubbleUtils::DrawMaskedImage( aGc , iBubble ); |
|
423 } |
|
424 else |
|
425 { |
|
426 // Draw bubble frame |
|
427 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
428 if ( !AknsDrawUtils::DrawFrame( skin, |
|
429 (CWindowGc&) aGc, |
|
430 iOuterRect, |
|
431 iInnerRect, |
|
432 iFrameId, |
|
433 KAknsIIDDefault ) ) |
|
434 { |
|
435 BubbleUtils::DrawBackgroundRect( aGc, Rect() ); |
|
436 } |
|
437 } |
|
438 } |
|
439 |
|
440 // End of File |