📄 multiviewsview2.cpp
字号:
/* Copyright (c) 2004, Nokia. All rights reserved */
// INCLUDE FILES
#include <aknviewappui.h>
#include <aknconsts.h>
#include <aknnotewrappers.h>
#include <MultiViews.rsg>
#include <stringloader.h>
#include "MultiViewsView2.h"
#include "MultiViewsContainer2.h"
#include "MultiViews.hrh"
// ========================= MEMBER FUNCTIONS ==================================
// -----------------------------------------------------------------------------
// CMultiViewsView2::CMultiViewsView2()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CMultiViewsView2::CMultiViewsView2()
{
// No implementation required
}
// -----------------------------------------------------------------------------
// CMultiViewsView2::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CMultiViewsView2* CMultiViewsView2::NewL()
{
CMultiViewsView2* self = CMultiViewsView2::NewLC();
CleanupStack::Pop( self );
return self;
}
// -----------------------------------------------------------------------------
// CMultiViewsView2::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CMultiViewsView2* CMultiViewsView2::NewLC()
{
CMultiViewsView2* self = new ( ELeave ) CMultiViewsView2();
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
// -----------------------------------------------------------------------------
// CMultiViewsView2::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CMultiViewsView2::ConstructL()
{
BaseConstructL( R_MULTIVIEWS_VIEW2 );
}
// -----------------------------------------------------------------------------
// CMultiViewsView2::~CMultiViewsView2()
// Destructor.
// -----------------------------------------------------------------------------
//
CMultiViewsView2::~CMultiViewsView2()
{
// No implementation required
}
// -----------------------------------------------------------------------------
// CMultiViewsView2::Id()
// Returns View's ID.
// -----------------------------------------------------------------------------
//
TUid CMultiViewsView2::Id() const
{
return TUid::Uid( EMultiViewsView2Id );
}
// -----------------------------------------------------------------------------
// CMultiViewsView2::DoActivateL()
// Activate an MultiView2
// -----------------------------------------------------------------------------
//
void CMultiViewsView2::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/ )
{
iContainer = CMultiViewsContainer2::NewL( ClientRect() );
}
// -----------------------------------------------------------------------------
// CMultiViewsView2::DoDeactivate()
// DeActivate an MultiView2
// -----------------------------------------------------------------------------
//
void CMultiViewsView2::DoDeactivate()
{
if ( iContainer )
{
AppUi()->RemoveFromStack( iContainer );
delete iContainer;
iContainer = NULL;
}
}
// -----------------------------------------------------------------------------
// CMultiViewsView2::HandleCommandL()
// Takes care of Command handling.
// -----------------------------------------------------------------------------
//
void CMultiViewsView2::HandleCommandL( TInt aCommand )
{
if ( aCommand == EMultiViewsCommand1 )
{
// Load a string from the resource file.
HBufC* textResource = StringLoader::LoadLC( R_MULT_COMMAND1_TEXT );
CAknInformationNote* informationNote = new ( ELeave ) CAknInformationNote;
informationNote->ExecuteLD( *textResource );
// Pop HBuf from CleanUpStack and Destroy it.
CleanupStack::PopAndDestroy( textResource );
}
else if ( aCommand == EMultiViewsSwitchToView1 )
{
AppUi()->ActivateLocalViewL( TUid::Uid( EMultiViewsView1Id ) );
}
else
{
AppUi()->HandleCommandL( aCommand );
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -