26 |
26 |
27 #include "peninputlayoutvirtualkeyctrl.h" |
27 #include "peninputlayoutvirtualkeyctrl.h" |
28 #include "peninputlayoutvkb.h" |
28 #include "peninputlayoutvkb.h" |
29 #include "peninputlayout.h" |
29 #include "peninputlayout.h" |
30 #include "peninputpluginutils.h" |
30 #include "peninputpluginutils.h" |
|
31 #include "peninputcmd.h" |
31 |
32 |
32 _LIT( KKeyShiftCharacter, "\x2191"); |
33 _LIT( KKeyShiftCharacter, "\x2191"); |
33 _LIT( KKeyStarCharacter, "\x002a"); |
34 _LIT( KKeyStarCharacter, "\x002a"); |
34 |
35 |
35 const TInt KDefaultKeyMargin = 10; |
36 const TInt KDefaultKeyMargin = 10; |
129 textlineset = ETrue; |
130 textlineset = ETrue; |
130 |
131 |
131 if (iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) != KNullDesC) |
132 if (iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) != KNullDesC) |
132 { |
133 { |
133 TAknLayoutText textLayout; |
134 TAknLayoutText textLayout; |
134 textLayout.LayoutText(Rect(), |
135 textLayout.LayoutText(GetRect(), |
135 iKeyboard->TextLineLayout(TVirtualKeyTextPos(i))); |
136 iKeyboard->TextLineLayout(TVirtualKeyTextPos(i))); |
136 TRgb color( KRgbBlack ); // sane default for nonskinned case |
137 TRgb color( KRgbBlack ); // sane default for nonskinned case |
137 if ( AknsUtils::AvkonSkinEnabled() ) |
138 if ( AknsUtils::AvkonSkinEnabled() ) |
138 { |
139 { |
139 AknsUtils::GetCachedColor( UiLayout()->SkinInstance(), |
140 AknsUtils::GetCachedColor( UiLayout()->SkinInstance(), |
144 |
145 |
145 // replace the shift text to shift icon |
146 // replace the shift text to shift icon |
146 if( iKeyboard->ShiftIcon() && |
147 if( iKeyboard->ShiftIcon() && |
147 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyShiftCharacter ) |
148 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyShiftCharacter ) |
148 { |
149 { |
149 CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); |
150 //CFbsBitGc* gc = GetGc();//static_cast<CFbsBitGc*>(BitGc()); |
150 AknPenInputDrawUtils::DrawColorIcon( iKeyboard->ShiftIcon(), |
151 AknPenInputDrawUtils::DrawColorIcon( iKeyboard->ShiftIcon(), |
151 *gc, |
152 *aGc, |
152 textLayout.TextRect() ); |
153 textLayout.TextRect() ); |
153 } |
154 } |
154 else if(iKeyboard->StarIcon() && |
155 else if(iKeyboard->StarIcon() && |
155 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyStarCharacter ) |
156 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyStarCharacter ) |
156 { |
157 { |
157 CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); |
158 //CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); |
158 AknPenInputDrawUtils::DrawColorIcon( iKeyboard->StarIcon(), |
159 AknPenInputDrawUtils::DrawColorIcon( iKeyboard->StarIcon(), |
159 *gc, |
160 *aGc, |
160 textLayout.TextRect() ); |
161 textLayout.TextRect() ); |
161 } |
162 } |
162 else |
163 else |
163 { |
164 { |
164 textLayout.DrawText(*BitGc(), iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)), |
165 textLayout.DrawText(*aGc, iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)), |
165 EFalse, color); |
166 EFalse, color); |
166 } |
167 } |
167 } |
168 } |
168 } |
169 } |
169 } |
170 } |
170 |
171 |
171 if (!textlineset) |
172 if (!textlineset) |
172 { |
173 { |
173 TAknLayoutText textLayout; |
174 TAknLayoutText textLayout; |
174 textLayout.LayoutText(Rect(), iKeyboard->iVKBTextLineLayout); |
175 textLayout.LayoutText(GetRect(), iKeyboard->iVKBTextLineLayout); |
175 |
176 |
176 CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); |
177 //CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); |
177 |
178 |
178 //charRect.Move(keyboardRect.iTl); |
179 //charRect.Move(keyboardRect.iTl); |
179 //if(iKeyInfo->Dimmed()) |
180 //if(iKeyInfo->Dimmed()) |
180 // { |
181 // { |
181 // gc->SetFadingParameters(iKeyboard->iFadingParamBlack, iKeyboard->iFadingParamWhite); |
182 // gc->SetFadingParameters(iKeyboard->iFadingParamBlack, iKeyboard->iFadingParamWhite); |
199 { |
200 { |
200 color = KRgbGray; |
201 color = KRgbGray; |
201 } |
202 } |
202 if( iKeyInfo->DisplayUnicode() && iKeyInfo->DisplayUnicode()->Length() != 0) |
203 if( iKeyInfo->DisplayUnicode() && iKeyInfo->DisplayUnicode()->Length() != 0) |
203 { |
204 { |
204 textLayout.DrawText(*BitGc(), *iKeyInfo->DisplayUnicode(), EFalse, color); |
205 textLayout.DrawText(*aGc, *iKeyInfo->DisplayUnicode(), EFalse, color); |
205 } |
206 } |
206 else |
207 else |
207 { |
208 { |
208 textLayout.DrawText(*BitGc(), iKeyInfo->KeyUnicodes(), EFalse, color); |
209 textLayout.DrawText(*aGc, iKeyInfo->KeyUnicodes(), EFalse, color); |
209 } |
210 } |
210 |
211 |
211 //if(iKeyInfo->Dimmed()) |
212 //if(iKeyInfo->Dimmed()) |
212 // gc->SetFaded(EFalse); |
213 // gc->SetFaded(EFalse); |
213 |
214 |
311 void CVirtualKeyCtrl::DrawBmp(const TRect& aDestRect,const TRect& aSourceRect, |
312 void CVirtualKeyCtrl::DrawBmp(const TRect& aDestRect,const TRect& aSourceRect, |
312 const CFbsBitmap* aBmp,CFbsBitmap* aMask, |
313 const CFbsBitmap* aBmp,CFbsBitmap* aMask, |
313 TBool aInvertFlag) |
314 TBool aInvertFlag) |
314 { |
315 { |
315 CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); |
316 CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); |
|
317 DrawBmp(gc,aDestRect,aSourceRect,aBmp,aMask,aInvertFlag); |
|
318 } |
|
319 |
|
320 // --------------------------------------------------------------------------- |
|
321 // CVirtualKeyCtrl::DrawBmp |
|
322 // Draw bitmap |
|
323 // (other items were commented in a header). |
|
324 // --------------------------------------------------------------------------- |
|
325 // |
|
326 void CVirtualKeyCtrl::DrawBmp(CFbsBitGc* aGc, const TRect& aDestRect,const TRect& aSourceRect, |
|
327 const CFbsBitmap* aBmp,CFbsBitmap* aMask, |
|
328 TBool aInvertFlag) |
|
329 { |
316 if(aMask) |
330 if(aMask) |
317 { |
331 { |
318 //TRect bmpRect(TPoint(0,0),aMask->SizeInPixels()); |
332 //TRect bmpRect(TPoint(0,0),aMask->SizeInPixels()); |
319 gc->DrawBitmapMasked(aDestRect,aBmp,aSourceRect,aMask,aInvertFlag); |
333 aGc->DrawBitmapMasked(aDestRect,aBmp,aSourceRect,aMask,aInvertFlag); |
320 } |
334 } |
321 else |
335 else |
322 { |
336 { |
323 gc->DrawBitmap(aDestRect,aBmp,aSourceRect); |
337 aGc->DrawBitmap(aDestRect,aBmp,aSourceRect); |
324 } |
338 } |
325 } |
339 } |
326 |
340 |
327 // --------------------------------------------------------------------------- |
341 // --------------------------------------------------------------------------- |
328 // CVirtualKeyCtrl::DrawNormalStateKey |
342 // CVirtualKeyCtrl::DrawNormalStateKey |
329 // Draw key in normal state |
343 // Draw key in normal state |
358 } |
372 } |
359 else if (iKeyboard->KeySkinId(EKeyBmpNormal) != KAknsIIDNone) |
373 else if (iKeyboard->KeySkinId(EKeyBmpNormal) != KAknsIIDNone) |
360 { |
374 { |
361 TRect innerrect = rect; |
375 TRect innerrect = rect; |
362 innerrect.Shrink( KDefaultKeyMargin, KDefaultKeyMargin ); |
376 innerrect.Shrink( KDefaultKeyMargin, KDefaultKeyMargin ); |
363 |
377 TBool bHasDrawn = EFalse; |
364 AknsDrawUtils::DrawFrame(UiLayout()->SkinInstance(), |
378 if(UiLayout()->NotDrawToLayoutDevice()) |
365 *gc, |
379 { |
366 rect, |
380 TBool ret = iKeyboard->PrepareKeyBmp(iKeyboard->NormalKeyBmp(), |
367 innerrect, |
381 iKeyboard->NormalKeyDev(), |
368 iKeyboard->KeySkinId(EKeyBmpNormal), |
382 rect,innerrect, |
369 KAknsIIDDefault); |
383 iKeyboard->KeySkinId(EKeyBmpNormal), |
|
384 KAknsIIDDefault,Rect()); |
|
385 if(ret) |
|
386 { |
|
387 gc->BitBlt(rect.iTl,iKeyboard->NormalKeyBmp()); |
|
388 bHasDrawn = ETrue; |
|
389 } |
|
390 } |
|
391 |
|
392 if(!bHasDrawn) |
|
393 { |
|
394 AknsDrawUtils::DrawFrame(UiLayout()->SkinInstance(), |
|
395 *gc, |
|
396 rect, |
|
397 innerrect, |
|
398 iKeyboard->KeySkinId(EKeyBmpNormal), |
|
399 KAknsIIDDefault); |
|
400 } |
370 } |
401 } |
371 else if( iKeyboard->NonIrregularKeyBitmap( EKeyBmpNormal ) ) |
402 else if( iKeyboard->NonIrregularKeyBitmap( EKeyBmpNormal ) ) |
372 { |
403 { |
373 TRect srcRect(TPoint(0,0), |
404 TRect srcRect(TPoint(0,0), |
374 iKeyboard->NonIrregularKeyBitmap( EKeyBmpNormal )->SizeInPixels()); |
405 iKeyboard->NonIrregularKeyBitmap( EKeyBmpNormal )->SizeInPixels()); |
401 } |
432 } |
402 |
433 |
403 gc->SetPenColor( KRgbBlack ); |
434 gc->SetPenColor( KRgbBlack ); |
404 gc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
435 gc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
405 gc->SetFaded(EFalse); |
436 gc->SetFaded(EFalse); |
406 DrawKeyText(); |
437 DrawKeyText(gc); |
407 } |
438 } |
408 |
439 |
|
440 CFbsBitGc* CVirtualKeyCtrl::GetGc() |
|
441 { |
|
442 if(UiLayout()->NotDrawToLayoutDevice()) |
|
443 { |
|
444 //draw to highligh bitmap |
|
445 if(Keyboard()->Bitmap()->SizeInPixels() != Rect().Size()) |
|
446 { |
|
447 Keyboard()->Bitmap()->Resize(Rect().Size()); |
|
448 Keyboard()->HighlightDev()->Resize( Rect().Size()); |
|
449 //gc must be adjusted |
|
450 Keyboard()->HighlightGc()->Activate(Keyboard()->HighlightDev()); |
|
451 Keyboard()->HighlightGc()->Resized(); |
|
452 } |
|
453 return Keyboard()->HighlightGc(); |
|
454 } |
|
455 else |
|
456 return static_cast<CFbsBitGc*>(BitGc()); |
|
457 } |
|
458 |
409 // --------------------------------------------------------------------------- |
459 // --------------------------------------------------------------------------- |
410 // CVirtualKeyCtrl::DrawHighlightKey |
460 // CVirtualKeyCtrl::DrawHighlightKey |
411 // Draw key in highlight state |
461 // Draw key in highlight state |
412 // (other items were commented in a header). |
462 // (other items were commented in a header). |
413 // --------------------------------------------------------------------------- |
463 // --------------------------------------------------------------------------- |
414 // |
464 // |
415 void CVirtualKeyCtrl::DrawHighlightKey() |
465 void CVirtualKeyCtrl::DrawHighlightKey() |
416 { |
466 { |
417 CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); |
467 CFbsBitGc* gc = GetGc(); |
418 TRect rect = Rect(); |
468 if(UiLayout()->NotDrawToLayoutDevice()) |
|
469 gc->Activate( Keyboard()->HighlightDev() ); |
|
470 TRect rect = GetRect(); |
|
471 |
419 TPoint bmpPos = rect.iTl; |
472 TPoint bmpPos = rect.iTl; |
420 TRect bmpRect(TPoint(0,0),rect.Size()); |
473 TRect bmpRect(TPoint(0,0),rect.Size()); |
421 |
474 |
422 if(iVirtualKeyDrawInfo.iVKPressedLeftImgID.iMajor && |
475 if(iVirtualKeyDrawInfo.iVKPressedLeftImgID.iMajor && |
423 iVirtualKeyDrawInfo.iVKPressedMiddleImgID.iMajor && |
476 iVirtualKeyDrawInfo.iVKPressedMiddleImgID.iMajor && |
424 iVirtualKeyDrawInfo.iVKPressedRightImgID.iMajor) |
477 iVirtualKeyDrawInfo.iVKPressedRightImgID.iMajor) |
425 { |
478 { |
426 TRect innerRect = Rect(); |
479 TRect innerRect = GetRect(); |
427 innerRect.Shrink( 4, 0 ); |
480 innerRect.Shrink( 4, 0 ); |
428 |
481 |
429 AknPenInputDrawUtils::Draw3PiecesFrame(UiLayout()->SkinInstance(), |
482 AknPenInputDrawUtils::Draw3PiecesFrame(UiLayout()->SkinInstance(), |
430 *gc, |
483 *gc, |
431 Rect(), |
484 GetRect(), |
432 innerRect, |
485 innerRect, |
433 iVirtualKeyDrawInfo.iVKPressedLeftImgID, |
486 iVirtualKeyDrawInfo.iVKPressedLeftImgID, |
434 iVirtualKeyDrawInfo.iVKPressedMiddleImgID, |
487 iVirtualKeyDrawInfo.iVKPressedMiddleImgID, |
435 iVirtualKeyDrawInfo.iVKPressedRightImgID); |
488 iVirtualKeyDrawInfo.iVKPressedRightImgID); |
436 |
489 |
442 |
495 |
443 //do we have highlight background bmp for this key? |
496 //do we have highlight background bmp for this key? |
444 else if (iKeyboard->KeySkinId(EKeyBmpHighlight) != KAknsIIDNone) |
497 else if (iKeyboard->KeySkinId(EKeyBmpHighlight) != KAknsIIDNone) |
445 { |
498 { |
446 TRect innerrect = rect; |
499 TRect innerrect = rect; |
|
500 |
447 innerrect.Shrink( KDefaultKeyMargin, KDefaultKeyMargin ); |
501 innerrect.Shrink( KDefaultKeyMargin, KDefaultKeyMargin ); |
448 |
502 TBool bHasDrawn = EFalse; |
449 AknsDrawUtils::DrawFrame(UiLayout()->SkinInstance(), |
503 if(UiLayout()->NotDrawToLayoutDevice()) |
450 *gc, |
504 { |
451 rect, |
505 TBool ret = iKeyboard->PrepareKeyBmp(iKeyboard->HighightKeyBmp(), |
452 innerrect, |
506 iKeyboard->HighlightKeyDev(), |
453 iKeyboard->KeySkinId(EKeyBmpHighlight), |
507 rect,innerrect, |
454 KAknsIIDDefault); |
508 iKeyboard->KeySkinId(EKeyBmpHighlight), |
|
509 KAknsIIDDefault,Rect()); |
|
510 if(ret) |
|
511 { |
|
512 gc->BitBlt(rect.iTl,iKeyboard->HighightKeyBmp()); |
|
513 bHasDrawn = ETrue; |
|
514 } |
|
515 } |
|
516 |
|
517 if(!bHasDrawn) |
|
518 { |
|
519 AknsDrawUtils::DrawFrame(UiLayout()->SkinInstance(), |
|
520 *gc, |
|
521 rect, |
|
522 innerrect, |
|
523 iKeyboard->KeySkinId(EKeyBmpHighlight), |
|
524 KAknsIIDDefault); |
|
525 } |
455 } |
526 } |
456 else if( iKeyboard->NonIrregularKeyBitmap( EKeyBmpHighlight ) ) |
527 else if( iKeyboard->NonIrregularKeyBitmap( EKeyBmpHighlight ) ) |
457 { |
528 { |
458 TRect srcRect(TPoint(0,0), |
529 TRect srcRect(TPoint(0,0), |
459 iKeyboard->NonIrregularKeyBitmap( EKeyBmpHighlight )->SizeInPixels()); |
530 iKeyboard->NonIrregularKeyBitmap( EKeyBmpHighlight )->SizeInPixels()); |
460 DrawBmp(rect, |
531 DrawBmp(gc, rect, |
461 srcRect, |
532 srcRect, |
462 iKeyboard->NonIrregularKeyBitmap( EKeyBmpHighlight ), |
533 iKeyboard->NonIrregularKeyBitmap( EKeyBmpHighlight ), |
463 iKeyboard->NonIrregularKeyBitmap( EKeyBmpHighlightMask ), |
534 iKeyboard->NonIrregularKeyBitmap( EKeyBmpHighlightMask ), |
464 ETrue); |
535 ETrue); |
465 } |
536 } |
488 |
559 |
489 gc->SetPenColor( KRgbBlack ); |
560 gc->SetPenColor( KRgbBlack ); |
490 |
561 |
491 gc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
562 gc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
492 gc->SetFaded(EFalse); |
563 gc->SetFaded(EFalse); |
493 DrawKeyText(); |
564 if(UiLayout()->NotDrawToLayoutDevice()) |
|
565 { |
|
566 DrawKeyText(Keyboard()->HighlightGc()); |
|
567 UpdateChangedArea(ETrue); |
|
568 } |
|
569 else |
|
570 { |
|
571 DrawKeyText(gc); |
|
572 } |
494 |
573 |
495 } |
574 } |
496 |
575 |
497 // --------------------------------------------------------------------------- |
576 // --------------------------------------------------------------------------- |
498 // CVirtualKeyCtrl::Draw |
577 // CVirtualKeyCtrl::Draw |
552 |
631 |
553 CFepUiBaseCtrl::HandlePointerDownEventL(aPoint); |
632 CFepUiBaseCtrl::HandlePointerDownEventL(aPoint); |
554 |
633 |
555 //draw key new state |
634 //draw key new state |
556 iKeyboard->DrawBubble(iKeyInfo); |
635 iKeyboard->DrawBubble(iKeyInfo); |
557 ReDraw(); |
636 if(UiLayout()->NotDrawToLayoutDevice()) |
|
637 { |
|
638 if( !(iKeyInfo->Dimmed()) && (iKeyInfo->Latched() || (PointerDown()&&!iKeyInfo->IsLatchKey())) ) |
|
639 { |
|
640 DrawHighlightKey(); |
|
641 } |
|
642 else |
|
643 { |
|
644 ReDraw(); |
|
645 } |
|
646 } |
|
647 else |
|
648 { |
|
649 ReDraw(); |
|
650 UpdateArea( Rect() ); |
|
651 } |
558 UpdateArea( Rect() ); |
652 UpdateArea( Rect() ); |
559 |
653 |
560 if(iKeyInfo->IsLatchKey()) |
654 if(iKeyInfo->IsLatchKey()) |
561 { |
655 { |
562 // Only set latch status, not generate event for latch key |
656 // Only set latch status, not generate event for latch key |
591 { |
685 { |
592 // When key up, latch key will generate event. |
686 // When key up, latch key will generate event. |
593 // When key down, latch key won't generate event. |
687 // When key down, latch key won't generate event. |
594 eventType = iKeyInfo->Latched() ? EEventVirtualKeyLatched : EEventVirtualKeyUnLatched; |
688 eventType = iKeyInfo->Latched() ? EEventVirtualKeyLatched : EEventVirtualKeyUnLatched; |
595 } |
689 } |
596 ReDraw(); |
690 if(UiLayout()->NotDrawToLayoutDevice()) |
597 UpdateAreaImmed( Rect() ); |
691 { |
|
692 //no need to draw again, just remove the highlight bitmap |
|
693 UpdateChangedArea(EFalse); |
|
694 Draw(); |
|
695 } |
|
696 else |
|
697 { |
|
698 ReDraw(); |
|
699 UpdateAreaImmed( Rect() ); |
|
700 } |
598 ReportKeyEvent(eventType); |
701 ReportKeyEvent(eventType); |
599 |
702 |
600 |
703 |
601 //Advanced tactile feedback REQ 417-47932 |
704 //Advanced tactile feedback REQ 417-47932 |
602 #ifdef RD_TACTILE_FEEDBACK |
705 #ifdef RD_TACTILE_FEEDBACK |
671 |
786 |
672 void CVirtualKeyCtrl::CancelPointerDownL() |
787 void CVirtualKeyCtrl::CancelPointerDownL() |
673 { |
788 { |
674 CFepUiBaseCtrl::CancelPointerDownL(); |
789 CFepUiBaseCtrl::CancelPointerDownL(); |
675 iKeyboard->ClearBubble(ETrue); |
790 iKeyboard->ClearBubble(ETrue); |
676 ReDraw(); |
791 if(UiLayout()->NotDrawToLayoutDevice()) |
677 UpdateArea( Rect() ); |
792 { |
|
793 UpdateChangedArea(EFalse); |
|
794 } |
|
795 else |
|
796 { |
|
797 ReDraw(); |
|
798 UpdateArea( Rect() ); |
|
799 } |
678 } |
800 } |
679 // --------------------------------------------------------------------------- |
801 // --------------------------------------------------------------------------- |
680 // CVirtualKeyCtrl::ReDraw |
802 // CVirtualKeyCtrl::ReDraw |
681 // Redraw and updates the key |
803 // Redraw and updates the key |
682 // (other items were commented in a header). |
804 // (other items were commented in a header). |
683 // --------------------------------------------------------------------------- |
805 // --------------------------------------------------------------------------- |
684 // |
806 // |
685 void CVirtualKeyCtrl::ReDraw() |
807 void CVirtualKeyCtrl::ReDraw() |
686 { |
808 { |
687 Draw(); |
809 if(UiLayout()->NotDrawToLayoutDevice()) |
688 UpdateArea(Rect(), EFalse); |
810 { |
|
811 if(iKeyInfo->Latched()||(PointerDown()&&!iKeyInfo->IsLatchKey())) |
|
812 { |
|
813 DrawHighlightKey(); |
|
814 UpdateChangedArea(ETrue); |
|
815 } |
|
816 else |
|
817 { |
|
818 Draw(); |
|
819 UpdateArea(Rect(), EFalse); |
|
820 } |
|
821 } |
|
822 else |
|
823 { |
|
824 Draw(); |
|
825 UpdateArea(Rect(), EFalse); |
|
826 } |
689 } |
827 } |
690 |
828 |
691 // --------------------------------------------------------------------------- |
829 // --------------------------------------------------------------------------- |
692 // CVirtualKeyCtrl::ReportKeyEvent |
830 // CVirtualKeyCtrl::ReportKeyEvent |
693 // Report current key event |
831 // Report current key event |
901 // (other items were commented in a header). |
1039 // (other items were commented in a header). |
902 // --------------------------------------------------------------------------- |
1040 // --------------------------------------------------------------------------- |
903 // |
1041 // |
904 void CVirtualRawKeyCtrl::HandlePointerLeave(const TPoint& aPoint) |
1042 void CVirtualRawKeyCtrl::HandlePointerLeave(const TPoint& aPoint) |
905 { |
1043 { |
|
1044 if(UiLayout()->NotDrawToLayoutDevice()) |
|
1045 { |
|
1046 UpdateChangedArea(EFalse); |
|
1047 } |
906 TRawEvent event; |
1048 TRawEvent event; |
907 event.Set(TRawEvent::EButton1Up,aPoint.iX,aPoint.iY); |
1049 event.Set(TRawEvent::EButton1Up,aPoint.iX,aPoint.iY); |
908 |
1050 |
909 SimulateRawEvent(event); |
1051 SimulateRawEvent(event); |
910 |
1052 |
917 UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveInput, ETrue, EFalse); |
1059 UiLayout()->DoTactileFeedback(ETouchFeedbackSensitiveInput, ETrue, EFalse); |
918 } |
1060 } |
919 } |
1061 } |
920 #endif //RD_TACTILE_FEEDBACK |
1062 #endif //RD_TACTILE_FEEDBACK |
921 } |
1063 } |
|
1064 |
|
1065 TRect CVirtualKeyCtrl::GetRect() |
|
1066 { |
|
1067 TRect r(Rect()); |
|
1068 if(UiLayout()->NotDrawToLayoutDevice()) |
|
1069 { |
|
1070 if(iKeyInfo->Latched()||(PointerDown()&&!iKeyInfo->IsLatchKey())) |
|
1071 { |
|
1072 r.Move(-r.iTl.iX, -r.iTl.iY); |
|
1073 } |
|
1074 } |
|
1075 return r; |
|
1076 } |
|
1077 |
|
1078 void CVirtualKeyCtrl::UpdateChangedArea(TBool aFlag) |
|
1079 { |
|
1080 struct SData |
|
1081 { |
|
1082 TBool flag; |
|
1083 CFbsBitmap* bmp; |
|
1084 TRect pos; |
|
1085 } data; |
|
1086 data.flag = aFlag; |
|
1087 data.bmp = Keyboard()->Bitmap();//aFlag ? Keyboard()->iBitmap : 0; |
|
1088 data.pos = Rect(); |
|
1089 TPtrC ptr; |
|
1090 ptr.Set(reinterpret_cast<const TUint16*>(&data),sizeof(data)/sizeof(TUint16)); |
|
1091 |
|
1092 UiLayout()->SignalOwner(ESignalUpdateChangedArea,ptr); |
|
1093 } |
922 //end of file |
1094 //end of file |