Nokia N97 SDK
Example Applications Guide

CCEGroupContainer Class Reference

#include <CCEGroupContainer.h>

Inheritance diagram for CCEGroupContainer:

List of all members.

Detailed Description

Container for group view.

Definition at line 33 of file CCEGroupContainer.h.


Public Member Functions

  CCEGroupContainer (CAknView *aParent)
void  ConstructL ()
virtual  ~CCEGroupContainer ()
void  AppendListBoxItemL (const TDesC &aItem)
TInt  CurrentItemIndex ()
void  ResetListBoxL ()
void  SetCurrentItemIndex (TInt aIndex)

Protected Member Functions

void  Draw (const TRect &aRect) const
TInt  CountComponentControls () const
CCoeControl *  ComponentControl (TInt aIndex) const
void  HandleResourceChange (TInt aType)
TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
void  SizeChanged ()

Private Attributes

CAknView *  iParent
CEikColumnListBox *  iListBox
CDesCArray *  iItemList
CEikLabel *  iInfoLabel


Constructor & Destructor Documentation

CCEGroupContainer::CCEGroupContainer (  CAknView *  aParent  ) 
 

C++ default constructor.

Parameters:
aParent  Parent view of the container

Definition at line 37 of file CCEGroupContainer.cpp.

00038     : iParent( aParent )
00039     {
00040     }

CCEGroupContainer::~CCEGroupContainer (   )  [virtual]
 

Destructor.

Definition at line 84 of file CCEGroupContainer.cpp.

References iInfoLabel, iItemList, and iListBox.

00085     {
00086     delete iItemList;
00087     delete iListBox;
00088     delete iInfoLabel;
00089     }


Member Function Documentation

void CCEGroupContainer::ConstructL (   ) 
 

Symbian 2nd phase constructor.

Definition at line 47 of file CCEGroupContainer.cpp.

References iInfoLabel, iItemList, and iListBox.

Referenced by CCEGroupView::DoActivateL().

00048     {
00049     // Create a window for the group view
00050     CreateWindowL();
00051 
00052     // Create a label for info text
00053     HBufC* labelText = StringLoader::LoadLC( R_CE_INFO_LABEL_TEXT );
00054     iInfoLabel = new (ELeave) CEikLabel;
00055     iInfoLabel->SetContainerWindowL( *this );
00056     iInfoLabel->SetAlignment( EHCenterVCenter );
00057     iInfoLabel->SetTextL( *labelText );
00058     iInfoLabel->SetExtentToWholeScreen();
00059     CleanupStack::PopAndDestroy( labelText );
00060 
00061     // Create a list box for listing the groups of music files
00062     iListBox = new (ELeave) CAknSingleStyleListBox;
00063     iListBox->MakeVisible( EFalse );
00064     iListBox->SetContainerWindowL( *this );
00065     iListBox->ConstructL( this, NULL );
00066     iListBox->CreateScrollBarFrameL( ETrue );
00067     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
00068         CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
00069     HBufC* emptyText = StringLoader::LoadLC( R_CE_NO_GROUPS );
00070     iListBox->View()->SetListEmptyTextL( *emptyText );
00071     CleanupStack::PopAndDestroy( emptyText );
00072 
00073     // Create a text array for items of the list box
00074     iItemList = new (ELeave) CDesCArraySeg( KCEArrayGranularity );
00075     iListBox->Model()->SetItemTextArray( iItemList );
00076     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
00077 
00078     // Set size of the window and activate it
00079     SetRect( iAvkonAppUi->ClientRect() );
00080     ActivateL();
00081     }

void CCEGroupContainer::AppendListBoxItemL (  const TDesC &  aItem  ) 
 

Append new item to the list box of group listing.

Parameters:
aItem  List box item to add

Definition at line 96 of file CCEGroupContainer.cpp.

References iItemList, and iListBox.

Referenced by CCEGroupView::PopulateListBoxL().

00097     {
00098     // Load a string from the resource. The string is used to generate
00099     // the item that will be added to the list box.
00100     HBufC* listItem = StringLoader::LoadLC( R_CE_GROUP_LIST_ITEM, aItem );
00101 
00102     // Append the item to the list box and refresh it
00103     iItemList->AppendL( *listItem );
00104     iListBox->HandleItemAdditionL();
00105     CleanupStack::PopAndDestroy( listItem );
00106 
00107     // Make the list box visible, if needed
00108     if( !iListBox->IsVisible() )
00109         {
00110         iListBox->MakeVisible( ETrue );
00111         }
00112     }

TInt CCEGroupContainer::CurrentItemIndex (   ) 
 

