uifw/AvKon/src/AknRadioButtonSettingPage.cpp
branchRCL_3
changeset 15 c52421ed5f07
parent 7 08e69e956a8c
child 18 fcdfafb36fe7
--- a/uifw/AvKon/src/AknRadioButtonSettingPage.cpp	Wed Jun 09 09:58:37 2010 +0300
+++ b/uifw/AvKon/src/AknRadioButtonSettingPage.cpp	Mon Jun 21 15:57:43 2010 +0300
@@ -75,13 +75,26 @@
      * Extension flags.
      */
     TBitFlags iFlags;
+
+    /**
+     * Item that received pen down event
+     */
+    TInt iPenDownOnItem;
+    
+    /**
+     * Is selection valid
+     */
+    TBool iIsValidSelection;
+    
     };
 // end of CAknRadioButtonSettingPageExtension class definition
 
 
 CAknRadioButtonSettingPageExtension::CAknRadioButtonSettingPageExtension(
     CCoeControl& aOwner ) :
-    iOldFocusedItemIndex(-1), iIsDragged( EFalse )
+    iOldFocusedItemIndex(-1), iIsDragged( EFalse ), 
+    iIsValidSelection( ETrue ),
+    iPenDownOnItem ( KErrNotFound )
     {
     if ( static_cast<CAknAppUi*>(
             aOwner.ControlEnv()->AppUi() )->IsSingleClickCompatible() )
@@ -229,6 +242,14 @@
 		
     switch ( aEventType )
         {
+        case MEikListBoxObserver::EEventPenDownOnItem:
+            {
+            if ( iExtension )
+                {
+                iExtension->iPenDownOnItem = ListBoxControl()->CurrentItemIndex();
+                }
+            break;
+            }
         case MEikListBoxObserver::EEventItemSingleClicked:
         case MEikListBoxObserver::EEventItemDoubleClicked:
             {
@@ -287,8 +308,17 @@
 	} 
 
 EXPORT_C void CAknRadioButtonSettingPage::SelectCurrentItemL()
-	{
-    iCurrentSelectionIndex = ListBoxControl()->CurrentItemIndex();
+	{   
+    if ( ListBoxControl()->IsHighlightEnabled() || 
+            ( iExtension && iExtension->iIsValidSelection ) )
+        {
+        iCurrentSelectionIndex = ListBoxControl()->CurrentItemIndex();
+        }
+    else
+        {
+        ListBoxControl()->SetCurrentItemIndex ( iCurrentSelectionIndex );
+        }
+
     SetRadioButtonSelectionL( iCurrentSelectionIndex );
 	UpdateSettingL();
 	if( iSettingPageObserver )
@@ -456,7 +486,22 @@
     TPointerEvent& event = const_cast<TPointerEvent&>( aPointerEvent );
     event.iModifiers &= ~EModifierShift;
     event.iModifiers &= ~EModifierCtrl;
-
+    
+    if ( iExtension )
+        {
+        TInt index ( KErrNotFound );
+        ListBoxControl()->View()->XYPosToItemIndex( 
+            aPointerEvent.iPosition, index );
+        if ( index == iExtension->iPenDownOnItem 
+                && iExtension->iPenDownOnItem != KErrNotFound )
+            {
+            iExtension->iIsValidSelection = ETrue;
+            }
+        else
+            {
+            iExtension->iIsValidSelection = EFalse;
+            }
+        }
     CAknListBoxSettingPage::HandlePointerEventL( aPointerEvent );
     }