uifw/AvKon/src/aknsignal.cpp
branchRCL_3
changeset 19 aecbbf00d063
parent 18 fcdfafb36fe7
child 20 d48ab3b357f1
equal deleted inserted replaced
18:fcdfafb36fe7 19:aecbbf00d063
     1 /*
     1 /*
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2008 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     CEikStatusPaneBase*      iStatusPane;
    85     TBool       iIsActiveIdle;
    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 
   292     iExtension->iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle();
   293 		iExtension->iStatusPane = CEikStatusPaneBase::Current();
       
   294 
   293 
   295     iSignalIconControl = CAknSignalIcon::NewL();
   294     iSignalIconControl = CAknSignalIcon::NewL();
   296     iSignalIconControl->SetDrawBlank( EFalse );
   295     iSignalIconControl->SetDrawBlank( EFalse );
   297 
   296 
   298     // Load default icon
   297     // Load default icon
   301     iSignalStrengthControl = CAknSignalStrength::NewL();
   300     iSignalStrengthControl = CAknSignalStrength::NewL();
   302 
   301 
   303     iSignalIconControl->SetContainerWindowL( *this );
   302     iSignalIconControl->SetContainerWindowL( *this );
   304     iSignalStrengthControl->SetContainerWindowL( *this );
   303     iSignalStrengthControl->SetContainerWindowL( *this );
   305 
   304 
       
   305     iTicker = CPeriodic::NewL( CActive::EPriorityLow );
       
   306 
   306     // Set flags to default values
   307     // Set flags to default values
   307     iPrivateFlags = 0;
   308     iPrivateFlags = 0;
   308 
   309 
   309     iDataObserver = new (ELeave) CAknSignalDataObserver( this );
   310     iDataObserver = new (ELeave) CAknSignalDataObserver( this );
   310     }
   311     }
   377 // Stops ongoing signal state animation.
   378 // Stops ongoing signal state animation.
   378 // ---------------------------------------------------------------------------
   379 // ---------------------------------------------------------------------------
   379 //
   380 //
   380 void CAknSignalPane::DisableAnimation()
   381 void CAknSignalPane::DisableAnimation()
   381     {
   382     {
   382     StopTicker();
   383     if ( iTicker && iTicker->IsActive() )
       
   384         {
       
   385         iTicker->Cancel();
       
   386         }
   383     }
   387     }
   384 
   388 
   385 
   389 
   386 // ---------------------------------------------------------------------------
   390 // ---------------------------------------------------------------------------
   387 // CAknSignalPane::ShowGprsIcon
   391 // CAknSignalPane::ShowGprsIcon
   397         TRAP_IGNORE( LoadSignalIconL( aGprsIconState,
   401         TRAP_IGNORE( LoadSignalIconL( aGprsIconState,
   398                                       iSignalIconControl->ColorIndex() ) );
   402                                       iSignalIconControl->ColorIndex() ) );
   399 
   403 
   400         iSignalIconControl->SetDrawBlank( EFalse );
   404         iSignalIconControl->SetDrawBlank( EFalse );
   401 
   405 
   402         if ( aGprsIconState != EAknSignalGprsIndicatorEstablishingContext )
   406         if ( aGprsIconState != EAknSignalGprsIndicatorEstablishingContext &&
   403             {
   407              iTicker )
   404             StopTicker();
   408             {
       
   409             iTicker->Cancel();
   405             }
   410             }
   406         else if ( aGprsIconState == EAknSignalGprsIndicatorEstablishingContext )
   411         else if ( aGprsIconState == EAknSignalGprsIndicatorEstablishingContext )
   407             {
   412             {
   408             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   413             if ( iTicker && !iTicker->IsActive() )
   409                                        KAknIndicatorAnimationInterval ) );
   414                 {
       
   415                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   416                                 KAknIndicatorAnimationInterval,
       
   417                                 TCallBack( TickerCallback, this ) );
       
   418                 }
   410             }
   419             }
   411         }
   420         }
   412     }
   421     }
   413 
   422 
   414 
   423 
   519 // From class CCoeControl.
   528 // From class CCoeControl.
   520 // CAknSignalPane::Draw
   529 // CAknSignalPane::Draw
   521 // Draws the signal pane.
   530 // Draws the signal pane.
   522 // ---------------------------------------------------------------------------
   531 // ---------------------------------------------------------------------------
   523 //
   532 //
   524 EXPORT_C void CAknSignalPane::Draw( const TRect& aRect ) const
   533 EXPORT_C void CAknSignalPane::Draw( const TRect& /*aRect*/ ) const
   525     {     
   534     {
   526     if ( iExtension->iStatusPane && 
   535     if ( iExtension->iIsActiveIdle )
   527          iExtension->iStatusPane->IsTransparent() )
   536         {
   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);
       
   535         return;
   537         return;
   536         }
   538         }
   537 
   539 
   538     // Don't allow normal background drawing if
   540     if ( AknStatuspaneUtils::StaconPaneActive() )
   539     // background is already drawn with a background drawer.
   541         {
   540     const MCoeControlBackground* backgroundDrawer = FindBackground();
   542         //  Signal pane in STACON PANE layout
   541     if ( !backgroundDrawer )
   543         DrawInStaconPane( Rect() );
   542         {
   544         }
   543         if ( AknStatuspaneUtils::StaconPaneActive() )
   545     else if ( AknStatuspaneUtils::FlatLayoutActive() )
   544             {
   546         {
   545             //  Signal pane in STACON PANE layout
   547         //  Signal pane in FLAT STATUSPANE layout
   546             DrawInStaconPane( Rect() );
   548         DrawInFlatStatusPane( Rect() );
   547             }
   549         }
   548         else if ( AknStatuspaneUtils::FlatLayoutActive() )
   550     else if ( AknStatuspaneUtils::SmallLayoutActive() )
   549             {
   551         {
   550             //  Signal pane in FLAT STATUSPANE layout
   552         //  Signal pane in SMALL STATUSPANE layout
   551             DrawInFlatStatusPane( Rect() );
   553         DrawInSmallStatusPane( Rect() );
   552             }
   554         }
   553         else if ( AknStatuspaneUtils::SmallLayoutActive() )
   555     else
   554             {
   556         {
   555             //  Signal pane in SMALL STATUSPANE layout
   557         // Signal pane in NORMAL STATUSPANE layout
   556             DrawInSmallStatusPane( Rect() );
   558         DrawInNormalStatusPane( Rect() );
   557             }
       
   558         else
       
   559             {
       
   560             // Signal pane in NORMAL STATUSPANE layout
       
   561             DrawInNormalStatusPane( Rect() );
       
   562             }
       
   563         }
   559         }
   564     }
   560     }
   565 
   561 
   566 
   562 
   567 // ---------------------------------------------------------------------------
   563 // ---------------------------------------------------------------------------
   757         TRAP_IGNORE( LoadSignalIconL( aCommonPacketDataIconState,
   753         TRAP_IGNORE( LoadSignalIconL( aCommonPacketDataIconState,
   758                                       iSignalIconControl->ColorIndex() ) );
   754                                       iSignalIconControl->ColorIndex() ) );
   759 
   755 
   760         iSignalIconControl->SetDrawBlank( EFalse );
   756         iSignalIconControl->SetDrawBlank( EFalse );
   761 
   757 
   762         if ( aCommonPacketDataIconState != EAknSignalCommonPacketDataIndicatorEstablishingContext )
   758         if ( aCommonPacketDataIconState != EAknSignalCommonPacketDataIndicatorEstablishingContext &&
   763             {
   759              iTicker )
   764             StopTicker();
   760             {
       
   761             iTicker->Cancel();
   765             }
   762             }
   766         else if ( aCommonPacketDataIconState == EAknSignalCommonPacketDataIndicatorEstablishingContext )
   763         else if ( aCommonPacketDataIconState == EAknSignalCommonPacketDataIndicatorEstablishingContext )
   767             {
   764             {
   768             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   765             if ( iTicker && !iTicker->IsActive() )
   769                                        KAknIndicatorAnimationInterval ) );
   766                 {
       
   767                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   768                                 KAknIndicatorAnimationInterval,
       
   769                                 TCallBack( TickerCallback, this ) );
       
   770                 }
   770             }
   771             }
   771         }
   772         }
   772     }
   773     }
   773 
   774 
   774 
   775 
   786         TRAP_IGNORE( LoadSignalIconL( aEdgeIconState,
   787         TRAP_IGNORE( LoadSignalIconL( aEdgeIconState,
   787                                       iSignalIconControl->ColorIndex() ) );
   788                                       iSignalIconControl->ColorIndex() ) );
   788 
   789 
   789         iSignalIconControl->SetDrawBlank( EFalse );
   790         iSignalIconControl->SetDrawBlank( EFalse );
   790 
   791 
   791         if ( aEdgeIconState != EAknSignalEdgeIndicatorEstablishingContext )
   792         if ( aEdgeIconState != EAknSignalEdgeIndicatorEstablishingContext &&
   792             {
   793              iTicker )
   793             StopTicker();
   794             {
       
   795             iTicker->Cancel();
   794             }
   796             }
   795         else if ( aEdgeIconState == EAknSignalEdgeIndicatorEstablishingContext )
   797         else if ( aEdgeIconState == EAknSignalEdgeIndicatorEstablishingContext )
   796             {
   798             {
   797             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   799             if ( iTicker && !iTicker->IsActive() )
   798                                        KAknIndicatorAnimationInterval ) );
   800                 {
       
   801                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   802                                 KAknIndicatorAnimationInterval,
       
   803                                 TCallBack( TickerCallback, this ) );
       
   804                 }
   799             }
   805             }
   800         }
   806         }
   801     }
   807     }
   802 
   808 
   803 
   809 
   815         TRAP_IGNORE( LoadSignalIconL( aWcdmaIconState,
   821         TRAP_IGNORE( LoadSignalIconL( aWcdmaIconState,
   816                                       iSignalIconControl->ColorIndex() ) );
   822                                       iSignalIconControl->ColorIndex() ) );
   817 
   823 
   818         iSignalIconControl->SetDrawBlank( EFalse );
   824         iSignalIconControl->SetDrawBlank( EFalse );
   819 
   825 
   820         if ( aWcdmaIconState != EAknSignalWcdmaIndicatorEstablishingContext )
   826         if ( aWcdmaIconState != EAknSignalWcdmaIndicatorEstablishingContext &&
   821             {
   827              iTicker )
   822             StopTicker();
   828             {
       
   829             iTicker->Cancel();
   823             }
   830             }
   824         else if ( aWcdmaIconState == EAknSignalWcdmaIndicatorEstablishingContext )
   831         else if ( aWcdmaIconState == EAknSignalWcdmaIndicatorEstablishingContext )
   825             {
   832             {
   826             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   833             if ( iTicker && !iTicker->IsActive() )
   827                                        KAknIndicatorAnimationInterval ) );
   834                 {
       
   835                 iTicker->Start( KAknIndicatorAnimationDelay,
       
   836                                 KAknIndicatorAnimationInterval,
       
   837                                 TCallBack( TickerCallback, this ) );
       
   838                 }
   828             }
   839             }
   829         }
   840         }
   830     }
   841     }
   831 
   842 
   832 
   843 
   844         TRAP_IGNORE( LoadSignalIconL( aHsdpaIconState,
   855         TRAP_IGNORE( LoadSignalIconL( aHsdpaIconState,
   845                                       iSignalIconControl->ColorIndex() ) );
   856                                       iSignalIconControl->ColorIndex() ) );
   846 
   857 
   847         iSignalIconControl->SetDrawBlank( EFalse );
   858         iSignalIconControl->SetDrawBlank( EFalse );
   848 
   859 
   849         if ( aHsdpaIconState != EAknSignalHsdpaIndicatorEstablishingContext )
   860         if ( aHsdpaIconState != EAknSignalHsdpaIndicatorEstablishingContext &&
   850             {
   861              iTicker )
   851             StopTicker();
   862             {
       
   863             iTicker->Cancel();
   852             }
   864             }
   853         else if ( aHsdpaIconState == EAknSignalHsdpaIndicatorEstablishingContext )
   865         else if ( aHsdpaIconState == EAknSignalHsdpaIndicatorEstablishingContext )
   854             {
   866             {
   855             TRAP_IGNORE( StartTickerL( KAknIndicatorAnimationDelay,
   867             if ( iTicker && !iTicker->IsActive() )
   856                                        KAknIndicatorAnimationInterval ) );
   868                 {
   857             }
   869                 iTicker->Start( KAknIndicatorAnimationDelay,
   858         }
   870                                 KAknIndicatorAnimationInterval,
   859     }
   871                                 TCallBack( TickerCallback, this ) );
   860 
   872                 }
   861 // ---------------------------------------------------------------------------
   873             }
   862 // CAknSignalPane::ShowUmaIcon
   874         }
   863 // Displays an Uma state icon.
   875     }
   864 // ---------------------------------------------------------------------------
   876 
   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     }
       
   889 
   877 
   890 // ---------------------------------------------------------------------------
   878 // ---------------------------------------------------------------------------
   891 // CAknSignalPane::ShowCdmaIcon
   879 // CAknSignalPane::ShowCdmaIcon
   892 // Displays a CDMA state icon.
   880 // Displays a CDMA state icon.
   893 // ---------------------------------------------------------------------------
   881 // ---------------------------------------------------------------------------
   905 
   893 
   906         iExtension->iCdmaSignalState = aCdmaIconState;
   894         iExtension->iCdmaSignalState = aCdmaIconState;
   907 
   895 
   908         // Tick timer is only used when animating.
   896         // Tick timer is only used when animating.
   909         if ( aCdmaIconState != EAknSignalCdmaIndicatorSending &&
   897         if ( aCdmaIconState != EAknSignalCdmaIndicatorSending &&
   910              aCdmaIconState != EAknSignalCdmaIndicatorReceiving )
   898              aCdmaIconState != EAknSignalCdmaIndicatorReceiving &&
   911             {
   899              iTicker )
   912             StopTicker();
   900             {
       
   901             iTicker->Cancel();
   913             }
   902             }
   914 
   903 
   915         switch ( aCdmaIconState )
   904         switch ( aCdmaIconState )
   916             {
   905             {
   917             case EAknSignalCdmaIndicatorSending:
   906             case EAknSignalCdmaIndicatorSending:
   918             case EAknSignalCdmaIndicatorReceiving:
   907             case EAknSignalCdmaIndicatorReceiving:
   919                 {
       
   920                 if ( iTicker && !iTicker->IsActive() )
   908                 if ( iTicker && !iTicker->IsActive() )
   921                     {
   909                     {
   922                     // restart animation
   910                     // restart animation
   923                     iExtension->iCdmaAnimationIndex = 0;
   911                     iExtension->iCdmaAnimationIndex = 0;
   924                     TRAP_IGNORE(
   912                     iTicker->Start( KAknIndicatorShortAnimationInterval,
   925                         StartTickerL( KAknIndicatorShortAnimationInterval,
   913                                     KAknIndicatorShortAnimationInterval,
   926                                       KAknIndicatorShortAnimationInterval ) );
   914                                     TCallBack( TickerCallback, this ) );
   927                     }
   915                     }
   928                 break;
   916                 break;
   929                 }
       
   930             default:
   917             default:
   931                 break;
   918                 break;
   932             }
   919             }
   933         }
   920         }
   934     }
   921     }
  1081         }
  1068         }
  1082 
  1069 
  1083     iSignalState = aIconState;
  1070     iSignalState = aIconState;
  1084     }
  1071     }
  1085 
  1072 
  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 
       
  1124 //  End of File
  1073 //  End of File