|
Nokia N97 SDK Example Applications Guide |
#include <CCEMusicContainer.h>
Inheritance diagram for CCEMusicContainer:

Definition at line 32 of file CCEMusicContainer.h.
Public Member Functions |
|
| CCEMusicContainer (CAknView *aParent) | |
| void | ConstructL () |
| virtual | ~CCEMusicContainer () |
| void | AppendListBoxItemL (CDesCArray *aTextItems) |
| void | ResetListBoxL () |
| TInt | CurrentItemIndex () |
| 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 |
| CAknDoubleStyleListBox * | iListBox |
| CDesCArray * | iItemList |
|
|
C++ default constructor.
Definition at line 37 of file CCEMusicContainer.cpp. 00038 : iParent( aParent ) 00039 { 00040 }
|
|
|
Destructor. Definition at line 73 of file CCEMusicContainer.cpp. References iItemList, and iListBox.
|
|
|
Symbian 2nd phase constructor. Definition at line 47 of file CCEMusicContainer.cpp. References iItemList, and iListBox. Referenced by CCEMusicView::DoActivateL(). 00048 { 00049 // Create a window for the music view 00050 CreateWindowL(); 00051 00052 // Create a list box for the music files listing 00053 iListBox = new (ELeave) CAknDoubleStyleListBox; 00054 iListBox->MakeVisible( EFalse ); 00055 iListBox->SetContainerWindowL( *this ); 00056 iListBox->ConstructL( this, NULL ); 00057 iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); 00058 iListBox->CreateScrollBarFrameL( ETrue ); 00059 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 00060 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); 00061 00062 // Create text array for items of the list box 00063 iItemList = new (ELeave) CDesCArraySeg( KCEArrayGranularity ); 00064 iListBox->Model()->SetItemTextArray( iItemList ); 00065 iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); 00066 00067 // Set size of the window and activate it 00068 SetRect( iAvkonAppUi->ClientRect() ); 00069 ActivateL(); 00070 }
|
|
|
Append a new list box item with song name, artist and album to the list box of group listing.
Definition at line 84 of file CCEMusicContainer.cpp. 00085 { 00086 HBufC* listItem; 00087 00088 // Load the string from the resource. The string will be used to 00089 // generate a new item to the list box. There are different strings 00090 // for items that have an album tag and items that does not 00091 // have album, title or artist tag. 00092 00093 // If song name and artist tags are present this string will be used. 00094 // It is also used to view file name if name or artist tag is missing. 00095 if( aTextItems->Count() == 2 ) 00096 { 00097 listItem = StringLoader::LoadLC( 00098 R_CE_MUSIC_LIST_2_ITEM, *aTextItems, iEikonEnv ); 00099 } 00100 00101 // If song name, artist and album tags are all found 00102 else if ( aTextItems->Count() == 3 ) 00103 { 00104 listItem = StringLoader::LoadLC( 00105 R_CE_MUSIC_LIST_3_ITEM, *aTextItems, iEikonEnv ); 00106 } 00107 00108 // If this else is reached, the function has not been used properly 00109 else 00110 { 00111 return; 00112 } 00113 00114 // Append the new item to the list box and refresh it 00115 iItemList->AppendL( *listItem ); 00116 iListBox->HandleItemAdditionL(); 00117 00118 CleanupStack::PopAndDestroy( listItem ); 00119 00120 // Make the list box visible, if needed 00121 if( !iListBox->IsVisible() ) 00122 { 00123 iListBox->MakeVisible( ETrue ); 00124 } 00125 }
|
|
|
Clear the list box of group listing. Definition at line 132 of file CCEMusicContainer.cpp. References iItemList, and iListBox. Referenced by CCEMusicView::PopulateListBoxL(). 00133 { 00134 // Clear the list box 00135 iItemList->Reset(); 00136 iListBox->HandleItemRemovalL(); 00137 iListBox->MakeVisible( EFalse ); 00138 }
|
|
|
Get index of the item that is currently selected in the list box.
Definition at line 145 of file CCEMusicContainer.cpp. References iListBox. 00146 { 00147 return iListBox->CurrentItemIndex(); 00148 }
|
|
|
Selects specified item of the list box.
Definition at line 155 of file CCEMusicContainer.cpp. References iListBox. 00156 { 00157 iListBox->SetCurrentItemIndexAndDraw( aIndex ); 00158 }
|
|
|
From CCoeControl. Draw the screen. Definition at line 165 of file CCEMusicContainer.cpp. 00166 { 00167 // Get the graphics content and clear the screen 00168 CWindowGc& gc = SystemGc(); 00169 gc.Clear( aRect ); 00170 }
|
|
|
From CCoeControl. Get count of component controls in the container. Definition at line 212 of file CCEMusicContainer.cpp.
|
|
|
From CCoeControl. Get component control by its index. Definition at line 222 of file CCEMusicContainer.cpp. References iListBox. 00223 { 00224 switch( aIndex ) 00225 { 00226 case 0: 00227 { 00228 return iListBox; 00229 } 00230 default: 00231 { 00232 return NULL; 00233 } 00234 } 00235 }
|
|
|
From CCoeControl. Handle change of the screen resolution. Definition at line 242 of file CCEMusicContainer.cpp. References iParent. 00243 { 00244 if ( aType == KEikDynamicLayoutVariantSwitch ) 00245 { 00246 ( static_cast <CCEMusicView *> ( iParent ) )->HandleClientRectChange(); 00247 } 00248 }
|
|
||||||||||||
|
From CCoeControl. Handle user's key events. Definition at line 177 of file CCEMusicContainer.cpp. References iListBox, and iParent. 00178 { 00179 if( aType == EEventKey ) 00180 { 00181 switch( aKeyEvent.iScanCode ) 00182 { 00183 case EStdKeyUpArrow: 00184 case EStdKeyDownArrow: 00185 { 00186 // Send arrow key events to the list box for moving the focus 00187 iListBox->OfferKeyEventL( aKeyEvent, aType ); 00188 return EKeyWasConsumed; 00189 } 00190 00191 case EStdKeyDevice3: 00192 { 00193 // Send selection event to parent view 00194 iParent->HandleCommandL( ECECmdSelect ); 00195 return EKeyWasConsumed; 00196 } 00197 00198 default: 00199 { 00200 break; 00201 } 00202 } 00203 } 00204 return EKeyWasNotConsumed; 00205 }
|
|
|
From CCoeControl. Responds to size changes to sets the size and position of the contents of this control. Definition at line 257 of file CCEMusicContainer.cpp. References iListBox. 00258 { 00259 iListBox->SetRect( Rect() ); 00260 }
|
|
© Nokia 2009 |