photosgallery/viewframework/views/cloudview/src/glxcloudviewcontrol.cpp
branchRCL_3
changeset 21 f9e827349359
parent 18 78ad99c24f08
child 23 b023a8d2866a
equal deleted inserted replaced
19:420f6808bf21 21:f9e827349359
  1409 TBool CGlxCloudViewControl::HandlePointerEventL( const TAlfEvent &aEvent )
  1409 TBool CGlxCloudViewControl::HandlePointerEventL( const TAlfEvent &aEvent )
  1410     {
  1410     {
  1411     TRACER("GLX_CLOUD::CGlxCloudViewControl::HandlePointerEventL");
  1411     TRACER("GLX_CLOUD::CGlxCloudViewControl::HandlePointerEventL");
  1412     CAlfVisual* tappedvisual = aEvent.Visual();	
  1412     CAlfVisual* tappedvisual = aEvent.Visual();	
  1413     TBool consumed = EFalse;
  1413     TBool consumed = EFalse;
  1414     
       
  1415 
  1414 
  1416     if(aEvent.PointerEvent().iType == TPointerEvent::EButton1Down)
  1415     if(aEvent.PointerEvent().iType == TPointerEvent::EButton1Down)
  1417         {	
  1416         {	
  1418         iDownEventReceived = EFalse;
  1417         iDownEventReceived = ETrue;
  1419         //reset variables & Physics simulator 
  1418         //reset variables & Physics simulator 
  1420         iPhysics->StopPhysics();
  1419         iPhysics->StopPhysics();
  1421         iPhysics->ResetFriction();
  1420         iPhysics->ResetFriction();
  1422         iDragging = EFalse;
  1421         iDragging = EFalse;
  1423         iPhysicsStarted = EFalse;
  1422         iPhysicsStarted = EFalse;
  1429         Display()->Roster().DisableLongTapEventsWhenDragging(*this);
  1428         Display()->Roster().DisableLongTapEventsWhenDragging(*this);
  1430         
  1429         
  1431         //If the grid is already shown , disable it
  1430         //If the grid is already shown , disable it
  1432         if(iTagsContextMenuControl->ItemMenuVisibility())
  1431         if(iTagsContextMenuControl->ItemMenuVisibility())
  1433            {
  1432            {
  1434            iDownEventReceived = ETrue;
       
  1435            iTagsContextMenuControl->ShowItemMenuL(EFalse);
  1433            iTagsContextMenuControl->ShowItemMenuL(EFalse);
  1436            return ETrue;
  1434            return ETrue;
  1437            }
  1435            }
  1438         if(tappedvisual)
  1436         if(tappedvisual)
  1439             {
  1437             {
  1455                     break;
  1453                     break;
  1456                     }
  1454                     }
  1457                 }
  1455                 }
  1458             }
  1456             }
  1459         }
  1457         }
  1460     else if(iDownEventReceived)
  1458     else if (iDownEventReceived && aEvent.PointerEvent().iType == TPointerEvent::EDrag)
  1461         {
       
  1462         consumed = ETrue;
       
  1463         }
       
  1464     else if (aEvent.PointerEvent().iType == TPointerEvent::EDrag)
       
  1465         {
  1459         {
  1466         GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::HandlePointerEventL(EDrag) event");
  1460         GLX_LOG_INFO("GLX_CLOUD :: CGlxCloudViewControl::HandlePointerEventL(EDrag) event");
  1467         
  1461 
  1468         iTouchFeedback->InstantFeedback(ETouchFeedbackBasic);
  1462         iTouchFeedback->InstantFeedback(ETouchFeedbackBasic);
  1469 
  1463 
  1470         consumed = HandleDragL(aEvent.PointerEvent());
  1464         consumed = HandleDragL(aEvent.PointerEvent());
  1471         }
  1465         }
  1472     else if (aEvent.PointerUp())
  1466     else if (iDownEventReceived && aEvent.PointerUp())
  1473         {
  1467         {
       
  1468         iDownEventReceived = EFalse;
  1474         Display()->Roster().SetPointerEventObservers(0, *this);
  1469         Display()->Roster().SetPointerEventObservers(0, *this);
  1475         consumed = ETrue;
  1470         consumed = ETrue;
  1476         
  1471         
  1477         //If the long press timer is completed , and if upevent is received.. ignore it
  1472         //If the long press timer is completed , and if upevent is received.. ignore it
  1478         if(iTimerComplete)
  1473         if(iTimerComplete)
  1698 
  1693 
  1699 // ---------------------------------------------------------------------------
  1694 // ---------------------------------------------------------------------------
  1700 // offerEvent()
  1695 // offerEvent()
  1701 // ---------------------------------------------------------------------------
  1696 // ---------------------------------------------------------------------------
  1702 //
  1697 //
  1703 AlfEventStatus CGlxCloudViewControl::offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent )
  1698 AlfEventStatus CGlxCloudViewControl::offerEvent(CAlfWidgetControl& aControl,
       
  1699         const TAlfEvent& aEvent)
  1704     {
  1700     {
  1705     TRACER("GLX_CLOUD::CGlxCloudViewControl::offerEvent");  
  1701     TRACER("GLX_CLOUD::CGlxCloudViewControl::offerEvent");  
  1706     AlfEventStatus status = EEventNotHandled;  
  1702     AlfEventStatus status = EEventNotHandled;  
  1707     if(aEvent.IsCustomEvent() && accept(aControl, aEvent))
  1703     if(aEvent.IsCustomEvent() && accept(aControl, aEvent))
  1708         {
  1704         {
  1757 
  1753 
  1758 // ---------------------------------------------------------------------------
  1754 // ---------------------------------------------------------------------------
  1759 // accept()
  1755 // accept()
  1760 // ---------------------------------------------------------------------------
  1756 // ---------------------------------------------------------------------------
  1761 //   
  1757 //   
  1762 bool CGlxCloudViewControl::accept ( CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent ) const
  1758 bool CGlxCloudViewControl::accept(CAlfWidgetControl& /*aControl*/,
       
  1759         const TAlfEvent& aEvent) const
  1763     {
  1760     {
  1764     TRACER("GLX_CLOUD::CGlxCloudViewControl::accept");
  1761     TRACER("GLX_CLOUD::CGlxCloudViewControl::accept");
  1765     if(	aEvent.CustomParameter() == EEventScrollPageUp 	||
  1762     if(	aEvent.CustomParameter() == EEventScrollPageUp 	||
  1766         aEvent.CustomParameter() == EEventScrollPageDown ||
  1763         aEvent.CustomParameter() == EEventScrollPageDown ||
  1767         aEvent.CustomParameter() == EEventDragVertical ||
  1764         aEvent.CustomParameter() == EEventDragVertical ||
  1775 // ---------------------------------------------------------------------------
  1772 // ---------------------------------------------------------------------------
  1776 // attachScrollBar()
  1773 // attachScrollBar()
  1777 // ---------------------------------------------------------------------------
  1774 // ---------------------------------------------------------------------------
  1778 //	
  1775 //	
  1779 void CGlxCloudViewControl::InitializeScrollBar(IAlfScrollBarWidget* aScrollBarWidget)
  1776 void CGlxCloudViewControl::InitializeScrollBar(IAlfScrollBarWidget* aScrollBarWidget)
  1780     { 
  1777     {
  1781     TRACER("GLX_CLOUD::CGlxCloudViewControl::InitializeScrollBar");
  1778     TRACER("GLX_CLOUD::CGlxCloudViewControl::InitializeScrollBar");
  1782     iScrollBarWidget=aScrollBarWidget;
  1779     iScrollBarWidget = aScrollBarWidget;
  1783     ((IAlfScrollBarModel *)(iScrollBarWidget->model()))->initializeData(iScrollEventData.mSpan,
  1780     ((IAlfScrollBarModel *) (iScrollBarWidget->model()))->initializeData(
  1784             iScrollEventData.mViewLength,0);													           
  1781             iScrollEventData.mSpan, iScrollEventData.mViewLength, 0);
  1785     DisplayScrollBar();	
  1782     DisplayScrollBar();
  1786     }
  1783     }
  1787 
  1784 
  1788 // ---------------------------------------------------------------------------
  1785 // ---------------------------------------------------------------------------
  1789 // Scroll()
  1786 // Scroll()
  1790 // ---------------------------------------------------------------------------
  1787 // ---------------------------------------------------------------------------
  1838 // DisplayScrollBar()
  1835 // DisplayScrollBar()
  1839 // ---------------------------------------------------------------------------
  1836 // ---------------------------------------------------------------------------
  1840 //
  1837 //
  1841 void CGlxCloudViewControl::DisplayScrollBar() 
  1838 void CGlxCloudViewControl::DisplayScrollBar() 
  1842     {
  1839     {
  1843     if( iScrollBarWidget )
  1840     if (iScrollBarWidget)
  1844         {
  1841         {
  1845         IAlfElement* vertBaseElement =(iScrollBarWidget->control()->findElement ("BaseElement"));
  1842         IAlfElement* vertBaseElement =(iScrollBarWidget->control()->findElement ("BaseElement"));
  1846         IAlfScrollBarDefaultBaseElement* scrollbarbaselement=static_cast<IAlfScrollBarDefaultBaseElement*> (
  1843         IAlfScrollBarDefaultBaseElement* scrollbarbaselement=static_cast<IAlfScrollBarDefaultBaseElement*> (
  1847             vertBaseElement->makeInterface (IAlfScrollBarDefaultBaseElement::type() ) );
  1844             vertBaseElement->makeInterface (IAlfScrollBarDefaultBaseElement::type() ) );
  1848 
  1845 
  1849         if( iScrollEventData.mSpan )
  1846         // To set the scrollbar visibility, it's enough to set the opacity 
  1850             {       
  1847         // of baselayout. No need to set the opacity of thumb separately. 
  1851             scrollbarbaselement->setThumbOpacity(1.0);  
  1848         if (iScrollEventData.mSpan)
       
  1849             {
  1852             //make scroll bar visible
  1850             //make scroll bar visible
  1853             scrollbarbaselement->setOpacity(1.0);
  1851             scrollbarbaselement->setOpacity(1.0);
  1854             }
  1852             }
  1855         else
  1853         else
  1856             {
  1854             {
  1857             scrollbarbaselement->setThumbOpacity(0.0);  
       
  1858             //make scroll bar invisible
  1855             //make scroll bar invisible
  1859             scrollbarbaselement->setOpacity(0.0);
  1856             scrollbarbaselement->setOpacity(0.0);
  1860             }
  1857             }
  1861         }
  1858         }
  1862     }
  1859     }