textinput/peninputcommonlayout/src/peninputuistatemgr.cpp
changeset 27 694fa80c203c
parent 24 fc42a86c98e3
child 35 0f326f2e628e
equal deleted inserted replaced
24:fc42a86c98e3 27:694fa80c203c
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Implementation of the ui state machine manager
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // User includes
       
    20 #include "peninputuistatemgr.h"
       
    21 #include "peninputlayoutcontext.h"
       
    22 #include "peninputuistatebase.h"
       
    23 
       
    24 
       
    25 // ======== MEMBER FUNCTIONS ========
       
    26 
       
    27 // --------------------------------------------------------------------------
       
    28 // CPeninputUiStateMgr::CPeninputUiStateMgr
       
    29 // (other items were commented in a header)
       
    30 // --------------------------------------------------------------------------
       
    31 //
       
    32 CPeninputUiStateMgr::CPeninputUiStateMgr( MPeninputLayoutContext* aContext )
       
    33     : iContext( aContext )
       
    34     {
       
    35     }
       
    36 
       
    37 // --------------------------------------------------------------------------
       
    38 // CPeninputUiStateMgr::NewL
       
    39 // (other items were commented in a header).
       
    40 // --------------------------------------------------------------------------
       
    41 //
       
    42 EXPORT_C CPeninputUiStateMgr* CPeninputUiStateMgr::NewL( 
       
    43     MPeninputLayoutContext* aContext )
       
    44     {
       
    45     CPeninputUiStateMgr* self = NewLC( aContext );
       
    46     CleanupStack::Pop( self );
       
    47 
       
    48     return self;
       
    49     }
       
    50     
       
    51 // --------------------------------------------------------------------------
       
    52 // CPeninputUiStateMgr::NewLC
       
    53 // (other items were commented in a header)
       
    54 // --------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CPeninputUiStateMgr* CPeninputUiStateMgr::NewLC( 
       
    57     MPeninputLayoutContext* aContext )
       
    58     {
       
    59     CPeninputUiStateMgr* self = 
       
    60         new ( ELeave ) CPeninputUiStateMgr( aContext );
       
    61     CleanupStack::PushL( self );
       
    62     self->Construct(); 
       
    63     
       
    64     return self;
       
    65     }
       
    66       
       
    67 // --------------------------------------------------------------------------
       
    68 // CPeninputUiStateMgr::~CPeninputUiStateMgr
       
    69 // (other items were commented in a header)
       
    70 // --------------------------------------------------------------------------
       
    71 //
       
    72 EXPORT_C CPeninputUiStateMgr::~CPeninputUiStateMgr()
       
    73     {
       
    74     iUiStateTypeList.Reset();
       
    75     iUiStateTypeList.Close();
       
    76     
       
    77     iUiStateList.ResetAndDestroy();
       
    78     iUiStateList.Close();
       
    79     }
       
    80     
       
    81 // --------------------------------------------------------------------------
       
    82 // CPeninputUiStateMgr::CurrentUiState
       
    83 // (other items were commented in a header)
       
    84 // --------------------------------------------------------------------------
       
    85 //
       
    86 EXPORT_C CPeninputUiStateBase* CPeninputUiStateMgr::CurrentUiState()
       
    87     {
       
    88     return iCurrentState;
       
    89     }
       
    90 
       
    91 // --------------------------------------------------------------------------
       
    92 // CPeninputUiStateMgr::GetUiState
       
    93 // (other items were commented in a header).
       
    94 // --------------------------------------------------------------------------
       
    95 EXPORT_C CPeninputUiStateBase* CPeninputUiStateMgr::GetUiState( 
       
    96     TInt aUiStateType )                                            
       
    97     {
       
    98     CPeninputUiStateBase* uiState = NULL;
       
    99   
       
   100     for ( TInt i = 0; i < iUiStateTypeList.Count(); i++ )
       
   101         {
       
   102         if ( iUiStateTypeList[i] == aUiStateType )
       
   103             {
       
   104             uiState = iUiStateList[i];
       
   105             break;
       
   106             }
       
   107         }
       
   108     
       
   109     return uiState; 
       
   110     }
       
   111     
       
   112 // --------------------------------------------------------------------------
       
   113 // CPeninputUiStateMgr::SetCurrentUiState
       
   114 // (other items were commented in a header)
       
   115 // --------------------------------------------------------------------------
       
   116 //
       
   117 EXPORT_C void CPeninputUiStateMgr::SetCurrentUiState( 
       
   118     CPeninputUiStateBase* aUiState )
       
   119     {
       
   120     iCurrentState = aUiState;
       
   121     }
       
   122 
       
   123 // --------------------------------------------------------------------------
       
   124 // CPeninputUiStateMgr::SetCurrentUiState
       
   125 // (other items were commented in a header)
       
   126 // --------------------------------------------------------------------------
       
   127 //
       
   128 EXPORT_C void CPeninputUiStateMgr::SetCurrentUiState( TInt aUiStateType )
       
   129     {
       
   130     iCurrentState = GetUiState( aUiStateType );
       
   131     }
       
   132 
       
   133 // --------------------------------------------------------------------------
       
   134 // CPeninputUiStateMgr::AddUiState
       
   135 // (other items were commented in a header)
       
   136 // --------------------------------------------------------------------------
       
   137 //
       
   138 EXPORT_C void CPeninputUiStateMgr::AddUiState( CPeninputUiStateBase* aUiState,
       
   139                                                TInt aUiStateType )
       
   140     {
       
   141     iUiStateTypeList.Append( aUiStateType );
       
   142     iUiStateList.Append( aUiState );  
       
   143     }
       
   144     
       
   145 // --------------------------------------------------------------------------
       
   146 // CPeninputUiStateMgr::ConstructL
       
   147 // (other items were commented in a header)
       
   148 // --------------------------------------------------------------------------
       
   149 //
       
   150 void CPeninputUiStateMgr::Construct()
       
   151     {
       
   152     }