author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:55:58 +0300 | |
branch | RCL_3 |
changeset 56 | 8152b1f1763a |
parent 50 | 5a1685599b76 |
permissions | -rw-r--r-- |
44 | 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; |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
136 |
if(DataMgr()->IsUpdate()) |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
137 |
{ |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
138 |
DataMgr()->SetUpdate(EFalse); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
139 |
CSplitItutUiLayout* itutLayout = |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
140 |
static_cast<CSplitItutUiLayout*>( LayoutContext()->UiLayout() ); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
141 |
itutLayout->SizeChanged( NULL ); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
142 |
} |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
143 |
iCurrentState->OnEntryL(); |
44 | 144 |
} |
145 |
||
146 |
// --------------------------------------------------------------------------- |
|
147 |
// CWesternSplitItutUiMgr::ActivateUiL |
|
148 |
// --------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
void CWesternSplitItutUiMgr::ActivateUiL() |
|
151 |
{ |
|
152 |
if (iCurrentState) |
|
153 |
{ |
|
154 |
iCurrentState->OnEntryL(); |
|
155 |
} |
|
156 |
else |
|
157 |
{ |
|
158 |
SetCurrentStateL(CSplitItutUiMgrBase::EStateWesternStandby); |
|
159 |
} |
|
160 |
} |
|
161 |
||
162 |
// --------------------------------------------------------------------------- |
|
163 |
// CWesternSplitItutUiMgr::DeactivateUI |
|
164 |
// --------------------------------------------------------------------------- |
|
165 |
// |
|
166 |
void CWesternSplitItutUiMgr::DeactivateUI() |
|
167 |
{ |
|
168 |
if (iCurrentState) |
|
169 |
{ |
|
170 |
iCurrentState->OnExit(); |
|
171 |
} |
|
172 |
} |
|
173 |
||
174 |
// --------------------------------------------------------------------------- |
|
175 |
// CWesternSplitItutUiMgr::HandleCommandL |
|
176 |
// --------------------------------------------------------------------------- |
|
177 |
// |
|
178 |
TInt CWesternSplitItutUiMgr::HandleCommandL(TInt aCmd, TUint8* aData) |
|
179 |
{ |
|
180 |
if ( aCmd == ECmdPenInputFingerMatchSelection || |
|
181 |
aCmd == ECmdPenInputFingerSpelling ) |
|
182 |
{ |
|
183 |
if (!(*(reinterpret_cast<TBool*>(aData)))) |
|
184 |
{ |
|
185 |
// state not on |
|
186 |
SetCurrentStateL(CSplitItutUiMgrBase::EStateWesternStandby); |
|
187 |
||
188 |
return KErrNone; |
|
189 |
} |
|
190 |
} |
|
191 |
||
192 |
switch (aCmd) |
|
193 |
{ |
|
194 |
case ECmdPenInputCase: |
|
195 |
{ |
|
196 |
if (iCurrentState) |
|
197 |
{ |
|
198 |
iLayoutContext->DataMgr()->SetCase(*((TUint*) aData)); |
|
199 |
return KErrNone; |
|
200 |
} |
|
201 |
} |
|
202 |
case ECmdPenInputFingerSpelling: |
|
203 |
{ |
|
204 |
SetCurrentStateL(CSplitItutUiMgrBase::EStateSpelling); |
|
205 |
return KErrNone; |
|
206 |
} |
|
207 |
// Modify warning |
|
208 |
//break; |
|
209 |
default: |
|
210 |
break; |
|
211 |
} |
|
212 |
||
213 |
if (iCurrentState) |
|
214 |
{ |
|
215 |
return iCurrentState->HandleCommandL(aCmd, aData); |
|
216 |
} |
|
217 |
||
218 |
return KErrNotSupported; |
|
219 |
} |
|
220 |
||
221 |
// End Of File |