textinput/peninputhwrboxjp/src/peninputhwrboxuistatepencandidateselecting.cpp
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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 hwr ui state machine (Pen CandidateSelecting State)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // System includes
       
    20 #include <peninputuistatemgr.h>
       
    21 
       
    22 #include "peninputhwrevent.h"
       
    23 #include "peninputhwrboxlayout.h"
       
    24 #include "peninputhwrboxdatamgr.h"       // use data mgr
       
    25 #include "peninputhwrboxuistatetype.h"         // UI state
       
    26 #include "peninputhwrboxwindow.h"        // use hwr window, which derived from base window
       
    27 // user includes
       
    28 #include "peninputhwrboxuistatepencandidateselecting.h"
       
    29 
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 
       
    32 // Implementation of Class CPeninputHwrBoxUiStatePenCandidateSelecting
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CPeninputHwrBoxUiStatePenCandidateSelecting::NewL
       
    36 // (other items were commented in a header).
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CPeninputHwrBoxUiStatePenCandidateSelecting* CPeninputHwrBoxUiStatePenCandidateSelecting::NewL(MPeninputUiStateMgr* aUiStateMgr,
       
    40                                                          MPeninputLayoutContext* aContext)
       
    41     {
       
    42     CPeninputHwrBoxUiStatePenCandidateSelecting* self = new ( ELeave ) CPeninputHwrBoxUiStatePenCandidateSelecting(aUiStateMgr,aContext);
       
    43     CleanupStack::PushL(self);
       
    44     self->Construct();
       
    45     CleanupStack::Pop(self);
       
    46     return self;
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CPeninputHwrBoxUiStatePenCandidateSelecting::~CPeninputHwrBoxUiStatePenCandidateSelecting
       
    51 // (other items were commented in a header).
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CPeninputHwrBoxUiStatePenCandidateSelecting::~CPeninputHwrBoxUiStatePenCandidateSelecting()
       
    55     {
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CPeninputHwrBoxUiStatePenBeginWriting::HandleControlEventPenL
       
    60 // (other items were commented in a header).
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 void CPeninputHwrBoxUiStatePenCandidateSelecting::HandleControlEventPenL(TInt aEventType
       
    64                                                                    , const TDesC& aEventData
       
    65                                                                    , CPeninputHwrBoxLayout& aUiLayout
       
    66                                                                    , TDes& aCharCode
       
    67                                                                    , TBool& aHandled)
       
    68     {
       
    69     aHandled = ETrue;
       
    70     switch (aEventType)
       
    71         {
       
    72         case EPeninputLayoutHwrEventBeginWriting:
       
    73             aUiLayout.ToPenStandBy(ETrue);   // Not To PenStandBy
       
    74             iUiStateMgr->SetCurrentUiState(EPeninputHwrUiStatePenBeginWriting);
       
    75             aUiLayout.HwrBoxWindow()->DimInputContextField(ETrue);    // BeginWriting::OnEntry()
       
    76             break;
       
    77         case EPeninputLayoutHwrEventCandidateSelected:
       
    78             {   // CandidateSelecting::OnCandidateSelectedL(aEventData);
       
    79             if (aEventData.Length() > 1)
       
    80                 {
       
    81                 //get the candidate index
       
    82                 const TInt cellNo = aEventData[aEventData.Length()-1];
       
    83 
       
    84                 //not the first candidate, replace previouse char
       
    85                 if (cellNo > 0)
       
    86                     {
       
    87                     //get the new candidate
       
    88                     aUiLayout.DataMgr(0)->GetCandidate(cellNo, aCharCode);
       
    89                     aUiLayout.SubmitL(aCharCode);
       
    90                     }
       
    91                 }
       
    92             aUiLayout.ToPenStandBy();
       
    93             }
       
    94             break;
       
    95         case EPeninputLayoutHwrEventDropDownListExpanded:
       
    96             aHandled = EFalse;
       
    97             break;
       
    98         case EEventDraggingEnd:
       
    99             break; // nop
       
   100         case EPeninputLayoutEventBack:
       
   101             {   // clear
       
   102             aUiLayout.ClearInputToPenStandByL();
       
   103             }
       
   104             break;
       
   105         default:
       
   106             {  // return EFalse;
       
   107             aUiLayout.ToPenStandBy();
       
   108             aHandled = EFalse;
       
   109             }
       
   110             break;
       
   111         }
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CPeninputHwrBoxUiStatePenCandidateSelecting::CPeninputHwrBoxUiStatePenCandidateSelecting
       
   116 // (other items were commented in a header).
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 CPeninputHwrBoxUiStatePenCandidateSelecting::CPeninputHwrBoxUiStatePenCandidateSelecting(MPeninputUiStateMgr* aUiStateMgr,
       
   120                                                    MPeninputLayoutContext* aContext)
       
   121     :CPeninputHwrBoxUiState(aUiStateMgr,aContext)
       
   122     {
       
   123     }
       
   124 
       
   125 // End Of File