33 #include <eiklabel.h> |
33 #include <eiklabel.h> |
34 #include <AknsDrawUtils.h> |
34 #include <AknsDrawUtils.h> |
35 #include <AknBidiTextUtils.h> |
35 #include <AknBidiTextUtils.h> |
36 #include <AknsUtils.h> |
36 #include <AknsUtils.h> |
37 #include <AknIconUtils.h> |
37 #include <AknIconUtils.h> |
38 #include <coecntrl.h> |
38 |
39 #include <aknfepuictrls.mbg> |
39 #include <aknfepuictrls.mbg> |
40 #include <skinlayout.cdl.h> |
|
41 #include <aknlayoutscalable_avkon.cdl.h> |
|
42 |
|
43 #include "AknFepUiInterfacePanic.h" |
40 #include "AknFepUiInterfacePanic.h" |
44 #include "AknFepUIAvkonCtrlCandidatePane.h" |
41 #include "AknFepUIAvkonCtrlCandidatePane.h" |
|
42 #include "AknFepUIAvkonCtrlCandidateSelected.h" |
45 #include "aknfepchineseuidataconv.h" |
43 #include "aknfepchineseuidataconv.h" |
46 #include "aknfepuilayoutdatamgr.h" |
44 #include "aknfepuilayoutdatamgr.h" |
47 #include "AknFepUiInputStateBase.h" |
45 |
48 #include "AknFepUIAvkonCtrlCandidateCharacter.h" |
46 |
49 #include "data_caging_path_literals.hrh" |
47 #include "data_caging_path_literals.hrh" |
50 |
48 |
51 const TInt CandidateCountLeft = 10; |
49 const TInt CandidateCountLeft = 10; |
52 const TInt DibertHeight = 480; |
|
53 const TInt ShowAboveCharacter = -1; |
|
54 const TInt ShowBellowCharacter = 1; |
|
55 |
50 |
56 _LIT(KFepUiControlsBitmapFile, "aknfepuictrls.mbm"); |
51 _LIT(KFepUiControlsBitmapFile, "aknfepuictrls.mbm"); |
57 |
52 |
58 CAknFepUICtrlCandidatePane* CAknFepUICtrlCandidatePane::NewL( RWindow& aParent, |
53 CAknFepUICtrlCandidatePane* CAknFepUICtrlCandidatePane::NewL(RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr) |
59 CAknFepUiLayoutDataMgr* aLafDataMgr, |
54 { |
60 MAknFepChineseUiMgr* aMgr ) |
55 CAknFepUICtrlCandidatePane* self = new(ELeave) CAknFepUICtrlCandidatePane( aLafDataMgr ); |
61 { |
|
62 CAknFepUICtrlCandidatePane* self = new(ELeave) CAknFepUICtrlCandidatePane( aLafDataMgr, aMgr ); |
|
63 CleanupStack::PushL(self); |
56 CleanupStack::PushL(self); |
64 self->ConstructL(aParent); |
57 self->ConstructL(aParent); |
65 CleanupStack::Pop(); |
58 CleanupStack::Pop(); |
66 return self; |
59 return self; |
67 } |
60 } |
68 |
61 |
69 CAknFepUICtrlCandidatePane::~CAknFepUICtrlCandidatePane() |
62 CAknFepUICtrlCandidatePane::~CAknFepUICtrlCandidatePane() |
70 { |
63 { |
71 delete iCtrlScroll; |
64 delete iCandidateSelected; |
72 delete iPreview; |
65 delete iNaviArrowBitmapLeft; |
|
66 delete iNaviArrowBitmapLeftMask; |
|
67 delete iNaviArrowBitmapRight; |
|
68 delete iNaviArrowBitmapRightMask; |
|
69 delete iNaviArrowBitmapUp; |
|
70 delete iNaviArrowBitmapUpMask; |
|
71 delete iNaviArrowBitmapDown; |
|
72 delete iNaviArrowBitmapDownMask; |
73 if(iCandidateArray) |
73 if(iCandidateArray) |
74 { |
74 { |
75 iCandidateArray->Reset(); |
75 iCandidateArray->Reset(); |
76 delete iCandidateArray; |
76 delete iCandidateArray; |
77 } |
77 } |
78 iCandidateLabelArray.ResetAndDestroy(); |
78 iCandidateLabelArray.ResetAndDestroy(); |
|
79 iOrdinalLabelArray.ResetAndDestroy(); |
79 iCandidateModeArray.Reset(); |
80 iCandidateModeArray.Reset(); |
80 iPages.Reset(); |
81 iPages.Reset(); |
81 } |
82 } |
82 |
83 |
83 const TDesC& CAknFepUICtrlCandidatePane::TextBuffer() const |
84 const TDesC& CAknFepUICtrlCandidatePane::TextBuffer() const |
246 return EFalse; |
276 return EFalse; |
247 } |
277 } |
248 |
278 |
249 void CAknFepUICtrlCandidatePane::ShowHorizontalScrollArrows(TBool /*aValue*/) |
279 void CAknFepUICtrlCandidatePane::ShowHorizontalScrollArrows(TBool /*aValue*/) |
250 { |
280 { |
251 // Left & right arrow are not need, so do nothing. |
281 // If the state is changed, the arrows will be redrawn in the new state. |
|
282 // if(!COMPARE_BOOLS(iShowHorizontalScrollArrows, aValue)) |
|
283 // { |
|
284 // iShowHorizontalScrollArrows = aValue; |
|
285 // TRect rect = iIndiFepArrowLeft.Rect(); |
|
286 // Window().Invalidate(rect); |
|
287 // rect = iIndiFepArrowRight.Rect(); |
|
288 // Window().Invalidate(rect); |
|
289 // } |
252 } |
290 } |
253 |
291 |
254 void CAknFepUICtrlCandidatePane::ShowUpScrollArrows(TBool aValue) |
292 void CAknFepUICtrlCandidatePane::ShowUpScrollArrows(TBool aValue) |
255 { |
293 { |
256 // call function of scroll pane to show/hide up arrow. |
294 if (iShowUpScrollArrows != aValue) |
257 iCtrlScroll->ShowUpScrollArrows( aValue ); |
295 { |
|
296 iShowUpScrollArrows = aValue; |
|
297 TRect rect = iIndiFepArrowUp.Rect(); |
|
298 Window().Invalidate(rect); |
|
299 } |
258 } |
300 } |
259 |
301 |
260 void CAknFepUICtrlCandidatePane::ShowDownScrollArrows(TBool aValue) |
302 void CAknFepUICtrlCandidatePane::ShowDownScrollArrows(TBool aValue) |
261 { |
303 { |
262 // call function of scroll pane to show/hide down arrow. |
304 if (iShowDownScrollArrows != aValue) |
263 iCtrlScroll->ShowDownScrollArrows( aValue ); |
305 { |
|
306 iShowDownScrollArrows = aValue; |
|
307 TRect rect = iIndiFepArrowDown.Rect(); |
|
308 Window().Invalidate(rect); |
|
309 } |
|
310 |
264 } |
311 } |
265 |
312 |
266 void CAknFepUICtrlCandidatePane::ShowLeftScrollArrows(TBool /*aValue*/) |
313 void CAknFepUICtrlCandidatePane::ShowLeftScrollArrows(TBool /*aValue*/) |
267 { |
314 { |
268 // Left arrow is not need, so do nothing. |
315 // if (iShowLeftScrollArrows != aValue) |
|
316 // { |
|
317 // iShowLeftScrollArrows = aValue; |
|
318 // TRect rect = iIndiFepArrowLeft.Rect(); |
|
319 // Window().Invalidate(rect); |
|
320 // } |
269 } |
321 } |
270 |
322 |
271 void CAknFepUICtrlCandidatePane::ShowRightScrollArrows(TBool /*aValue*/) |
323 void CAknFepUICtrlCandidatePane::ShowRightScrollArrows(TBool /*aValue*/) |
272 { |
324 { |
273 // Right arrow is not need, so do nothing. |
325 // if (iShowRightScrollArrows != aValue) |
|
326 // { |
|
327 // iShowRightScrollArrows = aValue; |
|
328 // TRect rect = iIndiFepArrowRight.Rect(); |
|
329 // Window().Invalidate(rect); |
|
330 // } |
274 } |
331 } |
275 |
332 |
276 TBool CAknFepUICtrlCandidatePane::IsShowVerticalScrollArrows() const |
333 TBool CAknFepUICtrlCandidatePane::IsShowVerticalScrollArrows() const |
277 { |
334 { |
278 // call function of scroll pane to get scroll state |
335 return iShowVerticalScrollArrows; |
279 return iCtrlScroll->IsShowVerticalScrollArrows(); |
|
280 } |
336 } |
281 |
337 |
282 void CAknFepUICtrlCandidatePane::ShowVerticalScrollArrows(TBool aValue) |
338 void CAknFepUICtrlCandidatePane::ShowVerticalScrollArrows(TBool aValue) |
283 { |
339 { |
284 // call function of scroll pane to set scroll state |
340 // If the state is changed, the arrows will be redrawn in the new state. |
285 iCtrlScroll->ShowVerticalScrollArrows( aValue ); |
341 if(!COMPARE_BOOLS(iShowVerticalScrollArrows, aValue)) |
|
342 { |
|
343 iShowVerticalScrollArrows = aValue; |
|
344 TRect rect = iIndiFepArrowUp.Rect(); |
|
345 Window().Invalidate(rect); |
|
346 rect = iIndiFepArrowDown.Rect(); |
|
347 Window().Invalidate(rect); |
|
348 } |
|
349 } |
|
350 |
|
351 void CAknFepUICtrlCandidatePane::ShowCandidateOrdinals(TBool aValue) |
|
352 { |
|
353 if(!COMPARE_BOOLS(iShowCandidateOrdinals, aValue)) |
|
354 { |
|
355 iShowCandidateOrdinals = aValue; |
|
356 iCandidateSelected->ShowOrdinal(aValue); |
|
357 UpdateLabelVisibility(); |
|
358 } |
|
359 } |
|
360 |
|
361 TBool CAknFepUICtrlCandidatePane::IsShowCandidateOrdinals() const |
|
362 { |
|
363 return iShowCandidateOrdinals; |
286 } |
364 } |
287 |
365 |
288 TInt CAknFepUICtrlCandidatePane::VisibleCandidateCount() const |
366 TInt CAknFepUICtrlCandidatePane::VisibleCandidateCount() const |
289 { |
367 { |
290 return iVisibleCount; |
368 return iVisibleCount; |
580 } |
668 } |
581 // shouldn't be called while no components. |
669 // shouldn't be called while no components. |
582 return NULL ; |
670 return NULL ; |
583 } |
671 } |
584 |
672 |
|
673 void CAknFepUICtrlCandidatePane::Draw(const TRect& /* aRect */) const |
|
674 { |
|
675 CWindowGc& gc = SystemGc(); |
|
676 |
|
677 if(iShowHorizontalScrollArrows) |
|
678 { |
|
679 if (iShowLeftScrollArrows) |
|
680 { |
|
681 iIndiFepArrowLeft.DrawImage(gc, |
|
682 iNaviArrowBitmapLeft, |
|
683 iNaviArrowBitmapLeftMask); |
|
684 } |
|
685 |
|
686 if (iShowRightScrollArrows) |
|
687 { |
|
688 iIndiFepArrowRight.DrawImage(gc, |
|
689 iNaviArrowBitmapRight, |
|
690 iNaviArrowBitmapRightMask); |
|
691 } |
|
692 } |
|
693 if(iShowVerticalScrollArrows) |
|
694 { |
|
695 if (iShowUpScrollArrows) |
|
696 { |
|
697 iIndiFepArrowUp.DrawImage(gc, |
|
698 iNaviArrowBitmapUp, |
|
699 iNaviArrowBitmapUpMask); |
|
700 } |
|
701 |
|
702 if (iShowDownScrollArrows) |
|
703 { |
|
704 iIndiFepArrowDown.DrawImage(gc, |
|
705 iNaviArrowBitmapDown, |
|
706 iNaviArrowBitmapDownMask); |
|
707 } |
|
708 } |
|
709 } |
|
710 |
585 void CAknFepUICtrlCandidatePane::ConstructL(RWindow& aParent) |
711 void CAknFepUICtrlCandidatePane::ConstructL(RWindow& aParent) |
586 { |
712 { |
587 SetContainerWindowL(aParent); |
713 SetContainerWindowL(aParent); |
|
714 ConstructBitmapsL(); |
588 |
715 |
589 TBuf<EOneCandidate> ordinal; |
716 TBuf<EOneCandidate> ordinal; |
590 for(TInt i = 0; i < EMaxCandidates; i++) |
717 for(TInt i = 0; i < EMaxCandidates; i++) |
591 { |
718 { |
592 CAknFepUICtrlCandidateCharacter* candidateLabel = CAknFepUICtrlCandidateCharacter::NewL( aParent, this ); |
719 CEikLabel* candidateLabel = new(ELeave) CEikLabel; |
593 CleanupStack::PushL(candidateLabel); |
720 CleanupStack::PushL(candidateLabel); |
594 candidateLabel->SetContainerWindowL(aParent); |
721 candidateLabel->SetContainerWindowL(aParent); |
|
722 candidateLabel->SetBufferReserveLengthL(EPhraseLength); |
595 // ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack |
723 // ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack |
596 User::LeaveIfError(iCandidateLabelArray.Append(candidateLabel)); |
724 User::LeaveIfError(iCandidateLabelArray.Append(candidateLabel)); |
597 CleanupStack::Pop(); // candidateLabel |
725 CleanupStack::Pop(); // candidateLabel |
598 |
726 |
|
727 CEikLabel* ordinalLabel = new(ELeave) CEikLabel; |
|
728 CleanupStack::PushL(ordinalLabel); |
|
729 ordinalLabel->SetContainerWindowL(aParent); |
|
730 ordinalLabel->SetBufferReserveLengthL(EOneCandidate); |
|
731 ordinal.Num((i+1)%10); // digits are [1, 2,,, 9, 0] - only want the last digit in the case of 10! |
|
732 ordinalLabel->SetTextL(ordinal); |
|
733 // ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack |
|
734 User::LeaveIfError(iOrdinalLabelArray.Append(ordinalLabel)); |
|
735 CleanupStack::Pop(); // ordinalLabel |
|
736 |
599 User::LeaveIfError(iCandidateModeArray.Append(ECandidateModeNormal)); |
737 User::LeaveIfError(iCandidateModeArray.Append(ECandidateModeNormal)); |
600 } |
738 } |
601 |
739 |
|
740 iCandidateSelected = CAknFepUICtrlCandidateSelected::NewL(aParent); |
|
741 iCandidateSelected->MakeVisible(iHighlighted); |
|
742 iCandidateSelected->SetMopParent(this); |
602 iCandidateArray = new(ELeave) CDesCArrayFlat(1); |
743 iCandidateArray = new(ELeave) CDesCArrayFlat(1); |
603 |
744 } |
604 // scroll part |
745 |
605 iCtrlScroll = CAknFepUICtrlCandidateScroll::NewL( aParent, this ); |
746 void CAknFepUICtrlCandidatePane::ConstructBitmapsL() |
606 iCtrlScroll->SetMopParent(this); |
747 { |
607 |
748 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
608 // character preview |
749 |
609 iPreview = CAknFepPreview::NewL( aParent ); |
750 TFileName bmpFile; |
610 } |
751 bmpFile.Copy(_L("z:")); |
611 |
752 bmpFile.Append(KDC_BITMAP_DIR); |
612 CAknFepUICtrlCandidatePane::CAknFepUICtrlCandidatePane(CAknFepUiLayoutDataMgr* aLafDataMgr, MAknFepChineseUiMgr* aMgr ) |
753 bmpFile.Append(KFepUiControlsBitmapFile); |
|
754 |
|
755 AknsUtils::CreateColorIconL( skin, |
|
756 KAknsIIDQgnIndiFepArrowLeft, |
|
757 KAknsIIDQsnIconColors, |
|
758 EAknsCIQsnIconColorsCG20, |
|
759 iNaviArrowBitmapLeft, |
|
760 iNaviArrowBitmapLeftMask, |
|
761 bmpFile, |
|
762 EMbmAknfepuictrlsQgn_indi_fep_arrow_left, |
|
763 EMbmAknfepuictrlsQgn_indi_fep_arrow_left_mask, |
|
764 AKN_LAF_COLOR( 0 ) |
|
765 ); |
|
766 AknsUtils::CreateColorIconL( skin, |
|
767 KAknsIIDQgnIndiFepArrowRight, |
|
768 KAknsIIDQsnIconColors, |
|
769 EAknsCIQsnIconColorsCG20, |
|
770 iNaviArrowBitmapRight, |
|
771 iNaviArrowBitmapRightMask, |
|
772 bmpFile, |
|
773 EMbmAknfepuictrlsQgn_indi_fep_arrow_right, |
|
774 EMbmAknfepuictrlsQgn_indi_fep_arrow_right_mask, |
|
775 AKN_LAF_COLOR( 0 ) |
|
776 ); |
|
777 |
|
778 AknsUtils::CreateColorIconL( skin, |
|
779 KAknsIIDQgnIndiFepArrowUp, |
|
780 KAknsIIDQsnIconColors, |
|
781 EAknsCIQsnIconColorsCG20, |
|
782 iNaviArrowBitmapUp, |
|
783 iNaviArrowBitmapUpMask, |
|
784 bmpFile, |
|
785 EMbmAknfepuictrlsQgn_indi_fep_arrow_up, |
|
786 EMbmAknfepuictrlsQgn_indi_fep_arrow_up_mask, |
|
787 AKN_LAF_COLOR( 0 ) |
|
788 ); |
|
789 AknsUtils::CreateColorIconL( skin, |
|
790 KAknsIIDQgnIndiFepArrowDown, |
|
791 KAknsIIDQsnIconColors, |
|
792 EAknsCIQsnIconColorsCG20, |
|
793 iNaviArrowBitmapDown, |
|
794 iNaviArrowBitmapDownMask, |
|
795 bmpFile, |
|
796 EMbmAknfepuictrlsQgn_indi_fep_arrow_down, |
|
797 EMbmAknfepuictrlsQgn_indi_fep_arrow_down_mask, |
|
798 AKN_LAF_COLOR( 0 ) |
|
799 ); |
|
800 } |
|
801 |
|
802 CAknFepUICtrlCandidatePane::CAknFepUICtrlCandidatePane(CAknFepUiLayoutDataMgr* aLafDataMgr) |
613 : |
803 : |
614 iPaneLayout(CAknFepUICtrlContainerChinese::ELayoutCandidate), |
804 iPaneLayout(CAknFepUICtrlContainerChinese::ELayoutCandidate), |
615 iHighlighted(EFalse), |
805 iHighlighted(EFalse), |
|
806 iShowHorizontalScrollArrows(EFalse), |
|
807 iShowVerticalScrollArrows(EFalse), |
|
808 iShowUpScrollArrows(ETrue), |
|
809 iShowDownScrollArrows(ETrue), |
|
810 iShowLeftScrollArrows(ETrue), |
|
811 iShowRightScrollArrows(ETrue), |
|
812 iShowCandidateOrdinals(ETrue), |
616 iCurDisplayPage(0), |
813 iCurDisplayPage(0), |
617 iChineseUiMgr(aMgr), |
814 iOrdinalLableWidth(0) |
618 iPointDown( EFalse ) |
|
619 { |
815 { |
620 iLafDataMgr = aLafDataMgr; |
816 iLafDataMgr = aLafDataMgr; |
621 } |
817 } |
622 |
818 |
|
819 void CAknFepUICtrlCandidatePane::LayoutRects() |
|
820 { |
|
821 TRect rect = Rect(); |
|
822 |
|
823 TAknWindowLineLayout candidateWindowLine1 = |
|
824 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine1)); |
|
825 TAknWindowLineLayout candidateWindowLine2 = |
|
826 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine2)); |
|
827 TAknWindowLineLayout candidateWindowLine3 = |
|
828 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine3)); |
|
829 TAknWindowLineLayout candidateWindowLine4 = |
|
830 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine4)); |
|
831 |
|
832 iIndiFepArrowLeft.LayoutRect(rect, candidateWindowLine1); |
|
833 AknIconUtils::SetSize(iNaviArrowBitmapLeft, iIndiFepArrowLeft.Rect().Size()); |
|
834 |
|
835 iIndiFepArrowRight.LayoutRect(rect, candidateWindowLine2); |
|
836 AknIconUtils::SetSize(iNaviArrowBitmapRight, iIndiFepArrowRight.Rect().Size()); |
|
837 |
|
838 iIndiFepArrowUp.LayoutRect(rect, candidateWindowLine3); |
|
839 AknIconUtils::SetSize(iNaviArrowBitmapUp, iIndiFepArrowUp.Rect().Size()); |
|
840 |
|
841 iIndiFepArrowDown.LayoutRect(rect, candidateWindowLine4); |
|
842 AknIconUtils::SetSize( iNaviArrowBitmapDown, iIndiFepArrowDown.Rect().Size() ); |
|
843 } |
|
844 |
623 void CAknFepUICtrlCandidatePane::LayoutContainedControls() |
845 void CAknFepUICtrlCandidatePane::LayoutContainedControls() |
624 { |
846 { |
625 LayoutLabels(); |
847 LayoutLabels(); |
626 LayoutScroll(); |
848 LayoutCandidateSelected(); |
627 } |
849 } |
628 |
850 |
629 void CAknFepUICtrlCandidatePane::LayoutLabel(TInt aIndex) |
851 void CAknFepUICtrlCandidatePane::LayoutLabel(TInt aIndex) |
630 { |
852 { |
631 __ASSERT_DEBUG(aIndex >= 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount)); |
853 __ASSERT_DEBUG(aIndex >= 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount)); |
632 __ASSERT_DEBUG(aIndex < iVisibleCount, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount)); |
854 __ASSERT_DEBUG(aIndex < iVisibleCount, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount)); |
633 TRect rect = Rect(); |
855 TRect rect = Rect(); |
634 CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[aIndex]; |
856 CEikLabel* candidateLabel = iCandidateLabelArray[aIndex]; |
|
857 CEikLabel* ordinalLabel = iOrdinalLabelArray[aIndex]; |
635 TAknWindowLineLayout layoutCandidateItem = |
858 TAknWindowLineLayout layoutCandidateItem = |
636 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECharacterLayout)); |
859 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem)); |
637 TAknTextLineLayout candidateLayout = |
860 TAknTextLineLayout candidateLayout = |
638 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECharacterTextLayout)); |
861 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine)); |
639 |
862 |
640 // layout candidate label |
863 // layout candidate label |
641 TAknLayoutRect layoutRectCandidateItem; |
864 TAknLayoutRect layoutRectCandidateItem; |
642 layoutRectCandidateItem.LayoutRect( rect,layoutCandidateItem ); |
865 layoutRectCandidateItem.LayoutRect(rect,layoutCandidateItem); |
643 TRect rectCandidateItem = layoutRectCandidateItem.Rect(); |
866 TRect rectCandidateItem = layoutRectCandidateItem.Rect(); |
644 if ( aIndex > 0 ) |
867 |
|
868 if(aIndex > 0) |
645 { |
869 { |
646 rectCandidateItem.iTl.iX = iCandidateLabelArray[aIndex - 1]->Rect().iBr.iX; |
870 rectCandidateItem.iTl.iX = iCandidateLabelArray[aIndex - 1]->Rect().iBr.iX; |
647 } |
871 } |
648 |
|
649 TAknLayoutText layoutText; |
872 TAknLayoutText layoutText; |
650 layoutText.LayoutText( rectCandidateItem, candidateLayout ); |
873 layoutText.LayoutText(rectCandidateItem,candidateLayout); |
651 TInt interval = candidateLayout.il + candidateLayout.ir; |
874 TRect rectText = layoutText.TextRect(); |
652 |
875 rectText.SetWidth(LabelTextWidthInPixels(aIndex)); |
653 TInt width = LabelTextWidthInPixels( aIndex ); |
876 |
654 TInt minwidth = layoutRectCandidateItem.Rect().Width() - interval ; |
877 candidateLabel->SetRect(rectText); |
655 if ( width < minwidth ) |
878 candidateLabel->SetFont(layoutText.Font()); |
656 { |
879 |
657 width = minwidth; |
880 // layout ordinal label |
658 } |
881 TAknTextLineLayout ordinalLayout = |
659 rectCandidateItem.SetWidth( width + interval ); |
882 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EOrdinalCandidateTextLayout)); |
660 candidateLabel->SetRect( rectCandidateItem ); |
883 TBufC16<1> buf; |
|
884 TAknLayoutText layoutOrdinal; |
|
885 TPtr16 ptr = buf.Des(); |
|
886 ptr = (*(ordinalLabel->Text())).Left(EOneCandidate); |
|
887 |
|
888 layoutOrdinal.LayoutText(rectCandidateItem,ordinalLayout); |
|
889 |
|
890 const CFont* font = layoutOrdinal.Font(); |
|
891 |
|
892 TRect rectOrdinal = layoutOrdinal.TextRect(); |
|
893 // align ordinal label and candidate label |
|
894 |
|
895 /* removed in 2006.03.29 |
|
896 rectOrdinal.iTl.iY = rectText.iTl.iY; |
|
897 rectOrdinal.SetWidth(font->TextWidthInPixels(ptr)); |
|
898 rectOrdinal.SetHeight(font->HeightInPixels()); |
|
899 */ |
|
900 |
|
901 // inserted in 2006.03.29 |
|
902 TPoint ordinalPosition; |
|
903 TInt ordinalWidth = font->TextWidthInPixels(ptr); |
|
904 ordinalPosition.iX = rectText.iTl.iX - ordinalWidth; |
|
905 ordinalPosition.iY = rectText.iTl.iY; |
|
906 |
|
907 rectOrdinal = TRect(ordinalPosition, |
|
908 TPoint(ordinalPosition.iX + rectOrdinal.Width(), |
|
909 ordinalPosition.iY + rectOrdinal.Height())); |
|
910 // end inserting |
|
911 |
|
912 ordinalLabel->SetRect(rectOrdinal); |
|
913 ordinalLabel->SetFont(font); |
|
914 iOrdinalLableWidth = rectOrdinal.Width(); |
661 |
915 |
662 // override colours if skin data present |
916 // override colours if skin data present |
663 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
917 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
664 TRgb candidateLabelTextColor = layoutText.Color(); |
918 TRgb candidateLabelTextColor = layoutText.Color(); |
|
919 TRgb ordinalLabelTextColor = layoutOrdinal.Color(); |
665 |
920 |
666 AknsUtils::GetCachedColor(skin, candidateLabelTextColor, |
921 AknsUtils::GetCachedColor(skin, candidateLabelTextColor, |
667 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19); |
922 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19); |
668 |
923 |
|
924 AknsUtils::GetCachedColor(skin, ordinalLabelTextColor, |
|
925 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19); |
|
926 |
669 TRAP_IGNORE( |
927 TRAP_IGNORE( |
670 candidateLabel->OverrideColorL(EColorLabelText, candidateLabelTextColor); |
928 candidateLabel->OverrideColorL(EColorLabelText, candidateLabelTextColor); |
|
929 ordinalLabel->OverrideColorL(EColorLabelText, ordinalLabelTextColor); |
671 ); |
930 ); |
672 } |
931 } |
673 |
932 |
674 void CAknFepUICtrlCandidatePane::LayoutLabels() |
933 void CAknFepUICtrlCandidatePane::LayoutLabels() |
675 { |
934 { |
676 for(TInt i = 0; i < iVisibleCount; i++) |
935 for(TInt i = 0; i < iVisibleCount; i++) |
677 { |
936 { |
678 LayoutLabel(i); |
937 LayoutLabel(i); |
679 } |
938 } |
680 } |
939 } |
681 void CAknFepUICtrlCandidatePane::LayoutScroll() |
940 |
682 { |
941 void CAknFepUICtrlCandidatePane::LayoutCandidateSelected() |
683 TAknWindowLineLayout scrolllayout = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(EScrollLayout)); |
942 { |
684 AknLayoutUtils::LayoutControl( iCtrlScroll, Rect(), scrolllayout ); |
943 TCandidateMode candidateMode = iCandidateModeArray[iSelected]; |
|
944 iCandidateSelected->SetCandidateMode(candidateMode); |
|
945 iCandidateSelected->SetLayout(iPaneLayout); |
|
946 |
|
947 TRect ordinalRect = iOrdinalLabelArray[iSelected]->Rect(); |
|
948 |
|
949 TAknLayoutRect layoutRect; |
|
950 TAknWindowLineLayout layoutCandidateItem = |
|
951 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem)); |
|
952 layoutRect.LayoutRect(Rect(),layoutCandidateItem); |
|
953 |
|
954 TRect rectLayoutCandidateItem = layoutRect.Rect(); |
|
955 rectLayoutCandidateItem.iTl.iX = ordinalRect.iTl.iX; |
|
956 |
|
957 TAknTextLineLayout candidateLayout = |
|
958 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine)); |
|
959 TAknTextLineLayout ordinalLayout = |
|
960 CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EOrdinalCandidateTextLayout)); |
|
961 rectLayoutCandidateItem.SetWidth(iCandidateLabelArray[iSelected]->Rect().Width() + candidateLayout.il - ordinalLayout.il); |
|
962 |
|
963 rectLayoutCandidateItem.SetHeight(rectLayoutCandidateItem.Height() - 1); |
|
964 |
|
965 iCandidateSelected->SetRect(rectLayoutCandidateItem); |
685 } |
966 } |
686 |
967 |
687 void CAknFepUICtrlCandidatePane::UpdateLabelVisibility() |
968 void CAknFepUICtrlCandidatePane::UpdateLabelVisibility() |
688 { |
969 { |
689 TInt number = 0; |
970 TInt number = 0; |
879 { |
1159 { |
880 if (!aEnable) |
1160 if (!aEnable) |
881 { |
1161 { |
882 for (TInt i=0; i<iVisibleCount; i++) |
1162 for (TInt i=0; i<iVisibleCount; i++) |
883 { |
1163 { |
884 iCandidateLabelArray[i]->SetText( KNullDesC ); |
1164 TRAP_IGNORE(iCandidateLabelArray[i]->SetTextL(KNullDesC)); |
885 } |
1165 } |
886 TRAP_IGNORE( HidePreviewL();) |
|
887 iCandidateArray->Reset(); |
1166 iCandidateArray->Reset(); |
888 iVisibleCount = 0; |
1167 iVisibleCount = 0; |
889 DrawNow(); |
1168 DrawNow(); |
890 } |
1169 } |
891 } |
1170 } |
892 |
|
893 void CAknFepUICtrlCandidatePane::FepUIClosePressed() |
|
894 { |
|
895 // Click close to close container |
|
896 if ( iChineseUiMgr ) |
|
897 { |
|
898 iChineseUiMgr->CloseContainer(); |
|
899 } |
|
900 } |
|
901 |
|
902 void CAknFepUICtrlCandidatePane::SetFepUiState( MAknFepUiStateCtrl* aFepUiState ) |
|
903 { |
|
904 iFepUiState = aFepUiState; |
|
905 } |
|
906 |
|
907 void CAknFepUICtrlCandidatePane::HidePreviewL() |
|
908 { |
|
909 if( iPreview && iPreview->IsVisible()) |
|
910 { |
|
911 iPreview->HideL(); |
|
912 } |
|
913 } |
|
914 void CAknFepUICtrlCandidatePane::HandlePointerEventL( const TPointerEvent & aPointerEvent ) |
|
915 { |
|
916 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
917 // Press will pop up preview |
|
918 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
919 { |
|
920 for ( TInt i = 0; i < iVisibleCount; i++ ) |
|
921 { |
|
922 if ( iCandidateLabelArray[i]->Rect().Contains( aPointerEvent.iPosition )) |
|
923 { |
|
924 iPointDown = ETrue; |
|
925 SelectIndex( i ); |
|
926 const TDesC* txtLabel = iCandidateLabelArray[i]->Text(); |
|
927 TPoint point = iCandidateLabelArray[i]->PositionRelativeToScreen(); |
|
928 TRect rect( point, iCandidateLabelArray[i]->Size()); |
|
929 // if container is show on top, the preview should show bellow the character |
|
930 // else the preview should show above the character. |
|
931 TInt bottom = ShowAboveCharacter; |
|
932 if ( point.iY < iCandidateLabelArray[i]->Rect().iBr.iY ) |
|
933 { |
|
934 bottom = ShowBellowCharacter; |
|
935 } |
|
936 rect.Move( 0, (iCandidateLabelArray[i]->Size().iHeight ) * bottom ); |
|
937 iPreview->ShowL( rect, *txtLabel ); |
|
938 break; |
|
939 } |
|
940 } |
|
941 } |
|
942 // Up will submit text |
|
943 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && iPointDown ) |
|
944 { |
|
945 iPointDown = EFalse; |
|
946 for ( TInt i = 0; i < iVisibleCount; i++ ) |
|
947 { |
|
948 if ( iCandidateLabelArray[i]->Rect().Contains( aPointerEvent.iPosition )) |
|
949 { |
|
950 if ( iChineseUiMgr ) |
|
951 { |
|
952 const TDesC* text = iCandidateLabelArray[i]->Text(); |
|
953 iChineseUiMgr->SubmitSelectedTextL( *text ); |
|
954 } |
|
955 break; |
|
956 } |
|
957 } |
|
958 if( iPreview->IsVisible()) |
|
959 { |
|
960 iPreview->HideL(); |
|
961 } |
|
962 |
|
963 if( !iHighlighted ) |
|
964 { |
|
965 iCandidateLabelArray[iSelected]->SetHighlight( iHighlighted ); |
|
966 } |
|
967 } |
|
968 // Drag out of candidate pane, hide preview |
|
969 else if ( aPointerEvent.iType == TPointerEvent::EDrag && iPointDown ) |
|
970 { |
|
971 TBool bContain = EFalse; |
|
972 for ( TInt i = 0; ( !bContain ) && ( i < iVisibleCount ); i++ ) |
|
973 { |
|
974 if ( iCandidateLabelArray[i]->Rect().Contains( aPointerEvent.iPosition )) |
|
975 { |
|
976 TBool bSameIndex = ( i == iSelected ); |
|
977 SelectIndex( i ); |
|
978 if ( !bSameIndex ) |
|
979 { |
|
980 const TDesC* txtLabel = iCandidateLabelArray[i]->Text(); |
|
981 TPoint point = iCandidateLabelArray[i]->PositionRelativeToScreen(); |
|
982 TRect rect( point, iCandidateLabelArray[i]->Size()); |
|
983 TInt bottom = ShowAboveCharacter; |
|
984 // If container is moved to top, |
|
985 // then pop up preview below the character |
|
986 if ( point.iY < iCandidateLabelArray[i]->Rect().iBr.iY ) |
|
987 { |
|
988 bottom = ShowBellowCharacter; |
|
989 } |
|
990 rect.Move( 0, (iCandidateLabelArray[i]->Size().iHeight ) * bottom ); |
|
991 iPreview->ShowL( rect, *txtLabel ); |
|
992 } |
|
993 bContain = ETrue; |
|
994 break; |
|
995 } |
|
996 } |
|
997 if ( !bContain ) |
|
998 { |
|
999 iPreview->HideL(); |
|
1000 iCandidateLabelArray[iSelected]->SetHighlight( iHighlighted ); |
|
1001 if( !iHighlighted ) |
|
1002 { |
|
1003 iSelected = 0; |
|
1004 } |
|
1005 } |
|
1006 else if( bContain && !iPreview->IsVisible()) |
|
1007 { |
|
1008 const TDesC* txtLabel = iCandidateLabelArray[iSelected]->Text(); |
|
1009 TPoint point = iCandidateLabelArray[iSelected]->PositionRelativeToScreen(); |
|
1010 TRect rect( point, iCandidateLabelArray[iSelected]->Size()); |
|
1011 TInt bottom = ShowAboveCharacter; |
|
1012 // If container is moved to top, |
|
1013 // then pop up preview below the character |
|
1014 if ( point.iY < iCandidateLabelArray[iSelected]->Rect().iBr.iY ) |
|
1015 { |
|
1016 bottom = ShowBellowCharacter; |
|
1017 } |
|
1018 rect.Move( 0, (iCandidateLabelArray[iSelected]->Size().iHeight ) * bottom ); |
|
1019 iPreview->ShowL( rect, *txtLabel ); |
|
1020 } |
|
1021 } |
|
1022 else |
|
1023 { |
|
1024 // do nothing |
|
1025 } |
|
1026 } |
|
1027 |
|
1028 CAknFepPreview* CAknFepPreview::NewL( RWindowTreeNode& aParent ) |
|
1029 { |
|
1030 CAknFepPreview* self = new(ELeave) CAknFepPreview; |
|
1031 CleanupStack::PushL(self); |
|
1032 self->ConstructL( aParent ); |
|
1033 CleanupStack::Pop(); |
|
1034 return self; |
|
1035 } |
|
1036 |
|
1037 CAknFepPreview::~CAknFepPreview() |
|
1038 { |
|
1039 delete iPreviewLabel; |
|
1040 } |
|
1041 |
|
1042 void CAknFepPreview::Draw( const TRect& /*aRect*/ ) const |
|
1043 { |
|
1044 CWindowGc& gc = SystemGc(); |
|
1045 |
|
1046 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1047 TRect outerRect; |
|
1048 TRect innerRect; |
|
1049 CalculateFrameRects( outerRect, innerRect ); |
|
1050 gc.SetBrushColor( KRgbGray ); |
|
1051 // draw the whole frame background according to the containing context, which in this case |
|
1052 // is the candidate pane, to avoid corner drawing mess and to cope with masked grid frame centre |
|
1053 MAknsControlContext* cc = AknsDrawUtils::ControlContext(this); |
|
1054 AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect, |
|
1055 KAknsIIDQsnFrInputCharPreview, KAknsIIDDefault ); |
|
1056 } |
|
1057 |
|
1058 void CAknFepPreview::SizeChanged() |
|
1059 { |
|
1060 TRect rect = Rect(); |
|
1061 TAknTextLineLayout candidateLayout = AknLayoutScalable_Avkon::cell_hyb_candi_pane_t1(0); |
|
1062 // Get preview rect and font. |
|
1063 TAknLayoutText layoutText; |
|
1064 layoutText.LayoutText( rect, candidateLayout ); |
|
1065 TRect rectText = layoutText.TextRect(); |
|
1066 const CFont* font = layoutText.Font(); |
|
1067 |
|
1068 iPreviewLabel->SetRect( rectText ); |
|
1069 iPreviewLabel->SetFont( font ); |
|
1070 // override with skin text color |
|
1071 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1072 |
|
1073 TRgb labelTextColor; |
|
1074 AknsUtils::GetCachedColor( skin, labelTextColor, |
|
1075 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 ); |
|
1076 |
|
1077 TRAP_IGNORE( |
|
1078 iPreviewLabel->OverrideColorL(EColorLabelText, labelTextColor); ) |
|
1079 } |
|
1080 |
|
1081 void CAknFepPreview::ShowL( TRect& aRect, const TDesC& aCharacter ) |
|
1082 { |
|
1083 SetRect( aRect ); |
|
1084 |
|
1085 iPreviewLabel->SetTextL( aCharacter ); |
|
1086 MakeVisible( ETrue ); |
|
1087 RWindow& window = Window(); |
|
1088 window.SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + 100 ); |
|
1089 DrawNow(); |
|
1090 } |
|
1091 |
|
1092 void CAknFepPreview::HideL() |
|
1093 { |
|
1094 MakeVisible( EFalse ); |
|
1095 iPreviewLabel->SetTextL( KNullDesC ); |
|
1096 DrawNow(); |
|
1097 } |
|
1098 |
|
1099 TInt CAknFepPreview::CountComponentControls() const |
|
1100 { |
|
1101 CCoeControl* controls[] = |
|
1102 { |
|
1103 iPreviewLabel |
|
1104 }; |
|
1105 TInt count = 0; |
|
1106 for ( TUint ii = 0 ; ii < (sizeof(controls) / sizeof(CCoeControl*)); ii++ ) |
|
1107 { |
|
1108 if ( controls[ii] ) |
|
1109 { |
|
1110 count++; |
|
1111 } |
|
1112 } |
|
1113 |
|
1114 return count ; |
|
1115 } |
|
1116 |
|
1117 CCoeControl* CAknFepPreview::ComponentControl(TInt aIndex) const |
|
1118 { |
|
1119 CCoeControl* controls[] = |
|
1120 { |
|
1121 iPreviewLabel |
|
1122 }; |
|
1123 |
|
1124 for ( TUint ii = 0; (ii < sizeof(controls) / sizeof(CCoeControl*)); ii++ ) |
|
1125 { |
|
1126 if ( controls[ii] && aIndex-- == 0 ) |
|
1127 { |
|
1128 return controls[ii]; |
|
1129 } |
|
1130 } |
|
1131 // shouldn't be called while no components. |
|
1132 return NULL ; |
|
1133 } |
|
1134 |
|
1135 CAknFepPreview::CAknFepPreview() |
|
1136 { |
|
1137 } |
|
1138 |
|
1139 void CAknFepPreview::ConstructL( RWindowTreeNode& /*aParent */) |
|
1140 { |
|
1141 RWindowGroup& wg = CCoeEnv::Static()->RootWin(); |
|
1142 CreateWindowL( wg ); |
|
1143 RWindow& window = Window(); |
|
1144 iPreviewLabel = new( ELeave ) CEikLabel; |
|
1145 iPreviewLabel->SetContainerWindowL( window ); |
|
1146 iPreviewLabel->SetLabelAlignment( ELayoutAlignCenter ); |
|
1147 iPreviewLabel->SetMopParent( this ); |
|
1148 window.SetRequiredDisplayMode( EColor16MA ); |
|
1149 window.SetTransparencyAlphaChannel(); |
|
1150 window.SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + 100 ); |
|
1151 window.SetFaded( EFalse, RWindowTreeNode::EFadeIncludeChildren ); |
|
1152 // Enable receive drag event. |
|
1153 Window().PointerFilter( EPointerFilterDrag, 0 ); |
|
1154 MakeVisible( EFalse ); |
|
1155 ActivateL(); |
|
1156 } |
|
1157 |
|
1158 void CAknFepPreview::CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const |
|
1159 { |
|
1160 TRect windowRect = Rect(); |
|
1161 |
|
1162 TAknLayoutRect topLeft; |
|
1163 topLeft.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_2()); |
|
1164 |
|
1165 TAknLayoutRect bottomRight; |
|
1166 bottomRight.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_5()); |
|
1167 |
|
1168 aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr ); |
|
1169 aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl ); |
|
1170 } |
|
1171 |
|
1172 CAknFepUICtrlCandidateScroll* CAknFepUICtrlCandidateScroll::NewL( |
|
1173 RWindowTreeNode& aParent, MAknFepUIEventObserver* aObserver ) |
|
1174 { |
|
1175 CAknFepUICtrlCandidateScroll* self = new(ELeave) CAknFepUICtrlCandidateScroll; |
|
1176 CleanupStack::PushL(self); |
|
1177 self->ConstructL( aParent, aObserver ); |
|
1178 CleanupStack::Pop(); |
|
1179 return self; |
|
1180 } |
|
1181 |
|
1182 CAknFepUICtrlCandidateScroll::~CAknFepUICtrlCandidateScroll() |
|
1183 { |
|
1184 // delete bitmaps |
|
1185 delete iScrollCloseBitmap; |
|
1186 delete iScrollCloseBitmapMask; |
|
1187 delete iNaviArrowBitmapUp; |
|
1188 delete iNaviArrowBitmapUpMask; |
|
1189 delete iNaviArrowBitmapDown; |
|
1190 delete iNaviArrowBitmapDownMask; |
|
1191 } |
|
1192 |
|
1193 void CAknFepUICtrlCandidateScroll::SizeChanged() |
|
1194 { |
|
1195 LayoutIcon(); |
|
1196 } |
|
1197 |
|
1198 void CAknFepUICtrlCandidateScroll::Draw( const TRect& /*aRect*/ ) const |
|
1199 { |
|
1200 CWindowGc& gc = SystemGc(); |
|
1201 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1202 |
|
1203 // draw the whole frame background according to the containing context, which in this case |
|
1204 // is the candidate pane, to avoid corner drawing mess and to cope with masked grid frame centre |
|
1205 MAknsControlContext* cc = AknsDrawUtils::ControlContext(this); |
|
1206 TRect rect = Rect(); |
|
1207 |
|
1208 // Draw scroll background |
|
1209 AknsDrawUtils::DrawBackground( skin, cc, this, gc, |
|
1210 rect.iTl, rect, KAknsDrawParamDefault ); |
|
1211 |
|
1212 // Draw close Rects |
|
1213 if ( iShowClose ) |
|
1214 { |
|
1215 TRect outerRect; |
|
1216 TRect innerRect; |
|
1217 CalculateCloseRects( outerRect, innerRect ); |
|
1218 AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect, |
|
1219 KAknsIIDQsnFrKeypadButtonFrNormal, KAknsIIDDefault ); |
|
1220 // Draw close bitmap |
|
1221 iIndiFepClose.DrawImage( gc, |
|
1222 iScrollCloseBitmap, |
|
1223 iScrollCloseBitmapMask ); |
|
1224 } |
|
1225 |
|
1226 // Draw Up arrow & Down arrow |
|
1227 if ( iShowVerticalScrollArrows ) |
|
1228 { |
|
1229 if ( iShowUpScrollArrows ) |
|
1230 { |
|
1231 iIndiFepArrowUp.DrawImage( gc, |
|
1232 iNaviArrowBitmapUp, |
|
1233 iNaviArrowBitmapUpMask ); |
|
1234 } |
|
1235 |
|
1236 if ( iShowDownScrollArrows ) |
|
1237 { |
|
1238 iIndiFepArrowDown.DrawImage( gc, |
|
1239 iNaviArrowBitmapDown, |
|
1240 iNaviArrowBitmapDownMask ); |
|
1241 } |
|
1242 } |
|
1243 } |
|
1244 |
|
1245 void CAknFepUICtrlCandidateScroll::HandlePointerEventL( const TPointerEvent & aPointerEvent ) |
|
1246 { |
|
1247 // Close area is click will close the container |
|
1248 if ( iObServer != NULL && iIndiFepClose.Rect().Contains( aPointerEvent.iPosition )) |
|
1249 { |
|
1250 iObServer->FepUIClosePressed(); |
|
1251 } |
|
1252 } |
|
1253 |
|
1254 void CAknFepUICtrlCandidateScroll::ShowUpScrollArrows(TBool aValue) |
|
1255 { |
|
1256 // Update the up arrow if needed |
|
1257 if ( iShowUpScrollArrows != aValue ) |
|
1258 { |
|
1259 iShowUpScrollArrows = aValue; |
|
1260 TRect rect = iIndiFepArrowUp.Rect(); |
|
1261 Window().Invalidate(rect); |
|
1262 } |
|
1263 } |
|
1264 |
|
1265 void CAknFepUICtrlCandidateScroll::ShowDownScrollArrows( TBool aValue ) |
|
1266 { |
|
1267 // Update the down arrow if needed |
|
1268 if ( iShowDownScrollArrows != aValue ) |
|
1269 { |
|
1270 iShowDownScrollArrows = aValue; |
|
1271 TRect rect = iIndiFepArrowDown.Rect(); |
|
1272 Window().Invalidate(rect); |
|
1273 } |
|
1274 } |
|
1275 |
|
1276 void CAknFepUICtrlCandidateScroll::ShowVerticalScrollArrows( TBool aValue ) |
|
1277 { |
|
1278 // If the state is changed, the arrows will be redrawn in the new state. |
|
1279 if(!COMPARE_BOOLS(iShowVerticalScrollArrows, aValue)) |
|
1280 { |
|
1281 iShowVerticalScrollArrows = aValue; |
|
1282 //TRect rect = iIndiFepArrowUp.Rect(); |
|
1283 DrawDeferred(); |
|
1284 //rect = iIndiFepArrowDown.Rect(); |
|
1285 //Window().Invalidate(rect); |
|
1286 } |
|
1287 } |
|
1288 |
|
1289 TBool CAknFepUICtrlCandidateScroll::IsShowVerticalScrollArrows() const |
|
1290 { |
|
1291 return iShowVerticalScrollArrows; |
|
1292 } |
|
1293 |
|
1294 void CAknFepUICtrlCandidateScroll::ConstructL( RWindowTreeNode& aParent, |
|
1295 MAknFepUIEventObserver* aObserver ) |
|
1296 { |
|
1297 CreateWindowL( aParent ); |
|
1298 ConstructBitmapsL(); |
|
1299 iObServer = aObserver; |
|
1300 |
|
1301 TRect rect; |
|
1302 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect ); |
|
1303 // Dibert will not need close button |
|
1304 iShowClose = rect.Height() == DibertHeight ? EFalse : ETrue; |
|
1305 |
|
1306 } |
|
1307 |
|
1308 void CAknFepUICtrlCandidateScroll::ConstructBitmapsL() |
|
1309 { |
|
1310 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
1311 |
|
1312 TFileName bmpFile; |
|
1313 bmpFile.Copy(_L("z:")); |
|
1314 bmpFile.Append( KDC_BITMAP_DIR ); |
|
1315 bmpFile.Append( KFepUiControlsBitmapFile ); |
|
1316 |
|
1317 // Create close bitmap |
|
1318 AknsUtils::CreateColorIconL( skin, |
|
1319 KAknsIIDQgnGrafFepCandiListClose, |
|
1320 KAknsIIDQsnIconColors, |
|
1321 EAknsCIQsnIconColorsCG20, |
|
1322 iScrollCloseBitmap, |
|
1323 iScrollCloseBitmapMask, |
|
1324 bmpFile, |
|
1325 EMbmAknfepuictrlsQgn_indi_input_candi_list_close, |
|
1326 EMbmAknfepuictrlsQgn_indi_input_candi_list_close_mask, |
|
1327 AKN_LAF_COLOR( 0 )); |
|
1328 |
|
1329 // Create Up bitmap |
|
1330 AknsUtils::CreateColorIconL( skin, |
|
1331 KAknsIIDQgnIndiFepArrowUp, |
|
1332 KAknsIIDQsnIconColors, |
|
1333 EAknsCIQsnIconColorsCG20, |
|
1334 iNaviArrowBitmapUp, |
|
1335 iNaviArrowBitmapUpMask, |
|
1336 bmpFile, |
|
1337 EMbmAknfepuictrlsQgn_indi_fep_arrow_up, |
|
1338 EMbmAknfepuictrlsQgn_indi_fep_arrow_up_mask, |
|
1339 AKN_LAF_COLOR( 0 )); |
|
1340 |
|
1341 // Create Down bitmap |
|
1342 AknsUtils::CreateColorIconL( skin, |
|
1343 KAknsIIDQgnIndiFepArrowDown, |
|
1344 KAknsIIDQsnIconColors, |
|
1345 EAknsCIQsnIconColorsCG20, |
|
1346 iNaviArrowBitmapDown, |
|
1347 iNaviArrowBitmapDownMask, |
|
1348 bmpFile, |
|
1349 EMbmAknfepuictrlsQgn_indi_fep_arrow_down, |
|
1350 EMbmAknfepuictrlsQgn_indi_fep_arrow_down_mask, |
|
1351 AKN_LAF_COLOR( 0 )); |
|
1352 } |
|
1353 |
|
1354 CAknFepUICtrlCandidateScroll::CAknFepUICtrlCandidateScroll() |
|
1355 : iShowVerticalScrollArrows(EFalse), |
|
1356 iShowUpScrollArrows(ETrue), |
|
1357 iShowDownScrollArrows(ETrue), |
|
1358 iShowClose(ETrue) |
|
1359 { |
|
1360 } |
|
1361 |
|
1362 void CAknFepUICtrlCandidateScroll::LayoutIcon() |
|
1363 { |
|
1364 TRect rect = Rect(); |
|
1365 // layout arrow up |
|
1366 TAknWindowLineLayout arrowUpLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g1(0); |
|
1367 iIndiFepArrowUp.LayoutRect( rect, arrowUpLayout ); |
|
1368 AknIconUtils::SetSize(iNaviArrowBitmapUp, iIndiFepArrowUp.Rect().Size()); |
|
1369 |
|
1370 // layout arrow down |
|
1371 TAknWindowLineLayout arrowDownLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g2(0); |
|
1372 iIndiFepArrowDown.LayoutRect( rect, arrowDownLayout ); |
|
1373 AknIconUtils::SetSize( iNaviArrowBitmapDown, iIndiFepArrowDown.Rect().Size()); |
|
1374 |
|
1375 // layout close |
|
1376 TAknWindowLineLayout closeLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g3(0); |
|
1377 iIndiFepClose.LayoutRect( rect, closeLayout ); |
|
1378 AknIconUtils::SetSize( iScrollCloseBitmap, iIndiFepClose.Rect().Size()); |
|
1379 } |
|
1380 |
|
1381 void CAknFepUICtrlCandidateScroll::CalculateCloseRects(TRect& aOuterRect, TRect& aInnerRect) const |
|
1382 { |
|
1383 TRect windowRect = iIndiFepClose.Rect(); |
|
1384 |
|
1385 TAknLayoutRect topLeft; |
|
1386 topLeft.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_2()); |
|
1387 |
|
1388 TAknLayoutRect bottomRight; |
|
1389 bottomRight.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_5()); |
|
1390 |
|
1391 aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr ); |
|
1392 aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl ); |
|
1393 } |
|
1394 |
|
1395 // End of file |
1171 // End of file |