598 } |
521 } |
599 |
522 |
600 TBool CAknSctNaviButton::IsEnabled() |
523 TBool CAknSctNaviButton::IsEnabled() |
601 { |
524 { |
602 return iButtonControl->IsVisible(); |
525 return iButtonControl->IsVisible(); |
603 } |
|
604 |
|
605 // ---------------------------------------------------------------------------- |
|
606 // Table navi class implementation |
|
607 // ---------------------------------------------------------------------------- |
|
608 // |
|
609 CAknSctTableNavi::CAknSctTableNavi(CAknCharMap* aCharMap, CAknCharMapExtension* aExtension) : |
|
610 iCharMap(aCharMap), iExtension(aExtension) |
|
611 { |
|
612 } |
|
613 |
|
614 CAknSctTableNavi::~CAknSctTableNavi() |
|
615 { |
|
616 if (iButtonArray.Count()) |
|
617 { |
|
618 iButtonArray.ResetAndDestroy(); |
|
619 } |
|
620 iButtonArray.Close(); |
|
621 delete iIdle; |
|
622 } |
|
623 |
|
624 TInt CAknSctTableNavi::CountComponentControls() const |
|
625 { |
|
626 return iButtonArray.Count(); |
|
627 } |
|
628 |
|
629 CCoeControl* CAknSctTableNavi::ComponentControl( TInt aIndex ) const |
|
630 { |
|
631 CCoeControl* rtn; |
|
632 if (aIndex < iButtonArray.Count()) |
|
633 { |
|
634 rtn = iButtonArray[aIndex]->iButtonControl; |
|
635 } |
|
636 else |
|
637 { |
|
638 rtn = NULL; |
|
639 } |
|
640 return rtn; |
|
641 } |
|
642 |
|
643 TKeyResponse CAknSctTableNavi::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aModifiers) |
|
644 { |
|
645 CAknSctNaviButton* buttonObj = iButtonArray[iButtonIndex]; |
|
646 buttonObj->iButtonControl->OfferKeyEventL(aKeyEvent,aModifiers); |
|
647 TKeyResponse response = EKeyWasNotConsumed; |
|
648 TUint code=aKeyEvent.iCode; |
|
649 switch (code) |
|
650 { |
|
651 case EKeyEnter: |
|
652 case EKeyOK: |
|
653 { |
|
654 switch (buttonObj->iButtonId) |
|
655 { |
|
656 case EAknSctTableNaviExit: |
|
657 { |
|
658 iExtension->iKeyOkEvent = ETrue; |
|
659 TableExitL(); |
|
660 response = EKeyWasConsumed; |
|
661 } |
|
662 break; |
|
663 // add all supported table types here. |
|
664 case EAknSctTableNaviSpecialChar: |
|
665 case EAknSctTableNaviEmotion: |
|
666 { |
|
667 NextTableL(); |
|
668 response = EKeyWasConsumed; |
|
669 } |
|
670 break; |
|
671 default: |
|
672 break; |
|
673 } |
|
674 } |
|
675 break; |
|
676 case EKeyLeftArrow: |
|
677 case '4': |
|
678 { |
|
679 MoveFocus(-1,0); |
|
680 response = EKeyWasConsumed; |
|
681 } |
|
682 break; |
|
683 case EKeyRightArrow: |
|
684 case '6': |
|
685 { |
|
686 MoveFocus(1,0); |
|
687 response = EKeyWasConsumed; |
|
688 } |
|
689 break; |
|
690 case EKeyUpArrow: |
|
691 case '2': |
|
692 { |
|
693 response = EKeyWasConsumed; |
|
694 if ((iButtonIndex==0) && !Layout_Meta_Data::IsLandscapeOrientation()) |
|
695 { |
|
696 // Left page button. |
|
697 if (iExtension->iPageNavi && iExtension->iPageNavi->EnterControl(0,0)) |
|
698 { |
|
699 LeaveControl(); |
|
700 } |
|
701 } |
|
702 else |
|
703 { |
|
704 // Last radio button. |
|
705 if ((iButtonIndex==0) && iExtension->iRadioButton) |
|
706 { |
|
707 if (iExtension->iRadioButton->EnterControl(0,iExtension->iRadioButton->Count()-1)) |
|
708 { |
|
709 LeaveControl(); |
|
710 } |
|
711 break; |
|
712 } |
|
713 |
|
714 // Grid bottom row. |
|
715 TInt xPos = ButtonPosition(iButtonIndex); |
|
716 if (iCharMap->ColMax(0) > iCharMap->ColMax(xPos)) |
|
717 { |
|
718 xPos = iCharMap->RowMax(iCharMap->ColMax(0)); |
|
719 } |
|
720 |
|
721 if (iExtension->EnterControl(xPos,iCharMap->ColMax(xPos))) |
|
722 { |
|
723 LeaveControl(); |
|
724 break; |
|
725 } |
|
726 } |
|
727 } |
|
728 break; |
|
729 |
|
730 case EKeyDownArrow: |
|
731 case '8': |
|
732 { |
|
733 response = EKeyWasConsumed; |
|
734 |
|
735 // First radio button. |
|
736 if ((iButtonIndex==0) && iExtension->iRadioButton) |
|
737 { |
|
738 if (iExtension->iRadioButton->EnterControl(0,0)) |
|
739 { |
|
740 LeaveControl(); |
|
741 } |
|
742 break; |
|
743 } |
|
744 |
|
745 // Grid top row. |
|
746 TInt xPos = ButtonPosition(iButtonIndex); |
|
747 if (iExtension->EnterControl(xPos,iCharMap->ColMin(xPos))) |
|
748 { |
|
749 LeaveControl(); |
|
750 break; |
|
751 } |
|
752 } |
|
753 break; |
|
754 |
|
755 default: |
|
756 break; |
|
757 } |
|
758 return response; |
|
759 } |
|
760 |
|
761 void CAknSctTableNavi::TableExitL() |
|
762 { |
|
763 if(!iIdle) |
|
764 { |
|
765 iIdle = CIdle::NewL(CActive::EPriorityStandard); |
|
766 } |
|
767 |
|
768 iIdle->Cancel(); |
|
769 iIdle->Start(TCallBack(TableExitCallBackL, this)); |
|
770 } |
|
771 |
|
772 TInt CAknSctTableNavi::TableExitCallBackL(TAny* aThis) |
|
773 { |
|
774 ((CAknSctTableNavi*)aThis)->DoTableExitL(); |
|
775 return KErrNone; |
|
776 } |
|
777 |
|
778 void CAknSctTableNavi::DoTableExitL() |
|
779 { |
|
780 iCharMap->SetStatusChanged(EAknCharSelectedTableExitButton); |
|
781 } |
|
782 |
|
783 void CAknSctTableNavi::NextTableL() |
|
784 { |
|
785 if(!iIdle) |
|
786 { |
|
787 iIdle = CIdle::NewL(CActive::EPriorityStandard); |
|
788 } |
|
789 |
|
790 iIdle->Cancel(); |
|
791 iIdle->Start(TCallBack(NextTableCallBackL, this)); |
|
792 } |
|
793 |
|
794 TInt CAknSctTableNavi::NextTableCallBackL(TAny* aThis) |
|
795 { |
|
796 ((CAknSctTableNavi*)aThis)->DoNextTableL(); |
|
797 return KErrNone; |
|
798 } |
|
799 |
|
800 void CAknSctTableNavi::DoNextTableL() |
|
801 { |
|
802 iCharMap->SetStatusChanged(EAknCharSelectedNextTableButton); |
|
803 } |
|
804 |
|
805 TInt CAknSctTableNavi::ButtonPosition(TInt aButtonIndex) const |
|
806 { |
|
807 // buttons behind the 1th are behavior as one button |
|
808 return (aButtonIndex==0) ? 0 : 1; |
|
809 } |
|
810 |
|
811 void CAknSctTableNavi::ConstructFromResourceL(TResourceReader& aReader) |
|
812 { |
|
813 // Table navi buttons. |
|
814 TInt counts = aReader.ReadInt16(); |
|
815 for (TInt i = 0; i < counts; i++) |
|
816 { |
|
817 TInt buttonId = aReader.ReadInt16(); |
|
818 TInt resId = aReader.ReadInt32(); |
|
819 TResourceReader buttonReader; |
|
820 iCoeEnv->CreateResourceReaderLC(buttonReader, resId); |
|
821 CAknSctNaviButton* buttonObj = CAknSctNaviButton::NewL(*this, buttonId, buttonReader); |
|
822 buttonObj->SetObserver(this); |
|
823 iButtonArray.Append(buttonObj); |
|
824 CleanupStack::PopAndDestroy(); // buttonReader |
|
825 } |
|
826 } |
|
827 |
|
828 TSize CAknSctTableNavi::MinimumSize() |
|
829 { |
|
830 return Rect().Size(); |
|
831 } |
|
832 |
|
833 void CAknSctTableNavi::SizeChanged() |
|
834 { |
|
835 if (iButtonArray.Count()>0) |
|
836 { |
|
837 |
|
838 TInt ctrlVariety = 2; |
|
839 TInt cellVariety = 1; |
|
840 if(!iCharMap->IsJapaneseSctUi()) |
|
841 { |
|
842 ctrlVariety = (iCharMap->TableCount()>1) ? 0 : 1; |
|
843 cellVariety = 0; |
|
844 } |
|
845 |
|
846 TAknLayoutRect cellLayRect, buttonLayRect; |
|
847 TRect buttonRect; |
|
848 |
|
849 // Table exit. |
|
850 cellLayRect.LayoutRect(Rect(), AknLayoutScalable_Avkon::cell_graphic2_control_pane(ctrlVariety,0)); |
|
851 buttonLayRect.LayoutRect(cellLayRect.Rect(), AknLayoutScalable_Avkon::bg_button_pane_cp05(cellVariety)); |
|
852 buttonRect = buttonLayRect.Rect(); |
|
853 |
|
854 TAknLayoutRect iconLayRect; |
|
855 iconLayRect.LayoutRect(buttonRect, AknLayoutScalable_Avkon::cell_graphic2_control_pane_g1(cellVariety)); |
|
856 TSize iconSize = iconLayRect.Rect().Size(); |
|
857 |
|
858 CAknSctNaviButton* buttonObj = iButtonArray[0]; |
|
859 buttonObj->iButtonControl->SetRect(buttonRect); |
|
860 buttonObj->iButtonControl->SetHighlightRect(buttonRect); |
|
861 buttonObj->iButtonControl->SetIconScaleMode(EAspectRatioPreserved); |
|
862 buttonObj->iButtonControl->SetIconSize(iconSize); |
|
863 buttonObj->SetEnabled(ETrue); |
|
864 |
|
865 // Table change. |
|
866 if (iCharMap->TableCount() > 1) |
|
867 { |
|
868 cellLayRect.LayoutRect(Rect(), AknLayoutScalable_Avkon::cell_graphic2_control_pane(ctrlVariety,1)); |
|
869 buttonLayRect.LayoutRect(cellLayRect.Rect(), AknLayoutScalable_Avkon::bg_button_pane_cp05(cellVariety)); |
|
870 buttonRect = buttonLayRect.Rect(); |
|
871 |
|
872 for (TInt i(1); i<iButtonArray.Count(); i++) |
|
873 { |
|
874 CAknSctNaviButton* buttonObj = iButtonArray[i]; |
|
875 buttonObj->iButtonControl->SetRect(buttonRect); |
|
876 buttonObj->iButtonControl->SetHighlightRect(buttonRect); |
|
877 buttonObj->iButtonControl->SetIconScaleMode(EAspectRatioPreserved); |
|
878 buttonObj->iButtonControl->SetIconSize(iconSize); |
|
879 buttonObj->SetEnabled(ETrue); |
|
880 } |
|
881 } |
|
882 |
|
883 TRAP_IGNORE(UpdateNextTableButtonL()); |
|
884 } |
|
885 } |
|
886 |
|
887 void CAknSctTableNavi::HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType) |
|
888 { |
|
889 if(aEventType == EEventStateChanged) |
|
890 { |
|
891 for(TInt i=0; i<iButtonArray.Count(); i++) |
|
892 { |
|
893 CAknSctNaviButton* button = iButtonArray[i]; |
|
894 if(button->iButtonControl == aControl) |
|
895 { |
|
896 switch(button->iButtonId) |
|
897 { |
|
898 case EAknSctTableNaviExit: |
|
899 { |
|
900 iExtension->iKeyOkEvent = ETrue; |
|
901 TableExitL(); |
|
902 } |
|
903 return; |
|
904 |
|
905 case EAknSctTableNaviSpecialChar: |
|
906 case EAknSctTableNaviEmotion: |
|
907 { |
|
908 NextTableL(); |
|
909 } |
|
910 return; |
|
911 |
|
912 default: |
|
913 break; |
|
914 } |
|
915 |
|
916 break; |
|
917 } |
|
918 } |
|
919 } |
|
920 } |
|
921 |
|
922 |
|
923 void CAknSctTableNavi::UpdateNextTableButtonL() |
|
924 { |
|
925 |
|
926 TBool isFocused = EFalse; |
|
927 |
|
928 // table switch buttons stay in one place. |
|
929 for(TInt index(1); index<iButtonArray.Count(); index++) |
|
930 { |
|
931 CAknSctNaviButton* buttonObj = iButtonArray[index]; |
|
932 if(buttonObj->IsEnabled()) |
|
933 { |
|
934 isFocused = buttonObj->IsFocused(); |
|
935 } |
|
936 } |
|
937 |
|
938 // fresh focused button |
|
939 for (TInt index(1); index<iButtonArray.Count(); index++) |
|
940 { |
|
941 CAknSctNaviButton* buttonObj = iButtonArray[index]; |
|
942 if (iCharMap->TableCount() > 1) |
|
943 { |
|
944 switch (iCharMap->NextTableCase()) |
|
945 { |
|
946 case EAknCharMapTableSpecialChar: |
|
947 { |
|
948 TBool isShown = EFalse; |
|
949 if(iExtension->IsShowingEmotion()) |
|
950 { |
|
951 isShown = (buttonObj->iButtonId==EAknSctTableNaviSpecialChar); |
|
952 } |
|
953 else |
|
954 { |
|
955 isShown = (buttonObj->iButtonId==EAknSctTableNaviEmotion); |
|
956 } |
|
957 buttonObj->SetEnabled(isShown); |
|
958 buttonObj->SetFocused(isShown && isFocused); |
|
959 if(isShown && isFocused) |
|
960 { |
|
961 iButtonIndex = index; |
|
962 } |
|
963 } |
|
964 break; |
|
965 |
|
966 default: |
|
967 buttonObj->SetEnabled(EFalse); |
|
968 break; |
|
969 } |
|
970 } |
|
971 else |
|
972 { |
|
973 buttonObj->SetEnabled(EFalse); |
|
974 } |
|
975 } |
|
976 } |
|
977 |
|
978 CCoeControl* CAknSctTableNavi::FocusedControl() |
|
979 { |
|
980 return this; |
|
981 } |
|
982 |
|
983 TBool CAknSctTableNavi::EnterControl(TInt aX, TInt /*aY*/) |
|
984 { |
|
985 if (IsVisible()) |
|
986 { |
|
987 if ((aX >= 0) && (aX < iButtonArray.Count())) |
|
988 { |
|
989 TInt index = aX; |
|
990 if (AknLayoutUtils::LayoutMirrored()) // reverse. |
|
991 { |
|
992 index = (iButtonArray.Count() - 1) - aX; |
|
993 } |
|
994 |
|
995 index = ButtonPosition(index); |
|
996 |
|
997 for(; index<iButtonArray.Count(); index++) |
|
998 { |
|
999 CAknSctNaviButton* buttonObj = iButtonArray[index]; |
|
1000 if (buttonObj->IsEnabled()) |
|
1001 { |
|
1002 iButtonIndex = index; |
|
1003 iExtension->iFocusHandler = this; |
|
1004 buttonObj->SetFocused(ETrue); |
|
1005 return ETrue; |
|
1006 } |
|
1007 } |
|
1008 } |
|
1009 } |
|
1010 return EFalse; |
|
1011 } |
|
1012 |
|
1013 void CAknSctTableNavi::MoveFocus(TInt aX, TInt /*aY*/) |
|
1014 { |
|
1015 TInt delta = aX; |
|
1016 if (AknLayoutUtils::LayoutMirrored()) // reverse. |
|
1017 { |
|
1018 delta = -aX; |
|
1019 } |
|
1020 |
|
1021 TInt buttonIndex = iButtonIndex + delta; |
|
1022 |
|
1023 // loop until find next position |
|
1024 for (TInt i = 0; i < iButtonArray.Count(); i++) |
|
1025 { |
|
1026 |
|
1027 if (buttonIndex > iButtonArray.Count() - 1) // goto Next control |
|
1028 { |
|
1029 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
1030 { |
|
1031 // First radio button. |
|
1032 if (iExtension->iRadioButton) |
|
1033 { |
|
1034 if (iExtension->iRadioButton->EnterControl(0,0)) |
|
1035 { |
|
1036 LeaveControl(); |
|
1037 } |
|
1038 break; |
|
1039 } |
|
1040 // Grid start. |
|
1041 if (iExtension->EnterControl(0,iCharMap->ColMin(0))) |
|
1042 { |
|
1043 LeaveControl(); |
|
1044 } |
|
1045 } |
|
1046 else |
|
1047 { |
|
1048 // Left page button. |
|
1049 if (iExtension->iPageNavi && |
|
1050 iExtension->iPageNavi->EnterControl(0,0)) |
|
1051 { |
|
1052 LeaveControl(); |
|
1053 } |
|
1054 } |
|
1055 break; |
|
1056 } |
|
1057 |
|
1058 else if (buttonIndex < 0) // goto Prev control |
|
1059 { |
|
1060 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
1061 { |
|
1062 // Right page button. |
|
1063 if (iExtension->iPageNavi && |
|
1064 iExtension->iPageNavi->EnterControl(1,0)) |
|
1065 { |
|
1066 LeaveControl(); |
|
1067 } |
|
1068 } |
|
1069 else |
|
1070 { |
|
1071 // Grid end. |
|
1072 TInt posY = iCharMap->ColMax(0); |
|
1073 if (iExtension->EnterControl(iCharMap->RowMax(posY),posY)) |
|
1074 { |
|
1075 LeaveControl(); |
|
1076 } |
|
1077 } |
|
1078 break; |
|
1079 } |
|
1080 |
|
1081 if (iButtonArray[buttonIndex]->IsEnabled()) // goto next button in This control |
|
1082 { |
|
1083 CAknSctNaviButton* buttonObj; |
|
1084 buttonObj = iButtonArray[iButtonIndex]; |
|
1085 buttonObj->SetFocused(EFalse); |
|
1086 iButtonIndex = buttonIndex; |
|
1087 buttonObj = iButtonArray[iButtonIndex]; |
|
1088 buttonObj->SetFocused(ETrue); |
|
1089 break; |
|
1090 } |
|
1091 |
|
1092 buttonIndex += (delta < 0) ? -1 : 1; // get next position |
|
1093 } |
|
1094 } |
|
1095 |
|
1096 TBool CAknSctTableNavi::LeaveControl() |
|
1097 { |
|
1098 for (TInt i = 0; i < iButtonArray.Count(); i++ ) |
|
1099 { |
|
1100 iButtonArray[i]->SetFocused(EFalse); |
|
1101 } |
|
1102 return ETrue; |
|
1103 } |
|
1104 |
|
1105 TBool CAknSctTableNavi::ExitWithKey(TInt /*aKeycode*/) |
|
1106 { |
|
1107 if (iButtonArray[iButtonIndex]->iButtonId != EAknSctTableNaviExit) |
|
1108 { |
|
1109 return EFalse; |
|
1110 } |
|
1111 else |
|
1112 { |
|
1113 return ETrue; |
|
1114 } |
|
1115 } |
526 } |
1116 |
527 |
1117 // ---------------------------------------------------------------------------- |
528 // ---------------------------------------------------------------------------- |
1118 // Page Navi class implementation |
529 // Page Navi class implementation |
1119 // ---------------------------------------------------------------------------- |
530 // ---------------------------------------------------------------------------- |
1180 case EKeyEnter: |
592 case EKeyEnter: |
1181 case EKeyOK: |
593 case EKeyOK: |
1182 { |
594 { |
1183 switch (buttonObj->iButtonId) |
595 switch (buttonObj->iButtonId) |
1184 { |
596 { |
|
597 case EAknSctTableNaviExit: |
|
598 { |
|
599 iExtension->iKeyOkEvent = ETrue; |
|
600 TableExitL(); |
|
601 } |
|
602 break; |
1185 case EAknSctPageNaviPrevPage: |
603 case EAknSctPageNaviPrevPage: |
1186 { |
604 { |
1187 iCharMap->PrevPageL(); |
605 iCharMap->PrevPageL(); |
1188 } |
606 } |
1189 break; |
607 break; |
1190 case EAknSctPageNaviNextPage: |
608 case EAknSctPageNaviNextPage: |
1191 { |
609 { |
1192 iCharMap->NextPageL(); |
610 iCharMap->NextPageL(); |
1193 } |
611 } |
1194 break; |
612 break; |
|
613 // add all supported table types here. |
|
614 case EAknSctTableNaviSpecialChar: |
|
615 case EAknSctTableNaviEmotion: |
|
616 { |
|
617 NextTableL(); |
|
618 } |
|
619 break; |
1195 default: |
620 default: |
1196 return EKeyWasConsumed; |
621 return EKeyWasConsumed; |
1197 } |
622 } |
1198 buttonObj->SetFocused(ETrue); |
623 buttonObj->SetFocused(ETrue); |
1199 response = EKeyWasConsumed; |
624 response = EKeyWasConsumed; |
1200 UpdatePageTitleL(); |
625 UpdatePageTitleL(); |
1201 } |
626 } |
1202 break; |
627 break; |
1203 case EKeyLeftArrow: |
628 case EKeyLeftArrow: |
1204 case '4': |
629 case '4': |
1205 { |
|
1206 MoveFocus(-1,0); |
|
1207 response = EKeyWasConsumed; |
|
1208 } |
|
1209 break; |
|
1210 case EKeyRightArrow: |
630 case EKeyRightArrow: |
1211 case '6': |
631 case '6': |
1212 { |
|
1213 MoveFocus(1,0); |
|
1214 response = EKeyWasConsumed; |
|
1215 } |
|
1216 break; |
|
1217 case EKeyUpArrow: |
632 case EKeyUpArrow: |
1218 case '2': |
633 case '2': |
1219 { |
634 case EKeyDownArrow: |
|
635 case '8': |
|
636 { |
|
637 TInt gridX; |
|
638 TInt gridY; |
|
639 TBool gridInvolved = CalcNextStep( code, gridX, gridY ); |
|
640 MoveFocus( !gridInvolved, gridX, gridY ); |
1220 response = EKeyWasConsumed; |
641 response = EKeyWasConsumed; |
1221 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
642 } |
1222 { |
643 break; |
1223 if (iExtension->iRadioButton && !IsNextButton()) |
644 default: |
|
645 break; |
|
646 } |
|
647 return response; |
|
648 } |
|
649 |
|
650 TBool CAknSctPageNavi::CalcNextStep( TUint aKey, TInt& aX, TInt& aY ) |
|
651 { |
|
652 TBool landscape = Layout_Meta_Data::IsLandscapeOrientation(); |
|
653 TBool mirrored = AknLayoutUtils::LayoutMirrored(); |
|
654 TBool emotionEnabled = iExtension->IsEmotionEnabled(); |
|
655 TInt scPages = iCharMap->PageCount(); |
|
656 |
|
657 aX = 0; |
|
658 aY = 0; |
|
659 TInt xOffset = 0; |
|
660 TInt yOffset = 0; |
|
661 |
|
662 // Simplify key events to two variants |
|
663 switch ( aKey ) |
|
664 { |
|
665 case EKeyLeftArrow: |
|
666 case '4': |
|
667 { |
|
668 xOffset = -1; |
|
669 } |
|
670 break; |
|
671 case EKeyRightArrow: |
|
672 case '6': |
|
673 { |
|
674 xOffset = 1; |
|
675 } |
|
676 break; |
|
677 case EKeyDownArrow: |
|
678 case '8': |
|
679 { |
|
680 yOffset = 1; |
|
681 } |
|
682 break; |
|
683 case EKeyUpArrow: |
|
684 case '2': |
|
685 { |
|
686 yOffset = -1; |
|
687 } |
|
688 break; |
|
689 default: |
|
690 break; |
|
691 } |
|
692 |
|
693 TInt runtimeIndex = iButtonIndex; |
|
694 if ( !emotionEnabled ) |
|
695 { |
|
696 // SC/Emotion unabled, button regrouped! |
|
697 if ( ( mirrored && iButtonIndex == EAknSctPageNaviPrevPage && xOffset != 1 ) |
|
698 || ( !mirrored && iButtonIndex == EAknSctPageNaviNextPage && xOffset != -1) ) |
|
699 { |
|
700 runtimeIndex = iExtension->IsShowingEmotion()?EAknSctTableNaviSpecialChar:EAknSctTableNaviEmotion; |
|
701 } |
|
702 } |
|
703 // calculate when moving from PageNavi to grid, the column position |
|
704 switch ( runtimeIndex ) |
|
705 { |
|
706 case EAknSctTableNaviExit: |
|
707 { |
|
708 aX = 0; |
|
709 if ( ( !mirrored && xOffset == -1 ) || ( mirrored && xOffset == 1 ) ) |
|
710 { |
|
711 // Grid end |
|
712 aY = iCharMap->ColMax(0); |
|
713 aX = iCharMap->RowMax( aY ); |
|
714 return ETrue; |
|
715 } |
|
716 else if ( mirrored && xOffset == -1 && scPages >= 2 ) |
|
717 { |
|
718 xOffset = EAknSctPageNaviNextPage; |
|
719 } |
|
720 else if ( scPages < 2 |
|
721 && ( ( !mirrored && xOffset == 1 ) || ( mirrored && xOffset == -1 ) ) ) |
|
722 { |
|
723 if ( !emotionEnabled ) |
1224 { |
724 { |
1225 // Last radio button. |
725 // Grid start |
1226 if (iExtension->iRadioButton->EnterControl( |
726 aX = 0; |
1227 0,iExtension->iRadioButton->Count()-1)) |
727 aY = iCharMap->ColMin( aX ); |
1228 { |
728 return ETrue; |
1229 LeaveControl(); |
|
1230 } |
|
1231 break; |
|
1232 } |
|
1233 } |
|
1234 TInt xPos; |
|
1235 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
1236 { |
|
1237 xPos = IsNextButton() ? iCharMap->MaxCols() - 1 : 0; |
|
1238 } |
|
1239 else |
|
1240 { |
|
1241 if (IsNextButton()) |
|
1242 { |
|
1243 xPos = iCharMap->MaxCols() - 1; |
|
1244 } |
729 } |
1245 else |
730 else |
1246 { |
731 { |
1247 xPos = !iExtension->iRadioButton ? |
732 xOffset = LastButton(); |
1248 iCharMap->TableCount() : iCharMap->MaxCols()-2; |
|
1249 } |
733 } |
1250 } |
734 } |
1251 if (iCharMap->ColMax(0) > iCharMap->ColMax(xPos)) |
|
1252 { |
|
1253 xPos = iCharMap->RowMax(iCharMap->ColMax(0)); |
|
1254 } |
|
1255 // Grid bottom row. |
|
1256 if (iExtension->EnterControl(xPos,iCharMap->ColMax(xPos))) |
|
1257 { |
|
1258 LeaveControl(); |
|
1259 break; |
|
1260 } |
|
1261 } |
|
1262 break; |
|
1263 case EKeyDownArrow: |
|
1264 case '8': |
|
1265 { |
|
1266 response = EKeyWasConsumed; |
|
1267 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
1268 { |
|
1269 if (!IsNextButton()) |
|
1270 { |
|
1271 // First table button. |
|
1272 if (iExtension->iTableNavi && |
|
1273 iExtension->iTableNavi->EnterControl(0,0)) |
|
1274 { |
|
1275 LeaveControl(); |
|
1276 break; |
|
1277 } |
|
1278 } |
|
1279 else |
|
1280 { |
|
1281 // Grid top row. |
|
1282 TInt xPos = iCharMap->MaxCols() - 1; |
|
1283 if (iExtension->EnterControl(xPos,iCharMap->ColMin(xPos))) |
|
1284 { |
|
1285 LeaveControl(); |
|
1286 break; |
|
1287 } |
|
1288 } |
|
1289 } |
|
1290 else |
735 else |
1291 { |
736 { |
1292 TInt xPos; |
737 xOffset = EAknSctTableNaviExit + xOffset; |
1293 if (IsNextButton()) |
738 } |
1294 { |
739 } |
1295 xPos = iCharMap->MaxCols() - 1; |
740 break; |
1296 } |
741 case EAknSctPageNaviPrevPage: |
1297 else |
742 { |
1298 { |
743 aX = mirrored ? iCharMap->MaxCols()-2 : 1; |
1299 xPos = !iExtension->iRadioButton ? |
744 if ( mirrored && xOffset == -1 ) |
1300 iCharMap->TableCount() : iCharMap->MaxCols() - 2; |
745 { |
1301 } |
746 xOffset = LastButton(); |
1302 // Grid top row. |
747 } |
1303 if (iExtension->EnterControl(xPos,iCharMap->ColMin(xPos))) |
748 else |
1304 { |
749 { |
1305 LeaveControl(); |
750 xOffset = xOffset + EAknSctPageNaviPrevPage; |
1306 break; |
751 } |
1307 } |
752 } |
1308 } |
753 break; |
1309 } |
754 case EAknSctPageNaviNextPage: |
1310 break; |
755 { |
1311 default: |
756 aX = mirrored ? 1 : iCharMap->MaxCols()-2; |
1312 break; |
757 if ( mirrored && xOffset == 1 ) |
1313 } |
758 { |
1314 return response; |
759 xOffset = 0; |
1315 } |
760 } |
|
761 else if ( !mirrored && xOffset == 1 ) |
|
762 { |
|
763 xOffset = LastButton(); |
|
764 } |
|
765 else |
|
766 { |
|
767 xOffset = EAknSctPageNaviNextPage + xOffset; |
|
768 } |
|
769 } |
|
770 break; |
|
771 case EAknSctTableNaviSpecialChar: |
|
772 case EAknSctTableNaviEmotion: |
|
773 { |
|
774 aX = iCharMap->MaxCols()-1; |
|
775 if ( ( !mirrored && xOffset == 1 ) || ( mirrored && xOffset == -1 ) ) |
|
776 { |
|
777 // Grid start |
|
778 aX = 0; |
|
779 aY = iCharMap->ColMin( aX ); |
|
780 return ETrue; |
|
781 } |
|
782 else if ( scPages < 2 |
|
783 && ( ( !mirrored && xOffset == -1 ) || ( mirrored && xOffset == 1 ) ) ) |
|
784 { |
|
785 xOffset = EAknSctTableNaviExit; |
|
786 } |
|
787 else if ( mirrored && xOffset == 1 ) |
|
788 { |
|
789 xOffset = EAknSctPageNaviPrevPage; |
|
790 } |
|
791 else |
|
792 { |
|
793 xOffset = EAknSctPageNaviNextPage; |
|
794 } |
|
795 } |
|
796 break; |
|
797 default: |
|
798 break; |
|
799 } |
|
800 |
|
801 if ( yOffset == 1 ) |
|
802 { |
|
803 // DOWN |
|
804 aY = iCharMap->ColMin( aX ); |
|
805 return ETrue; |
|
806 } |
|
807 else if ( yOffset == -1 ) |
|
808 { |
|
809 // and UP |
|
810 aY = iCharMap->ColMax( aX ); |
|
811 return ETrue; |
|
812 } |
|
813 |
|
814 // Return False means it's internal moving focus within Page Navi |
|
815 aX = xOffset; |
|
816 aY = 0; |
|
817 return EFalse; |
|
818 } |
1316 |
819 |
1317 TBool CAknSctPageNavi::IsNextButton() const |
820 TBool CAknSctPageNavi::IsNextButton() const |
1318 { |
821 { |
1319 if (iButtonIndex < iButtonArray.Count() && iButtonArray[iButtonIndex]) |
822 if (iButtonIndex < iButtonArray.Count() && iButtonArray[iButtonIndex]) |
1320 { |
823 { |
1450 } |
970 } |
1451 |
971 |
1452 void CAknSctPageNavi::SizeChanged() |
972 void CAknSctPageNavi::SizeChanged() |
1453 { |
973 { |
1454 |
974 |
1455 TAknLayoutRect pageButtonLayRect; |
975 TAknLayoutRect pageButtonLayRect, buttonLayRect; |
1456 TInt pageVariate = !iCharMap->IsJapaneseSctUi() ? ((iCharMap->TableCount() > 1) ? 0 : 1) : 2; |
976 TInt cellVar = Layout_Meta_Data::IsLandscapeOrientation()? 3 : 2; |
1457 |
977 TInt bgVar = 2; |
|
978 TBool landScape = Layout_Meta_Data::IsLandscapeOrientation(); |
|
979 TBool emotionEnabled = ETrue; |
|
980 TBool mirrored = AknLayoutUtils::LayoutMirrored(); |
1458 CAknSctNaviButton* buttonObj; |
981 CAknSctNaviButton* buttonObj; |
1459 TRect rect; |
982 TRect rect; |
1460 |
983 |
|
984 if ( iExtension ) |
|
985 { |
|
986 emotionEnabled = iExtension->IsEmotionEnabled(); |
|
987 } |
|
988 |
|
989 // Prev button |
|
990 buttonObj = iButtonArray[1]; |
|
991 buttonObj->iButtonControl->SetButtonFlags(0); |
|
992 TInt col = 0; |
|
993 if ( !landScape ) |
|
994 { |
|
995 col = mirrored ? ( !emotionEnabled?4:3 ) : 1; |
|
996 } |
|
997 else |
|
998 { |
|
999 col = mirrored ? ( !emotionEnabled?6:5 ) : 1; |
|
1000 } |
|
1001 pageButtonLayRect.LayoutRect( Rect(), AknLayoutScalable_Avkon::cell_graphic2_control_pane(cellVar,col) ); |
|
1002 buttonLayRect.LayoutRect( pageButtonLayRect.Rect(), AknLayoutScalable_Avkon::bg_button_pane_cp05(bgVar)); |
|
1003 rect = buttonLayRect.Rect(); |
|
1004 buttonObj->iButtonControl->SetRect(rect); |
|
1005 buttonObj->iButtonControl->SetHighlightRect(rect); |
|
1006 |
|
1007 // ...Prev button icon |
|
1008 TAknLayoutRect iconLayRect; |
|
1009 iconLayRect.LayoutRect(rect, AknLayoutScalable_Avkon::cell_graphic2_control_pane_g1(bgVar)); |
|
1010 TSize iconSize = iconLayRect.Rect().Size(); |
|
1011 buttonObj->iButtonControl->SetIconSize(iconSize); |
|
1012 |
|
1013 // Next button |
|
1014 buttonObj = iButtonArray[2]; |
|
1015 buttonObj->iButtonControl->SetButtonFlags(0); |
|
1016 if ( !landScape ) |
|
1017 { |
|
1018 col = mirrored ? 1 : ( !emotionEnabled?4:3 ); |
|
1019 } |
|
1020 else |
|
1021 { |
|
1022 col = mirrored ? 1 : ( !emotionEnabled?6:5 ); |
|
1023 } |
|
1024 pageButtonLayRect.LayoutRect( Rect(), AknLayoutScalable_Avkon::cell_graphic2_control_pane(cellVar,col) ); |
|
1025 buttonLayRect.LayoutRect( pageButtonLayRect.Rect(), AknLayoutScalable_Avkon::bg_button_pane_cp05(bgVar)); |
|
1026 rect = buttonLayRect.Rect(); |
|
1027 buttonObj->iButtonControl->SetRect(rect); |
|
1028 buttonObj->iButtonControl->SetHighlightRect(rect); |
|
1029 |
|
1030 // ...Next button icon |
|
1031 buttonObj->iButtonControl->SetIconSize(iconSize); |
|
1032 |
|
1033 // Exit button |
1461 buttonObj = iButtonArray[0]; |
1034 buttonObj = iButtonArray[0]; |
1462 buttonObj->iButtonControl->SetButtonFlags(0); |
1035 buttonObj->iButtonControl->SetButtonFlags(0); |
1463 if (!AknLayoutUtils::LayoutMirrored()) |
1036 pageButtonLayRect.LayoutRect( Rect(), AknLayoutScalable_Avkon::cell_graphic2_control_pane(cellVar,0) ); |
1464 { |
1037 buttonLayRect.LayoutRect( pageButtonLayRect.Rect(), AknLayoutScalable_Avkon::bg_button_pane_cp05(bgVar)); |
1465 buttonObj->iButtonId = EAknSctPageNaviPrevPage; |
1038 rect = buttonLayRect.Rect(); |
1466 pageButtonLayRect.LayoutRect(Rect(),AknLayoutScalable_Avkon::bg_button_pane_cp10(pageVariate)); |
|
1467 } |
|
1468 else |
|
1469 { |
|
1470 buttonObj->iButtonId = EAknSctPageNaviNextPage; |
|
1471 pageButtonLayRect.LayoutRect(Rect(),AknLayoutScalable_Avkon::bg_button_pane_cp11(pageVariate)); |
|
1472 } |
|
1473 rect = pageButtonLayRect.Rect(); |
|
1474 buttonObj->iButtonControl->SetRect(rect); |
1039 buttonObj->iButtonControl->SetRect(rect); |
1475 buttonObj->iButtonControl->SetHighlightRect(rect); |
1040 buttonObj->iButtonControl->SetHighlightRect(rect); |
1476 TAknLayoutRect pageButtonIconLayRect; |
1041 |
1477 pageButtonIconLayRect.LayoutRect(pageButtonLayRect.Rect(), AknLayoutScalable_Avkon::graphic2_pages_pane_g1(pageVariate)); |
1042 // ...Exit button icon |
1478 buttonObj->iButtonControl->SetIconScaleMode(EAspectRatioPreserved); |
|
1479 TSize iconSize = pageButtonIconLayRect.Rect().Size(); |
|
1480 buttonObj->iButtonControl->SetIconSize(iconSize); |
1043 buttonObj->iButtonControl->SetIconSize(iconSize); |
1481 |
1044 |
1482 buttonObj = iButtonArray[1]; |
1045 // Emotion/Special-char button |
1483 buttonObj->iButtonControl->SetButtonFlags(0); |
1046 col = landScape? 6 : 4; |
1484 if (!AknLayoutUtils::LayoutMirrored()) |
1047 pageButtonLayRect.LayoutRect( Rect(), AknLayoutScalable_Avkon::cell_graphic2_control_pane(cellVar,col) ); |
1485 { |
1048 buttonLayRect.LayoutRect( pageButtonLayRect.Rect(), AknLayoutScalable_Avkon::bg_button_pane_cp05(bgVar)); |
1486 buttonObj->iButtonId = EAknSctPageNaviNextPage; |
1049 rect = buttonLayRect.Rect(); |
1487 pageButtonLayRect.LayoutRect(Rect(), AknLayoutScalable_Avkon::bg_button_pane_cp11(pageVariate)); |
1050 for ( TInt i = 3; i < iButtonArray.Count();i++ ) |
1488 } |
1051 { |
1489 else |
1052 buttonObj = iButtonArray[i]; |
1490 { |
1053 buttonObj->iButtonControl->SetButtonFlags(0); |
1491 buttonObj->iButtonId = EAknSctPageNaviPrevPage; |
1054 buttonObj->iButtonControl->SetRect(rect); |
1492 pageButtonLayRect.LayoutRect(Rect(), AknLayoutScalable_Avkon::bg_button_pane_cp10(pageVariate)); |
1055 buttonObj->iButtonControl->SetHighlightRect(rect); |
1493 } |
1056 |
1494 rect = pageButtonLayRect.Rect(); |
1057 // ...its icon |
1495 buttonObj->iButtonControl->SetRect(rect); |
1058 buttonObj->iButtonControl->SetIconSize(iconSize); |
1496 buttonObj->iButtonControl->SetHighlightRect(rect); |
1059 } |
1497 buttonObj->iButtonControl->SetIconScaleMode(EAspectRatioPreserved); |
1060 TRAP_IGNORE(UpdateNextTableButtonL()); |
1498 buttonObj->iButtonControl->SetIconSize(iconSize); |
1061 |
1499 |
|
1500 // Page text. |
1062 // Page text. |
1501 TRect parentRect = Rect(); |
1063 col = landScape? 3 : 2; |
1502 AknLayoutUtils::LayoutLabel(iTitle, parentRect, AknLayoutScalable_Avkon::graphic2_pages_pane_t1(pageVariate).LayoutLine()); |
1064 pageButtonLayRect.LayoutRect(Rect(), AknLayoutScalable_Avkon::cell_graphic2_control_pane(cellVar,col)); |
|
1065 TAknTextComponentLayout textlayout = AknLayoutScalable_Avkon::cell_graphic2_control_pane_t1(); |
|
1066 TRect titleRect( pageButtonLayRect.Rect() ); |
|
1067 if ( !emotionEnabled ) |
|
1068 { |
|
1069 // start complex dynamic logic to locate title rect when emotion is unable |
|
1070 TInt orientation = mirrored ? -1 : 1; |
|
1071 TInt newLeft = titleRect.iTl.iX + orientation*rect.Width()/2; |
|
1072 TPoint titleTL( newLeft, titleRect.iTl.iY ); |
|
1073 titleRect.SetRect( titleTL, titleRect.Size() ); |
|
1074 } |
|
1075 AknLayoutUtils::LayoutLabel(iTitle, titleRect, textlayout.LayoutLine()); |
1503 |
1076 |
1504 // Page text color |
1077 // Page text color |
1505 TAknLayoutText textLayout; |
1078 TAknLayoutText textLayout; |
1506 textLayout.LayoutText(parentRect, AknLayoutScalable_Avkon::graphic2_pages_pane_t1(pageVariate)); |
1079 textLayout.LayoutText( titleRect, textlayout ); |
1507 TRect textRect = textLayout.TextRect(); |
|
1508 TRgb color = textLayout.Color(); |
1080 TRgb color = textLayout.Color(); |
1509 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1081 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1510 if (skin) |
1082 if (skin) |
1511 { |
1083 { |
1512 (void)AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6); |
1084 (void)AknsUtils::GetCachedColor(skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6); |
1565 } |
1140 } |
1566 } |
1141 } |
1567 return EFalse; |
1142 return EFalse; |
1568 } |
1143 } |
1569 |
1144 |
1570 void CAknSctPageNavi::MoveFocus(TInt aX, TInt /*aY*/) |
1145 void CAknSctPageNavi::MoveFocus(TInt aX, TInt aY ) |
1571 { |
1146 { |
1572 TInt delta = aX; |
1147 (void)aX; |
1573 TInt buttonIndex = iButtonIndex + delta; |
1148 (void)aY; |
1574 for (TInt i = 0; i < iButtonArray.Count(); i++) |
1149 } |
1575 { |
1150 |
1576 if (buttonIndex > iButtonArray.Count() - 1) // Next control. |
1151 void CAknSctPageNavi::MoveFocus(TBool aInternalMove, TInt aX, TInt aY ) |
1577 { |
1152 { |
1578 if (!AknLayoutUtils::LayoutMirrored()) |
1153 if ( aInternalMove ) |
1579 { |
1154 { |
1580 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
1155 EnterControl( aX, 0 ); |
|
1156 } |
|
1157 else |
|
1158 { |
|
1159 if (iExtension->EnterControl( aX, aY ) ) |
|
1160 { |
|
1161 LeaveControl(); |
|
1162 } |
|
1163 } |
|
1164 } |
|
1165 |
|
1166 TBool CAknSctPageNavi::LeaveControl() |
|
1167 { |
|
1168 for (TInt i = 0; i < iButtonArray.Count(); i++ ) |
|
1169 { |
|
1170 iButtonArray[i]->SetFocused(EFalse); |
|
1171 } |
|
1172 return ETrue; |
|
1173 } |
|
1174 |
|
1175 TBool CAknSctPageNavi::ExitWithKey(TInt /*aKeycode*/) |
|
1176 { |
|
1177 return EFalse; |
|
1178 } |
|
1179 |
|
1180 |
|
1181 void CAknSctPageNavi::TableExitL() |
|
1182 { |
|
1183 if(!iIdle) |
|
1184 { |
|
1185 iIdle = CIdle::NewL(CActive::EPriorityStandard); |
|
1186 } |
|
1187 |
|
1188 iIdle->Cancel(); |
|
1189 iIdle->Start(TCallBack(TableExitCallBackL, this)); |
|
1190 } |
|
1191 |
|
1192 TInt CAknSctPageNavi::TableExitCallBackL(TAny* aThis) |
|
1193 { |
|
1194 ((CAknSctPageNavi*)aThis)->DoTableExitL(); |
|
1195 return KErrNone; |
|
1196 } |
|
1197 |
|
1198 void CAknSctPageNavi::DoTableExitL() |
|
1199 { |
|
1200 iCharMap->SetStatusChanged(EAknCharSelectedTableExitButton); |
|
1201 } |
|
1202 |
|
1203 void CAknSctPageNavi::NextTableL() |
|
1204 { |
|
1205 if(!iIdle) |
|
1206 { |
|
1207 iIdle = CIdle::NewL(CActive::EPriorityStandard); |
|
1208 } |
|
1209 |
|
1210 iIdle->Cancel(); |
|
1211 iIdle->Start(TCallBack(NextTableCallBackL, this)); |
|
1212 } |
|
1213 |
|
1214 TInt CAknSctPageNavi::NextTableCallBackL(TAny* aThis) |
|
1215 { |
|
1216 ((CAknSctPageNavi*)aThis)->DoNextTableL(); |
|
1217 return KErrNone; |
|
1218 } |
|
1219 |
|
1220 void CAknSctPageNavi::DoNextTableL() |
|
1221 { |
|
1222 iCharMap->SetStatusChanged(EAknCharSelectedNextTableButton); |
|
1223 } |
|
1224 |
|
1225 void CAknSctPageNavi::UpdateNextTableButtonL() |
|
1226 { |
|
1227 |
|
1228 TBool isFocused = EFalse; |
|
1229 |
|
1230 // table switch buttons stay in one place. |
|
1231 for(TInt index(3); index<iButtonArray.Count(); index++) |
|
1232 { |
|
1233 CAknSctNaviButton* buttonObj = iButtonArray[index]; |
|
1234 if(buttonObj->IsEnabled()) |
|
1235 { |
|
1236 isFocused = buttonObj->IsFocused(); |
|
1237 } |
|
1238 } |
|
1239 |
|
1240 // fresh focused button |
|
1241 for (TInt index(1); index<iButtonArray.Count(); index++) |
|
1242 { |
|
1243 CAknSctNaviButton* buttonObj = iButtonArray[index]; |
|
1244 if ( index == EAknSctPageNaviPrevPage |
|
1245 || index == EAknSctPageNaviNextPage ) |
|
1246 { |
|
1247 // No need to display Prev/Next |
|
1248 if ( iCharMap->PageCount() < 2 ) |
|
1249 { |
|
1250 buttonObj->SetEnabled(EFalse); |
|
1251 } |
|
1252 continue; |
|
1253 } |
|
1254 if (iCharMap->TableCount() > 1) |
|
1255 { |
|
1256 switch (iCharMap->NextTableCase()) |
|
1257 { |
|
1258 case EAknCharMapTableSpecialChar: |
1581 { |
1259 { |
1582 // First table button. |
1260 TBool isShown = EFalse; |
1583 if (iExtension->iTableNavi && |
1261 if(iExtension->IsShowingEmotion()) |
1584 iExtension->iTableNavi->EnterControl(0,0)) |
|
1585 { |
1262 { |
1586 LeaveControl(); |
1263 isShown = (buttonObj->iButtonId==EAknSctTableNaviSpecialChar); |
1587 break; |
1264 } |
|
1265 else |
|
1266 { |
|
1267 isShown = (buttonObj->iButtonId==EAknSctTableNaviEmotion); |
|
1268 } |
|
1269 buttonObj->SetEnabled(isShown); |
|
1270 buttonObj->SetFocused(isShown && isFocused); |
|
1271 if(isShown && isFocused) |
|
1272 { |
|
1273 iButtonIndex = index; |
1588 } |
1274 } |
1589 } |
1275 } |
1590 else |
1276 break; |
1591 { |
1277 |
1592 // First radio button. |
1278 default: |
1593 if (iExtension->iRadioButton && |
1279 buttonObj->SetEnabled(EFalse); |
1594 iExtension->iRadioButton->EnterControl(0,0)) |
1280 break; |
1595 { |
1281 } |
1596 LeaveControl(); |
1282 } |
1597 break; |
1283 else |
1598 } |
1284 { |
1599 // Grid start. |
1285 buttonObj->SetEnabled(EFalse); |
1600 TInt yPos = iCharMap->ColMin(0); |
1286 } |
1601 if (iExtension->EnterControl(iCharMap->RowMin(yPos),yPos)) |
1287 } |
1602 { |
1288 } |
1603 LeaveControl(); |
1289 |
1604 break; |
1290 TInt CAknSctPageNavi::LastButton() const |
1605 } |
1291 { |
1606 } |
1292 TBool emotionEnable = iExtension->IsEmotionEnabled(); |
1607 } |
1293 if ( emotionEnable ) |
1608 else |
1294 { |
1609 { |
1295 return iExtension->IsShowingEmotion()?EAknSctTableNaviSpecialChar:EAknSctTableNaviEmotion; |
1610 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
1296 } |
1611 { |
1297 else if ( iCharMap->PageCount() < 2 && !emotionEnable ) |
1612 // Grid end. |
1298 { |
1613 TInt yPos = iCharMap->ColMax(0); |
1299 // Only one page, must have no SC/Emotion also, left Exit only. |
1614 if (iExtension->EnterControl(iCharMap->RowMax(yPos),yPos)) |
1300 return EAknSctTableNaviExit; |
1615 { |
1301 } |
1616 LeaveControl(); |
1302 else |
1617 break; |
1303 { |
1618 } |
1304 // emotion doesn't support, no SC/Emotion icon then |
1619 } |
1305 TBool mirrored = AknLayoutUtils::LayoutMirrored(); |
1620 else |
1306 return mirrored ? EAknSctPageNaviPrevPage : EAknSctPageNaviNextPage; |
1621 { |
1307 } |
1622 // Last table button. |
|
1623 TInt xPos = iCharMap->TableCount() - 1; |
|
1624 if (iExtension->iTableNavi && |
|
1625 iExtension->iTableNavi->EnterControl(xPos,0)) |
|
1626 { |
|
1627 LeaveControl(); |
|
1628 break; |
|
1629 } |
|
1630 } |
|
1631 } |
|
1632 break; |
|
1633 } |
|
1634 else if (buttonIndex < 0) // Prev control |
|
1635 { |
|
1636 if (!AknLayoutUtils::LayoutMirrored()) |
|
1637 { |
|
1638 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
1639 { |
|
1640 // Grid end. |
|
1641 TInt yPos = iCharMap->ColMax(0); |
|
1642 if (iExtension->EnterControl(iCharMap->RowMax(yPos),yPos)) |
|
1643 { |
|
1644 LeaveControl(); |
|
1645 break; |
|
1646 } |
|
1647 } |
|
1648 else |
|
1649 { |
|
1650 // Last table button. |
|
1651 if (iExtension->iTableNavi && |
|
1652 iExtension->iTableNavi->EnterControl(iCharMap->TableCount()-1,0)) |
|
1653 { |
|
1654 LeaveControl(); |
|
1655 break; |
|
1656 } |
|
1657 } |
|
1658 } |
|
1659 else |
|
1660 { |
|
1661 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
1662 { |
|
1663 // First table button. |
|
1664 if (iExtension->iTableNavi && |
|
1665 iExtension->iTableNavi->EnterControl(0,0)) |
|
1666 { |
|
1667 LeaveControl(); |
|
1668 break; |
|
1669 } |
|
1670 } |
|
1671 else |
|
1672 { |
|
1673 // Grid start. |
|
1674 TInt yPos = iCharMap->ColMin(0); |
|
1675 if (iExtension->EnterControl(iCharMap->RowMin(yPos),yPos)) |
|
1676 { |
|
1677 LeaveControl(); |
|
1678 break; |
|
1679 } |
|
1680 } |
|
1681 } |
|
1682 } |
|
1683 |
|
1684 if (iButtonArray[buttonIndex]->IsEnabled()) // This control |
|
1685 { |
|
1686 CAknSctNaviButton* buttonObj; |
|
1687 buttonObj = iButtonArray[iButtonIndex]; |
|
1688 buttonObj->SetFocused(EFalse); |
|
1689 iButtonIndex = buttonIndex; |
|
1690 buttonObj = iButtonArray[iButtonIndex]; |
|
1691 buttonObj->SetFocused(ETrue); |
|
1692 break; |
|
1693 } |
|
1694 buttonIndex += (delta < 0) ? -1 : 1; |
|
1695 } |
|
1696 } |
|
1697 |
|
1698 TBool CAknSctPageNavi::LeaveControl() |
|
1699 { |
|
1700 for (TInt i = 0; i < iButtonArray.Count(); i++ ) |
|
1701 { |
|
1702 iButtonArray[i]->SetFocused(EFalse); |
|
1703 } |
|
1704 return ETrue; |
|
1705 } |
|
1706 |
|
1707 TBool CAknSctPageNavi::ExitWithKey(TInt /*aKeycode*/) |
|
1708 { |
|
1709 return EFalse; |
|
1710 } |
1308 } |
1711 |
1309 |
1712 // ---------------------------------------------------------------------------- |
1310 // ---------------------------------------------------------------------------- |
1713 // Category button class implementation |
1311 // Category button class implementation |
1714 // ---------------------------------------------------------------------------- |
1312 // ---------------------------------------------------------------------------- |
1756 iButtonControl->DrawDeferred(); |
1354 iButtonControl->DrawDeferred(); |
1757 } |
1355 } |
1758 |
1356 |
1759 |
1357 |
1760 // ---------------------------------------------------------------------------- |
1358 // ---------------------------------------------------------------------------- |
1761 // Radio button class implementation |
|
1762 // ---------------------------------------------------------------------------- |
|
1763 // |
|
1764 CAknSctRadioButton::CAknSctRadioButton() |
|
1765 { |
|
1766 } |
|
1767 |
|
1768 CAknSctRadioButton::CAknSctRadioButton( |
|
1769 CAknCharMap* aCharMap, |
|
1770 CAknCharMapExtension* aExtension) |
|
1771 :iExtension(aExtension), |
|
1772 iCharMap(aCharMap) |
|
1773 { |
|
1774 } |
|
1775 |
|
1776 CAknSctRadioButton::~CAknSctRadioButton() |
|
1777 { |
|
1778 iButtonArray.ResetAndDestroy(); |
|
1779 iButtonArray.Close(); |
|
1780 } |
|
1781 |
|
1782 TInt CAknSctRadioButton::CountComponentControls() const |
|
1783 { |
|
1784 return iButtonArray.Count(); |
|
1785 } |
|
1786 |
|
1787 CCoeControl* CAknSctRadioButton::ComponentControl( TInt aIndex ) const |
|
1788 { |
|
1789 if (aIndex < iButtonArray.Count()) |
|
1790 { |
|
1791 return iButtonArray[aIndex]->iButtonControl; |
|
1792 } |
|
1793 return NULL; |
|
1794 } |
|
1795 |
|
1796 TKeyResponse CAknSctRadioButton::OfferKeyEventL( |
|
1797 const TKeyEvent& aKeyEvent, |
|
1798 TEventCode /*aModifiers*/) |
|
1799 { |
|
1800 TKeyResponse responce = EKeyWasNotConsumed; |
|
1801 TUint code=aKeyEvent.iCode; |
|
1802 switch (code) |
|
1803 { |
|
1804 case EKeyEnter: |
|
1805 case EKeyOK: |
|
1806 { |
|
1807 if (AknLayoutUtils::PenEnabled()) |
|
1808 { |
|
1809 // Grid. |
|
1810 TInt yPos = iCharMap->ColMin(0); |
|
1811 TInt xPos = iCharMap->RowMin(yPos); |
|
1812 if (iExtension->EnterControl(xPos,yPos)) |
|
1813 { |
|
1814 CAknButton* buttonCtrlObj; |
|
1815 TInt currentIndex; |
|
1816 TInt newIndex; |
|
1817 for (TInt index=0; index < iButtonArray.Count(); index++) |
|
1818 { |
|
1819 buttonCtrlObj = iButtonArray[index]->iButtonControl; |
|
1820 currentIndex = buttonCtrlObj->StateIndex(); |
|
1821 if (index == iButtonIndex) |
|
1822 { |
|
1823 newIndex = KAknSctRadioOn; |
|
1824 } |
|
1825 else |
|
1826 { |
|
1827 newIndex = KAknSctRadioOff; |
|
1828 } |
|
1829 if (currentIndex != newIndex) |
|
1830 { |
|
1831 buttonCtrlObj->SetCurrentState(newIndex, ETrue); |
|
1832 if (newIndex == KAknSctRadioOn) |
|
1833 { |
|
1834 iExtension->iCurrentCategory = |
|
1835 iButtonArray[index]->iButtonId; |
|
1836 iCharMap->SetStatusChanged(EAknCharChangedCategory); |
|
1837 } |
|
1838 } |
|
1839 } |
|
1840 LeaveControl(); |
|
1841 } |
|
1842 } |
|
1843 responce = EKeyWasConsumed; |
|
1844 } |
|
1845 break; |
|
1846 case EKeyLeftArrow: |
|
1847 case '4': |
|
1848 { |
|
1849 responce = EKeyWasConsumed; |
|
1850 if (AknLayoutUtils::PenEnabled()) |
|
1851 { |
|
1852 TInt yPos = iButtonIndex - 1; |
|
1853 if (iCharMap->RowMax(yPos) < 0) |
|
1854 { |
|
1855 if (Layout_Meta_Data::IsLandscapeOrientation()) |
|
1856 { |
|
1857 if (iExtension->iRadioButton) |
|
1858 { |
|
1859 // Right page button. |
|
1860 if (iExtension->iPageNavi && |
|
1861 iExtension->iPageNavi->EnterControl(1,0)) |
|
1862 { |
|
1863 LeaveControl(); |
|
1864 break; |
|
1865 } |
|
1866 } |
|
1867 } |
|
1868 // Next button up. |
|
1869 MoveFocus(0,-1); |
|
1870 break; |
|
1871 } |
|
1872 else |
|
1873 { |
|
1874 //Previous row end. |
|
1875 TInt xPos = iCharMap->RowMax(yPos); |
|
1876 if (iExtension->EnterControl(xPos,yPos)) |
|
1877 { |
|
1878 LeaveControl(); |
|
1879 break; |
|
1880 } |
|
1881 } |
|
1882 break; |
|
1883 } |
|
1884 // Move by grid. |
|
1885 iCharMap->TakeFocus(); |
|
1886 TInt xPos = iCharMap->CursorPos().iX; |
|
1887 TInt yPos = iCharMap->CursorPos().iY; |
|
1888 if (xPos == 0) |
|
1889 { |
|
1890 iCharMap->MoveFocus(-1,0); |
|
1891 } |
|
1892 iCharMap->ShowFocus(); |
|
1893 } |
|
1894 break; |
|
1895 case EKeyRightArrow: |
|
1896 case '6': |
|
1897 { |
|
1898 responce = EKeyWasConsumed; |
|
1899 if (AknLayoutUtils::PenEnabled()) |
|
1900 { |
|
1901 TInt yPos = iButtonIndex; |
|
1902 if (iCharMap->RowMax(yPos) < 0) |
|
1903 { |
|
1904 // Next button down. |
|
1905 MoveFocus(0,1); |
|
1906 break; |
|
1907 } |
|
1908 else |
|
1909 { |
|
1910 // 1st cell in the row. |
|
1911 if (iExtension->EnterControl(0,yPos)) |
|
1912 { |
|
1913 LeaveControl(); |
|
1914 break; |
|
1915 } |
|
1916 } |
|
1917 break; |
|
1918 } |
|
1919 // Move by grid. |
|
1920 iCharMap->TakeFocus(); |
|
1921 TInt xPos = iCharMap->CursorPos().iX; |
|
1922 TInt yPos = iCharMap->CursorPos().iY; |
|
1923 if (xPos == iCharMap->RowMax(yPos)) |
|
1924 { |
|
1925 iCharMap->MoveFocus(1,0); |
|
1926 } |
|
1927 iCharMap->ShowFocus(); |
|
1928 } |
|
1929 break; |
|
1930 case EKeyDownArrow: |
|
1931 case '8': |
|
1932 { |
|
1933 MoveFocus(0, 1); |
|
1934 responce = EKeyWasConsumed; |
|
1935 } |
|
1936 break; |
|
1937 case EKeyUpArrow: |
|
1938 case '2': |
|
1939 { |
|
1940 MoveFocus(0,-1); |
|
1941 responce = EKeyWasConsumed; |
|
1942 } |
|
1943 break; |
|
1944 default: |
|
1945 break; |
|
1946 } |
|
1947 return responce; |
|
1948 } |
|
1949 |
|
1950 void CAknSctRadioButton::ConstructFromResourceL(TResourceReader& aReader) |
|
1951 { |
|
1952 TInt counts = aReader.ReadInt16(); |
|
1953 TResourceReader reader; |
|
1954 TInt categorybutton_id; |
|
1955 TInt sctcase_id; |
|
1956 TInt resId; |
|
1957 CAknSctCategoryButton* buttonObj; |
|
1958 TBool allowCreation; |
|
1959 |
|
1960 for (TInt index=0; index < counts; index++) |
|
1961 { |
|
1962 allowCreation = EFalse; |
|
1963 // button id |
|
1964 categorybutton_id = aReader.ReadInt16(); |
|
1965 sctcase_id = aReader.ReadInt16(); |
|
1966 switch (categorybutton_id) |
|
1967 { |
|
1968 case EAknSCTCategoryButtonHalfCase: |
|
1969 case EAknSCTCategoryButtonFullCase: |
|
1970 allowCreation = ETrue; |
|
1971 break; |
|
1972 case EAknSCTCategoryButtonPicto: |
|
1973 if (iExtension->iPictographsBuffer) |
|
1974 { |
|
1975 allowCreation = ETrue; |
|
1976 } |
|
1977 break; |
|
1978 case EAknSCTCategoryButtonPicto1: |
|
1979 case EAknSCTCategoryButtonPicto2: |
|
1980 if (iExtension->iPictographsBuffer && |
|
1981 iExtension->iPictographsBufferGrouping) |
|
1982 { |
|
1983 allowCreation = ETrue; |
|
1984 } |
|
1985 break; |
|
1986 default: |
|
1987 break; |
|
1988 } |
|
1989 |
|
1990 if (allowCreation) |
|
1991 { |
|
1992 // read the button resource |
|
1993 resId = aReader.ReadInt32(); |
|
1994 iCoeEnv->CreateResourceReaderLC( reader, resId ); |
|
1995 // create Category button object |
|
1996 buttonObj = CAknSctCategoryButton::NewL( |
|
1997 *this, reader, categorybutton_id, sctcase_id); |
|
1998 // Append button |
|
1999 iButtonArray.Append(buttonObj); |
|
2000 CleanupStack::PopAndDestroy(); // reader |
|
2001 } |
|
2002 else |
|
2003 { |
|
2004 // Skip data |
|
2005 resId = aReader.ReadInt32(); |
|
2006 } |
|
2007 } |
|
2008 |
|
2009 } |
|
2010 |
|
2011 void CAknSctRadioButton::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
2012 { |
|
2013 TRect rect(Rect()); |
|
2014 if (AknLayoutUtils::PenEnabled() && rect.Contains(aPointerEvent.iPosition)) |
|
2015 { |
|
2016 if (aPointerEvent.iType == TPointerEvent::EButton1Down) |
|
2017 { |
|
2018 CAknButton* buttonCtrlObj; |
|
2019 TRect rectButton; |
|
2020 TInt currentIndex; |
|
2021 TInt newIndex; |
|
2022 for (TInt index=0; index < iButtonArray.Count(); index++) |
|
2023 { |
|
2024 buttonCtrlObj = iButtonArray[index]->iButtonControl; |
|
2025 rectButton = buttonCtrlObj->Rect(); |
|
2026 currentIndex = buttonCtrlObj->StateIndex(); |
|
2027 |
|
2028 if (rectButton.Contains(aPointerEvent.iPosition)) |
|
2029 { |
|
2030 newIndex = KAknSctRadioOn; |
|
2031 } |
|
2032 else |
|
2033 { |
|
2034 newIndex = KAknSctRadioOff; |
|
2035 } |
|
2036 if (currentIndex != newIndex) |
|
2037 { |
|
2038 buttonCtrlObj->SetCurrentState(newIndex, ETrue); |
|
2039 if (newIndex == KAknSctRadioOn) |
|
2040 { |
|
2041 if (AknLayoutUtils::PenEnabled()) |
|
2042 { |
|
2043 iButtonIndex = index; |
|
2044 } |
|
2045 iExtension->iCurrentCategory = |
|
2046 iButtonArray[index]->iButtonId; |
|
2047 iCharMap->SetStatusChanged(EAknCharChangedCategory); |
|
2048 } |
|
2049 } |
|
2050 } |
|
2051 } |
|
2052 else if (aPointerEvent.iType == TPointerEvent::EDrag) |
|
2053 { |
|
2054 } |
|
2055 else if (aPointerEvent.iType == TPointerEvent::EButton1Up) |
|
2056 { |
|
2057 } |
|
2058 } |
|
2059 else |
|
2060 { |
|
2061 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
2062 } |
|
2063 } |
|
2064 |
|
2065 TSize CAknSctRadioButton::MinimumSize() |
|
2066 { |
|
2067 TAknLayoutRect oneButtonLayRect; |
|
2068 if (!AknLayoutUtils::PenEnabled()) |
|
2069 { |
|
2070 TAknLayoutScalableParameterLimits charMapDialogVariety = |
|
2071 AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits(); |
|
2072 |
|
2073 // Main pane without softkeys |
|
2074 TRect mainPaneRect; |
|
2075 if(!AknLayoutUtils::LayoutMetricsRect( |
|
2076 AknLayoutUtils::EPopupParent, mainPaneRect)) |
|
2077 { |
|
2078 mainPaneRect = iAvkonAppUi->ClientRect(); |
|
2079 } |
|
2080 |
|
2081 // Calc the variety |
|
2082 TInt maxVariety = charMapDialogVariety.LastVariety(); |
|
2083 |
|
2084 TAknLayoutRect popupGridLayRect; |
|
2085 popupGridLayRect.LayoutRect(mainPaneRect, |
|
2086 AknLayoutScalable_Avkon::popup_grid_graphic_window(maxVariety)); |
|
2087 |
|
2088 // Calculate the size relatively |
|
2089 TRect relativeDialog(TPoint(0,0),popupGridLayRect.Rect().Size()); |
|
2090 |
|
2091 // Get the layout of the actual character grid with scrollbar |
|
2092 TAknLayoutRect gridWithScrollLayRect; |
|
2093 gridWithScrollLayRect.LayoutRect(relativeDialog, |
|
2094 AknLayoutScalable_Avkon::listscroll_popup_graphic_pane()); |
|
2095 |
|
2096 TAknLayoutRect categoryButtonLayRect; |
|
2097 categoryButtonLayRect.LayoutRect(gridWithScrollLayRect.Rect(), |
|
2098 AknLayoutScalable_Avkon::grid_sct_catagory_button_pane()); |
|
2099 |
|
2100 oneButtonLayRect.LayoutRect(categoryButtonLayRect.Rect(), |
|
2101 AknLayoutScalable_Avkon::cell_sct_catagory_button_pane()); |
|
2102 } |
|
2103 else |
|
2104 { |
|
2105 TAknLayoutRect popupGridLayRect; |
|
2106 popupGridLayRect.LayoutRect(iAvkonAppUi->ApplicationRect(), |
|
2107 AknLayoutScalable_Avkon::popup_grid_graphic2_window(0)); |
|
2108 |
|
2109 TAknLayoutRect oneButtonLayRect; |
|
2110 TAknLayoutRect categoryButtonLayRect; |
|
2111 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
2112 { |
|
2113 oneButtonLayRect.LayoutRect(popupGridLayRect.Rect(), |
|
2114 AknLayoutScalable_Avkon::grid_graphic2_control_pane(4)); |
|
2115 |
|
2116 categoryButtonLayRect.LayoutRect(popupGridLayRect.Rect(), |
|
2117 AknLayoutScalable_Avkon::grid_graphic2_catg_pane(0)); |
|
2118 } |
|
2119 else |
|
2120 { |
|
2121 oneButtonLayRect.LayoutRect(popupGridLayRect.Rect(), |
|
2122 AknLayoutScalable_Avkon::grid_graphic2_control_pane(5)); |
|
2123 |
|
2124 categoryButtonLayRect.LayoutRect(popupGridLayRect.Rect(), |
|
2125 AknLayoutScalable_Avkon::grid_graphic2_catg_pane(1)); |
|
2126 |
|
2127 } |
|
2128 } |
|
2129 |
|
2130 TSize size(oneButtonLayRect.Rect().Width(), |
|
2131 oneButtonLayRect.Rect().Height() * iButtonArray.Count()); |
|
2132 return size; |
|
2133 } |
|
2134 |
|
2135 void CAknSctRadioButton::SizeChanged() |
|
2136 { |
|
2137 TRect base; |
|
2138 if (!AknLayoutUtils::PenEnabled()) |
|
2139 { |
|
2140 TAknLayoutScalableParameterLimits charMapDialogVariety = |
|
2141 AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits(); |
|
2142 |
|
2143 // Main pane without softkeys |
|
2144 TRect mainPaneRect; |
|
2145 if(!AknLayoutUtils::LayoutMetricsRect( |
|
2146 AknLayoutUtils::EPopupParent, mainPaneRect)) |
|
2147 { |
|
2148 mainPaneRect = iAvkonAppUi->ClientRect(); |
|
2149 } |
|
2150 |
|
2151 // Calc the variety |
|
2152 TInt maxVariety = charMapDialogVariety.LastVariety(); |
|
2153 |
|
2154 TAknLayoutRect popupGridLayRect; |
|
2155 popupGridLayRect.LayoutRect(mainPaneRect, |
|
2156 AknLayoutScalable_Avkon::popup_grid_graphic_window(maxVariety)); |
|
2157 |
|
2158 // Calculate the size relatively |
|
2159 TRect relativeDialog(TPoint(0,0), popupGridLayRect.Rect().Size()); |
|
2160 |
|
2161 // Get the layout of the actual character grid with scrollbar |
|
2162 TAknLayoutRect gridWithScrollLayRect; |
|
2163 gridWithScrollLayRect.LayoutRect(relativeDialog, |
|
2164 AknLayoutScalable_Avkon::listscroll_popup_graphic_pane()); |
|
2165 |
|
2166 TAknLayoutRect categoryButtonLayRect; |
|
2167 categoryButtonLayRect.LayoutRect(gridWithScrollLayRect.Rect(), |
|
2168 AknLayoutScalable_Avkon::grid_sct_catagory_button_pane()); |
|
2169 |
|
2170 TAknLayoutRect oneButtonLayRect; |
|
2171 oneButtonLayRect.LayoutRect(categoryButtonLayRect.Rect(), |
|
2172 AknLayoutScalable_Avkon::cell_sct_catagory_button_pane()); |
|
2173 |
|
2174 base = oneButtonLayRect.Rect(); |
|
2175 } |
|
2176 else |
|
2177 { |
|
2178 TAknLayoutRect popupGridLayRect; |
|
2179 popupGridLayRect.LayoutRect(iAvkonAppUi->ApplicationRect(), |
|
2180 AknLayoutScalable_Avkon::popup_grid_graphic2_window(0)); |
|
2181 |
|
2182 TAknLayoutRect oneButtonLayRect; |
|
2183 TAknLayoutRect categoryButtonLayRect; |
|
2184 if ( !Layout_Meta_Data::IsLandscapeOrientation() ) |
|
2185 { |
|
2186 oneButtonLayRect.LayoutRect(popupGridLayRect.Rect(), |
|
2187 AknLayoutScalable_Avkon::grid_graphic2_control_pane(4)); |
|
2188 |
|
2189 categoryButtonLayRect.LayoutRect(popupGridLayRect.Rect(), |
|
2190 AknLayoutScalable_Avkon::grid_graphic2_catg_pane(0)); |
|
2191 } |
|
2192 else |
|
2193 { |
|
2194 oneButtonLayRect.LayoutRect(popupGridLayRect.Rect(), |
|
2195 AknLayoutScalable_Avkon::grid_graphic2_control_pane(5)); |
|
2196 |
|
2197 categoryButtonLayRect.LayoutRect(popupGridLayRect.Rect(), |
|
2198 AknLayoutScalable_Avkon::grid_graphic2_catg_pane(1)); |
|
2199 |
|
2200 } |
|
2201 base.iTl = categoryButtonLayRect.Rect().iTl; |
|
2202 base.SetSize(oneButtonLayRect.Rect().Size()); |
|
2203 } |
|
2204 |
|
2205 if (iButtonArray.Count() > 0) |
|
2206 { |
|
2207 CAknButton* buttonCtrlObj; |
|
2208 |
|
2209 TMargins8 margins; |
|
2210 margins.iTop = 1; |
|
2211 margins.iBottom = 0; |
|
2212 margins.iLeft = 0; |
|
2213 margins.iRight = 0; |
|
2214 |
|
2215 // Change the size of buttons |
|
2216 for (TInt index=0; index < iButtonArray.Count(); index++) |
|
2217 { |
|
2218 buttonCtrlObj = iButtonArray[index]->iButtonControl; |
|
2219 if (buttonCtrlObj) |
|
2220 { |
|
2221 if (AknLayoutUtils::PenEnabled()) |
|
2222 { |
|
2223 buttonCtrlObj->SetHighlightRect(base); |
|
2224 } |
|
2225 buttonCtrlObj->SetRect( base ); |
|
2226 buttonCtrlObj->SetIconSize( base.Size() ); |
|
2227 buttonCtrlObj->SetMargins( margins ); |
|
2228 buttonCtrlObj->SetIconScaleMode(EAspectRatioPreserved); |
|
2229 base.Move(TPoint(0, base.Size().iHeight)); |
|
2230 } |
|
2231 } |
|
2232 } |
|
2233 } |
|
2234 |
|
2235 void CAknSctRadioButton::Draw(const TRect& /*aRect*/) const |
|
2236 { |
|
2237 // no draw |
|
2238 } |
|
2239 |
|
2240 /** |
|
2241 * Returns ETrue if the aFlag bitfield in iFlags is set, EFalse if it |
|
2242 * is clear |
|
2243 */ |
|
2244 inline TInt CAknSctRadioButton::Count() const |
|
2245 { |
|
2246 return iButtonArray.Count(); |
|
2247 } |
|
2248 |
|
2249 void CAknSctRadioButton::SetCurrentCategory(TInt aCategory) |
|
2250 { |
|
2251 CAknSctCategoryButton* buttonObj; |
|
2252 TInt status; |
|
2253 |
|
2254 for (TInt index=0; index < iButtonArray.Count(); index++) |
|
2255 { |
|
2256 buttonObj = iButtonArray[index]; |
|
2257 status = (buttonObj->iButtonId == aCategory)? |
|
2258 KAknSctRadioOn : KAknSctRadioOff; |
|
2259 buttonObj->iButtonControl->SetCurrentState(status, ETrue); |
|
2260 } |
|
2261 } |
|
2262 |
|
2263 void CAknSctRadioButton::SetValidSctCase(TInt aSctCase) |
|
2264 { |
|
2265 CAknSctCategoryButton* buttonObj; |
|
2266 |
|
2267 for (TInt index=0; index < iButtonArray.Count(); index++) |
|
2268 { |
|
2269 buttonObj = iButtonArray[index]; |
|
2270 if (buttonObj->iSctCaseId == aSctCase) |
|
2271 { |
|
2272 buttonObj->iValid = ETrue; |
|
2273 break; |
|
2274 } |
|
2275 // Here is the special case for Half-width/Lower/Upper |
|
2276 else if (buttonObj->iSctCaseId == EAknSCTHalfCase |
|
2277 && (aSctCase == EAknSCTLowerCase |
|
2278 || aSctCase == EAknSCTUpperCase) |
|
2279 ) |
|
2280 { |
|
2281 buttonObj->iValid = ETrue; |
|
2282 break; |
|
2283 } |
|
2284 } |
|
2285 } |
|
2286 |
|
2287 void CAknSctRadioButton::RemoveInvalidButton() |
|
2288 { |
|
2289 CAknSctCategoryButton* buttonObj; |
|
2290 |
|
2291 for (TInt index=iButtonArray.Count()-1; index >= 0; index--) |
|
2292 { |
|
2293 buttonObj = iButtonArray[index]; |
|
2294 if (!buttonObj->iValid) |
|
2295 { |
|
2296 if (buttonObj->iSctCaseId == EAknSCTHalfCase) |
|
2297 { |
|
2298 if (iButtonArray.Count() > 1) |
|
2299 { |
|
2300 delete buttonObj; |
|
2301 iButtonArray.Remove(index); |
|
2302 } |
|
2303 } |
|
2304 else |
|
2305 { |
|
2306 delete buttonObj; |
|
2307 iButtonArray.Remove(index); |
|
2308 } |
|
2309 } |
|
2310 } |
|
2311 } |
|
2312 |
|
2313 CCoeControl* CAknSctRadioButton::FocusedControl() |
|
2314 { |
|
2315 return this; |
|
2316 } |
|
2317 |
|
2318 TBool CAknSctRadioButton::EnterControl(TInt /*aX*/, TInt aY) |
|
2319 { |
|
2320 if (IsVisible()) |
|
2321 { |
|
2322 if ((aY >= 0) && (aY < Count())) |
|
2323 { |
|
2324 if (iExtension->iHasCategoryButtonUi) |
|
2325 { |
|
2326 iEntryIndex = aY; |
|
2327 iExtension->iFocusHandler = this; |
|
2328 if (AknLayoutUtils::PenEnabled()) |
|
2329 { |
|
2330 iButtonIndex = aY; |
|
2331 CAknSctCategoryButton* buttonObj = |
|
2332 iButtonArray[iButtonIndex]; |
|
2333 buttonObj->SetFocused(ETrue); |
|
2334 } |
|
2335 return ETrue; |
|
2336 } |
|
2337 } |
|
2338 } |
|
2339 return EFalse; |
|
2340 } |
|
2341 |
|
2342 void CAknSctRadioButton::MoveFocus(TInt /*aX*/, TInt aY) |
|
2343 { |
|
2344 CAknSctCategoryButton* buttonObj; |
|
2345 CAknButton* buttonCtrlObj; |
|
2346 TInt buttonIndex = iButtonIndex + aY; |
|
2347 if (buttonIndex > iButtonArray.Count() - 1) |
|
2348 { |
|
2349 if (!AknLayoutUtils::PenEnabled()) |
|
2350 { |
|
2351 // First radio button. |
|
2352 buttonIndex = 0; |
|
2353 } |
|
2354 else |
|
2355 { |
|
2356 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
|
2357 { |
|
2358 // Left page button. |
|
2359 if (iExtension->iPageNavi && |
|
2360 iExtension->iPageNavi->EnterControl(0,0)) |
|
2361 { |
|
2362 LeaveControl(); |
|
2363 return; |
|
2364 } |
|
2365 } |
|
2366 else |
|
2367 { |
|
2368 // First table button. |
|
2369 if (iExtension->iTableNavi && |
|
2370 iExtension->iTableNavi->EnterControl(0,0)) |
|
2371 { |
|
2372 LeaveControl(); |
|
2373 return; |
|
2374 } |
|
2375 } |
|
2376 } |
|
2377 } |
|
2378 else if (buttonIndex < 0) |
|
2379 { |
|
2380 if (!AknLayoutUtils::PenEnabled()) |
|
2381 { |
|
2382 // Last radio button. |
|
2383 buttonIndex = iButtonArray.Count() - 1; |
|
2384 } |
|
2385 else |
|
2386 { |
|
2387 // First table button. |
|
2388 if (iExtension->iTableNavi && |
|
2389 iExtension->iTableNavi->EnterControl(0,0)) |
|
2390 { |
|
2391 LeaveControl(); |
|
2392 return; |
|
2393 } |
|
2394 } |
|
2395 } |
|
2396 |
|
2397 if (!AknLayoutUtils::PenEnabled()) |
|
2398 { |
|
2399 buttonObj = iButtonArray[iButtonIndex]; |
|
2400 buttonCtrlObj = buttonObj->iButtonControl; |
|
2401 buttonCtrlObj->SetCurrentState(KAknSctRadioOff, ETrue); |
|
2402 iButtonIndex = buttonIndex; |
|
2403 buttonObj = iButtonArray[iButtonIndex]; |
|
2404 buttonCtrlObj = buttonObj->iButtonControl; |
|
2405 buttonCtrlObj->SetCurrentState(KAknSctRadioOn, ETrue); |
|
2406 iExtension->iCurrentCategory = |
|
2407 iButtonArray[buttonIndex]->iButtonId; |
|
2408 iCharMap->SetStatusChanged(EAknCharChangedCategory); |
|
2409 } |
|
2410 else |
|
2411 { |
|
2412 buttonObj = iButtonArray[iButtonIndex]; |
|
2413 buttonObj->SetFocused(EFalse); |
|
2414 iButtonIndex = buttonIndex; |
|
2415 buttonObj = iButtonArray[iButtonIndex]; |
|
2416 buttonObj->SetFocused(ETrue); |
|
2417 } |
|
2418 } |
|
2419 |
|
2420 TBool CAknSctRadioButton::LeaveControl() |
|
2421 { |
|
2422 for (TInt i = 0; i < iButtonArray.Count(); i++ ) |
|
2423 { |
|
2424 iButtonArray[i]->SetFocused(EFalse); |
|
2425 } |
|
2426 return ETrue; |
|
2427 } |
|
2428 |
|
2429 TBool CAknSctRadioButton::ExitWithKey(TInt /*aKeycode*/) |
|
2430 { |
|
2431 return EFalse; |
|
2432 } |
|
2433 |
|
2434 // ---------------------------------------------------------------------------- |
|
2435 // Extension class implementation |
1359 // Extension class implementation |
2436 // ---------------------------------------------------------------------------- |
1360 // ---------------------------------------------------------------------------- |
2437 // |
1361 // |
2438 CAknCharMapExtension::CAknCharMapExtension() : iSingleClickEnabled( iAvkonAppUi->IsSingleClickCompatible() ) |
1362 CAknCharMapExtension::CAknCharMapExtension() : iSingleClickEnabled( iAvkonAppUi->IsSingleClickCompatible() ) |
2439 { |
1363 { |
3467 switch (code) |
2362 switch (code) |
3468 { |
2363 { |
3469 case EKeyLeftArrow: |
2364 case EKeyLeftArrow: |
3470 case '4': |
2365 case '4': |
3471 { |
2366 { |
3472 if (iExtension->iRadioButton && (iCursorPos.iX == 0)) // Radio button. |
|
3473 { |
|
3474 if (iExtension->iRadioButton->EnterControl(iCursorPos.iX,iCursorPos.iY)) |
|
3475 { |
|
3476 LeaveControl(); |
|
3477 break; |
|
3478 } |
|
3479 } |
|
3480 |
|
3481 if (AknLayoutUtils::PenEnabled()) |
2367 if (AknLayoutUtils::PenEnabled()) |
3482 { |
2368 { |
3483 if (!iIsMirrored) |
2369 if (!iIsMirrored) |
3484 { |
2370 { |
3485 if ((iCursorPos.iX == 0) && (iCursorPos.iY == ColMin(0))) |
2371 if ((iCursorPos.iX == 0) && (iCursorPos.iY == ColMin(0))) |
3486 { |
2372 { |
3487 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
2373 // western, move left from first one in grid, focus pageNavi last button |
|
2374 if ( iExtension->iPageNavi ) |
3488 { |
2375 { |
3489 // Last table button. |
2376 TInt maxButt = iExtension->iPageNavi->LastButton(); |
3490 if (iExtension->iTableNavi && |
2377 if ( iExtension->iPageNavi->EnterControl( maxButt,0 ) ) |
3491 iExtension->iTableNavi->EnterControl(TableCount() - 1,0)) |
2378 { |
3492 { |
|
3493 LeaveControl(); |
2379 LeaveControl(); |
3494 break; |
2380 break; |
3495 } |
2381 } |
3496 } |
|
3497 else |
|
3498 { |
|
3499 // Right page button. |
|
3500 if (iExtension->iPageNavi && |
|
3501 iExtension->iPageNavi->EnterControl(1,0)) |
|
3502 { |
|
3503 LeaveControl(); |
|
3504 break; |
|
3505 } |
|
3506 } |
2382 } |
3507 } |
2383 } |
3508 } |
2384 } |
3509 else |
2385 else |
3510 { |
2386 { |
3511 if (((iCursorPos.iY == ColMax(0)) && (iCursorPos.iX == RowMax(ColMax(0))))) |
2387 if (((iCursorPos.iY == ColMax(0)) && (iCursorPos.iX == RowMax(ColMax(0))))) |
3512 { |
2388 { |
3513 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
2389 // mirrored, move left from last one in grid, focus pgNavi first button |
|
2390 if (iExtension->iPageNavi && |
|
2391 iExtension->iPageNavi->EnterControl(0,0)) |
3514 { |
2392 { |
3515 // Left page button. |
2393 LeaveControl(); |
3516 if (iExtension->iPageNavi && |
2394 break; |
3517 iExtension->iPageNavi->EnterControl(0,0)) |
|
3518 { |
|
3519 LeaveControl(); |
|
3520 break; |
|
3521 } |
|
3522 } |
|
3523 else |
|
3524 { |
|
3525 // First table button. |
|
3526 if (iExtension->iTableNavi && |
|
3527 iExtension->iTableNavi->EnterControl(0,0)) |
|
3528 { |
|
3529 LeaveControl(); |
|
3530 break; |
|
3531 } |
|
3532 } |
2395 } |
3533 } |
2396 } |
3534 } |
2397 } |
3535 } |
2398 } |
3536 MoveFocus(-1,0); |
2399 MoveFocus(-1,0); |
3537 break; |
2400 break; |
3538 } |
2401 } |
3539 case EKeyRightArrow: |
2402 case EKeyRightArrow: |
3540 case '6': |
2403 case '6': |
3541 { |
2404 { |
3542 if (iExtension->iRadioButton && |
|
3543 (iCursorPos.iX == RowMax(iCursorPos.iY)) && |
|
3544 (iCursorPos.iY <= (iExtension->iRadioButton->Count() - 2))) |
|
3545 { |
|
3546 // Radio button. |
|
3547 if (iExtension->iRadioButton->EnterControl(iCursorPos.iX,iCursorPos.iY+1)) |
|
3548 { |
|
3549 LeaveControl(); |
|
3550 break; |
|
3551 } |
|
3552 } |
|
3553 if (AknLayoutUtils::PenEnabled()) |
2405 if (AknLayoutUtils::PenEnabled()) |
3554 { |
2406 { |
3555 if (!iIsMirrored) |
2407 if (!iIsMirrored) |
3556 { |
2408 { |
3557 if ((iCursorPos.iY == ColMax(0)) && |
2409 if ((iCursorPos.iY == ColMax(0)) && |
3558 (iCursorPos.iX == RowMax(ColMax(0)))) |
2410 (iCursorPos.iX == RowMax(ColMax(0)))) |
3559 { |
2411 { |
3560 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
2412 // western, move right from last one in grid, focus pgNavi first button |
|
2413 if (iExtension->iPageNavi && |
|
2414 iExtension->iPageNavi->EnterControl(0,0)) |
3561 { |
2415 { |
3562 // Left page button. |
2416 LeaveControl(); |
3563 if (iExtension->iPageNavi && |
2417 break; |
3564 iExtension->iPageNavi->EnterControl(0,0)) |
|
3565 { |
|
3566 LeaveControl(); |
|
3567 break; |
|
3568 } |
|
3569 } |
|
3570 else |
|
3571 { |
|
3572 // First table button. |
|
3573 if (iExtension->iTableNavi && |
|
3574 iExtension->iTableNavi->EnterControl(0,0)) |
|
3575 { |
|
3576 LeaveControl(); |
|
3577 break; |
|
3578 } |
|
3579 } |
2418 } |
3580 } |
2419 } |
3581 } |
2420 } |
3582 else |
2421 else |
3583 { |
2422 { |
3584 if ((iCursorPos.iY == ColMin(0)) && |
2423 if ((iCursorPos.iY == ColMin(0)) && |
3585 (iCursorPos.iX == 0)) |
2424 (iCursorPos.iX == 0)) |
3586 { |
2425 { |
3587 if (!Layout_Meta_Data::IsLandscapeOrientation()) |
2426 // mirrored, move right from first one in grid, focus pgNavi last button |
|
2427 if ( iExtension->iPageNavi ) |
3588 { |
2428 { |
3589 // First table button. |
2429 TInt maxButt = iExtension->iPageNavi->LastButton(); |
3590 if (iExtension->iTableNavi && |
2430 if ( iExtension->iPageNavi->EnterControl( maxButt,0 ) ) |
3591 iExtension->iTableNavi->EnterControl(0,0)) |
|
3592 { |
|
3593 LeaveControl(); |
|
3594 break; |
|
3595 } |
|
3596 |
|
3597 } |
|
3598 else |
|
3599 { |
|
3600 // Left page button. |
|
3601 if (iExtension->iPageNavi && |
|
3602 iExtension->iPageNavi->EnterControl(1,0)) |
|
3603 { |
2431 { |
3604 LeaveControl(); |
2432 LeaveControl(); |
3605 break; |
2433 break; |
3606 } |
2434 } |
3607 } |
2435 } |
3614 case EKeyUpArrow: |
2442 case EKeyUpArrow: |
3615 case '2': |
2443 case '2': |
3616 { |
2444 { |
3617 if (AknLayoutUtils::PenEnabled()) |
2445 if (AknLayoutUtils::PenEnabled()) |
3618 { |
2446 { |
3619 if (iCursorPos.iY == ColMin(iCursorPos.iX)) |
2447 if ( iCursorPos.iY == ColMin(iCursorPos.iX) ) |
3620 { |
2448 { |
3621 if (!iExtension->iRadioButton && iCursorPos.iX < TableCount()) |
2449 // cell is at the top row, need to go on to PageNavi |
|
2450 if ( iExtension->iPageNavi ) |
3622 { |
2451 { |
3623 // Table button up. |
2452 TInt aX = 0; |
3624 if ( iExtension->iTableNavi && |
2453 |
3625 iExtension->iTableNavi->EnterControl(iCursorPos.iX,0)) |
2454 if ( iCursorPos.iX == MaxCols() - 1 ) |
|
2455 { |
|
2456 aX = iExtension->iPageNavi->LastButton(); |
|
2457 } |
|
2458 else if ( iCursorPos.iX == MaxCols() - 2 ) |
|
2459 { |
|
2460 // a bit complex as unable-emotion SCT has no SC/Emotion icon |
|
2461 if ( iExtension->IsEmotionEnabled() ) |
|
2462 { |
|
2463 aX = iIsMirrored? 1 : 2; |
|
2464 } |
|
2465 else |
|
2466 { |
|
2467 aX = -1; |
|
2468 } |
|
2469 } |
|
2470 else if (iCursorPos.iX == 1 ) |
|
2471 { |
|
2472 aX = iIsMirrored? 2 : 1; |
|
2473 } |
|
2474 else if ( iCursorPos.iX == 0 ) |
|
2475 { |
|
2476 // first button in PageNavi |
|
2477 aX = 0; |
|
2478 } |
|
2479 else |
|
2480 { |
|
2481 aX = -1; |
|
2482 } |
|
2483 if ( iExtension->iPageNavi->EnterControl( aX,0 ) ) |
3626 { |
2484 { |
3627 LeaveControl(); |
2485 LeaveControl(); |
3628 break; |
2486 break; |
3629 } |
2487 } |
3630 } |
2488 } |
3631 else |
2489 EnterControl(iCursorPos.iX, ColMax( iCursorPos.iX)); |
3632 { |
2490 break; |
3633 if (iCursorPos.iX == MaxCols() - 1) |
2491 } |
|
2492 } |
|
2493 MoveFocus(0,-1); |
|
2494 break; |
|
2495 } |
|
2496 case EKeyDownArrow: |
|
2497 case '8': |
|
2498 { |
|
2499 if (AknLayoutUtils::PenEnabled()) |
|
2500 { |
|
2501 if (iCursorPos.iY == ColMax(iCursorPos.iX)) |
|
2502 { |
|
2503 if ( iExtension->iPageNavi ) |
|
2504 { |
|
2505 TInt aX = 0; |
|
2506 |
|
2507 if ( iCursorPos.iX == MaxCols() - 1 ) |
3634 { |
2508 { |
3635 // Right page button. |
2509 aX = iExtension->iPageNavi->LastButton(); |
3636 if ( iExtension->iPageNavi && |
2510 } |
3637 iExtension->iPageNavi->EnterControl(1,0)) |
2511 else if ( iCursorPos.iX == MaxCols() - 2 ) |
|
2512 { |
|
2513 // a bit complex as unable-emotion SCT has no SC/Emotion icon |
|
2514 if ( iExtension->IsEmotionEnabled() ) |
3638 { |
2515 { |
3639 LeaveControl(); |
2516 aX = iIsMirrored? 1 : 2; |
3640 break; |
2517 } |
|
2518 else |
|
2519 { |
|
2520 aX = -1; |
3641 } |
2521 } |
3642 } |
2522 } |
3643 if (Layout_Meta_Data::IsLandscapeOrientation()) |
2523 else if ( iCursorPos.iX == 1 ) |
3644 { |
2524 { |
3645 if ((!iExtension->iRadioButton && |
2525 aX = iIsMirrored? 2 : 1; |
3646 (iCursorPos.iX == TableCount())) || |
|
3647 ((iExtension->iRadioButton) && |
|
3648 (iCursorPos.iX == MaxCols()-2))) |
|
3649 { |
|
3650 // Left page button. |
|
3651 if ( iExtension->iPageNavi && |
|
3652 iExtension->iPageNavi->EnterControl(0,0)) |
|
3653 { |
|
3654 LeaveControl(); |
|
3655 break; |
|
3656 } |
|
3657 } |
|
3658 } |
2526 } |
3659 // Grid bottom row. |
2527 else if ( iCursorPos.iX == 0 ) |
3660 if (ColMax(0) > ColMax(iCursorPos.iX)) |
|
3661 { |
2528 { |
3662 EnterControl(RowMax(ColMax(0)), ColMax(0)); |
2529 // default: first button in PageNavi |
|
2530 aX = 0; |
|
2531 } |
|
2532 else |
|
2533 { |
|
2534 aX = -1; |
|
2535 } |
|
2536 if ( iExtension->iPageNavi->EnterControl( aX,0 ) ) |
|
2537 { |
|
2538 LeaveControl(); |
3663 break; |
2539 break; |
3664 } |
2540 } |
3665 EnterControl(iCursorPos.iX, ColMax( iCursorPos.iX)); |
2541 } |
3666 break; |
2542 // cell is at bottom row |
3667 } |
|
3668 } |
|
3669 } |
|
3670 MoveFocus(0,-1); |
|
3671 break; |
|
3672 } |
|
3673 case EKeyDownArrow: |
|
3674 case '8': |
|
3675 { |
|
3676 if (AknLayoutUtils::PenEnabled()) |
|
3677 { |
|
3678 if (iCursorPos.iY == ColMax(iCursorPos.iX)) |
|
3679 { |
|
3680 if (iCursorPos.iX > RowMax(ColMax(0))) |
2543 if (iCursorPos.iX > RowMax(ColMax(0))) |
3681 { |
2544 { |
3682 // Grid last item. |
2545 // Grid last item. |
3683 EnterControl(RowMax(ColMax(0)), ColMax(0)); |
2546 EnterControl(RowMax(ColMax(0)), ColMax(0)); |
3684 break; |
2547 break; |
3685 } |
|
3686 if ((iCursorPos.iX == MaxCols() - 1) || |
|
3687 (!Layout_Meta_Data::IsLandscapeOrientation() && |
|
3688 iExtension->iRadioButton && |
|
3689 (iCursorPos.iX == MaxCols() - 2))) |
|
3690 { |
|
3691 // Right page button. |
|
3692 if (iExtension->iPageNavi && |
|
3693 iExtension->iPageNavi->EnterControl(1,0)) |
|
3694 { |
|
3695 LeaveControl(); |
|
3696 break; |
|
3697 } |
|
3698 } |
|
3699 if ((Layout_Meta_Data::IsLandscapeOrientation() && |
|
3700 !iExtension->iRadioButton && |
|
3701 (iCursorPos.iX == TableCount())) || |
|
3702 (!Layout_Meta_Data::IsLandscapeOrientation() && |
|
3703 (iCursorPos.iX == 0)) || |
|
3704 (Layout_Meta_Data::IsLandscapeOrientation() && |
|
3705 iExtension->iRadioButton && |
|
3706 (iCursorPos.iX == MaxCols() - 2))) |
|
3707 { |
|
3708 // Left page button. |
|
3709 if (iExtension->iPageNavi && |
|
3710 iExtension->iPageNavi->EnterControl(0,0)) |
|
3711 { |
|
3712 LeaveControl(); |
|
3713 break; |
|
3714 } |
|
3715 } |
|
3716 if (!iExtension->iRadioButton && |
|
3717 iCursorPos.iX < TableCount()) |
|
3718 { |
|
3719 // Table button down. |
|
3720 if (iExtension->iTableNavi && |
|
3721 iExtension->iTableNavi->EnterControl(iCursorPos.iX,0)) |
|
3722 { |
|
3723 LeaveControl(); |
|
3724 break; |
|
3725 } |
|
3726 } |
2548 } |
3727 // Grid top row. |
2549 // Grid top row. |
3728 EnterControl(iCursorPos.iX, ColMin(iCursorPos.iX)); |
2550 EnterControl(iCursorPos.iX, ColMin(iCursorPos.iX)); |
3729 break; |
2551 break; |
3730 } |
2552 } |
4345 varietyNumber -= 1; |
3026 varietyNumber -= 1; |
4346 } |
3027 } |
4347 varietyNumber += maxVarietyOffset; |
3028 varietyNumber += maxVarietyOffset; |
4348 |
3029 |
4349 TAknLayoutRect popupGridLayRect; |
3030 TAknLayoutRect popupGridLayRect; |
4350 popupGridLayRect.LayoutRect(mainPaneRect, |
3031 popupGridLayRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::popup_grid_graphic_window(varietyNumber)); |
4351 AknLayoutScalable_Avkon::popup_grid_graphic_window(varietyNumber)); |
|
4352 |
3032 |
4353 // Background height. |
3033 // Background height. |
4354 TInt backgroundHeightOffset = |
3034 TInt backgroundHeightOffset = popupGridLayRect.Rect().Height() - rect.iBr.iY; |
4355 popupGridLayRect.Rect().Height() - rect.iBr.iY; |
|
4356 |
|
4357 rect.iBr.iY += backgroundHeightOffset; |
3035 rect.iBr.iY += backgroundHeightOffset; |
4358 } |
3036 } |
4359 else |
3037 else |
4360 { |
3038 { |
4361 TAknLayoutRect popupGridLayRect; |
3039 TAknLayoutRect popupGridLayRect; |
4362 popupGridLayRect.LayoutRect(iAvkonAppUi->ApplicationRect(), |
3040 popupGridLayRect.LayoutRect(iAvkonAppUi->ApplicationRect(), AknLayoutScalable_Avkon::popup_grid_graphic2_window(0)); |
4363 AknLayoutScalable_Avkon::popup_grid_graphic2_window(0)); |
|
4364 |
3041 |
4365 // Background height. |
3042 // Background height. |
4366 TInt backgroundHeightOffset = |
3043 TInt backgroundHeightOffset = popupGridLayRect.Rect().Height() - rect.iBr.iY; |
4367 popupGridLayRect.Rect().Height() - rect.iBr.iY; |
|
4368 |
|
4369 rect.iBr.iY += backgroundHeightOffset * 2; |
3044 rect.iBr.iY += backgroundHeightOffset * 2; |
4370 } |
3045 } |
4371 |
3046 |
4372 // Grid (main). |
3047 // Grid (main). |
4373 if ( !Extension()->iMenuSct ) |
3048 if ( !Extension()->iMenuSct ) |
4374 { |
3049 { |
4375 // 1) Draw the background |
3050 // 1) Draw the background |
4376 |
|
4377 // Check if we got an offscreen bitmap allocated for skin background and |
3051 // Check if we got an offscreen bitmap allocated for skin background and |
4378 // there is bitmap background in the current skin. |
3052 // there is bitmap background in the current skin. |
4379 if( CAknEnv::Static()->TransparencyEnabled() ) |
3053 if( CAknEnv::Static()->TransparencyEnabled() ) |
4380 { |
3054 { |
4381 TRegionFix<10> clipReg; |
3055 TRegionFix<10> clipReg; |
4382 clipReg.AddRect(rect); |
3056 clipReg.AddRect(rect); |
|
3057 |
4383 if ( iFirstVisibleRow == 0 && iSetRecentSct ) |
3058 if ( iFirstVisibleRow == 0 && iSetRecentSct ) |
4384 { |
3059 { |
4385 TPoint pos = iGridTopLeft; |
3060 TPoint pos = iGridTopLeft; |
4386 TInt endX = pos.iX + iGridItemWidth * iMaxColumns + 1; |
3061 TSize size(iGridItemWidth*iMaxColumns+1, iGridItemHeight); |
4387 TInt endY = pos.iY + iGridItemHeight; |
3062 if(iIsMirrored) |
|
3063 { |
|
3064 pos.iX += iGridItemWidth - size.iWidth; |
|
3065 } |
4388 // eliminate the overlap area between menu sct and the first menu item. |
3066 // eliminate the overlap area between menu sct and the first menu item. |
4389 if ( Extension()->iMenuSct ) |
3067 if ( Extension()->iMenuSct ) |
4390 { |
3068 { |
4391 endY--; |
3069 size.iHeight--; |
4392 } |
3070 } |
4393 clipReg.SubRect( TRect( pos, TPoint( endX, endY ) ) ); |
3071 clipReg.SubRect(TRect(pos,size)); |
4394 } |
3072 } |
|
3073 |
4395 // Take scroll bar out of clip region |
3074 // Take scroll bar out of clip region |
4396 if (iSBFrame) |
3075 if (iSBFrame) |
4397 { |
3076 { |
4398 clipReg.SubRect(iSBFrame->GetScrollBarHandle( |
3077 clipReg.SubRect(iSBFrame->GetScrollBarHandle(CEikScrollBar::EVertical)->Rect()); |
4399 CEikScrollBar::EVertical)->Rect()); |
|
4400 } |
3078 } |
|
3079 |
4401 gc.SetClippingRegion(clipReg); |
3080 gc.SetClippingRegion(clipReg); |
4402 } |
3081 } |
|
3082 |
4403 AknsDrawUtils::Background( skin, cc, this, gc, rect,KAknsDrawParamNoClearUnderImage); |
3083 AknsDrawUtils::Background( skin, cc, this, gc, rect,KAknsDrawParamNoClearUnderImage); |
|
3084 |
4404 if( CAknEnv::Static()->TransparencyEnabled() ) |
3085 if( CAknEnv::Static()->TransparencyEnabled() ) |
4405 { |
3086 { |
4406 gc.CancelClippingRegion(); |
3087 gc.CancelClippingRegion(); |
4407 } |
3088 } |
4408 |
3089 |
4409 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
3090 // 2) Draw the grid |
|
3091 gc.SetPenStyle(CGraphicsContext::ESolidPen); |
4410 gc.SetBrushStyle(CGraphicsContext::ENullBrush); |
3092 gc.SetBrushStyle(CGraphicsContext::ENullBrush); |
4411 gc.SetPenSize(TSize(1,1)); |
3093 gc.SetPenSize(TSize(1,1)); |
4412 |
|
4413 // 2) Draw the grid |
|
4414 DrawGrid(gc); |
3094 DrawGrid(gc); |
4415 } |
3095 } |
4416 |
3096 |
4417 // Grid (recent). |
3097 // Grid (recent). |
4418 if (iFirstVisibleRow==0 && iSetRecentSct) |
3098 if (iFirstVisibleRow==0 && iSetRecentSct) |