214 { |
214 { |
215 return; |
215 return; |
216 } |
216 } |
217 |
217 |
218 //in case skin or resolution has changed |
218 //in case skin or resolution has changed |
219 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
220 TBool highlighted = EFalse; |
|
221 if (iItem) |
|
222 { |
|
223 highlighted = iItem->IsHighlighted(); |
|
224 } |
|
225 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
226 |
|
227 iModel->ReConstructSelectionIconsL(); |
219 iModel->ReConstructSelectionIconsL(); |
228 |
|
229 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
230 iModel->UpdateIconArrayL(highlighted); |
|
231 #else |
|
232 iModel->UpdateIconArrayL(); |
220 iModel->UpdateIconArrayL(); |
233 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
234 |
221 |
235 iListBox = CreateListBoxL(aParent); |
222 iListBox = CreateListBoxL(aParent); |
236 |
223 |
237 // Disable transition effects for iListBox, this is needed to get |
224 // Disable transition effects for iListBox, this is needed to get |
238 // rid of artifacts caused by transition effects when list box controls |
225 // rid of artifacts caused by transition effects when list box controls |
640 } |
627 } |
641 } |
628 } |
642 } |
629 } |
643 } |
630 } |
644 |
631 |
645 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
646 TBool CMIDChoiceGroupControl::IsControlOnFormHighlighted() |
|
647 { |
|
648 if (iItem) |
|
649 { |
|
650 return iItem->IsHighlighted(); |
|
651 } |
|
652 else |
|
653 { |
|
654 return EFalse; |
|
655 } |
|
656 } |
|
657 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
658 |
632 |
659 // --- from MEikListBoxObserver --- |
633 // --- from MEikListBoxObserver --- |
660 // Handles choice listbox events (as in selection) |
634 // Handles choice listbox events (as in selection) |
661 void CMIDChoiceGroupControl::HandleListBoxEventL(CEikListBox* aControl, TListBoxEvent aEventType) |
635 void CMIDChoiceGroupControl::HandleListBoxEventL(CEikListBox* aControl, TListBoxEvent aEventType) |
662 { |
636 { |
712 // Not a popup then, handle some keys in clever ways |
686 // Not a popup then, handle some keys in clever ways |
713 |
687 |
714 // Save the currently selected item (if exclusive choice) |
688 // Save the currently selected item (if exclusive choice) |
715 TInt oldSelected = iModel->SelectedElement(); |
689 TInt oldSelected = iModel->SelectedElement(); |
716 TInt oldCurrentIndex = -1; |
690 TInt oldCurrentIndex = -1; |
717 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
718 TBool wasHighlighted = EFalse; |
|
719 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
720 |
691 |
721 if (iListBox) |
692 if (iListBox) |
722 { |
693 { |
723 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
724 wasHighlighted = iListBox->GetHighlight(); |
|
725 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
726 |
|
727 oldCurrentIndex = iListBox->View()->CurrentItemIndex(); |
694 oldCurrentIndex = iListBox->View()->CurrentItemIndex(); |
728 // Let the listbox take a shot at the key |
695 // Let the listbox take a shot at the key |
729 resp = iListBox->OfferKeyEventL(aKeyEvent, aType); |
696 resp = iListBox->OfferKeyEventL(aKeyEvent, aType); |
730 |
|
731 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
732 wasHighlighted = (iListBox->GetHighlight() && !wasHighlighted) ? EFalse : ETrue; |
|
733 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
734 } |
697 } |
735 |
698 |
736 // If click (enter) on an already selected item in an exclusive choice, |
699 // If click (enter) on an already selected item in an exclusive choice, |
737 // do not consume the key. This allows the form to display a context menu. |
700 // do not consume the key. This allows the form to display a context menu |
738 // Choicegroup element need to be focused and selected |
|
739 if ((iType == MMIDChoiceGroup::EExclusive) && |
701 if ((iType == MMIDChoiceGroup::EExclusive) && |
740 ((aKeyEvent.iCode == EKeyOK) || (aKeyEvent.iCode == EKeyEnter)) && |
702 ((aKeyEvent.iCode == EKeyOK) || (aKeyEvent.iCode == EKeyEnter)) && |
741 ((oldSelected != -1) || (oldSelected == -1 && oldCurrentIndex == -1)) && |
703 ((oldSelected != -1) || (oldSelected == -1 && oldCurrentIndex == -1)) && |
742 (oldSelected == iModel->SelectedElement()) |
704 (oldSelected == iModel->SelectedElement())) |
743 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
744 && (wasHighlighted && iListBox->GetHighlight()) |
|
745 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
746 ) |
|
747 { |
705 { |
748 // Do not consume the key, so that form can pop a menu |
706 // Do not consume the key, so that form can pop a menu |
749 CMIDDisplayable& displayable = iItem->Form()->CurrentDisplayable(); |
707 CMIDDisplayable& displayable = iItem->Form()->CurrentDisplayable(); |
750 TInt cntOpt = displayable.NumCommandsForOkOptionsMenu(); |
708 TInt cntOpt = displayable.NumCommandsForOkOptionsMenu(); |
751 |
709 |
763 |
721 |
764 resp = EKeyWasConsumed; |
722 resp = EKeyWasConsumed; |
765 } |
723 } |
766 else |
724 else |
767 { |
725 { |
768 TInt numScreenOrHelpCommands = displayable.NumCommandsForScreenOrHelpOptionsMenu(); |
|
769 |
|
770 // if ( cntOpt > 1 ) will run menu, else execute ProcessCommandL( CommandOffset ) |
726 // if ( cntOpt > 1 ) will run menu, else execute ProcessCommandL( CommandOffset ) |
771 if (cntOpt > 1) |
727 if (cntOpt > 1) |
772 { |
728 { |
773 displayable.MenuHandler()->ShowMenuL(CMIDMenuHandler::EOkMenu); |
729 displayable.MenuHandler()->ShowMenuL(CMIDMenuHandler::EOkMenu); |
774 resp = EKeyWasConsumed; |
|
775 } |
|
776 else if (cntOpt == 0 && numScreenOrHelpCommands > 1) |
|
777 { |
|
778 // If there is more than one screen command on form |
|
779 // and there is no ok/item commands then show menu |
|
780 displayable.MenuHandler()->ShowMenuL(CMIDMenuHandler::EOptionsMenu); |
|
781 resp = EKeyWasConsumed; |
730 resp = EKeyWasConsumed; |
782 } |
731 } |
783 else if (command && command->CommandType() != MMIDCommand::EBack && |
732 else if (command && command->CommandType() != MMIDCommand::EBack && |
784 command->CommandType() != MMIDCommand::ECancel) |
733 command->CommandType() != MMIDCommand::ECancel) |
785 { |
734 { |
1416 // pop goes the weasel |
1365 // pop goes the weasel |
1417 void CMIDChoiceGroupControl::DoPopupL() |
1366 void CMIDChoiceGroupControl::DoPopupL() |
1418 { |
1367 { |
1419 //in case skin or resolution has changed |
1368 //in case skin or resolution has changed |
1420 iModel->ReConstructSelectionIconsL(); |
1369 iModel->ReConstructSelectionIconsL(); |
1421 |
|
1422 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
1423 iModel->UpdateIconArrayL(EFalse); |
|
1424 #else |
|
1425 iModel->UpdateIconArrayL(); |
1370 iModel->UpdateIconArrayL(); |
1426 #endif |
|
1427 |
1371 |
1428 // In order for the listbox to have popup as parent, it |
1372 // In order for the listbox to have popup as parent, it |
1429 // needs to be allocated and constructed separately |
1373 // needs to be allocated and constructed separately |
1430 CMIDChoiceGroupListBox* pListBox = AllocateListBoxL(); |
1374 CMIDChoiceGroupListBox* pListBox = AllocateListBoxL(); |
1431 CleanupStack::PushL(pListBox); |
1375 CleanupStack::PushL(pListBox); |
1919 #ifdef RD_JAVA_S60_RELEASE_9_2 |
1863 #ifdef RD_JAVA_S60_RELEASE_9_2 |
1920 CMIDForm* CMIDChoiceGroupControl::Form() const |
1864 CMIDForm* CMIDChoiceGroupControl::Form() const |
1921 { |
1865 { |
1922 return iItem->Form(); |
1866 return iItem->Form(); |
1923 } |
1867 } |
1924 |
|
1925 CMIDControlItem* CMIDChoiceGroupControl::ControlItem() const |
|
1926 { |
|
1927 return iItem; |
|
1928 } |
|
1929 |
|
1930 CMIDChoiceGroupListBox* CMIDChoiceGroupControl::InnerListBoxControl() const |
|
1931 { |
|
1932 return iListBox; |
|
1933 } |
|
1934 |
|
1935 CMIDChoiceGroupModel* CMIDChoiceGroupControl::InnerListBoxModel() const |
|
1936 { |
|
1937 return iModel; |
|
1938 } |
|
1939 #endif // RD_JAVA_S60_RELEASE_9_2 |
1868 #endif // RD_JAVA_S60_RELEASE_9_2 |