44
|
1 |
/*
|
|
2 |
* Copyright (c) 2009-2010 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: Implementation of symbol table.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE
|
|
20 |
#include <peninputfingerhwrarwnd.rsg>
|
|
21 |
|
|
22 |
#include <coemain.h>
|
|
23 |
#include <s32mem.h>
|
|
24 |
#include <barsread.h>
|
|
25 |
|
|
26 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
27 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
28 |
#include <AknLayoutDef.h>
|
|
29 |
#include <AknUtils.h>
|
|
30 |
#include <AknsUtils.h>
|
|
31 |
#include <akniconutils.h>
|
|
32 |
#include <aknfeppeninputenums.h>
|
|
33 |
#include <AknFepGlobalEnums.h>
|
|
34 |
|
|
35 |
#include <peninputlayout.h>
|
|
36 |
#include <peninputrepeatbutton.h>
|
|
37 |
|
|
38 |
#include "hbufcarrayar.h"
|
|
39 |
#include "peninputfingerhwrarevent.h"
|
|
40 |
#include "peninputfingerhwrarcontrolid.h"
|
|
41 |
#include "peninputfingerhwrarstoreconstants.h"
|
|
42 |
#include "peninputlayoutvkb.h"
|
|
43 |
#include "peninputfingerhwrarnumsymboltable.h"
|
|
44 |
#include "peninputfingerhwarvkbutility.h"
|
|
45 |
|
|
46 |
const TUint16 KInvalidChar = 0xFFFF;
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
// Symbian Constructor
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
CPeninputArabicFingerHwrNumSymbolTable* CPeninputArabicFingerHwrNumSymbolTable::NewL(
|
|
52 |
CFepUiLayout* aUiLayout, TInt aId )
|
|
53 |
{
|
|
54 |
CPeninputArabicFingerHwrNumSymbolTable* self = CPeninputArabicFingerHwrNumSymbolTable::NewLC(
|
|
55 |
aUiLayout, aId );
|
|
56 |
|
|
57 |
CleanupStack::Pop( self ); // self;
|
|
58 |
return self;
|
|
59 |
}
|
|
60 |
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
// Symbian Constructor
|
|
63 |
// ---------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
CPeninputArabicFingerHwrNumSymbolTable* CPeninputArabicFingerHwrNumSymbolTable::NewLC(
|
|
66 |
CFepUiLayout* aUiLayout, TInt aId )
|
|
67 |
{
|
|
68 |
CPeninputArabicFingerHwrNumSymbolTable* self = new (ELeave) CPeninputArabicFingerHwrNumSymbolTable(
|
|
69 |
aUiLayout, aId );
|
|
70 |
CleanupStack::PushL( self );
|
|
71 |
self->ConstructL();
|
|
72 |
return self;
|
|
73 |
}
|
|
74 |
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
// C++ constructor.
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
CPeninputArabicFingerHwrNumSymbolTable::CPeninputArabicFingerHwrNumSymbolTable(
|
|
80 |
CFepUiLayout* aFepUiLayout, TInt aControlId )
|
|
81 |
: CControlGroup( aFepUiLayout, aControlId ),iIsNativeNumMode(EFalse)
|
|
82 |
{
|
|
83 |
SetControlType(ECtrlControlGroup|ECtrlTactileFeedback);
|
|
84 |
SetTactileFeedbackType(ETouchFeedbackSensitiveInput);
|
|
85 |
}
|
|
86 |
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
// c++ destructor
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
CPeninputArabicFingerHwrNumSymbolTable::~CPeninputArabicFingerHwrNumSymbolTable()
|
|
92 |
{
|
|
93 |
}
|
|
94 |
|
|
95 |
// ---------------------------------------------------------------------------
|
|
96 |
// popup the list.
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
void CPeninputArabicFingerHwrNumSymbolTable::OpenSymbolTable()
|
|
100 |
{
|
|
101 |
CapturePointer( ETrue );
|
|
102 |
iPopupVisible = ETrue;
|
|
103 |
UiLayout()->LockArea(UiLayout()->Rect(),this);
|
|
104 |
// signal server to add the pop area
|
|
105 |
if(UiLayout()->NotDrawToLayoutDevice())
|
|
106 |
{
|
|
107 |
struct SData
|
|
108 |
{
|
|
109 |
TRect rr;
|
|
110 |
TBool flag;
|
|
111 |
} data;
|
|
112 |
|
|
113 |
data.rr = iNumKeypad->Rect();
|
|
114 |
data.flag = ETrue;
|
|
115 |
TPtrC ptrForAdd;
|
|
116 |
ptrForAdd.Set(reinterpret_cast<const TUint16*>(&data),sizeof(data)/sizeof(TUint16));
|
|
117 |
|
|
118 |
UiLayout()->SignalOwner(ESignalPopupArea,ptrForAdd);
|
|
119 |
}
|
|
120 |
|
|
121 |
RefreshNumSymbolTable();;
|
|
122 |
}
|
|
123 |
|
|
124 |
// ---------------------------------------------------------------------------
|
|
125 |
// cancel the popup.
|
|
126 |
// ---------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
void CPeninputArabicFingerHwrNumSymbolTable::CloseSymbolTable()
|
|
129 |
{
|
|
130 |
CapturePointer( EFalse );
|
|
131 |
iPopupVisible = EFalse;
|
|
132 |
// signal server to remove the pop area
|
|
133 |
if(UiLayout()->NotDrawToLayoutDevice())
|
|
134 |
{
|
|
135 |
struct SData
|
|
136 |
{
|
|
137 |
TRect rr;
|
|
138 |
TBool flag;
|
|
139 |
} data;
|
|
140 |
|
|
141 |
data.rr = iNumKeypad->Rect();
|
|
142 |
data.flag = EFalse;
|
|
143 |
TPtrC ptrForRemove;
|
|
144 |
ptrForRemove.Set(reinterpret_cast<const TUint16*>(&data),sizeof(data)/sizeof(TUint16));
|
|
145 |
|
|
146 |
UiLayout()->SignalOwner(ESignalPopupArea,ptrForRemove);
|
|
147 |
}
|
|
148 |
UiLayout()->UnLockArea(UiLayout()->Rect(),this);
|
|
149 |
}
|
|
150 |
|
|
151 |
// ---------------------------------------------------------------------------
|
|
152 |
// get visibility of popup.
|
|
153 |
// ---------------------------------------------------------------------------
|
|
154 |
//
|
|
155 |
TBool CPeninputArabicFingerHwrNumSymbolTable::IsPopup()
|
|
156 |
{
|
|
157 |
return iPopupVisible;
|
|
158 |
}
|
|
159 |
|
|
160 |
// ---------------------------------------------------------------------------
|
|
161 |
// Handle pointer down event.
|
|
162 |
// ---------------------------------------------------------------------------
|
|
163 |
//
|
|
164 |
CFepUiBaseCtrl* CPeninputArabicFingerHwrNumSymbolTable::HandlePointerDownEventL(
|
|
165 |
const TPoint& aPoint )
|
|
166 |
{
|
|
167 |
CancelPointerDownL();
|
|
168 |
CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerDownEventL( aPoint );
|
|
169 |
|
|
170 |
if(!ctrl)
|
|
171 |
{
|
|
172 |
ReportEvent(EHwrEventOutsideEvent);
|
|
173 |
}
|
|
174 |
else
|
|
175 |
{
|
|
176 |
#ifdef RD_TACTILE_FEEDBACK
|
|
177 |
if (UiLayout()->SupportTactileFeedback())
|
|
178 |
{
|
|
179 |
UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveInput);
|
|
180 |
}
|
|
181 |
#endif //RD_TACTILE_FEEDBACK
|
|
182 |
ctrl->UpdateArea(ctrl->Rect(),EFalse);
|
|
183 |
}
|
|
184 |
|
|
185 |
return ctrl;
|
|
186 |
}
|
|
187 |
|
|
188 |
// ---------------------------------------------------------------------------
|
|
189 |
// Handle pointer up event.
|
|
190 |
// ---------------------------------------------------------------------------
|
|
191 |
//
|
|
192 |
CFepUiBaseCtrl* CPeninputArabicFingerHwrNumSymbolTable::HandlePointerUpEventL(
|
|
193 |
const TPoint& aPoint )
|
|
194 |
{
|
|
195 |
CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerUpEventL( aPoint );
|
|
196 |
|
|
197 |
if(ctrl)
|
|
198 |
{
|
|
199 |
ctrl->UpdateArea(ctrl->Rect(),EFalse);
|
|
200 |
}
|
|
201 |
|
|
202 |
return ctrl;
|
|
203 |
}
|
|
204 |
|
|
205 |
// ---------------------------------------------------------------------------
|
|
206 |
// Handle pointer move event.
|
|
207 |
// ---------------------------------------------------------------------------
|
|
208 |
//
|
|
209 |
CFepUiBaseCtrl* CPeninputArabicFingerHwrNumSymbolTable::HandlePointerMoveEventL(
|
|
210 |
const TPoint& aPoint )
|
|
211 |
{
|
|
212 |
CFepUiBaseCtrl* ctrl = CControlGroup::HandlePointerMoveEventL( aPoint );
|
|
213 |
if(ctrl)
|
|
214 |
{
|
|
215 |
HandlePointerEnter(aPoint);
|
|
216 |
ctrl->UpdateArea(ctrl->Rect(),EFalse);
|
|
217 |
}
|
|
218 |
else
|
|
219 |
{
|
|
220 |
HandlePointerLeave(aPoint);
|
|
221 |
UpdateArea(iRect,EFalse);
|
|
222 |
}
|
|
223 |
|
|
224 |
return ctrl;
|
|
225 |
}
|
|
226 |
|
|
227 |
// ---------------------------------------------------------------------------
|
|
228 |
// Symbian second-phase constructor.
|
|
229 |
// ---------------------------------------------------------------------------
|
|
230 |
//
|
|
231 |
void CPeninputArabicFingerHwrNumSymbolTable::ConstructL()
|
|
232 |
{
|
|
233 |
BaseConstructL();
|
|
234 |
|
|
235 |
// disable border
|
|
236 |
SetBorderSize( TSize(0,0) );
|
|
237 |
|
|
238 |
// construct virtual keypad
|
|
239 |
CreateVirtualKeypadL();
|
|
240 |
}
|
|
241 |
|
|
242 |
// ---------------------------------------------------------------------------
|
|
243 |
// SizeChanged
|
|
244 |
// ---------------------------------------------------------------------------
|
|
245 |
//
|
|
246 |
void CPeninputArabicFingerHwrNumSymbolTable::SizeChanged(const TRect& aVirtualKeypadRect)
|
|
247 |
{
|
|
248 |
// relayout the virtual key pad
|
|
249 |
iNumKeypad->SetRect(aVirtualKeypadRect);
|
|
250 |
}
|
|
251 |
|
|
252 |
// ---------------------------------------------------------------------------
|
|
253 |
// create symbol table keypad.
|
|
254 |
// ---------------------------------------------------------------------------
|
|
255 |
//
|
|
256 |
void CPeninputArabicFingerHwrNumSymbolTable::CreateVirtualKeypadL()
|
|
257 |
{
|
|
258 |
TFontSpec spec;
|
|
259 |
|
|
260 |
iNumKeypad = CVirtualKeyboard::NewL(
|
|
261 |
TRect(0,0,0,0),
|
|
262 |
UiLayout(),
|
|
263 |
EHwrCtrlIdNumSymbolTableVkb,
|
|
264 |
spec );
|
|
265 |
|
|
266 |
AddControlL( iNumKeypad );
|
|
267 |
iNumKeypad->AddEventObserver( UiLayout() );
|
|
268 |
|
|
269 |
iNumKeypad->SetKeySkinId( EKeyBmpNormal, KAknsIIDQsnFrKeypadButtonFrNormal );
|
|
270 |
iNumKeypad->SetKeySkinId( EKeyBmpHighlight, KAknsIIDQsnFrKeypadButtonFrPressed );
|
|
271 |
iNumKeypad->SetKeySkinId( EKeyBmpDim, KAknsIIDQsnFrKeypadButtonFrInactive );
|
|
272 |
iNumKeypad->SetResourceId( KInvalidResId );
|
|
273 |
|
|
274 |
iNumKeypad->SetKeyTextColorGroup( EAknsCIQsnTextColorsCG68 );
|
|
275 |
iNumKeypad->SetDrawOpaqueBackground( EFalse );
|
|
276 |
}
|
|
277 |
|
|
278 |
// ---------------------------------------------------------------------------
|
|
279 |
// Read control's background info.
|
|
280 |
// ---------------------------------------------------------------------------
|
|
281 |
//
|
|
282 |
void CPeninputArabicFingerHwrNumSymbolTable::ConstructFromResourceL()
|
|
283 |
{
|
|
284 |
if ( iResourceId == KInvalidResId )
|
|
285 |
{
|
|
286 |
User::Leave( KErrArgument );
|
|
287 |
}
|
|
288 |
|
|
289 |
TResourceReader reader;
|
|
290 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId );
|
|
291 |
|
|
292 |
const TInt32 bgImageResId = reader.ReadInt32();
|
|
293 |
LoadBackgroundFromResourceL(bgImageResId);
|
|
294 |
|
|
295 |
CleanupStack::PopAndDestroy( 1 ); //reader
|
|
296 |
|
|
297 |
|
|
298 |
CControlGroup::ConstructFromResourceL();
|
|
299 |
}
|
|
300 |
|
|
301 |
// ---------------------------------------------------------------------------
|
|
302 |
// Read control's background info.
|
|
303 |
// ---------------------------------------------------------------------------
|
|
304 |
//
|
|
305 |
void CPeninputArabicFingerHwrNumSymbolTable::LoadBackgroundFromResourceL( const TInt aResId )
|
|
306 |
{
|
|
307 |
if ( aResId == 0 )
|
|
308 |
return;
|
|
309 |
|
|
310 |
if ( BackgroundBmp() )
|
|
311 |
{
|
|
312 |
CFbsBitmap* bkBmp = BackgroundBmp();
|
|
313 |
delete bkBmp;
|
|
314 |
SetBackgroundBmp( NULL );
|
|
315 |
}
|
|
316 |
if ( BkMaskBmp() )
|
|
317 |
{
|
|
318 |
CFbsBitmap* bkMaskBmp = BkMaskBmp();
|
|
319 |
delete bkMaskBmp;
|
|
320 |
SetBackgroundMaskBmp( NULL );
|
|
321 |
}
|
|
322 |
|
|
323 |
TResourceReader resReader;
|
|
324 |
CCoeEnv::Static()->CreateResourceReaderLC( resReader, aResId );
|
|
325 |
|
|
326 |
TPtrC bmpFileName = resReader.ReadTPtrC();
|
|
327 |
TInt32 imgMajorSkinId = resReader.ReadInt32();
|
|
328 |
|
|
329 |
TAknsItemID id;
|
|
330 |
TInt skinitemid;
|
|
331 |
|
|
332 |
MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
|
|
333 |
const TInt16 bmpId = resReader.ReadInt16();
|
|
334 |
const TInt16 bmpMskId = resReader.ReadInt16();
|
|
335 |
skinitemid = resReader.ReadInt16();
|
|
336 |
id.Set( TInt( imgMajorSkinId ), skinitemid );
|
|
337 |
|
|
338 |
if ( bmpId != KInvalidImg )
|
|
339 |
{
|
|
340 |
CFbsBitmap* backgroundImg = NULL;
|
|
341 |
CFbsBitmap* backgroundMaskImg = NULL;
|
|
342 |
if ( bmpMskId != KInvalidImg )
|
|
343 |
{
|
|
344 |
AknsUtils::CreateIconL( skininstance, id, backgroundImg,
|
|
345 |
backgroundMaskImg, bmpFileName, bmpId, bmpMskId );
|
|
346 |
}
|
|
347 |
else
|
|
348 |
{
|
|
349 |
AknsUtils::CreateIconL( skininstance, id, backgroundImg,
|
|
350 |
bmpFileName, bmpId );
|
|
351 |
}
|
|
352 |
|
|
353 |
SetBackgroundBmp( backgroundImg );
|
|
354 |
SetBackgroundMaskBmp( backgroundMaskImg );
|
|
355 |
}
|
|
356 |
CleanupStack::PopAndDestroy( 1 ); //reader
|
|
357 |
}
|
|
358 |
|
|
359 |
// ---------------------------------------------------------------------------
|
|
360 |
// Load virtual keys image
|
|
361 |
// ---------------------------------------------------------------------------
|
|
362 |
//
|
|
363 |
void CPeninputArabicFingerHwrNumSymbolTable::LoadVkbKeyImageL(TInt aResId, const TSize& aKeySize)
|
|
364 |
{
|
|
365 |
PeninputFingerHwrArVkbUtility::LoadVkbKeyImageL(*iNumKeypad,aResId,aKeySize);
|
|
366 |
}
|
|
367 |
|
|
368 |
// ---------------------------------------------------------------------------
|
|
369 |
// Load virtual keys
|
|
370 |
// ---------------------------------------------------------------------------
|
|
371 |
//
|
|
372 |
void CPeninputArabicFingerHwrNumSymbolTable::LoadVirtualKeypadKeyL(const TInt aResId, const RArray<TRect>& aCellRects)
|
|
373 |
{
|
|
374 |
PeninputFingerHwrArVkbUtility::LoadVirtualKeypadKeyL(*iNumKeypad,aResId,aCellRects);
|
|
375 |
}
|
|
376 |
|
|
377 |
// ---------------------------------------------------------------------------
|
|
378 |
// accept editor's number mapping restriction.
|
|
379 |
// ---------------------------------------------------------------------------
|
|
380 |
//
|
|
381 |
void CPeninputArabicFingerHwrNumSymbolTable::UpdateTableSymbol( const TDesC& aNumMapping )
|
|
382 |
{
|
|
383 |
HBufC* charTable = GenerateCharTable(aNumMapping);
|
|
384 |
if(charTable)
|
|
385 |
{
|
|
386 |
TInt charTalbeCount = charTable->Length();
|
|
387 |
|
|
388 |
//numberpad
|
|
389 |
TInt keyCount = iNumKeypad->KeyArray().Count();
|
|
390 |
for ( TInt i = 0; i < keyCount; i++ )
|
|
391 |
{
|
|
392 |
CVirtualKey* vk = iNumKeypad->KeyArray()[i];
|
|
393 |
|
|
394 |
if(i < charTalbeCount && (*charTable)[i] != KInvalidChar)
|
|
395 |
{
|
|
396 |
TBuf<1> keydata;
|
|
397 |
TUint16 keyCode = (*charTable)[i];
|
|
398 |
keydata.Append(keyCode);
|
|
399 |
vk->SetKeyData(keydata);
|
|
400 |
vk->SetKeyScancode(keyCode);
|
|
401 |
vk->SetDimmed( EFalse );
|
|
402 |
}
|
|
403 |
else
|
|
404 |
{
|
|
405 |
vk->SetKeyData( KNullDesC );
|
|
406 |
vk->SetKeyScancode( KInvalidChar );
|
|
407 |
vk->SetDimmed( EFalse );
|
|
408 |
}
|
|
409 |
}
|
|
410 |
|
|
411 |
delete charTable;
|
|
412 |
|
|
413 |
//sync feedback
|
|
414 |
UpdateAllVirtualKeysFeedback();
|
|
415 |
}
|
|
416 |
}
|
|
417 |
|
|
418 |
// ---------------------------------------------------------------------------
|
|
419 |
// Get reordered char table for key pad to render them
|
|
420 |
// ---------------------------------------------------------------------------
|
|
421 |
//
|
|
422 |
HBufC* CPeninputArabicFingerHwrNumSymbolTable::GenerateCharTable(const TDesC& aNumMapping)
|
|
423 |
{
|
|
424 |
//format of aNumMapping is "0123456789******"
|
|
425 |
|
|
426 |
//char offset in aNumMapping
|
|
427 |
//cell 0 using aNumMapping[KNumOffsets[0]]
|
|
428 |
//cell 1 using aNumMapping[KNumOffsets[1]]
|
|
429 |
const TInt KNumOffsets[] =
|
|
430 |
{
|
|
431 |
12, 1, 2, 3,
|
|
432 |
13, 4, 5, 6,
|
|
433 |
14, 7, 8, 9,
|
|
434 |
15, 10, 0, 11
|
|
435 |
};
|
|
436 |
TInt tableSize = sizeof(KNumOffsets)/sizeof(TInt);
|
|
437 |
TInt mappingItemCount = aNumMapping.Length();
|
|
438 |
|
|
439 |
HBufC* reorderedCharTable = HBufC::New(mappingItemCount +1);
|
|
440 |
if(reorderedCharTable)
|
|
441 |
{
|
|
442 |
for(TInt i = 0; i < tableSize; i++)
|
|
443 |
{
|
|
444 |
if(KNumOffsets[i] < mappingItemCount)
|
|
445 |
{
|
|
446 |
TUint16 unicode = aNumMapping[KNumOffsets[i]];
|
|
447 |
TUint16 mappedCode = MapLatinNumAccordingToNumMode(unicode);
|
|
448 |
reorderedCharTable->Des().Append(mappedCode);
|
|
449 |
}
|
|
450 |
else
|
|
451 |
{
|
|
452 |
reorderedCharTable->Des().Append(KInvalidChar);
|
|
453 |
}
|
|
454 |
}
|
|
455 |
}
|
|
456 |
|
|
457 |
return reorderedCharTable;
|
|
458 |
}
|
|
459 |
|
|
460 |
// ---------------------------------------------------------------------------
|
|
461 |
// Navigate the symbol page
|
|
462 |
// ---------------------------------------------------------------------------
|
|
463 |
//
|
|
464 |
void CPeninputArabicFingerHwrNumSymbolTable::RefreshNumSymbolTable()
|
|
465 |
{
|
|
466 |
// Draw the symbol table
|
|
467 |
Draw();
|
|
468 |
|
|
469 |
// Update the feedback for the virtual key
|
|
470 |
UpdateAllVirtualKeysFeedback();
|
|
471 |
|
|
472 |
// Bitblt the whole symbol table to screen
|
|
473 |
UpdateArea(iRect);
|
|
474 |
}
|
|
475 |
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
// update feedback state of all virtual keys.
|
|
478 |
// ---------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
void CPeninputArabicFingerHwrNumSymbolTable::UpdateAllVirtualKeysFeedback()
|
|
481 |
{
|
|
482 |
//update numpad keys
|
|
483 |
TInt keyCount = iNumKeypad->KeyArray().Count();
|
|
484 |
for ( TInt i = 0; i < keyCount; i++ )
|
|
485 |
{
|
|
486 |
CVirtualKey* vk = iNumKeypad->KeyArray()[i];
|
|
487 |
TBool enable = !vk->Dimmed();
|
|
488 |
iNumKeypad->EnableKeyFeedback( vk, enable );
|
|
489 |
}
|
|
490 |
}
|
|
491 |
|
|
492 |
// ---------------------------------------------------------------------------
|
|
493 |
// update rect of all virtual keys.
|
|
494 |
// ---------------------------------------------------------------------------
|
|
495 |
//
|
|
496 |
void CPeninputArabicFingerHwrNumSymbolTable::UpdateAllVirtualKeysRect(const RArray<TRect> & aCellRects)
|
|
497 |
{
|
|
498 |
//update numpad keys rect
|
|
499 |
TInt keyCount = iNumKeypad->KeyArray().Count();
|
|
500 |
TInt rectCount = aCellRects.Count();
|
|
501 |
if(keyCount != rectCount)
|
|
502 |
{
|
|
503 |
return;
|
|
504 |
}
|
|
505 |
for ( TInt i = 0; i < keyCount; i++ )
|
|
506 |
{
|
|
507 |
CVirtualKey* vk = iNumKeypad->KeyArray()[i];
|
|
508 |
TRect rect = aCellRects[i%rectCount];
|
|
509 |
vk->SetRect(aCellRects[i%rectCount]);
|
|
510 |
TRect innerrect = rect;
|
|
511 |
innerrect.Shrink( TSize(10,10) );
|
|
512 |
vk->SetInnerRect( innerrect );
|
|
513 |
}
|
|
514 |
}
|
|
515 |
|
|
516 |
// ---------------------------------------------------------------------------
|
|
517 |
// Draw new content to the screen
|
|
518 |
// ---------------------------------------------------------------------------
|
|
519 |
//
|
|
520 |
void CPeninputArabicFingerHwrNumSymbolTable::Draw()
|
|
521 |
{
|
|
522 |
if(AbleToDraw())
|
|
523 |
{
|
|
524 |
DrawOpaqueMaskBackground( Rect() );
|
|
525 |
|
|
526 |
if( BackgroundBmp() && BackgroundBmp()->SizeInPixels() != Rect().Size() )
|
|
527 |
{
|
|
528 |
AknIconUtils::SetSize(BackgroundBmp(), Rect().Size(), EAspectRatioNotPreserved);
|
|
529 |
}
|
|
530 |
// draw background
|
|
531 |
DrawBackground();
|
|
532 |
|
|
533 |
// draw group
|
|
534 |
CControlGroup::Draw();
|
|
535 |
|
|
536 |
// bitblt the new content to screen
|
|
537 |
UpdateArea(iRect);
|
|
538 |
}
|
|
539 |
}
|
|
540 |
// ---------------------------------------------------------------------------
|
|
541 |
// set native number mode on or off.
|
|
542 |
// ---------------------------------------------------------------------------
|
|
543 |
//
|
|
544 |
void CPeninputArabicFingerHwrNumSymbolTable::SetNativeNumMode(
|
|
545 |
const TBool aIsNativeNumMode)
|
|
546 |
{
|
|
547 |
iIsNativeNumMode = aIsNativeNumMode;
|
|
548 |
}
|
|
549 |
// ---------------------------------------------------------------------------
|
|
550 |
// map latin number to arabic native number.
|
|
551 |
// ---------------------------------------------------------------------------
|
|
552 |
//
|
|
553 |
TInt16 CPeninputArabicFingerHwrNumSymbolTable:: MapLatinNumAccordingToNumMode(
|
|
554 |
TInt16 aUnicode)
|
|
555 |
{
|
|
556 |
TInt16 ret = aUnicode;
|
|
557 |
if(aUnicode >= 0x30 && aUnicode <= 0x39)
|
|
558 |
{
|
|
559 |
if(iIsNativeNumMode)
|
|
560 |
{
|
|
561 |
ret = aUnicode + 0x0660 - 0x30;
|
|
562 |
}
|
|
563 |
}
|
|
564 |
return ret;
|
|
565 |
}
|
|
566 |
// End Of File
|