photosgallery/viewframework/views/cloudview/src/glxtagscontextmenucontrol.cpp
branchRCL_3
changeset 25 191387a8b767
parent 22 2dac0fdba72b
child 32 78ad99c24f08
equal deleted inserted replaced
22:2dac0fdba72b 25:191387a8b767
    26 #include <alf/alftextstyle.h>
    26 #include <alf/alftextstyle.h>
    27 #include <alf/alfenv.h>
    27 #include <alf/alfenv.h>
    28 #include <alf/alfeventhandler.h>
    28 #include <alf/alfeventhandler.h>
    29 #include <alf/alfutil.h>
    29 #include <alf/alfutil.h>
    30 #include <alf/alftexture.h>
    30 #include <alf/alftexture.h>
       
    31 #include <alf/alfcurvepath.h>
       
    32 #include <alf/alflinevisual.h>
    31 #include <alf/alfevent.h>
    33 #include <alf/alfevent.h>
    32 #include <alf/alfdisplay.h>
    34 #include <alf/alfdisplay.h>
    33 #include <alf/alfframebrush.h>
    35 #include <alf/alfframebrush.h>
    34 
    36 
    35 #include <StringLoader.h>
    37 #include <StringLoader.h>
    57 const TInt KNoOfColumns = 1;
    59 const TInt KNoOfColumns = 1;
    58 //Highest possible value to make control opaque
    60 //Highest possible value to make control opaque
    59 const TReal KOpacityOpaque = 1.0;
    61 const TReal KOpacityOpaque = 1.0;
    60 //lowest possible value to make control completely transparent
    62 //lowest possible value to make control completely transparent
    61 const TReal KOpacityTransparent = 0.0;
    63 const TReal KOpacityTransparent = 0.0;
    62 const TPoint KDummyPoint(100,100);
    64 const TPoint KDummyPoint(500, 500);
    63 //6 Seconds delay for menu control visibility on screen 
    65 //6 Seconds delay for menu control visibility on screen 
    64 const TInt KTimerDelay = 6000000;
    66 const TInt KTimerDelay = 6000000;
    65 //Control complete height
    67 //Control complete height
    66 const TInt KGridHeight = KReqHeightPerMenuItem * KNumofMenuItems;
    68 const TInt KGridHeight = KReqHeightPerMenuItem * KNumofMenuItems;
    67 //Text size for menu items
    69 //Text size for menu items
    70 const TInt KShrinkXCoord = 5;
    72 const TInt KShrinkXCoord = 5;
    71 //Y shrink factor for stylus menu border to be drawn/visible
    73 //Y shrink factor for stylus menu border to be drawn/visible
    72 const TInt KShrinkYCoord = 5;
    74 const TInt KShrinkYCoord = 5;
    73 //Padding value for Minimum width for control
    75 //Padding value for Minimum width for control
    74 const TInt KWidthPadding = 20;
    76 const TInt KWidthPadding = 20;
       
    77 //Padding value for Minimum spacing for line separators
       
    78 const TInt KLinePadding = 5;
       
    79 //Context menu separator line thickness value
       
    80 const TReal KSeparatorLineThickness = 0.2;
    75 //For Tagging the visuals
    81 //For Tagging the visuals
    76 _LIT8(KTagSlideshow, "SS");
    82 _LIT8(KTagSlideshow, "SS");
    77 _LIT8(KTagRename, "Ren");
    83 _LIT8(KTagRename, "Ren");
    78 _LIT8(KTagDelete, "Del");
    84 _LIT8(KTagDelete, "Del");
    79 
    85 
   154     frameBrush->SetFrameRectsL(innerRect, outerRect);
   160     frameBrush->SetFrameRectsL(innerRect, outerRect);
   155 
   161 
   156     iMainVisual->Brushes()->AppendL(frameBrush, EAlfHasOwnership);
   162     iMainVisual->Brushes()->AppendL(frameBrush, EAlfHasOwnership);
   157     CleanupStack::Pop(frameBrush);
   163     CleanupStack::Pop(frameBrush);
   158 
   164 
       
   165     DrawLineSeparatorsL();
   159 	ShowItemMenu(EFalse);
   166 	ShowItemMenu(EFalse);
   160     }
   167     }
   161 // --------------------------------------------------------------------------- 
   168 // --------------------------------------------------------------------------- 
   162 // ~CGlxTagsContextMenuControl()
   169 // ~CGlxTagsContextMenuControl()
   163 // --------------------------------------------------------------------------- 
   170 // --------------------------------------------------------------------------- 
   259         {
   266         {
   260         iTimer->Cancel();//cancels any outstanding requests
   267         iTimer->Cancel();//cancels any outstanding requests
   261         }
   268         }
   262 
   269 
   263     TInt upperYPos = aPoint.iY - KMinimalGap;
   270     TInt upperYPos = aPoint.iY - KMinimalGap;
   264     TInt XPos = aPoint.iX ;
   271     TInt XPos = aPoint.iX + KWidthPadding;
   265     
   272     
   266     //Preferred is to display in upper area
   273     //Preferred is to display in upper area
   267     TInt upperDisplayableHeight = upperYPos - iViewableRect.iTl.iY;
   274     TInt upperDisplayableHeight = upperYPos - iViewableRect.iTl.iY;
   268     TInt rightDisplayableWidth = iViewableRect.iBr.iY - XPos;
   275     TInt rightDisplayableWidth = iViewableRect.iBr.iX - XPos ;
   269 
   276 
   270     //always draw above
   277     //always draw above
   271     if(rightDisplayableWidth < iMaxTextWidth)
   278     if(rightDisplayableWidth < iMaxTextWidth)
   272         {
   279         {
   273         XPos = aPoint.iX - iMaxTextWidth;
   280         XPos = aPoint.iX - iMaxTextWidth;
   279     else
   286     else
   280         {
   287         {
   281         iMainVisual->SetPos(TAlfRealPoint(XPos , upperYPos - KGridHeight));
   288         iMainVisual->SetPos(TAlfRealPoint(XPos , upperYPos - KGridHeight));
   282         }
   289         }
   283     
   290     
   284     iTimer->Cancel();          //cancels any outstanding requests
   291 	if ( iTimer)
   285     iTimer->SetDelay(KTimerDelay);
   292 	    {
       
   293 		iTimer->Cancel();          //cancels any outstanding requests
       
   294 	    iTimer->SetDelay(KTimerDelay);
       
   295 		}
   286     }
   296     }
   287 
   297 
   288 // --------------------------------------------------------------------------- 
   298 // --------------------------------------------------------------------------- 
   289 // ShowItemMenu()
   299 // ShowItemMenu()
   290 // --------------------------------------------------------------------------- 
   300 // --------------------------------------------------------------------------- 
   299         }
   309         }
   300     else
   310     else
   301         {
   311         {
   302         iMainVisual->SetOpacity(KOpacityTransparent);
   312         iMainVisual->SetOpacity(KOpacityTransparent);
   303         iItemMenuVisibility = EFalse;
   313         iItemMenuVisibility = EFalse;
       
   314         iMainVisual->SetPos(TAlfRealPoint(KDummyPoint));
   304         }
   315         }
   305     }
   316     }
   306 
   317 
   307 // --------------------------------------------------------------------------- 
   318 // --------------------------------------------------------------------------- 
   308 // ItemMenuVisibility()
   319 // ItemMenuVisibility()
   388             = (iMaxTextWidth > iDeleteTextVisual->TextExtents().iWidth
   399             = (iMaxTextWidth > iDeleteTextVisual->TextExtents().iWidth
   389                               ? iMaxTextWidth
   400                               ? iMaxTextWidth
   390                                  : iDeleteTextVisual->TextExtents().iWidth);
   401                                  : iDeleteTextVisual->TextExtents().iWidth);
   391 
   402 
   392     }
   403     }
       
   404 // --------------------------------------------------------------------------- 
       
   405 // --------------------------------------------------------------------------- 
       
   406 // DrawLineSeparatorsL()
       
   407 // --------------------------------------------------------------------------- 
       
   408 //
       
   409 void CGlxTagsContextMenuControl::DrawLineSeparatorsL()
       
   410     {
       
   411     TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::DrawLineSeparators");
       
   412     TRgb color;
       
   413     //Gets the color of the line specific to skin 
       
   414     AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color,
       
   415             KAknsIIDQsnLineColors, EAknsCIQsnLineColorsCG11);
       
   416 
       
   417     for (TInt i = 1; i < KNumofMenuItems; i++)
       
   418         {
       
   419         CAlfCurvePath* curvePath = CAlfCurvePath::NewLC(*iAlfEnv);
       
   420         curvePath->AppendArcL(
       
   421                 TPoint(KLinePadding, KReqHeightPerMenuItem * i), TSize(), 0,
       
   422                 0, 0);
       
   423         curvePath->AppendLineL(
       
   424                 TPoint(KLinePadding, KReqHeightPerMenuItem * i), TPoint(
       
   425                         iMainVisual->DisplayRect().Width() - KLinePadding,
       
   426                         KReqHeightPerMenuItem * i), 0);
       
   427 
       
   428         CAlfLineVisual* line = CAlfLineVisual::AddNewL(*this, iMainVisual);
       
   429         line->SetPath(curvePath, EAlfHasOwnership);
       
   430         line->SetThickness(KSeparatorLineThickness);
       
   431         line->SetColor(color);
       
   432         line->SetFlag(EAlfVisualFlagIgnorePointer);
       
   433 
       
   434         CleanupStack::Pop(curvePath);
       
   435         }
       
   436     }