idlehomescreen/xmluirendering/uiengine/src/xnkeyeventdispatcher.cpp
branchRCL_3
changeset 12 9674c1a575e9
parent 11 ff572dfe6d86
child 18 d05a55b217df
equal deleted inserted replaced
11:ff572dfe6d86 12:9674c1a575e9
    38 // Local macros
    38 // Local macros
    39 #define IS_ARROW_KEY( k ) \
    39 #define IS_ARROW_KEY( k ) \
    40     ( k == EStdKeyLeftArrow || k == EStdKeyRightArrow || \
    40     ( k == EStdKeyLeftArrow || k == EStdKeyRightArrow || \
    41       k == EStdKeyUpArrow || k == EStdKeyDownArrow ) 
    41       k == EStdKeyUpArrow || k == EStdKeyDownArrow ) 
    42 
    42 
       
    43 const TInt KOneView = 1;
       
    44 
    43 // -----------------------------------------------------------------------------
    45 // -----------------------------------------------------------------------------
    44 // SetInitialFocusL
    46 // SetInitialFocusL
    45 // -----------------------------------------------------------------------------
    47 // -----------------------------------------------------------------------------
    46 //
    48 //
    47 static void SetInitialFocusL( RPointerArray< CXnNode >& aArray )
    49 static void SetInitialFocusL( RPointerArray< CXnNode >& aArray )
   272                 appui.ShowFocus();
   274                 appui.ShowFocus();
   273                 
   275                 
   274                 if ( !iNode )
   276                 if ( !iNode )
   275                     {
   277                     {
   276                     // Find initial location for focus
   278                     // Find initial location for focus
   277                     ResolveAndSetFocusL(); 
   279                     ResolveAndSetFocusL();
   278                                             
   280                     
       
   281                     // If focus is still not set, we are in normal mode and the view is empty.
       
   282                     // left and right arrows lead to next/previous view. When other arrows
       
   283                     // are pressed, the focus is hidden.
       
   284                     if( !iNode )
       
   285                         {
       
   286                         if( iUiEngine.ViewManager()->ViewAmount() != KOneView &&
       
   287                             aKeyEvent.iScanCode == EStdKeyRightArrow )
       
   288                             {
       
   289                             iUiEngine.ViewManager()->ActivateNextViewL();
       
   290                             }
       
   291                         else if( iUiEngine.ViewManager()->ViewAmount() != KOneView &&
       
   292                                  aKeyEvent.iScanCode == EStdKeyLeftArrow )
       
   293                             {
       
   294                             iUiEngine.ViewManager()->ActivatePreviousViewL();
       
   295                             }
       
   296                         else
       
   297                             {
       
   298                             // hide focus if view is not switched
       
   299                             appui.HideFocus();
       
   300                             }
       
   301                         }
       
   302 
   279                     return EKeyWasConsumed;
   303                     return EKeyWasConsumed;
   280                     }
   304                     }
   281                 }
   305                 }
   282             }
   306             }
   283         
   307