commonuisupport/uikon/test/tspane/tspane.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
     1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   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  
   723 /**
   724 /**
   724   Auxiliary function for AutoTestBackGroundL
   725   Auxiliary function for AutoTestBackGroundL
   725 
   726  
   726   The function creates different controls and set them in the status pane.
   727   The function creates different controls and set them in the status pane.
   727 */
   728 */
   728 void CTspaneContainer::SwapBackgroundTestControlL(TInt aControlType)
   729 void CTspaneContainer::SwapBackgroundTestControlL(TInt aControlType)
   729 	{
   730 	{
   730 	CCoeControl* newControl=NULL;
   731 	
       
   732 
       
   733 	CCoeControl* newControl=0;
   731 	CCoeControl* container = iStatusPane->ContainerControlL(TUid::Uid(ETSpanePaneUid3));
   734 	CCoeControl* container = iStatusPane->ContainerControlL(TUid::Uid(ETSpanePaneUid3));
   732 
   735 	
       
   736  
   733 	switch(aControlType)
   737 	switch(aControlType)
   734 		{
   738 		{
   735 		case 0: 
   739 		 	case 0: 
   736 			// Pane 1 - normal label
   740 			// Pane 1 - normal label
   737 			newControl = new(ELeave) CEikLabel;
   741 			newControl = new(ELeave) CEikLabel;
   738 			CleanupStack::PushL(newControl);
   742 		 	CleanupStack::PushL(newControl);
   739 			newControl->SetContainerWindowL(*container);
   743 			newControl->SetContainerWindowL(*container);
   740 
   744 		 
   741 			static_cast<CEikLabel*>(newControl)->SetEmphasis(CEikLabel::EPartialEmphasis);
   745 			((CEikLabel*)newControl)->SetEmphasis(CEikLabel::EPartialEmphasis);
   742 			static_cast<CEikLabel*>(newControl)->SetTextL(_L("Normal Label"));
   746 			((CEikLabel*)newControl)->SetTextL(_L("Normal Label"));
   743 			break;
   747 			break;
   744 
   748 	
   745 		case 1: 
   749 			case 1: 
   746 			// Pane 2 -  label not drawn
   750 			// Pane 2 -  label not drawn
       
   751 			 
   747 			newControl = new(ELeave) CEikTestLabel;
   752 			newControl = new(ELeave) CEikTestLabel;
   748 			CleanupStack::PushL(newControl);
   753 		 	CleanupStack::PushL(newControl);
   749 			newControl->SetContainerWindowL(*container);
   754 			newControl->SetContainerWindowL(*container);
   750 
   755 
   751 			static_cast<CEikLabel*>(newControl)->SetEmphasis(CEikLabel::EPartialEmphasis);
   756 			((CEikLabel*)newControl)->SetEmphasis(CEikLabel::EPartialEmphasis);
   752 			static_cast<CEikLabel*>(newControl)->SetTextL(_L("Test Label"));
   757 			((CEikLabel*)newControl)->SetTextL(_L("Test Label"));
   753 			break;
   758 			break;
   754 
   759 			
   755 		case 2:
   760 			case 2: 
   756 			// Pane 3 - normal text button
   761 			// Pane 3 - normal text button	
       
   762 		 
   757 			newControl = new(ELeave) CEikTextButton;
   763 			newControl = new(ELeave) CEikTextButton;
   758 			CleanupStack::PushL(newControl);
   764 			CleanupStack::PushL(newControl);
   759 			newControl->SetContainerWindowL(*container);
   765 			newControl->SetContainerWindowL(*container);
   760 
   766 
   761 			static_cast<CEikTextButton*>(newControl)->SetTextL(_L(" Normal Text Button"));
   767 			((CEikTextButton*)newControl)->SetTextL(_L(" Normal Text Button"));	
   762 			break;
   768 			 break;
   763 
   769 			 
   764 		case 3:
   770 			case 3:
   765 			// Pane 4 - text button	not drawn
   771 			// Pane 4 - text button	not drawn
       
   772 		 
   766 			newControl = new(ELeave) CEikTestTextButton;
   773 			newControl = new(ELeave) CEikTestTextButton;
   767 			CleanupStack::PushL(newControl);
   774 			CleanupStack::PushL(newControl);
   768 			newControl->SetContainerWindowL(*container);
   775 			newControl->SetContainerWindowL(*container);
   769 
   776 
   770 			static_cast<CEikTextButton*>(newControl)->SetTextL(_L("Test Text Button"));
   777 			((CEikTextButton*)newControl)->SetTextL(_L("Test Text Button"));	
   771 			break;
   778 			break;
   772 
   779 			
   773 		case 4:
   780 			case 4:
   774 			// Pane 5 - normal clock
   781 			// Pane 5 - normal clock
   775 			{
       
   776 			newControl = new(ELeave) CEikClock;
   782 			newControl = new(ELeave) CEikClock;
   777 			CleanupStack::PushL(newControl);
   783 			CleanupStack::PushL(newControl);
   778 			newControl->SetContainerWindowL(*container);
   784 			newControl->SetContainerWindowL(*container);
   779 			TResourceReader res;
   785 			TResourceReader res;
   780 			iEikonEnv->CreateResourceReaderLC(res, R_TSPANE_CLOCK) ;
   786 			iEikonEnv->CreateResourceReaderLC(res, R_TSPANE_CLOCK) ;
   781 			static_cast<CEikClock*>(newControl)->ConstructFromResourceL(res);
   787 			((CEikClock*)newControl)->ConstructFromResourceL(res);
   782 			CleanupStack::PopAndDestroy();	// res
   788 			CleanupStack::PopAndDestroy();	// res
   783 			}
   789 			break;
   784 			break;
   790 			
   785 
   791 			case 5:
   786 		case 5:
       
   787 			// Pane 6 - test clock
   792 			// Pane 6 - test clock
   788 			{
       
   789 			newControl = new(ELeave) CEikTestClock;
   793 			newControl = new(ELeave) CEikTestClock;
   790 			CleanupStack::PushL(newControl);
   794 			CleanupStack::PushL(newControl);
   791 			newControl->SetContainerWindowL(*container);
   795 			newControl->SetContainerWindowL(*container);
   792 			TResourceReader res1;
   796 			TResourceReader res1;
   793 			iEikonEnv->CreateResourceReaderLC(res1, R_TSPANE_CLOCK) ;
   797 			iEikonEnv->CreateResourceReaderLC(res1, R_TSPANE_CLOCK) ;
   794 			static_cast<CEikClock*>(newControl)->ConstructFromResourceL(res1);
   798 			((CEikClock*)newControl)->ConstructFromResourceL(res1);
   795 			CleanupStack::PopAndDestroy();	// res1
   799 			CleanupStack::PopAndDestroy();	// res1	    	    
   796 			}
   800 			break;
   797 			break;
   801 		}
   798 		}
   802  
   799 
       
   800 	TRect rect = iStatusPane->PaneRectL(TUid::Uid(ETSpanePaneUid3));
   803 	TRect rect = iStatusPane->PaneRectL(TUid::Uid(ETSpanePaneUid3));
   801 	newControl->SetRect(rect);
   804 	newControl->SetRect(rect);
   802 	newControl->DrawNow();
   805 	newControl->DrawNow();
   803 	newControl->ActivateL();
   806 	newControl->ActivateL();
   804 
   807 
   805 	CCoeControl* oldControl=iStatusPane->SwapControlL(TUid::Uid(ETSpanePaneUid3), newControl); // iStatusPane takes ownership of newControl
   808 	CCoeControl* oldControl= iStatusPane->SwapControlL(TUid::Uid(ETSpanePaneUid3), newControl); // iStatusPane takes ownership of newControl
   806 	CleanupStack::Pop(newControl);
   809 	iStatusPane->MakeVisible(ETrue); 
   807 	CleanupStack::PushL(oldControl);
       
   808 	iStatusPane->MakeVisible(ETrue);
       
   809 	iStatusPane->ApplyCurrentSettingsL();
   810 	iStatusPane->ApplyCurrentSettingsL();
   810 	CleanupStack::PopAndDestroy(oldControl);
   811 
       
   812 	CleanupStack::Pop(); 
       
   813  
       
   814 	delete oldControl;
   811 	}
   815 	}
   812 
   816 
   813 /**
   817 /**
   814    @SYMTestCaseID UIF-tspane-AutoTestBackgroundL
   818    @SYMTestCaseID UIF-tspane-AutoTestBackgroundL
   815   
   819