textinput/peninputgenerichwr/src/peninputhwrarabicstatestandby.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 (Standby State)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // System includes
       
    20 #include <peninputuistatemgr.h>
       
    21 #include <aknfeppeninputenums.h>    // ERangeNumber
       
    22 #include <peninputlayoutcontext.h>
       
    23 #include <peninputdataconverter.h>
       
    24 #include <peninputcommonlayoutglobalenum.h>
       
    25 #include <peninputlayoutbasecontrol.h>
       
    26 // user includes
       
    27 //#include "peninputhwrevent.h"
       
    28 #include "peninputhwrarabic.hrh"
       
    29 #include "peninputhwrarabiclayout.h"
       
    30 #include "peninputhwrarabicdatamgr.h"       // use data mgr
       
    31 #include "peninputhwrarabicwindow.h"        // use hwr window, which derived from base window
       
    32 #include "peninputhwrarabicstatestandby.h"
       
    33 
       
    34 // ======== MEMBER FUNCTIONS ========
       
    35 
       
    36 // Implementation of Class CPeninputHwrBxAbStateStandby
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CPeninputHwrBxAbStateStandby::NewL
       
    40 // (other items were commented in a header).
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CPeninputHwrBxAbStateStandby* CPeninputHwrBxAbStateStandby::NewL(MPeninputUiStateMgr* aUiStateMgr,
       
    44                                                          MPeninputLayoutContext* aContext)
       
    45     {
       
    46     CPeninputHwrBxAbStateStandby* self = new ( ELeave ) CPeninputHwrBxAbStateStandby(aUiStateMgr,aContext);
       
    47     CleanupStack::PushL(self);
       
    48     self->Construct();
       
    49     CleanupStack::Pop(self);
       
    50     return self;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CPeninputHwrBxAbStateStandby::~CPeninputHwrBxAbStateStandby
       
    55 // (other items were commented in a header).
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CPeninputHwrBxAbStateStandby::~CPeninputHwrBxAbStateStandby()
       
    59     {
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CPeninputHwrBxAbStateStandby::HandleKeyEventL
       
    64 // (other items were commented in a header).
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 TBool CPeninputHwrBxAbStateStandby::HandleKeyEventL(const TRawEvent& /*aData*/)
       
    68     {
       
    69     return EFalse;
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CPeninputHwrBxAbStateStandby::CPeninputHwrBxAbStateStandby
       
    74 // (other items were commented in a header).
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CPeninputHwrBxAbStateStandby::CPeninputHwrBxAbStateStandby(MPeninputUiStateMgr* aUiStateMgr,
       
    78                                                    MPeninputLayoutContext* aContext)
       
    79     :CPeninputHwrBxAbStateBase(aUiStateMgr,aContext)
       
    80     {
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CPeninputHwrBxAbStateStandby::HandleVkbEvent
       
    85 // pseudo virual key (hwr 1 char)
       
    86 // (other items were commented in a header).
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 TBool CPeninputHwrBxAbStateStandby::HandleVkbEvent(TInt /*aEventType*/, const TDesC& aEventData)
       
    90     {
       
    91     TBool rs = SendKey(aEventData);
       
    92     return rs;
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CPeninputHwrBxAbStateStandby::HandleBackEvent
       
    97 // (other items were commented in a header).
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 TBool CPeninputHwrBxAbStateStandby::HandleBackEvent(TInt /*aEventType*/, const TDesC& aEventData)
       
   101     {
       
   102     return SendKey(aEventData);
       
   103 
       
   104     }
       
   105 
       
   106 // --------------------------------------------------------------------------
       
   107 // CPeninputUiStateHwrStandby::HandleControlEventPenL
       
   108 // (other items were commented in a header)
       
   109 // --------------------------------------------------------------------------
       
   110 //
       
   111 void CPeninputHwrBxAbStateStandby::HandleControlEventPenL( TInt aEventType, 
       
   112     const TDesC& aEventData, CPeninputHwrBxAbLayout& aUiLayout, TDes& /*aCharCode*/, TBool& aHandled )
       
   113     {
       
   114     aHandled = EFalse;
       
   115     switch (aEventType)
       
   116         {
       
   117         case EPeninputLayoutEventBack:
       
   118             {
       
   119             HandleBackEvent( aEventType, aEventData );	
       
   120             aHandled = ETrue;
       
   121             }
       
   122             break;
       
   123 
       
   124         case EEventHwrStrokeStarted:
       
   125             {
       
   126             aUiLayout.UiStateMgr()->SetCurrentUiState(EPeninputHwrBxAbStateBeginWriting);
       
   127             static_cast<CPeninputHwrBxAbWnd*>(aUiLayout.LayoutWindow())->OnStrokeStarted();
       
   128             aHandled = ETrue;
       
   129             }
       
   130             break;	
       
   131         case EEventIcfPointerUpEvent:
       
   132             {
       
   133             TInt dataType = CPeninputDataConverter::AnyToInt(aUiLayout.RequestData( EPeninputDataTypeCurrentRange ));
       
   134             if (dataType == ERangeNative)
       
   135                 {
       
   136                 static_cast<CPeninputHwrBxAbWnd *>(aUiLayout.LayoutWindow())->ResetAndShowDropdownList();
       
   137                 aHandled = ETrue;
       
   138                 }
       
   139             }
       
   140             break;
       
   141         default:
       
   142             break;
       
   143         }	
       
   144     }      
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // CPeninputHwrBxAbStateStandby::HandleEnterSpaceTabEvent
       
   148 // (other items were commented in a header).
       
   149 // -----------------------------------------------------------------------------
       
   150 //
       
   151 TBool CPeninputHwrBxAbStateStandby::HandleEnterSpaceTabEvent(TInt /*aEventType*/, const TDesC& aEventData)
       
   152     {
       
   153     TInt permittedRange = CPeninputDataConverter::AnyToInt
       
   154         ( iContext->RequestData( EPeninputDataTypePermittedRange ) );
       
   155     if (permittedRange == ERangeNumber)
       
   156         {
       
   157         return ETrue;
       
   158         }
       
   159     else
       
   160         {
       
   161         return SendKey(aEventData);
       
   162         }
       
   163     }
       
   164 
       
   165 // End Of File