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 EBacktrackingSettingItem:
  19.             settingItem = new (ELeave) CAknBinaryPopupSettingItem(aIdentifier,
  20.                                                                   *iBacktrack);
  21.             break;
  22.         default:
  23.             break;
  24.         }
  25.             
  26.     return settingItem;
  27.     }
  28. // ------------------------------------------------------------------------------
  29. // CS60UIExampleList::SetData()
  30. // Set ListItem data
  31. // ------------------------------------------------------------------------------
  32. //
  33. void CS60UIExampleList::SetData(TInt& aVolume, TInt& aSpeed, TBool& aBacktrack)
  34.     {
  35.     iVolume = &aVolume;
  36.     iSpeed = &aSpeed;
  37.     iBacktrack = &aBacktrack;
  38.     }
  39. // -----------------------------------------------------------------------------
  40. // CS60UIExampleList::SizeChanged()
  41. // Called by framework when the view size is changed.
  42. // -----------------------------------------------------------------------------
  43. //
  44. void CS60UIExampleList::SizeChanged()
  45.     {
  46.     if (ListBox()) 
  47.         {
  48.         ListBox()->SetRect(Rect());
  49.         }
  50.     }
  51. // -----------------------------------------------------------------------------
  52. // CS60UIExampleList::HandleResourceChange()
  53. // Called by framework when screen size changes. Use to cause necessary
  54. // resizing to be performed.
  55. // -----------------------------------------------------------------------------
  56. //
  57. void CS60UIExampleList::HandleResourceChange(TInt aType)
  58.     {
  59.     CCoeControl::HandleResourceChange(aType);
  60.     if (aType == KEikDynamicLayoutVariantSwitch)
  61.         {
  62.         // Screen size has changed. Get the new Main Pane size
  63.         TRect rect;
  64.         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
  65.         // Pass it on. Eventually SizeChanged() performs the necessary
  66.         // resizing
  67.         SetRect(rect);
  68.         }
  69.     }
  70. // End of File