fep/aknfep/src/AknFepUiInputStateCandidatePinyinAndStrokePhrase.cpp
changeset 0 eb1f2e154e89
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:            Implementation of Pinyin and Stroke phrase candidate state
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 // System includes
       
    30 #include <PtiEngine.h>   
       
    31 
       
    32 // User includes
       
    33 #include "AknFepUiInputStateCandidatePinyinAndStrokePhrase.h"
       
    34 #include "AknFepUiInputStateCandidateBasePhrase.h"
       
    35 #include "AknFepUiCtrlContainerChinese.h"
       
    36 #include "AknFepUICtrlCandidatePane.h"
       
    37 #include "AknFepUIManagerStateInterface.h"  
       
    38 #include "AknFepManager.h"                  
       
    39 // add for phrase creation
       
    40 #include "AknFepUICtrlPinyinPopup.h"
       
    41 
       
    42 // Constant definition
       
    43 const TInt KMinCnadidateCount = 1;
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // AknFepUiInputStateCandidatePinyinAndStrokePhrase::
       
    47 // TAknFepUiInputStateCandidatePinyinAndStrokePhrase
       
    48 // (other items were commented in a header).
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 TAknFepUiInputStateCandidatePinyinAndStrokePhrase::
       
    52     TAknFepUiInputStateCandidatePinyinAndStrokePhrase(MAknFepUIManagerStateInterface* aOwner,
       
    53                                                       MAknFepUICtrlContainerChinese* aUIContainer)
       
    54     :TAknFepInputStateCandidateBaseChinesePhrase(aOwner, aUIContainer)
       
    55     {
       
    56     iState = ECandidate;
       
    57     MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
       
    58     
       
    59     TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() &&
       
    60                             uiContainer->CandidatePane()->IsFirstPage());
       
    61     TInt bufLength = iOwner->PtiEngine()->CandidatePage().Length();
       
    62     TBool showHorizontalScrollArrows = multiplePages || bufLength > KMinCnadidateCount;
       
    63 
       
    64     uiContainer->ShowHorizontalScrollArrows(showHorizontalScrollArrows); 
       
    65     uiContainer->ShowVerticalScrollArrows(multiplePages);
       
    66     uiContainer->FocusCandidatePane(ETrue);
       
    67     uiContainer->CandidatePane()->ShowCandidateOrdinals(ETrue);
       
    68     uiContainer->CandidatePane()->SelectFirstPhrase();
       
    69     UpdateIndicator();
       
    70     }
       
    71 
       
    72 void TAknFepUiInputStateCandidatePinyinAndStrokePhrase::HandleCommandL(TInt aCommandID)
       
    73    {
       
    74    TAknFepInputStateCandidateBaseChinesePhrase::HandleCommandL(aCommandID);
       
    75    }
       
    76 // ---------------------------------------------------------------------------
       
    77 // AknFepUiInputStateCandidatePinyinAndStrokePhrase::HandleKeyL
       
    78 // (other items were commented in a header).
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 TBool TAknFepUiInputStateCandidatePinyinAndStrokePhrase::HandleKeyL(TInt aKey,
       
    82                                                                     TKeyPressLength aLength)
       
    83     {
       
    84     MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); 
       
    85            
       
    86     if ( ( aKey == EKeyBackspace ) || ( aKey == EKeyUpArrow &&
       
    87         iOwner->FepMan()->InputMode() == EPinyin &&
       
    88         candidatePane->IsFirstPage() ) )
       
    89         {
       
    90         // the follow 2 lines add for phrase creation
       
    91         UIContainer()->PinyinPopupWindow()->SetChangeState( ETrue );
       
    92         UIContainer()->PinyinPopupWindow()->SetFromCandidateChangeStateFlag( ETrue );
       
    93         iOwner->FepMan()->EntryPhrase( EFalse );
       
    94         iOwner->ChangeState(EEntry);
       
    95         return ETrue;
       
    96         }
       
    97         
       
    98     return TAknFepInputStateCandidateBaseChinesePhrase::HandleKeyL(aKey, aLength);
       
    99     }
       
   100 
       
   101 // End of file