fep/aknfep/src/AknFepUiInputStateConversionHiraganaKanji.cpp
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     1 /*
       
     2 * Copyright (c) 2002-2004 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:           
       
    15 *       Provides the TAknFepUiInputStateConversionHiraganaKanji methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 // INCLUDE FILES
       
    31 #include "AknFepUiInputStateConversionHiraganaKanji.h"
       
    32 #include "AknFepUIManagerStateInterface.h"   // MAknFepUIManagerStateInterface
       
    33 #include "AknFepManagerUIInterface.h"        // MAknFepManagerUIInterface
       
    34 #include "AknFepGlobalEnums.h"
       
    35 
       
    36 #include <PtiDefs.h>                     // keys
       
    37 #include <PtiEngine.h>
       
    38 #include <PtiCompositionDataIF.h>        // MPtiEngineCompositionDataInterface
       
    39 #include <aknfep.rsg>
       
    40 
       
    41 // CONSTANTS
       
    42 
       
    43 /**
       
    44  *  TAknFepUiInputStateConversionHiraganaKanji class.
       
    45  *
       
    46  */
       
    47 //============================ MEMBER FUNCTIONS ==============================
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // TAknFepUiInputStateConversionHiraganaKanji::
       
    51 //                                  TAknFepUiInputStateConversionHiraganaKanji
       
    52 // C++ default Constructor
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 TAknFepUiInputStateConversionHiraganaKanji::
       
    56     TAknFepUiInputStateConversionHiraganaKanji(
       
    57                                 MAknFepUIManagerStateInterface* aOwner,
       
    58                                 MAknFepUICtrlContainerJapanese* aUIContainer)
       
    59     :TAknFepUiInputStateEntryJapaneseMultitap(aOwner, aUIContainer)
       
    60     {
       
    61     iData = EStateEventCandidateOn;
       
    62     iState = EConversion;
       
    63 
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // TAknFepUiInputStateConversionHiraganaKanji::InitializeStateL
       
    68 // Initialize State
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 void TAknFepUiInputStateConversionHiraganaKanji::InitializeStateL()
       
    72     {
       
    73     iOwner->SetInlineEditUnderlineVisibility(ETrue);
       
    74 
       
    75     // Update of CBA
       
    76     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    77     TInt newResource = R_AKNFEP_SOFTKEYS_EMPTY_EMPTY_COMMIT;
       
    78     fepMan->UpdateCbaL(newResource);
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // TAknFepUiInputStateConversionHiraganaKanji::HandleNumericKeyL
       
    83 // Handling short keypress events of the numeric and the star.
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 TBool TAknFepUiInputStateConversionHiraganaKanji::HandleNumericShortKeyL(TInt /*aKey*/)
       
    87     {
       
    88     CPtiEngine* ptiEngine = iOwner->PtiEngine();
       
    89     ptiEngine->HandleCommandL(EPtiCommandUserActionAllComplete);
       
    90     iOwner->ChangeState(EMultiCompletion);
       
    91     return EFalse;
       
    92     }
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // TAknFepUiInputStateInitialJapaneseBase::HandleNaviKeyL
       
    96 // Handling Navigate keypress event
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 TBool TAknFepUiInputStateConversionHiraganaKanji::HandleNaviKeyL(TInt aKey,
       
   100                                                                  TKeyPressLength /*aLength*/)
       
   101     {
       
   102     CPtiEngine* ptiEngine = iOwner->PtiEngine();
       
   103     TPtiEngineCommand ptiCommand = EPtiCommandNone;
       
   104 
       
   105     switch(aKey)
       
   106         {
       
   107         case EKeyLeftArrow:
       
   108         case EKeyRightArrow:
       
   109         case EStdKeyLeftArrow:      /* 0x0e */
       
   110         case EStdKeyRightArrow:     /* 0x0f */
       
   111             {
       
   112             ptiCommand = EPtiCommandUserActionShorten;
       
   113             if (aKey == EKeyRightArrow
       
   114              || aKey == EStdKeyRightArrow)
       
   115                 ptiCommand = EPtiCommandUserActionLengthen;
       
   116 
       
   117             ptiEngine->HandleCommandL(ptiCommand);
       
   118             UpdateInlineEditingCharacterL();
       
   119             iData = EStateEventCandidateOff;
       
   120             }
       
   121             break;
       
   122         case EKeyDownArrow:
       
   123         case EKeyUpArrow:
       
   124         case EStdKeyDownArrow:      /* 0x11 */
       
   125         case EStdKeyUpArrow:        /* 0x10 */
       
   126         case EStdKeySpace:
       
   127             {
       
   128             ptiCommand = EPtiCommandUserActionConvert;
       
   129             if (aKey == EKeyUpArrow
       
   130              || aKey == EStdKeyUpArrow)
       
   131                 {
       
   132                 ptiCommand = EPtiCommandUserActionPrevious;
       
   133                 }
       
   134             ptiEngine->HandleCommandL(ptiCommand);
       
   135             UpdateInlineEditingCharacterL();
       
   136             if(iData == EStateEventCandidateOn)
       
   137                 {
       
   138                 iOwner->ChangeState(ECandidate);
       
   139                 }
       
   140             iData = EStateEventCandidateOn;
       
   141             }
       
   142             break;
       
   143         default:
       
   144              break;
       
   145         }
       
   146 
       
   147     return ETrue;
       
   148     }
       
   149 
       
   150 // ---------------------------------------------------------------------------
       
   151 // TAknFepUiInputStateInitialJapaneseBase::HandleAuxKeyL
       
   152 // Handling auxiliary keypress events including OK and Backspace
       
   153 // ---------------------------------------------------------------------------
       
   154 //
       
   155 TBool TAknFepUiInputStateConversionHiraganaKanji::HandleAuxKeyL(TInt aKey,
       
   156                                                                 TKeyPressLength /*aLength*/)
       
   157     {
       
   158     TBool ret = EFalse;
       
   159     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   160     CPtiEngine* ptiEngine = iOwner->PtiEngine();
       
   161 
       
   162     switch(aKey)
       
   163         {
       
   164         case EKeyOK:
       
   165         case EStdKeyDevice3:        /* 0xA7 */
       
   166         case EStdKeyEnter:          /* 0x03 */
       
   167         case EStdKeyNkpEnter:       /* 0x88 */
       
   168             {
       
   169             iOwner->ChangeState(EMultiCompletion);
       
   170             }
       
   171             break;
       
   172         case EKeyBackspace:
       
   173         case EStdKeyBackspace:      /* 0x01 */
       
   174         case EStdKeyEscape:         /* 0x04 */
       
   175             {
       
   176             fepMan->SetInlineEditingCursorVisibilityL(ETrue);
       
   177             ptiEngine->HandleCommandL(EPtiCommandUserActionCancel);
       
   178             iOwner->SetInlineEditUnderlineVisibility(ETrue);
       
   179             UpdateInlineEditingCharacterL();
       
   180             iOwner->ChangeState(EEntry);
       
   181             ret = ETrue;
       
   182             }
       
   183             break;
       
   184         default:
       
   185             break;
       
   186         }
       
   187 
       
   188     return ret;
       
   189     }
       
   190 
       
   191 // End of file