browserui/browser/BrowserAppInc/BrowserShortcutKeyMap.h
changeset 51 48e827313edd
parent 37 481242ead638
child 53 f427d27b98d8
equal deleted inserted replaced
37:481242ead638 51:48e827313edd
     1 /*
       
     2 * Copyright (c) 2007 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 the License "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:  Implements Browser Shortcut Key Map
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BROWSERSHORTCUTKEYMAP_H
       
    20 #define BROWSERSHORTCUTKEYMAP_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // MACROS
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CBrowserContentViewContainer;
       
    29 class MApiProvider;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33 * Encapsulate Keymap Cell Info
       
    34 * @since 5.0
       
    35 */
       
    36 class TKeymapCellData
       
    37     {
       
    38 public:
       
    39     // C++ constructor and destructor to initialize/delete pointer data members
       
    40     TKeymapCellData();
       
    41     ~TKeymapCellData();
       
    42 
       
    43     // data
       
    44     HBufC* keyText;
       
    45     HBufC* lineText;
       
    46     TInt   cmdRscId;
       
    47     CFbsBitmap* keyBitmapImage;
       
    48     CFbsBitmap* keyBitmapMask;
       
    49     
       
    50     TRect r; // Main rect for cell
       
    51     TRect rCell; // Cell contents rect (includes margin)
       
    52     TRect rKey;  // key indicator rect
       
    53     TRect rLine1; // text line 1 rect
       
    54     TRect rLine2; // text line 2 rect
       
    55     TRect rIcon; // icon rect        
       
    56     };
       
    57 
       
    58 /**
       
    59 * Create and manage the keymap sprite
       
    60 * @since 5.0
       
    61 */
       
    62 
       
    63 class CBrowserShortcutKeyMap: public CBase
       
    64     {
       
    65     public:  // Constructor and destructor
       
    66         /**
       
    67         * Two-phased constructor.
       
    68         */
       
    69         static CBrowserShortcutKeyMap* NewL( CBrowserContentViewContainer* aContentViewContainer, MApiProvider& aApiProvider );
       
    70 
       
    71         /**
       
    72         * Destructor.
       
    73         */
       
    74         virtual ~CBrowserShortcutKeyMap();
       
    75         
       
    76     private:  // Constructors
       
    77         /**
       
    78         * C++ default constructor.
       
    79         */
       
    80         CBrowserShortcutKeyMap( CBrowserContentViewContainer* aContentViewContainer, MApiProvider& aApiProvider );
       
    81 
       
    82         /**
       
    83         * By default Symbian 2nd phase constructor is private.
       
    84         */
       
    85         void ConstructL();
       
    86                 
       
    87     private: // New functions
       
    88 
       
    89         /**
       
    90         * @since 5.0
       
    91         * @param
       
    92         * @return
       
    93         * Initialize Keymap properties
       
    94         */        
       
    95         void InitKeymap(); 
       
    96 
       
    97         /**
       
    98         * @since 5.0
       
    99         * @param
       
   100         * @return
       
   101         * Initialize Keymap data kept for each cell of the map
       
   102         */
       
   103         void InitCellDataL();
       
   104         
       
   105         /**
       
   106         * @since 5.0
       
   107         * @param
       
   108         * @return
       
   109         * Create the bitmap and context that will be used for the sprite
       
   110         */
       
   111         void CreateBitmapAndContextL();
       
   112 
       
   113         /**
       
   114         * @since 5.0
       
   115         * @param
       
   116         * @return
       
   117         * Calculate the layout of the sprite rects for a given cell
       
   118         */
       
   119         void CreateCellLayout(const TInt& aCellIndex, const TPoint& aUpperL, const TSize& aSize);
       
   120 
       
   121         /**
       
   122         * @since 5.0
       
   123         * @param
       
   124         * @return
       
   125         * Draw the sprite rects to the sprite bitmap
       
   126         */
       
   127         void CreateSpriteCellL(const TInt& aCellIndex);
       
   128                
       
   129         /**
       
   130         * @since 5.0
       
   131         * @param
       
   132         * @return
       
   133         * Construct the Sprite from the bitmap and context
       
   134         */
       
   135         void ConstructSprite();
       
   136 
       
   137         /**
       
   138         * @since 5.0
       
   139         * @param
       
   140         * @return
       
   141         * Utility: Get the folder where the canned image is located
       
   142         */       
       
   143         HBufC* GetCannedImageDirL();
       
   144         
       
   145         /**
       
   146         * @since 5.0
       
   147         * @param
       
   148         * @return
       
   149         * Utility: get the SVG bitmaps, etc, given its filename
       
   150         */
       
   151         void LoadSvg( TInt aImageId, const TDesC& aFileName, CFbsBitmap*& aImage, CFbsBitmap*& aImageMask );
       
   152         
       
   153         /**
       
   154         * @since 7.x
       
   155         * @param
       
   156         * @return
       
   157         * Utility: create dimmed versions of bitmaps aImage
       
   158         */
       
   159         void CreateDimBitmapL(  CFbsBitmap* aImage,
       
   160                                 CFbsBitmap* aImageMask,
       
   161                                 CFbsBitmap*& aDimImage,
       
   162                                 CFbsBitmap*& aDimImageMask);
       
   163                                   
       
   164             
       
   165     private:    // Data
       
   166         CBrowserContentViewContainer* iContentViewContainer;  // not owned
       
   167         MApiProvider& iApiProvider;                           // not owned, used to query browser prefs
       
   168          
       
   169         TRect iTargetRect;                                    // Main rect of the keymap, sized according to parent container
       
   170         
       
   171         const CFont* iKeyFont;                                // not owned, font used for the key indicator text
       
   172         const CFont* iLineFont;                               // not owned, font used for the function description  
       
   173         RPointerArray<TKeymapCellData> iCellData;             // data structure to hold data for each key cell
       
   174         
       
   175         HBufC* iSvgMbmFile;                                   // holds icon svg
       
   176 
       
   177         /* sprite data */
       
   178         RWsSprite iSprite;
       
   179         CFbsBitmapDevice*        iSpriteBitmapDevice;         // owned
       
   180         CFbsBitGc*               iSpriteBitmapContext;        // owned
       
   181         CFbsBitmap*              iSpriteBitmap;               // owned
       
   182         CFbsBitmapDevice*        iSpriteMaskBitmapDevice;     // owned
       
   183         CFbsBitGc*               iSpriteMaskBitmapContext;    // owned
       
   184         CFbsBitmap*              iSpriteMaskBitmap;           // owned
       
   185     };
       
   186 
       
   187 #endif      // BROWSERSHORTCUTKEYMAP_H
       
   188 
       
   189 // End of File