136 // |
137 // |
137 // ----------------------------------------------------------------------------- |
138 // ----------------------------------------------------------------------------- |
138 // |
139 // |
139 CMmListBoxItemDrawer* CMmListBoxItemDrawer::NewLC( |
140 CMmListBoxItemDrawer* CMmListBoxItemDrawer::NewLC( |
140 CMmListBoxModel* aMmListBoxModel, |
141 CMmListBoxModel* aMmListBoxModel, |
141 const CFont* aFont, |
142 const CFont* aFont, |
142 CFormattedCellListBoxData* aFormattedCellData, |
143 CFormattedCellListBoxData* aFormattedCellData, |
143 TMmWidgetType aWidgetType, |
144 TMmWidgetType aWidgetType, |
144 CMmTemplateLibrary* aTemplateLibrary ) |
145 CMmTemplateLibrary* aTemplateLibrary ) |
145 { |
146 { |
146 CMmListBoxItemDrawer* self = new (ELeave)CMmListBoxItemDrawer( |
147 CMmListBoxItemDrawer* self = new ( ELeave ) CMmListBoxItemDrawer( |
147 aMmListBoxModel, aFont, aFormattedCellData, aWidgetType, |
148 aMmListBoxModel, aFont, aFormattedCellData, aWidgetType, |
148 aTemplateLibrary ); |
149 aTemplateLibrary ); |
149 CleanupStack::PushL(self); |
150 CleanupStack::PushL( self ); |
150 self->ConstructL(); |
151 self->ConstructL(); |
151 return self; |
152 return self; |
152 } |
153 } |
153 |
154 |
154 // ----------------------------------------------------------------------------- |
155 // ----------------------------------------------------------------------------- |
155 // |
156 // |
156 // ----------------------------------------------------------------------------- |
157 // ----------------------------------------------------------------------------- |
157 // |
158 // |
158 CMmListBoxItemDrawer* CMmListBoxItemDrawer::NewL( |
159 CMmListBoxItemDrawer* CMmListBoxItemDrawer::NewL( |
159 CMmListBoxModel* aMmListBoxModel, |
160 CMmListBoxModel* aMmListBoxModel, |
160 const CFont* aFont, |
161 const CFont* aFont, |
161 CFormattedCellListBoxData* aFormattedCellData, |
162 CFormattedCellListBoxData* aFormattedCellData, |
162 TMmWidgetType aWidgetType, |
163 TMmWidgetType aWidgetType, |
163 CMmTemplateLibrary* aTemplateLibrary ) |
164 CMmTemplateLibrary* aTemplateLibrary ) |
164 { |
165 { |
165 CMmListBoxItemDrawer* self = CMmListBoxItemDrawer::NewLC( |
166 CMmListBoxItemDrawer* self = CMmListBoxItemDrawer::NewLC( |
166 aMmListBoxModel, aFont, aFormattedCellData, aWidgetType, |
167 aMmListBoxModel, aFont, aFormattedCellData, aWidgetType, |
167 aTemplateLibrary ); |
168 aTemplateLibrary ); |
168 CleanupStack::Pop( self ); |
169 CleanupStack::Pop( self ); |
169 return self; |
170 return self; |
170 |
171 |
171 } |
172 } |
172 |
173 |
173 // ----------------------------------------------------------------------------- |
174 // ----------------------------------------------------------------------------- |
174 // |
175 // |
175 // ----------------------------------------------------------------------------- |
176 // ----------------------------------------------------------------------------- |
176 // |
177 // |
177 void CMmListBoxItemDrawer::SetView(CEikListBox * aView) |
178 void CMmListBoxItemDrawer::SetView( CEikListBox * aView ) |
178 { |
179 { |
179 iWidget = aView; |
180 iWidget = aView; |
180 } |
181 } |
181 |
182 |
182 // ----------------------------------------------------------------------------- |
183 // ----------------------------------------------------------------------------- |
191 // ----------------------------------------------------------------------------- |
192 // ----------------------------------------------------------------------------- |
192 // |
193 // |
193 // ----------------------------------------------------------------------------- |
194 // ----------------------------------------------------------------------------- |
194 // |
195 // |
195 void CMmListBoxItemDrawer::ConstructL() |
196 void CMmListBoxItemDrawer::ConstructL() |
196 { |
197 { |
197 iAnimator = CMmDrawerAnimator::NewL( *this ); |
198 iAnimator = CMmDrawerAnimator::NewL( *this ); |
198 iItemsDataCache = CMmItemsDataCache::NewL(); |
199 iItemsDataCache = CMmItemsDataCache::NewL(); |
199 iIsEditMode = EFalse; |
200 iIsEditMode = EFalse; |
200 iHighlightShown = EFalse; |
201 iHighlightShown = EFalse; |
201 iDrawMoveIndicators = ETrue; |
202 iDrawMoveIndicators = ETrue; |
202 } |
203 } |
203 |
204 |
204 // ----xm------------------------------------------------------------------------- |
205 // ----------------------------------------------------------------------------- |
205 // |
206 // |
206 // ----------------------------------------------------------------------------- |
207 // ----------------------------------------------------------------------------- |
207 // |
208 // |
208 void CMmListBoxItemDrawer::DrawEmptyItem( TInt aItemIndex, |
209 void CMmListBoxItemDrawer::DrawEmptyItem( TInt aItemIndex, |
209 TPoint aItemRectPos, TBool aViewIsDimmed ) const |
210 TPoint aItemRectPos, TBool aViewIsDimmed ) const |
210 { |
211 { |
211 TRect r( aItemRectPos, iItemCellSize ); |
212 TRect r( aItemRectPos, iItemCellSize ); |
212 |
213 |
213 CFormattedCellListBoxItemDrawer::DrawEmptyItem( aItemIndex, aItemRectPos, |
214 CFormattedCellListBoxItemDrawer::DrawEmptyItem( aItemIndex, aItemRectPos, |
214 aViewIsDimmed ); |
215 aViewIsDimmed ); |
215 |
216 |
216 const_cast<CMmListBoxItemDrawer*>(this)->DrawFloatingItems(r); |
217 const_cast<CMmListBoxItemDrawer*> ( this )->DrawFloatingItems( r ); |
217 } |
218 } |
218 |
219 |
219 // ----------------------------------------------------------------------------- |
220 // ----------------------------------------------------------------------------- |
220 // |
221 // |
221 // ----------------------------------------------------------------------------- |
222 // ----------------------------------------------------------------------------- |
222 // |
223 // |
223 TInt CMmListBoxItemDrawer::GetFloatingItemIndex(TMmFloatingItemType aType) const |
224 TInt CMmListBoxItemDrawer::GetFloatingItemIndex( TMmFloatingItemType aType ) const |
224 { |
225 { |
225 TInt ret (KErrNotFound); |
226 TInt ret( KErrNotFound ); |
226 TInt i(iFloatingItems.Count()-1); |
227 TInt i( iFloatingItems.Count() - 1 ); |
227 for(; i >= 0; i--) |
228 for( ; i >= 0; i-- ) |
228 { |
229 { |
229 if (iFloatingItems[i].GetFloatingItemType() == aType) |
230 if( iFloatingItems[i].GetFloatingItemType() == aType ) |
230 { |
231 { |
231 ret = i; |
232 ret = i; |
232 break; |
233 break; |
233 } |
234 } |
234 } |
235 } |
289 |
291 |
290 // ----------------------------------------------------------------------------- |
292 // ----------------------------------------------------------------------------- |
291 // |
293 // |
292 // ----------------------------------------------------------------------------- |
294 // ----------------------------------------------------------------------------- |
293 // |
295 // |
294 void CMmListBoxItemDrawer::DrawFloatingItems(TRect currentlyDrawnRect) |
296 void CMmListBoxItemDrawer::DrawFloatingItems( TRect currentlyDrawnRect ) |
295 { |
297 { |
296 TBool redrawItemBackground = IsRedrawItemBackgroundEnabled( ); |
298 TBool redrawItemBackground = IsRedrawItemBackgroundEnabled(); |
297 SetRedrawItemBackground( EFalse ); |
299 SetRedrawItemBackground( EFalse ); |
298 for(TInt i(iFloatingItems.Count()-1); i >= 0 ; i--) |
300 for( TInt i( iFloatingItems.Count() - 1 ); i >= 0; i-- ) |
299 { |
301 { |
300 TMmFloatingItemType type = iFloatingItems[i].GetFloatingItemType(); |
302 TMmFloatingItemType type = iFloatingItems[i].GetFloatingItemType(); |
301 if ( iFloatingItems[i].IsFloatingItemValid() ) |
303 if( iFloatingItems[i].IsFloatingItemValid() ) |
302 { |
304 { |
303 TInt drawnItemIndex = iFloatingItems[i].GetDrawnItemIndex(); |
305 TInt drawnItemIndex = iFloatingItems[i].GetDrawnItemIndex(); |
304 TSize size = iWidget->View()->ItemSize( drawnItemIndex ); |
306 TSize size = iWidget->View()->ItemSize( drawnItemIndex ); |
305 TRect rect( iFloatingItems[i].GetItemPosition(), iFloatingItems[i].GetItemPosition() + size); |
307 TRect rect( iFloatingItems[i].GetItemPosition(), iFloatingItems[i].GetItemPosition() + size); |
306 |
308 |
307 if (rect.Intersects(currentlyDrawnRect)) |
309 if( rect.Intersects( currentlyDrawnRect ) ) |
308 { |
310 { |
309 TInt tempZoomIconIndex = iZoomIconIndex; |
311 TInt tempZoomIconIndex = iZoomIconIndex; |
310 TInt tempZoomRatio = iIconAnimationZoomRatio; |
312 TInt tempZoomRatio = iIconAnimationZoomRatio; |
311 |
313 |
312 iZoomIconIndex = iFloatingItems[i].GetDrawnItemIndex(); |
314 iZoomIconIndex = iFloatingItems[i].GetDrawnItemIndex(); |
313 iIconAnimationZoomRatio = iFloatingItems[i].GetCurrentZoomRatio(); |
315 iIconAnimationZoomRatio = iFloatingItems[i].GetCurrentZoomRatio(); |
314 |
316 |
315 if ( ItemHasFloatingType( drawnItemIndex, EDrag) || |
317 if ( ItemHasFloatingType( drawnItemIndex, EDrag) || |
316 ItemHasFloatingType( drawnItemIndex, EDragTransition) ) |
318 ItemHasFloatingType( drawnItemIndex, EDragTransition) ) |
317 { |
319 { |
318 ClearFlags( CListItemDrawer::EPressedDownState ); |
320 ClearFlags( CListItemDrawer::EPressedDownState ); |
319 } |
321 } |
320 |
322 |
321 DrawActualItem( drawnItemIndex, rect, ETrue, EFalse, EFalse, EFalse ); |
323 DrawActualItem( drawnItemIndex, rect, ETrue, EFalse, EFalse, EFalse ); |
322 iIconAnimationZoomRatio = tempZoomRatio; |
324 iIconAnimationZoomRatio = tempZoomRatio; |
323 iZoomIconIndex = tempZoomIconIndex; |
325 iZoomIconIndex = tempZoomIconIndex; |
324 } |
326 } |
325 } |
327 } |
326 else |
328 else |
327 { |
329 { |
328 iFloatingItems.Remove(i); |
330 iFloatingItems.Remove( i ); |
329 } |
331 } |
330 } |
332 } |
331 SetRedrawItemBackground( redrawItemBackground ); |
333 SetRedrawItemBackground( redrawItemBackground ); |
332 } |
334 } |
333 |
335 |
334 // ----------------------------------------------------------------------------- |
336 // ----------------------------------------------------------------------------- |
335 // |
337 // |
336 // ----------------------------------------------------------------------------- |
338 // ----------------------------------------------------------------------------- |
337 // |
339 // |
338 TInt CMmListBoxItemDrawer::GetValidFloatingItemCount(TMmFloatingItemType aType) |
340 TInt CMmListBoxItemDrawer::GetValidFloatingItemCount(TMmFloatingItemType aType) |
339 { |
341 { |
340 TInt count (0); |
342 TInt count( 0 ); |
341 |
343 |
342 for(TInt i(iFloatingItems.Count()-1); i >= 0; i--) |
344 for( TInt i( iFloatingItems.Count() - 1 ); i >= 0; i-- ) |
343 { |
345 { |
344 if (iFloatingItems[i].GetFloatingItemType() == aType |
346 if( iFloatingItems[i].GetFloatingItemType() == aType |
345 && iFloatingItems[i].IsFloatingItemValid() ) |
347 && iFloatingItems[i].IsFloatingItemValid() ) |
346 count++; |
348 count++; |
347 } |
349 } |
348 return count; |
350 return count; |
349 } |
351 } |
350 // ----------------------------------------------------------------------------- |
352 // ----------------------------------------------------------------------------- |
351 // |
353 // |
352 // ----------------------------------------------------------------------------- |
354 // ----------------------------------------------------------------------------- |
353 // |
355 // |
354 void CMmListBoxItemDrawer::DrawItem(TInt aItemIndex, TPoint aItemRectPos, |
356 void CMmListBoxItemDrawer::DrawItem( TInt aItemIndex, TPoint aItemRectPos, |
355 TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized, |
357 TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized, |
356 TBool aViewIsDimmed) const |
358 TBool aViewIsDimmed) const |
357 { |
359 { |
358 if ( !Widget()->View()->RedrawDisabled() ) |
360 if( !Widget()->View()->RedrawDisabled() ) |
359 { |
361 { |
360 TBool highlightVisible = |
362 TBool highlightVisible = |
361 !( Flags() & CListItemDrawer::ESingleClickDisabledHighlight ); |
363 !( Flags() & CListItemDrawer::ESingleClickDisabledHighlight ); |
362 aItemIsCurrent = aItemIsCurrent && highlightVisible; |
364 aItemIsCurrent = aItemIsCurrent && highlightVisible; |
363 DoDrawItem( aItemIndex, aItemRectPos, aItemIsSelected, |
365 DoDrawItem( aItemIndex, aItemRectPos, aItemIsSelected, |
364 aItemIsCurrent, aViewIsEmphasized, aViewIsDimmed); |
366 aItemIsCurrent, aViewIsEmphasized, aViewIsDimmed ); |
365 } |
367 } |
366 } |
368 } |
367 // ----------------------------------------------------------------------------- |
369 // ----------------------------------------------------------------------------- |
368 // |
370 // |
369 // ----------------------------------------------------------------------------- |
371 // ----------------------------------------------------------------------------- |
370 // |
372 // |
371 void CMmListBoxItemDrawer::DoDrawItem(TInt aItemIndex, TPoint aItemRectPos, |
373 void CMmListBoxItemDrawer::DoDrawItem(TInt aItemIndex, TPoint aItemRectPos, |
372 TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized, |
374 TBool aItemIsSelected, TBool aItemIsCurrent, TBool aViewIsEmphasized, |
373 TBool aViewIsDimmed) const |
375 TBool aViewIsDimmed) const |
374 { |
376 { |
375 TSize itemCellSize = TSize( GetItemSize( aItemIndex, aItemIsCurrent )); |
377 TSize itemCellSize = TSize( GetItemSize( aItemIndex, aItemIsCurrent ) ); |
376 TRect actualItemRect(aItemRectPos, itemCellSize); |
378 TRect actualItemRect( aItemRectPos, itemCellSize ); |
377 |
379 |
378 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
380 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
379 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc ); |
381 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc ); |
380 if ( transApi ) |
382 if( transApi ) |
381 { |
383 { |
382 transApi->StartDrawing( MAknListBoxTfxInternal::EListView ); |
384 transApi->StartDrawing( MAknListBoxTfxInternal::EListView ); |
383 transApi->StopDrawing(); |
385 transApi->StopDrawing(); |
384 transApi->BeginRedraw( MAknListBoxTfxInternal::EListItem, |
386 transApi->BeginRedraw( MAknListBoxTfxInternal::EListItem, |
385 actualItemRect, aItemIndex ); |
387 actualItemRect, aItemIndex ); |
386 } |
388 } |
387 #endif |
389 #endif |
388 |
390 |
389 const_cast<CMmListBoxItemDrawer*>(this)->iLeftOverAreaUnderAnimatedItem = EFalse; |
391 const_cast<CMmListBoxItemDrawer*>(this)->iLeftOverAreaUnderAnimatedItem = EFalse; |
390 for(TInt i(iFloatingItems.Count()-1); i >= 0; i--) |
392 for( TInt i( iFloatingItems.Count() - 1 ); i >= 0; i-- ) |
391 { |
393 { |
392 if ( iFloatingItems[i].GetDrawnItemIndex() == aItemIndex |
394 if( iFloatingItems[i].GetDrawnItemIndex() == aItemIndex |
393 && iFloatingItems[i].IsFloatingItemValid() ) |
395 && iFloatingItems[i].IsFloatingItemValid() ) |
394 { |
396 { |
395 const_cast<CMmListBoxItemDrawer*>(this)->iLeftOverAreaUnderAnimatedItem = ETrue; |
397 const_cast<CMmListBoxItemDrawer*>(this)->iLeftOverAreaUnderAnimatedItem = ETrue; |
396 break; |
398 break; |
397 } |
399 } |
398 } |
400 } |
399 |
401 |
400 DrawActualItem(aItemIndex, actualItemRect, aItemIsCurrent, aViewIsEmphasized, |
402 DrawActualItem(aItemIndex, actualItemRect, aItemIsCurrent, aViewIsEmphasized, |
401 aViewIsDimmed, aItemIsSelected); |
403 aViewIsDimmed, aItemIsSelected); |
402 const_cast<CMmListBoxItemDrawer*>(this)->iLeftOverAreaUnderAnimatedItem = EFalse; |
404 const_cast<CMmListBoxItemDrawer*>(this)->iLeftOverAreaUnderAnimatedItem = EFalse; |
403 |
405 |
404 const_cast<CMmListBoxItemDrawer*>(this)->DrawFloatingItems(actualItemRect); |
406 const_cast<CMmListBoxItemDrawer*>(this)->DrawFloatingItems(actualItemRect); |
405 |
407 |
406 if (!AknLayoutUtils::PenEnabled() && IsEditMode()) |
408 if( !AknLayoutUtils::PenEnabled() && IsEditMode() ) |
407 { |
409 { |
408 const_cast<CMmListBoxItemDrawer*>(this)->DrawActualIndicatorItem( |
410 const_cast<CMmListBoxItemDrawer*> ( this )->DrawActualIndicatorItem( |
409 aItemIndex, actualItemRect ); |
411 aItemIndex, actualItemRect ); |
410 } |
412 } |
411 |
413 |
412 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
414 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
413 if ( transApi ) |
415 if( transApi ) |
414 { |
416 { |
415 transApi->EndRedraw( MAknListBoxTfxInternal::EListItem, aItemIndex ); |
417 transApi->EndRedraw( MAknListBoxTfxInternal::EListItem, aItemIndex ); |
416 } |
418 } |
417 #endif |
419 #endif |
418 |
420 |
419 |
421 |
421 } |
423 } |
422 // ----------------------------------------------------------------------------- |
424 // ----------------------------------------------------------------------------- |
423 // |
425 // |
424 // ----------------------------------------------------------------------------- |
426 // ----------------------------------------------------------------------------- |
425 // |
427 // |
426 void CMmListBoxItemDrawer::DrawItemText(TInt aItemIndex, |
428 void CMmListBoxItemDrawer::DrawItemText( TInt aItemIndex, |
427 const TRect &aItemTextRect, TBool aItemIsCurrent, |
429 const TRect &aItemTextRect, TBool aItemIsCurrent, |
428 TBool aViewIsEmphasized, TBool aItemIsSelected ) const |
430 TBool aViewIsEmphasized, TBool aItemIsSelected ) const |
429 { |
431 { |
430 TRAP_IGNORE( DoDrawItemTextL( aItemIndex, aItemTextRect, aItemIsCurrent, |
432 TRAP_IGNORE( DoDrawItemTextL( aItemIndex, aItemTextRect, aItemIsCurrent, |
431 aViewIsEmphasized, aItemIsSelected ) ); |
433 aViewIsEmphasized, aItemIsSelected ) ); |
432 } |
434 } |
433 |
435 |
434 // ----------------------------------------------------------------------------- |
436 // ----------------------------------------------------------------------------- |
435 // |
437 // |
436 // ----------------------------------------------------------------------------- |
438 // ----------------------------------------------------------------------------- |
437 // |
439 // |
438 void CMmListBoxItemDrawer::DoDrawItemTextL( TInt aItemIndex, const TRect |
440 void CMmListBoxItemDrawer::DoDrawItemTextL( TInt aItemIndex, const TRect |
439 &aItemTextRect, TBool aItemIsCurrent, TBool aViewIsEmphasized, |
441 &aItemTextRect, TBool aItemIsCurrent, TBool aViewIsEmphasized, |
440 TBool /* aItemIsSelected */) const |
442 TBool /* aItemIsSelected */) const |
441 { |
443 { |
442 CMmCacheForItem* cache = iItemsDataCache->GetItemCacheL( aItemIndex ); |
444 CMmCacheForItem* cache = iItemsDataCache->GetItemCacheL( aItemIndex ); |
443 cache->InvalidateIfCacheMayNotBeUsed( |
445 cache->InvalidateIfCacheMayNotBeUsed( |
444 aItemIsCurrent, iLastSubcellsSetupCode ); |
446 aItemIsCurrent, iLastSubcellsSetupCode ); |
445 |
447 |
446 if ( IsRedrawItemBackgroundEnabled() ) |
448 if( IsRedrawItemBackgroundEnabled() ) |
447 { |
449 { |
448 DrawBackgroundAndSeparatorLines( aItemTextRect ); |
450 DrawBackground( aItemTextRect ); |
449 } |
451 } |
450 |
452 |
451 if ( !iUseCache || !cache->IsValid() ) |
453 if ( !iUseCache || !cache->IsValid() ) |
452 { |
454 { |
453 SetupSubCellsL( aItemIsCurrent, aItemIndex ); |
455 SetupSubCellsL( aItemIsCurrent, aItemIndex ); |
454 } |
456 } |
455 __ASSERT_DEBUG( cache->IsValid(), User::Invariant() ); |
457 __ASSERT_DEBUG( cache->IsValid(), User::Invariant() ); |
456 |
458 |
457 FormattedCellData()->SetIconArray( cache->GetIconListL() ); |
459 FormattedCellData()->SetIconArray( cache->GetIconListL() ); |
458 |
460 |
459 TBool isFloating = !iUseCache && IsFloating( aItemIndex ); |
461 TBool isFloating = !iUseCache && IsFloating( aItemIndex ); |
460 if ( !!isFloating != !!iLastDrawnItemWasFloating ) // Ex-OR |
462 if( !!isFloating != !!iLastDrawnItemWasFloating ) // Ex-OR |
461 { |
463 { |
462 iLastDrawnItemWasFloating = isFloating; |
464 iLastDrawnItemWasFloating = isFloating; |
463 iColors = SetupColors( isFloating ); |
465 iColors = SetupColors( isFloating ); |
464 } |
466 } |
465 |
467 |
466 CFormattedCellListBoxData* data = static_cast<CFormattedCellListBoxData*>(iData); |
468 CFormattedCellListBoxData* data = static_cast<CFormattedCellListBoxData*>(iData); |
467 data->EnableMarqueeL( EFalse ); |
469 data->EnableMarqueeL( EFalse ); |
468 |
470 |
469 TBool highlightShown = ETrue; |
471 TBool highlightShown = ETrue; |
470 if (FormattedCellData()->RespectFocus() && !aViewIsEmphasized) |
472 if( FormattedCellData()->RespectFocus() && !aViewIsEmphasized ) |
471 { |
473 { |
472 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
474 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
473 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); |
475 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); |
474 if ( transApi ) |
476 if( transApi ) |
475 { |
477 { |
476 transApi->Remove( MAknListBoxTfxInternal::EListHighlight ); |
478 transApi->Remove( MAknListBoxTfxInternal::EListHighlight ); |
477 } |
479 } |
478 #endif |
480 #endif |
479 highlightShown = EFalse; |
481 highlightShown = EFalse; |
480 } |
482 } |
481 |
483 |
482 data->Draw( Properties(aItemIndex), *iGc, &( cache->GetItemText() ), aItemTextRect, |
484 data->Draw( Properties(aItemIndex), *iGc, &( cache->GetItemText() ), aItemTextRect, |
483 GetHighlightVisibility( aItemIndex, aItemIsCurrent, highlightShown ), iColors ); |
485 GetHighlightVisibility( aItemIndex, aItemIsCurrent, highlightShown ), iColors ); |
484 |
486 |
485 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
487 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
486 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); |
488 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); |
487 if ( transApi ) |
489 if( transApi ) |
488 { |
490 { |
489 transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); |
491 transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); |
490 } |
492 } |
491 #endif |
493 #endif |
492 |
494 |
493 if ( iMarqueeAdapter && aItemIsCurrent ) |
495 if( iMarqueeAdapter && aItemIsCurrent ) |
494 { |
496 { |
495 DEBUG(("CMmListBoxItemDrawer::DoDrawItemTextL - DrawMarquee")); |
497 DEBUG(("CMmListBoxItemDrawer::DoDrawItemTextL - DrawMarquee")); |
496 iMarqueeAdapter->DrawMarqueeL( *iGc ); |
498 iMarqueeAdapter->DrawMarqueeL( *iGc ); |
497 } |
499 } |
498 |
500 |
499 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
501 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
500 if ( transApi ) |
502 if( transApi ) |
501 { |
503 { |
502 transApi->StopDrawing(); |
504 transApi->StopDrawing(); |
503 } |
505 } |
504 #endif |
506 #endif |
505 |
507 |
506 ColumnData()->SetIconArray( NULL ); |
508 if( iDrawSeparatorLines ) |
|
509 { |
|
510 CMmListBoxView* view = static_cast<CMmListBoxView*>( iWidget->View() ); |
|
511 if( aItemIndex != ( view->ModelItemsCount() - 1 )) |
|
512 { |
|
513 AknListUtils::DrawSeparator( *iGc, aItemTextRect, iColors.iBack ); |
|
514 } |
|
515 } |
|
516 ColumnData()->SetIconArray( NULL ); |
|
517 |
507 } |
518 } |
508 |
519 |
509 // ----------------------------------------------------------------------------- |
520 // ----------------------------------------------------------------------------- |
510 // |
521 // |
511 // ----------------------------------------------------------------------------- |
522 // ----------------------------------------------------------------------------- |
594 aSubCellTemplate.iRectAccordingToParent.iBr |
618 aSubCellTemplate.iRectAccordingToParent.iBr |
595 = TPoint(ItemCellSize().iWidth * iIconAnimationZoomRatio, |
619 = TPoint(ItemCellSize().iWidth * iIconAnimationZoomRatio, |
596 ItemCellSize().iHeight * iIconAnimationZoomRatio); |
620 ItemCellSize().iHeight * iIconAnimationZoomRatio); |
597 |
621 |
598 aSubCellTemplate.iRectAccordingToParent.iTl = TPoint(0, 0); |
622 aSubCellTemplate.iRectAccordingToParent.iTl = TPoint(0, 0); |
599 SetupSubCellL( aSubCellTemplate, aIndex , aItemIndex); |
623 SetupSubCellL( aSubCellTemplate, aIndex, aItemIndex ); |
600 } |
624 } |
601 |
625 |
602 // ----------------------------------------------------------------------------- |
626 // ----------------------------------------------------------------------------- |
603 // |
627 // |
604 // ----------------------------------------------------------------------------- |
628 // ----------------------------------------------------------------------------- |
605 // |
629 // |
606 void CMmListBoxItemDrawer::SetupSubCellL( TTemplateChild aSubCellTemplate, |
630 void CMmListBoxItemDrawer::SetupSubCellL( TTemplateChild aSubCellTemplate, |
607 TInt aIndex, TInt aItemIndex ) const |
631 TInt aIndex, TInt aItemIndex ) const |
608 { |
632 { |
609 CFormattedCellListBoxData* data = static_cast<CFormattedCellListBoxData*>(iData); |
633 CFormattedCellListBoxData* data = static_cast<CFormattedCellListBoxData*>(iData); |
610 TInt width = aSubCellTemplate.iRectAccordingToParent.iBr.iX - aSubCellTemplate.iRectAccordingToParent.iTl.iX; |
634 TInt width = aSubCellTemplate.iRectAccordingToParent.iBr.iX - aSubCellTemplate.iRectAccordingToParent.iTl.iX; |
611 TInt height = aSubCellTemplate.iRectAccordingToParent.iBr.iY - aSubCellTemplate.iRectAccordingToParent.iTl.iY; |
635 TInt height = aSubCellTemplate.iRectAccordingToParent.iBr.iY - aSubCellTemplate.iRectAccordingToParent.iTl.iY; |
612 data->SetTransparentSubCellL(aIndex, ETrue); |
636 data->SetTransparentSubCellL( aIndex, ETrue ); |
613 data->SetSubCellSizeL( aIndex, TSize(width,height)); |
637 data->SetSubCellSizeL( aIndex, TSize( width, height ) ); |
614 data->SetSubCellIconSize( aIndex, TSize(width,height) ); |
638 data->SetSubCellIconSize( aIndex, TSize( width, height ) ); |
615 data->SetSubCellPositionL( aIndex, aSubCellTemplate.iRectAccordingToParent.iTl); |
639 data->SetSubCellPositionL( aIndex, aSubCellTemplate.iRectAccordingToParent.iTl); |
616 data->SetGraphicsSubCellL( aIndex, aSubCellTemplate.iIsImage ); |
640 data->SetGraphicsSubCellL( aIndex, aSubCellTemplate.iIsImage ); |
617 data->SetSubCellAlignmentL( aIndex, aSubCellTemplate.iTextAlign ); |
641 data->SetSubCellAlignmentL( aIndex, aSubCellTemplate.iTextAlign ); |
618 const CFont* font = AknLayoutUtils::FontFromId(aSubCellTemplate.iFontId); |
642 const CFont* font = AknLayoutUtils::FontFromId(aSubCellTemplate.iFontId); |
619 data->SetSubCellFontL (aIndex, font); |
643 data->SetSubCellFontL (aIndex, font); |
620 data->SetSubCellBaselinePosL( aIndex, |
644 data->SetSubCellBaselinePosL( aIndex, |
621 CAknLayoutFont::AsCAknLayoutFontOrNull( font )->TextPaneTopToBaseline() |
645 CAknLayoutFont::AsCAknLayoutFontOrNull( font )->TextPaneTopToBaseline() |
622 + aSubCellTemplate.iRectAccordingToParent.iTl.iY ); |
646 + aSubCellTemplate.iRectAccordingToParent.iTl.iY ); |
623 |
647 |
624 // If some text is clipped then marquee will do the drawing right after the subcell is drawn by ListBoxData. |
648 // If some text is clipped then marquee will do the drawing right after the subcell is drawn by ListBoxData. |
625 // Setting the subcell size to zero prevents ListBoxData from drawing the text. |
649 // Setting the subcell size to zero prevents ListBoxData from drawing the text. |
626 if (!aSubCellTemplate.iIsImage |
650 if (!aSubCellTemplate.iIsImage |
627 && !iIsMarqueeBeingDrawn |
651 && !iIsMarqueeBeingDrawn |
628 && ( aItemIndex == iWidget->View()->CurrentItemIndex() ) |
652 && ( aItemIndex == iWidget->View()->CurrentItemIndex() ) |
629 && !IsEditMode() |
653 && !IsEditMode() |
630 && iWidgetType == EListbox |
654 && iWidgetType == EListbox |
631 && iSubcellText |
655 && iSubcellText |
632 && iMarqueeAdapter->IsMarqueeEnabled() ) |
656 && iMarqueeAdapter->IsMarqueeEnabled() ) |
633 |
657 |
634 { |
658 { |
635 if (iMarqueeAdapter && IsTextClippedL( aSubCellTemplate, *iSubcellText ) |
659 if (iMarqueeAdapter && IsTextClippedL( aSubCellTemplate, *iSubcellText ) |
636 && STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() ) |
660 && STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() ) |
637 { |
661 { |
638 data->SetSubCellSizeL( aIndex, TSize(0,0)); |
662 data->SetSubCellSizeL( aIndex, TSize( 0, 0 ) ); |
639 const_cast<CMmListBoxItemDrawer*>(this)->AddSubcellMarqueeElementL( |
663 const_cast<CMmListBoxItemDrawer*> ( this )->AddSubcellMarqueeElementL( |
640 aSubCellTemplate, aIndex, aItemIndex); |
664 aSubCellTemplate, aIndex, aItemIndex ); |
641 } |
665 } |
642 else if (iMarqueeAdapter) |
666 else if( iMarqueeAdapter ) |
643 { |
667 { |
644 iMarqueeAdapter->StopMarqueeDrawing(aIndex); |
668 iMarqueeAdapter->StopMarqueeDrawing( aIndex ); |
645 } |
669 } |
646 } |
670 } |
647 |
671 |
648 if ( iMarqueeAdapter && iIsMarqueeBeingDrawn |
672 if( iMarqueeAdapter && iIsMarqueeBeingDrawn |
649 && iMarqueeAdapter->SubcellMarqueeElementExists( aIndex ) ) |
673 && iMarqueeAdapter->SubcellMarqueeElementExists( aIndex ) ) |
650 { |
674 { |
651 if (aItemIndex != iWidget->View()->CurrentItemIndex() ) |
675 if( aItemIndex != iWidget->View()->CurrentItemIndex() ) |
652 { |
676 { |
653 iMarqueeAdapter->StopMarqueeDrawing(aIndex); |
677 iMarqueeAdapter->StopMarqueeDrawing( aIndex ); |
654 } |
678 } |
655 else |
679 else |
656 { |
680 { |
657 data->SetSubCellSizeL(aIndex, TSize(0, 0)); |
681 data->SetSubCellSizeL( aIndex, TSize( 0, 0 ) ); |
658 } |
682 } |
659 } |
683 } |
660 } |
684 } |
661 |
685 |
662 // ----------------------------------------------------------------------------- |
686 // ----------------------------------------------------------------------------- |
663 // |
687 // |
664 // ----------------------------------------------------------------------------- |
688 // ----------------------------------------------------------------------------- |
665 // |
689 // |
666 CFormattedCellListBoxData::TColors CMmListBoxItemDrawer::SetupColors( TBool aDragged ) const |
690 CFormattedCellListBoxData::TColors CMmListBoxItemDrawer::SetupColors( TBool aDragged ) const |
667 { |
691 { |
668 CFormattedCellListBoxData::TColors colors; |
692 CFormattedCellListBoxData::TColors colors; |
669 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
693 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
670 |
694 |
671 if ( !aDragged ) |
695 if( !aDragged ) |
672 { |
696 { |
673 AknsUtils::GetCachedColor( skin, colors.iText, KAknsIIDQsnTextColors, |
697 AknsUtils::GetCachedColor( skin, colors.iText, KAknsIIDQsnTextColors, |
674 EAknsCIQsnTextColorsCG9 ); |
698 EAknsCIQsnTextColorsCG9 ); |
675 AknsUtils::GetCachedColor( skin, colors.iBack , KAknsIIDQsnTextColors, |
699 AknsUtils::GetCachedColor( skin, colors.iBack , KAknsIIDQsnTextColors, |
676 EAknsCIQsnOtherColorsCG6 ); |
700 EAknsCIQsnOtherColorsCG6 ); |
677 AknsUtils::GetCachedColor( skin, colors.iHighlightedText, |
701 AknsUtils::GetCachedColor( skin, colors.iHighlightedText, |
678 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 ); |
702 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 ); |
679 AknsUtils::GetCachedColor( skin, colors.iHighlightedBack, |
703 AknsUtils::GetCachedColor( skin, colors.iHighlightedBack, |
680 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
704 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
681 } |
705 } |
682 else |
706 else |
683 { |
707 { |
684 AknsUtils::GetCachedColor( skin, colors.iText, KAknsIIDQsnTextColors, |
708 AknsUtils::GetCachedColor( skin, colors.iText, KAknsIIDQsnTextColors, |
685 EAknsCIQsnTextColorsCG11 ); |
709 EAknsCIQsnTextColorsCG11 ); |
686 AknsUtils::GetCachedColor( skin, colors.iBack , KAknsIIDQsnTextColors, |
710 AknsUtils::GetCachedColor( skin, colors.iBack , KAknsIIDQsnTextColors, |
687 EAknsCIQsnTextColorsCG6 ); |
711 EAknsCIQsnTextColorsCG6 ); |
688 AknsUtils::GetCachedColor( skin, colors.iHighlightedText, |
712 AknsUtils::GetCachedColor( skin, colors.iHighlightedText, |
689 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 ); |
713 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 ); |
690 AknsUtils::GetCachedColor( skin, colors.iHighlightedBack, |
714 AknsUtils::GetCachedColor( skin, colors.iHighlightedBack, |
691 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
715 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 ); |
692 } |
716 } |
693 |
717 |
694 return colors; |
718 return colors; |
695 } |
719 } |
696 |
720 |
697 // ----------------------------------------------------------------------------- |
721 // ----------------------------------------------------------------------------- |
698 // |
722 // |
699 // ----------------------------------------------------------------------------- |
723 // ----------------------------------------------------------------------------- |
700 // |
724 // |
701 TInt CMmListBoxItemDrawer::GetItemHeight( TInt aItemIndex, TBool aItemIsCurrent ) const |
725 TInt CMmListBoxItemDrawer::GetItemHeight( TInt aItemIndex, TBool aItemIsCurrent ) const |
702 { |
726 { |
703 TSize ret(TInt(0),TInt(0)); |
727 TSize ret( TInt( 0 ), TInt( 0 ) ); |
704 ret = GetItemSize(aItemIndex, aItemIsCurrent); |
728 ret = GetItemSize( aItemIndex, aItemIsCurrent ); |
705 return ret.iHeight; |
729 return ret.iHeight; |
706 } |
730 } |
707 |
731 |
708 // ----------------------------------------------------------------------------- |
732 // ----------------------------------------------------------------------------- |
709 // |
733 // |
710 // ----------------------------------------------------------------------------- |
734 // ----------------------------------------------------------------------------- |
711 // |
735 // |
712 TInt CMmListBoxItemDrawer::GetFloatingItemCount() |
736 TInt CMmListBoxItemDrawer::GetFloatingItemCount() |
713 { |
737 { |
714 for( TInt i=0; i< iFloatingItems.Count(); i++) |
738 for( TInt i = 0; i < iFloatingItems.Count(); i++ ) |
715 { |
739 { |
716 TMmFloatingItem& current = GetFloatingItemAtIndex(i); |
740 TMmFloatingItem& current = GetFloatingItemAtIndex( i ); |
717 if (current.GetDrawnItemIndex() == KErrNotFound) |
741 if( current.GetDrawnItemIndex() == KErrNotFound ) |
718 { |
742 { |
719 RemoveFloatingItem(i); |
743 RemoveFloatingItem( i ); |
720 } |
744 } |
721 } |
745 } |
722 |
746 |
723 return iFloatingItems.Count(); |
747 return iFloatingItems.Count(); |
724 } |
748 } |
725 |
749 |
726 // ----------------------------------------------------------------------------- |
750 // ----------------------------------------------------------------------------- |
727 // |
751 // |
728 // ----------------------------------------------------------------------------- |
752 // ----------------------------------------------------------------------------- |
729 // |
753 // |
730 TMmFloatingItem& CMmListBoxItemDrawer::GetFloatingItemAtIndex( TInt aIndex ) |
754 TMmFloatingItem& CMmListBoxItemDrawer::GetFloatingItemAtIndex( TInt aIndex ) |
731 { |
755 { |
732 return iFloatingItems[ aIndex ]; |
756 return iFloatingItems[aIndex]; |
733 } |
757 } |
734 |
758 |
735 // ----------------------------------------------------------------------------- |
759 // ----------------------------------------------------------------------------- |
736 // |
760 // |
737 // ----------------------------------------------------------------------------- |
761 // ----------------------------------------------------------------------------- |
738 // |
762 // |
739 void CMmListBoxItemDrawer::RemoveFloatingItem( TInt aPosition ) |
763 void CMmListBoxItemDrawer::RemoveFloatingItem( TInt aPosition ) |
740 { |
764 { |
741 if (aPosition != KErrNotFound) |
765 if( aPosition != KErrNotFound ) |
742 { |
766 { |
743 iFloatingItems.Remove( aPosition ); |
767 iFloatingItems.Remove( aPosition ); |
744 } |
768 } |
745 } |
769 } |
746 |
770 |
747 // ----------------------------------------------------------------------------- |
771 // ----------------------------------------------------------------------------- |
748 // |
772 // |
749 // ----------------------------------------------------------------------------- |
773 // ----------------------------------------------------------------------------- |
915 TMmFloatingItem floatingItem( item.GetDrawnItemIndex(), |
939 TMmFloatingItem floatingItem( item.GetDrawnItemIndex(), |
916 aPoint, EDrag, MmEffects::KNoAnimationFramesCount, NULL ); |
940 aPoint, EDrag, MmEffects::KNoAnimationFramesCount, NULL ); |
917 floatingItem.SetManualDelete( ETrue ); |
941 floatingItem.SetManualDelete( ETrue ); |
918 |
942 |
919 TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(), |
943 TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(), |
920 item.GetItemPosition(), EPostDragRefreshItem, |
944 item.GetItemPosition(), EPostDragRefreshItem, |
921 MmEffects::KNoAnimationFramesCount, iWidget->View() ); |
945 MmEffects::KNoAnimationFramesCount, iWidget->View() ); |
922 |
946 |
923 iFloatingItems.Remove(dragFloatingItem); |
947 iFloatingItems.Remove( dragFloatingItem ); |
924 |
948 |
925 if (postDragRefresh.GetItemPosition() != floatingItem.GetItemPosition()) |
949 if (postDragRefresh.GetItemPosition() != floatingItem.GetItemPosition()) |
926 { |
950 { |
927 iFloatingItems.Append( postDragRefresh ); |
951 iFloatingItems.Append( postDragRefresh ); |
928 } |
952 } |
929 iFloatingItems.Insert( floatingItem, 0 ); |
953 iFloatingItems.Insert( floatingItem, 0 ); |
930 } |
954 } |
931 } |
955 } |
932 |
956 |
933 // ----------------------------------------------------------------------------- |
957 // ----------------------------------------------------------------------------- |
934 // |
958 // |
935 // ----------------------------------------------------------------------------- |
959 // ----------------------------------------------------------------------------- |
936 // |
960 // |
937 void CMmListBoxItemDrawer::SetDraggedIndexL(TInt aDraggedItemIndex, |
961 void CMmListBoxItemDrawer::SetDraggedIndexL( TInt aDraggedItemIndex, |
938 TPoint aPoint) |
962 TPoint aPoint ) |
939 { |
963 { |
940 TInt dragFloatingItem = KErrNotFound; |
964 TInt dragFloatingItem = KErrNotFound; |
941 do |
965 do |
942 { |
966 { |
943 dragFloatingItem = GetFloatingItemIndex(EDrag); |
967 dragFloatingItem = GetFloatingItemIndex( EDrag ); |
944 if (dragFloatingItem != KErrNotFound) |
968 if( dragFloatingItem != KErrNotFound ) |
945 { |
969 { |
946 TMmFloatingItem & item = GetFloatingItemAtIndex( dragFloatingItem ); |
970 TMmFloatingItem & item = GetFloatingItemAtIndex( dragFloatingItem ); |
947 |
971 |
948 TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(), |
972 TMmFloatingItem postDragRefresh( item.GetDrawnItemIndex(), |
949 item.GetItemPosition(), EPostDragRefreshItem, |
973 item.GetItemPosition(), EPostDragRefreshItem, |
950 MmEffects::KNoAnimationFramesCount, iWidget->View() ); |
974 MmEffects::KNoAnimationFramesCount, iWidget->View() ); |
951 |
975 |
952 if (postDragRefresh.GetItemPosition() != aPoint) |
976 if( postDragRefresh.GetItemPosition() != aPoint ) |
953 { |
977 { |
954 iFloatingItems.Append( postDragRefresh ); |
978 iFloatingItems.Append( postDragRefresh ); |
955 } |
979 } |
956 } |
980 } |
957 |
981 |
958 RemoveFloatingItem( dragFloatingItem ); |
982 RemoveFloatingItem( dragFloatingItem ); |
959 |
983 |
960 } |
984 } |
961 while ( dragFloatingItem != KErrNotFound ); |
985 while( dragFloatingItem != KErrNotFound ); |
962 |
986 |
963 if ( aDraggedItemIndex != KErrNotFound ) |
987 if( aDraggedItemIndex != KErrNotFound ) |
964 { |
988 { |
965 TMmFloatingItem floatingItem( aDraggedItemIndex, aPoint, EDrag, |
989 TMmFloatingItem floatingItem( aDraggedItemIndex, aPoint, EDrag, |
966 MmEffects::KNoAnimationFramesCount, iWidget->View() ); |
990 MmEffects::KNoAnimationFramesCount, iWidget->View() ); |
967 floatingItem.SetManualDelete( ETrue ); |
991 floatingItem.SetManualDelete( ETrue ); |
968 AddFloatingItemL(floatingItem, 0); |
992 AddFloatingItemL( floatingItem, 0 ); |
969 |
993 |
970 ClearFlags( CListItemDrawer::EPressedDownState ); |
994 ClearFlags( CListItemDrawer::EPressedDownState ); |
971 } |
995 } |
972 |
996 |
973 iAnimator->Trigger(); |
997 iAnimator->Trigger(); |
974 } |
998 } |
975 |
999 |
976 // ----------------------------------------------------------------------------- |
1000 // ----------------------------------------------------------------------------- |
985 // ----------------------------------------------------------------------------- |
1009 // ----------------------------------------------------------------------------- |
986 // |
1010 // |
987 // ----------------------------------------------------------------------------- |
1011 // ----------------------------------------------------------------------------- |
988 // |
1012 // |
989 void CMmListBoxItemDrawer::SetBgContext( |
1013 void CMmListBoxItemDrawer::SetBgContext( |
990 CAknsBasicBackgroundControlContext * aBgContext ) |
1014 CAknsBasicBackgroundControlContext * aBgContext ) |
991 { |
1015 { |
992 iBgContext = aBgContext; |
1016 iBgContext = aBgContext; |
993 } |
1017 } |
994 |
1018 |
995 // ----------------------------------------------------------------------------- |
1019 // ----------------------------------------------------------------------------- |
996 // |
1020 // |
997 // ----------------------------------------------------------------------------- |
1021 // ----------------------------------------------------------------------------- |
998 // |
1022 // |
999 void CMmListBoxItemDrawer::SetScrollbarVisibilityL( TBool aIsScrollbarVisible ) |
1023 void CMmListBoxItemDrawer::SetScrollbarVisibilityL( TBool aIsScrollbarVisible ) |
1000 { |
1024 { |
1001 iTemplateLibrary->SetScrollbarVisibilityL( aIsScrollbarVisible ); |
1025 iTemplateLibrary->SetScrollbarVisibilityL( aIsScrollbarVisible ); |
1002 } |
1026 } |
1003 |
1027 |
1004 // ----------------------------------------------------------------------------- |
1028 // ----------------------------------------------------------------------------- |
1005 // |
1029 // |
1006 // ----------------------------------------------------------------------------- |
1030 // ----------------------------------------------------------------------------- |
1007 // |
1031 // |
1008 TRect CMmListBoxItemDrawer::AdjustItemRect( TInt aItemIndex ) const |
1032 TRect CMmListBoxItemDrawer::AdjustItemRect( TInt aItemIndex ) const |
1009 { |
1033 { |
1010 TSize size = iWidget->View()->ItemSize (iWidget->View()->CurrentItemIndex () ); |
1034 TSize size = iWidget->View()->ItemSize (iWidget->View()->CurrentItemIndex () ); |
1011 TRect rect(iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ), |
1035 TRect rect(iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ), |
1012 iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ) + size); |
1036 iWidget->View()->ItemPos (iWidget->View()->CurrentItemIndex () ) + size); |
1013 if ( !AknLayoutUtils::PenEnabled () && iIsIndicatorItem) |
1037 if( !AknLayoutUtils::PenEnabled() && iIsIndicatorItem ) |
1014 { |
1038 { |
1015 TBool landscapeOrientation = |
1039 TBool landscapeOrientation = |
1016 Layout_Meta_Data::IsLandscapeOrientation (); |
1040 Layout_Meta_Data::IsLandscapeOrientation(); |
1017 const TDesC8& mm_template = iMmModel->GetAttributeAsText ( |
1041 const TDesC8& mm_template = iMmModel->GetAttributeAsText ( |
1018 0, KMmTemplate8); |
1042 0, KMmTemplate8); |
1019 TRect relativeToParentRect = TRect (TPoint (0, 0), TPoint (0, 0)); |
1043 TRect relativeToParentRect = TRect( TPoint( 0, 0 ), TPoint( 0, 0 ) ); |
1020 relativeToParentRect = iTemplateLibrary->GetMoveIndicatorRect( |
1044 relativeToParentRect = iTemplateLibrary->GetMoveIndicatorRect( |
1021 iWidgetType, mm_template, landscapeOrientation, |
1045 iWidgetType, mm_template, landscapeOrientation, |
1022 aItemIndex == iWidget->View()->CurrentItemIndex () ); |
1046 aItemIndex == iWidget->View()->CurrentItemIndex () ); |
1023 rect.Move (relativeToParentRect.iTl); |
1047 rect.Move( relativeToParentRect.iTl ); |
1024 rect.iBr.iX = rect.iBr.iX + relativeToParentRect.Width (); |
1048 rect.iBr.iX = rect.iBr.iX + relativeToParentRect.Width(); |
1025 rect.iBr.iY = rect.iBr.iY + relativeToParentRect.Height (); |
1049 rect.iBr.iY = rect.iBr.iY + relativeToParentRect.Height(); |
1026 } |
1050 } |
1027 return rect; |
1051 return rect; |
1028 } |
1052 } |
1029 |
1053 |
1030 // ----------------------------------------------------------------------------- |
1054 // ----------------------------------------------------------------------------- |
1031 // |
1055 // |
1032 // ----------------------------------------------------------------------------- |
1056 // ----------------------------------------------------------------------------- |
1033 // |
1057 // |
1038 iIsIndicatorItem = ETrue; |
1062 iIsIndicatorItem = ETrue; |
1039 TBool redrawItemBackground = |
1063 TBool redrawItemBackground = |
1040 IsRedrawItemBackgroundEnabled( ); |
1064 IsRedrawItemBackgroundEnabled( ); |
1041 SetRedrawItemBackground( EFalse ); |
1065 SetRedrawItemBackground( EFalse ); |
1042 |
1066 |
1043 DrawActualItem( aItemIndex, AdjustItemRect( aItemIndex ) , EFalse, EFalse, EFalse, EFalse); |
1067 DrawActualItem( aItemIndex, AdjustItemRect( aItemIndex ) , EFalse, EFalse, EFalse, EFalse); |
1044 |
1068 |
1045 SetRedrawItemBackground( redrawItemBackground ); |
1069 SetRedrawItemBackground( redrawItemBackground ); |
1046 iIsIndicatorItem = EFalse; |
1070 iIsIndicatorItem = EFalse; |
1047 } |
1071 } |
1048 } |
1072 } |
1049 |
1073 |
1050 // ----------------------------------------------------------------------------- |
1074 // ----------------------------------------------------------------------------- |
1051 // |
1075 // |
1052 // ----------------------------------------------------------------------------- |
1076 // ----------------------------------------------------------------------------- |
1053 // |
1077 // |
1054 void CMmListBoxItemDrawer::ReplaceSubCellText( const TDesC& aText ) |
1078 void CMmListBoxItemDrawer::ReplaceSubCellText( const TDesC& aText ) |
1055 { |
1079 { |
1056 delete iSubcellText; |
1080 delete iSubcellText; |
1057 iSubcellText = NULL; |
1081 iSubcellText = NULL; |
1058 if( aText.Compare( KNullDesC() ) ) |
1082 if( aText.Compare( KNullDesC() ) ) |
1059 { |
1083 { |
1060 iSubcellText = aText.Alloc(); |
1084 iSubcellText = aText.Alloc(); |
1061 } |
1085 } |
1062 } |
1086 } |
1063 |
1087 |
1064 // ----------------------------------------------------------------------------- |
1088 // ----------------------------------------------------------------------------- |
1065 // |
1089 // |
1066 // ----------------------------------------------------------------------------- |
1090 // ----------------------------------------------------------------------------- |
1067 // |
1091 // |
1068 void CMmListBoxItemDrawer::AddSubcellMarqueeElementL( TTemplateChild aSubCellTemplate, TInt aIndex, TInt aItemIndex ) |
1092 void CMmListBoxItemDrawer::AddSubcellMarqueeElementL( TTemplateChild aSubCellTemplate, TInt aIndex, TInt aItemIndex ) |
1069 { |
1093 { |
1070 TRgb textColor; |
1094 TRgb textColor; |
1071 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1095 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1072 AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 ); |
1096 AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 ); |
1073 iMarqueeAdapter->AddMarqueeElementL( aSubCellTemplate.iRectAccordingToParent, *iSubcellText, |
1097 iMarqueeAdapter->AddMarqueeElementL( aSubCellTemplate.iRectAccordingToParent, *iSubcellText, |
1074 aSubCellTemplate.iFontId, textColor, aSubCellTemplate.iTextAlign, aIndex, |
1098 aSubCellTemplate.iFontId, textColor, aSubCellTemplate.iTextAlign, aIndex, |
1075 aSubCellTemplate.iRectAccordingToParent.iTl.iY, |
1099 aSubCellTemplate.iRectAccordingToParent.iTl.iY, |
1076 aItemIndex); |
1100 aItemIndex); |
1077 } |
1101 } |
1078 |
1102 |
1079 // ----------------------------------------------------------------------------- |
1103 // ----------------------------------------------------------------------------- |
1080 // |
1104 // |
1081 // ----------------------------------------------------------------------------- |
1105 // ----------------------------------------------------------------------------- |
1082 // |
1106 // |
1083 void CMmListBoxItemDrawer::SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter ) |
1107 void CMmListBoxItemDrawer::SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter ) |
1084 { |
1108 { |
1085 iMarqueeAdapter = aAdapter; |
1109 iMarqueeAdapter = aAdapter; |
1086 } |
1110 } |
1087 |
1111 |
1088 // ----------------------------------------------------------------------------- |
1112 // ----------------------------------------------------------------------------- |
1089 // |
1113 // |
1090 // ----------------------------------------------------------------------------- |
1114 // ----------------------------------------------------------------------------- |
1091 // |
1115 // |
1133 child.iImageVisualId == EImageVisualIdEditMode ) |
1157 child.iImageVisualId == EImageVisualIdEditMode ) |
1134 { |
1158 { |
1135 child.iIsImage = EFalse; |
1159 child.iIsImage = EFalse; |
1136 } |
1160 } |
1137 |
1161 |
1138 if ( IsDraggable() && aItemIndex == iZoomIconIndex ) |
1162 if( IsEditMode() && IsDraggable() && aItemIndex == iZoomIconIndex ) |
1139 { |
1163 { |
1140 const TReal KNormalZoomRatio = 1.0; |
1164 const TReal KNormalZoomRatio = 1.0; |
1141 TReal zoomDelta = ( iIconAnimationZoomRatio - KNormalZoomRatio ) / 2.0; |
1165 TReal zoomDelta = ( iIconAnimationZoomRatio - KNormalZoomRatio ) / 2.0; |
1142 TSize size = child.iRectAccordingToParent.Size(); |
1166 TSize size = child.iRectAccordingToParent.Size(); |
1143 TSize sizeDelta( size.iWidth * zoomDelta, size.iHeight * zoomDelta ); |
1167 TSize sizeDelta( size.iWidth * zoomDelta, size.iHeight * zoomDelta ); |
1144 child.iRectAccordingToParent.Grow( sizeDelta ); |
1168 child.iRectAccordingToParent.Grow( sizeDelta ); |
1145 } |
1169 TInt targetZoom( KZoomStateZoomRatio * 100 ); |
1146 |
1170 Math::Round( zoomDelta, ( zoomDelta * 1000 ), 0); |
1147 TSize targetSize = child.iRectAccordingToParent.Size(); |
1171 if( (TInt)zoomDelta == targetZoom ) |
1148 |
1172 { |
1149 CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics( |
1173 static_cast<CMmWidgetContainer*> (Widget()->Parent())->SetAllowMove( ETrue ); |
1150 aItemIndex, child.iData, &targetSize ); |
1174 } |
1151 icon = iconHolder ? iconHolder->GetGulIcon() : NULL; |
1175 } |
1152 if ( icon ) |
1176 |
1153 { |
1177 TSize targetSize = child.iRectAccordingToParent.Size(); |
1154 CFbsBitmap* bitmap = icon->Bitmap(); |
1178 |
1155 ASSERT( bitmap ); |
1179 CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics( |
1156 //resize the item if it is a move indicator |
1180 aItemIndex, child.iData, &targetSize ); |
1157 if( iIsIndicatorItem ) |
1181 icon = iconHolder ? iconHolder->GetGulIcon() : NULL; |
1158 { |
1182 if( icon ) |
|
1183 { |
|
1184 CFbsBitmap* bitmap = icon->Bitmap(); |
|
1185 ASSERT( bitmap ); |
|
1186 //resize the item if it is a move indicator |
|
1187 if( iIsIndicatorItem ) |
|
1188 { |
1159 AknIconUtils::SetSize( bitmap, child.iRectAccordingToParent.Size(), |
1189 AknIconUtils::SetSize( bitmap, child.iRectAccordingToParent.Size(), |
1160 EAspectRatioNotPreserved ); |
1190 EAspectRatioNotPreserved ); |
1161 } |
1191 } |
1162 else |
1192 else |
1163 { |
1193 { |
1164 TSize bmpSize = bitmap->SizeInPixels(); |
1194 TSize bmpSize = bitmap->SizeInPixels(); |
1165 TBool setSizeRequired = bitmap->DisplayMode() == ENone; |
1195 TBool setSizeRequired = bitmap->DisplayMode() == ENone; |
1166 if ( targetSize.iWidth && targetSize.iHeight && |
1196 if ( targetSize.iWidth && targetSize.iHeight && |
1167 ( setSizeRequired || !BitmapFitsIntoTarget( bmpSize, targetSize ) ) ) |
1197 ( setSizeRequired || !BitmapFitsIntoTarget( bmpSize, targetSize ) ) ) |
1168 { |
1198 { |
1169 CFbsBitmap* mask = icon->Mask(); |
1199 CFbsBitmap* mask = icon->Mask(); |
1170 if ( mask ) |
1200 if( mask ) |
1171 { |
1201 { |
1172 __ASSERT_DEBUG( bmpSize == mask->SizeInPixels(), User::Invariant() ); |
1202 __ASSERT_DEBUG( bmpSize == mask->SizeInPixels(), User::Invariant() ); |
1173 AknIconUtils::SetSize( mask, targetSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); |
1203 AknIconUtils::SetSize( mask, targetSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); |
1174 } |
1204 } |
1175 AknIconUtils::SetSize( bitmap, targetSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); |
1205 AknIconUtils::SetSize( bitmap, targetSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); |
1176 } |
|
1177 } |
1206 } |
|
1207 } |
1178 |
1208 |
1179 TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder ); |
1209 TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder ); |
1180 |
1210 |
1181 HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex ); |
1211 HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex ); |
1182 const TInt newLength = aItemText.Length() + number->Length(); |
1212 const TInt newLength = aItemText.Length() + number->Length(); |
|
1213 if( aItemText.MaxLength() < newLength ) |
|
1214 { |
|
1215 aItemText.ReAllocL( newLength ); |
|
1216 } |
|
1217 CleanupStack::PopAndDestroy( number ); |
|
1218 aItemText.AppendNum( iconIndex ); |
|
1219 |
|
1220 SetupSubCellL( child, aSubcellIncrement, aItemIndex ); |
|
1221 |
|
1222 if( aChildIndex < aTemplateChildArray.Count() - 1 ) |
|
1223 { |
|
1224 const TInt newLength = aItemText.Length() + KTab().Length(); |
1183 if( aItemText.MaxLength() < newLength ) |
1225 if( aItemText.MaxLength() < newLength ) |
1184 { |
1226 { |
1185 aItemText.ReAllocL( newLength ); |
1227 aItemText.ReAllocL( newLength ); |
1186 } |
1228 } |
1187 CleanupStack::PopAndDestroy( number ); |
1229 aItemText.Append( KTab ); |
1188 aItemText.AppendNum( iconIndex ); |
1230 } |
1189 |
1231 |
1190 SetupSubCellL( child, aSubcellIncrement, aItemIndex ); |
1232 aSubcellIncrement++; |
1191 |
1233 iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::EGraphicsSubcell ); |
1192 if ( aChildIndex < aTemplateChildArray.Count() - 1 ) |
1234 } |
1193 { |
1235 else |
1194 const TInt newLength = aItemText.Length() + KTab().Length(); |
1236 { |
1195 if( aItemText.MaxLength() < newLength ) |
1237 // Mark the fact that subcell was not set to ensure that TMmSubcellsSetupCode |
1196 { |
1238 // works properly. |
1197 aItemText.ReAllocL( newLength ); |
|
1198 } |
|
1199 aItemText.Append( KTab ); |
|
1200 } |
|
1201 |
|
1202 aSubcellIncrement++; |
|
1203 iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::EGraphicsSubcell ); |
|
1204 } |
|
1205 else |
|
1206 { |
|
1207 // Mark the fact that subcell was not set to ensure that TMmSubcellsSetupCode |
|
1208 // works properly. |
|
1209 iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ESkippedSubcell ); |
1239 iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ESkippedSubcell ); |
1210 } |
1240 } |
1211 } |
1241 } |
1212 |
1242 |
1213 // ----------------------------------------------------------------------------- |
1243 // ----------------------------------------------------------------------------- |
1214 // |
1244 // |
1215 // ----------------------------------------------------------------------------- |
1245 // ----------------------------------------------------------------------------- |
1216 // |
1246 // |
1228 // ----------------------------------------------------------------------------- |
1258 // ----------------------------------------------------------------------------- |
1229 // |
1259 // |
1230 // ----------------------------------------------------------------------------- |
1260 // ----------------------------------------------------------------------------- |
1231 // |
1261 // |
1232 void CMmListBoxItemDrawer::SetupTextSubcellL( |
1262 void CMmListBoxItemDrawer::SetupTextSubcellL( |
1233 RArray<TTemplateChild>& aTemplateChildArray, TInt aChildIndex, |
1263 RArray<TTemplateChild>& aTemplateChildArray, TInt aChildIndex, |
1234 TInt aItemIndex, RBuf& aItemText, TInt& aSubcellIncrement ) const |
1264 TInt aItemIndex, RBuf& aItemText, TInt& aSubcellIncrement ) const |
1235 { |
1265 { |
1236 TTemplateChild child = aTemplateChildArray[aChildIndex]; |
1266 TTemplateChild child = aTemplateChildArray[aChildIndex]; |
1237 RBuf itemChildText; |
1267 RBuf itemChildText; |
1238 CleanupClosePushL( itemChildText ); |
1268 CleanupClosePushL( itemChildText ); |
1239 const TDesC8& mmTitleDes8 = iMmModel->GetAttributeAsText( aItemIndex, |
1269 const TDesC8& mmTitleDes8 = iMmModel->GetAttributeAsText( aItemIndex, |
1240 child.iData ); |
1270 child.iData ); |
1241 itemChildText.Assign( HnConvUtils::Str8ToStr( mmTitleDes8 ) ); |
1271 itemChildText.Assign( HnConvUtils::Str8ToStr( mmTitleDes8 ) ); |
1242 |
1272 |
1243 AppendText( aItemText, itemChildText ); |
1273 AppendText( aItemText, itemChildText ); |
1244 |
1274 |
1245 const_cast<CMmListBoxItemDrawer*>(this)->ReplaceSubCellText( |
1275 const_cast<CMmListBoxItemDrawer*> ( this )->ReplaceSubCellText( |
1246 itemChildText ); |
1276 itemChildText ); |
1247 CleanupStack::PopAndDestroy( &itemChildText ); |
1277 CleanupStack::PopAndDestroy( &itemChildText ); |
1248 |
1278 |
1249 SetupSubCellL( child, aSubcellIncrement, aItemIndex ); |
1279 SetupSubCellL( child, aSubcellIncrement, aItemIndex ); |
1250 |
1280 |
1251 if ( aChildIndex < aTemplateChildArray.Count() - 1 ) |
1281 if( aChildIndex < aTemplateChildArray.Count() - 1 ) |
1252 { |
1282 { |
1253 AppendText( aItemText, KTab ); |
1283 AppendText( aItemText, KTab ); |
1254 } |
1284 } |
1255 |
1285 |
1256 aSubcellIncrement++; |
1286 aSubcellIncrement++; |
1257 iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ETextSubcell ); |
1287 iLastSubcellsSetupCode.AddSubcellInfo( TMmSubcellsSetupCode::ETextSubcell ); |
1258 } |
1288 } |
1259 // ----------------------------------------------------------------------------- |
1289 // ----------------------------------------------------------------------------- |
1260 // |
1290 // |
1261 // ----------------------------------------------------------------------------- |
1291 // ----------------------------------------------------------------------------- |
1262 // |
1292 // |
1263 void CMmListBoxItemDrawer::AppendText( RBuf& aBuffer, const TDesC& aTextToAppend ) const |
1293 void CMmListBoxItemDrawer::AppendText( RBuf& aBuffer, const TDesC& aTextToAppend ) const |
1264 { |
1294 { |
1265 TInt newLength = aBuffer.Length() + aTextToAppend.Length(); |
1295 TInt newLength = aBuffer.Length() + aTextToAppend.Length(); |
1266 TInt error = KErrNone; |
1296 TInt error = KErrNone; |
1267 |
1297 |
1268 if( aBuffer.MaxLength() < newLength ) |
1298 if( aBuffer.MaxLength() < newLength ) |
1269 { |
1299 { |
1270 error = aBuffer.ReAlloc( newLength ); |
1300 error = aBuffer.ReAlloc( newLength ); |
1271 } |
1301 } |
1272 if ( error == KErrNone ) |
1302 if( error == KErrNone ) |
1273 { |
1303 { |
1274 aBuffer.Append( aTextToAppend ); |
1304 aBuffer.Append( aTextToAppend ); |
1275 } |
1305 } |
1276 } |
1306 } |
1277 // ----------------------------------------------------------------------------- |
1307 // ----------------------------------------------------------------------------- |
1278 // |
1308 // |
1279 // ----------------------------------------------------------------------------- |
1309 // ----------------------------------------------------------------------------- |
1280 // |
1310 // |
1281 void CMmListBoxItemDrawer::SetupBackdropSubcellL( |
1311 void CMmListBoxItemDrawer::SetupBackdropSubcellL( |
1282 RArray<TTemplateChild>& aTemplateChildArray, TInt aItemIndex, |
1312 RArray<TTemplateChild>& aTemplateChildArray, TInt aItemIndex, |
1283 RBuf& aItemText, TInt& aSubcellIncrement ) const |
1313 RBuf& aItemText, TInt& aSubcellIncrement ) const |
1284 { |
1314 { |
1285 CGulIcon* icon = NULL; |
1315 CGulIcon* icon = NULL; |
1286 for ( TInt i = 0; i < aTemplateChildArray.Count() /*&& |
1316 for( TInt i = 0; i < aTemplateChildArray.Count() /*&& |
1287 aItemIndex != iWidget->View()->CurrentItemIndex()*/; ++i ) |
1317 aItemIndex != iWidget->View()->CurrentItemIndex()*/; ++i ) |
1288 { |
1318 { |
1289 TTemplateChild child = aTemplateChildArray[i]; |
1319 TTemplateChild child = aTemplateChildArray[i]; |
1290 if( child.iImageVisualId == EImageVisualIdEditMode && |
1320 if( child.iImageVisualId == EImageVisualIdEditMode && |
1291 child.iIsImage ) |
1321 child.iIsImage ) |
1292 { |
1322 { |
1293 TSize itemSize = GetItemSize( aItemIndex, |
1323 TSize itemSize = GetItemSize( aItemIndex, |
1294 aItemIndex == iWidget->View()->CurrentItemIndex() ); |
1324 aItemIndex == iWidget->View()->CurrentItemIndex() ); |
1295 CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics( aItemIndex, child.iData, &itemSize ); |
1325 CHnIconHolder* iconHolder = iMmModel->GetAttributeAsRefCountedGraphics( aItemIndex, child.iData, &itemSize ); |
1296 icon = iconHolder ? iconHolder->GetGulIcon() : NULL; |
1326 icon = iconHolder ? iconHolder->GetGulIcon() : NULL; |
1297 if ( icon ) |
1327 if( icon ) |
1298 { |
1328 { |
1299 CFbsBitmap* bitmap = icon->Bitmap(); |
1329 CFbsBitmap* bitmap = icon->Bitmap(); |
1300 child.iRectAccordingToParent = TRect( TPoint( 0, 0 ), |
1330 child.iRectAccordingToParent = TRect( TPoint( 0, 0 ), |
1301 TPoint( itemSize.iWidth, itemSize.iHeight ) ); |
1331 TPoint( itemSize.iWidth, itemSize.iHeight ) ); |
1302 AknIconUtils::SetSize( bitmap, itemSize, |
1332 AknIconUtils::SetSize( bitmap, itemSize, |
1303 EAspectRatioNotPreserved ); |
1333 EAspectRatioNotPreserved ); |
1304 TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder ); |
1334 TInt iconIndex = iItemsDataCache->GetItemCacheL( aItemIndex )->AppendIconL( iconHolder ); |
1305 |
1335 |
1306 HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex ); |
1336 HBufC8* number = HnConvUtils::NumToStr8LC( iconIndex ); |
1307 TInt newLength = aItemText.Length() + number->Length(); |
1337 TInt newLength = aItemText.Length() + number->Length(); |
1308 if( aItemText.MaxLength() < newLength ) |
1338 if( aItemText.MaxLength() < newLength ) |
1309 { |
1339 { |
1352 itemText.Close(); |
1382 itemText.Close(); |
1353 itemText.CreateL( MmTemplateContants::KItemSubCellsText ); |
1383 itemText.CreateL( MmTemplateContants::KItemSubCellsText ); |
1354 |
1384 |
1355 RArray<TTemplateChild> templateChildArray; |
1385 RArray<TTemplateChild> templateChildArray; |
1356 CleanupClosePushL( templateChildArray ); |
1386 CleanupClosePushL( templateChildArray ); |
1357 if ( !iIsIndicatorItem ) |
1387 if( !iIsIndicatorItem ) |
1358 { |
1388 { |
1359 iTemplateLibrary->GetChildrenL( iWidgetType, templateChildArray, mmTemplate, |
1389 iTemplateLibrary->GetChildrenL( iWidgetType, templateChildArray, mmTemplate, |
1360 landscapeOrientation, aItemIsCurrent, IsEditMode() ); |
1390 landscapeOrientation, aItemIsCurrent, IsEditMode() ); |
1361 } |
1391 } |
1362 else if ( !AknLayoutUtils::PenEnabled() ) |
1392 else if ( !AknLayoutUtils::PenEnabled() ) |
1363 { |
1393 { |
1364 iTemplateLibrary->GetMoveIndicatorChildrenL( iWidgetType, templateChildArray, |
1394 iTemplateLibrary->GetMoveIndicatorChildrenL( iWidgetType, templateChildArray, |
1365 mmTemplate, landscapeOrientation, aItemIsCurrent ); |
1395 mmTemplate, landscapeOrientation, aItemIsCurrent ); |
1366 } |
1396 } |
1367 |
1397 |
1368 iLastSubcellsSetupCode.Clear(); |
1398 iLastSubcellsSetupCode.Clear(); |
1369 |
1399 |
1370 //Backdrop icon as first element to draw |
1400 //Backdrop icon as first element to draw |
1371 TInt subcellIncrement( 0 ); |
1401 TInt subcellIncrement( 0 ); |
1372 if ( GetBackdropVisibility( aItemIndex, aItemIsCurrent ) ) |
1402 if( GetBackdropVisibility( aItemIndex, aItemIsCurrent ) ) |
1373 { |
1403 { |
1374 SetupBackdropSubcellL( templateChildArray, aItemIndex, itemText, subcellIncrement ); |
1404 SetupBackdropSubcellL( templateChildArray, aItemIndex, itemText, subcellIncrement ); |
1375 iItemHasBackdrop = ETrue; |
1405 iItemHasBackdrop = ETrue; |
1376 } |
1406 } |
1377 else |
1407 else |
1378 { |
1408 { |
1379 iItemHasBackdrop = EFalse; |
1409 iItemHasBackdrop = EFalse; |
1380 } |
1410 } |
1381 |
1411 |
1382 for ( TInt i( 0 ) ; i < templateChildArray.Count() && !iLeftOverAreaUnderAnimatedItem; i++ ) |
1412 for ( TInt i( 0 ) ; i < templateChildArray.Count() && !iLeftOverAreaUnderAnimatedItem; i++ ) |
1383 { |
1413 { |
1384 TTemplateChild child = templateChildArray[i]; |
1414 TTemplateChild child = templateChildArray[i]; |
1385 if ( child.iImageVisualId == EImageVisualIdEditMode && child.iIsImage ) |
1415 if ( child.iImageVisualId == EImageVisualIdEditMode && child.iIsImage ) |
1386 { |
1416 { |
1387 continue; |
1417 continue; |
1388 } |
1418 } |
1389 else if( !child.iIsImage ) |
1419 else if( !child.iIsImage ) |
1390 { |
1420 { |
1391 SetupTextSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); |
1421 SetupTextSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); |
1392 } |
1422 } |
1393 else |
1423 else |
1394 { |
1424 { |
1395 SetupIconSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); |
1425 SetupIconSubcellL( templateChildArray, i, aItemIndex, itemText, subcellIncrement ); |
1396 } |
1426 } |
1397 } |
1427 } |
1398 TInt subcellsJustSet = subcellIncrement; |
1428 TInt subcellsJustSet = subcellIncrement; |
1399 iCurrentNumberOfSubcellsSet = Max( iCurrentNumberOfSubcellsSet, subcellsJustSet ); |
1429 iCurrentNumberOfSubcellsSet = Max( iCurrentNumberOfSubcellsSet, subcellsJustSet ); |
1400 __ASSERT_DEBUG( iCurrentNumberOfSubcellsSet <= MmTemplateContants::KSubCellsCount, |
1430 __ASSERT_DEBUG( iCurrentNumberOfSubcellsSet <= MmTemplateContants::KSubCellsCount, |
1401 User::Invariant() ); |
1431 User::Invariant() ); |
1402 |
1432 |
1403 for ( TInt i = subcellIncrement; i < iCurrentNumberOfSubcellsSet; i++ ) |
1433 for( TInt i = subcellIncrement; i < iCurrentNumberOfSubcellsSet; i++ ) |
1404 { |
1434 { |
1405 SetupSubNoCellL( i, aItemIndex ); |
1435 SetupSubNoCellL( i, aItemIndex ); |
1406 } |
1436 } |
1407 |
1437 |
1408 iLastSubcellsSetupCode.AddTemplateInfo( |
1438 iLastSubcellsSetupCode.AddTemplateInfo( |
1409 iItemsDataCache->GetTemplateIdentifierL( mmTemplate ) ); |
1439 iItemsDataCache->GetTemplateIdentifierL( mmTemplate ) ); |
1410 iLastSubcellsSetupCode.AddIsCurrentInfo( aItemIsCurrent ); |
1440 iLastSubcellsSetupCode.AddIsCurrentInfo( aItemIsCurrent ); |
1411 |
1441 |
1412 CleanupStack::PopAndDestroy( &templateChildArray ); |
1442 CleanupStack::PopAndDestroy( &templateChildArray ); |
1413 |
1443 |
1414 cache->SetSubcellsSetupCode( iLastSubcellsSetupCode ); |
1444 cache->SetSubcellsSetupCode( iLastSubcellsSetupCode ); |
1415 // the line below is here only to make the cached information complete |
1445 // the line below is here only to make the cached information complete |
1416 GetItemSize( aItemIndex, aItemIsCurrent ); |
1446 GetItemSize( aItemIndex, aItemIsCurrent ); |
1417 cache->MarkAsValidL(); |
1447 cache->MarkAsValidL(); |
1418 } |
1448 } |
1419 |
1449 |
1420 // ----------------------------------------------------------------------------- |
1450 // ----------------------------------------------------------------------------- |
1421 // |
1451 // |
1422 // ----------------------------------------------------------------------------- |
1452 // ----------------------------------------------------------------------------- |
1423 // |
1453 // |
1464 |
1494 |
1465 // ----------------------------------------------------------------------------- |
1495 // ----------------------------------------------------------------------------- |
1466 // |
1496 // |
1467 // ----------------------------------------------------------------------------- |
1497 // ----------------------------------------------------------------------------- |
1468 // |
1498 // |
1469 void CMmListBoxItemDrawer::DrawActualItem(TInt aItemIndex, |
1499 void CMmListBoxItemDrawer::DrawActualItem( TInt aItemIndex, |
1470 const TRect& aActualItemRect, TBool aItemIsCurrent, |
1500 const TRect& aActualItemRect, TBool aItemIsCurrent, |
1471 TBool aViewIsEmphasized, TBool /*aViewIsDimmed*/, |
1501 TBool aViewIsEmphasized, TBool /*aViewIsDimmed*/, |
1472 TBool aItemIsSelected) const |
1502 TBool aItemIsSelected ) const |
1473 { |
1503 { |
1474 if (Properties(aItemIndex).IsSelectionHidden()) |
1504 if( Properties( aItemIndex ).IsSelectionHidden() ) |
1475 { |
1505 { |
1476 aItemIsSelected = EFalse; |
1506 aItemIsSelected = EFalse; |
1477 } |
1507 } |
1478 DrawItemText(aItemIndex,aActualItemRect,aItemIsCurrent, |
1508 DrawItemText( aItemIndex, aActualItemRect, aItemIsCurrent, |
1479 aViewIsEmphasized,aItemIsSelected); |
1509 aViewIsEmphasized, aItemIsSelected ); |
1480 } |
1510 } |
1481 |
1511 |
1482 // ----------------------------------------------------------------------------- |
1512 // ----------------------------------------------------------------------------- |
1483 // |
1513 // |
1484 // ----------------------------------------------------------------------------- |
1514 // ----------------------------------------------------------------------------- |
1485 // |
1515 // |
1486 TBool CMmListBoxItemDrawer::GetHighlightVisibility( TInt aItemIndex, |
1516 TBool CMmListBoxItemDrawer::GetHighlightVisibility( TInt aItemIndex, |
1487 TBool aItemIsCurrent, TBool aAllowHighlightForNonDraggedItem ) const |
1517 TBool aItemIsCurrent, TBool aAllowHighlightForNonDraggedItem ) const |
1488 { |
1518 { |
1489 TBool highlightVisibility(EFalse); |
1519 TBool highlightVisibility( EFalse ); |
1490 if (!iItemHasBackdrop && !iLeftOverAreaUnderAnimatedItem ) //never draw highlight when item has backdrop or when left over area under animated item |
1520 if( !iItemHasBackdrop && !iLeftOverAreaUnderAnimatedItem ) //never draw highlight when item has backdrop or when left over area under animated item |
1491 { |
1521 { |
1492 TBool currentlyDraggedItem = |
1522 TBool currentlyDraggedItem = |
1493 ItemHasFloatingType( aItemIndex, EDrag ) || |
1523 ItemHasFloatingType( aItemIndex, EDrag ) || |
1494 ItemHasFloatingType( aItemIndex, EDragTransition ); |
1524 ItemHasFloatingType( aItemIndex, EDragTransition ); |
1495 |
1525 |
1496 if ( ( STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() |
1526 if( ( STATIC_CAST(CMmWidgetContainer*,Widget()->Parent())->IsHighlightVisible() |
1497 && aItemIsCurrent && aAllowHighlightForNonDraggedItem ) |
1527 && aItemIsCurrent && aAllowHighlightForNonDraggedItem ) |
1498 || currentlyDraggedItem ) |
1528 || currentlyDraggedItem ) |
1499 { |
1529 { |
1500 highlightVisibility = ETrue; |
1530 highlightVisibility = ETrue; |
1501 } |
1531 } |
1502 } |
1532 } |
1503 return highlightVisibility; |
1533 return highlightVisibility; |
1504 } |
1534 } |
1505 |
1535 |
1506 // ----------------------------------------------------------------------------- |
1536 // ----------------------------------------------------------------------------- |
1507 // |
1537 // |
1508 // ----------------------------------------------------------------------------- |
1538 // ----------------------------------------------------------------------------- |
1509 // |
1539 // |
1510 TBool CMmListBoxItemDrawer::GetBackdropVisibility( TInt aItemIndex, |
1540 TBool CMmListBoxItemDrawer::GetBackdropVisibility( TInt aItemIndex, |
1511 TBool aItemIsCurrent ) const |
1541 TBool aItemIsCurrent ) const |
1512 { |
1542 { |
1513 TBool currentlyDraggedItem = |
1543 TBool currentlyDraggedItem = |
1514 ItemHasFloatingType( aItemIndex, EDrag ) || |
1544 ItemHasFloatingType( aItemIndex, EDrag ) || |
1515 ItemHasFloatingType( aItemIndex, EDragTransition ); |
1545 ItemHasFloatingType( aItemIndex, EDragTransition ); |
1516 |
1546 |
1517 return IsEditMode() /* draw the backdrop only in edit mode */ |
1547 return IsEditMode() /* draw the backdrop only in edit mode */ |
1518 && !currentlyDraggedItem /* backdrop is disabled for dragged items */ |
1548 && !currentlyDraggedItem /* backdrop is disabled for dragged items */ |
1519 && !iIsIndicatorItem /* in non-touch backdrop is not drawn, just "move indicators" */ |
1549 && !iIsIndicatorItem /* in non-touch backdrop is not drawn, just "move indicators" */ |
1520 && !iLeftOverAreaUnderAnimatedItem /* is the currently drawn item the area left over behind dragged item*/ |
1550 && !iLeftOverAreaUnderAnimatedItem /* is the currently drawn item the area left over behind dragged item*/ |
1521 && !( STATIC_CAST( CMmWidgetContainer*,Widget()->Parent() )->IsHighlightVisible() |
1551 && !( STATIC_CAST( CMmWidgetContainer*,Widget()->Parent() )->IsHighlightVisible() |
1522 && aItemIsCurrent );/*if the timer is active then we want to draw highlight (not backdrop) on the current index*/ |
1552 && aItemIsCurrent );/*if the timer is active then we want to draw highlight (not backdrop) on the current index*/ |
1523 } |
1553 } |
1524 |
1554 |
1525 // ----------------------------------------------------------------------------- |
1555 // ----------------------------------------------------------------------------- |
1526 // |
1556 // |
1527 // ----------------------------------------------------------------------------- |
1557 // ----------------------------------------------------------------------------- |
1528 // |
1558 // |
1529 TBool CMmListBoxItemDrawer::ItemHasFloatingType( TInt aItemIndex, |
1559 TBool CMmListBoxItemDrawer::ItemHasFloatingType( TInt aItemIndex, |
1530 TMmFloatingItemType aFloatingType) const |
1560 TMmFloatingItemType aFloatingType ) const |
1531 { |
1561 { |
1532 TBool hasFloatingType( EFalse ); |
1562 TBool hasFloatingType( EFalse ); |
1533 for ( TInt i = iFloatingItems.Count() - 1 ; i >= 0; i-- ) |
1563 for( TInt i = iFloatingItems.Count() - 1; i >= 0; i-- ) |
1534 { |
1564 { |
1535 const TMmFloatingItem& item = iFloatingItems[i]; |
1565 const TMmFloatingItem& item = iFloatingItems[i]; |
1536 if ( item.GetFloatingItemType() == aFloatingType |
1566 if( item.GetFloatingItemType() == aFloatingType |
1537 && item.GetDrawnItemIndex() == aItemIndex ) |
1567 && item.GetDrawnItemIndex() == aItemIndex ) |
1538 { |
1568 { |
1539 hasFloatingType = ETrue; |
1569 hasFloatingType = ETrue; |
1540 break; |
1570 break; |
1541 } |
1571 } |
1542 } |
1572 } |
1543 return hasFloatingType; |
1573 return hasFloatingType; |
1544 } |
1574 } |
1545 // End of file |
1575 // End of file |