21
|
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 <AknFepGlobalEnums.h>
|
|
20 |
#include <peninputsplititutnew.rsg>
|
|
21 |
#include <peninputlayoutmultilineicf.h>
|
|
22 |
#include <StringLoader.h>
|
|
23 |
#include <peninputcommonbutton.h>
|
|
24 |
#include <peninputlayout.h>
|
|
25 |
#include <peninputcmd.h>
|
|
26 |
#include <peninputlabel.h>
|
|
27 |
|
|
28 |
#include "peninputsplititutwesternuistatespelling.h"
|
|
29 |
#include "peninputsplititutuimgrbase.h"
|
|
30 |
#include "peninputsplititutdatamgr.h"
|
|
31 |
#include "peninputsplititutlayoutcontext.h"
|
|
32 |
#include "peninputsplititutconverter.h"
|
|
33 |
#include "peninputsplititutlayout.h"
|
|
34 |
#include "peninputcommonbgctrl.h"
|
|
35 |
#include "peninputsplititutwindowmanager.h"
|
|
36 |
#include "peninputsplititutwindow.h"
|
|
37 |
|
|
38 |
CWesternSplitItutUiStateSpelling* CWesternSplitItutUiStateSpelling::NewL(CSplitItutUiMgrBase* aOwner)
|
|
39 |
{
|
|
40 |
CWesternSplitItutUiStateSpelling* self = new (ELeave) CWesternSplitItutUiStateSpelling(aOwner);
|
|
41 |
CleanupStack::PushL(self);
|
|
42 |
self->ConstructL();
|
|
43 |
CleanupStack::Pop(self);
|
|
44 |
return self;
|
|
45 |
}
|
|
46 |
|
|
47 |
CWesternSplitItutUiStateSpelling::~CWesternSplitItutUiStateSpelling()
|
|
48 |
{
|
|
49 |
}
|
|
50 |
|
|
51 |
CWesternSplitItutUiStateSpelling::CWesternSplitItutUiStateSpelling(CSplitItutUiMgrBase* aOwner)
|
|
52 |
:CSplitItutUiStateBase(aOwner)
|
|
53 |
{
|
|
54 |
iICF = static_cast<CFepLayoutMultiLineIcf*>(iOwner->LayoutContext()->Control(ECtrlIdICF));
|
|
55 |
}
|
|
56 |
|
|
57 |
void CWesternSplitItutUiStateSpelling::ConstructL()
|
|
58 |
{
|
|
59 |
CSplitItutUiStateBase::ConstructL();
|
|
60 |
}
|
|
61 |
|
|
62 |
void CWesternSplitItutUiStateSpelling::CreateTextBtnIfNeededL(CAknFepCtrlCommonButton*& aBtn,
|
|
63 |
TInt aCtrlId,
|
|
64 |
TInt aCtrlPos,
|
|
65 |
TInt aTextResId,
|
|
66 |
TAknTextLineLayout aTextFormat)
|
|
67 |
{
|
|
68 |
if (!aBtn)
|
|
69 |
{
|
|
70 |
aBtn = CAknFepCtrlCommonButton::NewL(iOwner->LayoutContext()->UiLayout(),
|
|
71 |
aCtrlId,
|
|
72 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
73 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
74 |
KAknsIIDQsnFrFunctionButtonInactive);
|
|
75 |
aBtn->SetRect(TItutDataConverter::AnyToRect(iOwner->DataMgr()->RequestData(aCtrlPos)));
|
|
76 |
HBufC* btntext = StringLoader::LoadLC(aTextResId);
|
|
77 |
aBtn->SetTextFormat(aTextFormat);
|
|
78 |
aBtn->SetTextL(*btntext);
|
|
79 |
aBtn->SetTextColorIndex( EAknsCIQsnTextColorsCG65 );
|
|
80 |
CleanupStack::PopAndDestroy(btntext);
|
|
81 |
iOwner->LayoutContext()->UiLayout()->AddControlL(aBtn);
|
|
82 |
}
|
|
83 |
}
|
|
84 |
|
|
85 |
void CWesternSplitItutUiStateSpelling::OnEntryL()
|
|
86 |
{
|
|
87 |
TInt keypadResId = KInvalidResId;
|
|
88 |
switch (iOwner->DataMgr()->InputMode())
|
|
89 |
{
|
|
90 |
case ENumber:
|
|
91 |
keypadResId = R_FINGER_INPUT_KEYPAD_NUMBER;
|
|
92 |
break;
|
|
93 |
case ELatin:
|
|
94 |
keypadResId = iOwner->DataMgr()->KeypadResourceId();
|
|
95 |
break;
|
|
96 |
default:
|
|
97 |
break;
|
|
98 |
}
|
|
99 |
//hide bubble in the first place.
|
|
100 |
iICF->HideBubble();
|
|
101 |
|
|
102 |
// update resource id of keypad
|
|
103 |
iOwner->DataMgr()->NotifyChangeControlLayout(
|
|
104 |
MItutPropertySubscriber::EItutPropertyKeypadResourceId, keypadResId);
|
|
105 |
|
|
106 |
// hide not needed controls
|
|
107 |
//iOwner->LayoutContext()->Control(ECtrlIdArrowLeft)->Hide(ETrue);
|
|
108 |
//iOwner->LayoutContext()->Control(ECtrlIdArrowRight)->Hide(ETrue);
|
|
109 |
iOwner->LayoutContext()->ShowArrowBtn( EBtnArrowLeft | EBtnArrowRight );
|
|
110 |
iOwner->LayoutContext()->Control(ECtrlIdOptions)->Hide(ETrue);
|
|
111 |
iOwner->LayoutContext()->Control(ECtrlIdClose)->Hide(ETrue);
|
|
112 |
|
|
113 |
TAknTextLineLayout btntextformat = TItutDataConverter::AnyToTextLine(
|
|
114 |
iOwner->DataMgr()->RequestData(EBtnTextLine));
|
|
115 |
CreateTextBtnIfNeededL(iOk, ECtrlIdOkBtn, EItutPosOk, R_PENINPUT_FINGER_OK, btntextformat);
|
|
116 |
iOk->SetReady(ETrue);
|
|
117 |
iOk->Hide(EFalse);
|
|
118 |
iICF->IsEmpty() ? iOk->SetDimmed(ETrue) : iOk->SetDimmed(EFalse);
|
|
119 |
|
|
120 |
CreateTextBtnIfNeededL(iCancel, ECtrlIdCancelBtn, EItutPosCancel,
|
|
121 |
R_PENINPUT_FINGER_CANCEL, btntextformat);
|
|
122 |
iCancel->SetReady(ETrue);
|
|
123 |
iCancel->Hide(EFalse);
|
|
124 |
|
|
125 |
iOwner->DataMgr()->SetSpellMode(ETrue);
|
|
126 |
iICF->SetLineSeparatorAfterPrompt(ETrue);
|
|
127 |
|
|
128 |
ReCalcLayoutL();
|
|
129 |
|
|
130 |
iICF->Hide( EFalse );
|
|
131 |
iOwner->DataMgr()->SetUpdate(ETrue);
|
|
132 |
}
|
|
133 |
|
|
134 |
void CWesternSplitItutUiStateSpelling::OnExit()
|
|
135 |
{
|
|
136 |
iICF->HideBubble(); //Hide bubble when full screen ITUT closed
|
|
137 |
iOk->Hide(ETrue);
|
|
138 |
iCancel->Hide(ETrue);
|
|
139 |
iOwner->DataMgr()->SetSpellMode(EFalse);
|
|
140 |
iICF->Hide( ETrue );
|
|
141 |
iOwner->LayoutContext()->ShowArrowBtn(0);
|
|
142 |
}
|
|
143 |
|
|
144 |
CSplitItutUiMgrBase::TUiState CWesternSplitItutUiStateSpelling::StateType()
|
|
145 |
{
|
|
146 |
return CSplitItutUiMgrBase::EStateSpelling;
|
|
147 |
}
|
|
148 |
|
|
149 |
TInt CWesternSplitItutUiStateSpelling::HandleCommandL(TInt aCmd, TUint8* /*aData*/)
|
|
150 |
{
|
|
151 |
switch (aCmd)
|
|
152 |
{
|
|
153 |
case EItutExtCmdSizeChanged:
|
|
154 |
{
|
|
155 |
ReCalcLayoutL();
|
|
156 |
return KErrNone;
|
|
157 |
}
|
|
158 |
|
|
159 |
case EItutCmdCheckIcfEmpty:
|
|
160 |
{
|
|
161 |
iICF->IsEmpty() ? iOk->SetDimmed(ETrue) : iOk->SetDimmed(EFalse);
|
|
162 |
return KErrNone;
|
|
163 |
}
|
|
164 |
default:
|
|
165 |
break;
|
|
166 |
}
|
|
167 |
|
|
168 |
return KErrNotSupported;
|
|
169 |
}
|
|
170 |
|
|
171 |
TBool CWesternSplitItutUiStateSpelling::HandleCtrlEventL(TInt aEventType,
|
|
172 |
CFepUiBaseCtrl* aCtrl,
|
|
173 |
const TDesC& /*aEventData*/)
|
|
174 |
{
|
|
175 |
switch (aEventType)
|
|
176 |
{
|
|
177 |
case EEventButtonUp:
|
|
178 |
{
|
|
179 |
TInt ctrlid = aCtrl->ControlId();
|
|
180 |
|
|
181 |
if (ctrlid != ECtrlIdOkBtn && ctrlid != ECtrlIdCancelBtn)
|
|
182 |
{
|
|
183 |
return EFalse;
|
|
184 |
}
|
|
185 |
|
|
186 |
TBuf<4> buf;
|
|
187 |
TBool exitbyok = (ctrlid == ECtrlIdOkBtn);
|
|
188 |
buf.Append(reinterpret_cast<TText*>(&exitbyok), sizeof(TBool)/sizeof(TText));
|
|
189 |
|
|
190 |
iOwner->LayoutContext()->UiLayout()->SignalOwner(ESignalExitSpellMode, buf);
|
|
191 |
return ETrue;
|
|
192 |
}
|
|
193 |
default:
|
|
194 |
break;
|
|
195 |
}
|
|
196 |
|
|
197 |
return EFalse;
|
|
198 |
}
|
|
199 |
|
|
200 |
void CWesternSplitItutUiStateSpelling::ReCalcLayoutL()
|
|
201 |
{
|
|
202 |
// Update "OK" and "Cancel" position
|
|
203 |
TAknTextLineLayout btntextformat = TItutDataConverter::AnyToTextLine(
|
|
204 |
iOwner->DataMgr()->RequestData(EBtnTextLine));
|
|
205 |
TRect btnrect = TItutDataConverter::AnyToRect(iOwner->DataMgr()->RequestData(EItutPosOk));
|
|
206 |
iOk->SetTextFormat(btntextformat);
|
|
207 |
iOk->SizeChanged(btnrect, btnrect, ETrue);
|
|
208 |
|
|
209 |
btnrect = TItutDataConverter::AnyToRect(iOwner->DataMgr()->RequestData(EItutPosCancel));
|
|
210 |
iCancel->SetTextFormat(btntextformat);
|
|
211 |
iCancel->SizeChanged(btnrect, btnrect, ETrue);
|
|
212 |
|
|
213 |
// Update key position
|
|
214 |
iOwner->LayoutContext()->ApplyVariantLafDataForSpellL();
|
|
215 |
}
|
|
216 |
|
|
217 |
// End Of File
|