internetradio2.0/uiinc/ircategoryviewcontainer.h
changeset 3 ee64f059b8e1
parent 2 2e1adbfc62af
child 4 3f2d53f144fe
child 5 0930554dc389
equal deleted inserted replaced
2:2e1adbfc62af 3:ee64f059b8e1
     1 /*
       
     2 * Copyright (c) 2005-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:  Header for CIRCategoryViewContainer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CIRCATEGORYVIEWCONTAINER_H
       
    20 #define CIRCATEGORYVIEWCONTAINER_H
       
    21 
       
    22 #include <aknlists.h>
       
    23 #include <EIKLBX.H>
       
    24 #include <aknsfld.h> 
       
    25 #include <eikclb.h> 
       
    26 #include "irimageconverterobserver.h"
       
    27 
       
    28 
       
    29 class CIRCategoryView;
       
    30 class CIRCategoryViewContainer;
       
    31 /**
       
    32  * This classes are used for Advertisements
       
    33  */
       
    34 class CIRCategoryCustomListBox;
       
    35 class CIRImageConverter;
       
    36 class CIRFilteredModel;
       
    37 class MIRListBoxArray;
       
    38 class CIRCategoryAdvertisingListBox;
       
    39 /**
       
    40  * Container for Search Results View.
       
    41  */
       
    42 class CIRCategoryViewContainer : public CCoeControl/*public CAknDoubleStyleListBox*/ , public MEikListBoxObserver,
       
    43                             public MIRImageConverterObserver
       
    44     
       
    45     {
       
    46     
       
    47 public:  // Methods
       
    48 
       
    49     /**
       
    50     * NewL.
       
    51     * Two-phased constructor.
       
    52     * Create a CIRCategoryViewContainer object, which will draw itself to aRect
       
    53     * @param aRect The rectangle this view will be drawn to.
       
    54     * @param aCtaegoryView The Category view's instance.
       
    55     * @return a pointer to the created instance of CIRCategoryViewContainer.
       
    56     */
       
    57     static CIRCategoryViewContainer* NewL( CIRCategoryView& aCtaegoryView, const TRect& aRect );
       
    58 
       
    59     /**
       
    60     * NewLC.
       
    61     * Two-phased constructor.
       
    62     * Create a CIRCategoryViewContainer object, which will draw itself to aRect
       
    63     * @param aRect The rectangle this view will be drawn to.
       
    64     * @param aCtaegoryView The Category view's instance.
       
    65     * @return a pointer to the created instance of CIRCategoryViewContainer.
       
    66     */
       
    67     static CIRCategoryViewContainer* NewLC( CIRCategoryView& aCtaegoryView, const TRect& aRect );
       
    68     
       
    69     /**
       
    70      * ConstructL
       
    71      * 2nd phase constructor.
       
    72      */
       
    73      void ConstructL( const TRect& aRect);
       
    74     
       
    75 	/**
       
    76      * CIRCategoryViewContainer()
       
    77      * C++ default constructor.
       
    78 	 * @param aView View of this container.
       
    79      */
       
    80     CIRCategoryViewContainer(CIRCategoryView& aCtaegoryView);
       
    81     
       
    82     /**
       
    83      * ~CIRCategoryViewContainer()
       
    84      * Destructor.
       
    85      */
       
    86     ~CIRCategoryViewContainer();
       
    87 
       
    88 	/**
       
    89      * UpdateSearchResultsViewL()
       
    90      * updates the search results data to the search results list
       
    91      */
       
    92  	void UpdateCategoryViewL(CDesCArray* aCategory);
       
    93  	
       
    94  	
       
    95 	// from base class CCoeControl
       
    96 
       
    97      /**
       
    98 	 * From CCoeControl
       
    99 	 *
       
   100 	 * @see CCoeControl::OfferKeyEventL() 
       
   101 	 */    
       
   102 	
       
   103 	TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   104     
       
   105  	/**
       
   106 	 * From CCoeControl
       
   107 	 *
       
   108 	 * @see CCoeControl::GetHelpContext( TCoeHelpContext& aContext ) const
       
   109 	 */
       
   110 	void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   111 	
       
   112 	/**
       
   113 	 * GetCurrentItemIndex()
       
   114 	 * returns the index of the currently selected item
       
   115 	 */ 
       
   116 	TInt GetCurrentItemIndex() const;
       
   117 
       
   118     /**
       
   119      * From MEikListBoxObserver HandleListBoxEventL
       
   120      */ 
       
   121     void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   122     
       
   123     
       
   124 	/**
       
   125 	 * GetListBoxTopIndex()
       
   126 	 * returns the index of the top item
       
   127 	 */ 
       
   128 	TInt GetListBoxTopIndex() const;
       
   129 	
       
   130 	/**
       
   131 	* CountComponentControls() const
       
   132 	* returns the number of components in the view.
       
   133 	*/
       
   134 	TInt CountComponentControls() const;
       
   135 	
       
   136 	/**
       
   137 	* ComponentControl()
       
   138 	* returns the pointer to the control
       
   139 	*/
       
   140 	CCoeControl* ComponentControl(TInt aIndex) const ;
       
   141 
       
   142 	/**
       
   143 	* SizeChanged()
       
   144 	* Responds to changes to the size and position of the contents of this control.
       
   145 	*/
       
   146 	void SizeChanged(/*const TRect& aRect*/);
       
   147 	
       
   148 	/**
       
   149 	* HandleResourceChange()
       
   150 	* Handles a change to the control's resources.
       
   151 	*/
       
   152 	void HandleResourceChange(TInt aType);
       
   153 	/*
       
   154 	* CreateFindBoxL()
       
   155 	* Creates the find box for dynamic filtering
       
   156 	*/
       
   157 	CAknSearchField* CreateFindBoxL(CEikListBox* aListBox,
       
   158 	CTextListBoxModel* aModel, CAknSearchField::TSearchFieldStyle aStyle);
       
   159 	/*
       
   160 	* DisableFindBox()
       
   161 	* disable the listbox when foxus is not present
       
   162 	*/
       
   163 	void DisableFindBox();
       
   164 	/**
       
   165 	* Function : StartTimer
       
   166 	* Function called to get the actual index of the station
       
   167 	*/
       
   168 	 void  Comparestrings();
       
   169 	
       
   170  	/**
       
   171  	* HandleImageConversionEventL()
       
   172  	* from base class MIRImageConverterObserver
       
   173  	*/
       
   174 	void HandleImageConversionEventL( MIRImageConverterObserver::TIRImageConversionEvent aEvent,
       
   175 				 TInt aId, TInt aError );
       
   176  	/**
       
   177  	* PresetLogoDownloadL()
       
   178  	* Used to download the  logos depending the preset values.
       
   179  	*/
       
   180  	void PresetLogoDownloadL(CIRIsdsPreset* aPreset);	
       
   181  	/**
       
   182  	* CreateCustomListBoxL()
       
   183  	* Creates the custom listbox and updates the list according to that
       
   184  	*/
       
   185 	void CreateCustomListBoxL();
       
   186  	/**
       
   187  	* CreateListBoxL()
       
   188  	* Creates ListBox depending upon the presence of Advertisement
       
   189  	*/
       
   190 	void CreateListBoxL();
       
   191  	/**
       
   192  	* OpenUrlL()
       
   193  	* Used to connect to advertisement url
       
   194  	*/
       
   195 	void OpenUrlL( const TDesC& aHttpLink );
       
   196 	
       
   197 	/**
       
   198 	* GetLogoNotSupported()
       
   199 	* returns whether the advertisement is supported by the sdk r not
       
   200 	*/
       
   201 	TBool GetLogoNotSupported();
       
   202 	/**
       
   203 	* HandleLogoErrorL()
       
   204 	* called from the iCategoryView when the logo is not downloaded
       
   205 	*/
       
   206 	void HandleLogoErrorL();
       
   207 private: //Methods
       
   208 
       
   209 
       
   210 	// from base class CCoeControl
       
   211 	/**
       
   212      * From CCoeControl
       
   213      * @see CCoeControl::Draw( const TRect& aRect ) const
       
   214 	 */
       
   215 	void Draw( const TRect& aRect ) const;
       
   216 
       
   217 private:    // Data
       
   218     /**
       
   219     * iCategoryView
       
   220     * reference of the category view
       
   221     */
       
   222     CIRCategoryView &iCategoryView;
       
   223 	CFbsBitmap*     iAdBitmap;
       
   224 	/*
       
   225 	* iCurrentItemConverter
       
   226 	* instance of CIRImageConverter
       
   227 	*/
       
   228 	CIRImageConverter* iCurrentItemConverter;
       
   229    	/*
       
   230    	* iLandScapeCount
       
   231    	* used to call the aknfind s HandlePopupFindSizeChanged function only once
       
   232    	*/
       
   233 	TInt iLandScapeCount;
       
   234 	TBool iFilteredFlag;
       
   235 	TInt iError;
       
   236 public:
       
   237     
       
   238   	 /**
       
   239 	 * iItemArray
       
   240 	 * array for the listbox model
       
   241 	 */ 
       
   242 	 CDesCArray* iItemArray;
       
   243 	 /**
       
   244 	 * iCategoryListBox
       
   245 	 * Instance of the Category ListBox
       
   246 	 */
       
   247   	CIRCategoryAdvertisingListBox* iCategoryListBox;
       
   248   	/*
       
   249 	* iFindString
       
   250 	* Used to Get the Entered Search string
       
   251 	*/
       
   252 	
       
   253 	TBuf<KSearchBoxTextLength> iFindString;
       
   254 	/*
       
   255 	* iSearchTextBox
       
   256 	* Instance for CAknSearchField;
       
   257 	*/
       
   258 	CAknSearchField* 			iSearchTextBox;	
       
   259 	/*
       
   260 	* iFilteredModel
       
   261 	* Instance for CAknFilteredTextListBoxModel;
       
   262 	*/
       
   263 	CIRFilteredModel* iFilteredModel;
       
   264 
       
   265     /*
       
   266 	* iConverter
       
   267 	* instance of CIRImageConverter
       
   268 	*/
       
   269 	CIRImageConverter* iConverter;
       
   270 	/**
       
   271 	* Temporary preset to store the raw data of Advertisements
       
   272 	*/
       
   273 	CIRIsdsPreset*  iAdvPreset;
       
   274     /*
       
   275     * iAdPresent
       
   276     * returns whether the advetisment is present or not
       
   277     */
       
   278     TBool iAdPresent;
       
   279     /*
       
   280     * iBgContext
       
   281     * Instance of CAknsBasicBackgroundControlContext
       
   282     */
       
   283     CAknsBasicBackgroundControlContext* iBgContext;
       
   284     /*
       
   285     * iAdvString
       
   286     * sets the advertisement string
       
   287     */
       
   288     HBufC* iAdvString;
       
   289     /*
       
   290     * iListBoxArray
       
   291     * Instance of MIRListBoxArray
       
   292     */
       
   293    	MIRListBoxArray* iListBoxArray;
       
   294    	
       
   295    	/*
       
   296    	* iRequestForAdvertisement
       
   297    	* sets when the request for advertisment conversation is made
       
   298    	*/
       
   299 	TBool iRequestForAdvertisement;
       
   300    	/*
       
   301    	* iLogoDownloadError
       
   302    	* sets when the  advertisment future is not supported
       
   303    	*/
       
   304 	TBool iLogoDownloadError;
       
   305     };
       
   306 
       
   307 #endif      // CIRCATEGORYVIEWCONTAINER_H