S60UIExampleList.cpp
上传用户:laixiong
上传日期:2007-03-11
资源大小:2994k
文件大小:3k
- // Copyright (c) 2006 Nokia Corporation.
- #include "S60UIExampleList.h"
- #include "S60UIExample.hrh"
- // ----------------------------------------------------------------------------
- // CAknExSettingListListbox::CreateSettingItemL()
- // Updates descripter array for list box
- // ----------------------------------------------------------------------------
- //
- CAknSettingItem* CS60UIExampleList::CreateSettingItemL(TInt aIdentifier)
- {
- CAknSettingItem* settingItem = NULL;
- switch (aIdentifier)
- {
- case ESpeedSettingItem:
- settingItem = new (ELeave) CAknSliderSettingItem(aIdentifier,
- *iSpeed);
- break;
- case EVolumeSettingItem:
- {
- // Ensure value is within expected range
- if (*iVolume < 1) *iVolume = 1;
- if (*iVolume > 10) *iVolume = 10;
- settingItem = new (ELeave) CAknVolumeSettingItem(aIdentifier, *iVolume);
- break;
- }
- case EBacktrackingSettingItem:
- settingItem = new (ELeave) CAknBinaryPopupSettingItem(aIdentifier,
- *iBacktrack);
- break;
- default:
- break;
- }
-
- return settingItem;
- }
- // ------------------------------------------------------------------------------
- // CS60UIExampleList::SetData()
- // Set ListItem data
- // ------------------------------------------------------------------------------
- //
- void CS60UIExampleList::SetData(TInt& aVolume, TInt& aSpeed, TBool& aBacktrack)
- {
- iVolume = &aVolume;
- iSpeed = &aSpeed;
- iBacktrack = &aBacktrack;
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleList::SizeChanged()
- // Called by framework when the view size is changed.
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleList::SizeChanged()
- {
- if (ListBox())
- {
- ListBox()->SetRect(Rect());
- }
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleList::HandleResourceChange()
- // Called by framework when screen size changes. Use to cause necessary
- // resizing to be performed.
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleList::HandleResourceChange(TInt aType)
- {
- CCoeControl::HandleResourceChange(aType);
- if (aType == KEikDynamicLayoutVariantSwitch)
- {
- // Screen size has changed. Get the new Main Pane size
- TRect rect;
- AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
- // Pass it on. Eventually SizeChanged() performs the necessary
- // resizing
- SetRect(rect);
- }
- }
- // End of File