|
1 /* |
|
2 * Copyright (c) 2005-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "TestAppContainer.h" |
|
21 |
|
22 #include <eiklabel.h> // for example label control |
|
23 |
|
24 // ================= MEMBER FUNCTIONS ======================= |
|
25 |
|
26 // --------------------------------------------------------- |
|
27 // CTestAppContainer::ConstructL(const TRect& aRect) |
|
28 // EPOC two phased constructor |
|
29 // --------------------------------------------------------- |
|
30 // |
|
31 void CTestAppContainer::ConstructL(const TRect& aRect) |
|
32 { |
|
33 CreateWindowL(); |
|
34 |
|
35 iLabelStatus = new (ELeave) CEikLabel; |
|
36 iLabelStatus->SetContainerWindowL( *this ); |
|
37 iLabelStatus->SetTextL( _L("Open menu to connect!") ); |
|
38 |
|
39 iLabelVoice = new (ELeave) CEikLabel; |
|
40 iLabelVoice->SetContainerWindowL( *this ); |
|
41 iLabelVoice->SetTextL( _L(" ") ); |
|
42 |
|
43 iLabelVolume = new (ELeave) CEikLabel; |
|
44 iLabelVolume->SetContainerWindowL( *this ); |
|
45 iLabelVolume->SetTextL( _L(" ") ); |
|
46 |
|
47 iLabelSpekingRate = new (ELeave) CEikLabel; |
|
48 iLabelSpekingRate->SetContainerWindowL( *this ); |
|
49 iLabelSpekingRate->SetTextL( _L(" ") ); |
|
50 |
|
51 iLabelDuration = new (ELeave) CEikLabel; |
|
52 iLabelDuration->SetContainerWindowL( *this ); |
|
53 iLabelDuration->SetTextL( _L(" ") ); |
|
54 |
|
55 iLabelGeneral = new (ELeave) CEikLabel; |
|
56 iLabelGeneral->SetContainerWindowL( *this ); |
|
57 iLabelGeneral->SetTextL( _L(" ") ); |
|
58 |
|
59 SetRect(aRect); |
|
60 ActivateL(); |
|
61 } |
|
62 |
|
63 // Destructor |
|
64 CTestAppContainer::~CTestAppContainer() |
|
65 { |
|
66 delete iLabelStatus; |
|
67 delete iLabelVoice; |
|
68 delete iLabelVolume; |
|
69 delete iLabelSpekingRate; |
|
70 delete iLabelDuration; |
|
71 delete iLabelGeneral; |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------- |
|
75 // CTestAppContainer::ChangeTextL() |
|
76 // |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 void CTestAppContainer::ChangeTextL( TInt aIndex, const TDesC& aText ) |
|
80 { |
|
81 if ( aIndex == 0 ) |
|
82 { |
|
83 iLabelStatus->SetTextL( aText ); |
|
84 } |
|
85 else if (aIndex == 1 ) |
|
86 { |
|
87 iLabelVoice->SetTextL( aText ); |
|
88 } |
|
89 else if (aIndex == 2 ) |
|
90 { |
|
91 iLabelVolume->SetTextL( aText ); |
|
92 } |
|
93 else if (aIndex == 3 ) |
|
94 { |
|
95 iLabelSpekingRate->SetTextL( aText ); |
|
96 } |
|
97 else if (aIndex == 4 ) |
|
98 { |
|
99 iLabelDuration->SetTextL( aText ); |
|
100 } |
|
101 else if (aIndex == 5 ) |
|
102 { |
|
103 iLabelGeneral->SetTextL( aText ); |
|
104 } |
|
105 |
|
106 SizeChanged(); |
|
107 DrawNow(); |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------- |
|
111 // CTestAppContainer::SizeChanged() |
|
112 // Called by framework when the view size is changed |
|
113 // --------------------------------------------------------- |
|
114 // |
|
115 void CTestAppContainer::SizeChanged() |
|
116 { |
|
117 iLabelStatus->SetExtent( TPoint(10,10), iLabelStatus->MinimumSize() ); |
|
118 iLabelVoice->SetExtent( TPoint(10,30), iLabelVoice->MinimumSize() ); |
|
119 iLabelVolume->SetExtent( TPoint(10,50), iLabelVolume->MinimumSize() ); |
|
120 iLabelSpekingRate->SetExtent( TPoint(10,70), iLabelSpekingRate->MinimumSize() ); |
|
121 iLabelDuration->SetExtent( TPoint(10,90), iLabelDuration->MinimumSize() ); |
|
122 iLabelGeneral->SetExtent( TPoint(10,130), iLabelGeneral->MinimumSize() ); |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------- |
|
126 // CTestAppContainer::CountComponentControls() const |
|
127 // --------------------------------------------------------- |
|
128 // |
|
129 TInt CTestAppContainer::CountComponentControls() const |
|
130 { |
|
131 return 6; // return nbr of controls inside this container |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------- |
|
135 // CTestAppContainer::ComponentControl(TInt aIndex) const |
|
136 // --------------------------------------------------------- |
|
137 // |
|
138 CCoeControl* CTestAppContainer::ComponentControl(TInt aIndex) const |
|
139 { |
|
140 switch ( aIndex ) |
|
141 { |
|
142 case 0: |
|
143 return iLabelStatus; |
|
144 case 1: |
|
145 return iLabelVoice; |
|
146 case 2: |
|
147 return iLabelVolume; |
|
148 case 3: |
|
149 return iLabelSpekingRate; |
|
150 case 4: |
|
151 return iLabelDuration; |
|
152 case 5: |
|
153 return iLabelGeneral; |
|
154 default: |
|
155 return NULL; |
|
156 } |
|
157 } |
|
158 |
|
159 // --------------------------------------------------------- |
|
160 // CTestAppContainer::Draw(const TRect& aRect) const |
|
161 // --------------------------------------------------------- |
|
162 // |
|
163 void CTestAppContainer::Draw(const TRect& aRect) const |
|
164 { |
|
165 CWindowGc& gc = SystemGc(); |
|
166 |
|
167 gc.SetPenStyle(CGraphicsContext::ENullPen); |
|
168 gc.SetBrushColor(KRgbGray); |
|
169 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
170 gc.DrawRect(aRect); |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------- |
|
174 // CTestAppContainer::HandleControlEventL( |
|
175 // CCoeControl* aControl,TCoeEvent aEventType) |
|
176 // --------------------------------------------------------- |
|
177 // |
|
178 void CTestAppContainer::HandleControlEventL( |
|
179 CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) |
|
180 { |
|
181 // Nothing |
|
182 } |
|
183 |
|
184 // End of File |