photosgallery/viewframework/views/cloudview/inc/glxtagscontextmenucontrol.h
branchRCL_3
changeset 26 5b3385a43d68
child 27 34937ec34dac
equal deleted inserted replaced
25:8e5f6eea9c9f 26:5b3385a43d68
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Cloud View Context menu control
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef GLXTAGSCONTEXTMENUCONTROL_H_
       
    19 #define GLXTAGSCONTEXTMENUCONTROL_H_
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32std.h>
       
    23 #include <alf/alfcontrol.h>
       
    24 #include "glxbubbletimer.h"                         //for timer functionality
       
    25 
       
    26 //Forward Declaration
       
    27 class CAlfGridLayout;
       
    28 class CAlfEnv;
       
    29 
       
    30 /**
       
    31  *MGlxItemMenuObserver is a class to handle the menu items in grid layout
       
    32  */
       
    33 class MGlxItemMenuObserver
       
    34     {
       
    35 public:
       
    36     /**
       
    37      * To Handle menu items in Grid layout
       
    38      * @param aCommand command to be handled
       
    39      */
       
    40     virtual void HandleGridMenuListL(TInt aCommand) = 0;
       
    41     };
       
    42 
       
    43 class CGlxTagsContextMenuControl : public CAlfControl,
       
    44         public MGlxTimerNotifier
       
    45 
       
    46     {
       
    47 public:
       
    48     /**     
       
    49      *  Perform the two phase construction
       
    50      *  @param aItemMenuObserver - handles the menu items in grid layout
       
    51      *  @return Pointer to newly created object
       
    52      */
       
    53     static CGlxTagsContextMenuControl* NewL(
       
    54             MGlxItemMenuObserver& aItemMenuObserver);
       
    55     /**     
       
    56      *  Perform the two phase construction
       
    57      *  @param aItemMenuObserver - handles the menu items in grid layout
       
    58      *  @return Pointer to newly created object
       
    59      */
       
    60     static CGlxTagsContextMenuControl* NewLC(
       
    61             MGlxItemMenuObserver& aItemMenuObserver);
       
    62     /**
       
    63      * Destroy the object and release all memory objects
       
    64      */
       
    65     ~CGlxTagsContextMenuControl();
       
    66 
       
    67 public:
       
    68     //MGlxTimernotifier
       
    69     /**
       
    70      * Virtual Function from MGlxTimernotifier
       
    71      */
       
    72     void TimerCompleteL();
       
    73 
       
    74 public:
       
    75     /**
       
    76      * Sets the grid layout on the screen with the Point specified
       
    77      * @param aPoint - Point from which grid has to be displayed
       
    78      */
       
    79     void SetDisplay(const TPoint& aPoint);
       
    80     /**
       
    81      * Hides/shows the grid layout
       
    82      * @param aOpacity - Opacity value
       
    83      */
       
    84     void ShowItemMenuL(TBool aOpacity);
       
    85     /**
       
    86      * Hides/shows the grid layout
       
    87      * @return value of menu's visibility
       
    88      */
       
    89     TBool ItemMenuVisibility();
       
    90 
       
    91     /**
       
    92      * Sets the drawable screen rect 
       
    93      * It also handles coordinates changed from Orientation
       
    94      * @param aRect - rect area where the Tags are drawn
       
    95      */
       
    96     void SetViewableRect(TRect aRect);
       
    97 
       
    98     /**
       
    99     * Handles the Up event when moved away from stylus menu
       
   100     */
       
   101     void HandleUpEventL();
       
   102     
       
   103 private:
       
   104     /**     
       
   105      *  constructor 
       
   106      *  @param aItemMenuObserver - handles the menu items in grid layout
       
   107      */
       
   108     CGlxTagsContextMenuControl(MGlxItemMenuObserver& aItemMenuObserver);
       
   109 
       
   110     /** 
       
   111      *  Perform the second phase of two phase construction
       
   112      */
       
   113     void ConstructL();
       
   114 
       
   115     /** 
       
   116      *  Creates the font 
       
   117      *  @return the fontId
       
   118      */
       
   119     TInt CreateFontL();
       
   120     /** 
       
   121      *  Creates the menulist and sets the Text style 
       
   122      *  @param aFontId - Sets the text style
       
   123      */
       
   124     void CreateMenuListL(TInt aFontId);
       
   125 
       
   126     /** 
       
   127      *  Calculates the maximum text width of menu items 
       
   128      */
       
   129     void CalculateMaxWidth();
       
   130     /** 
       
   131      *  Draws the line separators in Stylus menu
       
   132      */
       
   133     void DrawLineSeparatorsL();
       
   134     /**     
       
   135      *  Perform the two phase construction
       
   136      *  @param  aEvent - key Event to handle
       
   137      *  @return EKeyWasConsumed if key event is processed,
       
   138      *         otherwise EKeyWasNotConsumed
       
   139      */
       
   140     TBool OfferEventL(const TAlfEvent& aEvent);
       
   141 
       
   142 private:
       
   143 
       
   144     //Observer to handle the menu items in grid layout
       
   145     MGlxItemMenuObserver& iItemMenuObserver;
       
   146 
       
   147     //Grid layout, not owning
       
   148     CAlfGridLayout* iGrid;
       
   149     /** The Alf environment*/
       
   150     CAlfEnv* iAlfEnv;
       
   151 
       
   152     //Slideshow text, not owning
       
   153     CAlfTextVisual* iSlideshowTextVisual;
       
   154 
       
   155     //Delete text, not owning
       
   156     CAlfTextVisual* iDeleteTextVisual;
       
   157 
       
   158     //Rename text, not owning
       
   159     CAlfTextVisual* iRenameTextVisual;
       
   160 
       
   161     // Anchor Layout
       
   162     CAlfAnchorLayout* iMainVisual;
       
   163 
       
   164     //variable used for providing delay
       
   165     CGlxBubbleTimer* iTimer;
       
   166 
       
   167     //Viewable rect
       
   168     TRect iViewableRect;
       
   169 
       
   170     //flag for stylus menu visibility
       
   171     TBool iItemMenuVisibility;
       
   172     
       
   173     //Menu item selected
       
   174     TInt iCommandId;
       
   175     
       
   176     //Maximum text width of a menu item
       
   177     TInt iMaxTextWidth;
       
   178     };
       
   179 
       
   180 #endif /* GLXTAGSCONTEXTMENUCONTROL_H_ */