353 } |
353 } |
354 |
354 |
355 |
355 |
356 // ----------------------------------------------------------------------------- |
356 // ----------------------------------------------------------------------------- |
357 // CAknDigitalClock::HandlePointerEventL |
357 // CAknDigitalClock::HandlePointerEventL |
358 // Starts clock application in down event. |
358 // Opens the universal indicator popup upon tap. |
359 // ----------------------------------------------------------------------------- |
359 // ----------------------------------------------------------------------------- |
360 // |
360 // |
361 void CAknDigitalClock::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
361 void CAknDigitalClock::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
362 { |
362 { |
363 CAknControl:: HandlePointerEventL( aPointerEvent ); |
363 CAknControl::HandlePointerEventL( aPointerEvent ); |
364 |
364 |
365 if ( AknLayoutUtils::PenEnabled() ) |
365 // Do nothing if dimmed. |
366 { |
366 if ( IsDimmed() || Window().IsFaded() ) |
367 // Do nothing if dimmed. |
367 { |
368 if ( IsDimmed() || |
368 return; |
369 Window().IsFaded() ) |
369 } |
|
370 |
|
371 TRect rect( Rect() ); |
|
372 |
|
373 // Currently the small digital clock pane, universal |
|
374 // indicator pane and battery pane (in status pane layouts |
|
375 // where it's adjacent to universal indicator or digital |
|
376 // clock pane) are regarded as one touch responsive |
|
377 // area from which the universal indicator popup should |
|
378 // open on tap, so upon pointer up event it must be checked |
|
379 // here if the down event happened inside this control, |
|
380 // but the up event inside battery or indicator pane area. |
|
381 TBool pointerUpInIndicatorArea( EFalse ); |
|
382 TBool pointerUpInBatteryArea( EFalse ); |
|
383 |
|
384 if ( iFlags & EAknDigitalClockInStatusPane && |
|
385 aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
386 { |
|
387 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current(); |
|
388 |
|
389 if ( sp ) |
370 { |
390 { |
371 return; |
391 CCoeControl* indicatorPane = sp->ContainerControlL( |
372 } |
392 TUid::Uid( EEikStatusPaneUidIndic ) ); |
373 |
393 if ( indicatorPane ) |
374 TRect rect( Rect() ); |
|
375 |
|
376 // Currently the small digital clock pane and universal |
|
377 // indicator pane are regarded as one touch responsive area from |
|
378 // which the universal indicator popup should open on tap, |
|
379 // so upon pointer up event it must be checked here if |
|
380 // the down event happened inside this control, but the up event |
|
381 // inside indicator pane area. |
|
382 TRect indicatorRect( 0, 0, 0, 0 ); |
|
383 |
|
384 if ( iFlags & EAknDigitalClockInStatusPane && |
|
385 aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
386 { |
|
387 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current(); |
|
388 |
|
389 if ( sp ) |
|
390 { |
394 { |
391 CCoeControl* indicatorPane = sp->ContainerControlL( |
395 TRect indicatorRect( indicatorPane->PositionRelativeToScreen(), |
392 TUid::Uid( EEikStatusPaneUidIndic ) ); |
396 indicatorPane->Size() ); |
393 if ( indicatorPane ) |
397 pointerUpInIndicatorArea = |
|
398 indicatorRect.Contains( aPointerEvent.iParentPosition ); |
|
399 } |
|
400 |
|
401 if ( !AknStatuspaneUtils::ExtendedFlatLayoutActive() ) |
|
402 { |
|
403 CCoeControl* batteryPane = sp->ContainerControlL( |
|
404 TUid::Uid( EEikStatusPaneUidBattery ) ); |
|
405 if ( batteryPane ) |
394 { |
406 { |
395 indicatorRect = |
407 TRect batteryRect( batteryPane->PositionRelativeToScreen(), |
396 TRect( indicatorPane->PositionRelativeToScreen(), |
408 batteryPane->Size() ); |
397 indicatorPane->Size() ); |
409 pointerUpInBatteryArea = |
|
410 batteryRect.Contains( aPointerEvent.iParentPosition ); |
398 } |
411 } |
399 } |
412 } |
400 } |
413 } |
401 |
414 } |
402 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
415 |
403 rect.Contains( aPointerEvent.iPosition ) ) |
416 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && |
|
417 rect.Contains( aPointerEvent.iPosition ) ) |
|
418 { |
|
419 // Set flag that down event was inside the clock. |
|
420 iFlags |= EAknDigitalClockButton1DownReceived; |
|
421 |
|
422 // tactile feedback is done with SetFeedbackArea |
|
423 } |
|
424 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && |
|
425 ( ( iFlags & EAknDigitalClockButton1DownReceived && |
|
426 rect.Contains( aPointerEvent.iPosition ) ) || |
|
427 pointerUpInIndicatorArea || |
|
428 pointerUpInBatteryArea ) ) |
|
429 { |
|
430 if ( pointerUpInIndicatorArea || pointerUpInBatteryArea ) |
404 { |
431 { |
405 // Set flag that down event was inside the clock. |
432 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
406 iFlags |= EAknDigitalClockButton1DownReceived; |
433 if ( feedback ) |
407 |
434 { |
408 // tactile feedback is done with SetFeedbackArea |
435 // The pointer down was received in another control, |
|
436 // so the tactile feedback must be given directly. |
|
437 feedback->InstantFeedback( this, |
|
438 ETouchFeedbackSensitiveButton, |
|
439 ETouchFeedbackVibra, |
|
440 aPointerEvent ); |
|
441 } |
409 } |
442 } |
410 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && |
443 |
411 ( ( iFlags & EAknDigitalClockButton1DownReceived && |
444 // Launch the universal indicator popup. |
412 rect.Contains( aPointerEvent.iPosition ) ) || |
445 CAknSmallIndicator* indicatorNotifier = |
413 ( indicatorRect.Contains( aPointerEvent.iParentPosition ) ) ) ) |
446 CAknSmallIndicator::NewLC( TUid::Uid( 0 ) ); |
414 { |
447 indicatorNotifier->HandleIndicatorTapL(); |
415 // Launch the universal indicator popup. |
448 CleanupStack::PopAndDestroy( indicatorNotifier ); |
416 CAknSmallIndicator* indicatorNotifier = |
449 |
417 CAknSmallIndicator::NewLC( TUid::Uid( 0 ) ); |
450 // Up event received, reset button down flag. |
418 indicatorNotifier->HandleIndicatorTapL(); |
451 iFlags &= ( ~EAknDigitalClockButton1DownReceived ); |
419 CleanupStack::PopAndDestroy( indicatorNotifier ); |
|
420 |
|
421 // Up event received, reset button down flag. |
|
422 iFlags &= ( ~EAknDigitalClockButton1DownReceived ); |
|
423 } |
|
424 } |
452 } |
425 } |
453 } |
426 |
454 |
427 |
455 |
428 // ----------------------------------------------------------------------------- |
456 // ----------------------------------------------------------------------------- |