717 |
717 |
718 void CEikTestClock::Draw(const TRect& /*aRect*/) const |
718 void CEikTestClock::Draw(const TRect& /*aRect*/) const |
719 { |
719 { |
720 } |
720 } |
721 |
721 |
722 |
722 |
723 |
|
724 /** |
723 /** |
725 Auxiliary function for AutoTestBackGroundL |
724 Auxiliary function for AutoTestBackGroundL |
726 |
725 |
727 The function creates different controls and set them in the status pane. |
726 The function creates different controls and set them in the status pane. |
728 */ |
727 */ |
729 void CTspaneContainer::SwapBackgroundTestControlL(TInt aControlType) |
728 void CTspaneContainer::SwapBackgroundTestControlL(TInt aControlType) |
730 { |
729 { |
731 |
730 CCoeControl* newControl=NULL; |
732 |
|
733 CCoeControl* newControl=0; |
|
734 CCoeControl* container = iStatusPane->ContainerControlL(TUid::Uid(ETSpanePaneUid3)); |
731 CCoeControl* container = iStatusPane->ContainerControlL(TUid::Uid(ETSpanePaneUid3)); |
735 |
732 |
736 |
|
737 switch(aControlType) |
733 switch(aControlType) |
738 { |
734 { |
739 case 0: |
735 case 0: |
740 // Pane 1 - normal label |
736 // Pane 1 - normal label |
741 newControl = new(ELeave) CEikLabel; |
737 newControl = new(ELeave) CEikLabel; |
742 CleanupStack::PushL(newControl); |
738 CleanupStack::PushL(newControl); |
743 newControl->SetContainerWindowL(*container); |
739 newControl->SetContainerWindowL(*container); |
744 |
740 |
745 ((CEikLabel*)newControl)->SetEmphasis(CEikLabel::EPartialEmphasis); |
741 static_cast<CEikLabel*>(newControl)->SetEmphasis(CEikLabel::EPartialEmphasis); |
746 ((CEikLabel*)newControl)->SetTextL(_L("Normal Label")); |
742 static_cast<CEikLabel*>(newControl)->SetTextL(_L("Normal Label")); |
747 break; |
743 break; |
748 |
744 |
749 case 1: |
745 case 1: |
750 // Pane 2 - label not drawn |
746 // Pane 2 - label not drawn |
751 |
|
752 newControl = new(ELeave) CEikTestLabel; |
747 newControl = new(ELeave) CEikTestLabel; |
753 CleanupStack::PushL(newControl); |
748 CleanupStack::PushL(newControl); |
754 newControl->SetContainerWindowL(*container); |
749 newControl->SetContainerWindowL(*container); |
755 |
750 |
756 ((CEikLabel*)newControl)->SetEmphasis(CEikLabel::EPartialEmphasis); |
751 static_cast<CEikLabel*>(newControl)->SetEmphasis(CEikLabel::EPartialEmphasis); |
757 ((CEikLabel*)newControl)->SetTextL(_L("Test Label")); |
752 static_cast<CEikLabel*>(newControl)->SetTextL(_L("Test Label")); |
758 break; |
753 break; |
759 |
754 |
760 case 2: |
755 case 2: |
761 // Pane 3 - normal text button |
756 // Pane 3 - normal text button |
762 |
|
763 newControl = new(ELeave) CEikTextButton; |
757 newControl = new(ELeave) CEikTextButton; |
764 CleanupStack::PushL(newControl); |
758 CleanupStack::PushL(newControl); |
765 newControl->SetContainerWindowL(*container); |
759 newControl->SetContainerWindowL(*container); |
766 |
760 |
767 ((CEikTextButton*)newControl)->SetTextL(_L(" Normal Text Button")); |
761 static_cast<CEikTextButton*>(newControl)->SetTextL(_L(" Normal Text Button")); |
768 break; |
762 break; |
769 |
763 |
770 case 3: |
764 case 3: |
771 // Pane 4 - text button not drawn |
765 // Pane 4 - text button not drawn |
772 |
|
773 newControl = new(ELeave) CEikTestTextButton; |
766 newControl = new(ELeave) CEikTestTextButton; |
774 CleanupStack::PushL(newControl); |
767 CleanupStack::PushL(newControl); |
775 newControl->SetContainerWindowL(*container); |
768 newControl->SetContainerWindowL(*container); |
776 |
769 |
777 ((CEikTextButton*)newControl)->SetTextL(_L("Test Text Button")); |
770 static_cast<CEikTextButton*>(newControl)->SetTextL(_L("Test Text Button")); |
778 break; |
771 break; |
779 |
772 |
780 case 4: |
773 case 4: |
781 // Pane 5 - normal clock |
774 // Pane 5 - normal clock |
|
775 { |
782 newControl = new(ELeave) CEikClock; |
776 newControl = new(ELeave) CEikClock; |
783 CleanupStack::PushL(newControl); |
777 CleanupStack::PushL(newControl); |
784 newControl->SetContainerWindowL(*container); |
778 newControl->SetContainerWindowL(*container); |
785 TResourceReader res; |
779 TResourceReader res; |
786 iEikonEnv->CreateResourceReaderLC(res, R_TSPANE_CLOCK) ; |
780 iEikonEnv->CreateResourceReaderLC(res, R_TSPANE_CLOCK) ; |
787 ((CEikClock*)newControl)->ConstructFromResourceL(res); |
781 static_cast<CEikClock*>(newControl)->ConstructFromResourceL(res); |
788 CleanupStack::PopAndDestroy(); // res |
782 CleanupStack::PopAndDestroy(); // res |
789 break; |
783 } |
790 |
784 break; |
791 case 5: |
785 |
|
786 case 5: |
792 // Pane 6 - test clock |
787 // Pane 6 - test clock |
|
788 { |
793 newControl = new(ELeave) CEikTestClock; |
789 newControl = new(ELeave) CEikTestClock; |
794 CleanupStack::PushL(newControl); |
790 CleanupStack::PushL(newControl); |
795 newControl->SetContainerWindowL(*container); |
791 newControl->SetContainerWindowL(*container); |
796 TResourceReader res1; |
792 TResourceReader res1; |
797 iEikonEnv->CreateResourceReaderLC(res1, R_TSPANE_CLOCK) ; |
793 iEikonEnv->CreateResourceReaderLC(res1, R_TSPANE_CLOCK) ; |
798 ((CEikClock*)newControl)->ConstructFromResourceL(res1); |
794 static_cast<CEikClock*>(newControl)->ConstructFromResourceL(res1); |
799 CleanupStack::PopAndDestroy(); // res1 |
795 CleanupStack::PopAndDestroy(); // res1 |
800 break; |
796 } |
801 } |
797 break; |
802 |
798 } |
|
799 |
803 TRect rect = iStatusPane->PaneRectL(TUid::Uid(ETSpanePaneUid3)); |
800 TRect rect = iStatusPane->PaneRectL(TUid::Uid(ETSpanePaneUid3)); |
804 newControl->SetRect(rect); |
801 newControl->SetRect(rect); |
805 newControl->DrawNow(); |
802 newControl->DrawNow(); |
806 newControl->ActivateL(); |
803 newControl->ActivateL(); |
807 |
804 |
808 CCoeControl* oldControl= iStatusPane->SwapControlL(TUid::Uid(ETSpanePaneUid3), newControl); // iStatusPane takes ownership of newControl |
805 CCoeControl* oldControl=iStatusPane->SwapControlL(TUid::Uid(ETSpanePaneUid3), newControl); // iStatusPane takes ownership of newControl |
809 iStatusPane->MakeVisible(ETrue); |
806 CleanupStack::Pop(newControl); |
|
807 CleanupStack::PushL(oldControl); |
|
808 iStatusPane->MakeVisible(ETrue); |
810 iStatusPane->ApplyCurrentSettingsL(); |
809 iStatusPane->ApplyCurrentSettingsL(); |
811 |
810 CleanupStack::PopAndDestroy(oldControl); |
812 CleanupStack::Pop(); |
|
813 |
|
814 delete oldControl; |
|
815 } |
811 } |
816 |
812 |
817 /** |
813 /** |
818 @SYMTestCaseID UIF-tspane-AutoTestBackgroundL |
814 @SYMTestCaseID UIF-tspane-AutoTestBackgroundL |
819 |
815 |