|
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 CCtlContainer641::CCtlContainer641() |
|
26 { |
|
27 } |
|
28 |
|
29 CCtlContainer641::~CCtlContainer641() |
|
30 { |
|
31 // kids should be destroyed automatically |
|
32 delete iName; |
|
33 iContainee = NULL; |
|
34 } |
|
35 |
|
36 void CCtlContainer641::ConstructL( const TDesC& aName ) |
|
37 { |
|
38 CCtlBase641::ConstructL(); |
|
39 |
|
40 // construct the kids, add them to the array. |
|
41 iName = aName.AllocL(); |
|
42 CreateWindowL(); |
|
43 InitComponentArrayL(); |
|
44 |
|
45 iContainee = new (ELeave) CCtlContainee641; |
|
46 Components().AppendLC( iContainee, KChildOneID ) ; |
|
47 iContainee->ConstructL( _L("child1") ); |
|
48 CleanupStack::Pop(iContainee); |
|
49 } |
|
50 |
|
51 void CCtlContainer641::SizeChanged() |
|
52 { |
|
53 // set the size of the children |
|
54 const TRect rect = Rect(); |
|
55 TSize size = rect.Size(); |
|
56 TPoint tl = rect.iTl; |
|
57 |
|
58 TInt childCount = CountComponentControls(); |
|
59 if ( childCount > 0 ) |
|
60 { |
|
61 size.iWidth = (size.iWidth *3 )/10; |
|
62 size.iHeight = ( size.iHeight * 8 )/10; |
|
63 |
|
64 CCoeControl* child = NULL; |
|
65 for ( TInt ii = 0; ii < childCount; ++ii ) |
|
66 { |
|
67 child = ComponentControl( ii ); |
|
68 tl.iX += size.iWidth/10; |
|
69 tl.iY += size.iHeight/10; |
|
70 child->SetRect( TRect( tl, size ) ); |
|
71 } |
|
72 } |
|
73 } |
|
74 |
|
75 |
|
76 void CCtlContainer641::Draw( const TRect& /*aRect*/ ) const |
|
77 { |
|
78 // get a graphics context - outline the control |
|
79 CWindowGc& gc = SystemGc(); |
|
80 TRect rect = Rect(); |
|
81 gc.SetBrushColor( KRgbGreen ); |
|
82 DoDraw( gc, rect ); |
|
83 |
|
84 ApplyText(); |
|
85 } |
|
86 |
|
87 |
|
88 |
|
89 /** |
|
90 Draw text using a text-drawer derived from the environment, |
|
91 and a text-drawer instantiated locally. |
|
92 */ |
|
93 void CCtlContainer641::ApplyText() const |
|
94 { |
|
95 // The Inherited text drawer |
|
96 XCoeTextDrawer xTextDrawer(TextDrawer()); |
|
97 // Assume IsReusable |
|
98 |
|
99 const TRect rect = Rect(); |
|
100 xTextDrawer.SetClipRect( rect ); |
|
101 xTextDrawer.SetAlignment( EHRightVBottom ); |
|
102 xTextDrawer.DrawDisplayOrderedText( SystemGc(), KInheritedTextDrawerText, rect, *iEikonEnv->NormalFont() ); |
|
103 } |
|
104 |
|
105 |
|
106 |
|
107 /** Child controls wanting parents' text-drawer will get this one. */ |
|
108 |
|
109 void CCtlContainer641::GetTextDrawer( CCoeTextDrawerBase*& aTextDrawer, const CCoeControl* /*aDrawingControl*/, TInt /*aInt*/ ) const |
|
110 { |
|
111 aTextDrawer = &iCoeEnv->DefaultTextDrawer(); |
|
112 aTextDrawer->SetTextColor( KRgbInherited ); |
|
113 // Assume that the system text-drawer _is_ reusable. |
|
114 // See adjusted CoeEnv ConstructL() |
|
115 } |
|
116 |
|
117 |