75 const CFont* aFont, |
75 const CFont* aFont, |
76 CFormattedCellListBoxData* aFormattedCellData, |
76 CFormattedCellListBoxData* aFormattedCellData, |
77 CWmListBox* aListBox ) |
77 CWmListBox* aListBox ) |
78 : CFormattedCellListBoxItemDrawer( aTextListBoxModel,aFont,aFormattedCellData ), |
78 : CFormattedCellListBoxItemDrawer( aTextListBoxModel,aFont,aFormattedCellData ), |
79 iWmPlugin( aWmPlugin ) |
79 iWmPlugin( aWmPlugin ) |
80 { |
80 { |
81 iCellData = aFormattedCellData; |
81 iCellData = aFormattedCellData; |
82 iListBox = aListBox; |
82 iListBox = aListBox; |
83 } |
83 } |
84 |
84 |
85 // --------------------------------------------------------- |
85 // --------------------------------------------------------- |
86 // CWmListItemDrawer::ConstructL |
86 // CWmListItemDrawer::ConstructL |
87 // --------------------------------------------------------- |
87 // --------------------------------------------------------- |
88 // |
88 // |
134 // --------------------------------------------------------- |
134 // --------------------------------------------------------- |
135 // CWmListItemDrawer::~CWmListItemDrawer |
135 // CWmListItemDrawer::~CWmListItemDrawer |
136 // --------------------------------------------------------- |
136 // --------------------------------------------------------- |
137 // |
137 // |
138 CWmListItemDrawer::~CWmListItemDrawer() |
138 CWmListItemDrawer::~CWmListItemDrawer() |
139 { |
139 { |
140 iCellData = NULL; |
140 iCellData = NULL; |
141 iListBox = NULL; |
141 iListBox = NULL; |
142 |
142 |
143 // dispose icons |
143 // dispose icons |
144 delete iDefaultLogoImage; |
144 delete iDefaultLogoImage; |
145 delete iDefaultLogoImageMask; |
145 delete iDefaultLogoImageMask; |
146 } |
146 } |
147 |
147 |
148 // --------------------------------------------------------- |
148 // --------------------------------------------------------- |
149 // CWmListItemDrawer::UpdateItemHeight |
149 // CWmListItemDrawer::UpdateItemHeight |
150 // --------------------------------------------------------- |
150 // --------------------------------------------------------- |
151 // |
151 // |
154 // sets item height according to layout |
154 // sets item height according to layout |
155 TAknWindowLineLayout listPane = AknLayoutScalable_Apps |
155 TAknWindowLineLayout listPane = AknLayoutScalable_Apps |
156 ::list_wgtman_pane().LayoutLine(); |
156 ::list_wgtman_pane().LayoutLine(); |
157 TAknLayoutRect listPaneRect; |
157 TAknLayoutRect listPaneRect; |
158 listPaneRect.LayoutRect( iListBox->Rect(), listPane ); |
158 listPaneRect.LayoutRect( iListBox->Rect(), listPane ); |
|
159 |
159 TAknWindowLineLayout listRowPane = AknLayoutScalable_Apps |
160 TAknWindowLineLayout listRowPane = AknLayoutScalable_Apps |
160 ::listrow_wgtman_pane().LayoutLine(); |
161 ::listrow_wgtman_pane().LayoutLine(); |
161 TAknLayoutRect listRowPaneRect; |
162 TAknLayoutRect listRowPaneRect; |
162 listRowPaneRect.LayoutRect( listPaneRect.Rect(), listRowPane ); |
163 listRowPaneRect.LayoutRect( listPaneRect.Rect(), listRowPane ); |
163 TRect itemRect = listRowPaneRect.Rect(); |
164 TRect itemRect = listRowPaneRect.Rect(); |
164 TRAP_IGNORE( iListBox->SetItemHeightL( itemRect.Height() ); ); |
165 TRAP_IGNORE( iListBox->SetItemHeightL( itemRect.Height() ); ); |
165 iListBox->View()->ItemDrawer()->SetItemCellSize( itemRect.Size() ); |
166 iListBox->View()->ItemDrawer()->SetItemCellSize( itemRect.Size() ); |
|
167 |
|
168 // update view rect according to layout ( ou1cimx1#402776 ) |
|
169 iListBox->View()->SetViewRect( listPaneRect.Rect() ); |
166 } |
170 } |
167 |
171 |
168 // --------------------------------------------------------- |
172 // --------------------------------------------------------- |
169 // CWmListItemDrawer::DrawItem |
173 // CWmListItemDrawer::DrawItem |
170 // --------------------------------------------------------- |
174 // --------------------------------------------------------- |
188 aItemIndex, aItemRectPos, aViewIsDimmed ); |
192 aItemIndex, aItemRectPos, aViewIsDimmed ); |
189 |
193 |
190 if ( aItemIsCurrent && listFocused && highlightEnabled ) |
194 if ( aItemIsCurrent && listFocused && highlightEnabled ) |
191 { |
195 { |
192 TRect innerRect( itemRect ); |
196 TRect innerRect( itemRect ); |
193 const TInt highlightOffset = 2; |
197 const TInt highlightOffset = 5; |
194 innerRect.Shrink( highlightOffset, highlightOffset ); |
198 innerRect.Shrink( highlightOffset, highlightOffset ); |
195 |
199 |
196 AknsDrawUtils::DrawFrame( skin, |
200 AknsDrawUtils::DrawFrame( skin, |
197 gc, |
201 gc, |
198 itemRect, |
202 itemRect, |
199 innerRect, |
203 innerRect, |
200 KAknsIIDQsnFrList, |
204 KAknsIIDQsnFrList, |
321 CWmListBox::CWmListBox( CWmPlugin& aWmPlugin ): |
325 CWmListBox::CWmListBox( CWmPlugin& aWmPlugin ): |
322 CEikFormattedCellListBox(), |
326 CEikFormattedCellListBox(), |
323 iWmPlugin( aWmPlugin ) |
327 iWmPlugin( aWmPlugin ) |
324 { |
328 { |
325 iFindPaneIsVisible = EFalse; |
329 iFindPaneIsVisible = EFalse; |
326 iLogoSize = TSize( 0, 0); |
330 iLogoSize = TSize( 0, 0); |
327 } |
331 } |
328 |
332 |
329 // --------------------------------------------------------- |
333 // --------------------------------------------------------- |
330 // CWmListBox::~CWmListBox |
334 // CWmListBox::~CWmListBox |
331 // --------------------------------------------------------- |
335 // --------------------------------------------------------- |
370 |
374 |
371 // --------------------------------------------------------- |
375 // --------------------------------------------------------- |
372 // CWmListBox::WidgetData |
376 // CWmListBox::WidgetData |
373 // --------------------------------------------------------- |
377 // --------------------------------------------------------- |
374 // |
378 // |
375 CWmWidgetData& CWmListBox::WidgetData( TInt aItemIndex ) |
379 CWmWidgetData& CWmListBox::WidgetData( TInt aItemIndex, TBool aIgnoreSearchIndex ) |
376 { |
380 { |
377 return *iVisibleWidgetArray[ RealIndex( aItemIndex ) ]; |
381 return *iVisibleWidgetArray[ RealIndex( aItemIndex, aIgnoreSearchIndex ) ]; |
378 } |
382 } |
379 |
383 |
380 // --------------------------------------------------------- |
384 // --------------------------------------------------------- |
381 // CWmListBox::AddWidgetDataL |
385 // CWmListBox::AddWidgetDataL |
382 // --------------------------------------------------------- |
386 // --------------------------------------------------------- |
395 |
399 |
396 // --------------------------------------------------------- |
400 // --------------------------------------------------------- |
397 // CWmListBox::RemoveWidgetData |
401 // CWmListBox::RemoveWidgetData |
398 // --------------------------------------------------------- |
402 // --------------------------------------------------------- |
399 // |
403 // |
400 void CWmListBox::RemoveWidgetData( TInt aItemIndex ) |
404 void CWmListBox::RemoveWidgetData( TInt aItemIndex, TBool aIgnoreSearchIndex ) |
401 { |
405 { |
402 TInt realIndex = RealIndex( aItemIndex ); |
406 TInt realIndex = RealIndex( aItemIndex, aIgnoreSearchIndex ); |
403 TBool current = ( aItemIndex == CurrentItemIndex() ); |
407 TBool current = ( aItemIndex == CurrentItemIndex() ); |
404 // remove widget data |
408 // remove widget data |
405 CWmWidgetData* data = iVisibleWidgetArray[realIndex]; |
409 CWmWidgetData* data = iVisibleWidgetArray[realIndex]; |
406 iVisibleWidgetArray.Remove( realIndex ); |
410 iVisibleWidgetArray.Remove( realIndex ); |
407 // reorganise |
411 |
408 TRAP_IGNORE( |
|
409 AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( |
|
410 this, realIndex, current ) ); |
|
411 |
412 |
412 // Remove item from order array |
413 // Remove item from order array |
413 for ( TInt i = 0; i < iOrderDataArray.Count(); i++ ) |
414 for ( TInt i = 0; i < iOrderDataArray.Count(); i++ ) |
414 { |
415 { |
415 CWmWidgetOrderData* order = iOrderDataArray[i]; |
416 CWmWidgetOrderData* order = iOrderDataArray[i]; |
473 // --------------------------------------------------------- |
482 // --------------------------------------------------------- |
474 // |
483 // |
475 void CWmListBox::HandleLayoutChanged() |
484 void CWmListBox::HandleLayoutChanged() |
476 { |
485 { |
477 iLogoSize = TSize( 0, 0); |
486 iLogoSize = TSize( 0, 0); |
478 iLogoSize = LogoSize(); |
487 iLogoSize = LogoSize(); |
479 for ( TInt i=0; i<iVisibleWidgetArray.Count(); i++) |
488 for ( TInt i=0; i<iVisibleWidgetArray.Count(); i++) |
480 { |
489 { |
481 iVisibleWidgetArray[i]->UpdateLogo( iLogoSize, EFalse ); |
490 iVisibleWidgetArray[i]->UpdateLogo( iLogoSize, EFalse ); |
482 } |
491 } |
483 } |
492 } |
539 |
548 |
540 // --------------------------------------------------------- |
549 // --------------------------------------------------------- |
541 // CWmListBox::RealIndex |
550 // CWmListBox::RealIndex |
542 // --------------------------------------------------------- |
551 // --------------------------------------------------------- |
543 // |
552 // |
544 TInt CWmListBox::RealIndex( TInt aIndex ) |
553 TInt CWmListBox::RealIndex( TInt aIndex, TBool aIgnoreSearchIndex ) |
545 { |
554 { |
546 TInt realIndex = aIndex; |
555 TInt realIndex = aIndex; |
547 if ( iFindPaneIsVisible && aIndex >= 0 ) |
556 if ( ( iFindPaneIsVisible && aIndex >= 0 ) && !aIgnoreSearchIndex ) |
548 { |
557 { |
549 realIndex = static_cast<CAknFilteredTextListBoxModel*>(Model())->Filter() |
558 realIndex = static_cast<CAknFilteredTextListBoxModel*>(Model())->Filter() |
550 ->FilteredItemIndex( aIndex ); |
559 ->FilteredItemIndex( aIndex ); |
551 } |
560 } |
552 return realIndex; |
561 return realIndex; |