130 // layout in respect of the whole screen as only the icon size is needed |
126 // layout in respect of the whole screen as only the icon size is needed |
131 layoutRect.LayoutRect(screenRect, AknLayoutScalable_Avkon::list_single_2graphic_pane_g2_cp4().LayoutLine()); |
127 layoutRect.LayoutRect(screenRect, AknLayoutScalable_Avkon::list_single_2graphic_pane_g2_cp4().LayoutLine()); |
132 |
128 |
133 TSize iconSize(layoutRect.Rect().Width(), layoutRect.Rect().Height()); |
129 TSize iconSize(layoutRect.Rect().Width(), layoutRect.Rect().Height()); |
134 |
130 |
135 // create icons for non-highlighted mode |
|
136 |
|
137 AknsUtils::CreateColorIconLC(skin, notSelectedSkinId, KAknsIIDQsnIconColors, |
131 AknsUtils::CreateColorIconLC(skin, notSelectedSkinId, KAknsIIDQsnIconColors, |
138 EAknsCIQsnIconColorsCG14, bitmap, mask, avkonbmpFilename, notSelectedIconId, |
132 EAknsCIQsnIconColorsCG14, bitmap, mask, avkonbmpFilename, notSelectedIconId, |
139 notSelectedMaskId, KRgbBlue, iconSize, EAspectRatioPreservedAndUnusedSpaceRemoved); |
133 notSelectedMaskId, KRgbBlue, iconSize, EAspectRatioPreservedAndUnusedSpaceRemoved); |
140 |
134 |
141 CGulIcon* iconNotSelected = CGulIcon::NewL(bitmap, mask); |
135 CGulIcon* iconNotSelected = CGulIcon::NewL(bitmap, mask); |
151 CGulIcon* iconSelected = CGulIcon::NewL(bitmap, mask); |
145 CGulIcon* iconSelected = CGulIcon::NewL(bitmap, mask); |
152 CleanupStack::Pop(2); //bitmap, mask |
146 CleanupStack::Pop(2); //bitmap, mask |
153 |
147 |
154 delete iIconSelected; |
148 delete iIconSelected; |
155 iIconSelected = iconSelected; |
149 iIconSelected = iconSelected; |
156 |
|
157 // create icons for highlighted mode |
|
158 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
159 AknsUtils::CreateColorIconLC(skin, notSelectedSkinId, KAknsIIDQsnIconColors, |
|
160 EAknsCIQsnIconColorsCG15, bitmap, mask, avkonbmpFilename, notSelectedIconId, |
|
161 notSelectedMaskId, KRgbBlue, iconSize, EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
162 |
|
163 CGulIcon* iconNotSelectedHighlighted = CGulIcon::NewL(bitmap, mask); |
|
164 CleanupStack::Pop(2); //bitmap, mask |
|
165 |
|
166 delete iIconNotSelectedHighlighted; |
|
167 iIconNotSelectedHighlighted = iconNotSelectedHighlighted; |
|
168 |
|
169 AknsUtils::CreateColorIconLC(skin, selectedSkinId, KAknsIIDQsnIconColors, |
|
170 EAknsCIQsnIconColorsCG15, bitmap, mask, avkonbmpFilename, selectedIconId, |
|
171 selectedMaskId, KRgbBlue, iconSize, EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
172 |
|
173 CGulIcon* iconSelectedHighlighted = CGulIcon::NewL(bitmap, mask); |
|
174 CleanupStack::Pop(2); //bitmap, mask |
|
175 |
|
176 delete iIconSelectedHighlighted; |
|
177 iIconSelectedHighlighted = iconSelectedHighlighted; |
|
178 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
179 } |
150 } |
180 |
151 |
181 // Base class overrides |
152 // Base class overrides |
182 |
153 |
183 // The model contains more than just the strings - need to override |
154 // The model contains more than just the strings - need to override |
239 |
210 |
240 // If not in the middle of an update, refresh a bit |
211 // If not in the middle of an update, refresh a bit |
241 if (!iUpdating) |
212 if (!iUpdating) |
242 { |
213 { |
243 // Refresh icon array |
214 // Refresh icon array |
244 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
245 if (iObserver) |
|
246 { |
|
247 UpdateIconArrayL(iObserver->IsControlOnFormHighlighted()); |
|
248 } |
|
249 #else |
|
250 UpdateIconArrayL(); |
215 UpdateIconArrayL(); |
251 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
252 |
216 |
253 // Report event |
217 // Report event |
254 ReportEventL(MMIDChoiceGroupModelObserver::EElementAdded); |
218 ReportEventL(MMIDChoiceGroupModelObserver::EElementAdded); |
255 } |
219 } |
256 } |
220 } |
274 |
238 |
275 // If not in the middle of an update, refresh a bit |
239 // If not in the middle of an update, refresh a bit |
276 if (!iUpdating) |
240 if (!iUpdating) |
277 { |
241 { |
278 // Refresh icon array |
242 // Refresh icon array |
279 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
280 if (iObserver) |
|
281 { |
|
282 UpdateIconArrayL(iObserver->IsControlOnFormHighlighted()); |
|
283 } |
|
284 #else |
|
285 UpdateIconArrayL(); |
243 UpdateIconArrayL(); |
286 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
287 |
244 |
288 // Report element addition |
245 // Report element addition |
289 ReportEventL(MMIDChoiceGroupModelObserver::EElementAdded); |
246 ReportEventL(MMIDChoiceGroupModelObserver::EElementAdded); |
290 } |
247 } |
291 } |
248 } |
333 |
290 |
334 // If not in the middle of an update, refresh a bit |
291 // If not in the middle of an update, refresh a bit |
335 if (!iUpdating) |
292 if (!iUpdating) |
336 { |
293 { |
337 // Refresh icon array. |
294 // Refresh icon array. |
338 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
339 if (iObserver) |
|
340 { |
|
341 UpdateIconArrayL(iObserver->IsControlOnFormHighlighted()); |
|
342 } |
|
343 #else |
|
344 UpdateIconArrayL(); |
295 UpdateIconArrayL(); |
345 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
346 |
296 |
347 // Update the looks of the control |
297 // Update the looks of the control |
348 ReportEventL(MMIDChoiceGroupModelObserver::EElementDeleted); |
298 ReportEventL(MMIDChoiceGroupModelObserver::EElementDeleted); |
349 } |
299 } |
350 } |
300 } |
364 |
314 |
365 // If not updating, refresh now |
315 // If not updating, refresh now |
366 if (!iUpdating) |
316 if (!iUpdating) |
367 { |
317 { |
368 // Recreate icon array |
318 // Recreate icon array |
369 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
370 if (iObserver) |
|
371 { |
|
372 UpdateIconArrayL(iObserver->IsControlOnFormHighlighted()); |
|
373 } |
|
374 #else |
|
375 UpdateIconArrayL(); |
319 UpdateIconArrayL(); |
376 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
377 |
320 |
378 // Report event |
321 // Report event |
379 ReportEventL(MMIDChoiceGroupModelObserver::EElementDeleted); |
322 ReportEventL(MMIDChoiceGroupModelObserver::EElementDeleted); |
380 } |
323 } |
381 } |
324 } |
406 |
349 |
407 // Refresh stuff, if not in the middle of an update |
350 // Refresh stuff, if not in the middle of an update |
408 if (!iUpdating) |
351 if (!iUpdating) |
409 { |
352 { |
410 // Icon may have changed, recreate array. |
353 // Icon may have changed, recreate array. |
411 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
412 if (iObserver) |
|
413 { |
|
414 UpdateIconArrayL(iObserver->IsControlOnFormHighlighted()); |
|
415 } |
|
416 #else |
|
417 UpdateIconArrayL(); |
354 UpdateIconArrayL(); |
418 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
419 |
355 |
420 // Report event |
356 // Report event |
421 ReportEventL(MMIDChoiceGroupModelObserver::EElementModified); |
357 ReportEventL(MMIDChoiceGroupModelObserver::EElementModified); |
422 } |
358 } |
423 } |
359 } |
452 CArrayPtr<CGulIcon>* CMIDChoiceGroupModel::IconArray(TBool aReCreate) |
388 CArrayPtr<CGulIcon>* CMIDChoiceGroupModel::IconArray(TBool aReCreate) |
453 { |
389 { |
454 if (aReCreate) |
390 if (aReCreate) |
455 { |
391 { |
456 // Recreate, trap & ignore leaves |
392 // Recreate, trap & ignore leaves |
457 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
458 if (iObserver) |
|
459 { |
|
460 TRAP_IGNORE( |
|
461 UpdateIconArrayL(iObserver->IsControlOnFormHighlighted())); |
|
462 } |
|
463 #else |
|
464 TRAP_IGNORE(UpdateIconArrayL()); |
393 TRAP_IGNORE(UpdateIconArrayL()); |
465 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
466 } |
394 } |
467 |
395 |
468 return iIconArray; |
396 return iIconArray; |
469 } |
397 } |
470 |
398 |
525 void CMIDChoiceGroupModel::EndUpdate() |
453 void CMIDChoiceGroupModel::EndUpdate() |
526 { |
454 { |
527 iUpdating = EFalse; |
455 iUpdating = EFalse; |
528 |
456 |
529 // Create array, refresh control |
457 // Create array, refresh control |
530 #ifdef RD_JAVA_S60_RELEASE_9_2 |
458 TRAPD(ignore, UpdateIconArrayL()); |
531 if (iObserver) |
|
532 { |
|
533 TRAP_IGNORE(UpdateIconArrayL(iObserver->IsControlOnFormHighlighted())); |
|
534 } |
|
535 #else |
|
536 TRAP_IGNORE(UpdateIconArrayL()); |
|
537 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
538 |
459 |
539 // Report update end (observer should redraw) |
460 // Report update end (observer should redraw) |
540 TRAP_IGNORE(ReportEventL(MMIDChoiceGroupModelObserver::EUpdateEnded)); |
461 TRAP(ignore, ReportEventL(MMIDChoiceGroupModelObserver::EUpdateEnded)); |
541 } |
462 } |
542 |
463 |
543 |
464 |
544 // Returns the index of the selected element in an exclusive |
465 // Returns the index of the selected element in an exclusive |
545 // choice, or -1 |
466 // choice, or -1 |
608 // This should be done every time the contents of the model are changed, |
529 // This should be done every time the contents of the model are changed, |
609 // or icon array is retrieved with the create flag set. |
530 // or icon array is retrieved with the create flag set. |
610 // NOTE that the indices in the array and the item strings should |
531 // NOTE that the indices in the array and the item strings should |
611 // be synchronised. The selection icon is always at index |
532 // be synchronised. The selection icon is always at index |
612 // 0 (selected) and 1 (not selected) |
533 // 0 (selected) and 1 (not selected) |
613 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
614 void CMIDChoiceGroupModel::UpdateIconArrayL(TBool aHighlighted) |
|
615 #else |
|
616 void CMIDChoiceGroupModel::UpdateIconArrayL() |
534 void CMIDChoiceGroupModel::UpdateIconArrayL() |
617 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
618 { |
535 { |
619 ASSERT(iElements); |
536 ASSERT(iElements); |
620 ASSERT(iIconArray); |
537 ASSERT(iIconArray); |
621 |
538 |
622 // Clear array, DO NOT DELETE icons |
539 // Clear array, DO NOT DELETE icons |
628 { |
545 { |
629 return; |
546 return; |
630 } |
547 } |
631 |
548 |
632 // First add the selection icons |
549 // First add the selection icons |
633 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
634 if (aHighlighted) |
|
635 { |
|
636 iIconArray->AppendL(iIconSelectedHighlighted); |
|
637 iIconArray->AppendL(iIconNotSelectedHighlighted); |
|
638 } |
|
639 else |
|
640 { |
|
641 iIconArray->AppendL(iIconSelected); |
|
642 iIconArray->AppendL(iIconNotSelected); |
|
643 } |
|
644 #else |
|
645 iIconArray->AppendL(iIconSelected); |
550 iIconArray->AppendL(iIconSelected); |
646 iIconArray->AppendL(iIconNotSelected); |
551 iIconArray->AppendL(iIconNotSelected); |
647 #endif // RD_JAVA_S60_RELEASE_9_2 |
|
648 |
552 |
649 // Then loop through the elements and add their icons |
553 // Then loop through the elements and add their icons |
650 for (TInt i = 0; i < nCount; i++) |
554 for (TInt i = 0; i < nCount; i++) |
651 { |
555 { |
652 CMIDChoiceGroupElement *pElement = ElementAt(i); |
556 CMIDChoiceGroupElement *pElement = ElementAt(i); |