javauis/lcdui_akn/lcdui/src/CMIDCanvasGraphicsItem.cpp
branchRCL_3
changeset 59 e5618cc85d74
parent 46 4376525cdefb
child 60 6c158198356e
equal deleted inserted replaced
46:4376525cdefb 59:e5618cc85d74
    20 #include <lcdui.h>
    20 #include <lcdui.h>
    21 #include <fbs.h>
    21 #include <fbs.h>
    22 #include <bitdev.h>
    22 #include <bitdev.h>
    23 #include <bitstd.h>
    23 #include <bitstd.h>
    24 #include <j2me/jdebug.h>
    24 #include <j2me/jdebug.h>
       
    25 #ifdef RD_JAVA_S60_RELEASE_9_2
       
    26 // Used with partial VKB
       
    27 #include <AknPriv.hrh>
       
    28 #endif // RD_JAVA_S60_RELEASE_9_2
       
    29 #include <AknDef.h>
    25 
    30 
    26 // INTERNAL INCLUDES
    31 // INTERNAL INCLUDES
    27 #include "CMIDCanvasGraphicsItem.h"
    32 #include "CMIDCanvasGraphicsItem.h"
    28 #include "CMIDCanvasGraphicsItemPainter.h"
    33 #include "CMIDCanvasGraphicsItemPainter.h"
    29 #include "CMIDUtils.h"
    34 #include "CMIDUtils.h"
    80     if (iComponentContainer)
    85     if (iComponentContainer)
    81     {
    86     {
    82         iComponentContainer->UnregisterComponent(this);
    87         iComponentContainer->UnregisterComponent(this);
    83     }
    88     }
    84 
    89 
       
    90     iComponentContainer = NULL;
       
    91     iUtils = NULL;
       
    92     
    85     DEBUG("CMIDCanvasGraphicsItem::~CMIDCanvasGraphicsItem -");
    93     DEBUG("CMIDCanvasGraphicsItem::~CMIDCanvasGraphicsItem -");
    86 }
    94 }
    87 
    95 
    88 // ---------------------------------------------------------------------------
    96 // ---------------------------------------------------------------------------
    89 // CMIDCanvasGraphicsItem::CustomComponentControlCount
    97 // CMIDCanvasGraphicsItem::CustomComponentControlCount
   150     }
   158     }
   151 
   159 
   152     // Store container. NULL is ok.
   160     // Store container. NULL is ok.
   153     iComponentContainer = aComponentContainer;
   161     iComponentContainer = aComponentContainer;
   154 
   162 
   155     // Set item size and position is needed here.
   163     if (iComponentContainer)
   156     TSize size = iItemPainter->Size();
   164     {
   157     SetSizeL(size.iWidth, size.iHeight);
   165         // Set item size and position is needed here.
   158     TPoint position = iItemPainter->Position();
   166         TSize size = iItemPainter->Size();
   159     SetPosition(position.iX, position.iY);
   167         SetSizeL(size.iWidth, size.iHeight);
   160 
   168         TPoint position = iItemPainter->Position();
   161     if (iUtils)
   169         SetPosition(position.iX, position.iY);
   162     {
   170     
   163         // Set canvas fullscreen size is needed here.
   171         if (iUtils)
   164         iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect());
   172         {
   165     }
   173             // Set canvas fullscreen size is needed here.
   166 
   174             iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect());
       
   175         }
       
   176     }
   167     DEBUG("CMIDCanvasGraphicsItem::SetParentL -");
   177     DEBUG("CMIDCanvasGraphicsItem::SetParentL -");
   168 }
   178 }
   169 
   179 
   170 // ---------------------------------------------------------------------------
   180 // ---------------------------------------------------------------------------
   171 // CMIDCanvasGraphicsItem::SetDirectContainerL
   181 // CMIDCanvasGraphicsItem::SetDirectContainerL
   314 // (other items are commented in the header file)
   324 // (other items are commented in the header file)
   315 // ---------------------------------------------------------------------------
   325 // ---------------------------------------------------------------------------
   316 //
   326 //
   317 void CMIDCanvasGraphicsItem::HandleFullscreenModeChange()
   327 void CMIDCanvasGraphicsItem::HandleFullscreenModeChange()
   318 {
   328 {
   319     // Calling all functions which set size and position.
   329     if (iUtils && iUtils->IsScalingEnabled())
       
   330     {
       
   331         // We need reposition text editor.
       
   332         HandleChangeForScaling(EFullscreenChange);
       
   333     }
       
   334 }
       
   335 
       
   336 TBool CMIDCanvasGraphicsItem::IsScalingOn() const
       
   337 {
       
   338     return iUtils && iComponentContainer && iUtils->IsScalingEnabled()
       
   339 #ifdef RD_JAVA_S60_RELEASE_9_2
       
   340            && !iPartialVKBOpen
       
   341 #endif // RD_JAVA_S60_RELEASE_9_2
       
   342            && iComponentContainer->IsFullScreen();
       
   343 }
       
   344 
       
   345 void CMIDCanvasGraphicsItem::HandleResourceChange(TInt aType)
       
   346 {
       
   347 #ifdef RD_JAVA_S60_RELEASE_9_2
       
   348     if ((aType == KAknSplitInputEnabled) ||
       
   349             (aType == KAknSplitInputDisabled))
       
   350     {
       
   351         iPartialVKBOpen = (aType == KAknSplitInputEnabled);
       
   352 
       
   353         if (iUtils && iComponentContainer && iUtils->IsScalingEnabled() &&
       
   354                 iComponentContainer->IsFullScreen())
       
   355         {
       
   356             // We need reposition text editor.
       
   357             HandleChangeForScaling(EPartialVKBChange);
       
   358         }
       
   359     }
       
   360 #endif // RD_JAVA_S60_RELEASE_9_2
       
   361 
       
   362     if (KEikDynamicLayoutVariantSwitch)
       
   363     {
       
   364         if (iUtils && iComponentContainer && iUtils->IsScalingEnabled() &&
       
   365                 iComponentContainer->IsFullScreen())
       
   366         {
       
   367             // We need reposition text editor.
       
   368             HandleChangeForScaling(EResolutionChange);
       
   369         }
       
   370     }
       
   371 }
       
   372 
       
   373 void CMIDCanvasGraphicsItem::HandleChangeForScaling(TChange aChange)
       
   374 {
       
   375     // Calling functions which set size and position.
   320     TRAPD(err, SetSizeL(iNonScaledSize.iWidth, iNonScaledSize.iHeight));
   376     TRAPD(err, SetSizeL(iNonScaledSize.iWidth, iNonScaledSize.iHeight));
   321     if (err != KErrNone)
   377     if (err != KErrNone)
   322     {
   378     {
   323         DEBUG_INT("CMIDCanvasGraphicsItem::HandleFullscreenModeChange: SetSizeL method leave with %d code", err);
   379         DEBUG_INT("CMIDCanvasGraphicsItem::HandleFullscreenModeChange: SetSizeL method leave with %d code", err);
   324     }
   380     }
   325     SetPosition(iNonScaledPosition.iX, iNonScaledPosition.iY);
   381     SetPosition(iNonScaledPosition.iX, iNonScaledPosition.iY);
   326 
   382 
   327     if (iUtils)
   383     if (aChange == EResolutionChange || aChange == EFullscreenChange)
   328     {
   384     {
   329         // Setting of fullscreen canvas rect.
   385         if (iUtils)
   330         iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect());
   386         {
   331     }
   387             // Setting of fullscreen canvas rect.
   332 }
   388             iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect());
   333 
   389         }
   334 // ---------------------------------------------------------------------------
   390     }
   335 // CMIDCanvasGraphicsItem::HandleResolutionChange
   391 
   336 // (other items are commented in the header file)
   392 #ifdef RD_JAVA_S60_RELEASE_9_2
   337 // ---------------------------------------------------------------------------
   393     if (aChange == EPartialVKBChange)
   338 //
   394     {
   339 void CMIDCanvasGraphicsItem::HandleResolutionChange()
   395         if (iPartialVKBOpen)
   340 {
   396         {
   341     // Calling all functions which set size and position.
   397             // When partial VKB is opening, stop scaling.
   342     TRAPD(err, SetSizeL(iNonScaledSize.iWidth, iNonScaledSize.iHeight));
   398             iItemPainter->SetOnScreenCanvasRect(iComponentContainer->Control().Rect());
   343     if (err != KErrNone)
   399         }
   344     {
   400         else if (iUtils)
   345         DEBUG_INT("CMIDCanvasGraphicsItem::HandleFullscreenModeChange: SetSizeL method leave with %d code", err);
   401         {
   346     }
   402             // When partial VKB is closing, restore scaling.
   347     SetPosition(iNonScaledPosition.iX, iNonScaledPosition.iY);
   403             iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect());
   348     if (iUtils)
   404         }
   349     {
   405     }
   350         // Setting of fullscreen canvas rect.
   406 #endif // RD_JAVA_S60_RELEASE_9_2
   351         iItemPainter->SetOnScreenCanvasRect(iUtils->GetOnScreenCanvasRect());
       
   352     }
       
   353 }
       
   354 
       
   355 TBool CMIDCanvasGraphicsItem::IsScalingOn() const
       
   356 {
       
   357     return iUtils && iComponentContainer && iUtils->IsScalingEnabled() &&
       
   358            iComponentContainer->IsFullScreen();
       
   359 }
   407 }
   360 
   408 
   361 // End of file
   409 // End of file