uifw/EikStd/coctlsrc/aknedwincustomdrawbase.cpp
branchRCL_3
changeset 15 08e69e956a8c
parent 10 9f56a4e1b8ab
child 55 aecbbf00d063
--- a/uifw/EikStd/coctlsrc/aknedwincustomdrawbase.cpp	Mon Mar 15 12:41:34 2010 +0200
+++ b/uifw/EikStd/coctlsrc/aknedwincustomdrawbase.cpp	Wed Mar 31 21:59:52 2010 +0300
@@ -37,8 +37,9 @@
 // CONSTANTS
 
 // This is the last character that will be treated as requiring higher underline
-// const TText KMaxSpecialUnderliningChar = 0x0E5B;
+
 const TInt KWsBufferSize = 16000;
+const TInt KOneHundred = 100;
 
 // MEMBER FUNCTIONS
 
@@ -78,8 +79,6 @@
     iPictographDrawer = CAknPictographInterface::NewL(
         static_cast<CCoeControl&>( const_cast<CEikEdwin&>( iEdwin ) ),
         *static_cast<MAknPictographAnimatorCallBack*>( this ) );
-    
-    iSkinInstance = AknsUtils::SkinInstance();
     }
 
 // -----------------------------------------------------------------------------
@@ -94,7 +93,7 @@
         new( ELeave ) CAknEdwinCustomDrawBase( aEnv, aControl );
     CleanupStack::PushL( self );
     self->ConstructL();
-    CleanupStack::Pop();
+    CleanupStack::Pop( self );
     return self;
     }
 
@@ -113,7 +112,7 @@
         aEnv, aControl, aTextView, aSystemGc );
     CleanupStack::PushL( self );
     self->ConstructL();
-    CleanupStack::Pop();
+    CleanupStack::Pop( self );
     return self;
     }
 
@@ -167,7 +166,7 @@
         aExtraPixels = 0;
 
         TInt underlinePos(0);
-        (void)TextNeedsCustomUnderline( aText, aParam, aFormat, underlinePos ) ;
+        TextNeedsCustomUnderline( aText, aParam, aFormat, underlinePos ) ;
         // always perform custom underlining
 
         TRect underlineRect(aParam.iDrawRect);
@@ -318,53 +317,56 @@
     }
 
 
-TRgb CAknEdwinCustomDrawBase::SystemColor(TUint aColorIndex,TRgb aDefaultColor) const
+TRgb CAknEdwinCustomDrawBase::SystemColor( TUint aColorIndex, TRgb aDefaultColor ) const
     {
     TRgb ret = aDefaultColor;
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
     if (aColorIndex==TLogicalRgb::ESystemForegroundIndex)
         {
-        if (iSkinInstance && iEdwin.SkinColorId() != KErrNotFound)
+        if ( skin && iEdwin.SkinColorId() != KErrNotFound )
             {
-            AknsUtils::GetCachedColor(iSkinInstance, ret, KAknsIIDQsnTextColors, iEdwin.SkinColorId());
+            AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnTextColors, 
+                    iEdwin.SkinColorId() );
             }
         }
-    else if (aColorIndex==TLogicalRgb::ESystemBackgroundIndex)
+    else if ( aColorIndex==TLogicalRgb::ESystemBackgroundIndex )
         {
         // Only override aDefaultColor if SetBackgroundColorL was called:
-        (void)iEdwin.EditorBackgroundColor(ret);
+        iEdwin.EditorBackgroundColor( ret );
         // Insist on opaque background
-        ret.SetAlpha(0xFF);
+        ret.SetAlpha( 0xFF );
         }
-
     else if (aColorIndex==TLogicalRgb::ESystemSelectionForegroundIndex)
         {
         ret = KRgbWhite;
-
-        if (iSkinInstance)
+        if ( skin )
             {
             if ( iEdwin.HighlightStyle() == EEikEdwinHighlightLink )
                 {
-                AknsUtils::GetCachedColor(iSkinInstance, ret, KAknsIIDQsnHighlightColors, EAknsCIQsnTextColorsCG3);
+                AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnHighlightColors,
+                        EAknsCIQsnTextColorsCG3 );
                 }
             else // default
                 {
-                AknsUtils::GetCachedColor(iSkinInstance, ret, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG24);
+                AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnTextColors, 
+                        EAknsCIQsnTextColorsCG24 );
                 }
             }
         }
-    else if (aColorIndex==TLogicalRgb::ESystemSelectionBackgroundIndex)
+    else if ( aColorIndex==TLogicalRgb::ESystemSelectionBackgroundIndex )
         {
         ret = KRgbBlue;
-
-        if (iSkinInstance)
+        if ( skin )
             {
             if ( iEdwin.HighlightStyle() == EEikEdwinHighlightLink )
                 {
-                AknsUtils::GetCachedColor(iSkinInstance, ret, KAknsIIDQsnHighlightColors, EAknsCIQsnTextColorsCG1);
+                AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnHighlightColors, 
+                        EAknsCIQsnTextColorsCG1 );
                 }
             else // default
                 {
-                AknsUtils::GetCachedColor(iSkinInstance, ret, KAknsIIDQsnHighlightColors, EAknsCIQsnHighlightColorsCG2);
+                AknsUtils::GetCachedColor( skin, ret, KAknsIIDQsnHighlightColors, 
+                        EAknsCIQsnHighlightColorsCG2 );
                 }
             }
         }
@@ -401,17 +403,21 @@
 #endif //RD_UI_TRANSITION_EFFECTS_POPUPS
         if ( bitmapGc && iEdwin.SkinEnabled() )
             {
-            if ( AknsDrawUtils::DrawBackground( 
-                iSkinInstance, 
-                iEdwin.SkinBackgroundControlContext(),
-                &iControl,
-                *bitmapGc,
-                aRect.iTl,
-                aRect,
-                KAknsDrawParamNoClearUnderImage ) )
+            MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+            if ( skin )
                 {
-                aDrawnRect = aRect;
-                drawn = ETrue;
+                if ( AknsDrawUtils::DrawBackground( 
+                        skin, 
+                        iEdwin.SkinBackgroundControlContext(),
+                        &iControl,
+                        *bitmapGc,
+                        aRect.iTl,
+                        aRect,
+                        KAknsDrawParamNoClearUnderImage ) )
+                    {
+                    aDrawnRect = aRect;
+                    drawn = ETrue;
+                    }
                 }
             }
         else
@@ -715,7 +721,8 @@
                 }
             }
 
-        maxPercentOfALineDrawn = Max( maxPercentOfALineDrawn, (lengthDrawnOnThisLine * 100 )/aUnderlineRect.Width()  );
+        maxPercentOfALineDrawn = Max( maxPercentOfALineDrawn, 
+                ( lengthDrawnOnThisLine * KOneHundred )/aUnderlineRect.Width() );
         } // end of for loop over rows
 
     util.End();