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