|
1 /* |
|
2 * Copyright (c) 2004-2006 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: Parameter class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CPhCltBaseImageParams.h" |
|
20 #include "PhCltClientServer.h" |
|
21 // ----------------------------------------------------------------------------- |
|
22 // CPhCltBaseImageParams::CPhCltBaseImageParams |
|
23 // |
|
24 // C++ constructor. |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 CPhCltBaseImageParams::CPhCltBaseImageParams( |
|
28 const TPhCltImageType aType ) |
|
29 { |
|
30 iImages().iType = aType; |
|
31 } |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CPhCltBaseImageParams::Type |
|
35 // |
|
36 // Returns type. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 TPhCltImageType CPhCltBaseImageParams::Type() const |
|
40 { |
|
41 return iImages().iType; |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CPhCltBaseImageParams::AddImage |
|
46 // |
|
47 // Adds an image. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 void CPhCltBaseImageParams::AddImageL( TInt aHandle ) |
|
51 { |
|
52 if ( iImages().iImageCount > KPhCltImagesArrayLen - 1 ) |
|
53 { |
|
54 User::Leave( KErrOverflow ); |
|
55 } |
|
56 iImages().iImages[ iImages().iImageCount ] = aHandle; |
|
57 iImages().iImageCount++; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CPhCltBaseImageParams::Clean |
|
62 // |
|
63 // Cleans class content. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 void CPhCltBaseImageParams::Clean() |
|
67 { |
|
68 iImages().iImageCount = 0; |
|
69 for ( TInt i = 0; i < KPhCltImagesArrayLen; i++ ) |
|
70 { |
|
71 iImages().iImages[ i ] = 0; |
|
72 } |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CPhCltBaseImageParams::CPhCltBaseImageParams |
|
77 // |
|
78 // Destructor. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CPhCltBaseImageParams::~CPhCltBaseImageParams() |
|
82 { |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CPhCltBaseImageParams::operator= |
|
87 // |
|
88 // Assignment operator. |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 CPhCltBaseImageParams& CPhCltBaseImageParams:: |
|
92 operator=( const CPhCltBaseImageParams& aParamClass ) |
|
93 { |
|
94 Clean(); |
|
95 this->iImages().iType = aParamClass.iImages().iType; |
|
96 this->iImages().iImageCount = aParamClass.iImages().iImageCount; |
|
97 for ( TInt i = 0; i < KPhCltImagesArrayLen; i++ ) |
|
98 { |
|
99 iImages().iImages[ i ] = aParamClass.iImages().iImages[ i ]; |
|
100 } |
|
101 return *this; |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CPhCltBaseImageParams::GetImageL |
|
106 // |
|
107 // Gets an image handle. |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 TInt CPhCltBaseImageParams::GetImageL( const TInt aIndex ) const |
|
111 { |
|
112 if ( aIndex > iImages().iImageCount - 1 ) |
|
113 { |
|
114 User::Leave( KErrArgument ); |
|
115 } |
|
116 return iImages().iImages[ aIndex ]; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CPhCltBaseImageParams::Count |
|
121 // |
|
122 // Return image count. |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 TInt CPhCltBaseImageParams::Count() const |
|
126 { |
|
127 return iImages().iImageCount; |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CPhCltBaseImageParams::Images |
|
132 // |
|
133 // Returns all images. |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 TPckgBuf< TPhCltImageArray >& CPhCltBaseImageParams::Images() |
|
137 { |
|
138 return iImages; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CPhCltBaseImageParams::CPhCltBaseImageParams |
|
143 // |
|
144 // C++ constructor. |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 CPhCltExtVTImageParams::CPhCltExtVTImageParams( const TPhCltImageType aType ) |
|
148 : CPhCltBaseImageParams( aType ) |
|
149 { |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CPhCltBaseImageParams::NewL |
|
154 // |
|
155 // Constructor. |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 CPhCltExtVTImageParams* CPhCltExtVTImageParams::NewL( |
|
159 const TPhCltImageType aType ) |
|
160 { |
|
161 CPhCltExtVTImageParams* self = NULL; |
|
162 if ( aType != EPhCltTypeVTDefault ) // default image opening changed |
|
163 { |
|
164 self = new( ELeave ) CPhCltExtVTImageParams( aType ); |
|
165 } |
|
166 return self; |
|
167 } |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // CPhCltExtVTImageParams::~CPhCltExtVTImageParams |
|
171 // |
|
172 // Destructor. |
|
173 // ----------------------------------------------------------------------------- |
|
174 // |
|
175 CPhCltExtVTImageParams::~CPhCltExtVTImageParams() |
|
176 { |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // CPhCltExtOperatorLogoParams::CPhCltExtOperatorLogoParams |
|
181 // |
|
182 // C++ constructor. |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 CPhCltExtOperatorLogoParams::CPhCltExtOperatorLogoParams() |
|
186 : CPhCltBaseImageParams( EPhCltTypeOperatorLogo ) |
|
187 { |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CPhCltBaseImageParams::NewL |
|
192 // |
|
193 // Constructor. |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 CPhCltExtOperatorLogoParams* CPhCltExtOperatorLogoParams::NewL() |
|
197 { |
|
198 CPhCltExtOperatorLogoParams* self = |
|
199 new( ELeave )CPhCltExtOperatorLogoParams(); |
|
200 return self; |
|
201 } |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CPhCltBaseImageParams::CPhCltBaseImageParams |
|
205 // |
|
206 // Destructor. |
|
207 // ----------------------------------------------------------------------------- |
|
208 // |
|
209 CPhCltExtOperatorLogoParams::~CPhCltExtOperatorLogoParams() |
|
210 { |
|
211 } |
|
212 |
|
213 // ----------------------------------------------------------------------------- |
|
214 // CPhCltExtOperatorLogoParams::AddImage |
|
215 // |
|
216 // Adds an image. |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 void CPhCltExtOperatorLogoParams::AddImageL( TInt aHandle ) |
|
220 { |
|
221 iImages().iImages[ EPhCltExtOperatorLogoIndex ] = aHandle; |
|
222 iImages().iImageCount = 1; |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CPhCltBaseImageParams::operator= |
|
227 // |
|
228 // Assignment operator. |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 CPhCltBaseImageParams& CPhCltExtOperatorLogoParams:: |
|
232 operator=( const CPhCltBaseImageParams& aParamClass ) |
|
233 { |
|
234 Clean(); |
|
235 this->iImages().iType = aParamClass.iImages().iType; |
|
236 this->iImages().iImageCount = aParamClass.iImages().iImageCount; |
|
237 this->iImages().iImages[ EPhCltExtOperatorLogoIndex ] = |
|
238 aParamClass.iImages().iImages[ EPhCltExtOperatorLogoIndex ]; |
|
239 this->iImages().iImages[ EPhCltExtCountryCodeIndex ] = |
|
240 aParamClass.iImages().iImages[ EPhCltExtCountryCodeIndex ]; |
|
241 this->iImages().iImages[ EPhCltExtNetworkCodeIndex ] = |
|
242 aParamClass.iImages().iImages[ EPhCltExtNetworkCodeIndex ]; |
|
243 this->iImages().iImages[ EPhCltExtLogoTypeIndex ] = |
|
244 aParamClass.iImages().iImages[ EPhCltExtLogoTypeIndex ]; |
|
245 return *this; |
|
246 } |
|
247 |
|
248 // ----------------------------------------------------------------------------- |
|
249 // CPhCltExtOperatorLogoParams::SetCodesL |
|
250 // |
|
251 // Sets country and network code. |
|
252 // ----------------------------------------------------------------------------- |
|
253 // |
|
254 void CPhCltExtOperatorLogoParams::SetCodesL( const TPhCltCountryCode aCountryCode, |
|
255 const TPhCltNetworkCode aNetworkCode, |
|
256 const TPhCltExtOperatorLogoType aLogoType ) |
|
257 { |
|
258 iImages().iImages[ EPhCltExtCountryCodeIndex ] = aCountryCode; |
|
259 iImages().iImages[ EPhCltExtNetworkCodeIndex ] = aNetworkCode; |
|
260 iImages().iImages[ EPhCltExtLogoTypeIndex ] = aLogoType; |
|
261 } |
|
262 |
|
263 // END OF FILE |