diff -r a8834a2e9a96 -r c52421ed5f07 uifw/EikStd/coctlsrc/AknToolbar.cpp --- a/uifw/EikStd/coctlsrc/AknToolbar.cpp Wed Jun 09 09:58:37 2010 +0300 +++ b/uifw/EikStd/coctlsrc/AknToolbar.cpp Mon Jun 21 15:57:43 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -251,31 +251,26 @@ aReader.ReadInt8(); //lines, not used currently iFlags = aReader.ReadInt32(); - TBool enableTransparency = CAknEnv::Static()->TransparencyEnabled() && + TBool enableTransparency = ( ( !( iFlags & KAknToolbarFixed ) && !( iFlags & KAknToolbarFloatingUnTransparent ) ) || ( iFlags & KAknToolbarTransparent && iFlags & KAknToolbarFixed ) ); - - if( enableTransparency ) + if ( enableTransparency ) { Window().SetRequiredDisplayMode( EColor16MA ); // Without this, ACT does not work in all cases in HW - TInt err = Window().SetTransparencyAlphaChannel(); - - if ( err == KErrNone ) // it should all ways be true in NGA - { - // Set the window initially completely transparent. This needs to be called only once. - Window().SetBackgroundColor(~0); - } + EnableWindowTransparency(); } - - - iFrameContext = CAknsFrameBackgroundControlContext::NewL( KAknsIIDQsnFrPopupSub, - TRect(), TRect(), ( iFlags & KAknToolbarFixed )? ETrue : EFalse ); + TRect dummyRect( 0, 0, 0, 0 ); + iFrameContext = CAknsFrameBackgroundControlContext::NewL( + KAknsIIDQsnFrPopupSub, + dummyRect, + dummyRect, + ( iFlags & KAknToolbarFixed ) ? ETrue : EFalse ); iBgContext = CAknsBasicBackgroundControlContext::NewL( - KAknsIIDQsnBgScreen, TRect(), ETrue ); + KAknsIIDQsnBgScreen, dummyRect, ETrue ); SetWithSliding( ETrue ); @@ -314,15 +309,20 @@ // the rects correctly. if ( iFlags & KAknToolbarFixed ) { - if ( iFlags & KAknToolbarDefault ) + SetFocusing( EFalse ); + + // Don't set the size and position for default toolbar (never shown). + if ( !( iFlags & KAknToolbarDefault ) ) { - SetDimmed( ETrue ); + SetRect( CalculateSizeAndPosition() ); } - SetFocusing( EFalse ); - SetRect( CalculateSizeAndPosition() ); } - AdjustAllButtons(); + // Unnecessary for default toolbar (never shown). + if ( !( iFlags & KAknToolbarDefault ) ) + { + AdjustAllButtons(); + } } // ----------------------------------------------------------------------------- @@ -413,8 +413,9 @@ iInternalFlags.Clear( EFixedShown ); } - if ( visible && ( !AknLayoutUtils::PenEnabled() || - ( !Layout_Meta_Data::IsLandscapeOrientation() && iFlags & KAknToolbarDefault ) ) ) + if ( visible && + !Layout_Meta_Data::IsLandscapeOrientation() && + iFlags & KAknToolbarDefault ) { return; } @@ -547,9 +548,7 @@ // void CAknToolbar::ShowToolbarL() { - if ( iFlags & KAknToolbarFixed && - ( !AknLayoutUtils::PenEnabled() || - iFlags & KAknToolbarDefault ) ) + if ( iFlags & KAknToolbarFixed && iFlags & KAknToolbarDefault ) { if ( IsVisible() ) { @@ -592,12 +591,6 @@ SetExtent( startPos, rect.Size() ); UpdateControlPositions(); - TBool redrawStoreEnabled(EFalse); - if( !CAknEnv::Static()->TransparencyEnabled() ) - { - redrawStoreEnabled = Window().IsRedrawStoreEnabled(); - } - CTouchToolbarData* data = CheckRegistration( this ); if ( data && !(iFlags & KAknToolbarFixed) && iAvkonAppUi->IsForeground() ) { @@ -636,11 +629,6 @@ delete data; GfxTransEffect::Deregister( this ); } - - if ( !CAknEnv::Static()->TransparencyEnabled() && redrawStoreEnabled ) - { - Window().EnableRedrawStore( ETrue ); - } } // notify observer, for example touch pane, that toolbar was shown @@ -745,11 +733,6 @@ { if ( !iInternalFlags.IsSet( EShown ) ) // nothing to hide { - if ( iFlags & KAknToolbarDefault && !AknLayoutUtils::PenEnabled() - && IsVisible() ) - { - MakeVisible( EFalse ); - } return; } @@ -1200,13 +1183,8 @@ return; } } - - if ( aType == KAknToolbarSetVisible && iFlags & KAknToolbarDefault - && !AknLayoutUtils::PenEnabled() ) - { - return; - } - else if ( aType == KAknToolbarSetVisible && !IsShown() ) + + if ( aType == KAknToolbarSetVisible && !IsShown() ) { iInternalFlags.Set( ECalledFromFW ); iInternalFlags.Clear( EDrawBackground ); @@ -1235,14 +1213,10 @@ CAknButton* button = static_cast( item->Control() ); button->ResetState(); } - if ( iFlags & KAknToolbarDefault && !AknLayoutUtils::PenEnabled() && IsVisible() ) + + if ( iFlags & KAknToolbarFixed ) { - TRAP_IGNORE( HideToolbarL() ); - return; - } - else if ( iFlags & KAknToolbarFixed ) - { - if ( Layout_Meta_Data::IsLandscapeOrientation() && AknLayoutUtils::PenEnabled() ) + if ( Layout_Meta_Data::IsLandscapeOrientation() ) { iOrientation = EAknOrientationVertical; if ( ( iInternalFlags.IsSet( EFixedShown ) @@ -1262,7 +1236,7 @@ } } } - else if ( !( iFlags & KAknToolbarDefault ) && AknLayoutUtils::PenEnabled() ) + else if ( !( iFlags & KAknToolbarDefault ) ) { iOrientation = EAknOrientationHorizontal; if ( iInternalFlags.IsSet( EFixedShown ) && !iInternalFlags.IsSet( EShown ) ) @@ -1280,7 +1254,7 @@ } } } - else if ( ( !AknLayoutUtils::PenEnabled() || iFlags & KAknToolbarDefault ) && iInternalFlags.IsSet( EShown ) ) + else if ( iFlags & KAknToolbarDefault && iInternalFlags.IsSet( EShown ) ) { TRAP_IGNORE( HideToolbarL() ); return; @@ -2383,27 +2357,31 @@ } } - TRect rect = CalculateSizeAndPosition(); - // Set focused item again to avoid panic in a case when toolbar has more - // items in previous orientation and some of the items that do not - // fit to toolbar in this orientation was focused. - if ( IsFocused() ) - { - TRAP_IGNORE( MoveHighlightL( iFocusedItem, EFalse ) ); - } - - if ( iInternalFlags.IsSet( EShown ) ) + // Don't set the size and position for default toolbar (never shown). + if ( !( iFlags & KAknToolbarDefault ) ) { - if ( !( iFlags & KAknToolbarFlexiblePosition ) ) + TRect rect = CalculateSizeAndPosition(); + // Set focused item again to avoid panic in a case when toolbar has + // more items in previous orientation and some of the items that do + // not fit to toolbar in this orientation was focused. + if ( IsFocused() ) { - SetPosition( rect.iTl ); + TRAP_IGNORE( MoveHighlightL( iFocusedItem, EFalse ) ); } - else + + if ( iInternalFlags.IsSet( EShown ) ) { - UpdateControlPositions(); + if ( !( iFlags & KAknToolbarFlexiblePosition ) ) + { + SetPosition( rect.iTl ); + } + else + { + UpdateControlPositions(); + } + SetSize( rect.Size() ); + DrawDeferred(); } - SetSize( rect.Size() ); - DrawDeferred(); } } @@ -2639,14 +2617,10 @@ { TBool toolbarNotVisible( !IsShown() && !( iFlags & KAknToolbarDefault ) ); TBool fixedToolbar( iFlags & KAknToolbarFixed ); - TBool landscapeOrientation( Layout_Meta_Data::IsLandscapeOrientation() ); - TBool touchEnabled( AknLayoutUtils::PenEnabled() ); TBool defaultContent( iFlags & KAknToolbarDefault ); if ( toolbarNotVisible || !fixedToolbar || - ( defaultContent && !landscapeOrientation ) || - !touchEnabled || ( fixedToolbar && defaultContent ) ) { return;