photosgallery/viewframework/uiutilities/inc/glxuiutility.h
changeset 0 4e91876724a2
child 14 ce1c7ad1f18b
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     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:    ALF TK utilities
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_GLXUIUTILITY_H
       
    22 #define C_GLXUIUTILITY_H
       
    23 
       
    24 // external incudes
       
    25 #include <e32base.h>
       
    26 #include <gdi.h>
       
    27 
       
    28 #include <alf/alfenv.h>  //for action observers
       
    29 
       
    30 // Internal includes
       
    31 #include <mglxtvobserver.h>     // for inteface MGlxTvObserver
       
    32 
       
    33 // constants
       
    34 const TUint KGlxDefaultVisibleItemsGranularity = 15;
       
    35 const TUint KGlxQHDVisibleItemsGranularity = 20;
       
    36 const TUint KGlxVGAVisibleItemsGranularity = 21;
       
    37 
       
    38 class MGlxSkinChangeObserver;
       
    39 class CGlxSkinChangeMonitor;
       
    40 class CCoeAppUi;
       
    41 class CGlxSettingsModel;
       
    42 class CGlxTextureManager;
       
    43 class CAlfEnv;
       
    44 class CAlfDisplay;
       
    45 class CAlfTexture;
       
    46 class CAlfControl;
       
    47 class CGlxTv;
       
    48 class CGlxResolutionManager;
       
    49 class CGlxScreenFurniture;
       
    50 //class CHgContextUtility;
       
    51 /**
       
    52  * Enumeration for different types of navigations that occur from one view to the next
       
    53  */
       
    54 enum TGlxNavigationDirection 
       
    55     {
       
    56     EGlxNavigationForwards, 
       
    57     EGlxNavigationBackwards, 
       
    58     EGlxNavigationNext, 
       
    59     EGlxNavigationPrevious
       
    60     };
       
    61 
       
    62 /**
       
    63  * Enumeration for screen orientation of the application.
       
    64  */
       
    65 enum TGlxOrientation
       
    66     {
       
    67     EGlxOrientationUninitialised,   /**< For internal use only */
       
    68     EGlxOrientationDefault,         /**< Default orientation for the device */
       
    69     EGlxOrientationTextEntry,       /**< Text entry orientation for the device */
       
    70     EGlxOrientationLandscape        /**< Landscape orientation */
       
    71     };
       
    72 
       
    73 /**
       
    74  *  CGlxUiUtility
       
    75  *
       
    76  *  Alf utils
       
    77  *
       
    78  *  @lib glxalfutils.lib
       
    79  *
       
    80  *  @internal reviewed 12/06/2007 by Dave Schofield
       
    81  */
       
    82 class CGlxUiUtility : public CBase, 
       
    83                        public MGlxTvObserver ,             // for TV Out
       
    84                        public MAlfActionObserver           //FOR layout change notifications                      
       
    85     {
       
    86     
       
    87 public:
       
    88     /**
       
    89      * Get the single instance of the utility and increment the reference count.
       
    90      * The caller must call Close() when the utility is no longer needed.
       
    91      * @return Pointer to the single instance of the UiUtility.
       
    92      */
       
    93     IMPORT_C static CGlxUiUtility* UtilityL();
       
    94     
       
    95     /**
       
    96      * Decrement the reference count of the utility and delete it if the count
       
    97      * becomes zero.
       
    98      */
       
    99     IMPORT_C void Close();
       
   100 
       
   101     /**
       
   102      * Get a pointer to the Alf environment.
       
   103      * @return The ALF environment owned by the AlfUtility.
       
   104      */
       
   105     IMPORT_C CAlfEnv* Env() const;
       
   106     
       
   107     /**
       
   108      * Get a pointer to the Alf display.
       
   109      * @return The ALF display owned by ALF.
       
   110      */
       
   111     IMPORT_C CAlfDisplay* Display() const;
       
   112 
       
   113     /**
       
   114      * Shows the Alf display in full screen.
       
   115      */
       
   116     IMPORT_C static void ShowAlfDisplayL();
       
   117 
       
   118     /**
       
   119      * Hides the Alf display so that Avkon screen can take over the whole screen
       
   120      * and Avkon dialog can show the status pane.
       
   121      */
       
   122     IMPORT_C static void HideAlfDisplayL();
       
   123 
       
   124     /**
       
   125      * Return the GlxTextureManager owned by the UiUtility.
       
   126      * This pointer is only guaranteed to be valid until the UiUtility is Close()d.
       
   127      * @return The GlxTextureManager owned by the UiUtility
       
   128      */
       
   129     IMPORT_C CGlxTextureManager& GlxTextureManager();
       
   130 
       
   131     /**
       
   132      * @return The current direction of the switch between views
       
   133      */
       
   134     IMPORT_C TGlxNavigationDirection ViewNavigationDirection();
       
   135 
       
   136     /**
       
   137      * Set the current direction of the switch between views
       
   138      * @param aDirection The direction of the navigation
       
   139      */
       
   140     IMPORT_C void SetViewNavigationDirection(TGlxNavigationDirection aDirection);
       
   141 
       
   142     
       
   143     /**
       
   144       * Helper function to return display size
       
   145       * @return Display size
       
   146       */
       
   147     IMPORT_C TSize DisplaySize() const;
       
   148 
       
   149     /**
       
   150      * Get an id of a text style corresponding to the font and size
       
   151      * @param aFontId  The Avkon logical font Id
       
   152      * @param aSizeInPixels The size of the text
       
   153      * @return The Id of the Text style in the UiTextStyleManager
       
   154      */
       
   155     IMPORT_C TInt TextStyleIdL(TInt aFontId, TInt aSizeInPixels);
       
   156 
       
   157     /**
       
   158      * Set the screen orientation of the application.
       
   159      * @param aOrientation  The new orientation.
       
   160      */
       
   161     IMPORT_C void SetAppOrientationL(TGlxOrientation aOrientation);
       
   162     /**
       
   163      * @return The current screen orientation of the application.
       
   164      */
       
   165     IMPORT_C TGlxOrientation AppOrientation() const;
       
   166     
       
   167     /**
       
   168      * ScreenFurniture
       
   169      * @return pointer to CGlxScreenFurniture
       
   170      */
       
   171     IMPORT_C CGlxScreenFurniture* ScreenFurniture();
       
   172 
       
   173     /**
       
   174      * CHgContextUtility
       
   175      * @return pointer to CHgContextUtility
       
   176      */
       
   177     //IMPORT_C CHgContextUtility* ContextUtility();
       
   178     
       
   179     /**
       
   180      * This method can be used to check whether pen support is enabled.
       
   181      * @return ETrue if pen support is enabled, otherwise EFalse.
       
   182      */
       
   183     IMPORT_C TBool IsPenSupported();
       
   184     //Nitz Review Added
       
   185     /**
       
   186      * This method can be used to set the image size required for Rotation.
       
   187      * @param aRotatedImageSize the image size to be set.
       
   188      */
       
   189     IMPORT_C void SetRotatedImageSize(TSize aRotatedImageSize);
       
   190     //Nitz Review Added end
       
   191     
       
   192     /**
       
   193      * This method can be used to Get the image size required for Rotation.
       
   194      * @return the image size for the image to be rotated.
       
   195      */
       
   196     IMPORT_C TSize GetRotatedImageSize();
       
   197     
       
   198 	/**
       
   199      * This method can be used to get Icon Size for Grid Widget
       
   200      * @return const TSize.
       
   201      */
       
   202     IMPORT_C TSize GetGridIconSize();
       
   203     IMPORT_C TBool IsExitingState();
       
   204     
       
   205     IMPORT_C void SetExitingState(TBool aIsExiting);
       
   206     
       
   207     /**
       
   208      * Returns Visible items granularity based on feature 
       
   209      * layout (i.e., qHD, VGA)  
       
   210      * @return TInt visible items granularity / count
       
   211      */
       
   212     IMPORT_C TInt VisibleItemsInPageGranularityL();
       
   213     
       
   214 public: // from class MGlxTvObserver
       
   215 
       
   216     /**
       
   217      * @ref MGlxTvObserver::HandleTvStatusChangedL
       
   218      */
       
   219     IMPORT_C void HandleTvStatusChangedL( TTvChangeType aChangeType );
       
   220 
       
   221 
       
   222 public://from MAlfActionObserver
       
   223     
       
   224     /**
       
   225      * @ref MAlfActionObserver::HandleActionL
       
   226      */
       
   227     void  HandleActionL (const TAlfActionCommand &aActionCommand); 
       
   228 public:
       
   229 
       
   230 	/**
       
   231 	 *Add MGlxSkinChangeObserver to skin change observers array. 
       
   232 	 *@param aObserver Reference of the MGlxSkinChangeObserver.
       
   233 	 */
       
   234     IMPORT_C void AddSkinChangeObserverL(MGlxSkinChangeObserver& aObserver);
       
   235     
       
   236     
       
   237     /**
       
   238 	 *Remove MGlxSkinChangeObserver from skin change observers array. 
       
   239 	 *@param aObserver Reference of the MGlxSkinChangeObserver.
       
   240 	 */
       
   241     IMPORT_C void RemoveSkinChangeObserver(MGlxSkinChangeObserver& aObserver);   
       
   242     
       
   243 
       
   244 private: 
       
   245     /**
       
   246      * C++ default constructor.
       
   247      */
       
   248     CGlxUiUtility();
       
   249     /**
       
   250      * 2nd phase constructor.
       
   251      */
       
   252     void ConstructL();
       
   253     /**
       
   254      * Destructor.
       
   255      */
       
   256     ~CGlxUiUtility();
       
   257 
       
   258     /** 2-phase constructor */
       
   259     static CGlxUiUtility* NewL();
       
   260     
       
   261 private:
       
   262     /**
       
   263      * Create the secondary TV Out Display
       
   264      */
       
   265      void CreateTvOutDisplayL();
       
   266 
       
   267      /**
       
   268      * Destroy the secondary TV Out Display
       
   269      */
       
   270      void DestroyTvOutDisplay();
       
   271      /**
       
   272      * Calculate the Grid Icon Size for Grid Widget. It always calculate
       
   273      * size for Landscape orientation. This is done to avoid saving two
       
   274      * different thumbnail icons in Thumbnail database.
       
   275      */
       
   276      void GridIconSizeL();
       
   277     // internal class to contain details of a style
       
   278 private:
       
   279     class TGlxTextStyle
       
   280         {
       
   281     public:
       
   282         TGlxTextStyle( TInt aFontId, TInt aSizeInPixels, TInt aStyleId )
       
   283         : iFontId(aFontId), iSizeInPixels( aSizeInPixels ), iStyleId( aStyleId )
       
   284             {};
       
   285     public:
       
   286         TInt iFontId;
       
   287         TInt iSizeInPixels;
       
   288         TInt iStyleId;
       
   289         };
       
   290         
       
   291 private:        
       
   292     /** Pointer to the appui (not owned) */
       
   293     CCoeAppUi* iAppUi;
       
   294     
       
   295     /** The Alf environment (owned) */
       
   296     CAlfEnv* iEnv;    
       
   297     
       
   298     /** The Alf display used by the control (not owned) */
       
   299     CAlfDisplay* iAlfDisplay;
       
   300     
       
   301     /** The texture manager (owned) */
       
   302     CGlxTextureManager* iGlxTextureManager;
       
   303     
       
   304     /** Avkon control hosting the TV Alf display (owned) */
       
   305     CAlfDisplay* iTvDisplay;
       
   306     
       
   307     /** Pointer to TvOut monitoring object (owned) */
       
   308     CGlxTv* iGlxTvOut;
       
   309     
       
   310     /** Pointer to resolution manager object (owned) */
       
   311     CGlxResolutionManager* iGlxResolutionManager;
       
   312 
       
   313     /** Application settings model */
       
   314     CGlxSettingsModel* iSettingsModel;
       
   315     
       
   316     /// Current navigation direction between views
       
   317     TGlxNavigationDirection iNavigationDirection;
       
   318 
       
   319     /** Array of details of created styles */
       
   320     RArray<TGlxTextStyle> iTextStyles;
       
   321 
       
   322     /** Screen orientation of the application */
       
   323     TGlxOrientation iOrientation;
       
   324 
       
   325     /** Avkon control for monitoring skin changes*/
       
   326     CGlxSkinChangeMonitor* iGlxSkinChangeMonitor;
       
   327     
       
   328     TBool iShared;
       
   329 	TSize iGridIconSize;
       
   330     
       
   331     CGlxScreenFurniture* iScreenFurniture;
       
   332     TBool iIsExiting;
       
   333     //Added to give the Image size to the Coverflow Widget for Rotation
       
   334     TSize iRotatedImageSize;
       
   335     
       
   336 //    CHgContextUtility* iContextUtility;
       
   337     };
       
   338 
       
   339 
       
   340 #endif // C_GLXALFUTILITY_H