1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * widget manager plugin implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <bautils.h> |
|
21 #include <coemain.h> |
|
22 #include <aknViewAppUi.h> |
|
23 |
|
24 #include "wmcommon.h" |
|
25 #include "widgetmanager.hrh" |
|
26 #include "wmmaincontainer.h" |
|
27 #include "wmmaincontainerview.h" |
|
28 #include "wmresourceloader.h" |
|
29 #include "wmplugin.h" |
|
30 #include "wmeffectmanager.h" |
|
31 |
|
32 // --------------------------------------------------------- |
|
33 // CWmPlugin::NewL |
|
34 // --------------------------------------------------------- |
|
35 // |
|
36 CWmPlugin* CWmPlugin::NewL() |
|
37 { |
|
38 CWmPlugin* self=new(ELeave) CWmPlugin(); |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop(self); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------- |
|
46 // CWmPlugin::~CWmPlugin |
|
47 // --------------------------------------------------------- |
|
48 // |
|
49 CWmPlugin::~CWmPlugin() |
|
50 { |
|
51 if ( iViewAppUi ) |
|
52 { |
|
53 Deactivate(); |
|
54 iViewAppUi->RemoveView( TUid::Uid( EWmMainContainerViewId ) ); |
|
55 } |
|
56 iWmMainContainer = NULL; |
|
57 delete iResourceLoader; |
|
58 delete iEffectManager; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CWmPlugin::CWmPlugin |
|
63 // --------------------------------------------------------- |
|
64 // |
|
65 CWmPlugin::CWmPlugin() |
|
66 { |
|
67 iPreviousViewUid.iViewUid = KNullUid; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------- |
|
71 // CWmPlugin::ConstructL |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 void CWmPlugin::ConstructL() |
|
75 { |
|
76 iWmMainContainer = NULL; |
|
77 |
|
78 // store static view app ui |
|
79 CEikonEnv* eikonEnv = CEikonEnv::Static(); |
|
80 if ( !eikonEnv ) User::Leave( KErrUnknown ); |
|
81 iViewAppUi = (CAknViewAppUi*)eikonEnv->EikAppUi(); |
|
82 if ( !iViewAppUi ) User::Leave( KErrUnknown ); |
|
83 |
|
84 // create resource loader |
|
85 iFs = &eikonEnv->FsSession(); |
|
86 iResourceLoader = CWmResourceLoader::NewL( *eikonEnv ); |
|
87 iEffectManager = CWmEffectManager::NewL( *eikonEnv ); |
|
88 |
|
89 // main view |
|
90 CWmMainContainerView* mainView = |
|
91 CWmMainContainerView::NewL( *this ); |
|
92 CleanupStack::PushL( mainView ); |
|
93 iViewAppUi->AddViewL( mainView ); |
|
94 CleanupStack::Pop( mainView ); |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------- |
|
98 // CWmPlugin::Activate |
|
99 // --------------------------------------------------------- |
|
100 // |
|
101 void CWmPlugin::Activate() |
|
102 { |
|
103 if ( !IsActive() && iHsContentController ) |
|
104 { |
|
105 TRAP_IGNORE( |
|
106 iEffectManager->BeginFullscreenEffectL( |
|
107 KAppStartCommonDefaultStyle ); |
|
108 iViewAppUi->ActivateLocalViewL( |
|
109 TUid::Uid( EWmMainContainerViewId ) ); |
|
110 ); |
|
111 } |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------- |
|
115 // CWmPlugin::IsActive |
|
116 // --------------------------------------------------------- |
|
117 // |
|
118 TBool CWmPlugin::IsActive() |
|
119 { |
|
120 return ( iPreviousViewUid.iViewUid != KNullUid ); |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------- |
|
124 // CWmPlugin::Deactivate |
|
125 // --------------------------------------------------------- |
|
126 // |
|
127 void CWmPlugin::Deactivate() |
|
128 { |
|
129 if ( IsActive() ) |
|
130 { |
|
131 iWmMainContainer->SetClosingDown( ETrue ); |
|
132 TRAP_IGNORE( |
|
133 iEffectManager->BeginFullscreenEffectL( |
|
134 KAppExitCommonDefaultStyle ); |
|
135 iViewAppUi->ActivateLocalViewL( |
|
136 iPreviousViewUid.iViewUid ); |
|
137 ); |
|
138 } |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------- |
|
142 // CWmPlugin::MainViewActivated |
|
143 // --------------------------------------------------------- |
|
144 // |
|
145 void CWmPlugin::MainViewActivated( |
|
146 const TVwsViewId& aViewId, |
|
147 CWmMainContainer* aWmMainContainer ) |
|
148 { |
|
149 iPreviousViewUid = aViewId; |
|
150 iWmMainContainer = aWmMainContainer; |
|
151 iEffectManager->UiRendered(); |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------- |
|
155 // CWmPlugin::MainViewDeactivated |
|
156 // --------------------------------------------------------- |
|
157 // |
|
158 void CWmPlugin::MainViewDeactivated() |
|
159 { |
|
160 iPreviousViewUid.iViewUid = KNullUid; |
|
161 iWmMainContainer = NULL; |
|
162 iEffectManager->UiRendered(); |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------- |
|
166 // CWmPlugin::NotifyWidgetListChanged |
|
167 // --------------------------------------------------------- |
|
168 // |
|
169 void CWmPlugin::NotifyWidgetListChanged() |
|
170 { |
|
171 if ( iWmMainContainer ) |
|
172 { |
|
173 iWmMainContainer->HandleWidgetListChanged(); |
|
174 } |
|
175 } |
|
176 |
|
177 // End of file |
|