chxavrecentclipspopuplist.cpp
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:3k
源码类别:

Symbian

开发平台:

C/C++

  1. /************************************************************************
  2.  * chxavrecentclipspopuplist.cpp
  3.  * -----------------------------
  4.  *
  5.  * Synopsis:
  6.  * Contains the class implementation of CHXAvRecentClipsPopupList.  This 
  7.  * put up a dialog with the recently played clips.
  8.  *
  9.  *
  10.  *
  11.  * Target:
  12.  * Symbian OS
  13.  *
  14.  *
  15.  * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
  16.  *
  17.  *****************************************************************************/
  18. // Symbian includes...
  19. #include <avkon.mbg>
  20. // Helix includes...
  21. // Includes from this project...
  22. #include "chxavcleanupstack.h"
  23. #include "chxavmisc.h"
  24. #include "chxavrecentclipspopuplist.h"
  25. #include "chxavcleanstring.h"
  26. #include "realplayer.mbg"
  27. CHXAvRecentClipsPopupList::CHXAvRecentClipsPopupList(TInt& idxSelected)
  28. : m_pListBox(0)
  29. , m_idxSelected(idxSelected)
  30. {
  31. }
  32. CHXAvRecentClipsPopupList::~CHXAvRecentClipsPopupList()
  33. {
  34.     HX_DELETE(m_pListBox);
  35. }
  36. ////////////////////////////////////////////////
  37. //
  38. void CHXAvRecentClipsPopupList::ConstructL(CHXAvURLList *recentClips)
  39. {
  40.     // create listbox that this popup list uses/manages
  41.     m_pListBox  = new (ELeave) CAknSingleGraphicPopupMenuStyleListBox;
  42.     
  43.     CAknPopupList::ConstructL(m_pListBox, R_AVKON_SOFTKEYS_OK_BACK,
  44. AknPopupLayouts::EMenuGraphicWindow);
  45.     
  46.     m_pListBox->ConstructL(this, CEikListBox::ELeftDownInViewRect);
  47.     m_pListBox->CreateScrollBarFrameL(ETrue);
  48.     m_pListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
  49. CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
  50.     // XXXLCM are EMbmRealplayerFile_local, EMbmRealplayerFile_mmc not used? check mbm
  51.     // see CHXAvMisc::ClipTypeIconIndex; order is important
  52.      static const CHXAvMisc::ImageInfo images[] =
  53.     { 
  54.         {EMbmRealplayerQgn_prop_phone_small,        EMbmRealplayerQgn_prop_phone_small_mask     }, 
  55.         {EMbmRealplayerFile_network,      EMbmRealplayerFile_network_mask   }, 
  56.         {EMbmRealplayerQgn_prop_mmc_small,          EMbmRealplayerQgn_prop_mmc_small_mask       }, 
  57.         {EMbmRealplayerFile_mmc_broken,   EMbmRealplayerFile_mmc_broken_mask}  
  58.     };
  59.    
  60.     // create icon array for list items
  61.     CAknIconArray* pIcons = CHXAvMisc::AllocIconsL(images, ARRAY_COUNT(images));
  62.     AUTO_PUSH_POP(pIcons);
  63.     // transfer icon array ownership to list box
  64.     m_pListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL(pIcons);
  65.     // not sure what this does
  66.     m_pListBox->ItemDrawer()->SetItemMarkPosition(0);
  67.     m_pListBox->ItemDrawer()->SetItemMarkReplacement(_L("0"));
  68.     // set the title to "select clip:"
  69.     SetTitleL(CHXAvCleanString(R_PROMPT_SELECT_CLIP)());
  70.     // create list
  71.     CHXAvNameDisplayTrait trait(true /*hide extensions*/);
  72.     CDesCArrayFlat* pItems = CHXAvMisc::AllocGrPopupListItemsL(recentClips, &trait);
  73.     AUTO_PUSH_POP(pItems);
  74.     HX_ASSERT(pItems->Count() > 0);
  75.     // transfer list ownership to listbox
  76.     CTextListBoxModel* pModel = m_pListBox->Model();
  77.     pModel->SetItemTextArray(pItems);
  78.     pModel->SetOwnershipType(ELbmOwnsItemArray);
  79.     // make sure nothing is selected; first item is current
  80.     m_pListBox->ClearSelection();
  81.     m_pListBox->SetCurrentItemIndex(0);
  82. }
  83. //////////////////////////////
  84. //
  85. void
  86. CHXAvRecentClipsPopupList::AttemptExitL(TBool aAccept)
  87. {
  88.     m_idxSelected = m_pListBox->CurrentItemIndex();
  89.     CAknPopupList::AttemptExitL(aAccept);
  90. }