uifw/EikStd/coctlsrc/akntoolbarextensionview.cpp
branchRCL_3
changeset 9 aabf2c525e0f
parent 0 2f259fa3e83a
child 16 71dd06cfe933
equal deleted inserted replaced
4:8ca85d2f0db7 9:aabf2c525e0f
    30 #include "akntoolbaritem.h"
    30 #include "akntoolbaritem.h"
    31 #include "akntoolbarextensionview.h"
    31 #include "akntoolbarextensionview.h"
    32 
    32 
    33 #include "aknresourceprovider.h"
    33 #include "aknresourceprovider.h"
    34 
    34 
       
    35 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
    36 #include <gfxtranseffect/gfxtranseffect.h>
       
    37 #include <akntransitionutils.h>
       
    38 #endif
    35 const TInt KNoItemSelected = -1; 
    39 const TInt KNoItemSelected = -1; 
    36 const TUint32 KToolbarExtensionBgColor = 0x00000000;
    40 const TUint32 KToolbarExtensionBgColor = 0x00000000;
    37 const TInt KToolBarExtensionBgAlpha = 0x7F;
    41 const TInt KToolBarExtensionBgAlpha = 0x7F;
    38 const TInt KToolbarButtonBeforeTimeout = 300; 
    42 const TInt KToolbarButtonBeforeTimeout = 300; 
    39 
    43 
    68 // Destructor
    72 // Destructor
    69 // ---------------------------------------------------------------------------
    73 // ---------------------------------------------------------------------------
    70 //
    74 //
    71 CAknToolbarExtensionView::~CAknToolbarExtensionView()
    75 CAknToolbarExtensionView::~CAknToolbarExtensionView()
    72     {
    76     {
       
    77 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
    78     if ( IsVisible() )
       
    79         {
       
    80         CAknControl::MakeVisible( EFalse );
       
    81         }
       
    82     if ( GfxTransEffect::IsRegistered( this ) )
       
    83         {
       
    84         GfxTransEffect::Deregister( this );
       
    85         }
       
    86 #endif
    73     SetFocus( EFalse );
    87     SetFocus( EFalse );
    74     CEikonEnv::Static()->EikAppUi()->RemoveFromStack( this );
    88     CEikonEnv::Static()->EikAppUi()->RemoveFromStack( this );
    75     if ( iSelectedItem >= 0 && iSelectedItem < iItems.Count() ) 
    89     if ( iSelectedItem >= 0 && iSelectedItem < iItems.Count() ) 
    76         {
    90         {
    77         TRAP_IGNORE( iItems[iSelectedItem]->SetIsSelectedL(EFalse) ); 
    91         TRAP_IGNORE( iItems[iSelectedItem]->SetIsSelectedL(EFalse) ); 
   182             0, ECoeStackFlagRefusesFocus | ECoeStackFlagRefusesAllKeys );
   196             0, ECoeStackFlagRefusesFocus | ECoeStackFlagRefusesAllKeys );
   183         CEikonEnv::Static()->EikAppUi()->HandleStackChanged();
   197         CEikonEnv::Static()->EikAppUi()->HandleStackChanged();
   184         
   198         
   185         // Calling this here, so that iVisibleItems array has been updated and
   199         // Calling this here, so that iVisibleItems array has been updated and
   186         // all items visible in extension get call makevisible
   200         // all items visible in extension get call makevisible
       
   201 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
   202         if ( !GfxTransEffect::IsRegistered( this ) )
       
   203             {
       
   204             CAknControl::MakeVisible( aVisible );
       
   205             }            
       
   206 #else
   187         CAknControl::MakeVisible( aVisible );
   207         CAknControl::MakeVisible( aVisible );
       
   208 #endif 
   188         SetRect( rect );     
   209         SetRect( rect );     
   189         DrawableWindow()->SetOrdinalPosition( 0, ECoeWinPriorityNormal );    
   210         DrawableWindow()->SetOrdinalPosition( 0, ECoeWinPriorityNormal );    
       
   211 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS       
       
   212         if ( GfxTransEffect::IsRegistered( this ) )
       
   213             {
       
   214             CAknTransitionUtils::MakeVisibleSubComponents( this,
       
   215                                     CAknTransitionUtils::EAppearInvisible );
       
   216             }
       
   217 #endif
   190         TBool floating = !IsNonFocusing(); 
   218         TBool floating = !IsNonFocusing(); 
   191         for ( TInt i = 0; i < iItems.Count(); i++ )
   219         for ( TInt i = 0; i < iItems.Count(); i++ )
   192             {
   220             {
   193             if ( !floating && Editor( iItems[i]->ControlType() ) )
   221             if ( !floating && Editor( iItems[i]->ControlType() ) )
   194                 {
   222                 {
   225                    button->ResetState();
   253                    button->ResetState();
   226                    }
   254                    }
   227                 }
   255                 }
   228             iPreviousItem = KNoItemSelected;
   256             iPreviousItem = KNoItemSelected;
   229             }
   257             }
       
   258 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS        
       
   259         if ( GfxTransEffect::IsRegistered( this ) )
       
   260             {
       
   261             CAknTransitionUtils::SetAllParents( this );
       
   262             GfxTransEffect::NotifyExternalState( EInternalHandleSequence, 
       
   263                     ( const TDesC8* )this );
       
   264             GfxTransEffect::Begin( this, KGfxControlAppearAction );
       
   265             GfxTransEffect::NotifyExternalState( ECaptureComponentsBegin, 
       
   266                     ( const TDesC8* )this );
       
   267             GfxTransEffect::SetDemarcation( this, rect );
       
   268             CAknControl::MakeVisible( ETrue );
       
   269             CAknTransitionUtils::MakeVisibleSubComponents( this,
       
   270                                     CAknTransitionUtils::EAppearVisible );
       
   271             GfxTransEffect::NotifyExternalState( ECaptureComponentsEnd, 
       
   272                     ( const TDesC8* )this );
       
   273             GfxTransEffect::End( this );
       
   274             }
       
   275         else
       
   276             {
   230         DrawNow(); 
   277         DrawNow(); 
       
   278             }
       
   279 #else
       
   280         DrawNow();
       
   281 #endif 
   231         }
   282         }
   232     else if ( !aVisible && isVisible )
   283     else if ( !aVisible && isVisible )
   233         {
   284         {
   234         CEikonEnv::Static()->EikAppUi()->UpdateStackedControlFlags( this, 
   285         CEikonEnv::Static()->EikAppUi()->UpdateStackedControlFlags( this, 
   235             ~0, ECoeStackFlagRefusesFocus | ECoeStackFlagRefusesAllKeys );
   286             ~0, ECoeStackFlagRefusesFocus | ECoeStackFlagRefusesAllKeys );
   236         CEikonEnv::Static()->EikAppUi()->HandleStackChanged();
   287         CEikonEnv::Static()->EikAppUi()->HandleStackChanged();
   237         CAknControl::MakeVisible( aVisible );
       
   238         TRAP_IGNORE( SelectItemL( iSelectedItem, EFalse ) ); 
   288         TRAP_IGNORE( SelectItemL( iSelectedItem, EFalse ) ); 
   239         DrawableWindow()->SetOrdinalPosition( 0, ECoeWinPriorityNeverAtFront );
   289         DrawableWindow()->SetOrdinalPosition( 0, 
       
   290                 ECoeWinPriorityNeverAtFront );
       
   291 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
   292         if ( GfxTransEffect::IsRegistered( this ) )
       
   293             {
       
   294             CAknTransitionUtils::SetAllParents( this );
       
   295             GfxTransEffect::Begin( this, KGfxControlDisappearAction );
       
   296             GfxTransEffect::NotifyExternalState( ECaptureComponentsBegin, 
       
   297                     ( const TDesC8* )this );
       
   298             GfxTransEffect::SetDemarcation( this, Rect() );
       
   299             CAknControl::MakeVisible( EFalse );
       
   300             CAknTransitionUtils::MakeVisibleSubComponents( this,
       
   301                                     CAknTransitionUtils::EForceInvisible );
       
   302             GfxTransEffect::NotifyExternalState( ECaptureComponentsEnd, 
       
   303                     ( const TDesC8* )this );
       
   304             GfxTransEffect::End( this );
       
   305             }
       
   306         else
       
   307             {
       
   308             CAknControl::MakeVisible( EFalse );
       
   309             }
       
   310 #else
       
   311         CAknControl::MakeVisible( EFalse );
       
   312 #endif 
   240         }
   313         }
   241     else 
   314     else 
   242         {
   315         {
   243         CAknControl::MakeVisible( aVisible );
   316         CAknControl::MakeVisible( aVisible );
   244         }
   317         }
   812 CAknToolbarExtensionView::CAknToolbarExtensionView( 
   885 CAknToolbarExtensionView::CAknToolbarExtensionView( 
   813     CAknToolbarExtension* aExtension): iExtension( aExtension ),
   886     CAknToolbarExtension* aExtension): iExtension( aExtension ),
   814     iSelectedItem( KNoItemSelected ), iNumberOfColumns( 1 ),
   887     iSelectedItem( KNoItemSelected ), iNumberOfColumns( 1 ),
   815     iIsDownOutside( EFalse )
   888     iIsDownOutside( EFalse )
   816     {
   889     {
       
   890 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
   891     GfxTransEffect::Register( this, KGfxTransEffectToolbarExtensionControlUid);
       
   892 #endif
   817     }
   893     }
   818 
   894 
   819 
   895 
   820 // -----------------------------------------------------------------------------
   896 // -----------------------------------------------------------------------------
   821 // CAknToolbarExtensionView::ConstructL
   897 // CAknToolbarExtensionView::ConstructL
   954          AknLayoutScalable_Avkon::popup_tb_float_extension_window( variety ) : 
  1030          AknLayoutScalable_Avkon::popup_tb_float_extension_window( variety ) : 
   955          AknLayoutScalable_Avkon::popup_tb_extension_window( variety ) );
  1031          AknLayoutScalable_Avkon::popup_tb_extension_window( variety ) );
   956          
  1032          
   957     if( landscape && !floating )
  1033     if( landscape && !floating )
   958         {
  1034         {
   959 
       
   960         TRect extButtonRect( iExtension->Rect() );
       
   961 
       
   962         // Calculate new y coordinate according to button middle point
  1035         // Calculate new y coordinate according to button middle point
   963         TInt newY = extButtonRect.iTl.iY + mainPaneRect.iTl.iY;             
  1036         TInt newY = ( mainPaneRect.Height() - viewSize.iHeight ) / 2 + mainPaneRect.iTl.iY;            
   964         // Check that rect with new y fits to extension view area
  1037         // Check that rect with new y fits to extension view area
   965         if( newY < extensionRect.iTl.iY ) // Top
  1038         if( newY < extensionRect.iTl.iY ) // Top
   966             {
  1039             {
   967             newY = extensionRect.iTl.iY;
  1040             newY = extensionRect.iTl.iY;
   968             }
  1041             }