225 void CMmGridView::DoDraw(const TRect* aClipRect) const |
225 void CMmGridView::DoDraw(const TRect* aClipRect) const |
226 { |
226 { |
227 CMmListBoxItemDrawer* itemDrawer = static_cast< CMmListBoxItemDrawer*> ( ItemDrawer() ); |
227 CMmListBoxItemDrawer* itemDrawer = static_cast< CMmListBoxItemDrawer*> ( ItemDrawer() ); |
228 TBool drawingInitiated(EFalse); |
228 TBool drawingInitiated(EFalse); |
229 if ( CAknEnv::Static()->TransparencyEnabled() && |
229 if ( CAknEnv::Static()->TransparencyEnabled() && |
230 iWin && iWin->GetDrawRect() == TRect::EUninitialized ) |
230 iWin && iWin->GetDrawRect() == TRect::EUninitialized ) |
231 { |
231 { |
232 TRect a; |
232 TRect a; |
233 if (!aClipRect || *aClipRect == TRect(0,0,0,0) ) |
233 if (!aClipRect || *aClipRect == TRect(0,0,0,0) ) |
234 { |
234 { |
235 a = ViewRect(); |
235 a = ViewRect(); |
236 aClipRect = &a; |
236 aClipRect = &a; |
237 } |
237 } |
238 |
238 |
239 drawingInitiated=ETrue; |
239 drawingInitiated=ETrue; |
240 iWin->Invalidate( *aClipRect ); |
240 iWin->Invalidate( *aClipRect ); |
241 iWin->BeginRedraw( *aClipRect ); |
241 iWin->BeginRedraw( *aClipRect ); |
242 } |
242 } |
243 |
243 |
244 if ( !itemDrawer->IsEditMode() ) |
244 if ( !itemDrawer->IsEditMode() ) |
245 { |
245 { |
246 itemDrawer->DrawBackground(ViewRect()); |
246 itemDrawer->DrawBackground(ViewRect()); |
247 itemDrawer->SetRedrawItemBackground( EFalse ); |
247 itemDrawer->SetRedrawItemBackground( EFalse ); |
251 else |
251 else |
252 { |
252 { |
253 CAknGridView::Draw( aClipRect ); |
253 CAknGridView::Draw( aClipRect ); |
254 } |
254 } |
255 |
255 |
256 if ( aClipRect ) |
256 if ( aClipRect ) |
257 { |
257 { |
258 TRect rect(*aClipRect); |
258 TRect rect(*aClipRect); |
259 TInt lastItemInView = (iModel->NumberOfItems() <= BottomItemIndex() ) |
259 TInt lastItemInView = (iModel->NumberOfItems() <= BottomItemIndex() ) |
260 ? iModel->NumberOfItems()-1 : BottomItemIndex(); |
260 ? iModel->NumberOfItems()-1 : BottomItemIndex(); |
261 rect.iTl.iY = ItemPos( lastItemInView ).iY + ItemSize( lastItemInView ).iHeight; |
261 rect.iTl.iY = ItemPos( lastItemInView ).iY + ItemSize( lastItemInView ).iHeight; |
262 // iGc->SetClippingRect( rect ); |
262 // iGc->SetClippingRect( rect ); |
263 // removed to prevent non-redraw drawing. Was present to prevent out of view drawing when effects are on. |
263 // removed to prevent non-redraw drawing. Was present to prevent out of view drawing when effects are on. |
264 // could be removed because effects were disabled at some point in edit mode to enhance performance. |
264 // could be removed because effects were disabled at some point in edit mode to enhance performance. |
265 itemDrawer->DrawFloatingItems( rect ); |
265 itemDrawer->DrawFloatingItems( rect ); |
266 // iGc->CancelClippingRect(); |
266 // iGc->CancelClippingRect(); |
267 } |
267 } |
268 |
268 |
269 // if (aClipRect) |
269 // if (aClipRect) |
270 // { |
270 // { |
271 // const_cast< CMmGridView* >(this)->Gc()->DrawRect(*aClipRect); |
271 // const_cast< CMmGridView* >(this)->Gc()->DrawRect(*aClipRect); |
272 // } |
272 // } |
273 |
273 |
274 if ( CAknEnv::Static()->TransparencyEnabled() && |
274 if ( CAknEnv::Static()->TransparencyEnabled() && |
275 iWin && drawingInitiated ) |
275 iWin && drawingInitiated ) |
276 { |
276 { |
277 drawingInitiated = EFalse; |
277 drawingInitiated = EFalse; |
278 iWin->EndRedraw( ); |
278 iWin->EndRedraw( ); |
279 } |
279 } |
280 |
280 |
281 } |
281 } |
282 |
282 |
283 // ----------------------------------------------------------------------------- |
283 // ----------------------------------------------------------------------------- |
284 // |
284 // |
285 // ----------------------------------------------------------------------------- |
285 // ----------------------------------------------------------------------------- |
286 // |
286 // |
287 TInt CMmGridView::VerticalItemOffset() const |
287 TInt CMmGridView::VerticalItemOffset() const |
288 { |
288 { |
289 return iVerticalOffset; |
289 return iVerticalOffset; |
290 } |
290 } |
291 |
291 |
292 // ----------------------------------------------------------------------------- |
292 // ----------------------------------------------------------------------------- |
293 // |
293 // |
294 // ----------------------------------------------------------------------------- |
294 // ----------------------------------------------------------------------------- |
295 // |
295 // |
296 void CMmGridView::SetItemHeight(TInt aItemHeight) |
296 void CMmGridView::SetItemHeight(TInt aItemHeight) |
297 { |
297 { |
298 // we need to update the iItemHeight member in grid also (there are two different item height value holders - in grid and here in grid view) |
298 // we need to update the iItemHeight member in grid also (there are two different item height value holders - in grid and here in grid view) |
299 CMmListBoxItemDrawer* itemDrawer = |
299 CMmListBoxItemDrawer* itemDrawer = |
300 STATIC_CAST( CMmListBoxItemDrawer*, ItemDrawer() ); |
300 STATIC_CAST( CMmListBoxItemDrawer*, ItemDrawer() ); |
301 static_cast<CMmGrid*>(itemDrawer->Widget())->SetItemHeight( aItemHeight ); |
301 static_cast<CMmGrid*>(itemDrawer->Widget())->SetItemHeight( aItemHeight ); |
302 |
302 |
303 CAknGridView::SetItemHeight(aItemHeight); |
303 CAknGridView::SetItemHeight(aItemHeight); |
304 } |
304 } |
305 |
305 |
306 // ----------------------------------------------------------------------------- |
306 // ----------------------------------------------------------------------------- |
307 // |
307 // |
308 // ----------------------------------------------------------------------------- |
308 // ----------------------------------------------------------------------------- |
309 // |
309 // |