uifw/AvKon/src/akntabgrp.cpp
branchRCL_3
changeset 64 85902f042028
parent 56 d48ab3b357f1
child 72 a5e7a4f63858
--- a/uifw/AvKon/src/akntabgrp.cpp	Tue Sep 14 21:48:24 2010 +0300
+++ b/uifw/AvKon/src/akntabgrp.cpp	Wed Sep 15 12:29:17 2010 +0300
@@ -38,6 +38,7 @@
 
 #include <AknTasHook.h>
 #include <touchfeedback.h>
+#include <AknPriv.hrh>
 
 // USER INCLUDE FILES
 #include "aknappui.h"
@@ -2916,21 +2917,9 @@
                 // pointer position.
                 newTab = iActiveTab;
                 }
-            iExtension->iPointerDownTab       = newTab;
-            iExtension->iPointerDownXPosition = aPointerEvent.iPosition.iX;
             
             //Activates highlight drawing for pressed tab.
-            if (!iExtension->iHighlight)
-                {
-                iExtension->iHighlight = ETrue;
-                
-                // Set the pressed tab to highlight
-                if ( iExtension->iPointerDownTab >= 0 )
-                    {
-                    iTabArray->At( iExtension->iPointerDownTab )->SetHighlight( ETrue );
-                    }
-                DrawDeferred();
-                }
+            EnableHighlight( ETrue, newTab, aPointerEvent.iPosition.iX );
             
             return;
             }
@@ -2961,14 +2950,7 @@
             // if the button up event occurs ouside tabgroup, ignore it.
             if ( !Rect().Contains( aPointerEvent.iPosition ) || iExtension->iPointerDownTab != newTab )
                 {
-                iExtension->iPointerDownTab = -1;
-                iExtension->iPointerDownXPosition = -1;
-                if (iExtension->iHighlight)
-                    {
-                    iExtension->iHighlight = EFalse;
-                    ResetHighlightStatus();
-                    DrawDeferred();
-                    }
+                EnableHighlight( EFalse );
                 return;
                 }
 
@@ -3075,14 +3057,7 @@
                     }
                 }
 
-            iExtension->iPointerDownTab       = -1;
-            iExtension->iPointerDownXPosition = -1;
-            if( iExtension->iHighlight )
-                {
-                iExtension->iHighlight = EFalse;
-                ResetHighlightStatus();
-                DrawDeferred();
-                }
+            EnableHighlight( EFalse );
             }
         }
     }
@@ -3436,6 +3411,12 @@
         TRAP_IGNORE( InitTabGroupGraphicsL() );
         TRAP_IGNORE( LoadTabBitmapsL( iNumberOfTabsShown, iLongTabs ) );
         }
+    
+    // Stop highlighting the pressed tab when receives KAknMessageFocusLost event.
+    if( aType == KAknMessageFocusLost )
+        {
+        EnableHighlight(EFalse);
+        }
 
     if ( aType == KEikDynamicLayoutVariantSwitch )
         {
@@ -3466,11 +3447,7 @@
         if ( iExtension )
             {
             iExtension->iNarrowTabLayout = EFalse;
-            if( iExtension->iHighlight )
-                {
-                iExtension->iHighlight = EFalse;
-                ResetHighlightStatus();
-                }
+            EnableHighlight(EFalse);
             }
 
         if ( !COMPARE_BOOLS( iMirrored, AknLayoutUtils::LayoutMirrored() ) )
@@ -4520,4 +4497,34 @@
         iTabArray->At(i)->SetHighlight( EFalse );
         }
     }
+
+void CAknTabGroup::EnableHighlight( TBool aEnable, TInt aNewTab , TInt aPointX )
+    {
+    iExtension->iPointerDownTab = aNewTab;
+    iExtension->iPointerDownXPosition = aPointX;
+    if( aEnable )
+        {
+        //Activates highlight drawing for pressed tab.
+        if (!iExtension->iHighlight)
+            {
+            iExtension->iHighlight = ETrue;
+            
+            // Set the pressed tab to highlight
+            if ( iExtension->iPointerDownTab >= 0 )
+                {
+                iTabArray->At( iExtension->iPointerDownTab )->SetHighlight( ETrue );
+                }
+            DrawDeferred();
+            }
+        }
+    else
+        {
+        if (iExtension->iHighlight)
+            {
+            iExtension->iHighlight = EFalse;
+            ResetHighlightStatus();
+            DrawDeferred();
+            }
+        }
+    }
  //  End of File