|
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: drop-down list control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "peninputsplititutwesternuimgr.h" |
|
20 #include "peninputsplititutdata.h" |
|
21 #include "peninputsplititutdatamgr.h" |
|
22 #include "peninputsplititutwesternuistatenonpredict.h" |
|
23 #include "peninputsplititutwesternuistatespelling.h" |
|
24 #include "peninputsplititutlayoutcontext.h" |
|
25 #include "peninputsplititutlayout.h" |
|
26 #include "peninputsplititutwindowmanager.h" |
|
27 |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS ============================= |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // CWesternSplitItutUiMgr::NewL |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 CWesternSplitItutUiMgr* CWesternSplitItutUiMgr::NewL(MSplitItutLayoutContext* aContext, |
|
36 CSplitItutDataMgr* aDataMgr, |
|
37 CSplitItutWindowManager* aUiManager) |
|
38 { |
|
39 CWesternSplitItutUiMgr* self = new (ELeave) CWesternSplitItutUiMgr(aContext, aDataMgr,aUiManager); |
|
40 CleanupStack::PushL(self); |
|
41 self->ConstructL(); |
|
42 CleanupStack::Pop(self); |
|
43 return self; |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // CWesternSplitItutUiMgr::NewL |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CWesternSplitItutUiMgr::~CWesternSplitItutUiMgr() |
|
51 { |
|
52 if (iCurrentState) |
|
53 { |
|
54 iCurrentState->OnExit(); |
|
55 } |
|
56 |
|
57 delete iNormalState; |
|
58 delete iSpellState; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CWesternSplitItutUiMgr::CWesternSplitItutUiMgr |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CWesternSplitItutUiMgr::CWesternSplitItutUiMgr(MSplitItutLayoutContext* aContext, |
|
66 CSplitItutDataMgr* aDataMgr, |
|
67 CSplitItutWindowManager* aUiManager) |
|
68 :CSplitItutUiMgrBase(aContext, aDataMgr,aUiManager) |
|
69 { |
|
70 iDataMgr = aDataMgr; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CWesternSplitItutUiMgr::ConstructL |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 void CWesternSplitItutUiMgr::ConstructL() |
|
78 { |
|
79 CSplitItutUiMgrBase::ConstructL(); |
|
80 |
|
81 iNormalState = CWesternSplitItutUiStateNonPredict::NewL(this); |
|
82 iSpellState = CWesternSplitItutUiStateSpelling::NewL(this); |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CWesternSplitItutUiMgr::HandleCtrlEventL |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 TBool CWesternSplitItutUiMgr::HandleCtrlEventL(TInt aEventType, |
|
90 CFepUiBaseCtrl* aCtrl, |
|
91 const TDesC& aEventData) |
|
92 { |
|
93 if (!iCurrentState) |
|
94 { |
|
95 return EFalse; |
|
96 } |
|
97 |
|
98 return iCurrentState->HandleCtrlEventL(aEventType, aCtrl, aEventData); |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CWesternSplitItutUiMgr::SetCurrentStateL |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 void CWesternSplitItutUiMgr::SetCurrentStateL(TUiState aNewState) |
|
106 { |
|
107 if (iCurrentState && aNewState == iCurrentState->StateType()) |
|
108 { |
|
109 return; |
|
110 } |
|
111 |
|
112 CSplitItutUiStateBase* newstate = NULL; |
|
113 |
|
114 switch (aNewState) |
|
115 { |
|
116 case CSplitItutUiMgrBase::EStateWesternStandby: |
|
117 { |
|
118 newstate = iNormalState; |
|
119 } |
|
120 break; |
|
121 case CSplitItutUiMgrBase::EStateSpelling: |
|
122 { |
|
123 newstate = iSpellState; |
|
124 } |
|
125 break; |
|
126 default: |
|
127 return; |
|
128 } |
|
129 |
|
130 if (iCurrentState) |
|
131 { |
|
132 iCurrentState->OnExit(); |
|
133 } |
|
134 |
|
135 iCurrentState = newstate; |
|
136 if ( DataMgr()->IsUpdate() ) |
|
137 { |
|
138 DataMgr()->SetUpdate( EFalse ); |
|
139 CSplitItutUiLayout* itutLayout = |
|
140 static_cast<CSplitItutUiLayout*>( LayoutContext()->UiLayout() ); |
|
141 itutLayout->SizeChanged( NULL ); |
|
142 |
|
143 iCurrentState->OnEntryL(); |
|
144 |
|
145 //redraw layout immediately to minimize flicker |
|
146 itutLayout->DisableLayoutDrawing( EFalse ); |
|
147 itutLayout->Draw(); |
|
148 } |
|
149 else |
|
150 { |
|
151 iCurrentState->OnEntryL(); |
|
152 } |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CWesternSplitItutUiMgr::ActivateUiL |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 void CWesternSplitItutUiMgr::ActivateUiL() |
|
160 { |
|
161 if (iCurrentState) |
|
162 { |
|
163 iCurrentState->OnEntryL(); |
|
164 } |
|
165 else |
|
166 { |
|
167 SetCurrentStateL(CSplitItutUiMgrBase::EStateWesternStandby); |
|
168 } |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // CWesternSplitItutUiMgr::DeactivateUI |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 void CWesternSplitItutUiMgr::DeactivateUI() |
|
176 { |
|
177 if (iCurrentState) |
|
178 { |
|
179 iCurrentState->OnExit(); |
|
180 } |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // CWesternSplitItutUiMgr::HandleCommandL |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 TInt CWesternSplitItutUiMgr::HandleCommandL(TInt aCmd, TUint8* aData) |
|
188 { |
|
189 if ( aCmd == ECmdPenInputFingerMatchSelection || |
|
190 aCmd == ECmdPenInputFingerSpelling ) |
|
191 { |
|
192 if (!(*(reinterpret_cast<TBool*>(aData)))) |
|
193 { |
|
194 // state not on |
|
195 SetCurrentStateL(CSplitItutUiMgrBase::EStateWesternStandby); |
|
196 |
|
197 return KErrNone; |
|
198 } |
|
199 } |
|
200 |
|
201 switch (aCmd) |
|
202 { |
|
203 case ECmdPenInputCase: |
|
204 { |
|
205 if (iCurrentState) |
|
206 { |
|
207 iLayoutContext->DataMgr()->SetCase(*((TUint*) aData)); |
|
208 return KErrNone; |
|
209 } |
|
210 } |
|
211 case ECmdPenInputFingerSpelling: |
|
212 { |
|
213 SetCurrentStateL(CSplitItutUiMgrBase::EStateSpelling); |
|
214 return KErrNone; |
|
215 } |
|
216 // Modify warning |
|
217 //break; |
|
218 default: |
|
219 break; |
|
220 } |
|
221 |
|
222 if (iCurrentState) |
|
223 { |
|
224 return iCurrentState->HandleCommandL(aCmd, aData); |
|
225 } |
|
226 |
|
227 return KErrNotSupported; |
|
228 } |
|
229 |
|
230 // End Of File |