classicui_plat/ganes_api/inc/ganes/HgScrollerWithTitle.h
changeset 47 2f0c06423c72
parent 46 0e1e0022bd03
child 53 3c67ea82fafc
equal deleted inserted replaced
46:0e1e0022bd03 47:2f0c06423c72
     1 /*
       
     2 * Copyright (c) 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:     
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HGSCROLLERWITHTITLE_H_
       
    20 #define HGSCROLLERWITHTITLE_H_
       
    21 
       
    22 // INCLUDES
       
    23 #include <coecntrl.h>
       
    24 #include <coemain.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CGulIcon;
       
    28 class CHgScroller;
       
    29 class CHgListLayoutData;
       
    30 class CHgItem;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  * Compound control that compounds a static title element
       
    36  * and HgScroller. Scroller is owned by this control but it can be
       
    37  * accessed freely. However, user of this class
       
    38  * should not call InitScreenL for the scroller, because it is this classes
       
    39  * responsibility to set correct size for the HgScroller. 
       
    40  */
       
    41 class CHgScrollerWithTitle : public CCoeControl
       
    42     {
       
    43 public:
       
    44         
       
    45     // Possible scroller types. Used to define the scroller type
       
    46     // for this compound control
       
    47     enum THgScrollerType
       
    48         {
       
    49         EHgScrollerDoubleGraphicList,
       
    50         EHgScrollerDoubleTextList,
       
    51         EHgScrollerSingleGraphicList,
       
    52         EHgScrollerSingleLargeList,
       
    53         EHgScrollerSingleTextList,
       
    54         EHgScrollerGrid,
       
    55         EHgScrollerSingleTextListWithIcon,
       
    56         EHgScrollerDoubleGraphicListFlat
       
    57         };
       
    58     
       
    59     /**
       
    60      * Creates new CHgScrollerWithTitle.
       
    61      * 
       
    62      * @param aRect Rect that the control draws onto.
       
    63      * @param aItemCount Total count of items in the grid
       
    64      * @param aScrollerType Type of the scroller control.
       
    65      * @param aDefaultIcon Default icon to be used.
       
    66      * 
       
    67      * @return CHgScrollerWithTitle-object
       
    68      */
       
    69     IMPORT_C static CHgScrollerWithTitle* NewL( const TRect& aRect, 
       
    70             TInt aItemCount,
       
    71             THgScrollerType aScrollerType,
       
    72             CGulIcon* aDefaultIcon = NULL );
       
    73         
       
    74 public: // Destructor.
       
    75     
       
    76     virtual ~CHgScrollerWithTitle();
       
    77     
       
    78 public: // CCoeControl
       
    79     
       
    80     void Draw(const TRect& aRect ) const;
       
    81     void SizeChanged();
       
    82     TInt CountComponentControls() const;
       
    83     CCoeControl* ComponentControl(TInt aIndex) const;
       
    84     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    85     void FocusChanged(TDrawNow aDrawNow);
       
    86 
       
    87 public: // NEW FUNCTIONS
       
    88     
       
    89     /**
       
    90      * Re-inits the grid display area. 
       
    91      * 
       
    92      * @param aRect New display rect
       
    93      */
       
    94     IMPORT_C void InitScreenL( const TRect& aRect );
       
    95     
       
    96     /*
       
    97      * Get CHgScroller compound control. 
       
    98      * 
       
    99      * Notice, you shouldn't call
       
   100      * InitScreenL for the CHgScroller, instead this classes InitScreenL should
       
   101      * be used to set the size of this control.
       
   102      * 
       
   103      * @return Compound control.
       
   104      */
       
   105     IMPORT_C CHgScroller& Scroller();
       
   106     
       
   107     /*
       
   108      * Get the title element.
       
   109      * 
       
   110      * @return Title item (CHgItem). 
       
   111      */
       
   112     IMPORT_C CHgItem& TitleItem();
       
   113     
       
   114     /**
       
   115      * Returns preferred image size that should be used when setting image to title.
       
   116      */
       
   117     IMPORT_C static TSize PreferredImageSize();    
       
   118     
       
   119 protected: // Constructors
       
   120 
       
   121     CHgScrollerWithTitle( );
       
   122 
       
   123     void ConstructL(const TRect& aRect, 
       
   124             TInt aItemCount,
       
   125             THgScrollerType aScrollerType,
       
   126             CGulIcon* aDefaultIcon );
       
   127     
       
   128 protected:
       
   129     CHgScroller* iScroller; // Compound control. Own
       
   130     CHgListLayoutData* iLayoutData; // Layout data stroge. Own
       
   131     CHgItem* iTitleItem; // Title element. Own
       
   132 
       
   133     TRgb iColor; // Text color
       
   134     TRect iTitleRect; // Drawing rect for the title.
       
   135     };
       
   136 
       
   137 #endif /*HGSCROLLER_H_*/