|
1 /* |
|
2 * Copyright (c) 2002 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: Outlook Top Right |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "BMBubbleManager.h" //for enumerations |
|
21 #include "BMBubbleOutlookTopRight.h" |
|
22 #include "BMBubbleImageManager.h" |
|
23 #include "BMResourceManager.h" |
|
24 #include "BMBubbleHeader.h" |
|
25 #include "BMUtils.h" |
|
26 #include "BMLayout.h" |
|
27 #include "BMLayout2.h" |
|
28 |
|
29 #include <eiklabel.h> |
|
30 #include <eikimage.h> |
|
31 #include <eikenv.h> |
|
32 #include <AknsUtils.h> |
|
33 #include <AknsDrawUtils.h> |
|
34 |
|
35 // ========================= MEMBER FUNCTIONS ================================ |
|
36 |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CBubbleOutlookTopRight::CBubbleOutlookTopRight |
|
40 // |
|
41 // |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 CBubbleOutlookTopRight::CBubbleOutlookTopRight( CBubbleManager& aBubbleManager ) |
|
45 : CBubbleOutlookOneLined( aBubbleManager ) |
|
46 { |
|
47 } |
|
48 |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CBubbleOutlookTopRight::ConstructL |
|
52 // |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CBubbleOutlookTopRight::ConstructL() |
|
56 { |
|
57 CBubbleOutlookOneLined::ConstructL( ); |
|
58 } |
|
59 |
|
60 // Destructor |
|
61 CBubbleOutlookTopRight::~CBubbleOutlookTopRight() |
|
62 { |
|
63 |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CBubbleOutlookTopRight::ReadBubbleHeader |
|
68 // |
|
69 // |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 void CBubbleOutlookTopRight::ReadBubbleHeader( CBubbleHeader& aHeader ) |
|
73 { |
|
74 iHeader = &aHeader; |
|
75 |
|
76 iBubble = iBubbleManager.ResourceManager().ReserveEikImage( ETrue ); |
|
77 |
|
78 if ( !iCallObjectDisplay ) |
|
79 { |
|
80 GetCall1BubbleBitmaps(); |
|
81 } |
|
82 |
|
83 CBubbleOutlookOneLined::ReadBubbleHeader( aHeader ); |
|
84 } |
|
85 |
|
86 |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CBubbleOutlookTopRight::SizeChanged |
|
90 // called by framwork when the view size is changed |
|
91 // |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CBubbleOutlookTopRight::SizeChanged() |
|
95 { |
|
96 if( !iHeader ) |
|
97 { |
|
98 return; |
|
99 } |
|
100 |
|
101 AknsUtils::RegisterControlPosition( this ); |
|
102 |
|
103 if ( !iCallObjectDisplay ) |
|
104 { |
|
105 DoCall1Layout(); |
|
106 } |
|
107 else |
|
108 { |
|
109 TRAPD( err, DoCall2LayoutL() ); |
|
110 if ( err ) |
|
111 { |
|
112 iBubble->SetPicture( NULL, NULL ); |
|
113 |
|
114 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
115 AknsDrawUtils::PrepareFrame( skin, |
|
116 iOuterRect, |
|
117 iInnerRect, |
|
118 iFrameId, |
|
119 KAknsIIDDefault ); |
|
120 } |
|
121 } |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // CBubbleOutlookTopRight::DoCall1Layout |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 void CBubbleOutlookTopRight::DoCall1Layout() |
|
129 { |
|
130 // Deprecated |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // CBubbleOutlookTopRight::DoCall2Layout |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 void CBubbleOutlookTopRight::DoCall2LayoutL() |
|
138 { |
|
139 iBubble->SetPictureOwnedExternally( EFalse ); |
|
140 iBubble->SetPicture( NULL, NULL ); |
|
141 |
|
142 const TRect rect = Rect(); |
|
143 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
144 switch ( callState ) |
|
145 { |
|
146 case CBubbleManager::EWaiting: |
|
147 case CBubbleManager::EIncoming: |
|
148 case CBubbleManager::EOutgoing: |
|
149 case CBubbleManager::EAlerting: |
|
150 case CBubbleManager::EAlertToDisconnected: |
|
151 { |
|
152 /////////////////////////////////////////////////////////////////// |
|
153 // Outgoing call layout. Two calls and number entry. |
|
154 /////////////////////////////////////////////////////////////////// |
|
155 |
|
156 TAknLayoutRect bubbleRect; |
|
157 bubbleRect.LayoutRect( |
|
158 rect, |
|
159 BubbleLayout2::popup_call2_audio_out_background(1) ); |
|
160 |
|
161 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
162 TRect outerRect; |
|
163 TRect innerRect; |
|
164 BubbleLayout2::RectFrameInnerOuterRects( frameRect, |
|
165 outerRect, |
|
166 innerRect); |
|
167 |
|
168 iFrameId = ( callState == CBubbleManager::EAlertToDisconnected ) ? |
|
169 KAknsIIDQsnFrCall2RectDisconn : |
|
170 KAknsIIDQsnFrCall2Rect; |
|
171 |
|
172 iOuterRect = outerRect; |
|
173 iOuterRect.Move( Rect().iTl ); |
|
174 iInnerRect = innerRect; |
|
175 iInnerRect.Move( Rect().iTl ); |
|
176 |
|
177 // Call icon |
|
178 BubbleUtils::LayoutCustomElement( |
|
179 iSmallCallIndication, |
|
180 rect, |
|
181 BubbleLayout2::popup_call2_audio_out_call_waiting_icon(2) ); |
|
182 |
|
183 // Ciphering off |
|
184 BubbleUtils::LayoutControl( |
|
185 iCyphOffImage, |
|
186 rect, |
|
187 BubbleLayout2::popup_call2_audio_out_ciphering_icon(2) ); |
|
188 |
|
189 // Call type pane |
|
190 BubbleUtils::LayoutCallTypeIndicators( |
|
191 rect, |
|
192 BubbleLayout2::popup_call2_audio_second_call_type_icon(0), |
|
193 iTypeIndication1, // Data/Fax |
|
194 iTypeIndication2 ); // ALS line 2 |
|
195 |
|
196 // Text |
|
197 BubbleUtils::LayoutLabel( |
|
198 iTextLine1, |
|
199 rect, |
|
200 BubbleLayout2::popup_call2_audio_out_call_text_1(2) ); |
|
201 |
|
202 // Create call object bitmaps |
|
203 iBubble->SetRect( bubbleRect.Rect() ); |
|
204 |
|
205 BubbleUtils::PrepareBubbleImageL( |
|
206 iFrameId, |
|
207 outerRect, |
|
208 innerRect, |
|
209 iBubble ); |
|
210 |
|
211 if ( iHeader->CallObjectImage() && |
|
212 !iHeader->CallObjectText().Length() ) |
|
213 { |
|
214 // Add transparency |
|
215 BubbleUtils::AddTransparencyToBubbleImageL( |
|
216 KAknsIIDQsnFrCall2RectCoMask, // gradient tp mask |
|
217 outerRect, |
|
218 innerRect, |
|
219 iBubble ); |
|
220 } |
|
221 break; |
|
222 } |
|
223 case CBubbleManager::EDisconnected: |
|
224 case CBubbleManager::EActive: |
|
225 case CBubbleManager::EOnHold: |
|
226 { |
|
227 /////////////////////////////////////////////////////////////////// |
|
228 // Second call layout. Two calls and number entry. |
|
229 /////////////////////////////////////////////////////////////////// |
|
230 |
|
231 // Create bubble image |
|
232 TAknLayoutRect bubbleRect; |
|
233 bubbleRect.LayoutRect( |
|
234 rect, |
|
235 BubbleLayout2::popup_call2_audio_second_call_background(0) ); |
|
236 |
|
237 TRect frameRect( TPoint(0,0), bubbleRect.Rect().Size() ); |
|
238 TRect outerRect; |
|
239 TRect innerRect; |
|
240 BubbleLayout2::BubbleFrameInnerOuterRects( frameRect, |
|
241 outerRect, |
|
242 innerRect); |
|
243 TAknsItemID coMaskFrameId; |
|
244 if ( callState == CBubbleManager::EOnHold ) |
|
245 { |
|
246 iFrameId = KAknsIIDQsnFrCall2Bubble; |
|
247 coMaskFrameId = KAknsIIDQsnFrCall2BubbleCoMask; |
|
248 } |
|
249 else if ( callState == CBubbleManager::EDisconnected ) |
|
250 { |
|
251 iFrameId = KAknsIIDQsnFrCall2BubbleSecondDisconn; |
|
252 coMaskFrameId = KAknsIIDQsnFrCall2BubbleSecondCoMask; |
|
253 } |
|
254 else |
|
255 { |
|
256 iFrameId = KAknsIIDQsnFrCall2BubbleSecond; |
|
257 coMaskFrameId = KAknsIIDQsnFrCall2BubbleSecondCoMask; |
|
258 } |
|
259 |
|
260 iOuterRect = outerRect; |
|
261 iOuterRect.Move( Rect().iTl ); |
|
262 iInnerRect = innerRect; |
|
263 iInnerRect.Move( Rect().iTl ); |
|
264 |
|
265 // Call icon |
|
266 BubbleUtils::LayoutCustomElement( |
|
267 iSmallCallIndication, |
|
268 rect, |
|
269 BubbleLayout2::popup_call2_audio_second_call_status_icon(11) ); |
|
270 |
|
271 // Ciphering off |
|
272 BubbleUtils::LayoutControl( |
|
273 iCyphOffImage, |
|
274 rect, |
|
275 BubbleLayout2::popup_call2_audio_second_call_cyphering_icon(11) ); |
|
276 |
|
277 |
|
278 // Call type pane |
|
279 BubbleUtils::LayoutCallTypeIndicators( |
|
280 rect, |
|
281 BubbleLayout2::popup_call2_audio_second_call_type_icon(11), |
|
282 iTypeIndication1, // Data/Fax |
|
283 iTypeIndication2 ); // ALS line 2 |
|
284 |
|
285 // Text line 1 |
|
286 BubbleUtils::LayoutLabel( |
|
287 iTextLine1, |
|
288 rect, |
|
289 BubbleLayout2::popup_call2_audio_second_call_cli_text(13) ); |
|
290 |
|
291 // Create bubble |
|
292 iBubble->SetRect( bubbleRect.Rect() ); |
|
293 |
|
294 BubbleUtils::PrepareBubbleImageL( |
|
295 iFrameId, |
|
296 outerRect, |
|
297 innerRect, |
|
298 iBubble ); |
|
299 |
|
300 // Add transparency |
|
301 BubbleUtils::AddTransparencyToBubbleImageL( |
|
302 coMaskFrameId, |
|
303 outerRect, |
|
304 innerRect, |
|
305 iBubble ); |
|
306 |
|
307 break; |
|
308 } |
|
309 case CBubbleManager::ENone: |
|
310 default: |
|
311 break; |
|
312 } |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // CBubbleOutlookTopRight::GetCall1BubbleBitmaps |
|
317 // --------------------------------------------------------------------------- |
|
318 // |
|
319 void CBubbleOutlookTopRight::GetCall1BubbleBitmaps() |
|
320 { |
|
321 CBubbleManager::TPhoneCallState callState = iHeader->CallState(); |
|
322 |
|
323 TInt bubblePicture = KErrNotFound; |
|
324 TInt bubblePictureMask = KErrNotFound; |
|
325 |
|
326 // set call indications and bubble |
|
327 switch ( callState ) |
|
328 { |
|
329 case CBubbleManager::EAlertToDisconnected: |
|
330 bubblePicture = EQgn_graf_call_rec_small_right_disconn; |
|
331 bubblePictureMask = EQgn_graf_call_rec_small_right_disconn_mask; |
|
332 break; |
|
333 case CBubbleManager::EOutgoing: |
|
334 case CBubbleManager::EWaiting: |
|
335 case CBubbleManager::EAlerting: |
|
336 bubblePicture = EQgn_graf_call_rec_small_right; |
|
337 bubblePictureMask = EQgn_graf_call_rec_small_right_mask; |
|
338 break; |
|
339 case CBubbleManager::EActive: |
|
340 bubblePicture = EQgn_graf_call_second_three_active; |
|
341 bubblePictureMask = EQgn_graf_call_second_three_active_mask; |
|
342 break; |
|
343 case CBubbleManager::EOnHold: |
|
344 bubblePicture = EQgn_graf_call_second_three_held; |
|
345 bubblePictureMask = EQgn_graf_call_second_three_held_mask; |
|
346 break; |
|
347 case CBubbleManager::EDisconnected: |
|
348 bubblePicture = EQgn_graf_call_second_three_disconn; |
|
349 bubblePictureMask = EQgn_graf_call_second_three_disconn_mask; |
|
350 break; |
|
351 default: |
|
352 bubblePicture = KErrNotFound; |
|
353 bubblePictureMask = KErrNotFound; |
|
354 break; |
|
355 } |
|
356 |
|
357 if ( bubblePicture != KErrNotFound ) |
|
358 { |
|
359 if ( bubblePictureMask == KErrNotFound ) |
|
360 { |
|
361 iBubbleManager.ImageManager().SetBitmapToImage( |
|
362 iBubble, (TBMIcons) bubblePicture ); |
|
363 } |
|
364 else |
|
365 { |
|
366 iBubbleManager.ImageManager().SetBitmapToImage( |
|
367 iBubble, |
|
368 (TBMIcons) bubblePicture , |
|
369 (TBMIcons) bubblePictureMask); |
|
370 } |
|
371 } |
|
372 |
|
373 } |
|
374 |
|
375 // End of File |