|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: container |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "bctesttemplatecontainer.h" |
|
20 |
|
21 #define KAknAtListGray TRgb( 0xaaaaaa ) |
|
22 |
|
23 |
|
24 // ======== MEMBER FUNCTIONS ======== |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // C++ default Constructor |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 CBCTestTemplateContainer::CBCTestTemplateContainer() |
|
31 { |
|
32 } |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // Destructor |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 CBCTestTemplateContainer::~CBCTestTemplateContainer() |
|
39 { |
|
40 ResetControl(); |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // Symbian 2nd Constructor |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 void CBCTestTemplateContainer::ConstructL( const TRect& aRect ) |
|
48 { |
|
49 CreateWindowL(); |
|
50 SetRect( aRect ); |
|
51 ActivateL(); |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CBCTestTemplateContainer::Draw |
|
56 // Fills the window's rectangle. |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 void CBCTestTemplateContainer::Draw( const TRect& aRect ) const |
|
60 { |
|
61 CWindowGc& gc = SystemGc(); |
|
62 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
63 gc.SetBrushColor( KAknAtListGray ); |
|
64 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
65 gc.DrawRect( aRect ); |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // CBCTestTemplateContainer::CountComponentControls |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 TInt CBCTestTemplateContainer::CountComponentControls() const |
|
73 { |
|
74 if ( iControl ) |
|
75 { |
|
76 return 1; |
|
77 } |
|
78 else |
|
79 { |
|
80 return 0; |
|
81 } |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CBCTestTemplateContainer::ComponentControl |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CCoeControl* CBCTestTemplateContainer::ComponentControl( TInt ) const |
|
89 { |
|
90 return iControl; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CBCTestTemplateContainer::SetControl |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 void CBCTestTemplateContainer::SetControl( CCoeControl* aControl ) |
|
98 { |
|
99 iControl = aControl; |
|
100 if ( iControl ) |
|
101 { |
|
102 // You can change the position and size |
|
103 iControl->SetExtent( Rect().iTl, Rect().Size() ); |
|
104 iControl->ActivateL(); |
|
105 DrawNow(); |
|
106 } |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // CBCTestTemplateContainer::ResetControl |
|
111 // --------------------------------------------------------------------------- |
|
112 // |
|
113 void CBCTestTemplateContainer::ResetControl() |
|
114 { |
|
115 delete iControl; |
|
116 iControl = NULL; |
|
117 } |