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: common layout window for UI interface of VKB and HWR
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// System includes
|
|
20 |
#include <coemain.h>
|
|
21 |
|
|
22 |
#include <AknFepGlobalEnums.h>
|
|
23 |
#include <aknfeppeninputenums.h>
|
|
24 |
#include <peninputpluginutils.h>
|
|
25 |
#include <peninputcmdparam.h> // Use global signal
|
|
26 |
#include <peninputinputcontextfield.h>
|
|
27 |
#include <peninputeventbutton.h>
|
|
28 |
#include <peninputmultimodebutton.h>
|
|
29 |
#include <peninputdragbutton.h>
|
|
30 |
#include <peninputlayoutchoicelist.h>
|
|
31 |
#include <peninputlayout.h>
|
|
32 |
#include <peninputrangebar.h>
|
|
33 |
#include <bautils.h>
|
|
34 |
#include <AknIconUtils.h>
|
|
35 |
#include <AknLayoutDef.h>
|
|
36 |
#include <AknUtils.h>
|
|
37 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
38 |
#include <AknsUtils.h>
|
|
39 |
#include <peninputlayoutmultilineicf.h>
|
|
40 |
#include <peninputrepeatbutton.h>
|
|
41 |
|
|
42 |
// User includes
|
|
43 |
#include "peninputdataconverter.h"
|
|
44 |
#include "peninputrangebarinfo.h"
|
|
45 |
#include "peninputlayoutwindow.h"
|
|
46 |
#include "peninputclientlayoutinfo.h"
|
|
47 |
#include "peninputdataprovider.h"
|
|
48 |
#include "peninputlayoutcontext.h"
|
|
49 |
#include "peninputvkbctrlext.h"
|
|
50 |
#include "peninputnumerickeymappingmgr.h"
|
|
51 |
|
|
52 |
// Constants
|
|
53 |
const TInt KIntLengthForByte = 8;
|
|
54 |
const TInt KPeninputLayoutWindowRegionCount = 8;
|
|
55 |
const TInt KPeninputLayoutWindowUnitWidth = 12;
|
|
56 |
const TInt KInvalidIndex = -1;
|
|
57 |
|
|
58 |
const TInt32 KInvalidResId = -1;
|
|
59 |
const TInt KInvalidImg = -1 ;
|
|
60 |
const TUint32 KDefaultTextColor = 0x000000;
|
|
61 |
const TUint32 KDefaultShadowTextColor = 0xffffff;
|
|
62 |
const TInt KNotSupportSkin = -1;
|
|
63 |
|
|
64 |
const TInt KIntSizeToInt16 = 2;
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
// ======== MEMBER FUNCTIONS ========
|
|
69 |
|
|
70 |
// ------------------------------------------------------------------------
|
|
71 |
// CPeninputLayoutWindow::CPeninputLayoutWindow
|
|
72 |
// (other items were commented in a header)
|
|
73 |
// ------------------------------------------------------------------------
|
|
74 |
//
|
|
75 |
EXPORT_C CPeninputLayoutWindow::CPeninputLayoutWindow(
|
|
76 |
CFepUiLayout* aUiLayout, MPeninputLayoutContext* aLayoutContext )
|
|
77 |
: CAknFepCtrlBaseWindow( aUiLayout, EPeninutWindowCtrlIdBaseWindow ),
|
|
78 |
iConfigInfo( NULL ), iLayoutContext( aLayoutContext ),
|
|
79 |
iLastUsedTotalColumns( KPeninputLayoutWindowUnitWidth ),
|
|
80 |
iFirstTimeConstruct( ETrue ),
|
|
81 |
iSwitchFontSet(EFalse),
|
|
82 |
iUnitSizeChange(EFalse)
|
|
83 |
{
|
|
84 |
}
|
|
85 |
|
|
86 |
// ---------------------------------------------------------------------------
|
|
87 |
// CPeninputLayoutWindow::ConstructL
|
|
88 |
// (other items were commented in a header)
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
EXPORT_C void CPeninputLayoutWindow::ConstructL()
|
|
92 |
{
|
|
93 |
BaseConstructL();
|
|
94 |
|
|
95 |
if( iLayoutContext->LayoutType() == EPluginInputModeVkb )
|
|
96 |
{
|
|
97 |
iVkbLayout = CAknFepCtrlVkbLayout::NewL();
|
|
98 |
}
|
|
99 |
else
|
|
100 |
{
|
|
101 |
iVkbLayout = NULL;
|
|
102 |
}
|
|
103 |
|
|
104 |
CCoeEnv* coeEnv = CCoeEnv::Static();
|
|
105 |
|
|
106 |
// Set up resources
|
|
107 |
TFileName resFileName = GetWindowResFileName();
|
|
108 |
BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resFileName );
|
|
109 |
iWinResId = coeEnv->AddResourceFileL( resFileName );
|
|
110 |
|
|
111 |
TResourceReader reader;
|
|
112 |
|
|
113 |
coeEnv->CreateResourceReaderLC( reader, GetWindowResId() );
|
|
114 |
SetResourceId( GetWindowResId() );
|
|
115 |
ConstructFromResourceL();
|
|
116 |
// Pop and destroy reader
|
|
117 |
CleanupStack::PopAndDestroy( 1 );
|
|
118 |
MoveButton()->AddEventObserver( UiLayout() );
|
|
119 |
iCtrlPool = CPeninputCtrlPool::NewL();
|
|
120 |
|
|
121 |
CreateAllControlsL();
|
|
122 |
SetControlsFont();
|
|
123 |
}
|
|
124 |
|
|
125 |
// ---------------------------------------------------------------------------
|
|
126 |
// CPeninputLayoutWindow::~CPeninputLayoutWindow
|
|
127 |
// (other items were commented in a header)
|
|
128 |
// ---------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
EXPORT_C CPeninputLayoutWindow::~CPeninputLayoutWindow()
|
|
131 |
{
|
|
132 |
delete iCtrlPool;
|
|
133 |
delete iConfigInfo;
|
|
134 |
delete iKeyMappingMgr;
|
|
135 |
delete iVkbLayout;
|
|
136 |
// Delete resource file from CoeEnv
|
|
137 |
CCoeEnv::Static()->DeleteResourceFile( iWinResId );
|
|
138 |
|
|
139 |
CCoeEnv::Static()->DeleteResourceFile( iConfigResId );
|
|
140 |
|
|
141 |
}
|
|
142 |
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
// CPeninputLayoutWindow::ConstructFromResourceL
|
|
145 |
// (other items were commented in a header)
|
|
146 |
// ---------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
EXPORT_C void CPeninputLayoutWindow::ConstructFromResourceL(
|
|
149 |
TResourceReader& aResReader )
|
|
150 |
{
|
|
151 |
TInt supportskin = aResReader.ReadInt16();
|
|
152 |
|
|
153 |
if (iFirstTimeConstruct && (supportskin != KNotSupportSkin))
|
|
154 |
{
|
|
155 |
UiLayout()->AddControlL(this);
|
|
156 |
}
|
|
157 |
|
|
158 |
const TInt32 moveBtnResId = aResReader.ReadInt32();
|
|
159 |
const TInt32 closeBtnResId = aResReader.ReadInt32();
|
|
160 |
const TInt32 icfResId = aResReader.ReadInt32();
|
|
161 |
const TInt32 optionBtnResId = aResReader.ReadInt32();
|
|
162 |
const TInt32 keymappingResId = aResReader.ReadInt32();
|
|
163 |
const TInt32 shadowResId = aResReader.ReadInt32();
|
|
164 |
const TInt32 arrowLeftResId = aResReader.ReadInt32();
|
|
165 |
const TInt32 arrowRightResId = aResReader.ReadInt32();
|
|
166 |
const TInt32 bgImageResId = aResReader.ReadInt32();
|
|
167 |
|
|
168 |
TResourceReader resReader;
|
|
169 |
|
|
170 |
TBool multiLine = EFalse;
|
|
171 |
|
|
172 |
if (iFirstTimeConstruct)
|
|
173 |
{
|
|
174 |
// Read bitmaps of close and move button
|
|
175 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, moveBtnResId );
|
|
176 |
MoveButton()->SetResourceId( moveBtnResId );
|
|
177 |
MoveButton()->ConstructFromResourceL();
|
|
178 |
CleanupStack::PopAndDestroy( 1 );
|
|
179 |
|
|
180 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, closeBtnResId );
|
|
181 |
CloseButton()->SetResourceId( closeBtnResId );
|
|
182 |
CloseButton()->ConstructFromResourceL();
|
|
183 |
CleanupStack::PopAndDestroy( 1 );
|
|
184 |
|
|
185 |
// Read information of key mapping
|
|
186 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, keymappingResId );
|
|
187 |
iKeyMappingMgr = CPeninputNumericKepMappingMgr::NewL( resReader );
|
|
188 |
CleanupStack::PopAndDestroy( 1 );
|
|
189 |
|
|
190 |
|
|
191 |
multiLine = IsMultiLineIcf();
|
|
192 |
|
|
193 |
// Add input context field into the headpane
|
|
194 |
if (multiLine)
|
|
195 |
{
|
|
196 |
AddMultiContextFieldL();
|
|
197 |
}
|
|
198 |
else
|
|
199 |
{
|
|
200 |
AddContextFieldL();
|
|
201 |
}
|
|
202 |
|
|
203 |
|
|
204 |
// Add touch input button into the headpane
|
|
205 |
AddTouchInputButtonL( optionBtnResId );
|
|
206 |
}
|
|
207 |
else
|
|
208 |
{
|
|
209 |
multiLine = IsMultiLineIcf();
|
|
210 |
CControlGroup::ConstructFromResourceL();
|
|
211 |
}
|
|
212 |
|
|
213 |
// Read information of shadow
|
|
214 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, shadowResId );
|
|
215 |
ReadShadowInfoL( resReader );
|
|
216 |
CleanupStack::PopAndDestroy( 1 );
|
|
217 |
|
|
218 |
if (!multiLine)
|
|
219 |
{
|
|
220 |
//Read resource of icf
|
|
221 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, icfResId );
|
|
222 |
ReadIcfInfo( resReader );
|
|
223 |
CleanupStack::PopAndDestroy( 1 );
|
|
224 |
}
|
|
225 |
else
|
|
226 |
{
|
|
227 |
ReadMultiLineIcfInforL(icfResId);
|
|
228 |
}
|
|
229 |
|
|
230 |
// Read background image resource
|
|
231 |
ReadBackgroundInfoL( bgImageResId );
|
|
232 |
iFirstTimeConstruct = EFalse;
|
|
233 |
}
|
|
234 |
|
|
235 |
// -----------------------------------------------------------------------------
|
|
236 |
// CPeninputLayoutWindow::ConstructFromResourceL
|
|
237 |
// (other items were commented in a header).
|
|
238 |
// -----------------------------------------------------------------------------
|
|
239 |
//
|
|
240 |
EXPORT_C void CPeninputLayoutWindow::ConstructFromResourceL()
|
|
241 |
{
|
|
242 |
if (iResourceId == KInvalidResId)
|
|
243 |
{
|
|
244 |
User::Leave(KErrArgument);
|
|
245 |
}
|
|
246 |
|
|
247 |
TResourceReader reader;
|
|
248 |
CCoeEnv::Static()->CreateResourceReaderLC(reader, iResourceId);
|
|
249 |
|
|
250 |
TInt supportskin = reader.ReadInt16();
|
|
251 |
|
|
252 |
if (iFirstTimeConstruct && (supportskin != KNotSupportSkin))
|
|
253 |
{
|
|
254 |
UiLayout()->AddControlL(this);
|
|
255 |
}
|
|
256 |
|
|
257 |
const TInt32 moveBtnResId = reader.ReadInt32();
|
|
258 |
const TInt32 closeBtnResId = reader.ReadInt32();
|
|
259 |
const TInt32 icfResId = reader.ReadInt32();
|
|
260 |
const TInt32 optionBtnResId = reader.ReadInt32();
|
|
261 |
const TInt32 keymappingResId = reader.ReadInt32();
|
|
262 |
const TInt32 shadowResId = reader.ReadInt32();
|
|
263 |
const TInt32 arrowLeftResId = reader.ReadInt32();
|
|
264 |
const TInt32 arrowRightResId = reader.ReadInt32();
|
|
265 |
const TInt32 bgImageResId = reader.ReadInt32();
|
|
266 |
|
|
267 |
|
|
268 |
TResourceReader resReader;
|
|
269 |
TBool multiLine = EFalse;
|
|
270 |
|
|
271 |
if (iFirstTimeConstruct)
|
|
272 |
{
|
|
273 |
// Read bitmaps of close and move button
|
|
274 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, moveBtnResId );
|
|
275 |
MoveButton()->SetResourceId( moveBtnResId );
|
|
276 |
MoveButton()->ConstructFromResourceL();
|
|
277 |
CleanupStack::PopAndDestroy( 1 );
|
|
278 |
|
|
279 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, closeBtnResId );
|
|
280 |
CloseButton()->SetResourceId( closeBtnResId );
|
|
281 |
CloseButton()->ConstructFromResourceL();
|
|
282 |
CleanupStack::PopAndDestroy( 1 );
|
|
283 |
|
|
284 |
// Read information of key mapping
|
|
285 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, keymappingResId );
|
|
286 |
iKeyMappingMgr = CPeninputNumericKepMappingMgr::NewL( resReader );
|
|
287 |
CleanupStack::PopAndDestroy( 1 );
|
|
288 |
|
|
289 |
multiLine = IsMultiLineIcf();
|
|
290 |
|
|
291 |
// Add input context field into the headpane
|
|
292 |
if (multiLine)
|
|
293 |
{
|
|
294 |
AddMultiContextFieldL();
|
|
295 |
}
|
|
296 |
else
|
|
297 |
{
|
|
298 |
AddContextFieldL();
|
|
299 |
}
|
|
300 |
|
|
301 |
// Add touch input button into the headpane
|
|
302 |
AddTouchInputButtonL( optionBtnResId );
|
|
303 |
}
|
|
304 |
else
|
|
305 |
{
|
|
306 |
multiLine = IsMultiLineIcf();
|
|
307 |
CControlGroup::ConstructFromResourceL();
|
|
308 |
}
|
|
309 |
|
|
310 |
// Read information of shadow
|
|
311 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, shadowResId );
|
|
312 |
ReadShadowInfoL( resReader );
|
|
313 |
CleanupStack::PopAndDestroy( 1 );
|
|
314 |
|
|
315 |
if (!multiLine)
|
|
316 |
{
|
|
317 |
//Read resource of icf
|
|
318 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, icfResId );
|
|
319 |
ReadIcfInfo( resReader );
|
|
320 |
CleanupStack::PopAndDestroy( 1 );
|
|
321 |
}
|
|
322 |
else
|
|
323 |
{
|
|
324 |
ReadMultiLineIcfInforL(icfResId);
|
|
325 |
}
|
|
326 |
|
|
327 |
CleanupStack::PopAndDestroy(); // reader
|
|
328 |
|
|
329 |
// Read background image resource
|
|
330 |
ReadBackgroundInfoL( bgImageResId );
|
|
331 |
|
|
332 |
if( iLayoutContext->LayoutType() == EPluginInputModeVkb )
|
|
333 |
{
|
|
334 |
iVkbLayout->ConstructFromResourceL();
|
|
335 |
}
|
|
336 |
|
|
337 |
iFirstTimeConstruct = EFalse;
|
|
338 |
}
|
|
339 |
|
|
340 |
// ---------------------------------------------------------------------------
|
|
341 |
// CPeninputLayoutWindow::SizeChanged
|
|
342 |
// (other items were commented in a header)
|
|
343 |
// ---------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
EXPORT_C void CPeninputLayoutWindow::SizeChanged( TBool /*aLandscapeStyle*/ )
|
|
346 |
{
|
|
347 |
iLangOrSizeChanged = ETrue;
|
|
348 |
ChangeUnitSize();
|
|
349 |
|
|
350 |
ReadLafForShadow();
|
|
351 |
|
|
352 |
if ( iConfigInfo )
|
|
353 |
{
|
|
354 |
ChangeClientSize();
|
|
355 |
// Change the size of base window
|
|
356 |
SizeChangedForBaseWindow( iLastUsedTotalColumns );
|
|
357 |
|
|
358 |
}
|
|
359 |
|
|
360 |
TInt style = EPeninputPositionChangeBrJustify;
|
|
361 |
TBuf<KIntSizeToInt16> bufStyle;
|
|
362 |
bufStyle = ( TUint16* )&style;
|
|
363 |
HandleControlEvent(EPeninputLayoutEventMovePosition, NULL, bufStyle);
|
|
364 |
|
|
365 |
iLangOrSizeChanged = EFalse;
|
|
366 |
}
|
|
367 |
|
|
368 |
// ---------------------------------------------------------------------------
|
|
369 |
// CPeninputLayoutWindow::ReadLafForShadow
|
|
370 |
// (other items were commented in a header).
|
|
371 |
// ---------------------------------------------------------------------------
|
|
372 |
//
|
|
373 |
void CPeninputLayoutWindow::ReadLafForShadow()
|
|
374 |
{
|
|
375 |
if(!CPeninputDataConverter::AnyToInt
|
|
376 |
(iLayoutContext->RequestData(EAkninputDataTypeSizeChanging)))
|
|
377 |
{
|
|
378 |
return;
|
|
379 |
}
|
|
380 |
|
|
381 |
TRect anyRect;
|
|
382 |
|
|
383 |
TAknWindowLineLayout shadowPane;
|
|
384 |
TAknWindowLineLayout shadowTl;
|
|
385 |
TAknWindowLineLayout shadowBr;
|
|
386 |
TAknLayoutRect shadowRect;
|
|
387 |
TAknLayoutRect shadowTlRect;
|
|
388 |
TAknLayoutRect shadowBrRect;
|
|
389 |
|
|
390 |
shadowPane = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane(1).LayoutLine();
|
|
391 |
shadowRect.LayoutRect(anyRect, shadowPane);
|
|
392 |
|
|
393 |
shadowTl = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g1().LayoutLine();
|
|
394 |
shadowTlRect.LayoutRect(shadowRect.Rect(), shadowTl);
|
|
395 |
|
|
396 |
shadowBr = AknLayoutScalable_Avkon::bg_popup_fep_shadow_pane_g8().LayoutLine();
|
|
397 |
shadowBrRect.LayoutRect(shadowRect.Rect(), shadowBr);
|
|
398 |
|
|
399 |
iShadowTlWidth = shadowTlRect.Rect().Size().iWidth;
|
|
400 |
iShadowTlHeight = shadowTlRect.Rect().Size().iHeight;
|
|
401 |
iShadowBrWidth = shadowBrRect.Rect().Size().iWidth;
|
|
402 |
iShadowBrHeight = shadowBrRect.Rect().Size().iHeight;
|
|
403 |
|
|
404 |
//TRect newWinRect = Rect();
|
|
405 |
//newWinRect.iTl = ShadowRect().iTl + TPoint(iShadowTlWidth, iShadowTlHeight);
|
|
406 |
//SetRect( newWinRect );
|
|
407 |
}
|
|
408 |
|
|
409 |
// ---------------------------------------------------------------------------
|
|
410 |
// CPeninputLayoutWindow::SizeChanged
|
|
411 |
// (other items were commented in a header).
|
|
412 |
// ---------------------------------------------------------------------------
|
|
413 |
//
|
|
414 |
void CPeninputLayoutWindow::SizeChangedForBaseWindow( TInt aTotalColumns )
|
|
415 |
{
|
|
416 |
//only responsible for controls that layout window managed
|
|
417 |
//if ( ( aTotalColumns != iLastUsedTotalColumns ) || iLangOrSizeChanged )
|
|
418 |
{
|
|
419 |
TRect wndRect = Rect();
|
|
420 |
TRect rtTitleBar = TitleBar()->Rect();
|
|
421 |
|
|
422 |
TInt UnitWidth = *( static_cast<TInt*>( iLayoutContext->RequestData
|
|
423 |
( EPeninputDataTypeUnitWidth ) ) );
|
|
424 |
|
|
425 |
TInt UnitHeight = *( static_cast<TInt*>( iLayoutContext->RequestData
|
|
426 |
( EPeninputDataTypeUnitHeight ) ) );
|
|
427 |
|
|
428 |
TInt moveBtnColumns = 1;
|
|
429 |
TInt closeBtnColumns = 1;
|
|
430 |
TInt optionBtnColumns = 1;
|
|
431 |
TInt headerPaneColumns;
|
|
432 |
TInt icfColumns;
|
|
433 |
|
|
434 |
//Call SetRect function of dragbutton
|
|
435 |
if( iLayoutContext->LayoutType() == EPluginInputModeVkb)
|
|
436 |
{
|
|
437 |
moveBtnColumns = 2;
|
|
438 |
closeBtnColumns = 2;
|
|
439 |
}
|
|
440 |
|
|
441 |
TRect rectClose ( rtTitleBar.iTl, TSize( closeBtnColumns * UnitWidth, UnitHeight ) );
|
|
442 |
TRect innerRect;
|
|
443 |
AknPenImageUtils::CalculateGraphicRect( rectClose, innerRect );
|
|
444 |
CloseButton()->SizeChanged( rectClose, innerRect, ETrue );
|
|
445 |
|
|
446 |
//Call SetRect function of Head pane
|
|
447 |
headerPaneColumns = aTotalColumns - moveBtnColumns - closeBtnColumns;
|
|
448 |
TRect rectHeader ( TPoint(rectClose.iBr.iX, rectClose.iTl.iY ),
|
|
449 |
TSize( headerPaneColumns * UnitWidth, UnitHeight ) );
|
|
450 |
HeaderPane()->SetRect( rectHeader );
|
|
451 |
|
|
452 |
//Call SetRect function of input context field
|
|
453 |
icfColumns = headerPaneColumns - optionBtnColumns;
|
|
454 |
TRect rectIcf( rectHeader.iTl,
|
|
455 |
TSize( icfColumns * UnitWidth, UnitHeight ) );
|
|
456 |
if(ConfigInfo()->Language() == ELangArabic)
|
|
457 |
{
|
|
458 |
rectIcf.iTl.iX = rectIcf.iTl.iX + UnitWidth;
|
|
459 |
}
|
|
460 |
if(IsMultiLineIcf())
|
|
461 |
{
|
|
462 |
iMultiLineIcf->SetRect( rectIcf );
|
|
463 |
}
|
|
464 |
else
|
|
465 |
{
|
|
466 |
iInputContextField->SetRect( rectIcf );
|
|
467 |
}
|
|
468 |
if(ConfigInfo()->Language() == ELangArabic)
|
|
469 |
{
|
|
470 |
TRect rectBackspace(rectHeader.iTl, TSize(UnitWidth, UnitHeight));
|
|
471 |
AknPenImageUtils::CalculateGraphicRect( rectBackspace, innerRect );
|
|
472 |
iBackspaceButton->SizeChanged(rectBackspace, innerRect, ETrue);
|
|
473 |
}
|
|
474 |
//set the rect of option button
|
|
475 |
TRect rectOption ( TPoint( rectIcf.iBr.iX, rectIcf.iTl.iY ),
|
|
476 |
TSize( optionBtnColumns * UnitWidth, UnitHeight ) );
|
|
477 |
AknPenImageUtils::CalculateGraphicRect( rectOption, innerRect );
|
|
478 |
iTouchInputOptionButton->SizeChanged( rectOption, innerRect, ETrue );
|
|
479 |
|
|
480 |
//Call SetRect function of close button
|
|
481 |
TRect rectMove ( TPoint( rectHeader.iBr.iX, rectHeader.iTl.iY),
|
|
482 |
TSize( closeBtnColumns * UnitWidth, UnitHeight ) );
|
|
483 |
AknPenImageUtils::CalculateGraphicRect( rectMove, innerRect );
|
|
484 |
MoveButton()->SizeChanged( rectMove, innerRect, ETrue );
|
|
485 |
|
|
486 |
SetControlsFont();
|
|
487 |
iLastUsedTotalColumns = aTotalColumns;
|
|
488 |
}
|
|
489 |
}
|
|
490 |
// ---------------------------------------------------------------------------
|
|
491 |
// CPeninputLayoutWindow::HandleControlEvent
|
|
492 |
// (other items were commented in a header)
|
|
493 |
// ---------------------------------------------------------------------------
|
|
494 |
//
|
|
495 |
EXPORT_C void CPeninputLayoutWindow::HandleControlEvent( TInt aEventType,
|
|
496 |
CFepUiBaseCtrl* aCtrl, const TDesC& aEventData )
|
|
497 |
{
|
|
498 |
// Call this function in base class
|
|
499 |
CAknFepCtrlBaseWindow::HandleControlEvent( aEventType,
|
|
500 |
aCtrl, aEventData );
|
|
501 |
|
|
502 |
TInt* data = ( TInt* ) aEventData.Ptr();
|
|
503 |
|
|
504 |
switch ( aEventType )
|
|
505 |
{
|
|
506 |
case EPeninputLayoutEventSwitchLanguage:
|
|
507 |
{
|
|
508 |
TRAP_IGNORE( ChangeInputLanguageL( *data ) );
|
|
509 |
}
|
|
510 |
break;
|
|
511 |
case EPeninputLayoutEventRange:
|
|
512 |
{
|
|
513 |
HandleRangeEvent( *data );
|
|
514 |
}
|
|
515 |
break;
|
|
516 |
case EPeninputLayoutEventRangeLoop:
|
|
517 |
{
|
|
518 |
HandleRangeLoopEvent( *data );
|
|
519 |
}
|
|
520 |
break;
|
|
521 |
case EPeninputLayoutEventShift:
|
|
522 |
{
|
|
523 |
HandleShiftBtnClicked();
|
|
524 |
}
|
|
525 |
break;
|
|
526 |
case EPeninputLayoutEventCapslock:
|
|
527 |
{
|
|
528 |
HandleCapslockBtnClicked();
|
|
529 |
}
|
|
530 |
break;
|
|
531 |
case EPeninputLayoutEventMovePosition:
|
|
532 |
{
|
|
533 |
TInt style = *( ( TUint16* ) aEventData.Ptr() );
|
|
534 |
ChangeLayoutPosition( style );
|
|
535 |
}
|
|
536 |
break;
|
|
537 |
case EPeninputLayoutEventSetPermittedRange:
|
|
538 |
{
|
|
539 |
if ( *data & ERangeNative )
|
|
540 |
{
|
|
541 |
*data = *data | ERangeAccent | ERangeNativeNumber
|
|
542 |
| ERangeMixedText | ERangeMixedNumber;
|
|
543 |
}
|
|
544 |
else if(*data & ERangeEnglish)
|
|
545 |
{
|
|
546 |
*data = *data | ERangeAccent;
|
|
547 |
}
|
|
548 |
/*
|
|
549 |
if ( *data & ERangeNative )
|
|
550 |
{
|
|
551 |
*data = *data | ERangeNativeNumber
|
|
552 |
| ERangeMixedText | ERangeMixedNumber;
|
|
553 |
}
|
|
554 |
*/
|
|
555 |
// Update data:range
|
|
556 |
iLayoutContext->SetData( EPeninputDataTypePermittedRange, data );
|
|
557 |
|
|
558 |
// Set range of range bar component
|
|
559 |
CFepUiBaseCtrl* bar =
|
|
560 |
iCtrlPool->Control( EPeninutWindowCtrlIdRangeBar );
|
|
561 |
if ( bar )
|
|
562 |
{
|
|
563 |
CAknFepCtrlRangeBar* rangebar =
|
|
564 |
static_cast<CAknFepCtrlRangeBar*>( bar );
|
|
565 |
rangebar->SetPermittedRanges( *data );
|
|
566 |
}
|
|
567 |
}
|
|
568 |
break;
|
|
569 |
case EPeninputLayoutEventSetPermittedCase:
|
|
570 |
{
|
|
571 |
// Update data:case
|
|
572 |
iLayoutContext->SetData( EPeninputDataTypePermittedCase, data );
|
|
573 |
|
|
574 |
// Set range of case
|
|
575 |
CFepUiBaseCtrl* bar =
|
|
576 |
iCtrlPool->Control( EPeninutWindowCtrlIdRangeBar );
|
|
577 |
if ( bar )
|
|
578 |
{
|
|
579 |
CAknFepCtrlRangeBar* rangebar =
|
|
580 |
static_cast<CAknFepCtrlRangeBar*>( bar );
|
|
581 |
|
|
582 |
rangebar->SetPermittedCase( ERangeEnglish, ECaseUpper,
|
|
583 |
( *data & ECaseUpper) != 0 );
|
|
584 |
rangebar->SetPermittedCase( ERangeEnglish, ECaseLower,
|
|
585 |
( *data & ECaseLower) != 0 );
|
|
586 |
rangebar->SetPermittedCase( ERangeEnglish, ECaseText,
|
|
587 |
( *data & ECaseText) != 0 );
|
|
588 |
}
|
|
589 |
}
|
|
590 |
break;
|
|
591 |
case EPeninputLayoutEventSetCase:
|
|
592 |
{
|
|
593 |
DoCaseChange( *data );
|
|
594 |
}
|
|
595 |
break;
|
|
596 |
case EEventSizeChanged:
|
|
597 |
{
|
|
598 |
//if icf editor size changed, we need to inform owner
|
|
599 |
if(aCtrl == iInputContextField ||
|
|
600 |
aCtrl == iMultiLineIcf )
|
|
601 |
{
|
|
602 |
iLayoutContext->Sendkey( ESignalLayoutICFLengthChanged, KNullDesC );
|
|
603 |
}
|
|
604 |
}
|
|
605 |
break;
|
|
606 |
default:
|
|
607 |
break;
|
|
608 |
}
|
|
609 |
}
|
|
610 |
|
|
611 |
// ---------------------------------------------------------------------------
|
|
612 |
// CPeninputLayoutWindow::SetEditorTextL
|
|
613 |
// (other items were commented in a header)
|
|
614 |
// ---------------------------------------------------------------------------
|
|
615 |
//
|
|
616 |
EXPORT_C void CPeninputLayoutWindow::SetEditorTextL(
|
|
617 |
const TFepInputContextFieldData& aData )
|
|
618 |
{
|
|
619 |
if(IsMultiLineIcf())
|
|
620 |
{
|
|
621 |
if (iMultiLineIcf)
|
|
622 |
{
|
|
623 |
iMultiLineIcf->SetTextL( aData );
|
|
624 |
}
|
|
625 |
}
|
|
626 |
else
|
|
627 |
{
|
|
628 |
if (iInputContextField)
|
|
629 |
{
|
|
630 |
iInputContextField->SetTextL( aData );
|
|
631 |
}
|
|
632 |
|
|
633 |
}
|
|
634 |
}
|
|
635 |
|
|
636 |
// ---------------------------------------------------------------------------
|
|
637 |
// CPeninputLayoutWindow::SetEditorTextL
|
|
638 |
// (other items were commented in a header)
|
|
639 |
// ---------------------------------------------------------------------------
|
|
640 |
//
|
|
641 |
EXPORT_C void CPeninputLayoutWindow::SetTextIsSecret( TBool aData )
|
|
642 |
{
|
|
643 |
if(IsMultiLineIcf())
|
|
644 |
{
|
|
645 |
if (iMultiLineIcf)
|
|
646 |
{
|
|
647 |
iMultiLineIcf->SetTextIsSecret( aData );
|
|
648 |
}
|
|
649 |
}
|
|
650 |
else
|
|
651 |
{
|
|
652 |
if (iInputContextField)
|
|
653 |
{
|
|
654 |
iInputContextField->SetTextIsSecret( aData );
|
|
655 |
}
|
|
656 |
}
|
|
657 |
}
|
|
658 |
|
|
659 |
void CPeninputLayoutWindow::SetNumberGrouping( TBool aData )
|
|
660 |
{
|
|
661 |
if(IsMultiLineIcf())
|
|
662 |
{
|
|
663 |
if (iMultiLineIcf)
|
|
664 |
{
|
|
665 |
iMultiLineIcf->SetNumberGrouping( aData );
|
|
666 |
}
|
|
667 |
}
|
|
668 |
}
|
|
669 |
|
|
670 |
|
|
671 |
// ---------------------------------------------------------------------------
|
|
672 |
// CPeninputLayoutWindow::DoClose
|
|
673 |
// (other items were commented in a header)
|
|
674 |
// ---------------------------------------------------------------------------
|
|
675 |
//
|
|
676 |
EXPORT_C TBool CPeninputLayoutWindow::DoClose()
|
|
677 |
{
|
|
678 |
// Send EVkbEventWindowClose to layout
|
|
679 |
this->ReportEvent( EPeninputLayoutEventClose, KNullDesC );
|
|
680 |
|
|
681 |
// Return true which will permit the window close
|
|
682 |
return EFalse;
|
|
683 |
}
|
|
684 |
|
|
685 |
// ---------------------------------------------------------------------------
|
|
686 |
// CPeninputLayoutWindow::AddContextFieldL
|
|
687 |
// (other items were commented in a header)
|
|
688 |
// ---------------------------------------------------------------------------
|
|
689 |
//
|
|
690 |
void CPeninputLayoutWindow::AddContextFieldL()
|
|
691 |
{
|
|
692 |
// Get reference CControlGroup of headerPane
|
|
693 |
CControlGroup* headerPane = HeaderPane();
|
|
694 |
|
|
695 |
User::LeaveIfNull( headerPane );
|
|
696 |
|
|
697 |
// Input context field
|
|
698 |
iInputContextField = CFepInputContextField::NewL( TRect(),
|
|
699 |
UiLayout(), EPeninutWindowCtrlIdInputContextField );
|
|
700 |
|
|
701 |
// Transfer to headerPane
|
|
702 |
headerPane->AddControlL( iInputContextField );
|
|
703 |
iInputContextField->SetFocus(ETrue);
|
|
704 |
|
|
705 |
// Add layout as event observer
|
|
706 |
iInputContextField->AddEventObserver( UiLayout() );
|
|
707 |
}
|
|
708 |
|
|
709 |
// ---------------------------------------------------------------------------
|
|
710 |
// CPeninputLayoutWindow::AddTouchInputButtonL
|
|
711 |
// (other items were commented in a header)
|
|
712 |
// ---------------------------------------------------------------------------
|
|
713 |
//
|
|
714 |
void CPeninputLayoutWindow::AddTouchInputButtonL( TInt aResID )
|
|
715 |
{
|
|
716 |
// Get reference CControlGroup of headerPane
|
|
717 |
CControlGroup* headerPane = HeaderPane();
|
|
718 |
|
|
719 |
User::LeaveIfNull( headerPane );
|
|
720 |
|
|
721 |
// Create Touch Input Option
|
|
722 |
iTouchInputOptionButton = CAknFepCtrlEventButton::NewL( UiLayout(),
|
|
723 |
EPeninutWindowCtrlIdOptionBtn, EPeninputLayoutEventOption, 0,
|
|
724 |
KAknsIIDQsnFrFunctionButtonNormal,
|
|
725 |
KAknsIIDQsnFrFunctionButtonPressed,
|
|
726 |
KAknsIIDQsnFrFunctionButtonInactive );
|
|
727 |
|
|
728 |
// Read resource
|
|
729 |
TResourceReader reader;
|
|
730 |
|
|
731 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, aResID );
|
|
732 |
iTouchInputOptionButton->SetResourceId( aResID );
|
|
733 |
iTouchInputOptionButton->ConstructFromResourceL();
|
|
734 |
// Pop and destroy reader
|
|
735 |
CleanupStack::PopAndDestroy( 1 );
|
|
736 |
|
|
737 |
// Add into the group
|
|
738 |
headerPane->AddControlL( iTouchInputOptionButton );
|
|
739 |
iTouchInputOptionButton->AddEventObserver( UiLayout() );
|
|
740 |
}
|
|
741 |
|
|
742 |
// ---------------------------------------------------------------------------
|
|
743 |
// Get layout config method. It does a lasy initialization for a instance of
|
|
744 |
// CPeninputLayoutWindow::ConfigInfo
|
|
745 |
// (other items were commented in a header)
|
|
746 |
// ---------------------------------------------------------------------------
|
|
747 |
//
|
|
748 |
EXPORT_C CPeninputLayoutConfig* CPeninputLayoutWindow::ConfigInfo() const
|
|
749 |
{
|
|
750 |
return iConfigInfo;
|
|
751 |
}
|
|
752 |
|
|
753 |
// ---------------------------------------------------------------------------
|
|
754 |
// CPeninputLayoutWindow::CheckResourceExist
|
|
755 |
// (other items were commented in a header)
|
|
756 |
// ---------------------------------------------------------------------------
|
|
757 |
//
|
|
758 |
TBool CPeninputLayoutWindow::CheckResourceExist( const TDesC& aFileName )
|
|
759 |
{
|
|
760 |
RFile file;
|
|
761 |
|
|
762 |
if ( !aFileName.Length() )
|
|
763 |
{
|
|
764 |
return EFalse;
|
|
765 |
}
|
|
766 |
|
|
767 |
TInt rs = file.Open( CCoeEnv::Static()->FsSession(), aFileName, EFileRead );
|
|
768 |
|
|
769 |
if ( rs == KErrNotFound )
|
|
770 |
{
|
|
771 |
return EFalse;
|
|
772 |
}
|
|
773 |
else
|
|
774 |
{
|
|
775 |
file.Close();
|
|
776 |
|
|
777 |
return ETrue;
|
|
778 |
}
|
|
779 |
}
|
|
780 |
|
|
781 |
// ---------------------------------------------------------------------------
|
|
782 |
// CPeninputLayoutWindow::ChangeInputLanguageL
|
|
783 |
// (other items were commented in a header)
|
|
784 |
// ---------------------------------------------------------------------------
|
|
785 |
//
|
|
786 |
EXPORT_C void CPeninputLayoutWindow::ChangeInputLanguageL( TInt aLangID )
|
|
787 |
{
|
|
788 |
// Determine whether a new language id is same as existing one,
|
|
789 |
if ( ConfigInfo() )
|
|
790 |
{
|
|
791 |
// If language not changed, exit this function
|
|
792 |
if ( ConfigInfo()->Language() == aLangID )
|
|
793 |
{
|
|
794 |
return;
|
|
795 |
}
|
|
796 |
}
|
|
797 |
|
|
798 |
// First check file exist or not
|
|
799 |
TBool found = CheckResourceExist( GetWindowConfigResFileName( aLangID ) );
|
|
800 |
if ( !found )
|
|
801 |
{
|
|
802 |
aLangID = ELangEnglish;
|
|
803 |
found = CheckResourceExist( GetWindowConfigResFileName( aLangID ) );
|
|
804 |
}
|
|
805 |
|
|
806 |
if ( found )
|
|
807 |
{
|
|
808 |
// Store language
|
|
809 |
iLayoutContext->SetData( EPeninputDataTypeInputLanguage, &aLangID );
|
|
810 |
|
|
811 |
if ( iLayoutContext->LayoutType() == EPluginInputModeVkb )
|
|
812 |
{
|
|
813 |
CFepUiBaseCtrl* ctrl =
|
|
814 |
iCtrlPool->Control( EPeninutWindowCtrlIdVkbCtrl );
|
|
815 |
if ( ctrl )
|
|
816 |
{
|
|
817 |
( static_cast<CPeninputVkbCtrlExt*>( ctrl ) )->Reset();
|
|
818 |
}
|
|
819 |
}
|
|
820 |
|
|
821 |
( const_cast<RPointerArray<CFepUiBaseCtrl>&>
|
|
822 |
( ClientPane()->ControlList() ) ).Reset();
|
|
823 |
|
|
824 |
// Re-construct config info
|
|
825 |
if ( iConfigInfo )
|
|
826 |
{
|
|
827 |
delete iConfigInfo;
|
|
828 |
iConfigInfo = NULL;
|
|
829 |
}
|
|
830 |
|
|
831 |
if (iConfigResId)
|
|
832 |
{
|
|
833 |
CCoeEnv::Static()->DeleteResourceFile( iConfigResId );
|
|
834 |
}
|
|
835 |
|
|
836 |
// construct resource utils
|
|
837 |
|
|
838 |
CCoeEnv* coeEnv = CCoeEnv::Static();
|
|
839 |
|
|
840 |
// Set up resources
|
|
841 |
TFileName resFileName = GetWindowConfigResFileName( aLangID );
|
|
842 |
BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resFileName );
|
|
843 |
iConfigResId = coeEnv->AddResourceFileL( resFileName );
|
|
844 |
|
|
845 |
TResourceReader reader;
|
|
846 |
|
|
847 |
coeEnv->CreateResourceReaderLC( reader, GetWindowConfigResId() );
|
|
848 |
if ( iLayoutContext->LayoutType() == EPluginInputModeVkb )
|
|
849 |
{
|
|
850 |
iVkbLayout->Reset();
|
|
851 |
}
|
|
852 |
iConfigInfo = CPeninputLayoutConfig::NewL( *iVkbLayout, reader );
|
|
853 |
|
|
854 |
// Pop and destroy reader
|
|
855 |
CleanupStack::PopAndDestroy( 1 );
|
|
856 |
|
|
857 |
// Re-construct rangebar
|
|
858 |
ChangeRangeBarL();
|
|
859 |
|
|
860 |
iLangOrSizeChanged = ETrue;
|
|
861 |
//ChangeClientSize();
|
|
862 |
|
|
863 |
TBuf<10> iISOCode;
|
|
864 |
AknPenInputUtils::GetISOLanguageCode
|
|
865 |
( static_cast<TLanguage>(aLangID), iISOCode );
|
|
866 |
CFepUiBaseCtrl* langBtn =
|
|
867 |
iCtrlPool->Control( EPeninutWindowCtrlIdInputLangSwitcherBtn );
|
|
868 |
|
|
869 |
if ( langBtn )
|
|
870 |
{
|
|
871 |
( static_cast<CAknFepCtrlEventButton*>( langBtn ) )->SetText
|
|
872 |
( iISOCode );
|
|
873 |
UpdateArea(( static_cast<CAknFepCtrlButton*>( langBtn ) )->Rect(),
|
|
874 |
ETrue );
|
|
875 |
}
|
|
876 |
TInt range = -1;
|
|
877 |
iLayoutContext->SetData( EPeninputDataTypeCurrentRange, &range );
|
|
878 |
iLayoutContext->SetData( EPeninputDataTypeClientLayout, &range );
|
|
879 |
|
|
880 |
iMultiLineIcf->SetLanguageId( aLangID );
|
|
881 |
}
|
|
882 |
else
|
|
883 |
{
|
|
884 |
// Report error, do nothing
|
|
885 |
}
|
|
886 |
}
|
|
887 |
|
|
888 |
// ---------------------------------------------------------------------------
|
|
889 |
// CPeninputLayoutWindow::ChangeRangeBarL
|
|
890 |
// (other items were commented in a header)
|
|
891 |
// ---------------------------------------------------------------------------
|
|
892 |
//
|
|
893 |
void CPeninputLayoutWindow::ChangeRangeBarL()
|
|
894 |
{
|
|
895 |
// Read range bar from config into and reconstruct range button
|
|
896 |
if ( iConfigInfo )
|
|
897 |
{
|
|
898 |
TInt resid = iConfigInfo->RangebarResId();
|
|
899 |
CFepUiBaseCtrl* bar =
|
|
900 |
iCtrlPool->Control( EPeninutWindowCtrlIdRangeBar );
|
|
901 |
|
|
902 |
if ( bar )
|
|
903 |
{
|
|
904 |
CAknFepCtrlRangeBar* rangebar =
|
|
905 |
static_cast<CAknFepCtrlRangeBar*>( bar );
|
|
906 |
|
|
907 |
CAknFepCtrlRangeBar::TRangeBarActionStyle style =
|
|
908 |
( CAknFepCtrlRangeBar::TRangeBarActionStyle )
|
|
909 |
iConfigInfo->RangeBarInfo()->RangeStyle();
|
|
910 |
|
|
911 |
rangebar->SetActionStyle( style );
|
|
912 |
|
|
913 |
TResourceReader reader;
|
|
914 |
|
|
915 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, resid );
|
|
916 |
|
|
917 |
rangebar->ConstructFromResourceL( reader );
|
|
918 |
|
|
919 |
// Pop and destroy reader
|
|
920 |
CleanupStack::PopAndDestroy( 1 );
|
|
921 |
}
|
|
922 |
}
|
|
923 |
}
|
|
924 |
|
|
925 |
// ---------------------------------------------------------------------------
|
|
926 |
// CPeninputLayoutWindow::ChangeRange
|
|
927 |
// (other items were commented in a header)
|
|
928 |
// ---------------------------------------------------------------------------
|
|
929 |
//
|
|
930 |
EXPORT_C void CPeninputLayoutWindow::ChangeRange( TInt aRange, TInt aVkbLayoutId, TBool aNotify )
|
|
931 |
{
|
|
932 |
TInt curRange = CPeninputDataConverter::AnyToInt
|
|
933 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
934 |
|
|
935 |
|
|
936 |
CFepUiBaseCtrl* bar =
|
|
937 |
iCtrlPool->Control( EPeninutWindowCtrlIdRangeBar );
|
|
938 |
CAknFepCtrlRangeBar* rangebar =
|
|
939 |
static_cast<CAknFepCtrlRangeBar*>( bar );
|
|
940 |
|
|
941 |
if ( rangebar )
|
|
942 |
{
|
|
943 |
rangebar->ActiveRange( aRange );
|
|
944 |
}
|
|
945 |
|
|
946 |
if ( ( curRange != aRange ) || ( iLangOrSizeChanged ) )
|
|
947 |
{
|
|
948 |
// Change client layout
|
|
949 |
//UiLayout()->LayoutOwner()->Hide(ETrue);
|
|
950 |
CPeninputRangeBarInfo* rangeBar = iConfigInfo->RangeBarInfo();
|
|
951 |
CPeninputRangeInfo* rangeInfo = rangeBar->FindRange( aRange );
|
|
952 |
|
|
953 |
if ( !rangeInfo )
|
|
954 |
{
|
|
955 |
aRange = ERangeNumber;
|
|
956 |
rangeInfo = rangeBar->FindRange( ERangeNumber );
|
|
957 |
}
|
|
958 |
|
|
959 |
// Get the whole columns
|
|
960 |
|
|
961 |
iUnitSizeChange = ReconfigUnitSize(rangeInfo->ClientLayoutId());
|
|
962 |
/*if (iUnitSizeChange)
|
|
963 |
{
|
|
964 |
UiLayout()->LayoutOwner()->Hide(ETrue);
|
|
965 |
}
|
|
966 |
*/
|
|
967 |
ChangeClientLayout( rangeInfo->ClientLayoutId() );
|
|
968 |
|
|
969 |
CPeninputClientLayoutInfo* clientLayout =
|
|
970 |
ConfigInfo()->FindClientLayoutInfo( rangeInfo->ClientLayoutId() );
|
|
971 |
if ( clientLayout )
|
|
972 |
{
|
|
973 |
SizeChangedForBaseWindow( clientLayout->Columns() );
|
|
974 |
}
|
|
975 |
|
|
976 |
// Update data:range
|
|
977 |
iLayoutContext->SetData( EPeninputDataTypeCurrentRange, &aRange );
|
|
978 |
|
|
979 |
// Notify fep the new range
|
|
980 |
if ( aNotify )
|
|
981 |
{
|
|
982 |
TBuf<KIntLengthForByte> buf;
|
|
983 |
CPeninputDataConverter::IntToDesc( aRange, buf );
|
|
984 |
iLayoutContext->Sendkey( ESignalRange, buf );
|
|
985 |
}
|
|
986 |
|
|
987 |
// Change vkb layout
|
|
988 |
if ( iLayoutContext->LayoutType() == EPluginInputModeVkb )
|
|
989 |
{
|
|
990 |
if ( ( aRange == ERangeEnglish ) || ( aRange == ERangeAccent )
|
|
991 |
|| ( ConfigInfo()->CaseSensitive()
|
|
992 |
&& ( aRange == ERangeNative ) ) )
|
|
993 |
{
|
|
994 |
// Change shift and capslock button status according to the current case
|
|
995 |
TInt curCase = CPeninputDataConverter::AnyToInt
|
|
996 |
( iLayoutContext->RequestData( EPeninputDataTypeCase ) );
|
|
997 |
TInt shfit;
|
|
998 |
TInt capslock;
|
|
999 |
|
|
1000 |
CPeninputDataConverter::ShiftCapslockByCase( curCase,
|
|
1001 |
shfit, capslock );
|
|
1002 |
|
|
1003 |
iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shfit );
|
|
1004 |
ChangeButtonStatus( shfit, EPeninutWindowCtrlIdShiftBtn );
|
|
1005 |
iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslock );
|
|
1006 |
ChangeButtonStatus( capslock, EPeninutWindowCtrlIdCapslockBtn );
|
|
1007 |
|
|
1008 |
TInt caseid = CaseByShiftCapslockStatus();
|
|
1009 |
TInt vkblayoutid =
|
|
1010 |
ConfigInfo()->ShiftCapsSingleVkbLayoutId( aRange, caseid );
|
|
1011 |
|
|
1012 |
if ( aRange == ERangeAccent )
|
|
1013 |
{
|
|
1014 |
TInt curAccentIndex = CPeninputDataConverter::AnyToInt
|
|
1015 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) );
|
|
1016 |
vkblayoutid = vkblayoutid + curAccentIndex * 2;
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
// Change vkb layout
|
|
1020 |
ChangeVkbLayout( vkblayoutid );
|
|
1021 |
}
|
|
1022 |
else
|
|
1023 |
{
|
|
1024 |
TInt flag = 0;
|
|
1025 |
|
|
1026 |
iLayoutContext->SetData( EPeninputDataTypeShiftDown, &flag );
|
|
1027 |
ChangeButtonStatus( 0, EPeninutWindowCtrlIdShiftBtn );
|
|
1028 |
iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &flag );
|
|
1029 |
ChangeButtonStatus( 0, EPeninutWindowCtrlIdCapslockBtn );
|
|
1030 |
|
|
1031 |
// Change vkb layout
|
|
1032 |
if ( aVkbLayoutId )
|
|
1033 |
{
|
|
1034 |
ChangeVkbLayout( aVkbLayoutId );
|
|
1035 |
}
|
|
1036 |
else
|
|
1037 |
{
|
|
1038 |
ChangeVkbLayout( rangeInfo->VkbLayoutId() );
|
|
1039 |
}
|
|
1040 |
}
|
|
1041 |
|
|
1042 |
}
|
|
1043 |
|
|
1044 |
/*if (iUnitSizeChange)
|
|
1045 |
{
|
|
1046 |
//SizeChanged(ETrue);
|
|
1047 |
const TRect rect = ChangeUnitSize();
|
|
1048 |
ReadLafForShadow( rect );
|
|
1049 |
if ( iConfigInfo )
|
|
1050 |
{
|
|
1051 |
// Change the size of base window
|
|
1052 |
SizeChangedForBaseWindow( iLastUsedTotalColumns );
|
|
1053 |
ChangeClientSize();
|
|
1054 |
}
|
|
1055 |
UiLayout()->LayoutOwner()->Hide(EFalse);
|
|
1056 |
iUnitSizeChange = EFalse;
|
|
1057 |
}*/
|
|
1058 |
|
|
1059 |
if ( ( iLayoutContext->LayoutType() == EPluginInputModeVkb )
|
|
1060 |
&& ( curRange == ERangeNumber ) && ( curRange == aRange ) )
|
|
1061 |
{
|
|
1062 |
// Dimmed some keys if needed
|
|
1063 |
DimKeys();
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
UiLayout()->Draw();
|
|
1067 |
}
|
|
1068 |
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
// ---------------------------------------------------------------------------
|
|
1072 |
// CPeninputLayoutWindow::ChangeClientLayout
|
|
1073 |
// (other items were commented in a header)
|
|
1074 |
// ---------------------------------------------------------------------------
|
|
1075 |
//
|
|
1076 |
EXPORT_C void CPeninputLayoutWindow::ChangeClientLayout( TInt aClientLayoutId )
|
|
1077 |
{
|
|
1078 |
TInt curClientId = CPeninputDataConverter::AnyToInt
|
|
1079 |
( iLayoutContext->RequestData( EPeninputDataTypeClientLayout ) );
|
|
1080 |
|
|
1081 |
if ( ( curClientId != aClientLayoutId ) || ( iLangOrSizeChanged ) )
|
|
1082 |
{
|
|
1083 |
// Re-Orginize all controls according to the configuration
|
|
1084 |
ReorganizeControls( aClientLayoutId, ETrue );
|
|
1085 |
|
|
1086 |
// Update data:client layout id
|
|
1087 |
iLayoutContext->SetData( EPeninputDataTypeClientLayout,
|
|
1088 |
&aClientLayoutId );
|
|
1089 |
|
|
1090 |
// Reset lang changed flag
|
|
1091 |
if ( ( iLangOrSizeChanged )
|
|
1092 |
&& ( iLayoutContext->LayoutType() != EPluginInputModeVkb ) )
|
|
1093 |
{
|
|
1094 |
iLangOrSizeChanged = EFalse;
|
|
1095 |
}
|
|
1096 |
|
|
1097 |
//iUnitSizeChange = ReconfigUnitSize(aClientLayoutId);
|
|
1098 |
}
|
|
1099 |
}
|
|
1100 |
|
|
1101 |
// ---------------------------------------------------------------------------
|
|
1102 |
// CPeninputLayoutWindow::ChangeVkbLayout
|
|
1103 |
// (other items were commented in a header)
|
|
1104 |
// ---------------------------------------------------------------------------
|
|
1105 |
//
|
|
1106 |
EXPORT_C void CPeninputLayoutWindow::ChangeVkbLayout( TInt aVkbLayoutId )
|
|
1107 |
{
|
|
1108 |
TInt latchedFlag = CPeninputDataConverter::AnyToInt(
|
|
1109 |
iLayoutContext->RequestData(EAkninputDataTypeLatchedSet));
|
|
1110 |
// If the DeadKey is latched, cancel it and then change the VKB layout
|
|
1111 |
if(latchedFlag)
|
|
1112 |
{
|
|
1113 |
RPointerArray<CPeninputVkbLayoutInfo> vkbListInfo;
|
|
1114 |
RPointerArray<CPeninputVkbKeyInfo> keyInfoList;
|
|
1115 |
|
|
1116 |
vkbListInfo = iVkbLayout->VkbLayoutInfoList();
|
|
1117 |
TInt vkbListNum = vkbListInfo.Count();
|
|
1118 |
|
|
1119 |
CVirtualKey* pKey;
|
|
1120 |
TBool deadKeyChange = EFalse;
|
|
1121 |
// Find the latched DeadKey in all the Vkb layout
|
|
1122 |
for(TInt i = 0; i < vkbListNum; i++)
|
|
1123 |
{
|
|
1124 |
// Get key info list in one VKB layout
|
|
1125 |
keyInfoList = vkbListInfo[i]->KeyInfoList();
|
|
1126 |
TInt keyListNum = keyInfoList.Count();
|
|
1127 |
for(TInt j = 0; j < keyListNum; j++)
|
|
1128 |
{
|
|
1129 |
pKey = keyInfoList[j]->Key();
|
|
1130 |
if(pKey->Latched())
|
|
1131 |
{
|
|
1132 |
// Unlatch the DeadKey
|
|
1133 |
pKey->SetLatched(EFalse);
|
|
1134 |
|
|
1135 |
// Set the DeadKey state
|
|
1136 |
iLayoutContext->SetData(EAkninputDataTypeLatchedSet, &deadKeyChange);
|
|
1137 |
deadKeyChange = ETrue;
|
|
1138 |
break;
|
|
1139 |
}
|
|
1140 |
}
|
|
1141 |
if(deadKeyChange)
|
|
1142 |
{
|
|
1143 |
break;
|
|
1144 |
}
|
|
1145 |
}
|
|
1146 |
}
|
|
1147 |
|
|
1148 |
TInt curVkbId = CPeninputDataConverter::AnyToInt
|
|
1149 |
( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) );
|
|
1150 |
|
|
1151 |
if ( ( curVkbId != aVkbLayoutId ) || ( iLangOrSizeChanged ) )
|
|
1152 |
{
|
|
1153 |
iVkbLayout->ChangeVkbLayout( aVkbLayoutId );
|
|
1154 |
|
|
1155 |
TInt curClientId = CPeninputDataConverter::AnyToInt
|
|
1156 |
( iLayoutContext->RequestData( EPeninputDataTypeClientLayout ) );
|
|
1157 |
CPeninputControlInfo* vkbInfo = iConfigInfo->FindClientLayoutInfo
|
|
1158 |
( curClientId )->FindControlInfo( EPeninutWindowCtrlIdVkbCtrl );
|
|
1159 |
|
|
1160 |
TRect rect;
|
|
1161 |
CPeninputVkbCtrlExt* vkbCtrl = static_cast<CPeninputVkbCtrlExt*>
|
|
1162 |
( ClientPane()->ControlById( EPeninutWindowCtrlIdVkbCtrl ) );
|
|
1163 |
|
|
1164 |
if ( vkbInfo )
|
|
1165 |
{
|
|
1166 |
TInt unitWidth = CPeninputDataConverter::AnyToInt
|
|
1167 |
( iLayoutContext->RequestData( EPeninputDataTypeUnitWidth ) );
|
|
1168 |
|
|
1169 |
TInt unitHeight = CPeninputDataConverter::AnyToInt
|
|
1170 |
( iLayoutContext->RequestData
|
|
1171 |
( EPeninputDataTypeUnitHeight ) );
|
|
1172 |
|
|
1173 |
rect.iTl = vkbCtrl->Rect().iTl + TPoint( vkbInfo->BeginColumn()
|
|
1174 |
* unitWidth, vkbInfo->BeginRow() * unitHeight );
|
|
1175 |
TInt cols = vkbInfo->EndColumn() - vkbInfo->BeginColumn();
|
|
1176 |
TInt rows = vkbInfo->EndRow() - vkbInfo->BeginRow();
|
|
1177 |
rect.SetSize( TSize( cols * unitWidth, rows * unitHeight ) );
|
|
1178 |
}
|
|
1179 |
|
|
1180 |
CPeninputVkbLayoutInfo* vkblayout =
|
|
1181 |
ConfigInfo()->FindVkbLayoutInfo( aVkbLayoutId );
|
|
1182 |
|
|
1183 |
if ( vkbCtrl && vkblayout )
|
|
1184 |
{
|
|
1185 |
vkbCtrl->SetRect( rect );
|
|
1186 |
DimKeys();
|
|
1187 |
|
|
1188 |
// Make the true draw
|
|
1189 |
UpdateArea( vkbCtrl->Rect(), EFalse );
|
|
1190 |
}
|
|
1191 |
|
|
1192 |
// Update data : vkb layout id
|
|
1193 |
iLayoutContext->SetData( EPeninputDataTypeVkbLayout, &aVkbLayoutId );
|
|
1194 |
|
|
1195 |
// Reset lang changed flag
|
|
1196 |
if ( iLangOrSizeChanged )
|
|
1197 |
{
|
|
1198 |
iLangOrSizeChanged = EFalse;
|
|
1199 |
}
|
|
1200 |
}
|
|
1201 |
|
|
1202 |
}
|
|
1203 |
|
|
1204 |
// --------------------------------------------------------------------------
|
|
1205 |
// CPeninputLayoutWindow::HandleRangeEvent
|
|
1206 |
// (other items were commented in a header)
|
|
1207 |
// --------------------------------------------------------------------------
|
|
1208 |
//
|
|
1209 |
EXPORT_C void CPeninputLayoutWindow::HandleRangeEvent( TInt aRange )
|
|
1210 |
{
|
|
1211 |
TInt curRange = CPeninputDataConverter::AnyToInt
|
|
1212 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
1213 |
|
|
1214 |
if (!IsCanChangeRange(aRange))
|
|
1215 |
{
|
|
1216 |
ChangeToPreviousRange(curRange);
|
|
1217 |
return;
|
|
1218 |
}
|
|
1219 |
|
|
1220 |
CPeninputRangeBarInfo* rangeBar = iConfigInfo->RangeBarInfo();
|
|
1221 |
if ( !rangeBar )
|
|
1222 |
{
|
|
1223 |
return;
|
|
1224 |
}
|
|
1225 |
|
|
1226 |
CPeninputRangeInfo* rangeInfo = rangeBar->FindRange( aRange );
|
|
1227 |
|
|
1228 |
if ( !rangeInfo )
|
|
1229 |
{
|
|
1230 |
return;
|
|
1231 |
}
|
|
1232 |
|
|
1233 |
TInt responseStyle = rangeInfo->ResponseStyle();
|
|
1234 |
if ( responseStyle == EPeninputRangeResponseNoAction )
|
|
1235 |
{
|
|
1236 |
return;
|
|
1237 |
}
|
|
1238 |
|
|
1239 |
if ( curRange != aRange )
|
|
1240 |
{
|
|
1241 |
if ( responseStyle == EPeninputRangeResponseSwitchRange )
|
|
1242 |
{
|
|
1243 |
TInt index = KInvalidIndex;
|
|
1244 |
|
|
1245 |
if ( aRange == ERangeAccent )
|
|
1246 |
{
|
|
1247 |
index = 0;
|
|
1248 |
}
|
|
1249 |
iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &index );
|
|
1250 |
|
|
1251 |
ChangeRange( aRange );
|
|
1252 |
|
|
1253 |
// When change range mannually, make the entire window visible
|
|
1254 |
TInt style = EPeninputPositionChangeBrJustify;
|
|
1255 |
TBuf<KIntSizeToInt16> bufStyle;
|
|
1256 |
bufStyle = ( TUint16* )&style;
|
|
1257 |
HandleControlEvent(EPeninputLayoutEventMovePosition, NULL, bufStyle);
|
|
1258 |
}
|
|
1259 |
else if ( responseStyle == EPeninputRangeResponsePopupChoiceItem )
|
|
1260 |
{
|
|
1261 |
PopupChoiceList();
|
|
1262 |
}
|
|
1263 |
}
|
|
1264 |
}
|
|
1265 |
|
|
1266 |
// --------------------------------------------------------------------------
|
|
1267 |
// CPeninputLayoutWindow::HandleRangeLoopEvent
|
|
1268 |
// (other items were commented in a header)
|
|
1269 |
// --------------------------------------------------------------------------
|
|
1270 |
//
|
|
1271 |
EXPORT_C void CPeninputLayoutWindow::HandleRangeLoopEvent( TInt aLoop )
|
|
1272 |
{
|
|
1273 |
TInt curRange = CPeninputDataConverter::AnyToInt
|
|
1274 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
1275 |
|
|
1276 |
CFepUiBaseCtrl* ctrl = iCtrlPool->Control( EPeninutWindowCtrlIdRangeBar );
|
|
1277 |
CAknFepCtrlRangeBar* rangebar = static_cast<CAknFepCtrlRangeBar*>( ctrl );
|
|
1278 |
|
|
1279 |
if ( rangebar )
|
|
1280 |
{
|
|
1281 |
TRAP_IGNORE( rangebar->SetCaseL( curRange, aLoop ) );
|
|
1282 |
|
|
1283 |
if ( ( curRange == ERangeEnglish ) || ( ConfigInfo()->CaseSensitive()
|
|
1284 |
&& ( curRange == ERangeNative ) ) )
|
|
1285 |
{
|
|
1286 |
TInt curCase = rangebar->GetCase( curRange );
|
|
1287 |
|
|
1288 |
|
|
1289 |
|
|
1290 |
// Store case in the data manager, the engine will
|
|
1291 |
// get notice at the same time
|
|
1292 |
iLayoutContext->SetData( EPeninputDataTypeCase, &curCase );
|
|
1293 |
|
|
1294 |
// Notify fep the new case
|
|
1295 |
TBuf<KIntLengthForByte> buf;
|
|
1296 |
CPeninputDataConverter::IntToDesc( curCase, buf );
|
|
1297 |
iLayoutContext->Sendkey( ESignalCaseMode, buf );
|
|
1298 |
}
|
|
1299 |
}
|
|
1300 |
}
|
|
1301 |
|
|
1302 |
// --------------------------------------------------------------------------
|
|
1303 |
// CPeninputLayoutWindow::CaseByShiftCapslockStatus
|
|
1304 |
// (other items were commented in a header)
|
|
1305 |
// --------------------------------------------------------------------------
|
|
1306 |
//
|
|
1307 |
EXPORT_C TInt CPeninputLayoutWindow::CaseByShiftCapslockStatus()
|
|
1308 |
{
|
|
1309 |
TInt shiftStatus = CPeninputDataConverter::AnyToInt
|
|
1310 |
( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) );
|
|
1311 |
TInt capslockStatus = CPeninputDataConverter::AnyToInt
|
|
1312 |
( iLayoutContext->RequestData( EPeninputDataTypeCapslockDown ) );
|
|
1313 |
|
|
1314 |
return ( capslockStatus * 2 + shiftStatus );
|
|
1315 |
}
|
|
1316 |
|
|
1317 |
// ---------------------------------------------------------------------------
|
|
1318 |
// CPeninputLayoutWindow::HandleShiftBtnClicked
|
|
1319 |
// (other items were commented in a header)
|
|
1320 |
// ---------------------------------------------------------------------------
|
|
1321 |
//
|
|
1322 |
EXPORT_C void CPeninputLayoutWindow::HandleShiftBtnClicked()
|
|
1323 |
{
|
|
1324 |
TInt curRange = CPeninputDataConverter::AnyToInt
|
|
1325 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
1326 |
TBool flag = ( curRange == ERangeEnglish ) || ( curRange == ERangeAccent )
|
|
1327 |
|| ( ConfigInfo()->CaseSensitive() && ( curRange == ERangeNative ) );
|
|
1328 |
|
|
1329 |
if ( flag && !( iLayoutContext->IsShiftPermitted() ) )
|
|
1330 |
{
|
|
1331 |
ChangeButtonStatus( 0, EPeninutWindowCtrlIdShiftBtn );
|
|
1332 |
return;
|
|
1333 |
}
|
|
1334 |
|
|
1335 |
TInt shiftStatus = CPeninputDataConverter::AnyToInt
|
|
1336 |
( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) );
|
|
1337 |
|
|
1338 |
if ( shiftStatus )
|
|
1339 |
{
|
|
1340 |
shiftStatus = 0;
|
|
1341 |
}
|
|
1342 |
else
|
|
1343 |
{
|
|
1344 |
shiftStatus = 1;
|
|
1345 |
}
|
|
1346 |
|
|
1347 |
// Update data
|
|
1348 |
iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftStatus );
|
|
1349 |
ChangeButtonStatus( shiftStatus, EPeninutWindowCtrlIdShiftBtn );
|
|
1350 |
|
|
1351 |
// Update vkb layout
|
|
1352 |
TInt caseid = CaseByShiftCapslockStatus();
|
|
1353 |
|
|
1354 |
TInt vkbLayout = iConfigInfo->ShiftCapsSingleVkbLayoutId( curRange,
|
|
1355 |
caseid );
|
|
1356 |
|
|
1357 |
TInt responseStyle =
|
|
1358 |
iConfigInfo->RangeBarInfo()->FindRange( curRange )->ResponseStyle();
|
|
1359 |
if ( ( curRange == ERangeAccent )
|
|
1360 |
&& ( responseStyle == EPeninputRangeResponsePopupChoiceItem ) )
|
|
1361 |
{
|
|
1362 |
TInt curAccentIndex = CPeninputDataConverter::AnyToInt
|
|
1363 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) );
|
|
1364 |
vkbLayout = vkbLayout + curAccentIndex * 2;
|
|
1365 |
}
|
|
1366 |
|
|
1367 |
ChangeVkbLayout( vkbLayout );
|
|
1368 |
|
|
1369 |
// Synchronize case if needed
|
|
1370 |
if ( flag )
|
|
1371 |
{
|
|
1372 |
// Notify fep the new case
|
|
1373 |
TBuf<KIntLengthForByte> buf;
|
|
1374 |
TInt fepcase = CPeninputDataConverter::FepCaseByCaseId( caseid );
|
|
1375 |
iLayoutContext->SetData( EPeninputDataTypeCase, &fepcase );
|
|
1376 |
CPeninputDataConverter::IntToDesc( fepcase, buf );
|
|
1377 |
iLayoutContext->Sendkey( ESignalCaseMode, buf );
|
|
1378 |
}
|
|
1379 |
}
|
|
1380 |
|
|
1381 |
// ---------------------------------------------------------------------------
|
|
1382 |
// CPeninputLayoutWindow::HandleCapslockBtnClicked
|
|
1383 |
// (other items were commented in a header)
|
|
1384 |
// ---------------------------------------------------------------------------
|
|
1385 |
//
|
|
1386 |
EXPORT_C void CPeninputLayoutWindow::HandleCapslockBtnClicked()
|
|
1387 |
{
|
|
1388 |
TInt curRange = CPeninputDataConverter::AnyToInt
|
|
1389 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
1390 |
TBool flag = ( curRange == ERangeEnglish ) || ( curRange == ERangeAccent )
|
|
1391 |
|| ( ConfigInfo()->CaseSensitive() && ( curRange == ERangeNative ) );
|
|
1392 |
|
|
1393 |
if ( flag && !( iLayoutContext->IsCapsLockPermitted() ) )
|
|
1394 |
{
|
|
1395 |
ChangeButtonStatus( 0, EPeninutWindowCtrlIdCapslockBtn );
|
|
1396 |
return;
|
|
1397 |
}
|
|
1398 |
|
|
1399 |
TInt capslockStatus = CPeninputDataConverter::AnyToInt
|
|
1400 |
( iLayoutContext->RequestData( EPeninputDataTypeCapslockDown ) );
|
|
1401 |
TInt shiftStatus = CPeninputDataConverter::AnyToInt
|
|
1402 |
( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) );
|
|
1403 |
|
|
1404 |
if ( capslockStatus )
|
|
1405 |
{
|
|
1406 |
capslockStatus = 0;
|
|
1407 |
}
|
|
1408 |
else
|
|
1409 |
{
|
|
1410 |
capslockStatus = 1;
|
|
1411 |
}
|
|
1412 |
|
|
1413 |
if( shiftStatus )
|
|
1414 |
{
|
|
1415 |
shiftStatus = 0;
|
|
1416 |
iLayoutContext->SetData( EPeninputDataTypeShiftDown,
|
|
1417 |
&shiftStatus );
|
|
1418 |
ChangeButtonStatus( shiftStatus, EPeninutWindowCtrlIdShiftBtn );
|
|
1419 |
}
|
|
1420 |
|
|
1421 |
// Update data
|
|
1422 |
iLayoutContext->SetData( EPeninputDataTypeCapslockDown,
|
|
1423 |
&capslockStatus );
|
|
1424 |
ChangeButtonStatus( capslockStatus, EPeninutWindowCtrlIdCapslockBtn );
|
|
1425 |
|
|
1426 |
// Update vkb layout
|
|
1427 |
TInt caseid = CaseByShiftCapslockStatus();
|
|
1428 |
TInt vkbLayout = iConfigInfo->ShiftCapsSingleVkbLayoutId( curRange,
|
|
1429 |
caseid );
|
|
1430 |
|
|
1431 |
TInt responseStyle =
|
|
1432 |
iConfigInfo->RangeBarInfo()->FindRange( curRange )->ResponseStyle();
|
|
1433 |
if ( ( curRange == ERangeAccent )
|
|
1434 |
&& ( responseStyle == EPeninputRangeResponsePopupChoiceItem ) )
|
|
1435 |
{
|
|
1436 |
TInt curAccentIndex = CPeninputDataConverter::AnyToInt
|
|
1437 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) );
|
|
1438 |
vkbLayout = vkbLayout + curAccentIndex * 2;
|
|
1439 |
}
|
|
1440 |
|
|
1441 |
ChangeVkbLayout( vkbLayout );
|
|
1442 |
|
|
1443 |
// Synchronize case if needed
|
|
1444 |
if ( flag )
|
|
1445 |
{
|
|
1446 |
// Notify fep the new case
|
|
1447 |
TBuf<KIntLengthForByte> buf;
|
|
1448 |
TInt fepcase = CPeninputDataConverter::FepCaseByCaseId( caseid );
|
|
1449 |
iLayoutContext->SetData( EPeninputDataTypeCase, &fepcase );
|
|
1450 |
CPeninputDataConverter::IntToDesc( fepcase, buf );
|
|
1451 |
iLayoutContext->Sendkey( ESignalCaseMode, buf );
|
|
1452 |
}
|
|
1453 |
}
|
|
1454 |
|
|
1455 |
// ---------------------------------------------------------------------------
|
|
1456 |
// CPeninputLayoutWindow::DimKeys
|
|
1457 |
// (other items were commented in a header)
|
|
1458 |
// ---------------------------------------------------------------------------
|
|
1459 |
//
|
|
1460 |
void CPeninputLayoutWindow::DimKeys()
|
|
1461 |
{
|
|
1462 |
CPeninputVkbCtrlExt* vkbCtrl = static_cast<CPeninputVkbCtrlExt*>
|
|
1463 |
( ClientPane()->ControlById( EPeninutWindowCtrlIdVkbCtrl ) );
|
|
1464 |
vkbCtrl->CancelDims();
|
|
1465 |
TInt currentRange = CPeninputDataConverter::AnyToInt
|
|
1466 |
( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
|
|
1467 |
TInt permitRange = CPeninputDataConverter::AnyToInt
|
|
1468 |
( iLayoutContext->RequestData( EPeninputDataTypePermittedRange ) );
|
|
1469 |
TInt keyMapping = CPeninputDataConverter::AnyToInt
|
|
1470 |
( iLayoutContext->RequestData( EPeninputDataTypeNumericKeymap ) );
|
|
1471 |
|
|
1472 |
if ( ( currentRange == ERangeNumber )
|
|
1473 |
&& ( permitRange == ERangeNumber ) )
|
|
1474 |
{
|
|
1475 |
HBufC* rs = NULL;
|
|
1476 |
TRAP_IGNORE(rs = GetKeyMappingStringL(keyMapping));
|
|
1477 |
if( rs )
|
|
1478 |
{
|
|
1479 |
vkbCtrl->DimKeys( rs );
|
|
1480 |
delete rs;
|
|
1481 |
}
|
|
1482 |
}
|
|
1483 |
vkbCtrl->Draw();
|
|
1484 |
}
|
|
1485 |
|
|
1486 |
// ---------------------------------------------------------------------------
|
|
1487 |
// CPeninputLayoutWindow::AddControlL
|
|
1488 |
// (other items were commented in a header)
|
|
1489 |
// ---------------------------------------------------------------------------
|
|
1490 |
//
|
|
1491 |
EXPORT_C void CPeninputLayoutWindow::AddNotOwnedControl(
|
|
1492 |
CFepUiBaseCtrl* aControl )
|
|
1493 |
{
|
|
1494 |
//do nothing if we already has the control.
|
|
1495 |
if ( KErrNotFound != ClientPane()->ControlList().Find( aControl ) )
|
|
1496 |
{
|
|
1497 |
return;
|
|
1498 |
}
|
|
1499 |
|
|
1500 |
if ( aControl )
|
|
1501 |
{
|
|
1502 |
( const_cast<RPointerArray<CFepUiBaseCtrl>&>
|
|
1503 |
( ClientPane()->ControlList() ) ).Append( aControl );
|
|
1504 |
aControl->SetParent( ClientPane() );
|
|
1505 |
RRegion region( KPeninputLayoutWindowRegionCount );
|
|
1506 |
region.Copy( ClientPane()->Region() );
|
|
1507 |
|
|
1508 |
region.AddRect( aControl->Rect() );
|
|
1509 |
ClientPane()->SetRegion( region );
|
|
1510 |
}
|
|
1511 |
}
|
|
1512 |
// ---------------------------------------------------------------------------
|
|
1513 |
// CPeninputLayoutWindow::ChangeButtonStatus
|
|
1514 |
// (other items were commented in a header)
|
|
1515 |
// ---------------------------------------------------------------------------
|
|
1516 |
//
|
|
1517 |
EXPORT_C void CPeninputLayoutWindow::ChangeButtonStatus( const TInt aIsDown,
|
|
1518 |
const TInt aControlId )
|
|
1519 |
{
|
|
1520 |
CAknFepCtrlEventButton* button =
|
|
1521 |
static_cast<CAknFepCtrlEventButton*>
|
|
1522 |
( ClientPane()->ControlById( aControlId ) );
|
|
1523 |
|
|
1524 |
if ( button )
|
|
1525 |
{
|
|
1526 |
button->SetHighlight( aIsDown == 0 ? EFalse : ETrue );
|
|
1527 |
}
|
|
1528 |
}
|
|
1529 |
|
|
1530 |
// ---------------------------------------------------------------------------
|
|
1531 |
// CPeninputLayoutWindow::ChangeLayoutPosition
|
|
1532 |
// (other items were commented in a header)
|
|
1533 |
// ---------------------------------------------------------------------------
|
|
1534 |
//
|
|
1535 |
EXPORT_C void CPeninputLayoutWindow::ChangeLayoutPosition( TInt aJustifyStyle )
|
|
1536 |
{
|
|
1537 |
switch ( aJustifyStyle )
|
|
1538 |
{
|
|
1539 |
case EPeninputPositionChangeBrJustify:
|
|
1540 |
{
|
|
1541 |
BottomRightJustify();
|
|
1542 |
}
|
|
1543 |
break;
|
|
1544 |
case EPeninputPositionChangeDataQuery:
|
|
1545 |
{
|
|
1546 |
BottomRightJustify();
|
|
1547 |
DataQueryJustify();
|
|
1548 |
}
|
|
1549 |
break;
|
|
1550 |
/*case EPeninputPositionChangeNone:
|
|
1551 |
break;*/
|
|
1552 |
default:
|
|
1553 |
{
|
|
1554 |
TopLeftJustify();
|
|
1555 |
}
|
|
1556 |
break;
|
|
1557 |
}
|
|
1558 |
}
|
|
1559 |
|
|
1560 |
// ---------------------------------------------------------------------------
|
|
1561 |
// CPeninputLayoutWindow::SetWindowRect
|
|
1562 |
// (other items were commented in a header)
|
|
1563 |
// ---------------------------------------------------------------------------
|
|
1564 |
//
|
|
1565 |
EXPORT_C void CPeninputLayoutWindow::SetWindowRect( const TRect& aRect )
|
|
1566 |
{
|
|
1567 |
TRect rect = aRect;
|
|
1568 |
|
|
1569 |
|
|
1570 |
TRect shadowRect = TRect( TPoint(),
|
|
1571 |
TSize( aRect.Width() + iShadowBrWidth + iShadowTlWidth,
|
|
1572 |
aRect.Height() + iShadowTlHeight + iShadowBrHeight)
|
|
1573 |
);
|
|
1574 |
|
|
1575 |
rect.Move( TPoint(iShadowTlWidth, iShadowTlHeight) - rect.iTl );
|
|
1576 |
|
|
1577 |
SetRect( rect );
|
|
1578 |
RootControl()->SetRect( rect );
|
|
1579 |
UiLayout()->SetShadowRect( shadowRect );
|
|
1580 |
}
|
|
1581 |
|
|
1582 |
|
|
1583 |
// -----------------------------------------------------------------------------
|
|
1584 |
// CPeninputLayoutWindow::SetSwitchBtnFont
|
|
1585 |
// (other items were commented in a header).
|
|
1586 |
// -----------------------------------------------------------------------------
|
|
1587 |
//
|
|
1588 |
EXPORT_C void CPeninputLayoutWindow::SetSwitchBtnFont(CAknFepCtrlEventButton& aSwitchBtn)
|
|
1589 |
{
|
|
1590 |
// read switch font laf info only when need
|
|
1591 |
if (CPeninputDataConverter::AnyToInt(
|
|
1592 |
iLayoutContext->RequestData(EAkninputDataTypeSizeChanging)) || (!iSwitchFontSet))
|
|
1593 |
{
|
|
1594 |
TAknTextLineLayout langSwitch;
|
|
1595 |
TAknTextLineLayout langSwitchShadow;
|
|
1596 |
|
|
1597 |
switch( iLayoutContext->LayoutType() )
|
|
1598 |
{
|
|
1599 |
case EPluginInputModeVkb:
|
|
1600 |
{
|
|
1601 |
langSwitch =
|
|
1602 |
AknLayoutScalable_Avkon::cell_vkb_side_pane_t1().LayoutLine();
|
|
1603 |
langSwitchShadow =
|
|
1604 |
AknLayoutScalable_Avkon::cell_vkb_side_pane_t1_copy1().LayoutLine();
|
|
1605 |
}
|
|
1606 |
break;
|
|
1607 |
case EPluginInputModeHwr:
|
|
1608 |
{
|
|
1609 |
langSwitch =
|
|
1610 |
AknLayoutScalable_Avkon::cell_hwr_side_pane_t1().LayoutLine();
|
|
1611 |
langSwitchShadow =
|
|
1612 |
AknLayoutScalable_Avkon::cell_hwr_side_pane_t1_copy1().LayoutLine();
|
|
1613 |
}
|
|
1614 |
break;
|
|
1615 |
default:
|
|
1616 |
{
|
|
1617 |
return;
|
|
1618 |
}
|
|
1619 |
}
|
|
1620 |
|
|
1621 |
iSwitchFont = langSwitch.iFont;
|
|
1622 |
iSwitchShadowFont = langSwitchShadow.iFont;
|
|
1623 |
}
|
|
1624 |
|
|
1625 |
aSwitchBtn.SetFont(AknLayoutUtils::FontFromId(iSwitchFont, NULL));
|
|
1626 |
aSwitchBtn.SetShadowFont(AknLayoutUtils::FontFromId(iSwitchShadowFont, NULL));
|
|
1627 |
iSwitchFontSet = ETrue;
|
|
1628 |
}
|
|
1629 |
|
|
1630 |
// ---------------------------------------------------------------------------
|
|
1631 |
// CPeninputLayoutWindow::TopLeftJustify
|
|
1632 |
// (other items were commented in a header)
|
|
1633 |
// ---------------------------------------------------------------------------
|
|
1634 |
//
|
|
1635 |
EXPORT_C void CPeninputLayoutWindow::SetSwitchBtnTextColor(CAknFepCtrlEventButton& aSwitchBtn)
|
|
1636 |
{
|
|
1637 |
TRgb textColor;
|
|
1638 |
TInt error = AknsUtils::GetCachedColor(UiLayout()->SkinInstance(),
|
|
1639 |
textColor,
|
|
1640 |
KAknsIIDQsnTextColors,
|
|
1641 |
EAknsCIQsnTextColorsCG59);
|
|
1642 |
|
|
1643 |
if (error != KErrNone)
|
|
1644 |
{
|
|
1645 |
textColor = TRgb(KDefaultTextColor);
|
|
1646 |
}
|
|
1647 |
|
|
1648 |
aSwitchBtn.SetFontColor( textColor );
|
|
1649 |
|
|
1650 |
TRgb shadowTextColor;
|
|
1651 |
error = AknsUtils::GetCachedColor(UiLayout()->SkinInstance(),
|
|
1652 |
shadowTextColor,
|
|
1653 |
KAknsIIDQsnTextColors,
|
|
1654 |
EAknsCIQsnTextColorsCG62);
|
|
1655 |
|
|
1656 |
if (error != KErrNone)
|
|
1657 |
{
|
|
1658 |
shadowTextColor = TRgb(KDefaultShadowTextColor);
|
|
1659 |
}
|
|
1660 |
|
|
1661 |
aSwitchBtn.SetShadowFontColor( shadowTextColor );
|
|
1662 |
}
|
|
1663 |
|
|
1664 |
// ---------------------------------------------------------------------------
|
|
1665 |
// CPeninputLayoutWindow::TopLeftJustify
|
|
1666 |
// (other items were commented in a header)
|
|
1667 |
// ---------------------------------------------------------------------------
|
|
1668 |
//
|
|
1669 |
void CPeninputLayoutWindow::TopLeftJustify()
|
|
1670 |
{
|
|
1671 |
// Read position from datamgr
|
|
1672 |
TSize layoutSize = UiLayout()->Rect().Size();
|
|
1673 |
|
|
1674 |
TPoint tl = UiLayout()->Position();
|
|
1675 |
|
|
1676 |
TPoint oldBr = tl + layoutSize;
|
|
1677 |
|
|
1678 |
if ( tl.iX < 0 )
|
|
1679 |
{
|
|
1680 |
tl.iX = 0;
|
|
1681 |
}
|
|
1682 |
|
|
1683 |
if ( tl.iY < 0 )
|
|
1684 |
{
|
|
1685 |
tl.iY = 0;
|
|
1686 |
}
|
|
1687 |
|
|
1688 |
TPoint br = tl + layoutSize;
|
|
1689 |
|
|
1690 |
if ( br != oldBr )
|
|
1691 |
{
|
|
1692 |
//Write the new position into CenRep
|
|
1693 |
TInt x = 0;
|
|
1694 |
TInt y = 0;
|
|
1695 |
x = 0x0000FFFF & br.iX;
|
|
1696 |
y = 0xFFFF0000 & ( br.iY << 16 );
|
|
1697 |
TInt pos = x | y;
|
|
1698 |
iLayoutContext->SetData( EPeninputDataTypeWindowPosition, &pos );
|
|
1699 |
}
|
|
1700 |
|
|
1701 |
//Set the layout position
|
|
1702 |
//UiLayout()->SetRect( newRect );
|
|
1703 |
UiLayout()->LayoutOwner()->SetPosition( tl );
|
|
1704 |
//UiLayout()->LayoutOwner()->LayoutSizeChanged( newRect.Size() );
|
|
1705 |
}
|
|
1706 |
|
|
1707 |
// ---------------------------------------------------------------------------
|
|
1708 |
// CPeninputLayoutWindow::BottomRightJustify
|
|
1709 |
// (other items were commented in a header).
|
|
1710 |
// ---------------------------------------------------------------------------
|
|
1711 |
//
|
|
1712 |
void CPeninputLayoutWindow::BottomRightJustify()
|
|
1713 |
{
|
|
1714 |
// Read position from datamgr
|
|
1715 |
TSize layoutSize( UiLayout()->Rect().Size() );
|
|
1716 |
TPoint oldbr;
|
|
1717 |
TPoint br;
|
|
1718 |
TPoint tl;
|
|
1719 |
TSize screenSize = *( ( TSize* ) iLayoutContext->RequestData
|
|
1720 |
( EPeninputDataTypeScreenSize ) );
|
|
1721 |
|
|
1722 |
TRect screenRect = TRect( TPoint( 0, 0 ), screenSize );
|
|
1723 |
|
|
1724 |
TInt windowPosition = CPeninputDataConverter::AnyToInt
|
|
1725 |
( iLayoutContext->RequestData( EPeninputDataTypeWindowPosition ) );
|
|
1726 |
|
|
1727 |
oldbr.iX = windowPosition & 0x0000FFFF;
|
|
1728 |
oldbr.iY = ( windowPosition & 0xFFFF0000 ) >> 16;
|
|
1729 |
|
|
1730 |
br = oldbr;
|
|
1731 |
|
|
1732 |
if ( !screenRect.Contains( br ) )
|
|
1733 |
{
|
|
1734 |
if ( screenSize.iWidth < br.iX )
|
|
1735 |
{
|
|
1736 |
br.iX = screenSize.iWidth;
|
|
1737 |
}
|
|
1738 |
if ( screenSize.iHeight < br.iY )
|
|
1739 |
{
|
|
1740 |
br.iY = screenSize.iHeight;
|
|
1741 |
}
|
|
1742 |
}
|
|
1743 |
|
|
1744 |
// Check the top left point is in screen
|
|
1745 |
tl.iX = br.iX - layoutSize.iWidth;
|
|
1746 |
if ( tl.iX < 0 )
|
|
1747 |
{
|
|
1748 |
tl.iX = 0;
|
|
1749 |
br.iX = layoutSize.iWidth;
|
|
1750 |
}
|
|
1751 |
|
|
1752 |
tl.iY = br.iY - layoutSize.iHeight;
|
|
1753 |
if ( tl.iY < 0 )
|
|
1754 |
{
|
|
1755 |
tl.iY = 0;
|
|
1756 |
br.iY = layoutSize.iHeight;
|
|
1757 |
}
|
|
1758 |
|
|
1759 |
|
|
1760 |
if ( oldbr != br )
|
|
1761 |
{
|
|
1762 |
//Write the new position into CenRep
|
|
1763 |
TInt x = 0;
|
|
1764 |
TInt y = 0;
|
|
1765 |
x = 0x0000FFFF & br.iX;
|
|
1766 |
y = 0xFFFF0000 & ( br.iY << 16 );
|
|
1767 |
TInt pos = x | y;
|
|
1768 |
iLayoutContext->SetData( EPeninputDataTypeWindowPosition, &pos );
|
|
1769 |
}
|
|
1770 |
|
|
1771 |
//Set the layout position
|
|
1772 |
//UiLayout()->SetRect( newRect );
|
|
1773 |
//UiLayout()->LayoutOwner()->LayoutSizeChanged( newRect.Size() );
|
|
1774 |
UiLayout()->LayoutOwner()->SetPosition( tl );
|
|
1775 |
}
|
|
1776 |
|
|
1777 |
// ---------------------------------------------------------------------------
|
|
1778 |
// CPeninputLayoutWindow::DataQueryJustify
|
|
1779 |
// (other items were commented in a header)
|
|
1780 |
// ---------------------------------------------------------------------------
|
|
1781 |
//
|
|
1782 |
void CPeninputLayoutWindow::DataQueryJustify()
|
|
1783 |
{
|
|
1784 |
TRect* dataQueryRect = ( TRect* )( iLayoutContext->RequestData
|
|
1785 |
( EPeninputDataTypeDataQueryDlgRect) );
|
|
1786 |
|
|
1787 |
TRect rect = TRect( UiLayout()->Position(), UiLayout()->Rect().Size() );
|
|
1788 |
|
|
1789 |
//move the VKB to the bottom-right corner
|
|
1790 |
TSize scrsz = UiLayout()->ScreenSize();
|
|
1791 |
|
|
1792 |
if( scrsz.iWidth < scrsz.iHeight )
|
|
1793 |
{
|
|
1794 |
return;
|
|
1795 |
}
|
|
1796 |
rect = TRect( TPoint( scrsz.iWidth - rect.Width(), scrsz.iHeight - rect.Height() ),
|
|
1797 |
rect.Size() );
|
|
1798 |
|
|
1799 |
//Write the new position into CenRep
|
|
1800 |
TInt x = 0;
|
|
1801 |
TInt y = 0;
|
|
1802 |
x = 0x0000FFFF & rect.iBr.iX;
|
|
1803 |
y = 0xFFFF0000 & ( rect.iBr.iY << 16 );
|
|
1804 |
TInt pos = x | y;
|
|
1805 |
iLayoutContext->SetData( EPeninputDataTypeWindowPosition, &pos );
|
|
1806 |
|
|
1807 |
/*if ( rect.Intersects( *dataQueryRect ) )
|
|
1808 |
{
|
|
1809 |
TInt Y = dataQueryRect->iTl.iY;
|
|
1810 |
TInt height = rect.iBr.iY - rect.iTl.iY;
|
|
1811 |
rect.iTl.iY = Y - height;
|
|
1812 |
rect.iBr.iY = Y;
|
|
1813 |
|
|
1814 |
if( rect.iTl.iY <0 )
|
|
1815 |
{
|
|
1816 |
rect.iTl.iY = 0;
|
|
1817 |
rect.iBr.iY = height;
|
|
1818 |
}
|
|
1819 |
//Write the new position into CenRep
|
|
1820 |
TInt x = 0;
|
|
1821 |
TInt y = 0;
|
|
1822 |
x = 0x0000FFFF & rect.iBr.iX;
|
|
1823 |
y = 0xFFFF0000 & ( rect.iBr.iY << 16 );
|
|
1824 |
TInt pos = x | y;
|
|
1825 |
iLayoutContext->SetData( EPeninputDataTypeWindowPosition, &pos );
|
|
1826 |
}
|
|
1827 |
*/
|
|
1828 |
//Set the layout position
|
|
1829 |
UiLayout()->SetRect( rect );
|
|
1830 |
UiLayout()->LayoutOwner()->SetPosition( rect.iTl );
|
|
1831 |
UiLayout()->LayoutOwner()->LayoutSizeChanged( rect.Size() );
|
|
1832 |
}
|
|
1833 |
|
|
1834 |
// ---------------------------------------------------------------------------
|
|
1835 |
// CPeninputLayoutWindow::ReadShadowInfoL
|
|
1836 |
// (other items were commented in a header)
|
|
1837 |
// ---------------------------------------------------------------------------
|
|
1838 |
//
|
|
1839 |
void CPeninputLayoutWindow::ReadShadowInfoL( TResourceReader aResReader )
|
|
1840 |
{
|
|
1841 |
TPtrC bmpFileName = aResReader.ReadTPtrC();
|
|
1842 |
TInt32 imgMajorSkinId = aResReader.ReadInt32();
|
|
1843 |
|
|
1844 |
TAknsItemID id;
|
|
1845 |
TInt skinitemid;
|
|
1846 |
|
|
1847 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
1848 |
|
|
1849 |
for ( TInt i = 0; i < KShadowBmpBr + 1; i++ )
|
|
1850 |
{
|
|
1851 |
const TInt16 bmpId = aResReader.ReadInt16();
|
|
1852 |
const TInt16 bmpMskId = aResReader.ReadInt16();
|
|
1853 |
skinitemid = aResReader.ReadInt16();
|
|
1854 |
|
|
1855 |
id.Set(TInt(imgMajorSkinId), skinitemid);
|
|
1856 |
|
|
1857 |
if (bmpId != KInvalidImg)
|
|
1858 |
{
|
|
1859 |
CFbsBitmap* shadowImg = NULL;
|
|
1860 |
CFbsBitmap* shadowMaskImg = NULL;
|
|
1861 |
|
|
1862 |
if (bmpMskId != KInvalidImg)
|
|
1863 |
{
|
|
1864 |
AknsUtils::CreateIconL(skininstance,
|
|
1865 |
id,
|
|
1866 |
shadowImg,
|
|
1867 |
shadowMaskImg,
|
|
1868 |
bmpFileName,
|
|
1869 |
bmpId,
|
|
1870 |
bmpMskId);
|
|
1871 |
}
|
|
1872 |
else
|
|
1873 |
{
|
|
1874 |
AknsUtils::CreateIconL(skininstance,
|
|
1875 |
id,
|
|
1876 |
shadowImg,
|
|
1877 |
bmpFileName,
|
|
1878 |
bmpId);
|
|
1879 |
}
|
|
1880 |
|
|
1881 |
UiLayout()->SetShadowBmp(shadowImg, shadowMaskImg, TShadowBitmapIndex(i));
|
|
1882 |
}
|
|
1883 |
}
|
|
1884 |
}
|
|
1885 |
|
|
1886 |
// ---------------------------------------------------------------------------
|
|
1887 |
// CPeninputLayoutWindow::ReadBackgroundInfoL
|
|
1888 |
// (other items were commented in a header)
|
|
1889 |
// ---------------------------------------------------------------------------
|
|
1890 |
//
|
|
1891 |
void CPeninputLayoutWindow::ReadBackgroundInfoL( TInt aResId )
|
|
1892 |
{
|
|
1893 |
if( aResId == 0 )
|
|
1894 |
return;
|
|
1895 |
|
|
1896 |
if( BackgroundBmp() )
|
|
1897 |
{
|
|
1898 |
CFbsBitmap* bkBmp = BackgroundBmp();
|
|
1899 |
delete bkBmp;
|
|
1900 |
SetBackgroundBmp( NULL );
|
|
1901 |
}
|
|
1902 |
if( BkMaskBmp() )
|
|
1903 |
{
|
|
1904 |
CFbsBitmap* bkMaskBmp = BkMaskBmp();
|
|
1905 |
delete bkMaskBmp;
|
|
1906 |
SetBackgroundMaskBmp( NULL );
|
|
1907 |
}
|
|
1908 |
|
|
1909 |
TResourceReader resReader;
|
|
1910 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, aResId );
|
|
1911 |
|
|
1912 |
TPtrC bmpFileName = resReader.ReadTPtrC();
|
|
1913 |
TInt32 imgMajorSkinId = resReader.ReadInt32();
|
|
1914 |
|
|
1915 |
TAknsItemID id;
|
|
1916 |
TInt skinitemid;
|
|
1917 |
|
|
1918 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
1919 |
const TInt16 bmpId = resReader.ReadInt16();
|
|
1920 |
const TInt16 bmpMskId = resReader.ReadInt16();
|
|
1921 |
skinitemid = resReader.ReadInt16();
|
|
1922 |
id.Set(TInt(imgMajorSkinId), skinitemid);
|
|
1923 |
|
|
1924 |
if (bmpId != KInvalidImg)
|
|
1925 |
{
|
|
1926 |
CFbsBitmap* backgroundImg = NULL;
|
|
1927 |
CFbsBitmap* backgroundMaskImg = NULL;
|
|
1928 |
if (bmpMskId != KInvalidImg)
|
|
1929 |
{
|
|
1930 |
AknsUtils::CreateIconL(skininstance,
|
|
1931 |
id,
|
|
1932 |
backgroundImg,
|
|
1933 |
backgroundMaskImg,
|
|
1934 |
bmpFileName,
|
|
1935 |
bmpId,
|
|
1936 |
bmpMskId);
|
|
1937 |
}
|
|
1938 |
else
|
|
1939 |
{
|
|
1940 |
AknsUtils::CreateIconL(skininstance,
|
|
1941 |
id,
|
|
1942 |
backgroundImg,
|
|
1943 |
bmpFileName,
|
|
1944 |
bmpId);
|
|
1945 |
}
|
|
1946 |
|
|
1947 |
SetBackgroundBmp( backgroundImg );
|
|
1948 |
SetBackgroundMaskBmp( backgroundMaskImg );
|
|
1949 |
}
|
|
1950 |
CleanupStack::PopAndDestroy( 1 );
|
|
1951 |
}
|
|
1952 |
|
|
1953 |
// ---------------------------------------------------------------------------
|
|
1954 |
// CPeninputLayoutWindow::ReadIcfInfo
|
|
1955 |
// (other items were commented in a header)
|
|
1956 |
// ---------------------------------------------------------------------------
|
|
1957 |
//
|
|
1958 |
EXPORT_C void CPeninputLayoutWindow::ReadIcfInfo( TResourceReader aResReader )
|
|
1959 |
{
|
|
1960 |
TPtrC bmpFileName = aResReader.ReadTPtrC();
|
|
1961 |
TInt32 imgMajorSkinId = aResReader.ReadInt32();
|
|
1962 |
|
|
1963 |
TAknsItemID id;
|
|
1964 |
TInt skinitemid;
|
|
1965 |
|
|
1966 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
1967 |
|
|
1968 |
const TInt16 icfbgId = aResReader.ReadInt16();
|
|
1969 |
const TInt16 icfbgmaskId = aResReader.ReadInt16();
|
|
1970 |
skinitemid = aResReader.ReadInt16();
|
|
1971 |
|
|
1972 |
id.Set( TInt( imgMajorSkinId ), skinitemid );
|
|
1973 |
|
|
1974 |
if ( icfbgId != KInvalidImg )
|
|
1975 |
{
|
|
1976 |
CFbsBitmap* icfImg = NULL;
|
|
1977 |
|
|
1978 |
if (icfbgmaskId != KInvalidImg)
|
|
1979 |
{
|
|
1980 |
CFbsBitmap* icfmaskImg = NULL;
|
|
1981 |
|
|
1982 |
TRAP_IGNORE( AknsUtils::CreateIconL(skininstance,
|
|
1983 |
id,
|
|
1984 |
icfImg,
|
|
1985 |
icfmaskImg,
|
|
1986 |
bmpFileName,
|
|
1987 |
icfbgId,
|
|
1988 |
icfbgmaskId ) );
|
|
1989 |
|
|
1990 |
AknIconUtils::SetSize(icfmaskImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
1991 |
TRAP_IGNORE( iInputContextField->SetBackgroundMaskBitmapL(icfmaskImg) );
|
|
1992 |
}
|
|
1993 |
else
|
|
1994 |
{
|
|
1995 |
TRAP_IGNORE( AknsUtils::CreateIconL(skininstance,
|
|
1996 |
id,
|
|
1997 |
icfImg,
|
|
1998 |
bmpFileName,
|
|
1999 |
icfbgId) );
|
|
2000 |
}
|
|
2001 |
|
|
2002 |
AknIconUtils::SetSize(icfImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
2003 |
TRAP_IGNORE( iInputContextField->SetBackgroundBitmapL(icfImg) );
|
|
2004 |
}
|
|
2005 |
|
|
2006 |
// read text color
|
|
2007 |
TRgb textcolor;
|
|
2008 |
TInt32 colorMajorSkinId = aResReader.ReadInt32();
|
|
2009 |
skinitemid = aResReader.ReadInt16();
|
|
2010 |
|
|
2011 |
id.Set(TInt(colorMajorSkinId), skinitemid);
|
|
2012 |
|
|
2013 |
const TInt16 textcoloridx = aResReader.ReadInt16();
|
|
2014 |
|
|
2015 |
TInt error = AknsUtils::GetCachedColor(skininstance,
|
|
2016 |
textcolor,
|
|
2017 |
id,
|
|
2018 |
textcoloridx);
|
|
2019 |
|
|
2020 |
if (error == KErrNone)
|
|
2021 |
{
|
|
2022 |
iInputContextField->SetTextColor( textcolor );
|
|
2023 |
}
|
|
2024 |
else
|
|
2025 |
{
|
|
2026 |
iInputContextField->SetTextColor( TRgb( KDefaultTextColor ) );
|
|
2027 |
}
|
|
2028 |
}
|
|
2029 |
|
|
2030 |
// ---------------------------------------------------------------------------
|
|
2031 |
// CPeninputLayoutWindow::Draw
|
|
2032 |
// (other items were commented in a header)
|
|
2033 |
// ---------------------------------------------------------------------------
|
|
2034 |
//
|
|
2035 |
EXPORT_C void CPeninputLayoutWindow::Draw()
|
|
2036 |
{
|
|
2037 |
// Draw shadow
|
|
2038 |
CAknFepCtrlBaseWindow::Draw();
|
|
2039 |
|
|
2040 |
//DrawShadow();
|
|
2041 |
|
|
2042 |
UpdateArea(UiLayout()->Rect(), EFalse);
|
|
2043 |
}
|
|
2044 |
|
|
2045 |
// ---------------------------------------------------------------------------
|
|
2046 |
// CPeninputLayoutWindow::GetKeyMappingStringL
|
|
2047 |
// (other items were commented in a header)
|
|
2048 |
// ---------------------------------------------------------------------------
|
|
2049 |
//
|
|
2050 |
HBufC* CPeninputLayoutWindow::GetKeyMappingStringL(TInt aKeyMapping)
|
|
2051 |
{
|
|
2052 |
HBufC* rs = NULL;
|
|
2053 |
if ( aKeyMapping == EKeymapFromResource )
|
|
2054 |
{
|
|
2055 |
HBufC* customRes = (HBufC*) iLayoutContext->RequestData(EAknFepDataTypeUseDefinedResource);
|
|
2056 |
_LIT(KTenNumbers,"0123456789");
|
|
2057 |
rs = HBufC::NewL(KTenNumbers().Length() + customRes->Length());
|
|
2058 |
rs->Des().Copy(*customRes);
|
|
2059 |
rs->Des().Append(KTenNumbers);
|
|
2060 |
}
|
|
2061 |
else
|
|
2062 |
{
|
|
2063 |
rs = iKeyMappingMgr->KeyMappingStringL( aKeyMapping );
|
|
2064 |
}
|
|
2065 |
|
|
2066 |
return rs;
|
|
2067 |
}
|
|
2068 |
|
|
2069 |
// ---------------------------------------------------------------------------
|
|
2070 |
// CPeninputLayoutWindow::SetEnableSwitchToHwr
|
|
2071 |
// (other items were commented in a header)
|
|
2072 |
// ---------------------------------------------------------------------------
|
|
2073 |
//
|
|
2074 |
EXPORT_C void CPeninputLayoutWindow::SetEnableSwitchToHwr(TBool aEnable)
|
|
2075 |
{
|
|
2076 |
CAknFepCtrlEventButton* switchToHwrBtn = static_cast<CAknFepCtrlEventButton*>
|
|
2077 |
( iCtrlPool->Control( EPeninutWindowCtrlIdSwitchToHwrBtn ) );
|
|
2078 |
|
|
2079 |
if( switchToHwrBtn != NULL )
|
|
2080 |
{
|
|
2081 |
if ( aEnable )
|
|
2082 |
{
|
|
2083 |
switchToHwrBtn->SetDimmed(EFalse);
|
|
2084 |
}
|
|
2085 |
else
|
|
2086 |
{
|
|
2087 |
switchToHwrBtn->SetDimmed(ETrue);
|
|
2088 |
switchToHwrBtn->SetActive(EFalse);
|
|
2089 |
}
|
|
2090 |
}
|
|
2091 |
}
|
|
2092 |
|
|
2093 |
// ---------------------------------------------------------------------------
|
|
2094 |
// CPeninputLayoutWindow::SetEnableSettingBtn
|
|
2095 |
// (other items were commented in a header)
|
|
2096 |
// ---------------------------------------------------------------------------
|
|
2097 |
//
|
|
2098 |
EXPORT_C void CPeninputLayoutWindow::SetEnableSettingBtn(TBool aEnable)
|
|
2099 |
{
|
|
2100 |
CAknFepCtrlEventButton* langSetBtn = static_cast<CAknFepCtrlEventButton*>
|
|
2101 |
( iCtrlPool->Control( EPeninutWindowCtrlIdInputLangSwitcherBtn ) );
|
|
2102 |
|
|
2103 |
|
|
2104 |
if( langSetBtn != NULL )
|
|
2105 |
{
|
|
2106 |
if ( aEnable )
|
|
2107 |
{
|
|
2108 |
langSetBtn->SetDimmed(EFalse);
|
|
2109 |
iTouchInputOptionButton->SetDimmed(EFalse);
|
|
2110 |
}
|
|
2111 |
else
|
|
2112 |
{
|
|
2113 |
langSetBtn->SetDimmed(ETrue);
|
|
2114 |
langSetBtn->SetActive(EFalse);
|
|
2115 |
iTouchInputOptionButton->SetDimmed(ETrue);
|
|
2116 |
iTouchInputOptionButton->SetActive(EFalse);
|
|
2117 |
}
|
|
2118 |
}
|
|
2119 |
}
|
|
2120 |
|
|
2121 |
// ---------------------------------------------------------------------------
|
|
2122 |
// CPeninputLayoutWindow::ReconfigUnitSize
|
|
2123 |
// (other items were commented in a header)
|
|
2124 |
// ---------------------------------------------------------------------------
|
|
2125 |
//
|
|
2126 |
EXPORT_C TBool CPeninputLayoutWindow::ReconfigUnitSize(TInt /*aClientLayoutId*/)
|
|
2127 |
{
|
|
2128 |
return EFalse;
|
|
2129 |
}
|
|
2130 |
|
|
2131 |
void CPeninputLayoutWindow::AddMultiContextFieldL()
|
|
2132 |
{
|
|
2133 |
const CFont* icfFont = NULL;
|
|
2134 |
TAknTextLineLayout textPaneTextLayout;
|
|
2135 |
|
|
2136 |
textPaneTextLayout =
|
|
2137 |
AknLayoutScalable_Avkon::fep_vkb_top_text_pane_t1().LayoutLine();
|
|
2138 |
|
|
2139 |
icfFont = AknLayoutUtils::FontFromId( textPaneTextLayout.iFont, NULL );
|
|
2140 |
if ( icfFont )
|
|
2141 |
{
|
|
2142 |
iMultiLineIcf = CFepLayoutMultiLineIcf::NewL( TRect(),
|
|
2143 |
UiLayout(), EPeninputWindowCtrlIdMultiLineICF,
|
|
2144 |
icfFont->HeightInPixels(),
|
|
2145 |
icfFont->FontMaxHeight(),icfFont );
|
|
2146 |
|
|
2147 |
HeaderPane()->AddControlL( iMultiLineIcf );
|
|
2148 |
|
|
2149 |
// Add layout as event observer
|
|
2150 |
iMultiLineIcf->AddEventObserver( UiLayout() );
|
|
2151 |
iMultiLineIcf->SetFocus(ETrue);
|
|
2152 |
}
|
|
2153 |
}
|
|
2154 |
|
|
2155 |
EXPORT_C TBool CPeninputLayoutWindow::IsMultiLineIcf()
|
|
2156 |
{
|
|
2157 |
return EFalse;
|
|
2158 |
}
|
|
2159 |
|
|
2160 |
|
|
2161 |
void CPeninputLayoutWindow::ReadMultiLineIcfInforL(TInt aResID)
|
|
2162 |
{
|
|
2163 |
if (!aResID)
|
|
2164 |
{
|
|
2165 |
return;
|
|
2166 |
}
|
|
2167 |
|
|
2168 |
TResourceReader resReader;
|
|
2169 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, aResID );
|
|
2170 |
|
|
2171 |
TPtrC bmpFileName = resReader.ReadTPtrC();
|
|
2172 |
TInt32 imgMajorSkinId = resReader.ReadInt32();
|
|
2173 |
|
|
2174 |
TAknsItemID id;
|
|
2175 |
TInt skinitemid;
|
|
2176 |
|
|
2177 |
MAknsSkinInstance* skininstance = UiLayout()->SkinInstance();
|
|
2178 |
|
|
2179 |
const TInt16 icfbgId = resReader.ReadInt16();
|
|
2180 |
const TInt16 icfbgmaskId = resReader.ReadInt16();
|
|
2181 |
skinitemid = resReader.ReadInt16();
|
|
2182 |
|
|
2183 |
id.Set( TInt( imgMajorSkinId ), skinitemid );
|
|
2184 |
|
|
2185 |
if ( icfbgId != KInvalidImg )
|
|
2186 |
{
|
|
2187 |
CFbsBitmap* icfImg = NULL;
|
|
2188 |
|
|
2189 |
if (icfbgmaskId != KInvalidImg)
|
|
2190 |
{
|
|
2191 |
CFbsBitmap* icfmaskImg = NULL;
|
|
2192 |
|
|
2193 |
TRAP_IGNORE( AknsUtils::CreateIconL(skininstance,
|
|
2194 |
id,
|
|
2195 |
icfImg,
|
|
2196 |
icfmaskImg,
|
|
2197 |
bmpFileName,
|
|
2198 |
icfbgId,
|
|
2199 |
icfbgmaskId ) );
|
|
2200 |
|
|
2201 |
AknIconUtils::SetSize(icfmaskImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
2202 |
TRAP_IGNORE( iMultiLineIcf->SetBackgroundMaskBitmapL(icfmaskImg) );
|
|
2203 |
}
|
|
2204 |
else
|
|
2205 |
{
|
|
2206 |
TRAP_IGNORE( AknsUtils::CreateIconL(skininstance,
|
|
2207 |
id,
|
|
2208 |
icfImg,
|
|
2209 |
bmpFileName,
|
|
2210 |
icfbgId) );
|
|
2211 |
}
|
|
2212 |
|
|
2213 |
AknIconUtils::SetSize(icfImg, TSize(1,1), EAspectRatioNotPreserved);
|
|
2214 |
TRAP_IGNORE( iMultiLineIcf->SetBackgroundBitmapL(icfImg) );
|
|
2215 |
}
|
|
2216 |
|
|
2217 |
// read text color
|
|
2218 |
TRgb textcolor;
|
|
2219 |
TInt32 colorMajorSkinId = resReader.ReadInt32();
|
|
2220 |
skinitemid = resReader.ReadInt16();
|
|
2221 |
|
|
2222 |
id.Set(TInt(colorMajorSkinId), skinitemid);
|
|
2223 |
|
|
2224 |
const TInt16 textcoloridx = resReader.ReadInt16();
|
|
2225 |
|
|
2226 |
TInt error = AknsUtils::GetCachedColor(skininstance,
|
|
2227 |
textcolor,
|
|
2228 |
id,
|
|
2229 |
textcoloridx);
|
|
2230 |
|
|
2231 |
if (error == KErrNone)
|
|
2232 |
{
|
|
2233 |
iMultiLineIcf->SetTextColorL( textcolor );
|
|
2234 |
}
|
|
2235 |
else
|
|
2236 |
{
|
|
2237 |
iMultiLineIcf->SetTextColorL( TRgb( KDefaultTextColor ) );
|
|
2238 |
}
|
|
2239 |
CleanupStack::PopAndDestroy( 1 ); // resReader*/
|
|
2240 |
}
|
|
2241 |
|
|
2242 |
EXPORT_C TBool CPeninputLayoutWindow::IsCanChangeRange(TInt /*aRange*/)
|
|
2243 |
{
|
|
2244 |
return ETrue;
|
|
2245 |
}
|
|
2246 |
|
|
2247 |
EXPORT_C void CPeninputLayoutWindow::ChangeToPreviousRange(TInt /*aRange*/)
|
|
2248 |
{
|
|
2249 |
|
|
2250 |
}
|
|
2251 |
|
|
2252 |
EXPORT_C void CPeninputLayoutWindow::SetTextAlignmentL( TInt aAlignment )
|
|
2253 |
{
|
|
2254 |
if ( iMultiLineIcf && ConfigInfo()->Language() != ELangNone )
|
|
2255 |
{
|
|
2256 |
iMultiLineIcf->SetTextAlignmentL( aAlignment, ConfigInfo()->Language() );
|
|
2257 |
}
|
|
2258 |
}
|
|
2259 |
//End Of File
|