author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:34:44 +0300 | |
branch | RCL_3 |
changeset 50 | 5a1685599b76 |
parent 44 | ecbabf52600f |
child 56 | 8152b1f1763a |
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; |
|
136 |
if ( DataMgr()->IsUpdate() ) |
|
137 |
{ |
|
138 |
DataMgr()->SetUpdate( EFalse ); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
139 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
140 |
CSplitItutUiLayout* itutLayout = |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
141 |
static_cast<CSplitItutUiLayout*>( LayoutContext()->UiLayout()); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
142 |
// Get the screen rect |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
143 |
TRect screenRect = DataMgr()->screenSize(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
144 |
// If the screen is in portrait mode |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
145 |
if ( screenRect.Width() < screenRect.Height()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
146 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
147 |
itutLayout->SizeChanged( NULL ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
148 |
} |
44 | 149 |
|
150 |
iCurrentState->OnEntryL(); |
|
151 |
||
152 |
//redraw layout immediately to minimize flicker |
|
153 |
itutLayout->DisableLayoutDrawing( EFalse ); |
|
154 |
itutLayout->Draw(); |
|
155 |
} |
|
156 |
else |
|
157 |
{ |
|
158 |
iCurrentState->OnEntryL(); |
|
159 |
} |
|
160 |
} |
|
161 |
||
162 |
// --------------------------------------------------------------------------- |
|
163 |
// CWesternSplitItutUiMgr::ActivateUiL |
|
164 |
// --------------------------------------------------------------------------- |
|
165 |
// |
|
166 |
void CWesternSplitItutUiMgr::ActivateUiL() |
|
167 |
{ |
|
168 |
if (iCurrentState) |
|
169 |
{ |
|
170 |
iCurrentState->OnEntryL(); |
|
171 |
} |
|
172 |
else |
|
173 |
{ |
|
174 |
SetCurrentStateL(CSplitItutUiMgrBase::EStateWesternStandby); |
|
175 |
} |
|
176 |
} |
|
177 |
||
178 |
// --------------------------------------------------------------------------- |
|
179 |
// CWesternSplitItutUiMgr::DeactivateUI |
|
180 |
// --------------------------------------------------------------------------- |
|
181 |
// |
|
182 |
void CWesternSplitItutUiMgr::DeactivateUI() |
|
183 |
{ |
|
184 |
if (iCurrentState) |
|
185 |
{ |
|
186 |
iCurrentState->OnExit(); |
|
187 |
} |
|
188 |
} |
|
189 |
||
190 |
// --------------------------------------------------------------------------- |
|
191 |
// CWesternSplitItutUiMgr::HandleCommandL |
|
192 |
// --------------------------------------------------------------------------- |
|
193 |
// |
|
194 |
TInt CWesternSplitItutUiMgr::HandleCommandL(TInt aCmd, TUint8* aData) |
|
195 |
{ |
|
196 |
if ( aCmd == ECmdPenInputFingerMatchSelection || |
|
197 |
aCmd == ECmdPenInputFingerSpelling ) |
|
198 |
{ |
|
199 |
if (!(*(reinterpret_cast<TBool*>(aData)))) |
|
200 |
{ |
|
201 |
// state not on |
|
202 |
SetCurrentStateL(CSplitItutUiMgrBase::EStateWesternStandby); |
|
203 |
||
204 |
return KErrNone; |
|
205 |
} |
|
206 |
} |
|
207 |
||
208 |
switch (aCmd) |
|
209 |
{ |
|
210 |
case ECmdPenInputCase: |
|
211 |
{ |
|
212 |
if (iCurrentState) |
|
213 |
{ |
|
214 |
iLayoutContext->DataMgr()->SetCase(*((TUint*) aData)); |
|
215 |
return KErrNone; |
|
216 |
} |
|
217 |
} |
|
218 |
case ECmdPenInputFingerSpelling: |
|
219 |
{ |
|
220 |
SetCurrentStateL(CSplitItutUiMgrBase::EStateSpelling); |
|
221 |
return KErrNone; |
|
222 |
} |
|
223 |
// Modify warning |
|
224 |
//break; |
|
225 |
default: |
|
226 |
break; |
|
227 |
} |
|
228 |
||
229 |
if (iCurrentState) |
|
230 |
{ |
|
231 |
return iCurrentState->HandleCommandL(aCmd, aData); |
|
232 |
} |
|
233 |
||
234 |
return KErrNotSupported; |
|
235 |
} |
|
236 |
||
237 |
// End Of File |