Get index of the item that is currently selected in the list box.

Returns:
Index of selected item

Definition at line 119 of file CCEGroupContainer.cpp.

References iListBox.

Referenced by CCEGroupView::DynInitMenuPaneL().

00120         {
00121         return iListBox->CurrentItemIndex();
00122         }

void CCEGroupContainer::ResetListBoxL (   ) 
 

Clear the list box of group listing.

Definition at line 129 of file CCEGroupContainer.cpp.

References iItemList, and iListBox.

Referenced by CCEGroupView::PopulateListBoxL().

00130     {
00131     // Clear the list box model, refresh the list box and make it invisible
00132     iItemList->Reset();
00133     iListBox->HandleItemRemovalL();
00134     }

void CCEGroupContainer::SetCurrentItemIndex (  TInt  aIndex  ) 
 

Selects specified item of the list box.

Parameters:
aIndex  Index of the item to select

Definition at line 141 of file CCEGroupContainer.cpp.

References iListBox.

00142         {
00143     iListBox->SetCurrentItemIndexAndDraw( aIndex );
00144         }

void CCEGroupContainer::Draw (  const TRect &  aRect  )  const [protected]
 

From CCoeControl. Draw the screen.

Definition at line 151 of file CCEGroupContainer.cpp.

00152     {
00153     // Get the graphics content, set background color and clear the screen
00154     CWindowGc& gc = SystemGc();
00155     gc.SetPenStyle( CGraphicsContext::ENullPen );
00156     gc.SetBrushColor( AKN_LAF_COLOR( KCEBackgroundColor ) );
00157     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
00158     gc.Clear( aRect );
00159     }

TInt CCEGroupContainer::CountComponentControls (   )  const [protected]
 

From CCoeControl. Get count of component controls in the container.

Definition at line 202 of file CCEGroupContainer.cpp.

00203     {
00204     return KCENumberOfComponentsInGroupContainer;
00205     }

CCoeControl * CCEGroupContainer::ComponentControl (  TInt  aIndex  )  const [protected]
 

From CCoeControl. Get component control by its index.

Definition at line 212 of file CCEGroupContainer.cpp.

References iInfoLabel, and iListBox.

00213     {
00214     switch( aIndex )
00215         {
00216         case 0:
00217             {
00218                 return iInfoLabel;
00219                     }
00220         case 1:
00221             {
00222                 return iListBox;
00223                     }
00224         default:
00225             {
00226                 return NULL;
00227                     }
00228         }
00229     }

void CCEGroupContainer::HandleResourceChange (  TInt  aType  )  [protected]
 

From CCoeControl. Handle change of the screen resolution.

Definition at line 236 of file CCEGroupContainer.cpp.

References iParent.

00237     {
00238     if ( aType == KEikDynamicLayoutVariantSwitch )
00239         {
00240         ( static_cast <CCEGroupView *> ( iParent ) )->HandleClientRectChange();
00241         }
00242     }

TKeyResponse CCEGroupContainer::OfferKeyEventL (  const TKeyEvent &  aKeyEvent,
TEventCode  aType
)  [protected]
 

From CCoeControl. Handle user's key events.

Definition at line 166 of file CCEGroupContainer.cpp.

References iListBox, and iParent.

00168         {
00169         if( aType == EEventKey )
00170                 {
00171                 switch( aKeyEvent.iScanCode )
00172                         {
00173                         case EStdKeyUpArrow:
00174                         case EStdKeyDownArrow:
00175                                 {
00176                                 // Send arrow key events to the list box for moving the focus
00177                                 iListBox->OfferKeyEventL( aKeyEvent, aType );
00178                                 return EKeyWasConsumed;
00179                                 }
00180 
00181                         case EStdKeyDevice3:
00182                                 {
00183                                 // Send selection event to parent view
00184                                 iParent->HandleCommandL( ECECmdSelect );
00185                                 return EKeyWasConsumed;
00186                                 }
00187 
00188                         default:
00189                                 {
00190                                 break;
00191                                 }
00192                         }
00193                 }
00194         return EKeyWasNotConsumed;
00195         }

void CCEGroupContainer::SizeChanged (   )  [protected]
 

From CCoeControl. Responds to size changes to sets the size and position of the contents of this control.

Definition at line 250 of file CCEGroupContainer.cpp.

References iListBox.

00251         {
00252         if( iListBox )
00253             {
00254         iListBox->SetRect( Rect() );
00255             }
00256         if( iInfoLabel )
00257             {
00258         iInfoLabel->SetRect( Rect() );
00259             }
00260         }


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top