|
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 Wndwriting 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 "peninputhwrboxuistatetype.h" // UI state |
|
27 #include "peninputhwrboxwindow.h" // use hwr window, which derived from base window |
|
28 #include "peninputhwrboxuistatepenendwriting.h" |
|
29 |
|
30 // constant definition |
|
31 |
|
32 // ======== MEMBER FUNCTIONS ======== |
|
33 |
|
34 // Implementation of Class CPeninputHwrBoxUiStatePenEndWriting |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CPeninputHwrBoxUiStatePenEndWriting::NewL |
|
38 // (other items were commented in a header). |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CPeninputHwrBoxUiStatePenEndWriting* CPeninputHwrBoxUiStatePenEndWriting::NewL(MPeninputUiStateMgr* aUiStateMgr, |
|
42 MPeninputLayoutContext* aContext) |
|
43 { |
|
44 CPeninputHwrBoxUiStatePenEndWriting* self = new ( ELeave ) CPeninputHwrBoxUiStatePenEndWriting(aUiStateMgr,aContext); |
|
45 CleanupStack::PushL(self); |
|
46 self->Construct(); |
|
47 CleanupStack::Pop(self); |
|
48 return self; |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CPeninputHwrBoxUiStatePenEndWriting::~CPeninputHwrBoxUiStatePenEndWriting |
|
53 // (other items were commented in a header). |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CPeninputHwrBoxUiStatePenEndWriting::~CPeninputHwrBoxUiStatePenEndWriting() |
|
57 { |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CPeninputHwrBoxUiStatePenEndWriting::HandleControlEventPenL |
|
62 // (other items were commented in a header). |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 void CPeninputHwrBoxUiStatePenEndWriting::HandleControlEventPenL(TInt aEventType |
|
66 , const TDesC& aEventData |
|
67 , CPeninputHwrBoxLayout& aUiLayout |
|
68 , TDes& aCharCode |
|
69 , TBool& aHandled) |
|
70 { |
|
71 aHandled = ETrue; |
|
72 switch (aEventType) |
|
73 { |
|
74 case EPeninputLayoutHwrEventNewWriting: |
|
75 case EPeninputLayoutHwrEventBeginWriting: |
|
76 aUiLayout.DataMgr(0)->ClearCandidates(); |
|
77 iUiStateMgr->SetCurrentUiState(EPeninputHwrUiStatePenBeginWriting); |
|
78 aUiLayout.HwrBoxWindow()->DimInputContextField(ETrue); // BeginWriting::OnEntry() |
|
79 break; |
|
80 case EPeninputLayoutHwrEventCandidateSelected: |
|
81 { // EndWriting::OnCandidateSelectedL(aEventData); |
|
82 aUiLayout.HwrBoxWindow()->CancelWriting(); // Standby::OnEntry() |
|
83 |
|
84 //There must be a charcode and length at least |
|
85 if (aEventData.Length() > 1) |
|
86 { |
|
87 //get the candidate index |
|
88 const TInt cellNo = aEventData[aEventData.Length()-1]; |
|
89 |
|
90 //get and submit the candidate to fep |
|
91 aUiLayout.DataMgr(0)->GetCandidate(cellNo, aCharCode); |
|
92 aUiLayout.SubmitL(aCharCode); |
|
93 } |
|
94 aUiLayout.ToPenStandBy(); |
|
95 } |
|
96 break; |
|
97 case EPeninputLayoutHwrEventPointerOutsideWnd: |
|
98 aUiLayout.ToPenStandBy(); |
|
99 break; |
|
100 case EPeninputLayoutHwrEventDropDownListExpanded: |
|
101 { // dropdown list opened |
|
102 aUiLayout.HwrBoxWindow()->CancelWriting(); // timer cancel |
|
103 aUiLayout.HwrBoxWindow()->DropdownListDraw(); |
|
104 ToCandidateSelecting(aUiLayout); |
|
105 aHandled = EFalse; |
|
106 } |
|
107 break; |
|
108 case EEventDraggingEnd: |
|
109 case EPeninputLayoutHwrEventEndWriting: |
|
110 { // character time out |
|
111 ToCandidateSelecting(aUiLayout); |
|
112 } |
|
113 break; |
|
114 case EPeninputLayoutEventBack: |
|
115 { // clear |
|
116 aUiLayout.ClearInputToPenStandByL(); |
|
117 } |
|
118 break; |
|
119 default: |
|
120 { // return EFalse; |
|
121 aUiLayout.ToPenStandBy(); |
|
122 aHandled = EFalse; |
|
123 } |
|
124 break; |
|
125 } |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CPeninputHwrBoxUiStatePenEndWriting::CPeninputHwrBoxUiStatePenEndWriting |
|
130 // (other items were commented in a header). |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 CPeninputHwrBoxUiStatePenEndWriting::CPeninputHwrBoxUiStatePenEndWriting(MPeninputUiStateMgr* aUiStateMgr, |
|
134 MPeninputLayoutContext* aContext) |
|
135 :CPeninputHwrBoxUiState(aUiStateMgr,aContext) |
|
136 { |
|
137 } |
|
138 |
|
139 void CPeninputHwrBoxUiStatePenEndWriting::ToCandidateSelecting(CPeninputHwrBoxLayout& aUiLayout) |
|
140 { |
|
141 iUiStateMgr->SetCurrentUiState(EPeninputHwrUiStatePenCandidateSelecting); |
|
142 if (aUiLayout.DataMgr(0)->CandidateCount() > 0) |
|
143 { |
|
144 //hight the first |
|
145 aUiLayout.HwrBoxWindow()->HighlightCell(0); |
|
146 } |
|
147 #ifdef __PENINPUT_HWR_STROKE_LOG_ON |
|
148 aUiLayout.WriteHwrStrokeLogNew(); |
|
149 #endif // __PENINPUT_HWR_STROKE_LOG_ON |
|
150 } |
|
151 |
|
152 // End Of File |