|
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: Header place on the screen. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "BMBubbleManager.h" |
|
21 #include "BMBubblePlace.h" |
|
22 #include "BMBubbleOutlookBottom.h" |
|
23 #include "BMBubbleOutlookMiddle.h" |
|
24 #include "BMBubbleOutlookBottomRight.h" |
|
25 #include "BMBubbleOutlook.h" |
|
26 #include "BMBubbleOutlookTopLeft.h" |
|
27 #include "BMBubbleOutlookTopRight.h" |
|
28 #include "BMBubbleOutlookHide.h" |
|
29 #include "BMBubbleOutlookConference.h" |
|
30 #include "BMPanic.h" |
|
31 |
|
32 #include "BMBubbleOutlookBottomCnap.h" |
|
33 #include "BMBubbleOutlookMiddleCnap.h" |
|
34 #include "BMBubbleOutlookBottomText.h" |
|
35 #include "BMBubbleOutlookBottomImage.h" |
|
36 #include "BMBubbleOutlookVideo.h" |
|
37 #include "BMBubbleOutlookVideoCnap.h" |
|
38 #include "BMBubbleOutlookBottomRiCnap.h" |
|
39 #include "BMBubbleOutlookBottomImCnap.h" |
|
40 |
|
41 #include <AknsUtils.h> |
|
42 |
|
43 // ========================= MEMBER FUNCTIONS ================================ |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CBubblePlace::ConstructL |
|
47 // |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 void CBubblePlace::ConstructL( |
|
51 const TPhoneBubblePlace& aBubblePlace, |
|
52 CBubbleManager& aBubbleManager ) |
|
53 { |
|
54 |
|
55 iBubblePlace = aBubblePlace; |
|
56 iBubbleOutlook = NULL; |
|
57 iIsUsed = EFalse; // By default. |
|
58 |
|
59 // Create corresponding BubbleOutlook: |
|
60 switch( iBubblePlace ) |
|
61 { |
|
62 case EBottom: |
|
63 { |
|
64 CBubbleOutlookBottom* BOBottom = |
|
65 new( ELeave ) CBubbleOutlookBottom( aBubbleManager ); |
|
66 CleanupStack::PushL( BOBottom ); |
|
67 BOBottom->SetContainerWindowL( *this ); |
|
68 BOBottom->ConstructL(); |
|
69 CleanupStack::Pop(); |
|
70 iBubbleOutlook = BOBottom; |
|
71 } |
|
72 break; |
|
73 case EBottomRightActive: |
|
74 case EBottomRightHeld: |
|
75 { |
|
76 CBubbleOutlookBottomRight* BOBottomR = |
|
77 new( ELeave ) CBubbleOutlookBottomRight( aBubbleManager ); |
|
78 CleanupStack::PushL( BOBottomR ); |
|
79 BOBottomR->SetContainerWindowL( *this ); |
|
80 BOBottomR->ConstructL(); |
|
81 CleanupStack::Pop(); |
|
82 iBubbleOutlook = BOBottomR; |
|
83 } |
|
84 break; |
|
85 case EMiddleActive: |
|
86 case EMiddleHeld: |
|
87 { |
|
88 CBubbleOutlookMiddle* BOMiddle = |
|
89 new( ELeave ) CBubbleOutlookMiddle( aBubbleManager ); |
|
90 CleanupStack::PushL( BOMiddle ); |
|
91 BOMiddle->SetContainerWindowL( *this ); |
|
92 BOMiddle->ConstructL(); |
|
93 CleanupStack::Pop(); |
|
94 iBubbleOutlook = BOMiddle; |
|
95 } |
|
96 break; |
|
97 case ETopLeft: |
|
98 { |
|
99 CBubbleOutlookTopLeft* BOTL = |
|
100 new( ELeave ) CBubbleOutlookTopLeft( aBubbleManager ); |
|
101 CleanupStack::PushL( BOTL ); |
|
102 BOTL->SetContainerWindowL( *this ); |
|
103 BOTL->ConstructL(); |
|
104 CleanupStack::Pop(); |
|
105 iBubbleOutlook = BOTL; |
|
106 } |
|
107 break; |
|
108 case ETopRight: |
|
109 { |
|
110 CBubbleOutlookTopRight* BOTR = |
|
111 new( ELeave ) CBubbleOutlookTopRight( aBubbleManager ); |
|
112 CleanupStack::PushL( BOTR ); |
|
113 BOTR->SetContainerWindowL( *this ); |
|
114 BOTR->ConstructL(); |
|
115 CleanupStack::Pop(); |
|
116 iBubbleOutlook = BOTR; |
|
117 } |
|
118 break; |
|
119 case EHide: |
|
120 { |
|
121 CBubbleOutlookHide* BOH = |
|
122 new( ELeave ) CBubbleOutlookHide( aBubbleManager ); |
|
123 CleanupStack::PushL( BOH ); |
|
124 BOH->SetContainerWindowL( *this ); |
|
125 BOH->ConstructL(); |
|
126 CleanupStack::Pop(); |
|
127 iBubbleOutlook = BOH; |
|
128 } |
|
129 break; |
|
130 case E2InConf: |
|
131 { |
|
132 CBubbleOutlookConference* BOConf = |
|
133 new( ELeave ) CBubbleOutlookConference( aBubbleManager ); |
|
134 CleanupStack::PushL( BOConf ); |
|
135 BOConf->SetContainerWindowL( *this ); |
|
136 BOConf->ConstructL( 2 ); |
|
137 CleanupStack::Pop(); |
|
138 iBubbleOutlook = BOConf; |
|
139 } |
|
140 break; |
|
141 case E3InConf: |
|
142 { |
|
143 CBubbleOutlookConference* BOConf = |
|
144 new( ELeave ) CBubbleOutlookConference( aBubbleManager ); |
|
145 CleanupStack::PushL( BOConf ); |
|
146 BOConf->SetContainerWindowL( *this ); |
|
147 BOConf->ConstructL( 3 ); |
|
148 CleanupStack::Pop(); |
|
149 iBubbleOutlook = BOConf; |
|
150 } |
|
151 break; |
|
152 case E4InConf: |
|
153 { |
|
154 CBubbleOutlookConference* BOConf = |
|
155 new( ELeave ) CBubbleOutlookConference( aBubbleManager ); |
|
156 CleanupStack::PushL( BOConf ); |
|
157 BOConf->SetContainerWindowL( *this ); |
|
158 BOConf->ConstructL( 4 ); |
|
159 CleanupStack::Pop(); |
|
160 iBubbleOutlook = BOConf; |
|
161 } |
|
162 break; |
|
163 case E5InConf: |
|
164 { |
|
165 CBubbleOutlookConference* BOConf = |
|
166 new( ELeave ) CBubbleOutlookConference( aBubbleManager ); |
|
167 CleanupStack::PushL( BOConf ); |
|
168 BOConf->SetContainerWindowL( *this ); |
|
169 BOConf->ConstructL( 5 ); |
|
170 CleanupStack::Pop(); |
|
171 iBubbleOutlook = BOConf; |
|
172 } |
|
173 break; |
|
174 case EBottomText: |
|
175 { |
|
176 CBubbleOutlookBottomText* BOBottomText = |
|
177 new( ELeave ) CBubbleOutlookBottomText( aBubbleManager ); |
|
178 CleanupStack::PushL( BOBottomText ); |
|
179 BOBottomText->SetContainerWindowL( *this ); |
|
180 BOBottomText->ConstructL(); |
|
181 CleanupStack::Pop(); |
|
182 iBubbleOutlook = BOBottomText; |
|
183 } |
|
184 break; |
|
185 case EBottomImage: |
|
186 { |
|
187 CBubbleOutlookBottomImage* BOBottomImage = |
|
188 new( ELeave ) CBubbleOutlookBottomImage( aBubbleManager ); |
|
189 CleanupStack::PushL( BOBottomImage ); |
|
190 BOBottomImage->SetContainerWindowL( *this ); |
|
191 BOBottomImage->ConstructL(); |
|
192 CleanupStack::Pop(); |
|
193 iBubbleOutlook = BOBottomImage; |
|
194 } |
|
195 break; |
|
196 case EVideo: |
|
197 { |
|
198 CBubbleOutlookVideo* BOVideo = |
|
199 new( ELeave ) CBubbleOutlookVideo( aBubbleManager ); |
|
200 CleanupStack::PushL( BOVideo ); |
|
201 BOVideo->SetContainerWindowL( *this ); |
|
202 BOVideo->ConstructL(); |
|
203 CleanupStack::Pop(); |
|
204 iBubbleOutlook = BOVideo; |
|
205 } |
|
206 break; |
|
207 case EBottomCnap: |
|
208 { |
|
209 CBubbleOutlookBottomCnap* BOBottomCnap = |
|
210 new( ELeave ) CBubbleOutlookBottomCnap( aBubbleManager ); |
|
211 CleanupStack::PushL( BOBottomCnap ); |
|
212 BOBottomCnap->SetContainerWindowL( *this ); |
|
213 BOBottomCnap->ConstructL(); |
|
214 CleanupStack::Pop(); |
|
215 iBubbleOutlook = BOBottomCnap; |
|
216 } |
|
217 break; |
|
218 case EMiddleCnap: |
|
219 { |
|
220 CBubbleOutlookMiddleCnap* BOMiddleCnap = |
|
221 new( ELeave ) CBubbleOutlookMiddleCnap( aBubbleManager ); |
|
222 CleanupStack::PushL( BOMiddleCnap ); |
|
223 BOMiddleCnap->SetContainerWindowL( *this ); |
|
224 BOMiddleCnap->ConstructL(); |
|
225 CleanupStack::Pop(); |
|
226 iBubbleOutlook = BOMiddleCnap; |
|
227 } |
|
228 break; |
|
229 case EVideoCnap: |
|
230 { |
|
231 CBubbleOutlookVideoCnap* BOVideoCnap = |
|
232 new( ELeave ) CBubbleOutlookVideoCnap( aBubbleManager ); |
|
233 CleanupStack::PushL( BOVideoCnap ); |
|
234 BOVideoCnap->SetContainerWindowL( *this ); |
|
235 BOVideoCnap->ConstructL(); |
|
236 CleanupStack::Pop(); |
|
237 iBubbleOutlook = BOVideoCnap; |
|
238 } |
|
239 break; |
|
240 case EBottomRightCnap: |
|
241 { |
|
242 CBubbleOutlookBottomRightCnap* BOBottomRightCnap = |
|
243 new( ELeave ) CBubbleOutlookBottomRightCnap( aBubbleManager ); |
|
244 CleanupStack::PushL( BOBottomRightCnap ); |
|
245 BOBottomRightCnap->SetContainerWindowL( *this ); |
|
246 BOBottomRightCnap->ConstructL(); |
|
247 CleanupStack::Pop(); |
|
248 iBubbleOutlook = BOBottomRightCnap; |
|
249 } |
|
250 break; |
|
251 case EBottomImageCnap: |
|
252 { |
|
253 CBubbleOutlookBottomImageCnap* BOBottomImageCnap = |
|
254 new( ELeave ) CBubbleOutlookBottomImageCnap( aBubbleManager ); |
|
255 CleanupStack::PushL( BOBottomImageCnap ); |
|
256 BOBottomImageCnap->SetContainerWindowL( *this ); |
|
257 BOBottomImageCnap->ConstructL(); |
|
258 CleanupStack::Pop(); |
|
259 iBubbleOutlook = BOBottomImageCnap; |
|
260 } |
|
261 break; |
|
262 case EBottomRightActiveTouch: |
|
263 { |
|
264 CBubbleOutlookBottomRight* BOBottomR = |
|
265 new( ELeave ) CBubbleOutlookBottomRight( aBubbleManager ); |
|
266 CleanupStack::PushL( BOBottomR ); |
|
267 BOBottomR->SetContainerWindowL( *this ); |
|
268 BOBottomR->ConstructL(); |
|
269 CleanupStack::Pop(); |
|
270 iBubbleOutlook = BOBottomR; |
|
271 } |
|
272 break; |
|
273 case EBottomRightActiveCnapTouch: |
|
274 { |
|
275 CBubbleOutlookBottomRightCnap* BOBottomRightCnap = |
|
276 new( ELeave ) CBubbleOutlookBottomRightCnap( aBubbleManager ); |
|
277 CleanupStack::PushL( BOBottomRightCnap ); |
|
278 BOBottomRightCnap->SetContainerWindowL( *this ); |
|
279 BOBottomRightCnap->ConstructL(); |
|
280 CleanupStack::Pop(); |
|
281 iBubbleOutlook = BOBottomRightCnap; |
|
282 } |
|
283 break; |
|
284 case EMiddleHeldTouch: |
|
285 { |
|
286 CBubbleOutlookTopLeft* BOTL = |
|
287 new( ELeave ) CBubbleOutlookTopLeft( aBubbleManager ); |
|
288 CleanupStack::PushL( BOTL ); |
|
289 BOTL->SetContainerWindowL( *this ); |
|
290 BOTL->ConstructL(); |
|
291 CleanupStack::Pop(); |
|
292 iBubbleOutlook = BOTL; |
|
293 } |
|
294 break; |
|
295 default: |
|
296 Panic( EBMPanicUnhandledSwitchCase ); |
|
297 break; |
|
298 } |
|
299 |
|
300 |
|
301 iBubbleOutlook->SetParent( this ); |
|
302 |
|
303 ActivateL(); |
|
304 } |
|
305 |
|
306 // --------------------------------------------------------------------------- |
|
307 // CBubblePlace::~CBubblePlace |
|
308 // Destructor. |
|
309 // |
|
310 // --------------------------------------------------------------------------- |
|
311 // |
|
312 CBubblePlace::~CBubblePlace() |
|
313 { |
|
314 AknsUtils::DeregisterControlPosition( this ); |
|
315 delete iBubbleOutlook; |
|
316 } |
|
317 |
|
318 // --------------------------------------------------------------------------- |
|
319 // CBubblePlace::SizeChanged |
|
320 // called by framwork when the view size is changed |
|
321 // |
|
322 // --------------------------------------------------------------------------- |
|
323 // |
|
324 void CBubblePlace::SizeChanged() |
|
325 { |
|
326 AknsUtils::RegisterControlPosition( this ); |
|
327 iBubbleOutlook->SetRect ( Rect() ); |
|
328 } |
|
329 |
|
330 // --------------------------------------------------------------------------- |
|
331 // CBubblePlace::PositionChanged |
|
332 // --------------------------------------------------------------------------- |
|
333 // |
|
334 void CBubblePlace::PositionChanged() |
|
335 { |
|
336 AknsUtils::RegisterControlPosition( this ); |
|
337 } |
|
338 |
|
339 // --------------------------------------------------------------------------- |
|
340 // CBubblePlace::CountComponentControls |
|
341 // |
|
342 // |
|
343 // --------------------------------------------------------------------------- |
|
344 // |
|
345 TInt CBubblePlace::CountComponentControls() const |
|
346 { |
|
347 if ( iIsUsed ) |
|
348 { |
|
349 return 1; // bubble outlook |
|
350 } |
|
351 return 0; |
|
352 } |
|
353 |
|
354 // --------------------------------------------------------------------------- |
|
355 // CBubblePlace::ComponentControl |
|
356 // |
|
357 // |
|
358 // --------------------------------------------------------------------------- |
|
359 // |
|
360 CCoeControl* CBubblePlace::ComponentControl( TInt aIndex ) const |
|
361 { |
|
362 if ( !iIsUsed ) |
|
363 { |
|
364 return NULL; |
|
365 } |
|
366 |
|
367 switch ( aIndex ) |
|
368 { |
|
369 case 0: |
|
370 return iBubbleOutlook; |
|
371 default: |
|
372 return NULL; |
|
373 } |
|
374 } |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 // --------------------------------------------------------------------------- |
|
381 // CBubblePlace::SetIsUsed |
|
382 // |
|
383 // |
|
384 // --------------------------------------------------------------------------- |
|
385 // |
|
386 void CBubblePlace::SetIsUsed( const TBool& aIsUsed ) |
|
387 { |
|
388 iIsUsed = aIsUsed; |
|
389 if ( !iIsUsed ) |
|
390 { |
|
391 iBubbleOutlook->Reset( ); |
|
392 } |
|
393 } |
|
394 |
|
395 |
|
396 // --------------------------------------------------------------------------- |
|
397 // CBubblePlace::IsUsed |
|
398 // |
|
399 // |
|
400 // --------------------------------------------------------------------------- |
|
401 // |
|
402 TBool CBubblePlace::IsUsed( ) const |
|
403 { |
|
404 return iIsUsed; |
|
405 } |
|
406 |
|
407 |
|
408 // --------------------------------------------------------------------------- |
|
409 // CBubblePlace::GetBubblePlace |
|
410 // |
|
411 // |
|
412 // --------------------------------------------------------------------------- |
|
413 // |
|
414 CBubblePlace::TPhoneBubblePlace CBubblePlace::GetBubblePlace( ) const |
|
415 { |
|
416 return iBubblePlace; |
|
417 } |
|
418 |
|
419 |
|
420 // --------------------------------------------------------------------------- |
|
421 // CBubblePlace::GetBubbleOutlook |
|
422 // |
|
423 // |
|
424 // --------------------------------------------------------------------------- |
|
425 // |
|
426 CBubbleOutlook& CBubblePlace::GetBubbleOutlook( ) const |
|
427 { |
|
428 return *iBubbleOutlook; |
|
429 } |
|
430 |
|
431 // End of File |