meetingrequest/mrgui/src/cmrfocusstrategybase.cpp
branchRCL_3
changeset 12 4ce476e64c59
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Focus strategy base class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cmrfocusstrategybase.h"
       
    19 
       
    20 #include "mesmrfieldstorage.h"
       
    21 #include "cesmrfield.h"
       
    22 #include "emailtrace.h"
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // CMRFocusStrategyBase::CMRFocusStrategyBase
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CMRFocusStrategyBase::CMRFocusStrategyBase( MESMRFieldStorage& aFactory )
       
    29 : iFactory( aFactory )
       
    30     {
       
    31     FUNC_LOG;
       
    32     // Do nothing
       
    33     }
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // CMRFocusStrategyBase::~CMRFocusStrategyBase
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 CMRFocusStrategyBase::~CMRFocusStrategyBase()
       
    40     {
       
    41     FUNC_LOG;
       
    42     // Do nothing
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CMRFocusStrategyBase::InitializeFocus
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 void CMRFocusStrategyBase::InitializeFocus()
       
    50     {
       
    51     FUNC_LOG;
       
    52     
       
    53     HideFocus();
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CMRFocusStrategyBase::EventOccured
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void CMRFocusStrategyBase::EventOccured( TFocusEventType aEventType )
       
    61     {
       
    62     FUNC_LOG;
       
    63     
       
    64     // Default implementation
       
    65     if ( aEventType == MMRFocusStrategy::EFocusKeyEvent )
       
    66         {
       
    67         ShowFocus();
       
    68         }
       
    69     if ( aEventType == MMRFocusStrategy::EFocusPointerEvent )
       
    70         {
       
    71         HideFocus();
       
    72         }
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // CMRFocusStrategyBase::HideFocus
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 void CMRFocusStrategyBase::HideFocus()
       
    80     {
       
    81     FUNC_LOG;
       
    82     
       
    83     if ( iVisibleFocusOn )
       
    84         {
       
    85         const TInt count( iFactory.Count() );
       
    86         for ( TInt i = 0; i < count; i++ )
       
    87             {
       
    88             CESMRField* field = iFactory.Field( i );
       
    89 
       
    90             // At the start there is no focus in hybrid or touch device.
       
    91             // The hw key provokest the focus again
       
    92             field->SetFocusType( EESMRNoFocus );
       
    93             }
       
    94         iVisibleFocusOn = EFalse;
       
    95         }
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CMRFocusStrategyBase::ShowFocus
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 void CMRFocusStrategyBase::ShowFocus()
       
   103     {
       
   104     FUNC_LOG;
       
   105     
       
   106     if ( !iVisibleFocusOn )
       
   107         {
       
   108         const TInt count( iFactory.Count() );
       
   109         for ( TInt i = 0; i < count; i++ )
       
   110             {
       
   111             CESMRField* field = iFactory.Field( i );
       
   112 
       
   113             // At the start there is no focus in hybrid or touch device.
       
   114             // The hw key provokes the focus again
       
   115             field->SetFocusType( EESMRHighlightFocus );
       
   116             }
       
   117         iVisibleFocusOn = ETrue;
       
   118         }
       
   119     }
       
   120         
       
   121 // End of file