lafagnosticuifoundation/cone/tef/TCone7SubContainer.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent - Internal Symbian test code 
       
    19 */
       
    20 
       
    21 
       
    22 #include "TCone7Step.h"
       
    23 
       
    24 
       
    25 CCtlSubContainer641::CCtlSubContainer641()
       
    26 	{	
       
    27 	}
       
    28 	
       
    29 CCtlSubContainer641::~CCtlSubContainer641()
       
    30 	{
       
    31 	// kids should be destroyed automatically	
       
    32 	delete iName;
       
    33 	}
       
    34 	
       
    35 void CCtlSubContainer641::ConstructL( const TDesC& aName )
       
    36 	{
       
    37 	CCtlBase641::ConstructL();
       
    38 	
       
    39 	// construct the kids, add them to the array.	
       
    40 	iName = aName.AllocL();
       
    41 	// Not window-owning
       
    42 	
       
    43 	iContainee = new (ELeave) CCtlContainee641;
       
    44 	InitComponentArrayL();
       
    45    	Components().AppendLC( iContainee, KChildOneID ) ;
       
    46 	iContainee->ConstructL( _L("child1") );
       
    47 	CleanupStack::Pop( iContainee );
       
    48 		
       
    49 	iContainee->SetParent( this );
       
    50 	}
       
    51 	
       
    52 void CCtlSubContainer641::SizeChanged() 
       
    53 	{
       
    54 	// set the size of the children
       
    55 	TRect rect = Rect();
       
    56 	TSize size = rect.Size();
       
    57 	TPoint tl = rect.iTl;
       
    58 	
       
    59 	
       
    60 	TInt childCount = CountComponentControls();
       
    61 	if ( childCount > 0 )
       
    62 		{
       
    63 		size.iWidth = (size.iWidth * 5 )/10;
       
    64 		size.iHeight = ( size.iHeight * 4 )/10;
       
    65 		
       
    66 		CCoeControl* child;
       
    67 		for ( TInt ii = 0; ii < childCount; ++ii )
       
    68 			{
       
    69 			child = ComponentControl( ii );
       
    70 			tl.iX += size.iWidth/10;
       
    71 			tl.iY += size.iHeight/10;
       
    72 			child->SetRect( TRect( tl, size ) );
       
    73 			}
       
    74 		}
       
    75 	}
       
    76 
       
    77 void CCtlSubContainer641::Draw( const TRect& /*aRect*/ ) const
       
    78 	{
       
    79 	// get a graphics context - outline the control
       
    80 	CWindowGc& gc=SystemGc();
       
    81 	TRect rect=Rect();
       
    82 	gc.SetBrushColor( KRgbCyan );
       
    83 	DoDraw( gc, rect );
       
    84 	
       
    85 	ApplyText();	
       
    86 	}
       
    87 
       
    88 
       
    89 /** Draw text using a text-drawer derived from the environment, 
       
    90 	and a text-drawer instantiated locally.
       
    91 */
       
    92 void CCtlSubContainer641::ApplyText() const
       
    93 	{
       
    94 	TInt key = 0;
       
    95 	// The Inherited text drawer
       
    96 	XCoeTextDrawer xTextDrawer(TextDrawer( key ));
       
    97 	
       
    98 	TRect rect = Rect();
       
    99 	CCoeEnv* env = ControlEnv();
       
   100 	
       
   101 	xTextDrawer.SetClipRect( rect );
       
   102 	xTextDrawer.SetAlignment( EHRightVBottom );
       
   103 	xTextDrawer.DrawDisplayOrderedText( SystemGc(), KInheritedTextDrawerText, rect, *env->NormalFont() );
       
   104 	}
       
   105 
       
   106 
       
   107 
       
   108 /**  Child controls wanting parents' text-drawer will get one
       
   109 	 derived by recursing parent controls.
       
   110 */
       
   111 void CCtlSubContainer641::GetTextDrawer( CCoeTextDrawerBase*& /*aTextDrawer*/, const CCoeControl* /*aDrawingControl*/, TInt /*aInt*/ ) const
       
   112 	{
       
   113 	}
       
   114 
       
   115