|
1 /* |
|
2 * Copyright (c) 2002-2005 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 vkb ui state machine (compositionnochars) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // user includes |
|
20 #include "peninputvkbevent.h" |
|
21 #include "peninputvkbuistatecompositionwithchars.h" |
|
22 #include "peninputvkblayout.h" |
|
23 #include "peninputvkbwindow.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // Implementation of Class CAknFepVkbUiStateCompositionWithChars |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CAknFepVkbUiStateCompositionWithChars::CAknFepVkbUiStateCompositionWithChars |
|
31 // (other items were commented in a header). |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CAknFepVkbUiStateCompositionWithChars::CAknFepVkbUiStateCompositionWithChars( |
|
35 MAknFepVkbUiStateMgr* aUiStateMgr, |
|
36 MAknFepVkbLayoutContext* aContext) |
|
37 :CAknFepVkbUiState(aUiStateMgr,aContext) |
|
38 { |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CAknFepVkbUiStateCompositionWithChars::NewL |
|
43 // (other items were commented in a header). |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 CAknFepVkbUiStateCompositionWithChars* CAknFepVkbUiStateCompositionWithChars:: |
|
47 NewL(MAknFepVkbUiStateMgr* aUiStateMgr, |
|
48 MAknFepVkbLayoutContext* aContext) |
|
49 { |
|
50 CAknFepVkbUiStateCompositionWithChars* self = new ( ELeave ) |
|
51 CAknFepVkbUiStateCompositionWithChars(aUiStateMgr,aContext); |
|
52 CleanupStack::PushL(self); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop(); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CAknFepVkbUiStateCompositionWithChars::~CAknFepVkbUiStateCompositionWithChars |
|
60 // (other items were commented in a header). |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 CAknFepVkbUiStateCompositionWithChars::~CAknFepVkbUiStateCompositionWithChars() |
|
64 { |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CAknFepVkbUiStateCompositionWithChars::HandleKeyEventL |
|
69 // (other items were commented in a header). |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 TBool CAknFepVkbUiStateCompositionWithChars::HandleKeyEventL(const TRawEvent& aData) |
|
73 { |
|
74 if ( static_cast<CAknFepVkbLayout*>(iContext)->Window()->FocusedControlID() |
|
75 == EAknFepVkbCtrlIdCompositionField && aData.Type() == TRawEvent::EKeyUp) |
|
76 { |
|
77 if (aData.ScanCode() == EStdKeyLeftArrow) |
|
78 { |
|
79 //static_cast<CAknFepVkbLayout*>(iContext)->Window()->UpdateCompositionFieldCursor(ETrue); |
|
80 return ETrue; |
|
81 } |
|
82 else if (aData.ScanCode() == EStdKeyRightArrow) |
|
83 { |
|
84 //static_cast<CAknFepVkbLayout*>(iContext)->Window()->UpdateCompositionFieldCursor(EFalse); |
|
85 return ETrue; |
|
86 } |
|
87 } |
|
88 return EFalse; |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CAknFepVkbUiStateCompositionWithChars::HandleVkbEvent |
|
93 // (other items were commented in a header). |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 TBool CAknFepVkbUiStateCompositionWithChars::HandleVkbEvent(TInt /*aEventType*/, |
|
97 const TDesC& aEventData) |
|
98 { |
|
99 TKeyEvent* event = (TKeyEvent*) aEventData.Ptr(); |
|
100 if ( ! IsFilterUnicode(event->iScanCode) ) |
|
101 { |
|
102 if ( !iContext->CompositionFieldStringLength() ) // if no chars |
|
103 { |
|
104 iContext->SendEventToVkbControl(EVkbEventStandby2Composition,NULL); |
|
105 } |
|
106 |
|
107 return EFalse; |
|
108 } |
|
109 else |
|
110 { |
|
111 if ( !iContext->CompositionFieldStringLength() ) // if no chars |
|
112 { |
|
113 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateStandbycn()); |
|
114 iContext->ForceEditGainFocus(EInputContextFieldGetFocus); |
|
115 return SendKey(aEventData); |
|
116 } |
|
117 return ETrue; |
|
118 } |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CAknFepVkbUiStateCompositionWithChars::HandleBackEvent |
|
123 // (other items were commented in a header). |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 TBool CAknFepVkbUiStateCompositionWithChars::HandleBackEvent(TInt /*aEventType*/, |
|
127 const TDesC& /*aEventData*/) |
|
128 { |
|
129 return EFalse; // If no chars, needn't send to composition again |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CAknFepVkbUiStateCompositionWithChars::HandleEnterSpaceEvent |
|
134 // (other items were commented in a header). |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 TBool CAknFepVkbUiStateCompositionWithChars::HandleEnterSpaceEvent(TInt aEventType, |
|
138 const TDesC& aEventData) |
|
139 { |
|
140 TInt layoutType = iContext->RequestData(EAknFepDataTypeIMLayout); |
|
141 |
|
142 if ( !iContext->CompositionFieldStringLength() ) // If no chars |
|
143 { |
|
144 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateStandbycn()); |
|
145 iContext->ForceEditGainFocus(EInputContextFieldGetFocus); |
|
146 return SendKey(aEventData); |
|
147 } |
|
148 else // If have chars |
|
149 { |
|
150 if ( aEventType == EVkbEventKeyEnter) |
|
151 { |
|
152 return EFalse; |
|
153 } |
|
154 if ( ( layoutType == EAknFepVkbImCnZhuyin || layoutType == EAknFepVkbImCnStroke || |
|
155 layoutType == EAknFepVkbImCnPinyin || layoutType == EAknFepVkbImCnCangjie) && |
|
156 ( aEventType == EVkbEventKeySpace)) |
|
157 { |
|
158 return EFalse; |
|
159 } |
|
160 else{ |
|
161 return ETrue; |
|
162 } |
|
163 } |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // CAknFepVkbUiStateCompositionWithChars::HandleTabEvent |
|
168 // (other items were commented in a header). |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 TBool CAknFepVkbUiStateCompositionWithChars::HandleTabEvent(TInt /*aEventType*/, |
|
172 const TDesC& aEventData) |
|
173 { |
|
174 TInt layoutType = iContext->RequestData(EAknFepDataTypeIMLayout); |
|
175 |
|
176 if ( !iContext->CompositionFieldStringLength() ) // If no chars |
|
177 { |
|
178 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateStandbycn()); |
|
179 iContext->ForceEditGainFocus(EInputContextFieldGetFocus); |
|
180 return SendKey(aEventData); |
|
181 } |
|
182 return ETrue; |
|
183 } |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CAknFepVkbUiStateCompositionNoChars::HandleArrowKeyEvent |
|
187 // (other items were commented in a header). |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 TBool CAknFepVkbUiStateCompositionWithChars::HandleArrowKeyEvent(TInt /*aEventType*/, |
|
191 const TDesC& aEventData) |
|
192 { |
|
193 return EFalse; |
|
194 } |
|
195 // End Of File |