uifw/AvKon/src/aknsignal.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 72 a5e7a4f63858
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    80     CFbsBitmap* iCdmaSendIcons[KAknCdmaAnimationFrames];     // animation frames
    80     CFbsBitmap* iCdmaSendIcons[KAknCdmaAnimationFrames];     // animation frames
    81     CFbsBitmap* iCdmaSendMasks[KAknCdmaAnimationFrames];     // animation frame masks (needed because of AknIconUtils)
    81     CFbsBitmap* iCdmaSendMasks[KAknCdmaAnimationFrames];     // animation frame masks (needed because of AknIconUtils)
    82     CFbsBitmap* iCdmaStaticIcons[5];    // non-animated icons
    82     CFbsBitmap* iCdmaStaticIcons[5];    // non-animated icons
    83     CFbsBitmap* iCdmaStaticMasks[5];    // non-animated masks (needed because of AknIconUtils)
    83     CFbsBitmap* iCdmaStaticMasks[5];    // non-animated masks (needed because of AknIconUtils)
    84 
    84 
    85     TBool       iIsActiveIdle;
    85     CEikStatusPaneBase*      iStatusPane;
    86     };
    86     };
    87 
    87 
    88 
    88 
    89 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    90 // CAknSignalPaneExtension::CAknSignalPaneExtension
    90 // CAknSignalPaneExtension::CAknSignalPaneExtension
   287 #endif // __PROTOCOL_CDMA
   287 #endif // __PROTOCOL_CDMA
   288 
   288 
   289     // off by default
   289     // off by default
   290     iExtension->iCdmaSignalState    = EAknSignalCdmaIndicatorOff;
   290     iExtension->iCdmaSignalState    = EAknSignalCdmaIndicatorOff;
   291     iExtension->iCdmaAnimationIndex = 0;
   291     iExtension->iCdmaAnimationIndex = 0;
   292     iExtension->iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle();
   292 
       
   293 		iExtension->iStatusPane = CEikStatusPaneBase::Current();
   293 
   294 
   294     iSignalIconControl = CAknSignalIcon::NewL();
   295     iSignalIconControl = CAknSignalIcon::NewL();
   295     iSignalIconControl->SetDrawBlank( EFalse );
   296     iSignalIconControl->SetDrawBlank( EFalse );
   296 
   297 
   297     // Load default icon
   298     // Load default icon
   300     iSignalStrengthControl = CAknSignalStrength::NewL();
   301     iSignalStrengthControl = CAknSignalStrength::NewL();
   301 
   302 
   302     iSignalIconControl->SetContainerWindowL( *this );
   303     iSignalIconControl->SetContainerWindowL( *this );
   303     iSignalStrengthControl->SetContainerWindowL( *this );
   304     iSignalStrengthControl->SetContainerWindowL( *this );
   304 
   305 
   305     iTicker = CPeriodic::NewL( CActive::EPriorityLow );
       
   306 
       
   307     // Set flags to default values
   306     // Set flags to default values
   308     iPrivateFlags = 0;
   307     iPrivateFlags = 0;
   309 
   308 
   310     iDataObserver = new (ELeave) CAknSignalDataObserver( this );
   309     iDataObserver = new (ELeave) CAknSignalDataObserver( this );
   311     }
   310     }
   378 // Stops ongoing signal state animation.
   377 // Stops ongoing signal state animation.
   379 // ---------------------------------------------------------------------------
   378 // ---------------------------------------------------------------------------
   380 //
   379 //
   381 void CAknSignalPane::DisableAnimation()
   380 void CAknSignalPane::DisableAnimation()
   382     {
   381     {
   383     if ( iTicker && iTicker->IsActive() )
   382     StopTicker();
   384         {
       
   385         iTicker->Cancel();
       
   386         }
       
   387     }
   383     }
   388 
   384 
   389 
   385 
   390 // ---------------------------------------------------------------------------
   386 // ---------------------------------------------------------------------------
   391 // CAknSignalPane::ShowGprsIcon
   387 // CAknSignalPane::ShowGprsIcon
   401         TRAP_IGNORE( LoadSignalIconL( aGprsIconState,
   397         TRAP_IGNORE( LoadSignalIconL( aGprsIconState,
   402                                       iSignalIconControl->ColorIndex() ) );
   398                                       iSignalIconControl->ColorIndex() ) );
   403 
   399 
   404         iSignalIconControl->SetDrawBlank( EFalse );
   400         iSignalIconControl->SetDrawBlank( EFalse );
   405 
   401 
   406         if ( aGprsIconState != EAknSignalGprsIndicatorEstablishingContext &&
   402         if ( aGprsIconState != EAknSignalGprsIndicatorEstablishingContext )
   407              iTicker )
   403             {
   408             {
   404             StopTicker();
   409             iTicker->Cancel();
       
   410             }
   405             }
   411         else if ( aGprsIconState == EAknSignalGprsIndicatorEstablishingContext )
   406         else if ( aGprsIconState == EAknSignalGprsIndicatorEstablishingContext )
   412             {
   407             {
   413             if ( iTicker && !iTicker->IsActive() )
   408             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   414                 {
   409                                        KAknIndicatorAnimationInterval ) );
   415                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   416                                 KAknIndicatorAnimationInterval,
       
   417                                 TCallBack( TickerCallback, this ) );
       
   418                 }
       
   419             }
   410             }
   420         }
   411         }
   421     }
   412     }
   422 
   413 
   423 
   414 
   528 // From class CCoeControl.
   519 // From class CCoeControl.
   529 // CAknSignalPane::Draw
   520 // CAknSignalPane::Draw
   530 // Draws the signal pane.
   521 // Draws the signal pane.
   531 // ---------------------------------------------------------------------------
   522 // ---------------------------------------------------------------------------
   532 //
   523 //
   533 EXPORT_C void CAknSignalPane::Draw( const TRect& /*aRect*/ ) const
   524 EXPORT_C void CAknSignalPane::Draw( const TRect& aRect ) const
   534     {
   525     {     
   535     if ( iExtension->iIsActiveIdle )
   526     if ( iExtension->iStatusPane && 
   536         {
   527          iExtension->iStatusPane->IsTransparent() )
       
   528         {
       
   529         CWindowGc& gc = SystemGc();
       
   530         TRgb rgb(TRgb::Color16MA(0));
       
   531         gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
       
   532         gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   533         gc.SetBrushColor(rgb);
       
   534         gc.Clear(aRect);
   537         return;
   535         return;
   538         }
   536         }
   539 
   537 
   540     if ( AknStatuspaneUtils::StaconPaneActive() )
   538     // Don't allow normal background drawing if
   541         {
   539     // background is already drawn with a background drawer.
   542         //  Signal pane in STACON PANE layout
   540     const MCoeControlBackground* backgroundDrawer = FindBackground();
   543         DrawInStaconPane( Rect() );
   541     if ( !backgroundDrawer )
   544         }
   542         {
   545     else if ( AknStatuspaneUtils::FlatLayoutActive() )
   543         if ( AknStatuspaneUtils::StaconPaneActive() )
   546         {
   544             {
   547         //  Signal pane in FLAT STATUSPANE layout
   545             //  Signal pane in STACON PANE layout
   548         DrawInFlatStatusPane( Rect() );
   546             DrawInStaconPane( Rect() );
   549         }
   547             }
   550     else if ( AknStatuspaneUtils::SmallLayoutActive() )
   548         else if ( AknStatuspaneUtils::FlatLayoutActive() )
   551         {
   549             {
   552         //  Signal pane in SMALL STATUSPANE layout
   550             //  Signal pane in FLAT STATUSPANE layout
   553         DrawInSmallStatusPane( Rect() );
   551             DrawInFlatStatusPane( Rect() );
   554         }
   552             }
   555     else
   553         else if ( AknStatuspaneUtils::SmallLayoutActive() )
   556         {
   554             {
   557         // Signal pane in NORMAL STATUSPANE layout
   555             //  Signal pane in SMALL STATUSPANE layout
   558         DrawInNormalStatusPane( Rect() );
   556             DrawInSmallStatusPane( Rect() );
       
   557             }
       
   558         else
       
   559             {
       
   560             // Signal pane in NORMAL STATUSPANE layout
       
   561             DrawInNormalStatusPane( Rect() );
       
   562             }
   559         }
   563         }
   560     }
   564     }
   561 
   565 
   562 
   566 
   563 // ---------------------------------------------------------------------------
   567 // ---------------------------------------------------------------------------
   753         TRAP_IGNORE( LoadSignalIconL( aCommonPacketDataIconState,
   757         TRAP_IGNORE( LoadSignalIconL( aCommonPacketDataIconState,
   754                                       iSignalIconControl->ColorIndex() ) );
   758                                       iSignalIconControl->ColorIndex() ) );
   755 
   759 
   756         iSignalIconControl->SetDrawBlank( EFalse );
   760         iSignalIconControl->SetDrawBlank( EFalse );
   757 
   761 
   758         if ( aCommonPacketDataIconState != EAknSignalCommonPacketDataIndicatorEstablishingContext &&
   762         if ( aCommonPacketDataIconState != EAknSignalCommonPacketDataIndicatorEstablishingContext )
   759              iTicker )
   763             {
   760             {
   764             StopTicker();
   761             iTicker->Cancel();
       
   762             }
   765             }
   763         else if ( aCommonPacketDataIconState == EAknSignalCommonPacketDataIndicatorEstablishingContext )
   766         else if ( aCommonPacketDataIconState == EAknSignalCommonPacketDataIndicatorEstablishingContext )
   764             {
   767             {
   765             if ( iTicker && !iTicker->IsActive() )
   768             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   766                 {
   769                                        KAknIndicatorAnimationInterval ) );
   767                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   768                                 KAknIndicatorAnimationInterval,
       
   769                                 TCallBack( TickerCallback, this ) );
       
   770                 }
       
   771             }
   770             }
   772         }
   771         }
   773     }
   772     }
   774 
   773 
   775 
   774 
   787         TRAP_IGNORE( LoadSignalIconL( aEdgeIconState,
   786         TRAP_IGNORE( LoadSignalIconL( aEdgeIconState,
   788                                       iSignalIconControl->ColorIndex() ) );
   787                                       iSignalIconControl->ColorIndex() ) );
   789 
   788 
   790         iSignalIconControl->SetDrawBlank( EFalse );
   789         iSignalIconControl->SetDrawBlank( EFalse );
   791 
   790 
   792         if ( aEdgeIconState != EAknSignalEdgeIndicatorEstablishingContext &&
   791         if ( aEdgeIconState != EAknSignalEdgeIndicatorEstablishingContext )
   793              iTicker )
   792             {
   794             {
   793             StopTicker();
   795             iTicker->Cancel();
       
   796             }
   794             }
   797         else if ( aEdgeIconState == EAknSignalEdgeIndicatorEstablishingContext )
   795         else if ( aEdgeIconState == EAknSignalEdgeIndicatorEstablishingContext )
   798             {
   796             {
   799             if ( iTicker && !iTicker->IsActive() )
   797             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   800                 {
   798                                        KAknIndicatorAnimationInterval ) );
   801                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   802                                 KAknIndicatorAnimationInterval,
       
   803                                 TCallBack( TickerCallback, this ) );
       
   804                 }
       
   805             }
   799             }
   806         }
   800         }
   807     }
   801     }
   808 
   802 
   809 
   803 
   821         TRAP_IGNORE( LoadSignalIconL( aWcdmaIconState,
   815         TRAP_IGNORE( LoadSignalIconL( aWcdmaIconState,
   822                                       iSignalIconControl->ColorIndex() ) );
   816                                       iSignalIconControl->ColorIndex() ) );
   823 
   817 
   824         iSignalIconControl->SetDrawBlank( EFalse );
   818         iSignalIconControl->SetDrawBlank( EFalse );
   825 
   819 
   826         if ( aWcdmaIconState != EAknSignalWcdmaIndicatorEstablishingContext &&
   820         if ( aWcdmaIconState != EAknSignalWcdmaIndicatorEstablishingContext )
   827              iTicker )
   821             {
   828             {
   822             StopTicker();
   829             iTicker->Cancel();
       
   830             }
   823             }
   831         else if ( aWcdmaIconState == EAknSignalWcdmaIndicatorEstablishingContext )
   824         else if ( aWcdmaIconState == EAknSignalWcdmaIndicatorEstablishingContext )
   832             {
   825             {
   833             if ( iTicker && !iTicker->IsActive() )
   826             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   834                 {
   827                                        KAknIndicatorAnimationInterval ) );
   835                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   836                                 KAknIndicatorAnimationInterval,
       
   837                                 TCallBack( TickerCallback, this ) );
       
   838                 }
       
   839             }
   828             }
   840         }
   829         }
   841     }
   830     }
   842 
   831 
   843 
   832 
   855         TRAP_IGNORE( LoadSignalIconL( aHsdpaIconState,
   844         TRAP_IGNORE( LoadSignalIconL( aHsdpaIconState,
   856                                       iSignalIconControl->ColorIndex() ) );
   845                                       iSignalIconControl->ColorIndex() ) );
   857 
   846 
   858         iSignalIconControl->SetDrawBlank( EFalse );
   847         iSignalIconControl->SetDrawBlank( EFalse );
   859 
   848 
   860         if ( aHsdpaIconState != EAknSignalHsdpaIndicatorEstablishingContext &&
   849         if ( aHsdpaIconState != EAknSignalHsdpaIndicatorEstablishingContext )
   861              iTicker )
   850             {
   862             {
   851             StopTicker();
   863             iTicker->Cancel();
       
   864             }
   852             }
   865         else if ( aHsdpaIconState == EAknSignalHsdpaIndicatorEstablishingContext )
   853         else if ( aHsdpaIconState == EAknSignalHsdpaIndicatorEstablishingContext )
   866             {
   854             {
   867             if ( iTicker && !iTicker->IsActive() )
   855             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   868                 {
   856                                        KAknIndicatorAnimationInterval ) );
   869                 iTicker->Start( KAknIndicatorAnimationDelay,
   857             }
   870                                 KAknIndicatorAnimationInterval,
   858         }
   871                                 TCallBack( TickerCallback, this ) );
   859     }
   872                 }
   860 
   873             }
   861 // ---------------------------------------------------------------------------
   874         }
   862 // CAknSignalPane::ShowUmaIcon
   875     }
   863 // Displays an Uma state icon.
   876 
   864 // ---------------------------------------------------------------------------
       
   865 //
       
   866 EXPORT_C void CAknSignalPane::ShowUmaIconL(TInt aUmaIconState)
       
   867     {
       
   868     // State is not changed if illegal value was given.
       
   869     if (( aUmaIconState >= EAknSignalUmaIndicatorOff ) && 
       
   870         ( aUmaIconState <= EAknSignalUmaIndicatorMultipdp ))
       
   871         {        
       
   872         LoadSignalIconL( aUmaIconState, iSignalIconControl->ColorIndex() );
       
   873         
       
   874         iSignalIconControl->SetDrawBlank( EFalse );
       
   875         
       
   876         if ( aUmaIconState != EAknSignalUmaIndicatorEstablishingContext )
       
   877             {
       
   878             StopTicker();
       
   879             }
       
   880         else if ( aUmaIconState == EAknSignalUmaIndicatorEstablishingContext )
       
   881             {
       
   882             StartTickerL( KAknIndicatorAnimationDelay,
       
   883                                                    KAknIndicatorAnimationInterval );       
       
   884             }
       
   885         }
       
   886 
       
   887 
       
   888     }
   877 
   889 
   878 // ---------------------------------------------------------------------------
   890 // ---------------------------------------------------------------------------
   879 // CAknSignalPane::ShowCdmaIcon
   891 // CAknSignalPane::ShowCdmaIcon
   880 // Displays a CDMA state icon.
   892 // Displays a CDMA state icon.
   881 // ---------------------------------------------------------------------------
   893 // ---------------------------------------------------------------------------
   893 
   905 
   894         iExtension->iCdmaSignalState = aCdmaIconState;
   906         iExtension->iCdmaSignalState = aCdmaIconState;
   895 
   907 
   896         // Tick timer is only used when animating.
   908         // Tick timer is only used when animating.
   897         if ( aCdmaIconState != EAknSignalCdmaIndicatorSending &&
   909         if ( aCdmaIconState != EAknSignalCdmaIndicatorSending &&
   898              aCdmaIconState != EAknSignalCdmaIndicatorReceiving &&
   910              aCdmaIconState != EAknSignalCdmaIndicatorReceiving )
   899              iTicker )
   911             {
   900             {
   912             StopTicker();
   901             iTicker->Cancel();
       
   902             }
   913             }
   903 
   914 
   904         switch ( aCdmaIconState )
   915         switch ( aCdmaIconState )
   905             {
   916             {
   906             case EAknSignalCdmaIndicatorSending:
   917             case EAknSignalCdmaIndicatorSending:
   907             case EAknSignalCdmaIndicatorReceiving:
   918             case EAknSignalCdmaIndicatorReceiving:
       
   919                 {
   908                 if ( iTicker && !iTicker->IsActive() )
   920                 if ( iTicker && !iTicker->IsActive() )
   909                     {
   921                     {
   910                     // restart animation
   922                     // restart animation
   911                     iExtension->iCdmaAnimationIndex = 0;
   923                     iExtension->iCdmaAnimationIndex = 0;
   912                     iTicker->Start( KAknIndicatorShortAnimationInterval,
   924                     TRAP_IGNORE(
   913                                     KAknIndicatorShortAnimationInterval,
   925                         StartTickerL( KAknIndicatorShortAnimationInterval,
   914                                     TCallBack( TickerCallback, this ) );
   926                                       KAknIndicatorShortAnimationInterval ) );
   915                     }
   927                     }
   916                 break;
   928                 break;
       
   929                 }
   917             default:
   930             default:
   918                 break;
   931                 break;
   919             }
   932             }
   920         }
   933         }
   921     }
   934     }
  1068         }
  1081         }
  1069 
  1082 
  1070     iSignalState = aIconState;
  1083     iSignalState = aIconState;
  1071     }
  1084     }
  1072 
  1085 
       
  1086 
       
  1087 // ---------------------------------------------------------------------------
       
  1088 // CAknSignalPane::StartTickerL
       
  1089 // Starts the animation timer.
       
  1090 // ---------------------------------------------------------------------------
       
  1091 //
       
  1092 void CAknSignalPane::StartTickerL( TTimeIntervalMicroSeconds32 aDelay,
       
  1093                                    TTimeIntervalMicroSeconds32 aInterval )
       
  1094     {
       
  1095     if ( !iTicker )
       
  1096         {
       
  1097         iTicker = CPeriodic::NewL( CActive::EPriorityLow );
       
  1098         }
       
  1099 
       
  1100     if ( iTicker && !iTicker->IsActive() )
       
  1101         {
       
  1102         iTicker->Start( aDelay,
       
  1103                         aInterval,
       
  1104                         TCallBack( TickerCallback, this ) );
       
  1105         }
       
  1106     }
       
  1107 
       
  1108 
       
  1109 // ---------------------------------------------------------------------------
       
  1110 // CAknSignalPane::StopTicker
       
  1111 // Stops the animation timer.
       
  1112 // ---------------------------------------------------------------------------
       
  1113 //
       
  1114 void CAknSignalPane::StopTicker()
       
  1115     {
       
  1116     if ( iTicker )
       
  1117         {
       
  1118         iTicker->Cancel();
       
  1119         delete iTicker;
       
  1120         iTicker = NULL;
       
  1121         }
       
  1122     }
       
  1123 
  1073 //  End of File
  1124 //  End of File