uifw/EikStd/coctlsrc/AknTouchPane.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of the concrete touch pane class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <eikaufty.h>   // MEikAppUiFactory
       
    21 #include <eikenv.h>     // CEikonEnv
       
    22 #include <eikapp.h>     // CEikApplication
       
    23 #include <eikpanic.h>
       
    24 #include <AknCapServerClient.h> // RAknUiServer
       
    25 #include <barsread.h>           // TResourceReader
       
    26 #include <AknDef.h>             // View ids
       
    27 #include <AknsUtils.h>
       
    28 #include <AknsDrawUtils.h>
       
    29 #include <AknsFrameBackgroundControlContext.h>
       
    30 #include <aknview.h>            // CAknView
       
    31 #include <aknViewAppUi.h>       // CAknViewAppUi
       
    32 #include <StringLoader.h>       // StringLoader
       
    33 #include <hlplch.h>             // HlpLauncher
       
    34 #include <AknSgcc.h>
       
    35 #include <AknUtils.h>
       
    36 #include <AknStatuspaneUtils.h>
       
    37 #include <aknbutton.h>
       
    38 #include <akntoolbar.h>
       
    39 #include <aknfeppensupportinterface.h> // MAknFepPenSupportInterface
       
    40 #include <AknCapServerDefs.h>
       
    41 
       
    42 #include <AknTasHook.h> // for testability hooks
       
    43 #include <avkon.mbg>
       
    44 #include <avkon.rsg>
       
    45 #include <aknpriv.rsg>
       
    46 #include <layoutmetadata.cdl.h>
       
    47 #include <aknlayoutscalable_avkon.cdl.h>
       
    48 
       
    49 #include <gfxtranseffect/gfxtranseffect.h> 
       
    50 #include <akntranseffect.h>
       
    51 #include <akntransitionutils.h>
       
    52 
       
    53 #include "touchtoolbardata.h"
       
    54 
       
    55 #include "akntouchpane.hrh"
       
    56 #include "akntouchpane.h"
       
    57 
       
    58 #ifdef RD_SCALABLE_UI_V2
       
    59 
       
    60 const TInt KDisableToolbar = 0xfff1;
       
    61 const TInt KEnableToolbar = 0xfff2;
       
    62 
       
    63 // UIDs for contacts application.
       
    64 #ifdef RD_PHONEBOOK2
       
    65 #define KAknTouchPaneContactsAppUid TUid::Uid(0x101f4cce)
       
    66 #else
       
    67 #define KAknTouchPaneContactsAppUid TUid::Uid(0x101f87b1)
       
    68 #endif
       
    69 #define KAknTouchPaneContactsViewUid TUid::Uid(1)
       
    70 
       
    71 // UIDs for dialler application.
       
    72 #define KAknTouchPaneDiallerAppUid TUid::Uid(0x100058B3)
       
    73 #define KAknTouchPaneDiallerViewUid TUid::Uid(0x10282D81)
       
    74 #define KTouchPaneDiallerVievCommand TUid::Uid(0x1)
       
    75 
       
    76 #define KAknTouchPaneHelpAppUid TUid::Uid(0x10005234)
       
    77 
       
    78 #define KAknTouchPaneAutoLockAppUid TUid::Uid(0x100059B5)
       
    79 
       
    80 
       
    81 // Class for storing touch pane item description.
       
    82 class TAknTouchPaneItem
       
    83     {
       
    84 public:
       
    85 
       
    86     TAknTouchPaneItem()
       
    87         : iPriority( -1 ),
       
    88           iId( ETouchPaneElementNone ),
       
    89           iPlugin( NULL ) {}
       
    90 
       
    91     TInt iPriority;
       
    92     TUint iId;
       
    93     TUint iPlugin;
       
    94     };
       
    95 
       
    96 // Enumeration for touch pane flags.
       
    97 enum TAknTouchPaneFlags
       
    98     {
       
    99     ENoAutomaticVisibilityChanges   = 0,
       
   100     ETouchPaneActive                = 1,
       
   101     EHasForeground                  = 2,
       
   102     EShellIconActive                = 3,
       
   103     ESwapperIconActive              = 4,
       
   104     EIdleViewIconActive             = 5,
       
   105     EDiallerIconActive              = 6,
       
   106     ERotateIconActive               = 7,
       
   107     EHelpIconActive                 = 8,
       
   108     EInputMethodIconActive          = 9,
       
   109     EToolbarIconActive              = 10,
       
   110     EContactsIconActive            = 11
       
   111     };
       
   112 
       
   113 #endif // RD_SCALABLE_UI_V2
       
   114 
       
   115 // ============================= LOCAL FUNCTIONS ===============================
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // RectFromLayout
       
   119 // Gets a rect by mapping the given component layout with the given parent
       
   120 // rect.
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 #ifdef RD_SCALABLE_UI_V2
       
   124 TRect RectFromLayout( const TRect& aParent,
       
   125     const TAknWindowComponentLayout& aComponentLayout )
       
   126     {
       
   127     TAknLayoutRect layoutRect;
       
   128     layoutRect.LayoutRect( aParent, aComponentLayout.LayoutLine() );
       
   129     return layoutRect.Rect();
       
   130     }
       
   131 #endif // RD_SCALABLE_UI_V2
       
   132 
       
   133 // -----------------------------------------------------------------------------
       
   134 // Reads default touch pane content from the resources.
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 #ifdef RD_SCALABLE_UI_V2
       
   138 TUint ReadDefaultTouchPaneContentL( RArray<TAknTouchPaneItem>& aItems )
       
   139     {
       
   140     TResourceReader reader;
       
   141     CEikonEnv::Static()->CreateResourceReaderLC( reader, R_AKNPRIV_TOUCHPANE );
       
   142     TUint flags = reader.ReadUint32();
       
   143     
       
   144     TAknTouchPaneItem item;
       
   145     for ( TUint itemCount = reader.ReadInt16(); itemCount > 0; itemCount-- )
       
   146         {
       
   147         TUint version = reader.ReadUint8();
       
   148         if ( version != 1 )
       
   149             {
       
   150             User::Leave( KErrNotSupported );
       
   151             }
       
   152 
       
   153         item.iPriority = reader.ReadUint8();
       
   154         item.iId = reader.ReadUint8();
       
   155         item.iPlugin = reader.ReadUint32();
       
   156         aItems.AppendL( item );
       
   157         }
       
   158 
       
   159     CleanupStack::PopAndDestroy(); // reader
       
   160     return flags;
       
   161     };
       
   162 #endif // RD_SCALABLE_UI_V2
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // Reads the given resource and modifies the given item set based on the
       
   166 // customizations specified in the resource.
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 #ifdef RD_SCALABLE_UI_V2
       
   170 void ReadCustomTouchPaneContentL( TInt aResourceId,
       
   171     RArray<TAknTouchPaneItem>& aItems, TBool aAllowCustomization )
       
   172     {
       
   173     TResourceReader reader;
       
   174     CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId );
       
   175 
       
   176     // Check resource version.
       
   177     const TUint version = reader.ReadUint8();
       
   178     if ( version != 1 )
       
   179         {
       
   180         User::Leave( KErrNotSupported );
       
   181         }
       
   182 
       
   183     // Read application specific touch pane flags.
       
   184     const TUint flags = reader.ReadUint32();
       
   185 
       
   186     if ( flags & EAknNoTouchPane )
       
   187         {
       
   188         aItems.Reset();
       
   189         }
       
   190     else if ( aAllowCustomization && ( flags & EAknCustomTouchPane ) )
       
   191         {
       
   192         const TInt itemCount = reader.ReadInt16();
       
   193         for ( TInt ii = itemCount; ii > 0; --ii )
       
   194             {
       
   195             // Read custom item.
       
   196             const TInt version = reader.ReadInt8();
       
   197             if ( version != 1 )
       
   198                 {
       
   199                 User::Leave( KErrNotSupported );
       
   200                 }
       
   201             const TUint id = reader.ReadUint8();
       
   202             const TUint plugin = reader.ReadUint32();
       
   203 
       
   204             // Find optional item with lowest priority.
       
   205             TInt optionalItemPriority = 0;
       
   206             TInt optionalItemIndex = -1;
       
   207             for ( TInt jj = aItems.Count() - 1; jj >= 0; --jj )
       
   208                 {
       
   209                 if ( aItems[jj].iPriority > optionalItemPriority )
       
   210                     {
       
   211                     optionalItemPriority = aItems[jj].iPriority;
       
   212                     optionalItemIndex = jj;
       
   213                     }
       
   214                 }
       
   215 
       
   216             // Replace optional item.
       
   217             if ( optionalItemIndex >= 0 )
       
   218                 {
       
   219                 aItems[optionalItemIndex].iPriority = -1;
       
   220                 aItems[optionalItemIndex].iId = id;
       
   221                 aItems[optionalItemIndex].iPlugin = plugin;
       
   222                 }
       
   223             }
       
   224         }
       
   225 
       
   226     CleanupStack::PopAndDestroy(); // reader
       
   227     return;
       
   228     }
       
   229 #endif // RD_SCALABLE_UI_V2
       
   230 
       
   231 // ============================ MEMBER FUNCTIONS ===============================
       
   232 
       
   233 // -----------------------------------------------------------------------------
       
   234 // CAknTouchPane::CAknTouchPane
       
   235 // C++ default constructor.
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 #ifdef RD_SCALABLE_UI_V2
       
   239 CAknTouchPane::CAknTouchPane()
       
   240     : iAppUi( iAvkonAppUi ),
       
   241       iUid( TUid::Null() )
       
   242     {
       
   243     __ASSERT_DEBUG( iAppUi, User::Invariant() );
       
   244     SetMopParent( iAppUi );
       
   245 
       
   246     CApaApplication* application = iAppUi->Application();
       
   247     if ( application )
       
   248         {
       
   249         iUid = application->AppDllUid();
       
   250         }
       
   251 
       
   252     iFlags.Assign( ETouchPaneActive, iUid != KAknTouchPaneAutoLockAppUid );
       
   253     }
       
   254 #endif // RD_SCALABLE_UI_V2
       
   255 
       
   256 // -----------------------------------------------------------------------------
       
   257 // CAknTouchPane::ConstructL
       
   258 // Symbian 2nd phase constructor.
       
   259 // -----------------------------------------------------------------------------
       
   260 //
       
   261 #ifdef RD_SCALABLE_UI_V2
       
   262 void CAknTouchPane::ConstructL( RArray<TAknTouchPaneItem>& aItems )
       
   263     {
       
   264     CreateWindowL();
       
   265     Window().SetPointerGrab( ETrue );
       
   266     Window().SetNonFading( ETrue );
       
   267     Window().SetOrdinalPosition( 0, ECoeWinPriorityHigh );
       
   268     SetFocusing( EFalse );
       
   269 
       
   270     InitComponentArrayL();
       
   271 
       
   272     CCoeControl* component = NULL;
       
   273     for ( TInt ii = 0; ii < aItems.Count(); ++ii )
       
   274         {
       
   275         if ( aItems[ii].iId != ETouchPaneElementPlugin )
       
   276             {
       
   277             component = ConstructDefaultComponentL( aItems[ii].iId );
       
   278             }
       
   279         if ( component )
       
   280             {
       
   281             Components().AppendLC( component, KCoeNoControlId );
       
   282             CleanupStack::Pop( component );
       
   283             component = NULL;
       
   284             }
       
   285         }
       
   286 
       
   287     iBgContext = CAknsBasicBackgroundControlContext::NewL(
       
   288         KAknsIIDQsnBgScreen, TRect(), ETrue );
       
   289 
       
   290     iFrameContext = CAknsFrameBackgroundControlContext::NewL(
       
   291         KAknsIIDNone, TRect(), TRect(), ETrue );
       
   292 
       
   293     // Touch pane is set visible only in touch layouts.
       
   294     if ( AknLayoutUtils::PenEnabled() && Layout_Meta_Data::IsTouchPaneEnabled() )
       
   295         {
       
   296         SetWindowLayout();
       
   297         CCoeControl::MakeVisible( ETrue );
       
   298         }
       
   299     else
       
   300         {
       
   301         CCoeControl::MakeVisible( EFalse );
       
   302         }
       
   303         
       
   304     ActivateL();
       
   305     }
       
   306 #endif // RD_SCALABLE_UI_V2
       
   307 
       
   308 // -----------------------------------------------------------------------------
       
   309 // CAknTouchPane::NewL
       
   310 // Two-phased constructor.
       
   311 // -----------------------------------------------------------------------------
       
   312 //
       
   313 #ifdef RD_SCALABLE_UI_V2
       
   314 EXPORT_C CAknTouchPane* CAknTouchPane::NewL()
       
   315     {
       
   316     return CAknTouchPane::NewL( NULL );
       
   317     }
       
   318 #else
       
   319 EXPORT_C CAknTouchPane* CAknTouchPane::NewL()
       
   320     {
       
   321     return NULL;
       
   322     }
       
   323 #endif // RD_SCALABLE_UI_V2
       
   324 
       
   325 // -----------------------------------------------------------------------------
       
   326 // CAknTouchPane::NewL
       
   327 // Two-phased constructor.
       
   328 // -----------------------------------------------------------------------------
       
   329 //
       
   330 #ifdef RD_SCALABLE_UI_V2
       
   331 EXPORT_C CAknTouchPane* CAknTouchPane::NewL( TInt aResourceId )
       
   332     {
       
   333     RArray<TAknTouchPaneItem> items;
       
   334     CleanupClosePushL( items );
       
   335 
       
   336     const TUint flags = ReadDefaultTouchPaneContentL( items );
       
   337 
       
   338     if ( aResourceId )
       
   339         {
       
   340         ReadCustomTouchPaneContentL( aResourceId, items,
       
   341             !( flags & EAknDisabeTouchPaneCustomizations ) );
       
   342         }
       
   343     else if ( !( flags & EAknConstructTouchPaneByDefault ) )
       
   344         {
       
   345         items.Reset();
       
   346         }
       
   347 
       
   348     CAknTouchPane* self = NULL;
       
   349     if ( items.Count() )
       
   350         {
       
   351         self = new ( ELeave ) CAknTouchPane;
       
   352         CleanupStack::PushL( self );
       
   353         self->ConstructL( items );
       
   354         CleanupStack::Pop( self );
       
   355         }
       
   356 
       
   357     CleanupStack::Pop( &items );
       
   358     items.Close();
       
   359     AKNTASHOOK_ADDL( self, "CAknTouchPane" );
       
   360     return self;
       
   361     }
       
   362 #else
       
   363 EXPORT_C CAknTouchPane* CAknTouchPane::NewL( TInt )
       
   364     {
       
   365     return NULL;
       
   366     }
       
   367 #endif // RD_SCALABLE_UI_V2
       
   368 
       
   369 // -----------------------------------------------------------------------------
       
   370 // CAknTouchPane::~CAknTouchPane
       
   371 // Destructor.
       
   372 // -----------------------------------------------------------------------------
       
   373 //
       
   374 EXPORT_C CAknTouchPane::~CAknTouchPane()
       
   375     {
       
   376     AKNTASHOOK_REMOVE();
       
   377 #ifdef RD_SCALABLE_UI_V2
       
   378     DeregisterControlPositions();
       
   379 
       
   380     if ( iAppUi )
       
   381         {
       
   382         iAppUi->RemoveFromStack( this );
       
   383         iAppUi = NULL; // Not owned
       
   384         }
       
   385 
       
   386     // Although, these elements are owned by touch pane, they are deleted
       
   387     // through component array.
       
   388     iShellIcon = NULL;
       
   389     iSwapperIcon = NULL;
       
   390     iIdleViewIcon = NULL;
       
   391     iDiallerIcon = NULL;
       
   392     iRotateIcon = NULL;
       
   393     iHelpIcon = NULL;
       
   394     iInputMethodIcon = NULL;
       
   395     iToolbarIcon = NULL;
       
   396     iContactsIcon = NULL;
       
   397 
       
   398     iObserver = NULL; // Not owned
       
   399     delete iBgContext;
       
   400     delete iFrameContext;
       
   401 #endif // RD_SCALABLE_UI_V2
       
   402     }
       
   403 
       
   404 // -----------------------------------------------------------------------------
       
   405 // CAknTouchPane::ReduceRect
       
   406 // -----------------------------------------------------------------------------
       
   407 //
       
   408 #ifdef RD_SCALABLE_UI_V2
       
   409 EXPORT_C void CAknTouchPane::ReduceRect( TRect& aBoundingRect ) const
       
   410     {
       
   411     if ( !IsVisible() )
       
   412         {
       
   413         return;
       
   414         }
       
   415 
       
   416     TRect rect( Position(), Size() );
       
   417 
       
   418     if ( rect.Intersects( aBoundingRect ) )
       
   419         {
       
   420         rect.Intersection( aBoundingRect );
       
   421 
       
   422         if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
   423             {
       
   424             aBoundingRect.iTl.iX = rect.iBr.iX;
       
   425             }
       
   426         else 
       
   427             {
       
   428             aBoundingRect.iTl.iY = rect.iBr.iY;
       
   429             }
       
   430         }
       
   431     }
       
   432 #else
       
   433 EXPORT_C void CAknTouchPane::ReduceRect( TRect& ) const
       
   434     {
       
   435     }
       
   436 #endif // RD_SCALABLE_UI_V2
       
   437 
       
   438 // -----------------------------------------------------------------------------
       
   439 // CAknTouchPane::SetObserver
       
   440 // -----------------------------------------------------------------------------
       
   441 //
       
   442 #ifdef RD_SCALABLE_UI_V2
       
   443 EXPORT_C void CAknTouchPane::SetObserver( MAknTouchPaneObserver* aObserver )
       
   444     {
       
   445     iObserver = aObserver;
       
   446     }
       
   447 #else
       
   448 EXPORT_C void CAknTouchPane::SetObserver( MAknTouchPaneObserver* )
       
   449     {
       
   450     }
       
   451 #endif // RD_SCALABLE_UI_V2
       
   452 
       
   453 // -----------------------------------------------------------------------------
       
   454 // CAknTouchPane::SetVisibilityMode
       
   455 // -----------------------------------------------------------------------------
       
   456 //
       
   457 EXPORT_C void CAknTouchPane::SetVisibilityMode( TVisibilityMode aMode )
       
   458     {
       
   459 #ifdef RD_SCALABLE_UI_V2
       
   460     if ( aMode == EAutomaticVisibilityChanges )
       
   461         {
       
   462         iFlags.Clear( ENoAutomaticVisibilityChanges );
       
   463         }
       
   464     else if ( aMode == EManualVisibilityChanges )
       
   465         {
       
   466         iFlags.Set( ENoAutomaticVisibilityChanges );
       
   467         }
       
   468 #else
       
   469     (void)aMode;
       
   470 #endif // RD_SCALABLE_UI_V2
       
   471     }
       
   472 
       
   473 // -----------------------------------------------------------------------------
       
   474 // CAknTouchPane::AllowInputMethodActivation
       
   475 // -----------------------------------------------------------------------------
       
   476 //
       
   477 #ifdef RD_SCALABLE_UI_V2
       
   478 EXPORT_C void CAknTouchPane::AllowInputMethodActivation( TBool aValue )
       
   479     {
       
   480     if ( iInputMethodIcon )
       
   481         {
       
   482         iFlags.Assign( EInputMethodIconActive, aValue );
       
   483 
       
   484         // Icon dimming is updated only when touch pane is active.
       
   485         if ( iFlags.IsSet( ETouchPaneActive ) )
       
   486             {
       
   487             iInputMethodIcon->SetDimmed( !aValue );
       
   488             Window().Invalidate( iInputMethodIcon->Rect() );
       
   489             }
       
   490         }
       
   491     }
       
   492 #else
       
   493 EXPORT_C void CAknTouchPane::AllowInputMethodActivation( TBool )
       
   494     {
       
   495     }
       
   496 #endif // RD_SCALABLE_UI_V2
       
   497 
       
   498 // -----------------------------------------------------------------------------
       
   499 // CAknTouchPane::SetInputMethodIconActivated
       
   500 // -----------------------------------------------------------------------------
       
   501 //
       
   502 #ifdef RD_SCALABLE_UI_V2
       
   503 EXPORT_C void CAknTouchPane::SetInputMethodIconActivated( TBool aActivated )
       
   504     {
       
   505     if ( iInputMethodIcon )
       
   506         {
       
   507         iInputMethodIcon->SetCurrentState( aActivated ? 1 : 0, 
       
   508             !iInputMethodIcon->IsDimmed() );
       
   509         }
       
   510     }
       
   511 #else
       
   512 EXPORT_C void CAknTouchPane::SetInputMethodIconActivated( TBool )
       
   513     {
       
   514     }
       
   515 #endif // RD_SCALABLE_UI_V2
       
   516 
       
   517 // -----------------------------------------------------------------------------
       
   518 // CAknTouchPane::RefreshL
       
   519 // -----------------------------------------------------------------------------
       
   520 //
       
   521 EXPORT_C void CAknTouchPane::RefreshL()
       
   522     {
       
   523 #ifdef RD_SCALABLE_UI_V2
       
   524     if ( iHelpIcon && iUid != KAknTouchPaneHelpAppUid )
       
   525         {
       
   526         CArrayFix<TCoeHelpContext>* help = iAppUi->AppHelpContextL();
       
   527         TBool helpActive = help && help->Count();
       
   528         iFlags.Assign( EHelpIconActive, helpActive );
       
   529         delete help; help = NULL;
       
   530         }
       
   531 
       
   532     if ( iRotateIcon )
       
   533         {
       
   534         if ( iAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationUnspecified )
       
   535             {
       
   536             iFlags.Set( ERotateIconActive );
       
   537             }
       
   538         else 
       
   539             {
       
   540             iFlags.Clear( ERotateIconActive );
       
   541             }
       
   542         }
       
   543 
       
   544     if ( iToolbarIcon )
       
   545         {
       
   546         CAknToolbar* toolbar = iAppUi->CurrentPopupToolbar();
       
   547         if ( toolbar && !toolbar->IsToolbarDisabled() )
       
   548             {
       
   549             iFlags.Set( EToolbarIconActive );
       
   550             TInt nextState = toolbar->IsShown() ? 1 : 0;
       
   551             if ( nextState != iToolbarIcon->StateIndex() )
       
   552                 {
       
   553                 iToolbarIcon->SetCurrentState( nextState, EFalse );
       
   554                 Window().Invalidate( iToolbarIcon->Rect() );
       
   555                 }
       
   556             }
       
   557         else
       
   558             {
       
   559             iFlags.Clear( EToolbarIconActive );
       
   560             }
       
   561         }
       
   562 
       
   563     // Updates the dimming of buttons.
       
   564     DoRefresh();
       
   565 #endif // RD_SCALABLE_UI_V2
       
   566     }
       
   567 
       
   568 // -----------------------------------------------------------------------------
       
   569 // CAknTouchPane::SetFepPenSupportInterface
       
   570 // -----------------------------------------------------------------------------
       
   571 //
       
   572 #ifdef RD_SCALABLE_UI_V2
       
   573 EXPORT_C void CAknTouchPane::SetFepPenSupportInterface(
       
   574     MAknFepPenSupportInterface* aFepPenSupportInterface )
       
   575     {
       
   576     iFepPenSupportInterface = aFepPenSupportInterface;
       
   577     }
       
   578 #else
       
   579 EXPORT_C void CAknTouchPane::SetFepPenSupportInterface(
       
   580     MAknFepPenSupportInterface* )
       
   581     {
       
   582     }
       
   583 #endif // RD_SCALABLE_UI_V2
       
   584 
       
   585 // -----------------------------------------------------------------------------
       
   586 // CAknTouchPane::HandleStatusPaneSizeChange
       
   587 // -----------------------------------------------------------------------------
       
   588 //
       
   589 #ifdef RD_SCALABLE_UI_V2
       
   590 void CAknTouchPane::HandleStatusPaneSizeChange( TInt aInitialResourceId,
       
   591     TInt aLastRequestedResourceId )
       
   592     {
       
   593     if ( !iFlags.IsSet( ENoAutomaticVisibilityChanges ) )
       
   594         {
       
   595         TInt resourceId = aLastRequestedResourceId ?
       
   596             aLastRequestedResourceId : aInitialResourceId;
       
   597 
       
   598         __ASSERT_DEBUG( iAvkonAppUi->StatusPane(), User::Invariant() );
       
   599         TBool visible = iAvkonAppUi->StatusPane()->IsVisible();
       
   600         if ( visible )
       
   601             {
       
   602             visible = AknStatuspaneUtils::TouchPaneCompatibleLayoutActive() &&
       
   603                 !( AknStatuspaneUtils::StaconPaneActive() &&
       
   604                     resourceId == R_AVKON_STATUS_PANE_LAYOUT_EMPTY );
       
   605             }
       
   606         MakeVisible( visible );
       
   607         }
       
   608     }
       
   609 #endif // RD_SCALABLE_UI_V2
       
   610 
       
   611 // -----------------------------------------------------------------------------
       
   612 // CAknTouchPane::CountComponentControls
       
   613 // -----------------------------------------------------------------------------
       
   614 //
       
   615 EXPORT_C TInt CAknTouchPane::CountComponentControls() const
       
   616     {
       
   617 #ifdef RD_SCALABLE_UI_V2
       
   618     return CCoeControl::CountComponentControls();
       
   619 #else
       
   620     return NULL;
       
   621 #endif // RD_SCALABLE_UI_V2
       
   622     }
       
   623 
       
   624 // -----------------------------------------------------------------------------
       
   625 // CAknTouchPane::ComponentControl
       
   626 // -----------------------------------------------------------------------------
       
   627 //
       
   628 #ifdef RD_SCALABLE_UI_V2
       
   629 EXPORT_C CCoeControl* CAknTouchPane::ComponentControl( TInt aIndex ) const
       
   630     {
       
   631     __ASSERT_DEBUG(aIndex >= 0, Panic(EEikPanicInvalidIndex));
       
   632     __ASSERT_DEBUG(aIndex < Components().Count(), Panic(EEikPanicInvalidIndex));
       
   633 
       
   634     return CCoeControl::ComponentControl( aIndex );
       
   635     }
       
   636 #else
       
   637 EXPORT_C CCoeControl* CAknTouchPane::ComponentControl( TInt ) const
       
   638     {
       
   639     return NULL;
       
   640     }
       
   641 #endif // RD_SCALABLE_UI_V2
       
   642 
       
   643 // -----------------------------------------------------------------------------
       
   644 // CAknTouchPane::Draw
       
   645 // -----------------------------------------------------------------------------
       
   646 //
       
   647 #ifdef RD_SCALABLE_UI_V2
       
   648 EXPORT_C void CAknTouchPane::Draw( CWindowGc& aGc, 
       
   649     const CCoeControl& /*aControl*/, const TRect& aRect ) const
       
   650     {
       
   651     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   652     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
   653     
       
   654     if ( !cc )
       
   655         {
       
   656         iFrameContext->SetParentContext( iBgContext );
       
   657         }
       
   658     else
       
   659         {
       
   660         iFrameContext->SetParentContext( cc );
       
   661         }
       
   662     
       
   663     if ( !AknsDrawUtils::DrawBackground( skin, iFrameContext, this, aGc,
       
   664             aRect.iTl, aRect, KAknsDrawParamNoClearUnderImage ) )
       
   665         {
       
   666         aGc.SetBrushColor( KRgbRed );
       
   667         aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   668         aGc.SetClippingRect( aRect );
       
   669         aGc.DrawRect( Rect() );
       
   670         }
       
   671     }
       
   672 #else
       
   673 EXPORT_C void CAknTouchPane::Draw( CWindowGc&, const CCoeControl&,
       
   674     const TRect& ) const
       
   675     {
       
   676     }
       
   677 #endif // RD_SCALABLE_UI_V2
       
   678 
       
   679 // -----------------------------------------------------------------------------
       
   680 // CAknTouchPane::HandleControlEventL
       
   681 // -----------------------------------------------------------------------------
       
   682 //
       
   683 #ifdef RD_SCALABLE_UI_V2
       
   684 EXPORT_C void CAknTouchPane::HandleControlEventL( CCoeControl* aControl,
       
   685     TCoeEvent aEventType )
       
   686     {
       
   687     if ( aControl && ( aEventType == EEventStateChanged ) )
       
   688         {
       
   689         if ( aControl == iShellIcon )
       
   690             {
       
   691             if ( iUid != KAknApplicationShellViewId.iAppUid )
       
   692                 {                
       
   693                 ActivateApplicationShellL();
       
   694                 }
       
   695             else
       
   696                 {
       
   697                 ActivateIdleViewL();
       
   698                 }
       
   699             }
       
   700         else if ( aControl == iSwapperIcon )
       
   701             {
       
   702             ActivateFastSwapL();
       
   703             }
       
   704         else if ( aControl == iIdleViewIcon )
       
   705             {
       
   706             ActivateIdleViewL();
       
   707             }
       
   708         else if ( aControl == iDiallerIcon )
       
   709             {
       
   710             ActivateDiallerL( iUid != KAknTouchPaneDiallerAppUid );
       
   711             }
       
   712         else if ( aControl == iRotateIcon )
       
   713             {
       
   714             RotateScreenL();
       
   715             }
       
   716         else if ( aControl == iHelpIcon )
       
   717             {
       
   718             ActivateHelpL( iUid != KAknTouchPaneHelpAppUid );
       
   719             }
       
   720         else if ( aControl == iInputMethodIcon )
       
   721             {
       
   722             ActivateStylusInputL( iInputMethodIcon->StateIndex() == 1 );
       
   723             }
       
   724         else if ( aControl == iToolbarIcon )
       
   725             {
       
   726             ActivateToolbarL( iToolbarIcon->StateIndex() == 1 );
       
   727             }
       
   728         else if ( aControl == iContactsIcon )
       
   729             {
       
   730             ActivateContactsL( iUid != KAknTouchPaneContactsAppUid );
       
   731             }
       
   732 
       
   733         // Update the toolbar button state, if current toolbar notifies of a
       
   734         // change in its state
       
   735         else if ( aControl == iAppUi->CurrentPopupToolbar() && 
       
   736                   iToolbarIcon )
       
   737             {
       
   738             CAknToolbar* toolbar = iAppUi->CurrentPopupToolbar();
       
   739             iToolbarIcon->SetDimmed( EFalse );
       
   740             iFlags.Set( EToolbarIconActive );
       
   741             iToolbarIcon->SetCurrentState( toolbar->IsShown() ? 1 : 0, ETrue );
       
   742             }
       
   743         }
       
   744 
       
   745     else if ( aControl && ( aEventType == CAknButton::ELongPressEvent ) )
       
   746         {
       
   747         if ( aControl == iShellIcon || aControl == iSwapperIcon )
       
   748             {
       
   749             ActivateFastSwapL();
       
   750             }
       
   751         }
       
   752 
       
   753     else if ( aControl && ( aEventType == KDisableToolbar ) )
       
   754         {
       
   755         CAknToolbar* toolbar = iAppUi->CurrentPopupToolbar(); 
       
   756         if ( aControl == toolbar && iToolbarIcon )
       
   757             {
       
   758             iToolbarIcon->SetDimmed( ETrue );
       
   759             iFlags.Clear( EToolbarIconActive );
       
   760             }
       
   761         Window().Invalidate( iToolbarIcon->Rect() );
       
   762         }
       
   763     else if ( aControl && ( aEventType == KEnableToolbar ) )
       
   764         {
       
   765         CAknToolbar* toolbar = iAppUi->CurrentPopupToolbar(); 
       
   766         if ( aControl == toolbar && iToolbarIcon )
       
   767             {
       
   768             iToolbarIcon->SetDimmed( EFalse );
       
   769             iFlags.Set( EToolbarIconActive );
       
   770             }
       
   771         Window().Invalidate( iToolbarIcon->Rect() );
       
   772         }
       
   773     }
       
   774 #else
       
   775 EXPORT_C void CAknTouchPane::HandleControlEventL( CCoeControl*, TCoeEvent )
       
   776     {
       
   777     }
       
   778 #endif // RD_SCALABLE_UI_V2
       
   779 
       
   780 // -----------------------------------------------------------------------------
       
   781 // CAknTouchPane::HandleResourceChange
       
   782 // -----------------------------------------------------------------------------
       
   783 //
       
   784 #ifdef RD_SCALABLE_UI_V2
       
   785 EXPORT_C void CAknTouchPane::HandleResourceChange( TInt aType )
       
   786     {
       
   787     CCoeControl::HandleResourceChange( aType );
       
   788 
       
   789     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   790         {
       
   791         if ( AknLayoutUtils::PenEnabled() && Layout_Meta_Data::IsTouchPaneEnabled() )
       
   792             {
       
   793             SetWindowLayout();
       
   794             }
       
   795         else
       
   796             {
       
   797             CCoeControl::MakeVisible( EFalse );
       
   798             }
       
   799         }
       
   800     }
       
   801 #else
       
   802 EXPORT_C void CAknTouchPane::HandleResourceChange( TInt )
       
   803     {
       
   804     }
       
   805 #endif // RD_SCALABLE_UI_V2
       
   806 
       
   807 // -----------------------------------------------------------------------------
       
   808 // CAknTouchPane::MakeVisible
       
   809 // -----------------------------------------------------------------------------
       
   810 //
       
   811 #ifdef RD_SCALABLE_UI_V2
       
   812 EXPORT_C void CAknTouchPane::MakeVisible( TBool aVisible )
       
   813     {
       
   814     if ( ( !aVisible || AknLayoutUtils::PenEnabled() ) && 
       
   815         ( aVisible != IsVisible() ) && Layout_Meta_Data::IsTouchPaneEnabled() )
       
   816         {
       
   817         CCoeControl::MakeVisible( aVisible );
       
   818         ReportSizeChange();
       
   819         }
       
   820     }
       
   821 #else
       
   822 EXPORT_C void CAknTouchPane::MakeVisible( TBool )
       
   823     {
       
   824     }
       
   825 #endif // RD_SCALABLE_UI_V2
       
   826 
       
   827 // -----------------------------------------------------------------------------
       
   828 // CAknTouchPane::OfferKeyEventL
       
   829 // -----------------------------------------------------------------------------
       
   830 //
       
   831 EXPORT_C TKeyResponse CAknTouchPane::OfferKeyEventL(
       
   832     const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ )
       
   833     {
       
   834     return EKeyWasNotConsumed;
       
   835     }
       
   836 
       
   837 // -----------------------------------------------------------------------------
       
   838 // Handles window server events.
       
   839 // -----------------------------------------------------------------------------
       
   840 //
       
   841 void CAknTouchPane::HandleWsEventL( const TWsEvent& aEvent,
       
   842     CCoeControl* /*aDestination*/ )
       
   843     {
       
   844 #ifdef RD_SCALABLE_UI_V2
       
   845     TInt eventType = aEvent.Type();
       
   846     if ( eventType == EEventFocusLost )
       
   847         {
       
   848         iFlags.Clear( EHasForeground );
       
   849         DoRefresh();
       
   850         }
       
   851     else if ( eventType == EEventFocusGained )
       
   852         {
       
   853         iFlags.Set( EHasForeground );
       
   854         DoRefresh();
       
   855         }
       
   856 #else
       
   857     (void) aEvent;
       
   858 #endif // RD_SCALABLE_UI_V2
       
   859     }
       
   860 
       
   861 // -----------------------------------------------------------------------------
       
   862 // CAknTouchPane::HandlePointerEventL
       
   863 // When application is displaying menu or dialog, this method ignores pointer
       
   864 // events on other than application shell, application swapper, and idle view
       
   865 // icons.
       
   866 // -----------------------------------------------------------------------------
       
   867 //
       
   868 #ifdef RD_SCALABLE_UI_V2
       
   869 EXPORT_C void CAknTouchPane::HandlePointerEventL(
       
   870     const TPointerEvent& aPointerEvent )
       
   871     {
       
   872     TPoint position = aPointerEvent.iPosition;
       
   873     TBool isDisplayingMenu = EFalse;
       
   874     CEikMenuBar* menuBar = NULL;
       
   875 
       
   876     TVwsViewId viewId;
       
   877     TInt err = iAppUi->GetActiveViewId( viewId );
       
   878     if ( err == KErrNone && viewId.iAppUid != viewId.iViewUid )
       
   879         {
       
   880         // Application has active view
       
   881         CAknView* view = iAvkonViewAppUi->View( viewId.iViewUid );
       
   882         if ( view )
       
   883             {
       
   884             //menuBar = view->MenuBar();
       
   885             menuBar = view->CAknView::MenuBar();
       
   886             }
       
   887         }
       
   888     else
       
   889         {
       
   890         menuBar = iEikonEnv->AppUiFactory()->MenuBar();
       
   891         }
       
   892 
       
   893     if ( menuBar )
       
   894         {
       
   895         isDisplayingMenu = menuBar->IsDisplayed();
       
   896         }
       
   897 
       
   898     // Close menu on button up event
       
   899     if ( isDisplayingMenu && Rect().Contains( position ) && 
       
   900          aPointerEvent.iType == TPointerEvent::EButton1Up )
       
   901         {
       
   902         menuBar->StopDisplayingMenuBar(); //lint !e613
       
   903         }
       
   904 
       
   905     if ( !isDisplayingMenu ||
       
   906          ( iShellIcon && iShellIcon->Rect().Contains( position ) ) ||
       
   907          ( iSwapperIcon && iSwapperIcon->Rect().Contains( position ) ) ||
       
   908          ( iIdleViewIcon && iIdleViewIcon->Rect().Contains( position ) ) )
       
   909         {
       
   910         CCoeControl::HandlePointerEventL( aPointerEvent );
       
   911         }
       
   912     }
       
   913 #else
       
   914 EXPORT_C void CAknTouchPane::HandlePointerEventL( const TPointerEvent& )
       
   915     {
       
   916     }
       
   917 #endif // RD_SCALABLE_UI_V2
       
   918 
       
   919 // -----------------------------------------------------------------------------
       
   920 // CAknTouchPane::PositionChanged
       
   921 // -----------------------------------------------------------------------------
       
   922 //
       
   923 EXPORT_C void CAknTouchPane::PositionChanged()
       
   924     {
       
   925 #ifdef RD_SCALABLE_UI_V2
       
   926     RegisterControlPositions();
       
   927 #endif // RD_SCALABLE_UI_V2
       
   928     }
       
   929 
       
   930 // -----------------------------------------------------------------------------
       
   931 // CAknTouchPane::SizeChanged
       
   932 // -----------------------------------------------------------------------------
       
   933 //
       
   934 EXPORT_C void CAknTouchPane::SizeChanged()
       
   935     {
       
   936 #ifdef RD_SCALABLE_UI_V2
       
   937     // Update frame and background control contexts
       
   938     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
   939         {
       
   940         iFrameContext->SetFrame( KAknsIIDQgnGrafBgTouchVertical );
       
   941         }
       
   942     else
       
   943         {
       
   944         iFrameContext->SetFrame( KAknsIIDQgnGrafBgTouchHorizontal );
       
   945         }
       
   946     iFrameContext->SetFrameRects( Rect(), TRect() );
       
   947     iFrameContext->SetParentPos( Position() );
       
   948 
       
   949     iBgContext->SetParentPos( iAvkonAppUi->ApplicationRect().iTl );
       
   950     iBgContext->SetRect( iAvkonAppUi->ApplicationRect() );
       
   951 
       
   952     TInt gridVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
       
   953 
       
   954     TInt cellVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
       
   955     if ( Components().Count() < 4 )
       
   956         {
       
   957         if ( Components().Count() == 3 )
       
   958             {
       
   959             cellVariety += 2;
       
   960             }
       
   961         else
       
   962             {
       
   963             cellVariety += 4;
       
   964             }
       
   965         }
       
   966 
       
   967     TRect gridRect = RectFromLayout( Rect(),
       
   968         AknLayoutScalable_Avkon::grid_touch_3_pane( gridVariety ) );
       
   969 
       
   970     TAknLayoutScalableParameterLimits limits =
       
   971         AknLayoutScalable_Avkon::cell_touch_3_pane_ParamLimits( cellVariety );
       
   972 
       
   973     const TInt gridSize = ( ( limits.LastRow() - limits.FirstRow() ) + 1 ) *
       
   974         ( ( limits.LastColumn() - limits.FirstColumn() ) + 1 );
       
   975 
       
   976     const TInt maxItemCount = Min( gridSize, Components().Count() );
       
   977 
       
   978     TInt row = 0;
       
   979     TInt col = 0;
       
   980     TInt index = 0;
       
   981     TRect cellRect;
       
   982     for ( row = limits.FirstRow(); row <= limits.LastRow(); ++row )
       
   983         {
       
   984         for ( col = limits.FirstColumn(); col <= limits.LastColumn(); ++col )
       
   985             {
       
   986             if ( index < maxItemCount )
       
   987                 {
       
   988                 cellRect = RectFromLayout( gridRect, AknLayoutScalable_Avkon::
       
   989                     cell_touch_3_pane( cellVariety, col, row ) );
       
   990                 Components().At( index ).iControl->SetRect( cellRect );
       
   991                 ++index;
       
   992                 }
       
   993             }
       
   994         }
       
   995 
       
   996     // Set empty rect for controls that should not be visible (no layout data)
       
   997     TInt count = CountComponentControls();
       
   998     for ( TInt ii = maxItemCount; ii < count; ++ii )
       
   999         {
       
  1000         Components().At( ii ).iControl->SetRect( TRect() );
       
  1001         }
       
  1002 
       
  1003     // Set the tooltip positions. Code assumes that touch pane is always
       
  1004     // horizontal in portrait mode and vertical in landscape mode.
       
  1005     CAknButton::TTooltipPosition tooltipPosition;
       
  1006     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1007         {
       
  1008         if ( Position().iX > iAppUi->ClientRect().Center().iX )
       
  1009             {
       
  1010             tooltipPosition = CAknButton::EPositionLeft;
       
  1011             }
       
  1012         else
       
  1013             {
       
  1014             tooltipPosition = CAknButton::EPositionRight;
       
  1015             }
       
  1016         }
       
  1017     else
       
  1018         {
       
  1019         if ( Position().iY > iAppUi->ClientRect().Center().iY )
       
  1020             {
       
  1021             tooltipPosition = CAknButton::EPositionTop;
       
  1022             }
       
  1023         else
       
  1024             {
       
  1025             tooltipPosition = CAknButton::EPositionBottom;
       
  1026             }
       
  1027         }
       
  1028 
       
  1029     for ( TInt ii = 0; ii < maxItemCount; ++ii )
       
  1030         {
       
  1031         // This assumes that every control in touch pane is button
       
  1032         CAknButton* button =  
       
  1033             static_cast<CAknButton*>( Components().At( ii ).iControl );
       
  1034         button->SetTooltipPosition( tooltipPosition );
       
  1035         
       
  1036         // recalculate icon size
       
  1037         TRect sizeRect = RectFromLayout( cellRect, 
       
  1038             AknLayoutScalable_Avkon::cell_touch_3_pane_g2() );
       
  1039         button->SetIconSize( sizeRect.Size() );
       
  1040         
       
  1041         // recalculate margins
       
  1042         TRect graphicsRect = RectFromLayout( cellRect, 
       
  1043             AknLayoutScalable_Avkon::cell_touch_3_pane_g1() );
       
  1044         graphicsRect.BoundingRect( sizeRect );
       
  1045         
       
  1046         TMargins8 margins;
       
  1047         margins.iTop = sizeRect.iTl.iY - graphicsRect.iTl.iY;
       
  1048         margins.iBottom = graphicsRect.iBr.iY - sizeRect.iBr.iY;
       
  1049         margins.iLeft = sizeRect.iTl.iX - graphicsRect.iTl.iX;
       
  1050         margins.iRight = graphicsRect.iBr.iX - sizeRect.iBr.iX;
       
  1051         
       
  1052         button->SetMargins( margins );
       
  1053         }
       
  1054 
       
  1055     RegisterControlPositions();
       
  1056     ReportSizeChange();
       
  1057 #endif // RD_SCALABLE_UI_V2
       
  1058     }
       
  1059 
       
  1060 // -----------------------------------------------------------------------------
       
  1061 // CAknTouchPane::ActivateApplicationShellL
       
  1062 // -----------------------------------------------------------------------------
       
  1063 //
       
  1064 #ifdef RD_SCALABLE_UI_V2
       
  1065 void CAknTouchPane::ActivateApplicationShellL()
       
  1066     {
       
  1067     TVwsViewId shellView = KAknApplicationShellViewId;
       
  1068     iAppUi->CreateActivateViewEventL( shellView, TUid::Uid(1), KNullDesC8() );
       
  1069     }
       
  1070 #endif // RD_SCALABLE_UI_V2
       
  1071 
       
  1072 // -----------------------------------------------------------------------------
       
  1073 // CAknTouchPane::ActivateFastSwapL
       
  1074 // -----------------------------------------------------------------------------
       
  1075 //
       
  1076 #ifdef RD_SCALABLE_UI_V2
       
  1077 void CAknTouchPane::ActivateFastSwapL() const
       
  1078     {
       
  1079     RAknUiServer* uiServer = CAknSgcClient::AknSrv();
       
  1080     uiServer->MakeTaskListVisible( ETrue );
       
  1081     }
       
  1082 #endif // RD_SCALABLE_UI_V2
       
  1083 
       
  1084 // -----------------------------------------------------------------------------
       
  1085 // CAknTouchPane::ActivateIdleViewL
       
  1086 // -----------------------------------------------------------------------------
       
  1087 //
       
  1088 #ifdef RD_SCALABLE_UI_V2
       
  1089 void CAknTouchPane::ActivateIdleViewL() const
       
  1090     {
       
  1091     TVwsViewId idleView;
       
  1092     RAknUiServer* uiServer = CAknSgcClient::AknSrv();
       
  1093     TInt error = uiServer->GetPhoneIdleViewId( idleView );
       
  1094     if ( !error && iUid != idleView.iAppUid )
       
  1095         {
       
  1096         iAppUi->CreateActivateViewEventL( idleView, KNullUid, KNullDesC8() );
       
  1097         }
       
  1098     }
       
  1099 #endif // RD_SCALABLE_UI_V2
       
  1100 
       
  1101 // -----------------------------------------------------------------------------
       
  1102 // CAknTouchPane::RotateScreenL
       
  1103 // -----------------------------------------------------------------------------
       
  1104 //
       
  1105 #ifdef RD_SCALABLE_UI_V2
       
  1106 void CAknTouchPane::RotateScreenL() const
       
  1107     {
       
  1108     RAknUiServer* uiServer = CAknSgcClient::AknSrv();
       
  1109     User::LeaveIfError( uiServer->RotateScreen() );
       
  1110     }
       
  1111 #endif // RD_SCALABLE_UI_V2
       
  1112 
       
  1113 // -----------------------------------------------------------------------------
       
  1114 // CAknTouchPane::ActivateStylusInputL
       
  1115 // -----------------------------------------------------------------------------
       
  1116 //
       
  1117 #ifdef RD_SCALABLE_UI_V2
       
  1118 void CAknTouchPane::ActivateStylusInputL( TBool aActivate ) const
       
  1119     {
       
  1120     if( iFepPenSupportInterface != NULL)
       
  1121         {
       
  1122         if ( aActivate )
       
  1123             {
       
  1124             iFepPenSupportInterface->ActivatePenInputL();
       
  1125             }
       
  1126         else
       
  1127             {
       
  1128             iFepPenSupportInterface->DeactivatePenInputL();
       
  1129             }
       
  1130         }
       
  1131     }
       
  1132 #endif // RD_SCALABLE_UI_V2
       
  1133 
       
  1134 // -----------------------------------------------------------------------------
       
  1135 // CAknTouchPane::ActivateToolbarL
       
  1136 // -----------------------------------------------------------------------------
       
  1137 //
       
  1138 #ifdef RD_SCALABLE_UI_V2
       
  1139 void CAknTouchPane::ActivateToolbarL( TBool aActivate ) const
       
  1140     {
       
  1141     CAknToolbar* toolbar = iAppUi->CurrentPopupToolbar();
       
  1142     if ( toolbar )
       
  1143         {
       
  1144         // Toolbar transition effects integration.
       
  1145         // This code just does the registration part, and sets the demarcation
       
  1146         // rect, as that comes from the icon in the touchpane, which is only
       
  1147         // available here.  For toolbar animations where the touchpane aren't
       
  1148         // involved, registering etc. is done in AknToolbar.cpp.
       
  1149         TRect iconRect( iToolbarIcon->Position(),
       
  1150                         iToolbarIcon->Position() + iToolbarIcon->Size() );
       
  1151 
       
  1152         if ( CTouchToolbarData::SetData( toolbar, iconRect, ETrue ) ==
       
  1153              KErrNone )
       
  1154             {
       
  1155             GfxTransEffect::Register( toolbar, KGfxTouchToolbarControlUid,
       
  1156                                       EFalse );
       
  1157             GfxTransEffect::Enable();
       
  1158             CTouchToolbarData* ttb = CTouchToolbarData::GetData( toolbar );
       
  1159             if( ttb )
       
  1160                 {
       
  1161                 ttb->SetBetweenRegisterAndBegin( ETrue );    
       
  1162                 }
       
  1163             
       
  1164             }
       
  1165         toolbar->SetToolbarVisibility( aActivate, EFalse );
       
  1166         }
       
  1167     }
       
  1168 #endif // RD_SCALABLE_UI_V2
       
  1169 
       
  1170 // -----------------------------------------------------------------------------
       
  1171 // CAknTouchPane::ActivateHelpL
       
  1172 // -----------------------------------------------------------------------------
       
  1173 //
       
  1174 #ifdef RD_SCALABLE_UI_V2
       
  1175 void CAknTouchPane::ActivateHelpL( TBool aActivate )
       
  1176     {
       
  1177     if ( aActivate )
       
  1178         {
       
  1179         CArrayFix<TCoeHelpContext>* help = iAppUi->AppHelpContextL();
       
  1180         if ( help )
       
  1181             {
       
  1182             CleanupStack::PushL( help );
       
  1183             HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), help );
       
  1184             CleanupStack::Pop( help );
       
  1185             }
       
  1186         }
       
  1187     else
       
  1188         {
       
  1189         iAppUi->HandleCommandL( EEikCmdExit );
       
  1190         }
       
  1191     }
       
  1192 #endif // RD_SCALABLE_UI_V2
       
  1193 
       
  1194 // -----------------------------------------------------------------------------
       
  1195 // CAknTouchPane::ActivateDiallerL
       
  1196 // -----------------------------------------------------------------------------
       
  1197 //
       
  1198 #ifdef RD_SCALABLE_UI_V2
       
  1199 void CAknTouchPane::ActivateDiallerL( TBool aActivate )
       
  1200     {
       
  1201     if ( aActivate )
       
  1202         {
       
  1203         TVwsViewId diallerView( KAknTouchPaneDiallerAppUid,
       
  1204             KAknTouchPaneDiallerViewUid );
       
  1205         iAppUi->CreateActivateViewEventL( diallerView,
       
  1206             KTouchPaneDiallerVievCommand, KNullDesC8() );
       
  1207         }
       
  1208     else
       
  1209         {
       
  1210         iAppUi->HandleCommandL( EAknCmdExit );
       
  1211         }
       
  1212     }
       
  1213 #endif // RD_SCALABLE_UI_V2
       
  1214 
       
  1215 // -----------------------------------------------------------------------------
       
  1216 // CAknTouchPane::ActivateContactsL
       
  1217 // -----------------------------------------------------------------------------
       
  1218 //
       
  1219 #ifdef RD_SCALABLE_UI_V2
       
  1220 void CAknTouchPane::ActivateContactsL( TBool aActivate )
       
  1221     {
       
  1222     if ( aActivate )
       
  1223         {
       
  1224         TVwsViewId contactsView( KAknTouchPaneContactsAppUid,
       
  1225             KAknTouchPaneContactsViewUid );
       
  1226         iAppUi->CreateActivateViewEventL( contactsView, TUid::Null(),
       
  1227             KNullDesC8() );
       
  1228         }
       
  1229     else
       
  1230         {
       
  1231         iAppUi->HandleCommandL( EAknCmdExit );
       
  1232         }
       
  1233     }
       
  1234 #endif // RD_SCALABLE_UI_V2
       
  1235 
       
  1236 // -----------------------------------------------------------------------------
       
  1237 // CAknTouchPane::ConstructDefaultComponentL
       
  1238 // -----------------------------------------------------------------------------
       
  1239 //
       
  1240 #ifdef RD_SCALABLE_UI_V2
       
  1241 CAknButton* CAknTouchPane::ConstructDefaultComponentL( TInt aId )
       
  1242     {
       
  1243     CAknButton* element = NULL;
       
  1244     HBufC* tooltip = NULL;
       
  1245     HBufC* helpText = NULL;
       
  1246 
       
  1247     switch ( aId )
       
  1248         {
       
  1249         case ETouchPaneElementNone:
       
  1250             {
       
  1251             // Creates an empty button
       
  1252             element = CAknButton::NewLC();
       
  1253             element->AddStateL( NULL, NULL, NULL, NULL, KNullDesC(),
       
  1254                                 KNullDesC(), NULL );
       
  1255             element->SetDimmed( ETrue );
       
  1256             break;
       
  1257             }
       
  1258         case ETouchPaneElementAppsGrid:
       
  1259             {
       
  1260             if ( !iShellIcon )
       
  1261                 {
       
  1262                 tooltip = StringLoader::LoadLC( R_QTN_GEN_APP_SHELL_TOOLTIP );
       
  1263                 element = CAknButton::NewLC(
       
  1264                     AknIconUtils::AvkonIconFileName(),
       
  1265                     EMbmAvkonQgn_indi_tp_appsgrid,
       
  1266 	                EMbmAvkonQgn_indi_tp_appsgrid_mask,
       
  1267                     -1, -1, -1, -1, -1, -1,
       
  1268                     KNullDesC, *tooltip, KAknButtonReportOnLongPress, NULL,
       
  1269                     KAknsIIDQgnIndiTpAppsgrid );
       
  1270                 iShellIcon = element;
       
  1271                 CleanupStack::Pop( element );
       
  1272                 CleanupStack::Pop( tooltip );
       
  1273                 CleanupStack::PushL( element ); // will not leave
       
  1274                 iFlags.Set( EShellIconActive );
       
  1275                 }
       
  1276             break;
       
  1277             }
       
  1278         case ETouchPaneElementAppSwapper:
       
  1279             {
       
  1280             if ( !iSwapperIcon )
       
  1281                 {
       
  1282                 tooltip = StringLoader::LoadLC( R_QTN_GEN_FAST_SWAPPER_TOOLTIP );
       
  1283                 element = CAknButton::NewLC(
       
  1284                     AknIconUtils::AvkonIconFileName(),
       
  1285                     EMbmAvkonQgn_indi_tp_appswapper,
       
  1286                     EMbmAvkonQgn_indi_tp_appswapper_mask,
       
  1287                     -1, -1, -1, -1, -1, -1,
       
  1288                     KNullDesC, *tooltip, KAknButtonReportOnLongPress, NULL,
       
  1289                     KAknsIIDQgnIndiTpAppswapper );
       
  1290                 iSwapperIcon = element;
       
  1291                 CleanupStack::Pop( element );
       
  1292                 CleanupStack::Pop( tooltip );
       
  1293                 CleanupStack::PushL( element ); // will not leave
       
  1294                 iFlags.Set( ESwapperIconActive );
       
  1295                 }
       
  1296             break;
       
  1297             }
       
  1298         case ETouchPaneElementIdle:
       
  1299             {
       
  1300             if ( !iIdleViewIcon )
       
  1301                 {
       
  1302                 tooltip = StringLoader::LoadLC( R_QTN_GEN_IDLE_VIEW_TOOLTIP );
       
  1303                 element = CAknButton::NewLC(
       
  1304                     AknIconUtils::AvkonIconFileName(),
       
  1305                     EMbmAvkonQgn_indi_tp_idle,
       
  1306                     EMbmAvkonQgn_indi_tp_idle_mask,
       
  1307                     -1, -1, -1, -1, -1, -1,
       
  1308                     KNullDesC, *tooltip, NULL, NULL,
       
  1309                     KAknsIIDQgnIndiTpIdle );
       
  1310                 iIdleViewIcon = element;
       
  1311                 CleanupStack::Pop( element );
       
  1312                 CleanupStack::Pop( tooltip );
       
  1313                 CleanupStack::PushL( element ); // will not leave
       
  1314                 iFlags.Set( EIdleViewIconActive );
       
  1315                 }
       
  1316             break;
       
  1317             }
       
  1318         case ETouchPaneElementInput:
       
  1319             {
       
  1320             if ( !iInputMethodIcon )
       
  1321                 {
       
  1322                 tooltip = StringLoader::LoadLC( 
       
  1323                     R_QTN_GEN_INPUT_ACTIVATION_TOOLTIP );
       
  1324                 helpText = StringLoader::LoadLC( 
       
  1325                     R_QTN_GEN_INFO_POP_UP_DIMMED_ITEM, *tooltip );
       
  1326                 element = CAknButton::NewLC(
       
  1327                     AknIconUtils::AvkonIconFileName(),
       
  1328                     EMbmAvkonQgn_indi_tp_input,
       
  1329                     EMbmAvkonQgn_indi_tp_input_mask,
       
  1330                     -1, -1, -1, -1, -1, -1,
       
  1331                     KNullDesC, *tooltip, NULL, NULL,
       
  1332                     KAknsIIDQgnIndiTpInput );
       
  1333                 element->AddStateL(
       
  1334                     AknIconUtils::AvkonIconFileName(),
       
  1335                     EMbmAvkonQgn_indi_tp_input,
       
  1336                     EMbmAvkonQgn_indi_tp_input_mask,
       
  1337                     -1, -1, -1, -1, -1, -1,
       
  1338                     KNullDesC, *tooltip, KAknButtonStateHasLatchedFrame,
       
  1339                     KAknsIIDQgnIndiTpInput, KAknsIIDNone,
       
  1340                     KAknsIIDNone, KAknsIIDNone );
       
  1341                 element->SetDimmed( ETrue );
       
  1342                 element->SetDimmedHelpTextL( *helpText );
       
  1343                 iInputMethodIcon = element;
       
  1344                 CleanupStack::Pop( element );
       
  1345                 CleanupStack::Pop( helpText );
       
  1346                 CleanupStack::Pop( tooltip );
       
  1347                 CleanupStack::PushL( element ); // will not leave
       
  1348                 iFlags.Clear( EInputMethodIconActive );
       
  1349                 }
       
  1350             break;
       
  1351             }
       
  1352         case ETouchPaneElementRotateScreen:
       
  1353             {
       
  1354             if ( !iRotateIcon )
       
  1355                 {
       
  1356                 tooltip = StringLoader::LoadLC( 
       
  1357                     R_QTN_GEN_ROTATE_ICON_TOOLTIP );
       
  1358                 element = CAknButton::NewLC(
       
  1359                     AknIconUtils::AvkonIconFileName(),
       
  1360                     EMbmAvkonQgn_indi_tp_rotate_screen,
       
  1361                     EMbmAvkonQgn_indi_tp_rotate_screen_mask,
       
  1362                     -1, -1, -1, -1, -1, -1,
       
  1363                     KNullDesC, *tooltip, NULL, NULL,
       
  1364                     KAknsIIDQgnIndiTpRotateScreen );
       
  1365                 iRotateIcon = element;
       
  1366                 CleanupStack::Pop( element );
       
  1367                 CleanupStack::Pop( tooltip );
       
  1368                 CleanupStack::PushL( element ); // will not leave
       
  1369                 iFlags.Set( ERotateIconActive );
       
  1370                 }
       
  1371             break;
       
  1372             }
       
  1373         case ETouchPaneElementToolbar:
       
  1374             {
       
  1375             if ( !iToolbarIcon )
       
  1376                 {
       
  1377                 tooltip = StringLoader::LoadLC( 
       
  1378                     R_QTN_GEN_TOOLBAR_ICON_TOOLTIP );
       
  1379                 helpText = StringLoader::LoadLC( 
       
  1380                     R_QTN_GEN_INFO_POP_UP_DIMMED_ITEM, *tooltip );
       
  1381                 element = CAknButton::NewLC(
       
  1382                     AknIconUtils::AvkonIconFileName(),
       
  1383                     EMbmAvkonQgn_indi_tp_toolbar,
       
  1384                     EMbmAvkonQgn_indi_tp_toolbar_mask,
       
  1385                     -1, -1, -1, -1, -1, -1,
       
  1386                     KNullDesC, *tooltip, NULL, NULL,
       
  1387                     KAknsIIDQgnIndiTpToolbar );
       
  1388                 element->AddStateL(
       
  1389                     AknIconUtils::AvkonIconFileName(),
       
  1390                     EMbmAvkonQgn_indi_tp_toolbar,
       
  1391                     EMbmAvkonQgn_indi_tp_toolbar_mask,
       
  1392                     -1, -1, -1, -1, -1, -1,
       
  1393                     KNullDesC, *tooltip, KAknButtonStateHasLatchedFrame,
       
  1394                     KAknsIIDQgnIndiTpToolbar, KAknsIIDNone,
       
  1395                     KAknsIIDNone, KAknsIIDNone );
       
  1396                 element->SetDimmed( ETrue );
       
  1397                 element->SetDimmedHelpTextL( *helpText );
       
  1398                 iToolbarIcon = element;
       
  1399                 CleanupStack::Pop( element );
       
  1400                 CleanupStack::Pop( helpText );
       
  1401                 CleanupStack::Pop( tooltip );
       
  1402                 CleanupStack::PushL( element ); // will not leave
       
  1403                 iFlags.Clear( EToolbarIconActive );
       
  1404                 }
       
  1405             break;
       
  1406             }
       
  1407         case ETouchPaneElementHelp:
       
  1408             {
       
  1409             if ( !iHelpIcon )
       
  1410                 {
       
  1411                 TInt stateFlags = ( iUid == KAknTouchPaneHelpAppUid ) ?
       
  1412                     KAknButtonStateHasLatchedFrame : NULL;
       
  1413                 tooltip = StringLoader::LoadLC( R_QTN_GEN_HELP_TOOLTIP );
       
  1414                 helpText = StringLoader::LoadLC( 
       
  1415                     R_QTN_GEN_INFO_POP_UP_DIMMED_ITEM, *tooltip );
       
  1416                 element = CAknButton::NewLC(
       
  1417                     AknIconUtils::AvkonIconFileName(),
       
  1418                     EMbmAvkonQgn_indi_tp_help,
       
  1419                     EMbmAvkonQgn_indi_tp_help_mask,
       
  1420                     -1, -1, -1, -1, -1, -1,
       
  1421                     KNullDesC, *tooltip, NULL, stateFlags,
       
  1422                     KAknsIIDQgnIndiTpHelp );
       
  1423                 element->SetDimmedHelpTextL( *helpText );
       
  1424                 iHelpIcon = element;
       
  1425                 CleanupStack::Pop( element );
       
  1426                 CleanupStack::Pop( helpText );
       
  1427                 CleanupStack::Pop( tooltip );
       
  1428                 CleanupStack::PushL( element ); // will not leave
       
  1429                 iFlags.Set( EHelpIconActive );
       
  1430                 }
       
  1431             break;
       
  1432             }
       
  1433         case ETouchPaneElementDialler:
       
  1434             {
       
  1435             if ( !iDiallerIcon )
       
  1436                 {
       
  1437                 tooltip = StringLoader::LoadLC( 
       
  1438                     R_QTN_GEN_DIALLER_ICON_TOOLTIP );
       
  1439                 element = CAknButton::NewLC( 
       
  1440                     AknIconUtils::AvkonIconFileName(),
       
  1441                     EMbmAvkonQgn_indi_tp_dialler,
       
  1442                     EMbmAvkonQgn_indi_tp_dialler_mask,
       
  1443                     -1, -1, -1, -1, -1, -1,
       
  1444                     KNullDesC, *tooltip, NULL, NULL,
       
  1445                     KAknsIIDQgnIndiTpDialler );
       
  1446                 element->AddStateL(
       
  1447                     AknIconUtils::AvkonIconFileName(),
       
  1448                     EMbmAvkonQgn_indi_tp_dialler,
       
  1449                     EMbmAvkonQgn_indi_tp_dialler_mask,
       
  1450                     -1, -1, -1, -1, -1, -1,
       
  1451                     KNullDesC, *tooltip, KAknButtonStateHasLatchedFrame,
       
  1452                     KAknsIIDQgnIndiTpDialler, KAknsIIDNone,
       
  1453                     KAknsIIDNone, KAknsIIDNone );
       
  1454                 iDiallerIcon = element;
       
  1455                 CleanupStack::Pop( element );
       
  1456                 CleanupStack::Pop( tooltip );
       
  1457                 CleanupStack::PushL( element ); // will not leave
       
  1458                 iFlags.Set( EDiallerIconActive );
       
  1459                 }
       
  1460             break;
       
  1461             }
       
  1462         case ETouchPaneElementContacts:
       
  1463             {
       
  1464             if ( !iContactsIcon )
       
  1465                 {
       
  1466                 _LIT( KContactsTooltip, "Contacts" );
       
  1467                 tooltip = KContactsTooltip().AllocLC();
       
  1468                 element = CAknButton::NewLC(
       
  1469                     AknIconUtils::AvkonIconFileName(),
       
  1470                     EMbmAvkonQgn_indi_tp_contacts,
       
  1471                     EMbmAvkonQgn_indi_tp_contacts_mask,
       
  1472                     -1, -1, -1, -1, -1, -1,
       
  1473                     KNullDesC, *tooltip, NULL, NULL,
       
  1474                     KAknsIIDQgnIndiTpContacts );
       
  1475                 iContactsIcon = element;
       
  1476                 element->AddStateL(
       
  1477                     AknIconUtils::AvkonIconFileName(),
       
  1478                     EMbmAvkonQgn_indi_tp_contacts,
       
  1479                     EMbmAvkonQgn_indi_tp_contacts_mask,
       
  1480                     -1, -1, -1, -1, -1, -1,
       
  1481                     KNullDesC, *tooltip, KAknButtonStateHasLatchedFrame,
       
  1482                     KAknsIIDQgnIndiTpContacts, KAknsIIDNone,
       
  1483                     KAknsIIDNone, KAknsIIDNone );
       
  1484                 CleanupStack::Pop( element );
       
  1485                 CleanupStack::Pop( tooltip );
       
  1486                 CleanupStack::PushL( element ); // will not leave
       
  1487                 iFlags.Set( EContactsIconActive );
       
  1488                 }
       
  1489             break;
       
  1490             }
       
  1491         default:
       
  1492             {
       
  1493             User::Leave( KErrNotSupported );
       
  1494             }
       
  1495         }
       
  1496  
       
  1497     delete tooltip; tooltip = NULL;
       
  1498     delete helpText; helpText = NULL;
       
  1499  
       
  1500     if ( element )
       
  1501         {
       
  1502         // Set background for the element.
       
  1503         if ( aId != ETouchPaneElementNone )
       
  1504             {
       
  1505             element->SetBackgroundIds( KAknsIIDQsnFrButtonTpNormal,
       
  1506                 KAknsIIDQsnFrButtonTpPressed, KAknsIIDQsnFrButtonTpInactive,
       
  1507                 KAknsIIDQsnFrButtonTpPressed, KAknsIIDQsnFrButtonTpInactive );
       
  1508             }
       
  1509         else
       
  1510             {
       
  1511             element->SetBackgroundIds( KAknsIIDNone, KAknsIIDNone,
       
  1512                 KAknsIIDNone, KAknsIIDNone, KAknsIIDNone );
       
  1513             }
       
  1514 
       
  1515         SetDefaultPropertiesL( element );
       
  1516         CleanupStack::Pop( element );
       
  1517         }
       
  1518     return element;
       
  1519     }
       
  1520 #endif // RD_SCALABLE_UI_V2
       
  1521 
       
  1522 // -----------------------------------------------------------------------------
       
  1523 // CAknTouchPane::ReportSizeChange
       
  1524 // -----------------------------------------------------------------------------
       
  1525 //
       
  1526 #ifdef RD_SCALABLE_UI_V2
       
  1527 void CAknTouchPane::ReportSizeChange() const
       
  1528     {
       
  1529     if ( iObserver )
       
  1530         {
       
  1531         iObserver->HandleTouchPaneSizeChange();
       
  1532         }
       
  1533     }
       
  1534 #endif // RD_SCALABLE_UI_V2
       
  1535 
       
  1536 // -----------------------------------------------------------------------------
       
  1537 // CAknTouchPane::SetDefaultProperties
       
  1538 // -----------------------------------------------------------------------------
       
  1539 //
       
  1540 #ifdef RD_SCALABLE_UI_V2
       
  1541 void CAknTouchPane::SetDefaultPropertiesL( CCoeControl* aControl )
       
  1542     {
       
  1543     aControl->SetContainerWindowL( *this );
       
  1544     aControl->SetObserver( this );
       
  1545     aControl->SetFocusing( EFalse );
       
  1546     aControl->SetBackground( this );
       
  1547     }
       
  1548 #endif // RD_SCALABLE_UI_V2
       
  1549 
       
  1550 // -----------------------------------------------------------------------------
       
  1551 // CAknTouchPane::SetWindowLayout
       
  1552 // -----------------------------------------------------------------------------
       
  1553 //
       
  1554 #ifdef RD_SCALABLE_UI_V2
       
  1555 void CAknTouchPane::SetWindowLayout()
       
  1556     {
       
  1557     const TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
       
  1558     TRect touchPaneRect = RectFromLayout( iAppUi->ApplicationRect(),
       
  1559         AknLayoutScalable_Avkon::touch_pane( variety ) );
       
  1560     SetRect( touchPaneRect );
       
  1561     Window().Invalidate();
       
  1562     }
       
  1563 #endif // RD_SCALABLE_UI_V2
       
  1564 
       
  1565 // -----------------------------------------------------------------------------
       
  1566 // CAknTouchPane::RegisterControlPositions
       
  1567 // -----------------------------------------------------------------------------
       
  1568 //
       
  1569 #ifdef RD_SCALABLE_UI_V2
       
  1570 void CAknTouchPane::RegisterControlPositions() const
       
  1571     {
       
  1572     TInt count = CountComponentControls();
       
  1573     CCoeControl* control = NULL;
       
  1574     AknsUtils::RegisterControlPosition( this, Position() );
       
  1575     for ( TInt ii = 0; ii < count; ++ii )
       
  1576         {
       
  1577         control = ComponentControl( ii );
       
  1578         AknsUtils::RegisterControlPosition( control,
       
  1579             Position() + control->Position() );
       
  1580         }
       
  1581     }
       
  1582 #endif // RD_SCALABLE_UI_V2
       
  1583 
       
  1584 // -----------------------------------------------------------------------------
       
  1585 // CAknTouchPane::DeregisterControlPositions
       
  1586 // -----------------------------------------------------------------------------
       
  1587 //
       
  1588 #ifdef RD_SCALABLE_UI_V2
       
  1589 void CAknTouchPane::DeregisterControlPositions() const
       
  1590     {
       
  1591     TInt count = CountComponentControls();
       
  1592     CCoeControl* control = NULL;
       
  1593     AknsUtils::DeregisterControlPosition( this );
       
  1594     for ( TInt ii = 0; ii < count; ++ii )
       
  1595         {
       
  1596         control = ComponentControl( ii );
       
  1597         AknsUtils::DeregisterControlPosition( control );
       
  1598         }
       
  1599     }
       
  1600 #endif // RD_SCALABLE_UI_V2
       
  1601 
       
  1602 // -----------------------------------------------------------------------------
       
  1603 // CAknTouchPane::DoRefresh
       
  1604 // -----------------------------------------------------------------------------
       
  1605 //
       
  1606 #ifdef RD_SCALABLE_UI_V2
       
  1607 void CAknTouchPane::DoRefresh()
       
  1608     {
       
  1609     if ( iDiallerIcon )
       
  1610         {
       
  1611         // Set dialler icon pressed only in dialler application.
       
  1612         TInt state = ( iUid == KAknTouchPaneDiallerAppUid ? 1 : 0 );
       
  1613         if ( state != iDiallerIcon->StateIndex() )
       
  1614             {
       
  1615             iDiallerIcon->SetCurrentState( state, EFalse );
       
  1616             Window().Invalidate( iDiallerIcon->Rect() );
       
  1617             }
       
  1618         }
       
  1619 
       
  1620     if ( iContactsIcon )
       
  1621         {
       
  1622         // Set Contacts icon pressed only in contacts application.
       
  1623         TInt state = ( iUid == KAknTouchPaneContactsAppUid ? 1 : 0 );
       
  1624         if ( state != iContactsIcon->StateIndex() )
       
  1625             {
       
  1626             iContactsIcon->SetCurrentState( state, EFalse );
       
  1627             Window().Invalidate( iContactsIcon->Rect() );
       
  1628             }
       
  1629         }
       
  1630 
       
  1631     // Update icon dimming depending on whether the touch pane is active.
       
  1632     const TBool active = iFlags.IsSet( ETouchPaneActive ) &&
       
  1633         iFlags.IsSet( EHasForeground );
       
  1634 
       
  1635     if ( iShellIcon && iShellIcon->IsDimmed() == ( active &&
       
  1636          iFlags.IsSet( EShellIconActive ) ) )
       
  1637         {
       
  1638         iShellIcon->SetDimmed( !iShellIcon->IsDimmed() );
       
  1639         Window().Invalidate( iShellIcon->Rect() );
       
  1640         }
       
  1641 
       
  1642     if ( iSwapperIcon && iSwapperIcon->IsDimmed() == ( active &&
       
  1643          iFlags.IsSet( ESwapperIconActive ) ) )
       
  1644         {
       
  1645         iSwapperIcon->SetDimmed( !iSwapperIcon->IsDimmed() );
       
  1646         Window().Invalidate( iSwapperIcon->Rect() );
       
  1647         }
       
  1648 
       
  1649     if ( iIdleViewIcon && iIdleViewIcon->IsDimmed() == ( active &&
       
  1650          iFlags.IsSet( EIdleViewIconActive ) ) )
       
  1651         {
       
  1652         iIdleViewIcon->SetDimmed( !iIdleViewIcon->IsDimmed() );
       
  1653         Window().Invalidate( iIdleViewIcon->Rect() );
       
  1654         }
       
  1655 
       
  1656     if ( iDiallerIcon && iDiallerIcon->IsDimmed() == ( active &&
       
  1657          iFlags.IsSet( EDiallerIconActive ) ) )
       
  1658         {
       
  1659         iDiallerIcon->SetDimmed( !iDiallerIcon->IsDimmed() );
       
  1660         Window().Invalidate( iDiallerIcon->Rect() );
       
  1661         }
       
  1662 
       
  1663     if ( iRotateIcon && iRotateIcon->IsDimmed() == ( active &&
       
  1664          iFlags.IsSet( ERotateIconActive ) ) )
       
  1665         {
       
  1666         iRotateIcon->SetDimmed( !iRotateIcon->IsDimmed() );
       
  1667         Window().Invalidate( iRotateIcon->Rect() );
       
  1668         }
       
  1669 
       
  1670     if ( iHelpIcon && iHelpIcon->IsDimmed() == ( active &&
       
  1671          iFlags.IsSet( EHelpIconActive ) ) )
       
  1672         {
       
  1673         iHelpIcon->SetDimmed( !iHelpIcon->IsDimmed() );
       
  1674         Window().Invalidate( iHelpIcon->Rect() );
       
  1675         }
       
  1676 
       
  1677     if ( iInputMethodIcon && iInputMethodIcon->IsDimmed() == ( active &&
       
  1678          iFlags.IsSet( EInputMethodIconActive ) ) )
       
  1679         {
       
  1680         iInputMethodIcon->SetDimmed( !iInputMethodIcon->IsDimmed() );
       
  1681         Window().Invalidate( iInputMethodIcon->Rect() );
       
  1682         }
       
  1683 
       
  1684     if ( iToolbarIcon && iToolbarIcon->IsDimmed() == ( active &&
       
  1685          iFlags.IsSet( EToolbarIconActive ) ) )
       
  1686         {
       
  1687         iToolbarIcon->SetDimmed( !iToolbarIcon->IsDimmed() );
       
  1688         Window().Invalidate( iToolbarIcon->Rect() );
       
  1689         }
       
  1690 
       
  1691     if ( iContactsIcon && iContactsIcon->IsDimmed() == ( active &&
       
  1692          iFlags.IsSet( EContactsIconActive ) ) )
       
  1693         {
       
  1694         iContactsIcon->SetDimmed( !iContactsIcon->IsDimmed() );
       
  1695         Window().Invalidate( iContactsIcon->Rect() );
       
  1696         }
       
  1697     }
       
  1698 #endif // RD_SCALABLE_UI_V2
       
  1699 
       
  1700 // -----------------------------------------------------------------------------
       
  1701 // CAknTouchPane::Draw
       
  1702 // -----------------------------------------------------------------------------
       
  1703 //
       
  1704 #ifdef RD_SCALABLE_UI_V2
       
  1705 void CAknTouchPane::Draw( const TRect& aRect ) const
       
  1706     {
       
  1707     CWindowGc& gc = SystemGc();
       
  1708     Draw( gc, *this, aRect );
       
  1709     }
       
  1710 #else
       
  1711 void CAknTouchPane::Draw( const TRect& ) const
       
  1712     {
       
  1713     }
       
  1714 #endif // RD_SCALABLE_UI_V2
       
  1715 
       
  1716 //  End of File