S60UIExampleList.cpp
上传用户:laixiong
上传日期:2007-03-11
资源大小:2994k
文件大小:3k
源码类别:

Symbian

开发平台:

C/C++

  1. // Copyright (c) 2006 Nokia Corporation.
  2. #include "S60UIExampleList.h"
  3. #include "S60UIExample.hrh"
  4. // ----------------------------------------------------------------------------
  5. // CAknExSettingListListbox::CreateSettingItemL()
  6. // Updates descripter array for list box
  7. // ----------------------------------------------------------------------------
  8. //
  9. CAknSettingItem* CS60UIExampleList::CreateSettingItemL(TInt aIdentifier)
  10.     {
  11.     CAknSettingItem* settingItem = NULL;
  12.     switch (aIdentifier)
  13.         {
  14.         case ESpeedSettingItem:
  15.             settingItem = new (ELeave) CAknSliderSettingItem(aIdentifier, 
  16.                                                              *iSpeed);
  17.             break;
  18. case EVolumeSettingItem:
  19.     {
  20.     // Ensure value is within expected range
  21.     if (*iVolume < 1) *iVolume = 1;
  22.     if (*iVolume > 10) *iVolume = 10;
  23.     settingItem = new (ELeave) CAknVolumeSettingItem(aIdentifier, *iVolume);
  24.     break;
  25.     }
  26.         case EBacktrackingSettingItem:
  27.             settingItem = new (ELeave) CAknBinaryPopupSettingItem(aIdentifier,
  28.                                                                   *iBacktrack);
  29.             break;
  30.         default:
  31.             break;
  32.         }
  33.             
  34.     return settingItem;
  35.     }
  36. // ------------------------------------------------------------------------------
  37. // CS60UIExampleList::SetData()
  38. // Set ListItem data
  39. // ------------------------------------------------------------------------------
  40. //
  41. void CS60UIExampleList::SetData(TInt& aVolume, TInt& aSpeed, TBool& aBacktrack)
  42.     {
  43.     iVolume = &aVolume;
  44.     iSpeed = &aSpeed;
  45.     iBacktrack = &aBacktrack;
  46.     }
  47. // -----------------------------------------------------------------------------
  48. // CS60UIExampleList::SizeChanged()
  49. // Called by framework when the view size is changed.
  50. // -----------------------------------------------------------------------------
  51. //
  52. void CS60UIExampleList::SizeChanged()
  53.     {
  54.     if (ListBox()) 
  55.         {
  56.         ListBox()->SetRect(Rect());
  57.         }
  58.     }
  59. // -----------------------------------------------------------------------------
  60. // CS60UIExampleList::HandleResourceChange()
  61. // Called by framework when screen size changes. Use to cause necessary
  62. // resizing to be performed.
  63. // -----------------------------------------------------------------------------
  64. //
  65. void CS60UIExampleList::HandleResourceChange(TInt aType)
  66.     {
  67.     CCoeControl::HandleResourceChange(aType);
  68.     if (aType == KEikDynamicLayoutVariantSwitch)
  69.         {
  70.         // Screen size has changed. Get the new Main Pane size
  71.         TRect rect;
  72.         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
  73.         // Pass it on. Eventually SizeChanged() performs the necessary
  74.         // resizing
  75.         SetRect(rect);
  76.         }
  77.     }
  78. // End of File