javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItem.cpp
branchRCL_3
changeset 60 6c158198356e
parent 59 e5618cc85d74
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
    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     }
   311 // ---------------------------------------------------------------------------
   317 // ---------------------------------------------------------------------------
   312 //
   318 //
   313 void CMIDCanvasGraphicsItem::Dispose()
   319 void CMIDCanvasGraphicsItem::Dispose()
   314 {
   320 {
   315     DEBUG("CMIDCanvasGraphicsItem::Dispose +");
   321     DEBUG("CMIDCanvasGraphicsItem::Dispose +");
   316 
   322     
   317     delete this;
   323     delete this;
   318 
   324 
   319     DEBUG("CMIDCanvasGraphicsItem::Dispose -");
   325     DEBUG("CMIDCanvasGraphicsItem::Dispose -");
   320 }
   326 }
   321 
   327 
   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());
   404         }
   421         }
   405     }
   422     }
   406 #endif // RD_JAVA_S60_RELEASE_9_2
   423 #endif // RD_JAVA_S60_RELEASE_9_2
   407 }
   424 }
   408 
   425 
       
   426 void CMIDCanvasGraphicsItem::DeregisterCanvasGraphicsItem()
       
   427 {
       
   428     // This method is called on item from painter, when painter is disposed 
       
   429     // before disposal of item
       
   430     if (iComponentContainer)
       
   431     {
       
   432         // Remove this component from the container if set.
       
   433         iComponentContainer->UnregisterComponent(this);
       
   434     }
       
   435 
       
   436     iComponentContainer = NULL;
       
   437 }
   409 // End of file
   438 // End of file