29 #include <gfxtranseffect/gfxtranseffect.h> |
29 #include <gfxtranseffect/gfxtranseffect.h> |
30 #include <akntransitionutils.h> |
30 #include <akntransitionutils.h> |
31 #include <avkon.hrh> |
31 #include <avkon.hrh> |
32 #include "akndiscreetpopupcontrol.h" |
32 #include "akndiscreetpopupcontrol.h" |
33 #include "akndiscreetpopupdrawer.h" |
33 #include "akndiscreetpopupdrawer.h" |
|
34 #include "akntrace.h" |
34 |
35 |
35 _LIT( KDiscreetPopupWindowGroupName, "Discreet pop-up" ); |
36 _LIT( KDiscreetPopupWindowGroupName, "Discreet pop-up" ); |
36 |
37 |
37 const TInt KShortTimeout( 1500000 ); |
38 const TInt KShortTimeout( 1500000 ); |
38 const TInt KLongTimeout( 3000000 ); |
39 const TInt KLongTimeout( 3000000 ); |
100 const TDesC& aResourceFile, |
103 const TDesC& aResourceFile, |
101 const TInt& aCommand, |
104 const TInt& aCommand, |
102 const TInt& aPopupId, |
105 const TInt& aPopupId, |
103 MEikCommandObserver* aCommandObserver ) |
106 MEikCommandObserver* aCommandObserver ) |
104 { |
107 { |
|
108 _AKNTRACE_FUNC_ENTER; |
105 CAknDiscreetPopupControl* self = |
109 CAknDiscreetPopupControl* self = |
106 CAknDiscreetPopupControl::NewLC( aGlobal, |
110 CAknDiscreetPopupControl::NewLC( aGlobal, |
107 aCommand, |
111 aCommand, |
108 aPopupId, |
112 aPopupId, |
109 aCommandObserver ); |
113 aCommandObserver ); |
110 |
114 |
111 self->ConstructFromResourceL( aResourceId, aResourceFile ); |
115 self->ConstructFromResourceL( aResourceId, aResourceFile ); |
112 CleanupStack::Pop( self ); |
116 CleanupStack::Pop( self ); |
|
117 _AKNTRACE_FUNC_EXIT; |
113 return self; |
118 return self; |
114 } |
119 } |
115 |
120 |
116 |
121 |
117 // --------------------------------------------------------------------------- |
122 // --------------------------------------------------------------------------- |
399 // CAknDiscreetPopupControl::DoTimeOut |
406 // CAknDiscreetPopupControl::DoTimeOut |
400 // --------------------------------------------------------------------------- |
407 // --------------------------------------------------------------------------- |
401 // |
408 // |
402 void CAknDiscreetPopupControl::DoTimeOut() |
409 void CAknDiscreetPopupControl::DoTimeOut() |
403 { |
410 { |
|
411 _AKNTRACE_FUNC_ENTER; |
404 if ( !iInternalFlags.IsSet( EPressedDown ) ) |
412 if ( !iInternalFlags.IsSet( EPressedDown ) ) |
405 { |
413 { |
406 TRAP_IGNORE( RequestExitL() ); |
414 TRAP_IGNORE( RequestExitL() ); |
407 } |
415 } |
408 else |
416 else |
409 { |
417 { |
410 iTimer->Cancel(); |
418 iTimer->Cancel(); |
411 } |
419 } |
|
420 _AKNTRACE_FUNC_EXIT; |
412 } |
421 } |
413 |
422 |
414 |
423 |
415 // --------------------------------------------------------------------------- |
424 // --------------------------------------------------------------------------- |
416 // CAknDiscreetPopupControl::RequestExitL |
425 // CAknDiscreetPopupControl::RequestExitL |
417 // Popup exit when popup is completely invisible. |
426 // Popup exit when popup is completely invisible. |
418 // --------------------------------------------------------------------------- |
427 // --------------------------------------------------------------------------- |
419 // |
428 // |
420 void CAknDiscreetPopupControl::RequestExitL() |
429 void CAknDiscreetPopupControl::RequestExitL() |
421 { |
430 { |
|
431 _AKNTRACE_FUNC_ENTER; |
422 if( iCommandObserver && !iInternalFlags.IsSet( EGlobal ) ) |
432 if( iCommandObserver && !iInternalFlags.IsSet( EGlobal ) ) |
423 { |
433 { |
424 iCommandObserver->ProcessCommandL( EAknDiscreetPopupCmdClose ); |
434 iCommandObserver->ProcessCommandL( EAknDiscreetPopupCmdClose ); |
425 } |
435 } |
426 HidePopup(); |
436 HidePopup(); |
427 ReportEventL( MCoeControlObserver::EEventRequestExit ); |
437 ReportEventL( MCoeControlObserver::EEventRequestExit ); |
428 iInternalFlags.Clear( EPressedDown ); |
438 iInternalFlags.Clear( EPressedDown ); |
|
439 _AKNTRACE_FUNC_EXIT; |
429 } |
440 } |
430 |
441 |
431 |
442 |
432 // --------------------------------------------------------------------------- |
443 // --------------------------------------------------------------------------- |
433 // CAknDiscreetPopupControl::NotifyObserverL |
444 // CAknDiscreetPopupControl::NotifyObserverL |
434 // --------------------------------------------------------------------------- |
445 // --------------------------------------------------------------------------- |
435 // |
446 // |
436 void CAknDiscreetPopupControl::NotifyObserverL() |
447 void CAknDiscreetPopupControl::NotifyObserverL() |
437 { |
448 { |
|
449 _AKNTRACE_FUNC_ENTER; |
438 if ( iCommand != 0 && iCommandObserver ) |
450 if ( iCommand != 0 && iCommandObserver ) |
439 { |
451 { |
|
452 _AKNTRACE( "CAknDiscreetPopupControl::NotifyObserverL(), tap event will be disposed." ); |
440 // Play feedback if there is command associated with the popup |
453 // Play feedback if there is command associated with the popup |
441 ImmediateFeedback( ETouchFeedbackSensitive ); |
454 ImmediateFeedback( ETouchFeedbackSensitive ); |
442 iCommandObserver->ProcessCommandL( iCommand ); |
455 iCommandObserver->ProcessCommandL( iCommand ); |
443 } |
456 } |
|
457 _AKNTRACE_FUNC_EXIT; |
444 } |
458 } |
445 |
459 |
446 |
460 |
447 // ----------------------------------------------------------------------------- |
461 // ----------------------------------------------------------------------------- |
448 // CAknDiscreetPopupControl::ImmediateFeedback |
462 // CAknDiscreetPopupControl::ImmediateFeedback |
528 // CAknDiscreetPopupControl::ShowPopupL |
542 // CAknDiscreetPopupControl::ShowPopupL |
529 // --------------------------------------------------------------------------- |
543 // --------------------------------------------------------------------------- |
530 // |
544 // |
531 void CAknDiscreetPopupControl::ShowPopupL() |
545 void CAknDiscreetPopupControl::ShowPopupL() |
532 { |
546 { |
|
547 _AKNTRACE_FUNC_ENTER; |
533 AppUi()->AddToStackL( |
548 AppUi()->AddToStackL( |
534 this, |
549 this, |
535 ECoeStackPriorityDefault, |
550 ECoeStackPriorityDefault, |
536 ECoeStackFlagRefusesAllKeys | |
551 ECoeStackFlagRefusesAllKeys | |
537 ECoeStackFlagRefusesFocus ); |
552 ECoeStackFlagRefusesFocus ); |
693 // CAknDiscreetPopupControl::HandleResourceChange |
710 // CAknDiscreetPopupControl::HandleResourceChange |
694 // --------------------------------------------------------------------------- |
711 // --------------------------------------------------------------------------- |
695 // |
712 // |
696 void CAknDiscreetPopupControl::HandleResourceChange( TInt aType ) |
713 void CAknDiscreetPopupControl::HandleResourceChange( TInt aType ) |
697 { |
714 { |
|
715 _AKNTRACE_FUNC_ENTER; |
698 CAknControl::HandleResourceChange( aType ); |
716 CAknControl::HandleResourceChange( aType ); |
699 switch ( aType ) |
717 switch ( aType ) |
700 { |
718 { |
701 case KEikDynamicLayoutVariantSwitch: |
719 case KEikDynamicLayoutVariantSwitch: |
702 { |
720 { |
738 // pressed-down) |
757 // pressed-down) |
739 if ( aPointerEvent.iType == TPointerEvent::EButton1Down |
758 if ( aPointerEvent.iType == TPointerEvent::EButton1Down |
740 && eventInRect |
759 && eventInRect |
741 && iInternalFlags.IsClear( EDismissed ) ) |
760 && iInternalFlags.IsClear( EDismissed ) ) |
742 { |
761 { |
|
762 _AKNTRACE( "CAknDiscreetPopupControl::HandlePointerEventL, TPointerEvent::EButton1Down" ); |
743 SetPressedDownState( ETrue ); |
763 SetPressedDownState( ETrue ); |
744 ImmediateFeedback( ETouchFeedbackSensitive ); |
764 ImmediateFeedback( ETouchFeedbackSensitive ); |
745 } |
765 } |
746 |
766 |
747 // Pointer drag - reset pressed-down state if pointer out of popup area |
767 // Pointer drag - reset pressed-down state if pointer out of popup area |
748 else if ( aPointerEvent.iType == TPointerEvent::EDrag ) |
768 else if ( aPointerEvent.iType == TPointerEvent::EDrag ) |
749 { |
769 { |
|
770 _AKNTRACE( "CAknDiscreetPopupControl::HandlePointerEventL, TPointerEvent::EDrag" ); |
750 iInternalFlags.Set( EDragged ); |
771 iInternalFlags.Set( EDragged ); |
751 if ( !eventInRect && iInternalFlags.IsSet( EPressedDown ) ) |
772 if ( !eventInRect && iInternalFlags.IsSet( EPressedDown ) ) |
752 { |
773 { |
753 iInternalFlags.Clear( EPressedDown ); |
774 iInternalFlags.Clear( EPressedDown ); |
754 } |
775 } |