fmradio/fmradio/inc/fmradiochannellistcontainer.h
branchRCL_3
changeset 20 93c594350b9a
equal deleted inserted replaced
19:cce62ebc198e 20:93c594350b9a
       
     1 /*
       
     2 * Copyright (c) 2005 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 CFMRadioRecordingContainer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef FMRADIOCHANNELLISTCONTAINER_H
       
    20 #define FMRADIOCHANNELLISTCONTAINER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <coecntrl.h>
       
    24 #include <aknlists.h>
       
    25 
       
    26 #include "fmradiodefines.h"
       
    27 #include "fmradioengine.h"
       
    28 #include "mchannellisthandler.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CAknWaitDialog;
       
    32 class CFMRadioChannelListView;
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 * Creates and owns the UI components related to the Channel List view.
       
    37 * @since 2.6
       
    38 */
       
    39 class CFMRadioChannelListContainer : public CCoeControl, 
       
    40                                      public MEikListBoxObserver
       
    41     {
       
    42     public: // Constructors and destructor
       
    43         /**
       
    44         * Two-phase constructor of CFMRadioChannelListContainer
       
    45         * @since 2.6
       
    46         * @param aRect Frame rectangle for container
       
    47         * @param aRadioEngine Radio engine
       
    48         * @param aObserver Handler for channel list
       
    49         */
       
    50         static CFMRadioChannelListContainer* NewL( const TRect& aRect, 
       
    51         		CRadioEngine& aRadioEngine,
       
    52         		MChannelListHandler& aObserver);
       
    53         /**
       
    54         * Destructor.
       
    55         */
       
    56         virtual ~CFMRadioChannelListContainer();
       
    57     public: // New functions
       
    58         /**
       
    59         * Returns the index of the selected channel item from the channel list.
       
    60         * @since 2.6
       
    61         * @return the index of the currently selected channel
       
    62         */
       
    63         TInt CurrentlySelectedChannel() const;
       
    64         /**
       
    65         * Update the content of the channel at aIndex with the values specified
       
    66         * @since 2.6
       
    67         * @param aIndex index of the channel to update
       
    68         * @param aChannelName the new name of the channel
       
    69         * @param aChannelFrequency the new frequency of the channel
       
    70         */
       
    71         void UpdateChannelListContentL( TInt aIndex, const TDesC& aChannelName, TInt aChannelFrequency );
       
    72         /**
       
    73 	    * RemoveChannel from channel list 
       
    74 	    * @since 2.6
       
    75 	    * @param aIndex the index of the channel to update
       
    76 	    */
       
    77 	    void RemoveChannelL( TInt aIndex );
       
    78 	    /**
       
    79 	    * AddChannel from channel list 
       
    80 	    * @since 2.6
       
    81 	    * @param aChannelName the new name of the channel
       
    82         * @param aChannelFrequency the new frequency of the channel
       
    83         * @param aNowPlaying ETrue if channel is tuned
       
    84         */
       
    85 	    void AddChannelL( const TDesC& aChannelName, TInt aChannelFrequency, TBool aNowPlaying ); 
       
    86         /**
       
    87         * Update the content of the channel at aIndex with the values specified
       
    88         * @since 2.6
       
    89         * @param aIndex index of the last selected channel
       
    90         */
       
    91         void UpdateLastListenedChannel( TInt aIndex );
       
    92         /**
       
    93         * Adds icon to a list item
       
    94         * @param aIndex new icon index
       
    95         * @param aIconIndex icon index in list icon array
       
    96         */
       
    97         void UpdateItemIconL( TInt aIndex, TInt aIconIndex );
       
    98         /**
       
    99         * Hide all icons from the list
       
   100         */
       
   101         void HideIconsL();
       
   102         /**
       
   103         * Fades the entire window and controls in the window owned by this container control.
       
   104         * @since 2.6
       
   105         * @param aFaded flag to indicate whether we should fade or unfade
       
   106         */
       
   107         void SetFaded( TBool aFaded );
       
   108         /**
       
   109         * From CCoeControl
       
   110         */
       
   111         void HandleResourceChange(TInt aType);
       
   112         /**
       
   113 	    * MoveMode handled -> All Done
       
   114 	    */
       
   115         void MoveDoneL();        
       
   116         /**
       
   117 	    * ReIndexAll items in constainer list 
       
   118 	    */
       
   119         void ReIndexAllL();        
       
   120         /**
       
   121          * Handle movable item drop
       
   122          */
       
   123         void HandleDropL();        
       
   124         /**
       
   125          * Move selected item in list up
       
   126          */
       
   127         void MoveUpL();        
       
   128         /**
       
   129          * Move selected item in list down
       
   130          */
       
   131         void MoveDownL();        
       
   132         /**
       
   133          * Activate move action -> when grab is selected
       
   134          */
       
   135         void ActivateMoveL();
       
   136         /**
       
   137          * Move action canceled, return list to previous state
       
   138          */ 
       
   139         TBool MoveCanceledL();    
       
   140         /**
       
   141          * Current Move action state.
       
   142          */
       
   143         TBool MoveAction();
       
   144         /**
       
   145 	     * Touch pad move event handling
       
   146 	     */ 
       
   147         void TouchMoveEventL( TInt aIndex );
       
   148         
       
   149     private: // Functions from base classes
       
   150         /**
       
   151         * Called by framework when the view size is changed
       
   152         * @since 2.6
       
   153         */
       
   154         void SizeChanged();
       
   155         /**
       
   156         * Return the number of controls in the window owned by this container
       
   157         * @since 2.6
       
   158         * @return number of controls
       
   159         */
       
   160         TInt CountComponentControls() const;
       
   161         /**
       
   162         * Return the control corresponding to the specified index
       
   163         * @since 2.6
       
   164         * @param aIndex the index of the control to retrieve
       
   165         * @return the control corresponding to the specified index
       
   166         */
       
   167         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   168         /**
       
   169         * From MEikListBoxObserver, for listbox event handling.
       
   170         * @since 2.6
       
   171         * @param aListBox The originating list box.
       
   172         * @param aEventType A code for the event.
       
   173         */
       
   174         void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   175         /**
       
   176         * Allow the channel list to process key events
       
   177         * @since 2.6
       
   178         * @param aKeyEvent The key event.
       
   179         * @param aType The type of key event.
       
   180         */
       
   181         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   182 		/**
       
   183         * Required for help.
       
   184 		* @since 2.7
       
   185 		* @param aContext the help context to be used.
       
   186         */
       
   187         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   188         
       
   189         void FocusChanged(TDrawNow aDrawNow);
       
   190         /*
       
   191         * from CCoeControl
       
   192         */
       
   193         void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   194         
       
   195     private: // new functions
       
   196     	 // Default constructor
       
   197     	CFMRadioChannelListContainer( CRadioEngine& aRadioEngine, MChannelListHandler& aObserver ); 
       
   198         /**
       
   199         * EPOC default constructor.
       
   200         * @since 2.6
       
   201         * @param aRect Frame rectangle for container.
       
   202         */
       
   203         void ConstructL( const TRect& aRect);
       
   204 
       
   205         /*
       
   206          * Adds icons to the icon array.
       
   207          * @param aArray array to add icons 
       
   208          */
       
   209         void CreateListIconsL( CArrayPtr<CGulIcon>& aArray );
       
   210 
       
   211         /**
       
   212         * Create the channel list (initially all spots are set as empty)
       
   213         * @since 2.6
       
   214         */
       
   215         void InitializeChannelListL();
       
   216     private: //data
       
   217         // The channel list listbox
       
   218         CAknDoubleNumberStyleListBox* iChannelList;
       
   219         // Array of channel list items
       
   220         CDesCArray* iChannelItemArray;
       
   221         // Index of the most recently listened channel to keep the listbox up-to-date.
       
   222         TInt iLastChIndex;
       
   223         // array for list icon bitmaps
       
   224         RPointerArray<CFbsBitmap> iBitMaps;
       
   225         TBool iFadeStatus;
       
   226         CRadioEngine& iRadioEngine;
       
   227         TBool iMoveAction;
       
   228         TInt iMoveIndex;
       
   229         TInt iTouchMoveIndex;
       
   230         MChannelListHandler& iObserver;
       
   231         // not owned
       
   232         CFMRadioChannelListView* iChannelView;
       
   233         // flag for rocker key move activation
       
   234         TBool iKeyMoveActivated;
       
   235     };
       
   236 
       
   237 #endif
       
   238 
       
   239 // End of File