|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Provides the TAknFepInputStateEntryZhuyinStrokeBase methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #include "AknFepUiInputStateEntryZhuyinStrokeBase.h" |
|
31 |
|
32 #include "AknFepUIManagerStateInterface.h" //MAknFepUIManagerStateInterface |
|
33 #include "AknFepUiCtrlContainerChinese.h" |
|
34 #include "AknFepManagerUIInterface.h" //MAknFepManagerUIInterface |
|
35 #include "AknFepUICtrlCandidatePane.h" |
|
36 #include "AknFepUICtrlInputPane.h" |
|
37 #include "AknFepManager.h" |
|
38 |
|
39 #include <PtiEngine.h> //CPtiEngine |
|
40 #include <e32keys.h> //keys |
|
41 #include <avkon.rsg> |
|
42 |
|
43 TAknFepInputStateEntryZhuyinStrokeBase::TAknFepInputStateEntryZhuyinStrokeBase( |
|
44 MAknFepUIManagerStateInterface* aOwner, |
|
45 MAknFepUICtrlContainerChinese* aUIContainer) |
|
46 :TAknFepInputStateChineseBase(aOwner, aUIContainer) |
|
47 { |
|
48 iState = EEntry; |
|
49 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
50 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
51 MAknFepUICtrlCandidatePane* candidatePane = uiContainer->CandidatePane(); |
|
52 TBool multiplePages = ptiengine->MoreCandidatePages(); |
|
53 TInt bufLength = ptiengine->CandidatePage().Length(); |
|
54 TBool showHorizontalScrollArrows = multiplePages || bufLength > 1; |
|
55 |
|
56 uiContainer->ShowHorizontalScrollArrows(showHorizontalScrollArrows); |
|
57 uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
58 uiContainer->FocusCandidatePane(EFalse); |
|
59 uiContainer->FocusCandidatePane(ETrue); |
|
60 candidatePane->SetHighlighted(ETrue); |
|
61 candidatePane->ShowCandidateOrdinals(EFalse);// |
|
62 candidatePane->SelectFirst(); |
|
63 iUseforResourcechange = EFalse; |
|
64 } |
|
65 void TAknFepInputStateEntryZhuyinStrokeBase::HandleCommandL(TInt /*aCommandId*/) |
|
66 { |
|
67 RefreshUI(iUseforResourcechange); |
|
68 } |
|
69 |
|
70 TBool TAknFepInputStateEntryZhuyinStrokeBase::HandleKeyL(TInt aKey, TKeyPressLength aLength) |
|
71 { |
|
72 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
73 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
74 |
|
75 if(aKey == EKeyBackspace) |
|
76 { |
|
77 if (iOwner->PtiEngine()->DeleteKeyPress().Length()) |
|
78 { |
|
79 TBool multiplePages = ptiengine->MoreCandidatePages(); |
|
80 TInt bufLength = iOwner->PtiEngine()->CandidatePage().Length(); |
|
81 TBool showHorizontalScrollArrows = multiplePages || bufLength>1; |
|
82 |
|
83 uiContainer->ShowHorizontalScrollArrows(showHorizontalScrollArrows); |
|
84 uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
85 iUseforResourcechange = EFalse; |
|
86 RefreshUI(EFalse); |
|
87 SetInputPaneToneMark(); |
|
88 } |
|
89 else |
|
90 { |
|
91 iOwner->FepMan()->TryCloseUiL(); |
|
92 if (aLength == ELongKeyPress) |
|
93 { |
|
94 iOwner->FepMan()->SetLongClearAfterCloseUI(ETrue); |
|
95 } |
|
96 } |
|
97 } |
|
98 else if((aLength == EShortKeyPress) && iOwner->IsValidChineseInputKey(aKey)) |
|
99 { |
|
100 iOwner->FepMan()->SetCcpuFlag(CAknFepManager::ECcpuStateIgnoreStarUp); |
|
101 |
|
102 ptiengine->AppendKeyPress((TPtiKey)aKey); |
|
103 |
|
104 TBool multiplePages = ptiengine->MoreCandidatePages(); |
|
105 TInt bufLength = iOwner->PtiEngine()->CandidatePage().Length(); |
|
106 TBool showHorizontalScrollArrows = multiplePages || bufLength>1; |
|
107 |
|
108 uiContainer->ShowHorizontalScrollArrows(showHorizontalScrollArrows); |
|
109 uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
110 SetInputPaneToneMark(); |
|
111 iUseforResourcechange = EFalse; |
|
112 RefreshUI(EFalse); |
|
113 } |
|
114 else if(aKey == EKeyDownArrow) |
|
115 { |
|
116 ptiengine->NextCandidatePage(); |
|
117 iUseforResourcechange = EFalse; |
|
118 RefreshUI(EFalse); |
|
119 } |
|
120 else if(aKey == EKeyUpArrow) |
|
121 { |
|
122 ptiengine->PreviousCandidatePage(); |
|
123 iUseforResourcechange = EFalse; |
|
124 RefreshUI(EFalse); |
|
125 } |
|
126 else if(aKey == EKeyOK || aKey == EKeyRightArrow || aKey == EKeyLeftArrow) |
|
127 { |
|
128 iOwner->ChangeState(ECandidate); |
|
129 return EFalse; |
|
130 } |
|
131 return ETrue; |
|
132 } |
|
133 |
|
134 void TAknFepInputStateEntryZhuyinStrokeBase::RefreshUI(TBool aOrdinals) |
|
135 { |
|
136 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
137 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
138 MAknFepUICtrlInputPane* inputPane = uiContainer->InputPane(); |
|
139 |
|
140 // Universal layout |
|
141 TPoint baseLine = TPoint(0,0); |
|
142 TInt height = 0; |
|
143 TInt ascent = 0; |
|
144 |
|
145 TRAPD(ret,iOwner->FepMan()->GetScreenCoordinatesL(baseLine,height,ascent)); |
|
146 if (ret == KErrNone) |
|
147 { |
|
148 uiContainer->SetContainerPosition(baseLine, height); |
|
149 } |
|
150 TPtrC candidates = ptiengine->CandidatePage(); |
|
151 uiContainer->CandidatePane()->SetCandidateBuffer(candidates); |
|
152 uiContainer->Enable(ETrue); |
|
153 if (aOrdinals) |
|
154 { |
|
155 uiContainer->CandidatePane()->ShowCandidateOrdinals(ETrue); |
|
156 } |
|
157 else |
|
158 { |
|
159 uiContainer->CandidatePane()->ShowCandidateOrdinals(EFalse); |
|
160 } |
|
161 |
|
162 TPtrC ptr = ptiengine->GetPhoneticSpelling(1); |
|
163 inputPane->SetText(ptr); |
|
164 } |
|
165 |
|
166 void TAknFepInputStateEntryZhuyinStrokeBase::SetInputPaneToneMark() |
|
167 { |
|
168 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
169 MAknFepUICtrlInputPane* inputPane = UIContainer()->InputPane(); |
|
170 |
|
171 TText toneMark; |
|
172 TBool toneMarkEntered = ptiengine->ToneMark(toneMark); |
|
173 TBuf<1> buf; |
|
174 if(toneMarkEntered) |
|
175 { |
|
176 buf.Append(toneMark); |
|
177 } |
|
178 inputPane->SetToneMark(buf); |
|
179 } |
|
180 |
|
181 void TAknFepInputStateEntryZhuyinStrokeBase::KeyTimerExpired() |
|
182 { |
|
183 } |
|
184 |
|
185 void TAknFepInputStateEntryZhuyinStrokeBase::InitializeStateL(void) |
|
186 { |
|
187 iOwner->FepMan()->UpdateCbaL(R_AVKON_SOFTKEYS_EMPTY); |
|
188 } |
|
189 // End of file |