imstutils/imconversationview/imcvuiapp/inc/cimcvappsmileicongrid.h
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Grid for smile icons.
       
    15 *  Description : Handles statuspane, context pane, navi pane
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CIMCVAPPSMILEICINGRID_H
       
    21 #define CIMCVAPPSMILEICINGRID_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <coecntrl.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CEikDialog;
       
    28 class CGulIcon;
       
    29 class TAknLayoutRect;
       
    30 class MIMCVTapEventObserver;
       
    31 class MAknsSkinInstance;
       
    32 class MAknsControlContext;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 /**
       
    36 *  CIMCVAppSmileIconGrid
       
    37 *
       
    38 *  Grid for icons.
       
    39 */
       
    40 class CIMCVAppSmileIconGrid : public CCoeControl
       
    41     {
       
    42     public: // Constructors and destructor
       
    43         /**
       
    44         * Two-phased constructor.
       
    45         * @param aParent         : Parent control of grid.
       
    46         * @param aIconArray      : Reference to smile icon array.
       
    47         */
       
    48         static CIMCVAppSmileIconGrid* NewL( CEikDialog* aParent,
       
    49 							const RPointerArray<CGulIcon>& aIconArray );
       
    50 
       
    51         /**
       
    52         * Destructor.
       
    53         */
       
    54         virtual ~CIMCVAppSmileIconGrid();
       
    55 
       
    56 	public: // New methods
       
    57 
       
    58         /**
       
    59         * Move cursor
       
    60         * @param aKeyCode : EKeyLeftArrow | EKeyRightArrow |
       
    61         *                   EKeyUpArrow | EKeyDownArrow
       
    62         */
       
    63         void MoveCursor( TInt aKeyCode );
       
    64 
       
    65         /**
       
    66         * Return selected cursor position.
       
    67         * @return : Selected cursor position if cursor is pointed a bitmap.
       
    68         *           KPinbEmptySpecialCharId if cursor is pointed empty cell.
       
    69         */
       
    70         TInt SelectedBitmapId();
       
    71 
       
    72         /**
       
    73         * Return row count of grid.
       
    74         * @return : Row count.
       
    75 		*/
       
    76 	    TInt HeightInRows();
       
    77 
       
    78         /**
       
    79          * Set observer for handling tap events. 
       
    80          * Supports only single observer.
       
    81          * @param aObserver observer to handle tap events
       
    82          * @param aId control id which is used by the observer to 
       
    83          *        identify this object. 
       
    84          */
       
    85         void SetTapObserver( MIMCVTapEventObserver* aObserver, TUint aId );
       
    86         
       
    87 		/**
       
    88          * Calculate number of row and columns in smile grid
       
    89          * aViewableWidth Width of Dialog in which smile are shown
       
    90          */
       
    91         void SetViewableWindowWidth(TInt aViewableWidth);
       
    92         
       
    93 		/**
       
    94          *@return First smile icon rectangle in smile icon grid.
       
    95          */
       
    96         TRect GetFirstCellRect();
       
    97          
       
    98 
       
    99     private: // New methods
       
   100 
       
   101         /**
       
   102         * Set layout of identifier grid
       
   103         */
       
   104         void SetLayout();
       
   105         
       
   106         /**
       
   107          * Drawing function
       
   108          */
       
   109         void DrawItem( CWindowGc& aGc, 
       
   110                        TBool aSkinEnabled,
       
   111                        MAknsSkinInstance* aSkin, 
       
   112                        MAknsControlContext* aSkinCc,
       
   113                        TInt aIndex, TBool aSelected ) const;
       
   114         
       
   115     private: // Functions from base classes
       
   116 
       
   117         /**
       
   118         * From CCoeControl : Return minimum size of the control.
       
   119         */
       
   120         TSize MinimumSize();
       
   121 
       
   122         /**
       
   123         * From CCoeControl : Size of the control is set.
       
   124         */
       
   125         void SizeChanged();
       
   126 
       
   127         /**
       
   128         * From CCoeControl : Notifier for changing layout
       
   129         * @param aType : Type of resource change
       
   130         */
       
   131         void HandleResourceChange( TInt aType );
       
   132 
       
   133         /**
       
   134         * From CCoeControl : Drawing control.
       
   135         * @param aRect : Rectangle of control
       
   136         */
       
   137         void Draw( const TRect& aRect ) const;
       
   138 
       
   139         /**
       
   140         * From CCoeControl : Touch support.
       
   141         */
       
   142         void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   143 
       
   144 
       
   145 	private: // Constructors and destructor
       
   146 
       
   147         /**
       
   148         * default constructor.
       
   149         * @param aParent : Parent control of grid.
       
   150         * @param aIconArray : Array of Icon
       
   151         */
       
   152         CIMCVAppSmileIconGrid( CEikDialog* aParent,
       
   153         		const RPointerArray<CGulIcon>& aIconArray );
       
   154 
       
   155         /**
       
   156         * Second-phased constructor.
       
   157         */
       
   158         void ConstructL();
       
   159 
       
   160     private: // Data
       
   161 
       
   162         TInt iCursorPos;
       
   163         TInt iPrevCursorPos;
       
   164         TBool iDragEvent;
       
   165 
       
   166         CEikDialog* iParent; // Not own
       
   167 
       
   168 		// Reference to smile icon array.
       
   169 		const RPointerArray<CGulIcon>& iIconArray;
       
   170 
       
   171 		// Counts of icons and no. of rows
       
   172 		TInt iIconCount;
       
   173         TInt iRowCount;
       
   174 
       
   175 		//info regarding single cell
       
   176         TRect iFirstCell;
       
   177         TSize iIconSize;
       
   178         TInt  iCellWidth;
       
   179         TInt  iCellHeight;
       
   180 
       
   181         // Not owned. Pointer to observer
       
   182         MIMCVTapEventObserver* iTapObserver;
       
   183 
       
   184         // ID which needs to be reported back to TapObserver
       
   185         TUint iTapControlId;
       
   186         TBool iIsMirrored ;
       
   187 
       
   188         TInt iMaxColumns;
       
   189 	};
       
   190 
       
   191 #endif // CIMCVAPPSMILEICINGRID_H
       
   192 
       
   193 // End of File