uifw/AvKon/src/akndiscreetpopupcontrol.cpp
branchRCL_3
changeset 19 aecbbf00d063
parent 10 3d340a0166ff
child 20 d48ab3b357f1
equal deleted inserted replaced
18:fcdfafb36fe7 19:aecbbf00d063
    24 #include <AknUtils.h>
    24 #include <AknUtils.h>
    25 #include <apgwgnam.h>
    25 #include <apgwgnam.h>
    26 #include <bautils.h>
    26 #include <bautils.h>
    27 #include <barsread.h>
    27 #include <barsread.h>
    28 #include <gulicon.h>
    28 #include <gulicon.h>
    29 #include <gfxtranseffect/gfxtranseffect.h>
       
    30 #include <akntransitionutils.h>
       
    31 #include <avkon.hrh>
    29 #include <avkon.hrh>
    32 #include "akndiscreetpopupcontrol.h"
    30 #include "akndiscreetpopupcontrol.h"
    33 #include "akndiscreetpopupdrawer.h"
    31 #include "akndiscreetpopupdrawer.h"
    34 #include "akntrace.h"
       
    35 
    32 
    36 _LIT( KDiscreetPopupWindowGroupName, "Discreet pop-up" );
    33 _LIT( KDiscreetPopupWindowGroupName, "Discreet pop-up" );
    37 
    34 
       
    35 const TInt KOpacityChangeSpeed( 18 );
       
    36 const TInt KAlphaMax( 255 );
       
    37 const TInt KAlphaMin( 0 );
    38 const TInt KShortTimeout( 1500000 );
    38 const TInt KShortTimeout( 1500000 );
    39 const TInt KLongTimeout( 3000000 );
    39 const TInt KLongTimeout( 3000000 );
       
    40 const TInt KShowDelay( 300000 );
       
    41 const TInt KShowInterval( 50000 );
       
    42 const TInt KHideDelay( 50000 );
       
    43 const TInt KHideInterval( 50000 );
    40 const TInt KGlobalShowOrdinalPriority( ECoeWinPriorityAlwaysAtFront * 4 );
    44 const TInt KGlobalShowOrdinalPriority( ECoeWinPriorityAlwaysAtFront * 4 );
    41 const TInt KLocalShowOrdinalPriority( ECoeWinPriorityNormal + 1 );
    45 const TInt KLocalShowOrdinalPriority( ECoeWinPriorityNormal + 1 );
    42 const TInt KLocalHideOrdinalPosition( -10 );
    46 const TInt KLocalHideOrdinalPosition( -10 );
       
    47 const TInt KOpacityDismissFactor( 3 );
       
    48 const TInt KMaxFadeTime( 1000000 );
    43 
    49 
    44 /**
    50 /**
    45  * Internal discreet popup control flags.
    51  * Internal discreet popup control flags.
    46  */
    52  */
    47 enum TAknDiscreetPopupControlFlags
    53 enum TAknDiscreetPopupControlFlags
    48     {
    54     {
    49     EPressedDown,     // Pointer down is received in popup area
    55     EPressedDown,     // Pointer down is received in popup area
    50     EDismissed,       // Popup is dismissed (pointer up is received in popup area)
    56     EDismissed,       // Popup is dismissed (pointer up is received in popup area)
    51     EGlobal,          // Popup is global
    57     EGlobal,          // Popup is global
    52     EDragged,         // Pointer is dragged while popup open
    58     EFading,          // Popup is closing (fading)
    53     EStartTimerAgain  // Start timer again when timer is out and keep pressing  
    59     EDragged          // Pointer is dragged while popup open
    54     };
    60     };
    55 
    61 
    56 
    62 
    57 // ======== MEMBER FUNCTIONS ========
    63 // ======== MEMBER FUNCTIONS ========
    58 
    64 
    72     const TInt& aFlags, 
    78     const TInt& aFlags, 
    73     const TInt& aCommand,
    79     const TInt& aCommand,
    74     const TInt& aPopupId,
    80     const TInt& aPopupId,
    75     MEikCommandObserver* aCommandObserver )
    81     MEikCommandObserver* aCommandObserver )
    76     {
    82     {
    77     _AKNTRACE_FUNC_ENTER;
       
    78     CAknDiscreetPopupControl* self = 
    83     CAknDiscreetPopupControl* self = 
    79         CAknDiscreetPopupControl::NewLC( aGlobal,
    84         CAknDiscreetPopupControl::NewLC( aGlobal,
    80                                          aTitle,
    85                                          aTitle,
    81                                          aText,
    86                                          aText,
    82                                          aIcon,
    87                                          aIcon,
    87                                          aFlags,
    92                                          aFlags,
    88                                          aCommand,
    93                                          aCommand,
    89                                          aPopupId,
    94                                          aPopupId,
    90                                          aCommandObserver );
    95                                          aCommandObserver );
    91     CleanupStack::Pop( self );
    96     CleanupStack::Pop( self );
    92     _AKNTRACE_FUNC_EXIT;
       
    93     return self;
    97     return self;
    94     }
    98     }
    95 
    99 
    96 
   100 
    97 // ---------------------------------------------------------------------------
   101 // ---------------------------------------------------------------------------
   104     const TDesC& aResourceFile,
   108     const TDesC& aResourceFile,
   105     const TInt& aCommand,
   109     const TInt& aCommand,
   106     const TInt& aPopupId,
   110     const TInt& aPopupId,
   107     MEikCommandObserver* aCommandObserver )
   111     MEikCommandObserver* aCommandObserver )
   108     {
   112     {
   109     _AKNTRACE_FUNC_ENTER;
       
   110     CAknDiscreetPopupControl* self = 
   113     CAknDiscreetPopupControl* self = 
   111         CAknDiscreetPopupControl::NewLC( aGlobal, 
   114         CAknDiscreetPopupControl::NewLC( aGlobal, 
   112                                          aCommand, 
   115                                          aCommand, 
   113                                          aPopupId, 
   116                                          aPopupId, 
   114                                          aCommandObserver );
   117                                          aCommandObserver );
   115                                          
   118                                          
   116     self->ConstructFromResourceL( aResourceId, aResourceFile );
   119     self->ConstructFromResourceL( aResourceId, aResourceFile );
   117     CleanupStack::Pop( self );
   120     CleanupStack::Pop( self );
   118     _AKNTRACE_FUNC_EXIT;
       
   119     return self;
   121     return self;
   120     }
   122     }
   121 
   123 
   122 
   124 
   123 // ---------------------------------------------------------------------------
   125 // ---------------------------------------------------------------------------
   179 // CAknDiscreetPopupControl::~CAknDiscreetPopupControl
   181 // CAknDiscreetPopupControl::~CAknDiscreetPopupControl
   180 // ---------------------------------------------------------------------------
   182 // ---------------------------------------------------------------------------
   181 //
   183 //
   182 CAknDiscreetPopupControl::~CAknDiscreetPopupControl()
   184 CAknDiscreetPopupControl::~CAknDiscreetPopupControl()
   183     {
   185     {
   184     _AKNTRACE_FUNC_ENTER;
       
   185     AKNTASHOOK_REMOVE();
   186     AKNTASHOOK_REMOVE();
   186     if ( IsVisible() )
   187     if ( IsVisible() )
   187         {
   188         {
   188         HidePopup();
   189         HidePopup();
   189         }
   190         }
   190 
   191     if ( iInternalFlags.IsSet( EGlobal ) )
   191     GfxTransEffect::Deregister( this );
   192         {
   192 
   193         iWindowGroup.Close();
       
   194         }
   193     delete iTimer;	
   195     delete iTimer;	
   194     delete iDrawer;
   196     delete iDrawer;
   195 
       
   196     if ( iInternalFlags.IsSet( EGlobal ) )
       
   197         {
       
   198         CloseWindow();
       
   199         iWindowGroup.Close();
       
   200         }
       
   201 
       
   202     _AKNTRACE_FUNC_EXIT;
       
   203     }
   197     }
   204 
   198 
   205 
   199 
   206 // ---------------------------------------------------------------------------
   200 // ---------------------------------------------------------------------------
   207 // CAknDiscreetPopupControl::HandleDiscreetPopupActionL
   201 // CAknDiscreetPopupControl::HandleDiscreetPopupActionL
   259 // CAknDiscreetPopupControl::MakeVisible
   253 // CAknDiscreetPopupControl::MakeVisible
   260 // ---------------------------------------------------------------------------
   254 // ---------------------------------------------------------------------------
   261 //
   255 //
   262 void CAknDiscreetPopupControl::MakeVisible( TBool aVisible )
   256 void CAknDiscreetPopupControl::MakeVisible( TBool aVisible )
   263     {
   257     {
       
   258     if ( iTimer )
       
   259         {
       
   260         iTimer->Cancel();
       
   261         }
       
   262     
   264     CCoeControl::MakeVisible( aVisible );
   263     CCoeControl::MakeVisible( aVisible );
   265  
   264  
   266     if( iInternalFlags.IsSet( EGlobal ) )
   265     if( iInternalFlags.IsSet( EGlobal ) )
   267         {
   266         {
   268         iWindowGroup.SetOrdinalPosition( 0, KGlobalShowOrdinalPriority );
   267         iWindowGroup.SetOrdinalPosition( 0, KGlobalShowOrdinalPriority );
   269         }
   268         }
   270     else
   269     else
   271         {
   270         {
   272         Window().SetOrdinalPosition( 0, KLocalShowOrdinalPriority );
   271         Window().SetOrdinalPosition( 0, KLocalShowOrdinalPriority );
   273         }    
   272         }    
   274 
   273         
       
   274     if ( aVisible && iTimer )
       
   275         {
       
   276         iAlpha = 0;
       
   277         iInternalFlags.Clear( EFading );
       
   278         iInternalFlags.Clear( EDismissed );
       
   279         
       
   280         iTimer->Start( KShowDelay, 
       
   281                        KShowInterval, 
       
   282                        TCallBack( TimeOut, this ) );
       
   283                              
       
   284         iFadeTime.HomeTime(); 
       
   285         TTimeIntervalMicroSeconds32 timeout( KShowDelay );
       
   286         iFadeTime += timeout;
       
   287         }
   275     UpdateNonFadingStatus();
   288     UpdateNonFadingStatus();
   276     }
   289     }
   277 
   290 
   278 
   291 
   279 // ---------------------------------------------------------------------------
   292 // ---------------------------------------------------------------------------
   298     
   311     
   299     if ( aGlobal || thread.Name() == EIKAPPUI_SERVER_THREAD_NAME )
   312     if ( aGlobal || thread.Name() == EIKAPPUI_SERVER_THREAD_NAME )
   300         {
   313         {
   301         iInternalFlags.Set( EGlobal );
   314         iInternalFlags.Set( EGlobal );
   302         }
   315         }
   303 
       
   304     iInternalFlags.Set( EDismissed );
   316     iInternalFlags.Set( EDismissed );
   305     iCommand = aCommand;
   317 
   306     iCommandObserver = aCommandObserver;
   318     // Action allowed only when touch enabled
   307 
   319     if ( AknLayoutUtils::PenEnabled() )
   308     GfxTransEffect::Register( this, KGfxDiscreetPopupControlUid );
   320         {
   309     
   321         iCommand = aCommand;
       
   322         iCommandObserver = aCommandObserver;
       
   323         }
   310     AKNTASHOOK_ADD( this, "CAknDiscreetPopupControl" );
   324     AKNTASHOOK_ADD( this, "CAknDiscreetPopupControl" );
   311     }
   325     }
   312 
   326 
   313 
   327 
   314 // ---------------------------------------------------------------------------
   328 // ---------------------------------------------------------------------------
   343         Window().SetOrdinalPosition( KLocalHideOrdinalPosition );
   357         Window().SetOrdinalPosition( KLocalHideOrdinalPosition );
   344         }
   358         }
   345         
   359         
   346     iTimer = CPeriodic::NewL( 0 );
   360     iTimer = CPeriodic::NewL( 0 );
   347     
   361     
   348     EnableWindowTransparency();
   362     // try to enable window transparency
       
   363     if( CAknEnv::Static()->TransparencyEnabled() )
       
   364         {
       
   365         Window().SetRequiredDisplayMode( EColor16MA );
       
   366         if ( Window().SetTransparencyAlphaChannel() == KErrNone )
       
   367             {
       
   368             Window().SetBackgroundColor( ~0 );
       
   369             }
       
   370         }
   349 
   371 
   350     Window().SetPointerGrab( ETrue );
   372     Window().SetPointerGrab( ETrue );
   351     EnableDragEvents();
   373     EnableDragEvents();
   352     MakeVisible( EFalse );
   374     MakeVisible( EFalse );
   353     }
   375     }
   410 // CAknDiscreetPopupControl::DoTimeOut
   432 // CAknDiscreetPopupControl::DoTimeOut
   411 // ---------------------------------------------------------------------------
   433 // ---------------------------------------------------------------------------
   412 //
   434 //
   413 void CAknDiscreetPopupControl::DoTimeOut()
   435 void CAknDiscreetPopupControl::DoTimeOut()
   414     {
   436     {
   415 	_AKNTRACE_FUNC_ENTER;
   437     if ( iInternalFlags.IsSet( EFading ) && iAlpha <= KAlphaMin )
   416     if ( !iInternalFlags.IsSet( EPressedDown ) || 
   438         {
   417     	 iInternalFlags.IsSet( EStartTimerAgain ) )
   439         // popup has faded completely, exit
   418         {
       
   419         TRAP_IGNORE( RequestExitL() );
   440         TRAP_IGNORE( RequestExitL() );
   420         }
   441         }
   421     else
   442     else
   422         {
   443         {
   423         iTimer->Cancel();
   444         TInt opacityChange = 
   424         // if time is out and keep pressing, start short timer again.
   445             iInternalFlags.IsSet( EFading ) ? -KOpacityChangeSpeed : KOpacityChangeSpeed;
   425         iInternalFlags.Set( EStartTimerAgain );
   446         
   426         iTimer->Start( KShortTimeout, 
   447         if ( iInternalFlags.IsSet( EPressedDown ) 
   427                        0, 
   448              && iInternalFlags.IsSet( EFading ) )
   428                        TCallBack( TimeOut, this ) );
   449             {
   429         }
   450             iAlpha = KAlphaMax;
   430 	_AKNTRACE_FUNC_EXIT;
   451             opacityChange = 0;
       
   452             }
       
   453         
       
   454         if ( iInternalFlags.IsSet( EDismissed ) )
       
   455             {
       
   456             opacityChange *= KOpacityDismissFactor;
       
   457             }
       
   458         iAlpha += opacityChange;
       
   459         
       
   460         TTime now;     
       
   461         now.HomeTime();
       
   462         TInt fadeTime( now.MicroSecondsFrom( iFadeTime ).Int64() );
       
   463             
       
   464         if ( fadeTime > KMaxFadeTime )
       
   465             {          
       
   466             if ( !iInternalFlags.IsSet( EFading ) )
       
   467                 {
       
   468                 // fade in animation is taking too long, 
       
   469                 // make popup fully visible
       
   470                 iAlpha = KAlphaMax;
       
   471                 }
       
   472             else
       
   473                 {
       
   474                 // fade out animation is taking too long, 
       
   475                 // make popup invisible
       
   476                 iAlpha = KAlphaMin;    
       
   477                 }   
       
   478             }         
       
   479         
       
   480         if ( iAlpha >= KAlphaMax )
       
   481             {
       
   482             // popup is completely visible. set the EFading flag and set timeout
       
   483             iAlpha = KAlphaMax;
       
   484             iInternalFlags.Set( EFading );
       
   485             iTimer->Cancel();
       
   486             //fade out after timeout
       
   487             TTimeIntervalMicroSeconds32 timeout( KShortTimeout );
       
   488             if ( iFlags & KAknDiscreetPopupDurationLong )
       
   489                 {
       
   490                 timeout = KLongTimeout;
       
   491                 }
       
   492             iTimer->Start( timeout, 
       
   493                            KHideInterval, 
       
   494                            TCallBack( TimeOut, this ) );
       
   495                            
       
   496             iFadeTime.HomeTime();
       
   497             iFadeTime += timeout;            
       
   498             }
       
   499         else if ( iAlpha < KAlphaMin )
       
   500             {
       
   501             iAlpha = KAlphaMin;
       
   502             }
       
   503 
       
   504         DrawNow();
       
   505         }
   431     }
   506     }
   432 
   507 
   433 
   508 
   434 // ---------------------------------------------------------------------------
   509 // ---------------------------------------------------------------------------
   435 // CAknDiscreetPopupControl::RequestExitL
   510 // CAknDiscreetPopupControl::RequestExitL
   436 // Popup exit when popup is completely invisible.
   511 // Popup exit when popup is completely invisible.
   437 // ---------------------------------------------------------------------------
   512 // ---------------------------------------------------------------------------
   438 //
   513 //
   439 void CAknDiscreetPopupControl::RequestExitL()
   514 void CAknDiscreetPopupControl::RequestExitL()
   440     {
   515     {
   441     _AKNTRACE_FUNC_ENTER;
       
   442     if( iCommandObserver && !iInternalFlags.IsSet( EGlobal ) )
   516     if( iCommandObserver && !iInternalFlags.IsSet( EGlobal ) )
   443         {
   517         {
   444         iCommandObserver->ProcessCommandL( EAknDiscreetPopupCmdClose );
   518         iCommandObserver->ProcessCommandL( EAknDiscreetPopupCmdClose );
   445         }
   519         }
   446     HidePopup();
   520     HidePopup();
   447     ReportEventL( MCoeControlObserver::EEventRequestExit );
   521     ReportEventL( MCoeControlObserver::EEventRequestExit );
   448     iInternalFlags.Clear( EStartTimerAgain );
       
   449     iInternalFlags.Clear( EPressedDown );
   522     iInternalFlags.Clear( EPressedDown );
   450     _AKNTRACE_FUNC_EXIT;
       
   451     }
   523     }
   452 
   524 
   453 
   525 
   454 // ---------------------------------------------------------------------------
   526 // ---------------------------------------------------------------------------
   455 // CAknDiscreetPopupControl::NotifyObserverL
   527 // CAknDiscreetPopupControl::NotifyObserverL
   456 // ---------------------------------------------------------------------------
   528 // ---------------------------------------------------------------------------
   457 //
   529 //
   458 void CAknDiscreetPopupControl::NotifyObserverL()
   530 void CAknDiscreetPopupControl::NotifyObserverL()
   459     {
   531     {
   460     _AKNTRACE_FUNC_ENTER;
       
   461     if ( iCommand != 0 && iCommandObserver )
   532     if ( iCommand != 0 && iCommandObserver )
   462         {
   533         {
   463         _AKNTRACE( "CAknDiscreetPopupControl::NotifyObserverL(), tap event will be disposed." );
       
   464         // Play feedback if there is command associated with the popup
   534         // Play feedback if there is command associated with the popup
   465         if ( iFeedBack )
   535         ImmediateFeedback( ETouchFeedbackSensitive );
   466             {
       
   467             iFeedBack->InstantFeedback( this,
       
   468                                         ETouchFeedbackSensitive,
       
   469                                         ETouchFeedbackVibra,
       
   470                                         TPointerEvent()
       
   471                                       );
       
   472             }
       
   473         iCommandObserver->ProcessCommandL( iCommand );
   536         iCommandObserver->ProcessCommandL( iCommand );
   474         }
   537         }
   475     _AKNTRACE_FUNC_EXIT;
       
   476     }
   538     }
   477 
   539 
   478 
   540 
   479 // -----------------------------------------------------------------------------
   541 // -----------------------------------------------------------------------------
   480 // CAknDiscreetPopupControl::ImmediateFeedback
   542 // CAknDiscreetPopupControl::ImmediateFeedback
   560 // CAknDiscreetPopupControl::ShowPopupL
   622 // CAknDiscreetPopupControl::ShowPopupL
   561 // ---------------------------------------------------------------------------
   623 // ---------------------------------------------------------------------------
   562 //
   624 //
   563 void CAknDiscreetPopupControl::ShowPopupL()
   625 void CAknDiscreetPopupControl::ShowPopupL()
   564     {
   626     {
   565     _AKNTRACE_FUNC_ENTER;
       
   566     AppUi()->AddToStackL( 
   627     AppUi()->AddToStackL( 
   567             this, 
   628             this, 
   568             ECoeStackPriorityDefault,
   629             ECoeStackPriorityDefault,
   569             ECoeStackFlagRefusesAllKeys |
   630             ECoeStackFlagRefusesAllKeys |
   570             ECoeStackFlagRefusesFocus );
   631             ECoeStackFlagRefusesFocus );
   571 
   632 
   572     User::ResetInactivityTime();
   633     User::ResetInactivityTime();
   573 
   634 
   574     PlayTone();
   635     PlayTone();
   575     
   636     MakeVisible( ETrue );
   576     if ( GfxTransEffect::IsRegistered( this ) )
       
   577         {
       
   578         iInternalFlags.Clear( EDismissed );
       
   579         GfxTransEffect::Begin( this, KGfxControlAppearAction );
       
   580         MakeVisible( ETrue );
       
   581         GfxTransEffect::SetDemarcation( this, iPosition );
       
   582         GfxTransEffect::End( this );
       
   583         }
       
   584     else
       
   585         {
       
   586         MakeVisible( ETrue );
       
   587         }
       
   588 
       
   589     TTimeIntervalMicroSeconds32 timeout( KShortTimeout );
       
   590     
       
   591     if ( iFlags & KAknDiscreetPopupDurationLong )
       
   592         {
       
   593         timeout = KLongTimeout;
       
   594         }
       
   595     
       
   596     iTimer->Start( timeout, 
       
   597                    0, 
       
   598                    TCallBack( TimeOut, this ) );
       
   599 				   
       
   600 	_AKNTRACE_FUNC_EXIT;
       
   601     }
   637     }
   602 
   638 
   603 
   639 
   604 // ---------------------------------------------------------------------------
   640 // ---------------------------------------------------------------------------
   605 // CAknDiscreetPopupControl::HidePopup
   641 // CAknDiscreetPopupControl::HidePopup
   606 // ---------------------------------------------------------------------------
   642 // ---------------------------------------------------------------------------
   607 //
   643 //
   608 void CAknDiscreetPopupControl::HidePopup()
   644 void CAknDiscreetPopupControl::HidePopup()
   609     {
   645     {
   610     if ( GfxTransEffect::IsRegistered( this ) )
   646     MakeVisible( EFalse );
   611         {
       
   612         GfxTransEffect::Begin( this, KGfxControlDisappearAction );
       
   613         MakeVisible( EFalse );
       
   614         GfxTransEffect::End( this );
       
   615         }
       
   616     else
       
   617         {
       
   618         MakeVisible( EFalse );
       
   619         }
       
   620 
       
   621     AppUi()->RemoveFromStack( this );
   647     AppUi()->RemoveFromStack( this );
   622     }
   648     }
   623 
   649 
   624 
   650 
   625 // ---------------------------------------------------------------------------
   651 // ---------------------------------------------------------------------------
   672     if ( !iDrawer )
   698     if ( !iDrawer )
   673         {
   699         {
   674         return;
   700         return;
   675         }
   701         }
   676 
   702 
   677     iDrawer->Draw( SystemGc(), Rect() );
   703     CFbsBitmap* popupBitmap( iDrawer->PopupBitmap( Size() ) );
       
   704     
       
   705     // create a transparent mask for the popup
       
   706     CFbsBitmap* transParentBitmap = 
       
   707         iDrawer->TransparentMask( popupBitmap->SizeInPixels(), iAlpha );
       
   708     
       
   709     // blit the bitmap to screen with the transparent mask
       
   710     CWindowGc& gc = SystemGc();
       
   711     if( transParentBitmap )
       
   712         {
       
   713         gc.BitBltMasked( Rect().iTl, 
       
   714                          popupBitmap, 
       
   715                          popupBitmap->SizeInPixels(), 
       
   716                          transParentBitmap, 
       
   717                          EFalse );	
       
   718         }
       
   719     else
       
   720         {
       
   721         gc.BitBlt( Rect().iTl, popupBitmap );
       
   722         }
   678     }
   723     }
   679 
   724 
   680 
   725 
   681 // ---------------------------------------------------------------------------
   726 // ---------------------------------------------------------------------------
   682 // CAknDiscreetPopupControl::ConstructFromResourceL
   727 // CAknDiscreetPopupControl::ConstructFromResourceL
   728 // CAknDiscreetPopupControl::HandleResourceChange
   773 // CAknDiscreetPopupControl::HandleResourceChange
   729 // ---------------------------------------------------------------------------
   774 // ---------------------------------------------------------------------------
   730 //
   775 //
   731 void CAknDiscreetPopupControl::HandleResourceChange( TInt aType )
   776 void CAknDiscreetPopupControl::HandleResourceChange( TInt aType )
   732     {
   777     {
   733     _AKNTRACE_FUNC_ENTER;
       
   734     CAknControl::HandleResourceChange( aType );
   778     CAknControl::HandleResourceChange( aType );
   735     switch ( aType )
   779     switch ( aType )
   736         {
   780         {
   737         case KEikDynamicLayoutVariantSwitch:
   781         case KEikDynamicLayoutVariantSwitch:
   738             {
   782             {
   754         default:
   798         default:
   755             {
   799             {
   756             break;
   800             break;
   757             }
   801             }
   758         }
   802         }
   759     _AKNTRACE_FUNC_EXIT;
       
   760     }
   803     }
   761 
   804 
   762 
   805 
   763 // ---------------------------------------------------------------------------
   806 // ---------------------------------------------------------------------------
   764 // CAknDiscreetPopupControl::HandlePointerEventL
   807 // CAknDiscreetPopupControl::HandlePointerEventL
   768 //
   811 //
   769 void CAknDiscreetPopupControl::HandlePointerEventL( 
   812 void CAknDiscreetPopupControl::HandlePointerEventL( 
   770     const TPointerEvent& aPointerEvent )
   813     const TPointerEvent& aPointerEvent )
   771     {
   814     {
   772     TBool eventInRect( Rect().Contains( aPointerEvent.iPosition ) );
   815     TBool eventInRect( Rect().Contains( aPointerEvent.iPosition ) );
   773     
   816 
   774     // Pointer down - set pressed-down state (popup completely visible while
   817     // Pointer down - set pressed-down state (popup completely visible while
   775     // pressed-down)
   818     // pressed-down)
   776     if ( aPointerEvent.iType == TPointerEvent::EButton1Down 
   819     if ( aPointerEvent.iType == TPointerEvent::EButton1Down
   777          && eventInRect
   820          && eventInRect
   778          && iInternalFlags.IsClear( EDismissed ) )
   821          && iInternalFlags.IsClear( EDismissed ) )
   779         {
   822         {
   780         _AKNTRACE( "CAknDiscreetPopupControl::HandlePointerEventL, TPointerEvent::EButton1Down" );
       
   781         SetPressedDownState( ETrue );
   823         SetPressedDownState( ETrue );
   782         ImmediateFeedback( ETouchFeedbackSensitive );
   824         // Play feedback only when popup is completely visible (or fading away)
       
   825         if ( iInternalFlags.IsSet( EFading ) )
       
   826             {
       
   827             ImmediateFeedback( ETouchFeedbackSensitive );
       
   828             }
   783         }
   829         }
   784 
   830 
   785     // Pointer drag - reset pressed-down state if pointer out of popup area
   831     // Pointer drag - reset pressed-down state if pointer out of popup area
   786     else if ( aPointerEvent.iType == TPointerEvent::EDrag )
   832     else if ( aPointerEvent.iType == TPointerEvent::EDrag )
   787         {
   833         {
   788         _AKNTRACE( "CAknDiscreetPopupControl::HandlePointerEventL, TPointerEvent::EDrag" );
       
   789         iInternalFlags.Set( EDragged );
   834         iInternalFlags.Set( EDragged );
   790         if ( !eventInRect && iInternalFlags.IsSet( EPressedDown ) )
   835         if ( !eventInRect && iInternalFlags.IsSet( EPressedDown ) )
   791             {
   836             {
   792             iInternalFlags.Clear( EPressedDown );
   837             iInternalFlags.Clear( EPressedDown );
   793             }
   838             }
   797             }
   842             }
   798         }
   843         }
   799 
   844 
   800     // Pointer up - reset pressed-down state 
   845     // Pointer up - reset pressed-down state 
   801     else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   846     else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   802         {        
   847         {
   803         _AKNTRACE( "CAknDiscreetPopupControl::HandlePointerEventL, TPointerEvent::EButton1Up" );
   848         if ( iInternalFlags.IsSet( EFading )
   804         if ( eventInRect )
   849              && iInternalFlags.IsSet( EPressedDown )
   805             {
   850              && eventInRect )
       
   851             {
       
   852             // Notify popup tap
   806             NotifyObserverL();
   853             NotifyObserverL();
   807             }        
   854             // Start fading away
   808         // Start fading away
   855             if ( iInternalFlags.IsClear( EDismissed ) )
   809         if ( iInternalFlags.IsClear( EDismissed ) )
   856                 {
   810             {
   857                 iTimer->Cancel();
   811             iInternalFlags.Set( EDismissed );
   858                 iInternalFlags.Set( EFading );
   812             RequestExitL();
   859                 iInternalFlags.Set( EDismissed );
       
   860                 iTimer->Start( KHideDelay, KHideInterval, TCallBack( TimeOut, this ) );
       
   861                 }
   813             }
   862             }
   814         SetPressedDownState( EFalse );
   863         SetPressedDownState( EFalse );
   815         }
   864         }
   816     }
   865     }
       
   866