|
1 /* |
|
2 * Copyright (c) 2008 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: Effect manager. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDE FILES |
|
20 #include <eikapp.h> |
|
21 #include <aknappui.h> |
|
22 #include <gfxtranseffect/gfxtranseffect.h> // For transition effects |
|
23 #include <akntranseffect.h> // For transition effects |
|
24 |
|
25 // INCLUDE FILES |
|
26 #include "wmeffectmanager.h" |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KEffectTypeFullscreen = 1; |
|
30 |
|
31 const TInt KWaitForLayout = 1; |
|
32 const TInt KEffectStarted = 2; |
|
33 |
|
34 // ============================ MEMBER FUNCTIONS =============================== |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // C++ default constructor. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CWmEffectManager::CWmEffectManager( CCoeEnv& aCoeEnv ): iCoeEnv (aCoeEnv) |
|
41 { |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // Symbian 2nd phase constructor. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CWmEffectManager::ConstructL() |
|
49 { |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // Two-phased constructor. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CWmEffectManager* CWmEffectManager::NewL( CCoeEnv& aCoeEnv ) |
|
57 { |
|
58 CWmEffectManager* self = new (ELeave) CWmEffectManager( aCoeEnv ); |
|
59 CleanupStack::PushL( self ); |
|
60 self->ConstructL(); |
|
61 CleanupStack::Pop( self ); |
|
62 return self; |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // Destructor. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 CWmEffectManager::~CWmEffectManager() |
|
70 { |
|
71 GfxTransEffect::AbortFullScreen(); |
|
72 iEffects.ResetAndDestroy(); |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CWmEffectManager::BeginFullscreenEffectL |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void CWmEffectManager::BeginFullscreenEffectL( TInt aId ) |
|
80 { |
|
81 TWmEffect* effect = new (ELeave) TWmEffect; |
|
82 CleanupStack::PushL( effect ); |
|
83 effect->iId = aId; |
|
84 effect->iType = KEffectTypeFullscreen; |
|
85 effect->iState = KWaitForLayout; |
|
86 iEffects.Append( effect ); |
|
87 |
|
88 CleanupStack::Pop( effect ); |
|
89 |
|
90 DoBeginFullscreenEffect( *effect ); |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CWmEffectManager::UiRendered |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 void CWmEffectManager::UiRendered() |
|
98 { |
|
99 for ( TInt i = 0; i < iEffects.Count(); ) |
|
100 { |
|
101 TWmEffect* effect = iEffects[i]; |
|
102 if ( effect && effect->iState == KEffectStarted ) |
|
103 { |
|
104 GfxTransEffect::EndFullScreen(); |
|
105 RemoveEffect( effect ); |
|
106 } |
|
107 else |
|
108 { |
|
109 // RemoveEffect() will remove from iEffects array and |
|
110 // thats why we need to have conter in else |
|
111 i++; |
|
112 } |
|
113 } |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CWmEffectManager::DoBeginFullscreenEffect |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CWmEffectManager::DoBeginFullscreenEffect( TWmEffect& aEffect ) |
|
121 { |
|
122 if ( iCoeEnv.WsSession().GetFocusWindowGroup() != |
|
123 iCoeEnv.RootWin().Identifier() ) |
|
124 { |
|
125 // Window group is not focused |
|
126 RemoveEffect( &aEffect ); |
|
127 return; |
|
128 } |
|
129 |
|
130 const TInt flags( AknTransEffect::TParameter::EActivateExplicitCancel ); |
|
131 const TUid targetAppUid( iAvkonAppUi->Application()->AppDllUid() ); |
|
132 |
|
133 // Set effect begin point |
|
134 GfxTransEffect::BeginFullScreen( aEffect.iId , iAvkonAppUi->ClientRect(), |
|
135 AknTransEffect::EParameterType, AknTransEffect::GfxTransParam( |
|
136 targetAppUid, flags ) ); |
|
137 |
|
138 aEffect.iState = KEffectStarted; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CXnEffectManager::RemoveEffect |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 void CWmEffectManager::RemoveEffect( TWmEffect* aEffect ) |
|
146 { |
|
147 TInt index = iEffects.Find( aEffect ); |
|
148 if ( index != KErrNotFound ) |
|
149 { |
|
150 TWmEffect* temp = iEffects[index]; |
|
151 iEffects.Remove( index ); |
|
152 delete temp; |
|
153 } |
|
154 } |
|
155 |
|
156 // End fo file |
|
157 |