|
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 Beginwriting State) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // System includes |
|
20 #include <peninputuistatemgr.h> |
|
21 |
|
22 // user includes |
|
23 #include "peninputhwrevent.h" |
|
24 #include "peninputhwrboxlayout.h" |
|
25 #include "peninputhwrboxdatamgr.h" // use data mgr |
|
26 #include "peninputhwrboxwindow.h" // use hwr window, which derived from base window |
|
27 #include "peninputhwrboxuistatetype.h" // UI state |
|
28 #include "peninputhwrboxuistatepenbeginwriting.h" |
|
29 |
|
30 // constant definition |
|
31 const TUint16 KEWBackRep = 0x2408; |
|
32 const TUint16 KEWEnterRep = 0xF801; |
|
33 |
|
34 // ======== MEMBER FUNCTIONS ======== |
|
35 |
|
36 // Implementation of Class CPeninputHwrBoxUiStatePenBeginWriting |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CPeninputHwrBoxUiStatePenBeginWriting::NewL |
|
40 // (other items were commented in a header). |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CPeninputHwrBoxUiStatePenBeginWriting* CPeninputHwrBoxUiStatePenBeginWriting::NewL(MPeninputUiStateMgr* aUiStateMgr, |
|
44 MPeninputLayoutContext* aContext) |
|
45 { |
|
46 CPeninputHwrBoxUiStatePenBeginWriting* self = new ( ELeave ) CPeninputHwrBoxUiStatePenBeginWriting(aUiStateMgr,aContext); |
|
47 CleanupStack::PushL(self); |
|
48 self->Construct(); |
|
49 CleanupStack::Pop(self); |
|
50 return self; |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CPeninputHwrBoxUiStatePenBeginWriting::~CPeninputHwrBoxUiStatePenBeginWriting |
|
55 // (other items were commented in a header). |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CPeninputHwrBoxUiStatePenBeginWriting::~CPeninputHwrBoxUiStatePenBeginWriting() |
|
59 { |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CPeninputHwrBoxUiStatePenBeginWriting::HandleControlEventPenL |
|
64 // (other items were commented in a header). |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 void CPeninputHwrBoxUiStatePenBeginWriting::HandleControlEventPenL(TInt aEventType |
|
68 , const TDesC& aEventData |
|
69 , CPeninputHwrBoxLayout& aUiLayout |
|
70 , TDes& aCharCode |
|
71 , TBool& aHandled) |
|
72 { |
|
73 switch (aEventType) |
|
74 { |
|
75 case EPeninputLayoutHwrEventEndStroke: |
|
76 { |
|
77 const RArray<TPoint>* aTraceData = (RArray<TPoint>*)aEventData.Ptr(); |
|
78 aUiLayout.DataMgr(0)->DoRecognize(*aTraceData); |
|
79 iUiStateMgr->SetCurrentUiState(EPeninputHwrUiStatePenEndWriting); |
|
80 aUiLayout.DataMgr(0)->GetCandidate(0, aCharCode); |
|
81 aUiLayout.SubmitL(aCharCode); |
|
82 if (aUiLayout.DataMgr(0)->CandidateCount() > 0) |
|
83 { |
|
84 //hight the first |
|
85 aUiLayout.HwrBoxWindow()->HighlightCell(0); |
|
86 } |
|
87 TPtrC16 ptrBack; |
|
88 TPtrC16 ptrEnter; |
|
89 ptrBack.Set(&KEWBackRep, sizeof(KEWBackRep)/sizeof(TUint16)); |
|
90 ptrEnter.Set(&KEWEnterRep, sizeof(KEWEnterRep)/sizeof(TUint16)); |
|
91 //if char code is backspace or enter |
|
92 if (aCharCode.CompareC(ptrBack) == 0 || aCharCode.CompareC(ptrEnter) == 0) |
|
93 { |
|
94 aUiLayout.ToPenStandBy(); |
|
95 } |
|
96 aUiLayout.HwrBoxWindow()->DimInputContextField(EFalse); // BeginWriting::OnExit() |
|
97 } |
|
98 break; |
|
99 default: |
|
100 break; |
|
101 } |
|
102 aHandled = ETrue; |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CPeninputHwrBoxUiStatePenBeginWriting::CPeninputHwrBoxUiStatePenBeginWriting |
|
107 // (other items were commented in a header). |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 CPeninputHwrBoxUiStatePenBeginWriting::CPeninputHwrBoxUiStatePenBeginWriting(MPeninputUiStateMgr* aUiStateMgr, |
|
111 MPeninputLayoutContext* aContext) |
|
112 :CPeninputHwrBoxUiState(aUiStateMgr,aContext) |
|
113 { |
|
114 } |
|
115 |
|
116 // End Of File |