20 #include <coemain.h> |
20 #include <coemain.h> |
21 #include <AknUtils.h> |
21 #include <AknUtils.h> |
22 #include <gfxtranseffect/gfxtranseffect.h> |
22 #include <gfxtranseffect/gfxtranseffect.h> |
23 #include <akntransitionutils.h> |
23 #include <akntransitionutils.h> |
24 #include <AknPriv.hrh> |
24 #include <AknPriv.hrh> |
|
25 #ifdef RD_TACTILE_FEEDBACK |
|
26 #include <touchfeedback.h> |
|
27 #endif // RD_TACTILE_FEEDBACK |
25 |
28 |
26 // User includes |
29 // User includes |
27 #include "xnwidgetextensionadapter.h" |
30 #include "xnwidgetextensionadapter.h" |
28 #include "xncontroladapter.h" |
31 #include "xncontroladapter.h" |
29 #include "xncomponentnodeimpl.h" |
32 #include "xncomponentnodeimpl.h" |
251 // it will be closed after tapping outside of the |
252 // it will be closed after tapping outside of the |
252 // area of itself and its parent |
253 // area of itself and its parent |
253 if ( iPopup ) |
254 if ( iPopup ) |
254 { |
255 { |
255 // check if the tap was inside of popup |
256 // check if the tap was inside of popup |
256 TRect popupRect = this->Rect(); |
257 TRect popupRect( Rect() ); |
257 popupRect.Move(this->Position() ); |
258 popupRect.Move( Position() ); |
258 TBool isInPopupWindow = popupRect.Contains( |
259 |
259 aPointerEvent.iParentPosition ); |
260 TBool isInPopupWindow( popupRect.Contains( |
|
261 aPointerEvent.iParentPosition ) ); |
260 |
262 |
261 if ( !isInPopupWindow ) |
263 if ( !isInPopupWindow ) |
262 { |
264 { |
263 // if tap was outside of window, check if tap was |
265 // if tap was outside of window, check if tap was |
264 // inside of the parrent |
266 // inside of the parrent |
265 CXnProperty* parentIdProp( iNode.Node().GetPropertyL( |
267 CXnProperty* parentIdProp( iNode.Node().GetPropertyL( |
266 KParentIdName ) ); |
268 KParentIdName ) ); |
267 |
269 |
268 if ( parentIdProp ) |
270 if ( parentIdProp ) |
269 { |
271 { |
270 const TDesC8& parentIdVal = parentIdProp->StringValue(); |
272 const TDesC8& id( parentIdProp->StringValue() ); |
271 CXnNode* parentN(iUiEngine->FindNodeByIdL( parentIdVal, |
|
272 iNode.Node().Namespace() ) ); |
|
273 |
273 |
274 if ( parentN ) |
274 CXnNode* parent( |
|
275 iUiEngine->FindNodeByIdL( id, iNode.Node().Namespace() ) ); |
|
276 |
|
277 |
|
278 if ( parent ) |
275 { |
279 { |
276 TRect clientRect = |
280 TRect clientRect( iAppUiAdapter->ClientRect() ); |
277 static_cast<CEikAppUi&> ( *iAppUiAdapter ).ClientRect(); |
281 |
278 TRect parentRect = parentN->Rect(); |
282 TRect parentRect( parent->Rect() ); |
279 parentRect.Move( clientRect.iTl ); |
283 parentRect.Move( clientRect.iTl ); |
280 |
284 |
281 if ( !parentRect.Contains( aPointerEvent.iParentPosition ) ) |
285 if ( !parentRect.Contains( aPointerEvent.iParentPosition ) ) |
282 { |
286 { |
283 // tap was neither in popup nor in its parent - |
287 // tap was neither in popup nor in its parent - |
284 // we can close it |
288 // we can close it |
285 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
289 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
286 { |
290 { |
|
291 #ifdef RD_TACTILE_FEEDBACK |
|
292 MTouchFeedback* fb( MTouchFeedback::Instance() ); |
|
293 |
|
294 if ( fb ) |
|
295 { |
|
296 fb->InstantFeedback( ETouchFeedbackBasic ); |
|
297 } |
|
298 #endif |
287 HidePopupL(); |
299 HidePopupL(); |
288 return; |
300 return; |
289 } |
301 } |
290 } |
302 } |
291 else |
303 else |
292 { |
304 { |
293 // tap was made inside of popup parent |
305 // tap was made inside of popup parent |
294 // we pass the event to it after |
306 // we pass the event to it after |
295 // recalculating the taping point |
307 // recalculating the taping point |
296 TPointerEvent newPointerEvent; |
308 TPointerEvent newPointerEvent; |
|
309 |
297 newPointerEvent.Copy( aPointerEvent ); |
310 newPointerEvent.Copy( aPointerEvent ); |
|
311 |
298 newPointerEvent.iPosition = TPoint( |
312 newPointerEvent.iPosition = TPoint( |
299 aPointerEvent.iParentPosition - clientRect.iTl ); |
313 aPointerEvent.iParentPosition - clientRect.iTl ); |
300 parentN->Control()->HandlePointerEventL( newPointerEvent ); |
314 |
301 return; |
315 parent->Control()->HandlePointerEventL( newPointerEvent ); |
302 } |
316 } |
303 } |
317 } |
304 } |
318 } |
305 else |
319 else |
306 { |
320 { |
307 HidePopupL(); |
321 #ifdef RD_TACTILE_FEEDBACK |
|
322 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
323 { |
|
324 MTouchFeedback* fb( MTouchFeedback::Instance() ); |
|
325 |
|
326 if ( fb ) |
|
327 { |
|
328 fb->InstantFeedback( ETouchFeedbackBasic ); |
|
329 } |
|
330 #endif |
|
331 HidePopupL(); |
|
332 } |
308 } |
333 } |
309 } |
334 } |
310 } |
335 } |
311 |
336 |
312 CXnControlAdapter::HandlePointerEventL( aPointerEvent ); |
337 CXnControlAdapter::HandlePointerEventL( aPointerEvent ); |