javauis/lcdui_akn/lcdui/src/CMIDCustomItem.cpp
branchRCL_3
changeset 60 6c158198356e
parent 19 04becd199f91
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
    52 
    52 
    53 /** The custom item uses a different value for limiting the max sizes because
    53 /** The custom item uses a different value for limiting the max sizes because
    54 it needs to draw bitmaps with these sizes. @see KMaxScreenSizeFactor */
    54 it needs to draw bitmaps with these sizes. @see KMaxScreenSizeFactor */
    55 const TInt KCIMaxScreenSizeFactor = 2;
    55 const TInt KCIMaxScreenSizeFactor = 2;
    56 
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // TLcduiEvent
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 enum TLcduiEvent
       
    62 {
       
    63     EFixUIOrientation,
       
    64     EUnFixUIOrientation
       
    65 };
       
    66 
       
    67 
    57 CMIDCustomItem* CMIDCustomItem::NewL(
    68 CMIDCustomItem* CMIDCustomItem::NewL(
    58     MMIDEnv& aEnv, const TDesC& aLabel, CMIDUIManager* aUIManager)
    69     MMIDEnv& aEnv, const TDesC& aLabel, CMIDUIManager* aUIManager)
    59 {
    70 {
    60     CMIDCustomItem* item = new(ELeave) CMIDCustomItem(aEnv, aUIManager);
    71     CMIDCustomItem* item = new(ELeave) CMIDCustomItem(aEnv, aUIManager);
    61     CleanupStack::PushL(item);
    72     CleanupStack::PushL(item);
    76         , iDirectPaused(ETrue)
    87         , iDirectPaused(ETrue)
    77 #endif
    88 #endif
    78         , iRestoreDirectContentWhenUnfaded(EFalse)
    89         , iRestoreDirectContentWhenUnfaded(EFalse)
    79         , iPreviousVisibility(EFalse)
    90         , iPreviousVisibility(EFalse)
    80         , iConsumerWaitingForDSAResourcesCallback(NULL)
    91         , iConsumerWaitingForDSAResourcesCallback(NULL)
       
    92         , iUiFixed(EFalse)
       
    93         , iUiToBeFixedLater(EFalse)
    81 {
    94 {
    82     iMMidItem = this;
    95     iMMidItem = this;
    83 
    96 
    84     //Default values for PointerEventSuppressor
    97     //Default values for PointerEventSuppressor
    85     iPESPointerMovementInTwips = CMIDUIManager::EPESPointerMovementInTwips;
    98     iPESPointerMovementInTwips = CMIDUIManager::EPESPointerMovementInTwips;
   243 {
   256 {
   244     DEBUG("< CMIDCustomItem::~CMIDCustomItem");
   257     DEBUG("< CMIDCustomItem::~CMIDCustomItem");
   245     if (iDirectContent)
   258     if (iDirectContent)
   246     {
   259     {
   247         iDirectContent->MdcContainerDestroyed();
   260         iDirectContent->MdcContainerDestroyed();
       
   261     }
       
   262     
       
   263     if (iUiFixed && iForm)
       
   264     {
       
   265         iForm->CurrentDisplayable().ReleaseOrientation();
       
   266         iUiFixed = EFalse;
   248     }
   267     }
   249 
   268 
   250 #ifndef RD_JAVA_NGA_ENABLED
   269 #ifndef RD_JAVA_NGA_ENABLED
   251     if (iDirectAccess)
   270     if (iDirectAccess)
   252     {
   271     {
  1326 
  1345 
  1327     if (iPreviousVisibility)
  1346     if (iPreviousVisibility)
  1328     {
  1347     {
  1329         ChangeDirectContainerVisibility(ETrue);
  1348         ChangeDirectContainerVisibility(ETrue);
  1330     }
  1349     }
       
  1350     
       
  1351     if (iUiToBeFixedLater && iForm)
       
  1352     {
       
  1353         iForm->CurrentDisplayable().FixOrientation();
       
  1354         iUiFixed = ETrue;
       
  1355         iUiToBeFixedLater = EFalse;
       
  1356     }
  1331 }
  1357 }
  1332 
  1358 
  1333 void CMIDCustomItem::ItemRemovedFromForm()
  1359 void CMIDCustomItem::ItemRemovedFromForm()
  1334 {
  1360 {
       
  1361     if (iUiFixed && iForm)
       
  1362     {
       
  1363         iForm->CurrentDisplayable().ReleaseOrientation();
       
  1364         iUiFixed = EFalse;
       
  1365         iUiToBeFixedLater = EFalse;
       
  1366     }
       
  1367 
  1335     CMIDItem::ItemRemovedFromForm();
  1368     CMIDItem::ItemRemovedFromForm();
  1336 
  1369 
  1337     ChangeDirectContainerVisibility(EFalse);
  1370     ChangeDirectContainerVisibility(EFalse);
  1338 }
  1371 }
  1339 
  1372 
  1522     // Invoke the callback from LCDUI ES thread
  1555     // Invoke the callback from LCDUI ES thread
  1523     iEnv.ToLcduiObserver().InvokeUICallback(aConsumer, aCallbackId);
  1556     iEnv.ToLcduiObserver().InvokeUICallback(aConsumer, aCallbackId);
  1524 }
  1557 }
  1525 
  1558 
  1526 // ---------------------------------------------------------------------------
  1559 // ---------------------------------------------------------------------------
       
  1560 // From class MDirectContainer.
       
  1561 // CMIDCustomItem::MdcFixUIOrientation(TBool aEnableFix)
       
  1562 // ---------------------------------------------------------------------------
       
  1563 // 
       
  1564 
       
  1565 void CMIDCustomItem::MdcFixUIOrientation(TBool aEnableFix)
       
  1566 {
       
  1567     if (aEnableFix)
       
  1568     {
       
  1569         iEnv.ToLcduiObserver().InvokeLcduiEvent(*this, EFixUIOrientation);
       
  1570     }
       
  1571     else
       
  1572     {
       
  1573         iEnv.ToLcduiObserver().InvokeLcduiEvent(*this, EUnFixUIOrientation);
       
  1574     }     
       
  1575 }
       
  1576 
       
  1577 void CMIDCustomItem::HandleLcduiEvent(int aType)
       
  1578 {
       
  1579    switch (aType)
       
  1580    {
       
  1581        case EFixUIOrientation:
       
  1582            if (!iUiFixed)
       
  1583            {
       
  1584                if (iForm)
       
  1585                {
       
  1586                    iForm->CurrentDisplayable().FixOrientation();
       
  1587                    iUiFixed = ETrue;
       
  1588                    iUiToBeFixedLater = EFalse;
       
  1589                }
       
  1590                else
       
  1591                {
       
  1592                    iUiToBeFixedLater = ETrue;
       
  1593                }
       
  1594            }
       
  1595            break;
       
  1596        case EUnFixUIOrientation:
       
  1597            if (iForm && iUiFixed)
       
  1598            {
       
  1599                iForm->CurrentDisplayable().ReleaseOrientation();
       
  1600                iUiFixed = EFalse;
       
  1601                iUiToBeFixedLater = EFalse;
       
  1602            }
       
  1603            break;    
       
  1604     }
       
  1605 }
  1527 //
  1606 //
  1528 // ---------------------------------------------------------------------------
  1607 // ---------------------------------------------------------------------------
  1529 //
  1608 //
  1530 void CMIDCustomItem::MdcAddContentBounds(const TRect& /*aRect*/)
  1609 void CMIDCustomItem::MdcAddContentBounds(const TRect& /*aRect*/)
  1531 {
  1610 {