photosgallery/viewframework/views/cloudview/src/glxtagscontextmenucontrol.cpp
branchRCL_3
changeset 75 01504893d9cb
parent 64 34937ec34dac
equal deleted inserted replaced
68:5b238bc8ffb6 75:01504893d9cb
    34 #include <alf/alfevent.h>
    34 #include <alf/alfevent.h>
    35 #include <alf/alfdisplay.h>
    35 #include <alf/alfdisplay.h>
    36 #include <alf/alfframebrush.h>
    36 #include <alf/alfframebrush.h>
    37 
    37 
    38 #include <StringLoader.h>
    38 #include <StringLoader.h>
    39 #include <touchfeedback.h>
       
    40 
    39 
    41 // Photos Headers
    40 // Photos Headers
    42 #include "glxtagscontextmenucontrol.h"
    41 #include "glxtagscontextmenucontrol.h"
    43 #include "glxcommandfactory.h"
    42 #include "glxcommandfactory.h"
    44 #include <mglxmedialist.h>                          //for medialist
    43 #include <mglxmedialist.h>                          //for medialist
   273         {
   272         {
   274         iTimer->Cancel();//cancels any outstanding requests
   273         iTimer->Cancel();//cancels any outstanding requests
   275         }
   274         }
   276 
   275 
   277     TInt upperYPos = aPoint.iY - KMinimalGap;
   276     TInt upperYPos = aPoint.iY - KMinimalGap;
   278     TInt xPos = aPoint.iX;
   277     TInt XPos = aPoint.iX;
   279     
   278     
       
   279     //Preferred is to display in upper area
       
   280     TInt upperDisplayableHeight = upperYPos - iViewableRect.iTl.iY;
       
   281     TInt rightDisplayableWidth = iViewableRect.iBr.iX - (XPos + KRightMargin
       
   282             + KWidthPadding);
       
   283 
   280     //always draw above
   284     //always draw above
   281     if ((iViewableRect.iBr.iX - (xPos + KRightMargin + KWidthPadding))
   285     if(rightDisplayableWidth < iMaxTextWidth)
   282             < iMaxTextWidth)
   286         {
   283         {
   287         XPos = aPoint.iX - iMaxTextWidth;
   284         xPos = aPoint.iX - iMaxTextWidth;
   288         }
   285         }
   289     if(upperDisplayableHeight < KGridHeight)
   286 
   290         {
   287     if (upperYPos + KGridHeight > iViewableRect.iBr.iY)
   291         iMainVisual->SetPos(TAlfRealPoint(XPos , upperYPos ));
   288         {
   292         }
   289         upperYPos = iViewableRect.iBr.iY - KGridHeight;
   293     else
   290         }
   294         {
   291 
   295         iMainVisual->SetPos(TAlfRealPoint(XPos , upperYPos - KGridHeight));
   292     iMainVisual->SetPos(TAlfRealPoint(xPos, upperYPos));
   296         }
   293     
   297     
   294 	if ( iTimer)
   298 	if ( iTimer)
   295 	    {
   299 	    {
   296 		iTimer->Cancel();          //cancels any outstanding requests
   300 		iTimer->Cancel();          //cancels any outstanding requests
   297 	    iTimer->SetDelay(KTimerDelay);
   301 	    iTimer->SetDelay(KTimerDelay);
   339     TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::OfferEventL");
   343     TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::OfferEventL");
   340     TBool consumed = EFalse;
   344     TBool consumed = EFalse;
   341 
   345 
   342     if (aEvent.IsPointerEvent() && iItemMenuVisibility )
   346     if (aEvent.IsPointerEvent() && iItemMenuVisibility )
   343         {
   347         {
   344         MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   345         if (aEvent.PointerDown())
   348         if (aEvent.PointerDown())
   346             {
   349             {
   347             iCommandId = KErrNotFound;
   350             iCommandId = KErrNotFound;
   348             Display()->Roster().SetPointerEventObservers(
   351             Display()->Roster().SetPointerEventObservers(
   349                     EAlfPointerEventReportDrag
   352                     EAlfPointerEventReportDrag
   384                             EAlfHasOwnership);
   387                             EAlfHasOwnership);
   385 
   388 
   386                     iCommandId = EGlxCmdRename;
   389                     iCommandId = EGlxCmdRename;
   387                     }
   390                     }
   388                 consumed = ETrue;
   391                 consumed = ETrue;
   389                 if (feedback)
       
   390                     {
       
   391                     feedback->InstantFeedback(ETouchFeedbackBasic);
       
   392                     }
       
   393                 CleanupStack::Pop(brush);
   392                 CleanupStack::Pop(brush);
   394                 }//End of iItemMenuVisibility check
   393                 }//End of iItemMenuVisibility check
   395             }//End of Pointer down event 
   394             }//End of Pointer down event 
   396         else if (aEvent.PointerUp())
   395         else if (aEvent.PointerUp())
   397             {
   396             {
   420                     aEvent.PointerEvent().iParentPosition);
   419                     aEvent.PointerEvent().iParentPosition);
   421             if (!eventInsideControl)
   420             if (!eventInsideControl)
   422                 {
   421                 {
   423                 HandleUpEventL();
   422                 HandleUpEventL();
   424                 }
   423                 }
   425             else if (eventInsideControl && feedback)
       
   426                 {
       
   427                 feedback->InstantFeedback(ETouchFeedbackBasic);
       
   428                 }
       
   429             consumed = ETrue;
   424             consumed = ETrue;
   430             }
   425             }
   431         consumed = ETrue;
   426         consumed = ETrue;
   432         }
   427         }
   433     return consumed;
   428     return consumed;
   439 //
   434 //
   440 void CGlxTagsContextMenuControl::TimerCompleteL()
   435 void CGlxTagsContextMenuControl::TimerCompleteL()
   441     {
   436     {
   442     TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::TimerCompleteL");
   437     TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::TimerCompleteL");
   443     ShowItemMenuL(EFalse);
   438     ShowItemMenuL(EFalse);
   444     iItemMenuObserver.HandleGridMenuListL();
       
   445     }
   439     }
   446 
   440 
   447 // --------------------------------------------------------------------------- 
   441 // --------------------------------------------------------------------------- 
   448 // SetViewableRect()
   442 // SetViewableRect()
   449 // --------------------------------------------------------------------------- 
   443 // ---------------------------------------------------------------------------