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