fmradio/fmradio/inc/fmradioscanlocalstationscontainer.h
branchRCL_3
changeset 20 93c594350b9a
equal deleted inserted replaced
19:cce62ebc198e 20:93c594350b9a
       
     1 /*
       
     2 * Copyright (c) 2008 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:  definition of the class CFMRadioScanLocalStationsContainer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef FMRADIOSCANLOCALSTATIONSCONTAINER_H
       
    20 #define FMRADIOSCANLOCALSTATIONSCONTAINER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <coecntrl.h>
       
    24 #include <aknlists.h>
       
    25 
       
    26 #include "fmradiodefines.h"
       
    27 #include "fmradio.hrh"
       
    28 #include "fmradioengine.h"
       
    29 // FORWARD DECLARATIONS
       
    30 class CAknWaitDialog;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * Creates and owns the UI components related to the Scan Local Stations View.
       
    36 * @since 2.6
       
    37 */
       
    38 class CFMRadioScanLocalStationsContainer : public CCoeControl,
       
    39                                      	   public MEikListBoxObserver
       
    40     {
       
    41     public: // Constructors and destructor
       
    42         /**
       
    43         * Two-phase constructor of CFMRadioScanLocalStationsContainer
       
    44         * @since 2.6
       
    45         * @param aRect Frame rectangle for container.
       
    46         * @param aRadioEngine Radio engine reference
       
    47         */
       
    48         static CFMRadioScanLocalStationsContainer* NewL( const TRect& aRect, CRadioEngine& aRadioEngine );
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         virtual ~CFMRadioScanLocalStationsContainer();
       
    53     public: // New functions
       
    54         /**
       
    55         * Returns the index of the selected channel item from the channel list.
       
    56         * @since 2.6
       
    57         * @return the index of the currently selected channel
       
    58         */
       
    59         TInt CurrentlySelectedChannel() const; 
       
    60         /**
       
    61         * Update the content of the channel at aIndex with the values specified
       
    62         * @since 2.6
       
    63         * @param aIndex index of the channel to update
       
    64         * @param aInfoText Info text to be shown instead of the frequency value
       
    65         * @param aChannelFrequency the new frequency of the channel
       
    66         * @param aNowPlaying indicates if 'Now playing' icon needs to be shown
       
    67         * @param aInfoTextPlacement ETrue if info text is displayed after frequency string; EFalse otherwise.
       
    68         */
       
    69         void UpdateChannelListContentL( TInt aIndex, const TDesC& aInfoText, TInt aChannelFrequency, TBool aNowPlaying, TBool aInfoTextPlacement = EFalse );
       
    70         void RemoveChannelListContentL( TInt aIndex );
       
    71         /**
       
    72         * Update the content of the channel at aIndex with the values specified
       
    73         * @since 2.6
       
    74         * @param aIndex index of the last selected channel
       
    75         */
       
    76         void UpdateLastListenedChannel( TInt aIndex );
       
    77         /**
       
    78         * Displays 'Now Playing' icon for given index.
       
    79         * @param aNewIndex Index of channel to get the icon
       
    80         * @param aOldIndex Index of channel to loose the icon
       
    81         */
       
    82         void UpdateNowPlayingIconL( TInt aNewIndex, TInt aOldIndex = KErrNotFound );
       
    83         /**
       
    84         * Hide 'Now Playing' icon from given index
       
    85         * @param aIndex Index of channel to hide the icon
       
    86         * @param aDraw flag for updating list after icon removal
       
    87         */
       
    88         void HideNowPlayingIconL( TInt aIndex, TBool aDraw );
       
    89         /**
       
    90         * Fades the entire window and controls in the window owned by this container control.
       
    91         * @since 2.6
       
    92         * @param aFaded flag to indicate whether we should fade or unfade
       
    93         */
       
    94         void SetFaded( TBool aFaded );
       
    95         /**
       
    96         * From CCoeControl
       
    97         */
       
    98         void HandleResourceChange(TInt aType);
       
    99         /**
       
   100         * Resets channel list
       
   101         */
       
   102         void ResetChannelListL();
       
   103         /**
       
   104         * Create the channel list (initially all spots are set as empty)
       
   105         * @since 2.6
       
   106         */
       
   107         void InitializeChannelListL();
       
   108         
       
   109         void SetStationListEmptyTextL( const TDesC& aText );
       
   110         
       
   111         /*
       
   112          * Adds frequency to the scanned channels list. Used while
       
   113          * scanning is ongoing
       
   114          * @param aIndex channel index
       
   115          * @param aChannelFrequency frequency to add
       
   116          */
       
   117         void InsertScannedChannelToListL( TInt aIndex, TInt aChannelFrequency );
       
   118 
       
   119     private: // Functions from base classes
       
   120         /**
       
   121         * Called by framework when the view size is changed
       
   122         * @since 2.6
       
   123         */
       
   124         void SizeChanged();
       
   125         /**
       
   126         * Return the number of controls in the window owned by this container
       
   127         * @since 2.6
       
   128         * @return number of controls
       
   129         */
       
   130         TInt CountComponentControls() const;
       
   131         /**
       
   132         * Return the control corresponding to the specified index
       
   133         * @since 2.6
       
   134         * @param aIndex the index of the control to retrieve
       
   135         * @return the control corresponding to the specified index
       
   136         */
       
   137         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   138         /**
       
   139         * From MEikListBoxObserver, for listbox event handling.
       
   140         * @since 2.6
       
   141         * @param aListBox The originating list box.
       
   142         * @param aEventType A code for the event.
       
   143         */
       
   144         void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   145         /**
       
   146         * Allow the channel list to process key events
       
   147         * @since 2.6
       
   148         * @param aKeyEvent The key event.
       
   149         * @param aType The type of key event.
       
   150         */
       
   151         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   152 		/**
       
   153         * Required for help.
       
   154 		* @since 2.7
       
   155 		* @param aContext the help context to be used.
       
   156         */
       
   157         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   158         
       
   159         void FocusChanged(TDrawNow aDrawNow);
       
   160         /*
       
   161         * from CCoeControl
       
   162         */
       
   163         void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   164         
       
   165     private: // new functions
       
   166     	// Default constructor
       
   167     	CFMRadioScanLocalStationsContainer( CRadioEngine& aRadioEngine );    
       
   168         /**
       
   169         * EPOC two phased constructor
       
   170         * @since 2.6
       
   171         * @param aRect Frame rectangle for container.
       
   172         */
       
   173         void ConstructL( const TRect& aRect);
       
   174         
       
   175         /*
       
   176          * Adds icons to the icon array.
       
   177          * @param aArray array to add icons 
       
   178          */
       
   179         void CreateListIconsL( CArrayPtr<CGulIcon>& aArray );
       
   180 
       
   181     private: //data
       
   182     
       
   183         // The channel list listbox
       
   184         CAknSingleNumberStyleListBox* iChannelList;
       
   185         // Array of channel list items
       
   186         CDesCArray* iChannelItemArray;
       
   187         // Index of the most recently listened channel to keep the listbox up-to-date.
       
   188         TInt iLastChIndex;
       
   189         TBool iFadeStatus;
       
   190         MAknsSkinInstance* iSkin;
       
   191         CRadioEngine& iRadioEngine; //not own
       
   192         // array for list icon bitmaps
       
   193         RPointerArray<CFbsBitmap> iBitMaps;
       
   194 
       
   195     };
       
   196 
       
   197 #endif
       
   198 
       
   199 // End of File