S60UIExampleSettingsView.cpp
上传用户:laixiong
上传日期:2007-03-11
资源大小:2994k
文件大小:4k
源码类别:
Symbian
开发平台:
C/C++
- // Copyright (c) 2006 Nokia Corporation.
- #include "S60UIExampleList.h"
- #include "S60UIExampleSettingsView.h"
- #include "S60UIExample.hrh"
- #include <S60UIExample.rsg>
- #include <aknviewappui.h>
- // -----------------------------------------------------------------------------
- // CS60UIExampleSettingsView::NewL()
- // Two-phased constructor.
- // -----------------------------------------------------------------------------
- //
- CS60UIExampleSettingsView* CS60UIExampleSettingsView::NewL()
- {
- CS60UIExampleSettingsView* self = new (ELeave) CS60UIExampleSettingsView;
- CleanupStack::PushL (self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleSettingsView::ConstructL()
- // Symbian 2nd phase constructor can leave.
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleSettingsView::ConstructL()
- {
- BaseConstructL (R_S60UIEXAMPLE_SETTINGS_VIEW);
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleSettingsView::CS60UIExampleSettingsView()
- // C++ default constructor can NOT contain any code, that might leave.
- // -----------------------------------------------------------------------------
- //
- CS60UIExampleSettingsView::CS60UIExampleSettingsView() : iList (NULL)
- {
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleSettingsView::~CS60UIExampleSettingsView()
- // Destructor.
- // -----------------------------------------------------------------------------
- //
- CS60UIExampleSettingsView::~CS60UIExampleSettingsView()
- {
- if (iList)
- {
- AppUi()->RemoveFromStack (iList);
- }
- delete iList;
- }
- // -----------------------------------------------------------------------------
- // TUid CS60UIExampleSettingsView::Id()
- // Returns the View Id.
- // -----------------------------------------------------------------------------
- //
- TUid CS60UIExampleSettingsView::Id() const
- {
- return TUid::Uid (ES60UIExampleSettingsViewId);
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleSettingsView::HandleCommandL()
- // Handles the commands.
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleSettingsView::HandleCommandL (TInt aCommand)
- {
- switch (aCommand)
- {
- case EEikCmdExit:
- case EAknSoftkeyExit:
- {
- AppUi()->Exit();
- break;
- }
- case ES60UIExampleChange:
- {
- TInt index = iList->ListBox()->CurrentItemIndex();
- iList->EditItemL(index, EFalse);
- break;
- }
- case EAknSoftkeyBack:
- {
- AppUi()->ActivateLocalViewL (TUid::Uid (ES60UIExampleInitialViewId));
- break;
- }
- default:
- AppUi()->HandleCommandL (aCommand);
- }
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleSettingsView::DoActivateL()
- // Creates the Container class object.
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleSettingsView::DoActivateL (const TVwsViewId& /*aPrevViewId*/,
- TUid /*aCustomMessageId*/,
- const TDesC8& /*aCustomMessage*/)
- {
- if (!iList)
- {
- iList = new (ELeave) CS60UIExampleList;
- iList->SetData(iVolume, iSpeed, iBacktrack);
- iList->SetMopParent(this);
- iList->ConstructFromResourceL(R_S60UIEXAMPLE_SETTING_LIST);
- AppUi()->AddToStackL(*this, iList);
- }
- iList->MakeVisible (ETrue);
- iList->SetRect(ClientRect());
- iList->ActivateL();
- iList->DrawNow();
- }
- // -----------------------------------------------------------------------------
- // CS60UIExampleSettingsView::DoDeactivate()
- // Deletes the Container class object.
- // -----------------------------------------------------------------------------
- //
- void CS60UIExampleSettingsView::DoDeactivate()
- {
- if (iList)
- {
- iList->MakeVisible (EFalse);
- }
- }
- // End of File