79 // |
79 // |
80 CMIDCanvasGraphicsItem::~CMIDCanvasGraphicsItem() |
80 CMIDCanvasGraphicsItem::~CMIDCanvasGraphicsItem() |
81 { |
81 { |
82 DEBUG("CMIDCanvasGraphicsItem::~CMIDCanvasGraphicsItem +"); |
82 DEBUG("CMIDCanvasGraphicsItem::~CMIDCanvasGraphicsItem +"); |
83 |
83 |
|
84 // When disposing item first, removes the painter parent |
|
85 if (iItemPainter) |
|
86 { |
|
87 iItemPainter->SetItem(NULL); |
|
88 } |
|
89 |
84 // Remove this component from the container if set. |
90 // Remove this component from the container if set. |
85 if (iComponentContainer) |
91 if (iComponentContainer) |
86 { |
92 { |
87 iComponentContainer->UnregisterComponent(this); |
93 iComponentContainer->UnregisterComponent(this); |
88 } |
94 } |
368 HandleChangeForScaling(EResolutionChange); |
374 HandleChangeForScaling(EResolutionChange); |
369 } |
375 } |
370 } |
376 } |
371 } |
377 } |
372 |
378 |
|
379 void CMIDCanvasGraphicsItem::HandleForeground(TBool aForeground) |
|
380 { |
|
381 // If Canvas goes to foreground and scaling is on, |
|
382 // then we resize a CanvasGraphicsItem. |
|
383 if (aForeground) |
|
384 { |
|
385 HandleChangeForScaling(EForegroundGained); |
|
386 } |
|
387 } |
373 void CMIDCanvasGraphicsItem::HandleChangeForScaling(TChange aChange) |
388 void CMIDCanvasGraphicsItem::HandleChangeForScaling(TChange aChange) |
374 { |
389 { |
375 // Calling functions which set size and position. |
390 // Calling functions which set size and position. |
376 TRAPD(err, SetSizeL(iNonScaledSize.iWidth, iNonScaledSize.iHeight)); |
391 TRAPD(err, SetSizeL(iNonScaledSize.iWidth, iNonScaledSize.iHeight)); |
377 if (err != KErrNone) |
392 if (err != KErrNone) |
378 { |
393 { |
379 DEBUG_INT("CMIDCanvasGraphicsItem::HandleFullscreenModeChange: SetSizeL method leave with %d code", err); |
394 DEBUG_INT("CMIDCanvasGraphicsItem::HandleFullscreenModeChange: SetSizeL method leave with %d code", err); |
380 } |
395 } |
381 SetPosition(iNonScaledPosition.iX, iNonScaledPosition.iY); |
396 SetPosition(iNonScaledPosition.iX, iNonScaledPosition.iY); |
382 |
397 |
383 if (aChange == EResolutionChange || aChange == EFullscreenChange) |
398 if (aChange == EResolutionChange |
|
399 || aChange == EFullscreenChange |
|
400 || aChange == EForegroundGained) |
384 { |
401 { |
385 if (iUtils) |
402 if (iUtils) |
386 { |
403 { |
387 // Setting of fullscreen canvas rect. |
404 // Setting of fullscreen canvas rect. |
388 iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); |
405 iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect()); |