cmmanager/cmmgr/Framework/Inc/cmdesticonmap.h
changeset 20 9c97ad6591ae
parent 18 fcbbe021d614
child 21 b8e8e15e80f2
child 23 7ec726f93df1
child 28 860702281757
equal deleted inserted replaced
18:fcbbe021d614 20:9c97ad6591ae
     1 /*
       
     2 * Copyright (c) 2006 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:  Destination icon map
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMDESTICONMAP_H
       
    19 #define CMDESTICONMAP_H
       
    20 
       
    21 #include <coecntrl.h>
       
    22 #include <AknUtils.h>
       
    23 #include <gulicon.h>
       
    24 #include <AknIconArray.h>
       
    25 
       
    26 
       
    27 class CCmDestinationIconMapExtension;
       
    28 class CEikScrollBarFrame;
       
    29 class CCmDestinationIconMapExtension;
       
    30 
       
    31 
       
    32 /**
       
    33  * Change Icon Dialog table Destination UI.
       
    34  *
       
    35  */
       
    36 NONSHARABLE_CLASS(CCmDestinationIconMap) : public CCoeControl
       
    37                                          , public MEikScrollBarObserver
       
    38     {
       
    39     public: 
       
    40         
       
    41         /** 
       
    42         * CCmDestinationIconMap two phase constructor
       
    43         */
       
    44         static CCmDestinationIconMap* NewL();    
       
    45         
       
    46         /** 
       
    47         * CCmDestinationIconMap destructor
       
    48         */
       
    49          ~CCmDestinationIconMap();
       
    50         
       
    51         /** 
       
    52         * CCmDestinationIconMap resource constructor.
       
    53         * @param aReader Icon Dialog table Resource
       
    54         */
       
    55          void ConstructFromResourceL( TResourceReader& aReader );
       
    56 
       
    57         /**
       
    58         * Number of rows in the icon table.
       
    59         * @return Number of rows in icon table.
       
    60         */
       
    61          TInt HeightInRows();
       
    62         
       
    63         /**
       
    64         * Create the scrollbar Ptr and set the No of Rows in the 
       
    65         * Icon table depends upon the Icon array count.
       
    66         */
       
    67          void CreateScrollBarAndIconRowL();
       
    68         
       
    69         /**
       
    70         * Sets reference to the index where selected icon index is put.
       
    71         * @param aIconIndex Reference to the integer where selected icon 
       
    72         * index is put.
       
    73         */
       
    74          void SetIndex(TInt& aIconIndex);
       
    75 
       
    76     private:
       
    77     
       
    78         /** 
       
    79         * CCmDestinationIconMap constructor
       
    80         */
       
    81          CCmDestinationIconMap();
       
    82 
       
    83         /** 
       
    84         * CCmDestinationIconMap two phase constructor
       
    85         */
       
    86         void ConstructL();
       
    87         
       
    88     public: // from CCoeControl
       
    89     
       
    90          TSize MinimumSize();
       
    91          TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode);
       
    92          TCoeInputCapabilities InputCapabilities() const;
       
    93          virtual void ActivateL();
       
    94 
       
    95 #ifdef RD_SCALABLE_UI_V2
       
    96 
       
    97  	    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
    98  	    void SetObserver( MCoeControlObserver* aObserver  );
       
    99  	    
       
   100 #endif //RD_SCALABLE_UI_V2
       
   101 
       
   102     protected: // from CCoeControl
       
   103     
       
   104          void SizeChanged();
       
   105          void HandleResourceChange(TInt aType);
       
   106          TInt CountComponentControls() const;
       
   107          CCoeControl* ComponentControl(TInt aIndex) const;
       
   108 
       
   109     public: 
       
   110 
       
   111         /**
       
   112         * DrawOffscreenBackgroundIfRequired().
       
   113         *
       
   114         * @Description:Draw the offscreen bitmap if applicable.
       
   115         *              Specially in case of Skin change
       
   116         */
       
   117         void DrawOffscreenBackgroundIfRequired() const;
       
   118 
       
   119         /**
       
   120         * DoLayout()
       
   121         * @Description: Sets the Layout of the Icon table.
       
   122         */
       
   123         void DoLayout();
       
   124 
       
   125     private:
       
   126     
       
   127         /**
       
   128         * Draw().
       
   129         *
       
   130         * @Description:
       
   131         */
       
   132         void Draw(const TRect& aRect) const;
       
   133 
       
   134         /**
       
   135         * DrawItem().
       
   136         *
       
   137         * @Description:
       
   138         */
       
   139         void DrawItem( CWindowGc& aGc,
       
   140                        const TRect& aSctPosition,
       
   141                        TInt aIconIndex,
       
   142                        TBool aHighlighted,
       
   143                        TBool aDrawBackground ) const;
       
   144 
       
   145         /**
       
   146         * DrawCursor().
       
   147         *
       
   148         * @Description:
       
   149         */
       
   150         void DrawCursor() const;
       
   151         
       
   152         /**
       
   153         * MoveCursorL().
       
   154         *
       
   155         * @Description:
       
   156         */
       
   157         void MoveCursorL( TInt aX, TInt aY );
       
   158 
       
   159         /**
       
   160         * DrawCell().
       
   161         *
       
   162         * @Description:
       
   163         */
       
   164         void DrawCell( TInt aCursorPos, TBool aHighLighted ) const;
       
   165         
       
   166         /**
       
   167         * CursorRect().
       
   168         *
       
   169         * @Description:
       
   170         */
       
   171         TRect CursorRect( TInt aCursorPos ) const;
       
   172         
       
   173         /**
       
   174         * CursorPoint().
       
   175         *
       
   176         * @Description:
       
   177         */
       
   178         TPoint CursorPoint( TInt aCursorPos ) const;
       
   179 
       
   180         /**
       
   181         * UpdateScrollIndicatorL().
       
   182         *
       
   183         * @Description:
       
   184         */
       
   185         void UpdateScrollIndicatorL();
       
   186 
       
   187         /**
       
   188         * CountMaxColumnsAndCellSizes().
       
   189         *
       
   190         * @Description:
       
   191         */
       
   192         void CountMaxColumnsAndCellSizes();
       
   193 
       
   194         /**
       
   195         * LoadIconL().
       
   196         * This fucton leaves if the client does not have a valid UI context
       
   197         *
       
   198         * @Description:
       
   199         */
       
   200         void LoadIconL();
       
   201 
       
   202         /**
       
   203         * Extension().
       
   204         *
       
   205         * @Description:
       
   206         */
       
   207         CCmDestinationIconMapExtension* Extension() const;        
       
   208      
       
   209     private: //from CCoeContrl
       
   210 
       
   211         void Reserved_1();
       
   212         void Reserved_2();
       
   213         
       
   214     public:
       
   215 
       
   216         void HandleScrollEventL( CEikScrollBar* aScrollBar, 
       
   217                                  TEikScrollEvent aEventType);
       
   218 
       
   219     private:
       
   220         TInt                iGridItemWidth;
       
   221         TInt                iGridItemHeight;
       
   222         TBool               iIsMirrored;
       
   223         TInt                iRows;
       
   224         TInt                iFirstVisibleRow;
       
   225         TPoint              iOffset;
       
   226         TPoint              iGridTopLeft;
       
   227 
       
   228         TPoint              iCursorPos;
       
   229         TPoint              iOldCursorPos;
       
   230         mutable TBool       iDrawnBefore;
       
   231 
       
   232         CEikScrollBarFrame* iSBFrame;
       
   233         TInt*               iIconIndex;
       
   234 
       
   235         TBool               iAnimated;
       
   236 
       
   237         CFbsBitmap*         iOffscreenBg;
       
   238         CFbsBitmapDevice*   iBitmapDevice;
       
   239         CFbsBitGc*          iBitmapGc;
       
   240         TBool               iHasBitmapBackground;
       
   241         mutable TBool       iOffscreenBgDrawn;
       
   242 
       
   243         TInt                iMaxColumns;
       
   244         TInt                iCurrentPage;
       
   245         TInt                iNumPages;
       
   246         CCmDestinationIconMapExtension*   iExtension;
       
   247         CArrayPtr<CGulIcon>*  iConsArray;
       
   248         TBool               iDragAlreadyActive;
       
   249     };
       
   250 
       
   251 #endif // __CMDESTICONMAP_H