textinput/peninputsplititut/src/peninputsplititutwesternuimgr.cpp
changeset 0 eb1f2e154e89
child 5 a47de9135b21
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     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:  drop-down list control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "peninputsplititutwesternuimgr.h"
       
    20 #include "peninputsplititutdata.h"
       
    21 #include "peninputsplititutdatamgr.h"
       
    22 #include "peninputsplititutwesternuistatenonpredict.h"
       
    23 #include "peninputsplititutlayoutcontext.h"
       
    24 #include "peninputsplititutlayout.h"
       
    25 #include "peninputsplititutwindowmanager.h"
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS =============================
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CWesternSplitItutUiMgr::NewL
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CWesternSplitItutUiMgr* CWesternSplitItutUiMgr::NewL(MSplitItutLayoutContext* aContext, 
       
    35                                            CSplitItutDataMgr* aDataMgr,
       
    36                                            CSplitItutWindowManager* aUiManager)
       
    37     {
       
    38     CWesternSplitItutUiMgr* self = new (ELeave) CWesternSplitItutUiMgr(aContext, aDataMgr,aUiManager);
       
    39     CleanupStack::PushL(self);
       
    40     self->ConstructL(); 
       
    41     CleanupStack::Pop(self);
       
    42     return self;
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CWesternSplitItutUiMgr::NewL
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CWesternSplitItutUiMgr::~CWesternSplitItutUiMgr()
       
    50     {
       
    51     if (iCurrentState)
       
    52         {
       
    53         iCurrentState->OnExit();
       
    54         }
       
    55         
       
    56     delete iNormalState;
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // CWesternSplitItutUiMgr::CWesternSplitItutUiMgr
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 CWesternSplitItutUiMgr::CWesternSplitItutUiMgr(MSplitItutLayoutContext* aContext,
       
    64                                      CSplitItutDataMgr* aDataMgr,
       
    65                                      CSplitItutWindowManager* aUiManager)
       
    66                                     :CSplitItutUiMgrBase(aContext, aDataMgr,aUiManager)
       
    67     {
       
    68     iDataMgr = aDataMgr;
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // CWesternSplitItutUiMgr::ConstructL
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 void CWesternSplitItutUiMgr::ConstructL()
       
    76     {
       
    77     CSplitItutUiMgrBase::ConstructL();
       
    78 
       
    79     iNormalState = CWesternSplitItutUiStateNonPredict::NewL(this);
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CWesternSplitItutUiMgr::HandleCtrlEventL
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 TBool CWesternSplitItutUiMgr::HandleCtrlEventL(TInt aEventType, 
       
    87                                           CFepUiBaseCtrl* aCtrl, 
       
    88                                           const TDesC& aEventData)
       
    89     {
       
    90     if (!iCurrentState)
       
    91         {
       
    92         return EFalse;
       
    93         }
       
    94 
       
    95     return iCurrentState->HandleCtrlEventL(aEventType, aCtrl, aEventData);
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CWesternSplitItutUiMgr::SetCurrentStateL
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 void CWesternSplitItutUiMgr::SetCurrentStateL(TUiState aNewState)
       
   103     {
       
   104     if (iCurrentState && aNewState == iCurrentState->StateType())
       
   105     	{
       
   106         return;    		
       
   107     	}
       
   108     
       
   109     CSplitItutUiStateBase* newstate = NULL;
       
   110 
       
   111     switch (aNewState)
       
   112         {
       
   113         case CSplitItutUiMgrBase::EStateWesternStandby:
       
   114             {
       
   115             newstate = iNormalState;
       
   116             }
       
   117             break;
       
   118         default:
       
   119             return;    
       
   120         }
       
   121 
       
   122     if (iCurrentState)
       
   123         {
       
   124         iCurrentState->OnExit();
       
   125         }
       
   126 
       
   127     iCurrentState = newstate;    
       
   128     if(DataMgr()->IsUpdate())  
       
   129     	{
       
   130     	DataMgr()->SetUpdate(EFalse);
       
   131     	CSplitItutUiLayout* itutLayout = 
       
   132 			static_cast<CSplitItutUiLayout*>( LayoutContext()->UiLayout() );
       
   133 		itutLayout->SizeChanged( NULL );
       
   134     	}
       
   135     iCurrentState->OnEntryL();
       
   136     }
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // CWesternSplitItutUiMgr::ActivateUiL
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 void CWesternSplitItutUiMgr::ActivateUiL()
       
   143     {
       
   144     if (iCurrentState)
       
   145         {
       
   146         iCurrentState->OnEntryL();
       
   147         }
       
   148     else
       
   149         {
       
   150         SetCurrentStateL(CSplitItutUiMgrBase::EStateWesternStandby);
       
   151         }
       
   152     }
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // CWesternSplitItutUiMgr::DeactivateUI
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 void CWesternSplitItutUiMgr::DeactivateUI()
       
   159     {
       
   160     if (iCurrentState)
       
   161         {
       
   162         iCurrentState->OnExit();
       
   163         }
       
   164     }
       
   165 
       
   166 // ---------------------------------------------------------------------------
       
   167 // CWesternSplitItutUiMgr::HandleCommandL
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 TInt CWesternSplitItutUiMgr::HandleCommandL(TInt aCmd, TUint8* aData)
       
   171     {
       
   172     if ( aCmd == ECmdPenInputFingerMatchSelection )
       
   173         {
       
   174         if (!(*(reinterpret_cast<TBool*>(aData))))
       
   175             {
       
   176             // state not on
       
   177             SetCurrentStateL(CSplitItutUiMgrBase::EStateWesternStandby);
       
   178 
       
   179             return KErrNone;
       
   180             }
       
   181         }
       
   182 
       
   183     switch (aCmd)
       
   184         {
       
   185         case ECmdPenInputCase:
       
   186             {
       
   187             if (iCurrentState)
       
   188                 {
       
   189                 iLayoutContext->DataMgr()->SetCase(*((TUint*) aData));
       
   190                 return KErrNone;
       
   191                 }
       
   192             }
       
   193             break;          
       
   194         default:
       
   195             break;
       
   196         }
       
   197 
       
   198     if (iCurrentState)
       
   199         {
       
   200         return iCurrentState->HandleCommandL(aCmd, aData);
       
   201         }
       
   202 
       
   203     return KErrNotSupported;
       
   204     }
       
   205 
       
   206 // End Of File