fmradio/fmradio/src/fmradiochannellistcontainer.cpp
branchRCL_3
changeset 15 04aa446da81c
parent 13 4f2584af5a29
equal deleted inserted replaced
13:4f2584af5a29 15:04aa446da81c
    86     {
    86     {
    87     CreateWindowL();
    87     CreateWindowL();
    88 
    88 
    89     // Instantiate a listbox for the channel list
    89     // Instantiate a listbox for the channel list
    90     iChannelList = new ( ELeave ) CAknDoubleNumberStyleListBox();
    90     iChannelList = new ( ELeave ) CAknDoubleNumberStyleListBox();
    91     iControls.Append( iChannelList );
       
    92     iChannelList->SetContainerWindowL( *this );
    91     iChannelList->SetContainerWindowL( *this );
    93     iChannelList->SetListBoxObserver( this );
    92     iChannelList->SetListBoxObserver( this );
    94     iChannelList->ConstructL( this, CEikListBox::ELoopScrolling | EAknListBoxSelectionList ); // Looped list
    93     iChannelList->ConstructL( this, CEikListBox::ELoopScrolling | EAknListBoxSelectionList ); // Looped list
    95     iChannelList->SetRect( aRect ); // Set boundaries for listbox
    94     iChannelList->SetRect( aRect ); // Set boundaries for listbox
    96     // Create scrollbars
    95     // Create scrollbars
   123 // Class destructor
   122 // Class destructor
   124 // ----------------------------------------------------
   123 // ----------------------------------------------------
   125 //
   124 //
   126 CFMRadioChannelListContainer::~CFMRadioChannelListContainer()
   125 CFMRadioChannelListContainer::~CFMRadioChannelListContainer()
   127     {
   126     {
   128     iControls.ResetAndDestroy();
   127     delete iChannelList;
   129     iControls.Close();
       
   130     iBitMaps.ResetAndDestroy();
   128     iBitMaps.ResetAndDestroy();
   131     iBitMaps.Close();
   129     iBitMaps.Close();
   132     delete iChannelItemArray;
   130     delete iChannelItemArray;
   133     }
   131     }
   134 
   132 
   558 // Return the number of controls in the window owned by this container
   556 // Return the number of controls in the window owned by this container
   559 // ---------------------------------------------------------
   557 // ---------------------------------------------------------
   560 //
   558 //
   561 TInt CFMRadioChannelListContainer::CountComponentControls() const
   559 TInt CFMRadioChannelListContainer::CountComponentControls() const
   562     {
   560     {
   563     return iControls.Count();
   561     return 1;
   564     }
   562     }
   565 
   563 
   566 // ---------------------------------------------------------
   564 // ---------------------------------------------------------
   567 // CFMRadioChannelListContainer::ComponentControl
   565 // CFMRadioChannelListContainer::ComponentControl
   568 // Return the control corresponding to the specified index
   566 // Return the control corresponding to the specified index
   569 // ---------------------------------------------------------
   567 // ---------------------------------------------------------
   570 //
   568 //
   571 CCoeControl* CFMRadioChannelListContainer::ComponentControl( TInt aIndex ) const
   569 CCoeControl* CFMRadioChannelListContainer::ComponentControl( TInt aIndex ) const
   572     {
   570     {
   573     return STATIC_CAST( CCoeControl *,iControls[aIndex] );
   571     CCoeControl* control = NULL;
       
   572     
       
   573     switch ( aIndex )
       
   574         {
       
   575         case 0:
       
   576             {
       
   577             control = iChannelList;
       
   578             break;
       
   579             }
       
   580         default:
       
   581             {
       
   582             break;
       
   583             }
       
   584         }
       
   585     
       
   586     return control;
   574     }
   587     }
   575 
   588 
   576 // ---------------------------------------------------------
   589 // ---------------------------------------------------------
   577 // CFMRadioChannelListContainer::OfferKeyEventL
   590 // CFMRadioChannelListContainer::OfferKeyEventL
   578 // Allow the channel list to process key events
   591 // Allow the channel list to process key events
   580 //
   593 //
   581 TKeyResponse CFMRadioChannelListContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   594 TKeyResponse CFMRadioChannelListContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   582                                                            TEventCode aType )
   595                                                            TEventCode aType )
   583     {
   596     {
   584     TKeyResponse response = EKeyWasNotConsumed;
   597     TKeyResponse response = EKeyWasNotConsumed;
       
   598     
       
   599     if ( iFadeStatus )
       
   600         {
       
   601         // don't handle any keys if the view is faded
       
   602         return response;
       
   603         }
   585 
   604 
   586     switch ( aKeyEvent.iCode )
   605     switch ( aKeyEvent.iCode )
   587         {
   606         {
   588         case EKeyBackspace:
   607         case EKeyBackspace:
   589             {
   608             {