44 #include "xnappuiadapter.h" |
44 #include "xnappuiadapter.h" |
45 #include "xnviewmanager.h" |
45 #include "xnviewmanager.h" |
46 #include "xnviewdata.h" |
46 #include "xnviewdata.h" |
47 #include "xnplugindata.h" |
47 #include "xnplugindata.h" |
48 |
48 |
|
49 #include <gfxtranseffect/gfxtranseffect.h> |
|
50 #include <akntransitionutils.h> |
|
51 |
49 // Constants |
52 // Constants |
50 _LIT8( KPopup, "popup" ); |
53 _LIT8( KPopup, "popup" ); |
51 _LIT8( KPositionHint, "_s60-position-hint" ); |
54 _LIT8( KPositionHint, "_s60-position-hint" ); |
52 _LIT8( KWidgetNodeName, "widget" ); |
55 _LIT8( KWidgetNodeName, "widget" ); |
53 _LIT8( KParentIdName, "parentid" ); |
56 _LIT8( KParentIdName, "parentid" ); |
79 // |
82 // |
80 CXnWidgetExtensionAdapter::~CXnWidgetExtensionAdapter() |
83 CXnWidgetExtensionAdapter::~CXnWidgetExtensionAdapter() |
81 { |
84 { |
82 if ( iAppUiAdapter ) |
85 if ( iAppUiAdapter ) |
83 { |
86 { |
84 iAppUiAdapter->UiStateListener().RemoveObserver( *this ); |
87 iAppUiAdapter->UiStateListener().RemoveObserver( |
85 } |
88 *( static_cast< MXnUiStateObserver* >( this ) ) ); |
|
89 iAppUiAdapter->UiStateListener().RemoveObserver( |
|
90 *( static_cast< MXnUiResourceChangeObserver* >( this ) ) ); |
|
91 } |
|
92 GfxTransEffect::Deregister( this ); |
86 } |
93 } |
87 |
94 |
88 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
89 // CXnWidgetExtensionAdapter::CXnWidgetExtensionAdapter |
96 // CXnWidgetExtensionAdapter::CXnWidgetExtensionAdapter |
90 // C++ default constructor. Must not leave. |
97 // C++ default constructor. Must not leave. |
110 |
117 |
111 // this adapter handles both widgetextension and popup nodes |
118 // this adapter handles both widgetextension and popup nodes |
112 // we have to decide which one of them is the recent one |
119 // we have to decide which one of them is the recent one |
113 |
120 |
114 CXnType* typeInfo = iNode.Node().Type(); |
121 CXnType* typeInfo = iNode.Node().Type(); |
|
122 User::LeaveIfNull( typeInfo ); |
115 const TDesC8& type = typeInfo->Type(); |
123 const TDesC8& type = typeInfo->Type(); |
|
124 |
|
125 iPermanent = EFalse; |
116 |
126 |
117 if ( type == KPopup ) |
127 if ( type == KPopup ) |
118 { |
128 { |
|
129 iPopup = ETrue; |
119 CXnProperty* prop( iNode.Node().GetPropertyL( |
130 CXnProperty* prop( iNode.Node().GetPropertyL( |
120 XnPropertyNames::popup::KPopupType ) ); |
131 XnPropertyNames::popup::KPopupType ) ); |
121 |
132 |
122 if ( prop && prop->StringValue() == |
133 if ( prop && prop->StringValue() == |
123 XnPropertyNames::popup::popuptype::KPermanent ) |
134 XnPropertyNames::popup::popuptype::KPermanent ) |
134 } |
145 } |
135 |
146 |
136 iUiEngine = iNode.Node().UiEngine(); |
147 iUiEngine = iNode.Node().UiEngine(); |
137 CXnControlAdapter::ConstructL( iNode ); |
148 CXnControlAdapter::ConstructL( iNode ); |
138 |
149 |
139 EnableDragEvents(); |
150 EnableDragEvents(); |
|
151 |
|
152 GfxTransEffect::Register( this, KGfxPreviewPopupControlUid ); |
140 } |
153 } |
141 |
154 |
142 // ----------------------------------------------------------------------------- |
155 // ----------------------------------------------------------------------------- |
143 // CXnWidgetExtensionAdapter::MakeVisible |
156 // CXnWidgetExtensionAdapter::MakeVisible |
144 // |
157 // |
145 // ----------------------------------------------------------------------------- |
158 // ----------------------------------------------------------------------------- |
146 // |
159 // |
147 void CXnWidgetExtensionAdapter::MakeVisible( TBool aVisible ) |
160 void CXnWidgetExtensionAdapter::MakeVisible( TBool aVisible ) |
148 { |
161 { |
149 TBool visible( IsVisible() ? ETrue : EFalse ); |
162 if ( IsVisible() == aVisible ) |
150 |
|
151 if ( visible == aVisible ) |
|
152 { |
163 { |
153 return; |
164 return; |
154 } |
165 } |
|
166 |
|
167 CXnPluginData* plugin( |
|
168 iAppUiAdapter->ViewManager().ActiveViewData().Plugin( &iNode.Node() ) ); |
|
169 |
|
170 if ( !plugin ) |
|
171 { |
|
172 return; |
|
173 } |
155 |
174 |
156 SetPointerCapture( aVisible ); |
175 SetPointerCapture( aVisible ); |
157 |
176 |
158 CXnPluginData& plugin( |
177 plugin->SetIsDisplayingPopup( aVisible, &iNode.Node() ); |
159 iAppUiAdapter->ViewManager().ActiveViewData().Plugin( &iNode.Node() ) ); |
178 |
160 |
179 if ( !iPopup ) |
161 plugin.SetIsDisplayingPopup( aVisible, &iNode.Node() ); |
|
162 |
|
163 CXnType* typeInfo = iNode.Node().Type(); |
|
164 const TDesC8& type = typeInfo->Type(); |
|
165 |
|
166 TBool popup( type == KPopup ); |
|
167 |
|
168 if ( !popup ) |
|
169 { |
180 { |
170 DrawableWindow()->FadeBehind( aVisible ); |
181 DrawableWindow()->FadeBehind( aVisible ); |
171 } |
182 } |
172 else |
183 |
173 { |
184 if ( !iPermanent ) |
174 if ( !iPermanent ) |
185 { |
175 { |
186 if ( aVisible ) |
176 if ( aVisible ) |
187 { |
177 { |
188 iAppUiAdapter->UiStateListener().AddObserver( |
178 iAppUiAdapter->UiStateListener().AddObserver( *this ); |
189 *( static_cast< MXnUiStateObserver* >( this ) ) ); |
179 } |
190 iAppUiAdapter->UiStateListener().AddObserver( |
180 else |
191 *( static_cast< MXnUiResourceChangeObserver* >( this ) ) ); |
181 { |
192 } |
182 iAppUiAdapter->UiStateListener().RemoveObserver( *this ); |
193 else |
183 } |
194 { |
184 } |
195 iAppUiAdapter->UiStateListener().RemoveObserver( |
185 } |
196 *( static_cast< MXnUiStateObserver* >( this ) ) ); |
186 |
197 iAppUiAdapter->UiStateListener().RemoveObserver( |
187 if ( aVisible && popup ) |
198 *( static_cast< MXnUiResourceChangeObserver* >( this ) ) ); |
|
199 } |
|
200 } |
|
201 |
|
202 if ( aVisible && iPopup ) |
188 { |
203 { |
189 // read position-hint property and set-up its variable |
204 // read position-hint property and set-up its variable |
190 CXnProperty* positionHintProp = NULL; |
205 CXnProperty* positionHintProp = NULL; |
191 TRAP_IGNORE( positionHintProp = iNode.Node().GetPropertyL( KPositionHint ) ); |
206 TRAP_IGNORE( positionHintProp = iNode.Node().GetPropertyL( KPositionHint ) ); |
192 |
207 |
238 CalculatePosition(); |
253 CalculatePosition(); |
239 } |
254 } |
240 } |
255 } |
241 } |
256 } |
242 |
257 |
243 CCoeControl::MakeVisible( aVisible ); |
258 TBool effectStarted = EFalse; |
|
259 if ( iAppUiAdapter->IsForeground() ) |
|
260 { |
|
261 if ( aVisible ) |
|
262 { |
|
263 GfxTransEffect::Begin( this, KGfxControlAppearAction ); |
|
264 } |
|
265 else |
|
266 { |
|
267 GfxTransEffect::Begin( this, KGfxControlDisappearAction ); |
|
268 } |
|
269 effectStarted = ETrue; |
|
270 } |
|
271 |
|
272 CCoeControl::MakeVisible( aVisible ); |
|
273 |
|
274 if ( effectStarted ) |
|
275 { |
|
276 GfxTransEffect::SetDemarcation( this, iPosition ); |
|
277 GfxTransEffect::End( this ); |
|
278 } |
244 } |
279 } |
245 |
280 |
246 // ----------------------------------------------------------------------------- |
281 // ----------------------------------------------------------------------------- |
247 // CXnWidgetExtensionAdapter::HandlePointerEventL |
282 // CXnWidgetExtensionAdapter::HandlePointerEventL |
248 // |
283 // |
249 // ----------------------------------------------------------------------------- |
284 // ----------------------------------------------------------------------------- |
250 // |
285 // |
251 void CXnWidgetExtensionAdapter::HandlePointerEventL( |
286 void CXnWidgetExtensionAdapter::HandlePointerEventL( |
252 const TPointerEvent& aPointerEvent ) |
287 const TPointerEvent& aPointerEvent ) |
253 { |
288 { |
254 CXnType* typeInfo = iNode.Node().Type(); |
|
255 const TDesC8& type = typeInfo->Type(); |
|
256 |
289 |
257 // in case of popup, we have to make sure that |
290 // in case of popup, we have to make sure that |
258 // it will be closed after tapping outside of the |
291 // it will be closed after tapping outside of the |
259 // area of itself and its parent |
292 // area of itself and its parent |
260 if ( type == KPopup ) |
293 if ( iPopup ) |
261 { |
294 { |
262 // check if the tap was inside of popup |
295 // check if the tap was inside of popup |
263 TRect popupRect = this->Rect(); |
296 TRect popupRect = this->Rect(); |
264 popupRect.Move(this->Position() ); |
297 popupRect.Move(this->Position() ); |
265 TBool isInPopupWindow = popupRect.Contains( |
298 TBool isInPopupWindow = popupRect.Contains( |
553 // ----------------------------------------------------------------------------- |
586 // ----------------------------------------------------------------------------- |
554 // |
587 // |
555 void CXnWidgetExtensionAdapter::NotifyForegroundChanged( |
588 void CXnWidgetExtensionAdapter::NotifyForegroundChanged( |
556 TForegroundStatus aStatus ) |
589 TForegroundStatus aStatus ) |
557 { |
590 { |
558 if ( aStatus != EForeground ) |
591 if ( iPopup && aStatus != EForeground ) |
559 { |
592 { |
560 TRAP_IGNORE( HidePopupL() ); |
593 TRAP_IGNORE( HidePopupL() ); |
561 } |
594 } |
|
595 else if ( !iPopup && aStatus == EForeground ) |
|
596 { |
|
597 if ( !DrawableWindow()->IsFaded() ) |
|
598 { |
|
599 DrawableWindow()->FadeBehind( ETrue ); |
|
600 } |
|
601 } |
562 } |
602 } |
563 |
603 |
564 // ----------------------------------------------------------------------------- |
604 // ----------------------------------------------------------------------------- |
565 // CXnWidgetExtensionAdapter::NotifyLightStatusChanged |
605 // CXnWidgetExtensionAdapter::NotifyLightStatusChanged |
566 // |
606 // |
603 |
643 |
604 CleanupStack::Pop( prop ); |
644 CleanupStack::Pop( prop ); |
605 } |
645 } |
606 } |
646 } |
607 |
647 |
|
648 // ----------------------------------------------------------------------------- |
|
649 // CXnWidgetExtensionAdapter::NotifyStatusPaneSizeChanged |
|
650 // |
|
651 // ----------------------------------------------------------------------------- |
|
652 // |
|
653 void CXnWidgetExtensionAdapter::NotifyStatusPaneSizeChanged() |
|
654 { |
|
655 } |
|
656 |
|
657 // ----------------------------------------------------------------------------- |
|
658 // CXnWidgetExtensionAdapter::NotifyResourceChanged |
|
659 // |
|
660 // ----------------------------------------------------------------------------- |
|
661 // |
|
662 void CXnWidgetExtensionAdapter::NotifyResourceChanged( TInt aType ) |
|
663 { |
|
664 |
|
665 // if type is widget extension and fade has changed |
|
666 // we have to always fade main window |
|
667 if ( !iPopup && aType == KEikMessageWindowsFadeChange ) |
|
668 { |
|
669 if ( !DrawableWindow()->IsFaded() ) |
|
670 { |
|
671 DrawableWindow()->FadeBehind( ETrue ); |
|
672 } |
|
673 } |
|
674 } |
|
675 |
608 // End of File |
676 // End of File |