|
1 /* |
|
2 * Copyright (c) 2009 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 #include "MemSpyViewECom.h" |
|
19 |
|
20 // System includes |
|
21 #include <memspyui.rsg> |
|
22 |
|
23 // Engine includes |
|
24 #include <memspy/engine/memspyengine.h> |
|
25 #include <memspy/engine/memspyenginehelperecom.h> |
|
26 |
|
27 // User includes |
|
28 #include "MemSpyViewMainMenu.h" |
|
29 #include "MemSpyContainerObserver.h" |
|
30 |
|
31 |
|
32 |
|
33 CMemSpyViewECom::CMemSpyViewECom( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) |
|
34 : CMemSpyViewBase( aEngine, aObserver ) |
|
35 { |
|
36 } |
|
37 |
|
38 |
|
39 void CMemSpyViewECom::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
|
40 { |
|
41 _LIT( KTitle, "ECom" ); |
|
42 SetTitleL( KTitle ); |
|
43 |
|
44 // Finish construction |
|
45 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
|
46 |
|
47 // Select first item |
|
48 TInt index = KErrNotFound; |
|
49 if ( aSelectionRune != NULL ) |
|
50 { |
|
51 iCurrent = reinterpret_cast< CMemSpyEngineEComCategory* >( aSelectionRune ); |
|
52 index = iEngine.HelperECom().IndexOf( *iCurrent ); |
|
53 } |
|
54 |
|
55 if ( index >= 0 && index < iEngine.HelperECom().Count() ) |
|
56 { |
|
57 iListBox->SetCurrentItemIndex( index ); |
|
58 HandleListBoxItemSelectedL( index ); |
|
59 iListBox->DrawDeferred(); |
|
60 } |
|
61 } |
|
62 |
|
63 |
|
64 void CMemSpyViewECom::RefreshL() |
|
65 { |
|
66 SetListBoxModelL(); |
|
67 CMemSpyViewBase::RefreshL(); |
|
68 } |
|
69 |
|
70 |
|
71 TMemSpyViewType CMemSpyViewECom::ViewType() const |
|
72 { |
|
73 return EMemSpyViewTypeECom; |
|
74 } |
|
75 |
|
76 |
|
77 CMemSpyViewBase* CMemSpyViewECom::PrepareParentViewL() |
|
78 { |
|
79 CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); |
|
80 CleanupStack::PushL( parent ); |
|
81 parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); |
|
82 CleanupStack::Pop( parent ); |
|
83 return parent; |
|
84 } |
|
85 |
|
86 |
|
87 CMemSpyViewBase* CMemSpyViewECom::PrepareChildViewL() |
|
88 { |
|
89 CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, *iCurrent ); |
|
90 CleanupStack::PushL( child ); |
|
91 child->ConstructL( Rect(), *Parent() ); |
|
92 CleanupStack::Pop( child ); |
|
93 return child; |
|
94 } |
|
95 |
|
96 |
|
97 void CMemSpyViewECom::SetListBoxModelL() |
|
98 { |
|
99 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
|
100 listbox->Model()->SetItemTextArray( &iEngine.HelperECom() ); |
|
101 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
102 } |
|
103 |
|
104 |
|
105 void CMemSpyViewECom::HandleListBoxItemActionedL( TInt aIndex ) |
|
106 { |
|
107 const TInt count = iEngine.HelperECom().Count(); |
|
108 if ( aIndex >= 0 && aIndex < count ) |
|
109 { |
|
110 CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex ); |
|
111 iCurrent = &category; |
|
112 } |
|
113 else |
|
114 { |
|
115 iCurrent = NULL; |
|
116 } |
|
117 |
|
118 // Notify observer about item selection |
|
119 ReportEventL( MMemSpyViewObserver::EEventItemActioned ); |
|
120 } |
|
121 |
|
122 |
|
123 void CMemSpyViewECom::HandleListBoxItemSelectedL( TInt aIndex ) |
|
124 { |
|
125 const TInt count = iEngine.HelperECom().Count(); |
|
126 if ( aIndex >= 0 && aIndex < count ) |
|
127 { |
|
128 CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex ); |
|
129 iCurrent = &category; |
|
130 } |
|
131 else |
|
132 { |
|
133 iCurrent = NULL; |
|
134 } |
|
135 |
|
136 // Notify observer about item selection |
|
137 ReportEventL( MMemSpyViewObserver::EEventItemSelected ); |
|
138 } |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 CMemSpyViewEComCategory::CMemSpyViewEComCategory( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComCategory& aCategory ) |
|
153 : CMemSpyViewBase( aEngine, aObserver ), iCategory( aCategory ) |
|
154 { |
|
155 } |
|
156 |
|
157 |
|
158 void CMemSpyViewEComCategory::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
|
159 { |
|
160 SetTitleL( iCategory.Name() ); |
|
161 |
|
162 // Finish construction |
|
163 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
|
164 |
|
165 // Select first item |
|
166 TInt index = KErrNotFound; |
|
167 if ( aSelectionRune != NULL ) |
|
168 { |
|
169 iCurrent = reinterpret_cast< CMemSpyEngineEComInterface* >( aSelectionRune ); |
|
170 index = iCategory.IndexOf( *iCurrent ); |
|
171 } |
|
172 |
|
173 if ( index >= 0 && index < iCategory.Count() ) |
|
174 { |
|
175 iListBox->SetCurrentItemIndex( index ); |
|
176 HandleListBoxItemSelectedL( index ); |
|
177 iListBox->DrawDeferred(); |
|
178 } |
|
179 } |
|
180 |
|
181 |
|
182 void CMemSpyViewEComCategory::RefreshL() |
|
183 { |
|
184 SetListBoxModelL(); |
|
185 CMemSpyViewBase::RefreshL(); |
|
186 } |
|
187 |
|
188 |
|
189 TMemSpyViewType CMemSpyViewEComCategory::ViewType() const |
|
190 { |
|
191 return EMemSpyViewTypeEComCategory; |
|
192 } |
|
193 |
|
194 |
|
195 CMemSpyViewBase* CMemSpyViewEComCategory::PrepareParentViewL() |
|
196 { |
|
197 CMemSpyViewECom* parent = new(ELeave) CMemSpyViewECom( iEngine, iObserver ); |
|
198 CleanupStack::PushL( parent ); |
|
199 parent->ConstructL( Rect(), *Parent(), &iCategory ); |
|
200 CleanupStack::Pop( parent ); |
|
201 return parent; |
|
202 } |
|
203 |
|
204 |
|
205 CMemSpyViewBase* CMemSpyViewEComCategory::PrepareChildViewL() |
|
206 { |
|
207 CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, *iCurrent ); |
|
208 CleanupStack::PushL( child ); |
|
209 child->ConstructL( Rect(), *Parent() ); |
|
210 CleanupStack::Pop( child ); |
|
211 return child; |
|
212 } |
|
213 |
|
214 |
|
215 void CMemSpyViewEComCategory::SetListBoxModelL() |
|
216 { |
|
217 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
|
218 listbox->Model()->SetItemTextArray( &iCategory ); |
|
219 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
220 } |
|
221 |
|
222 |
|
223 void CMemSpyViewEComCategory::HandleListBoxItemActionedL( TInt aIndex ) |
|
224 { |
|
225 const TInt count = iCategory.Count(); |
|
226 if ( aIndex >= 0 && aIndex < count ) |
|
227 { |
|
228 CMemSpyEngineEComInterface& entry = iCategory.At( aIndex ); |
|
229 iCurrent = &entry; |
|
230 } |
|
231 else |
|
232 { |
|
233 iCurrent = NULL; |
|
234 } |
|
235 |
|
236 // Notify observer about item selection |
|
237 ReportEventL( MMemSpyViewObserver::EEventItemActioned ); |
|
238 } |
|
239 |
|
240 |
|
241 void CMemSpyViewEComCategory::HandleListBoxItemSelectedL( TInt aIndex ) |
|
242 { |
|
243 const TInt count = iCategory.Count(); |
|
244 if ( aIndex >= 0 && aIndex < count ) |
|
245 { |
|
246 CMemSpyEngineEComInterface& entry = iCategory.At( aIndex ); |
|
247 iCurrent = &entry; |
|
248 } |
|
249 else |
|
250 { |
|
251 iCurrent = NULL; |
|
252 } |
|
253 |
|
254 // Notify observer about item selection |
|
255 ReportEventL( MMemSpyViewObserver::EEventItemSelected ); |
|
256 } |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 CMemSpyViewEComInterface::CMemSpyViewEComInterface( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComInterface& aInterface ) |
|
284 : CMemSpyViewBase( aEngine, aObserver ), iInterface( aInterface ) |
|
285 { |
|
286 } |
|
287 |
|
288 |
|
289 void CMemSpyViewEComInterface::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
|
290 { |
|
291 SetTitleL( iInterface.Name() ); |
|
292 |
|
293 // Finish construction |
|
294 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
|
295 |
|
296 // Select first item |
|
297 TInt index = KErrNotFound; |
|
298 if ( aSelectionRune != NULL ) |
|
299 { |
|
300 iCurrent = reinterpret_cast< CMemSpyEngineEComImplementation* >( aSelectionRune ); |
|
301 index = iInterface.IndexOf( *iCurrent ); |
|
302 } |
|
303 |
|
304 if ( index >= 0 && index < iInterface.Count() ) |
|
305 { |
|
306 iListBox->SetCurrentItemIndex( index ); |
|
307 HandleListBoxItemSelectedL( index ); |
|
308 iListBox->DrawDeferred(); |
|
309 } |
|
310 } |
|
311 |
|
312 |
|
313 void CMemSpyViewEComInterface::RefreshL() |
|
314 { |
|
315 SetListBoxModelL(); |
|
316 CMemSpyViewBase::RefreshL(); |
|
317 } |
|
318 |
|
319 |
|
320 TMemSpyViewType CMemSpyViewEComInterface::ViewType() const |
|
321 { |
|
322 return EMemSpyViewTypeEComInterface; |
|
323 } |
|
324 |
|
325 |
|
326 CMemSpyViewBase* CMemSpyViewEComInterface::PrepareParentViewL() |
|
327 { |
|
328 CMemSpyViewEComCategory* parent = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, iInterface.Category() ); |
|
329 CleanupStack::PushL( parent ); |
|
330 parent->ConstructL( Rect(), *Parent(), &iInterface ); |
|
331 CleanupStack::Pop( parent ); |
|
332 return parent; |
|
333 } |
|
334 |
|
335 |
|
336 CMemSpyViewBase* CMemSpyViewEComInterface::PrepareChildViewL() |
|
337 { |
|
338 CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComImplementation( iEngine, iObserver, *iCurrent ); |
|
339 CleanupStack::PushL( child ); |
|
340 child->ConstructL( Rect(), *Parent() ); |
|
341 CleanupStack::Pop( child ); |
|
342 return child; |
|
343 } |
|
344 |
|
345 |
|
346 void CMemSpyViewEComInterface::SetListBoxModelL() |
|
347 { |
|
348 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
|
349 listbox->Model()->SetItemTextArray( &iInterface ); |
|
350 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
351 } |
|
352 |
|
353 |
|
354 void CMemSpyViewEComInterface::HandleListBoxItemActionedL( TInt aIndex ) |
|
355 { |
|
356 const TInt count = iInterface.Count(); |
|
357 if ( aIndex >= 0 && aIndex < count ) |
|
358 { |
|
359 CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex ); |
|
360 iCurrent = &entry; |
|
361 } |
|
362 else |
|
363 { |
|
364 iCurrent = NULL; |
|
365 } |
|
366 |
|
367 // Notify observer about item selection |
|
368 ReportEventL( MMemSpyViewObserver::EEventItemActioned ); |
|
369 } |
|
370 |
|
371 |
|
372 void CMemSpyViewEComInterface::HandleListBoxItemSelectedL( TInt aIndex ) |
|
373 { |
|
374 const TInt count = iInterface.Count(); |
|
375 if ( aIndex >= 0 && aIndex < count ) |
|
376 { |
|
377 CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex ); |
|
378 iCurrent = &entry; |
|
379 } |
|
380 else |
|
381 { |
|
382 iCurrent = NULL; |
|
383 } |
|
384 |
|
385 // Notify observer about item selection |
|
386 ReportEventL( MMemSpyViewObserver::EEventItemSelected ); |
|
387 } |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 CMemSpyViewEComImplementation::CMemSpyViewEComImplementation( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComImplementation& aImplementation ) |
|
424 : CMemSpyViewBase( aEngine, aObserver ), iImplementation( aImplementation ) |
|
425 { |
|
426 } |
|
427 |
|
428 |
|
429 void CMemSpyViewEComImplementation::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
|
430 { |
|
431 SetTitleL( iImplementation.Name() ); |
|
432 |
|
433 // Finish construction |
|
434 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
|
435 |
|
436 // Select first item |
|
437 if ( iImplementation.MdcaCount() ) |
|
438 { |
|
439 iListBox->SetCurrentItemIndex( 0 ); |
|
440 HandleListBoxItemSelectedL( 0 ); |
|
441 iListBox->DrawDeferred(); |
|
442 } |
|
443 } |
|
444 |
|
445 |
|
446 void CMemSpyViewEComImplementation::RefreshL() |
|
447 { |
|
448 SetListBoxModelL(); |
|
449 CMemSpyViewBase::RefreshL(); |
|
450 } |
|
451 |
|
452 |
|
453 TMemSpyViewType CMemSpyViewEComImplementation::ViewType() const |
|
454 { |
|
455 return EMemSpyViewTypeEComImplementation; |
|
456 } |
|
457 |
|
458 |
|
459 CMemSpyViewBase* CMemSpyViewEComImplementation::PrepareParentViewL() |
|
460 { |
|
461 CMemSpyViewEComInterface* parent = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, iImplementation.Interface() ); |
|
462 CleanupStack::PushL( parent ); |
|
463 parent->ConstructL( Rect(), *Parent(), &iImplementation ); |
|
464 CleanupStack::Pop( parent ); |
|
465 return parent; |
|
466 } |
|
467 |
|
468 |
|
469 void CMemSpyViewEComImplementation::SetListBoxModelL() |
|
470 { |
|
471 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
|
472 listbox->Model()->SetItemTextArray( &iImplementation ); |
|
473 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
474 } |
|
475 |