cbs/cbsui/UiInc/CCbsUiTopicListViewContainer.h
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     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: 
       
    15 *       TopicListViewContainer owns the list box which shows
       
    16 *       topics.
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef __CCBSUITOPICLISTVIEWCONTAINER_H
       
    24 #define __CCBSUITOPICLISTVIEWCONTAINER_H
       
    25 
       
    26 //  INCLUDES
       
    27 #include <coeccntx.h>
       
    28 #include <CbsCommon.h>
       
    29 #include <AknIconArray.h>  // CAknIconArray
       
    30 
       
    31 //  CONSTANTS  
       
    32 const TInt KTopicNumberLength = 3;
       
    33 
       
    34  
       
    35 //  FORWARD DECLARATIONS
       
    36 
       
    37 class CCbsUiTopicListView;
       
    38 class CEikColumnListBox;
       
    39 
       
    40 
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  TopicListView container class
       
    46 * 
       
    47 */
       
    48 class CCbsUiTopicListViewContainer : public CCoeControl,
       
    49 									 public MEikListBoxObserver
       
    50 	{
       
    51 
       
    52     public: // Constructors and destructor    
       
    53 
       
    54         /**
       
    55         * Two-phased constructor.
       
    56         *
       
    57         * @param aListView to update view
       
    58         * @param aRect rectangle for which container can use
       
    59         */
       
    60         static CCbsUiTopicListViewContainer* NewL( 
       
    61             CCbsUiTopicListView& aListView, 
       
    62             const TRect& aRect );
       
    63         
       
    64         /**
       
    65         * Destructor.
       
    66         */
       
    67         virtual ~CCbsUiTopicListViewContainer();
       
    68 
       
    69     public: // New functions
       
    70         
       
    71         /**
       
    72         * Resests the array of list box. This should be called when 
       
    73         * before ReloadOfferTopic.
       
    74         */  
       
    75         void ReloadStarts() const;
       
    76 
       
    77         /**
       
    78         * Adds topic information to the topic.
       
    79         *
       
    80         * @param aTopic for setting name and topic number to the list box
       
    81         */  
       
    82         void ReloadOfferTopicL( const TCbsTopic& aTopic ) const;
       
    83 
       
    84         /**
       
    85         * Handles a list box item addition. This should be called
       
    86         * when reload is done. 
       
    87         */
       
    88         void ReloadEndsL();
       
    89 
       
    90         /**
       
    91         * Returns current position, i.e. Current listbox item.
       
    92         *
       
    93         * @return currentposition
       
    94         */ 
       
    95         TInt CurrentPosition() const;
       
    96 
       
    97         /**
       
    98         * Sets the current item index in the list box.
       
    99         *
       
   100         * @param aItemIndex new focused item index
       
   101         */
       
   102         void SetCurrentItemIndex( TInt aItemIndex ) const;
       
   103 
       
   104     public: // From CCoeControl 
       
   105 
       
   106         /**
       
   107         * Returns the count of components.
       
   108         * 
       
   109         * @return number of components
       
   110         */    	   
       
   111         TInt CountComponentControls() const;
       
   112 
       
   113         /**
       
   114         * Returns a component. 
       
   115         *
       
   116         * @param aIndex component index to return
       
   117         * @return requested component
       
   118         */    	   
       
   119 	    CCoeControl* ComponentControl( TInt aIndex ) const;
       
   120 
       
   121         /**
       
   122         * Sets a new size to the list box.
       
   123         */    	   
       
   124 	    void SizeChanged();
       
   125 
       
   126         /**
       
   127         * Informs that the focus is changed.
       
   128         * @param aDrawNow Contains the value that was passed to it by SetFocus()
       
   129         */
       
   130 		void FocusChanged( TDrawNow aDrawNow );
       
   131 
       
   132         /**
       
   133         * Handles a needed key events.
       
   134         *
       
   135         * @param aKeyEvent what kind of key produced this event
       
   136         * @param aType Which kind of action produced this event
       
   137         * @return EKeyWasConsumed or EKeyWasNotConsumed 
       
   138         */    	   
       
   139 	    TKeyResponse OfferKeyEventL(
       
   140             const TKeyEvent& aKeyEvent, 
       
   141             TEventCode aType );	        	      
       
   142 
       
   143         /**
       
   144         * Gets the control's help context.
       
   145         * 
       
   146         * @param aContext The control's help context
       
   147         */
       
   148         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   149 
       
   150     public: 
       
   151         /**
       
   152         * 
       
   153         */
       
   154         void HandleResourceChange( TInt aType );
       
   155         
       
   156     public: // From MEikListBoxObserver
       
   157     	
       
   158     	/**
       
   159         * Handles list box events,
       
   160         * 
       
   161         * @param aEventType The event identifier.
       
   162         */
       
   163         void HandleListBoxEventL( CEikListBox* /*aListBox*/,
       
   164         						  TListBoxEvent aEventType );
       
   165 
       
   166     private: // New functions
       
   167 
       
   168         /**
       
   169         * Indicates, which icon to use:
       
   170         * '0' = subscribed and there are no messages
       
   171         * '1' = subscribed and there are messages
       
   172         * '2' = not subscribed and there are no messages
       
   173         * '3' = not subscribed, but are messages
       
   174         *
       
   175         * @param aTopic to check the topic status
       
   176         * @return char which indicates, which icon to use.
       
   177         */ 
       
   178 	    TChar GetStatus( const TCbsTopic& aTopic ) const;
       
   179 
       
   180         /**
       
   181         * Sets topic index to given buffer.
       
   182         *
       
   183         * @param aTopic a topic, from which will be used topic number
       
   184         * @param aIndexNumber buffer to be filled with topic number
       
   185         */
       
   186 	    void GetIndexNumber( 
       
   187             const TCbsTopic& aTopic, TBuf<KTopicNumberLength>& aIndexNumber ) const;
       
   188 
       
   189     private: 
       
   190 
       
   191         /**
       
   192         * Constructor.
       
   193         *
       
   194         * @param aListView to update view
       
   195         */
       
   196         CCbsUiTopicListViewContainer(CCbsUiTopicListView& aListView);
       
   197         
       
   198         /**
       
   199         * Symbian OS constructor.
       
   200         *
       
   201         * @param aRect size of client area
       
   202         */
       
   203         void ConstructL(const TRect& aRect);
       
   204         
       
   205         /**
       
   206         * LoadIconsL
       
   207         *
       
   208         * Loads icons to CAknIconArray and set this iconarray 
       
   209         * to list iListBox(CEikColumnListBox)
       
   210         */
       
   211         void LoadIconsL();
       
   212 
       
   213         /**
       
   214          *  Append icon to icon array.
       
   215          *
       
   216          *  @param aId                    Icon id
       
   217          *  @param aIcons                 Icon array
       
   218          *  @param aIconFileWithPath      Icon file name with path
       
   219          *  @param aIconGraphicsIndex     Picture index.
       
   220          *  @param aIconGraphicsMaskIndex Mask index.
       
   221          *  @param aColorIcon             Is icon colored
       
   222          */
       
   223         void AddIconL( TAknsItemID aId, CAknIconArray* aIcons,
       
   224                        const TDesC& aIconFileWithPath,
       
   225                        TInt aIconGraphicsIndex,
       
   226                        TInt aIconGraphicsMaskIndex,
       
   227                        TBool aColorIcon = EFalse );
       
   228 
       
   229 
       
   230         /**
       
   231          * Change bitmaps when skin changes.
       
   232          */
       
   233         void SkinBitmapChangesL( );
       
   234         
       
   235         /**
       
   236         * Construct icon
       
   237         *
       
   238         * @param aColourIcon    Is icon a colour icon
       
   239         * @param aInstance      Current skin instance
       
   240         * @param aID            Icon ID
       
   241         * @param aFilename      Icon file name with path
       
   242         * @param aFileBitmapId  ID of the bitmap in the file   
       
   243         * @param aFileMaskId    ID of the mask in the file
       
   244         *
       
   245         * @return   The constructed icon
       
   246         */
       
   247         CGulIcon* ConstructIconL( TBool& aColourIcon, 
       
   248                             MAknsSkinInstance* aInstance, 
       
   249                             const TAknsItemID& aID,                            
       
   250                             const TDesC& aFilename,
       
   251                             const TInt aFileBitmapId, 
       
   252                             const TInt aFileMaskId );
       
   253 
       
   254     private: // Data
       
   255 
       
   256         // Reference to TopicListView.
       
   257         CCbsUiTopicListView& iListView;
       
   258 
       
   259         // For data to be shown in the view.
       
   260         CEikColumnListBox* iListBox;
       
   261 
       
   262 	};
       
   263 
       
   264 
       
   265 #endif // __CCBSUITOPICLISTVIEWCONTAINER_H
       
   266 
       
   267 
       
   268 // End of File