📄 cameraappportraitview.cpp
字号:
/*
* ============================================================================
* Name : CCameraAppPortraitView2 from CameraAppView2.h
* Part of : CameraApp
* Created : 02/09/2004 by Forum Nokia
* Implementation notes:
* Initial content was generated by Series 60 AppWizard.
* Version :
* Copyright: Nokia Corporation, 2004
* ============================================================================
*/
#include <aknviewappui.h>
#include <avkon.hrh>
#include <eikmenup.h>
#include <CameraApp.rsg>
#include "CameraAppPortraitView.h"
#include "CameraAppPortraitContainer.h"
#include "CameraAppController.h"
/*
-----------------------------------------------------------------------------
CCameraAppPortraitView::ConstructL(const TRect& aRect)
Description: Symbian 2nd phase constructor can leave.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppPortraitView::ConstructL()
{
BaseConstructL( R_CAMERAAPP_VIEW2 );
}
/*
-----------------------------------------------------------------------------
CCameraAppPortraitView* CCameraAppPortraitView::NewLC( CCameraAppController&
aController )
Description: Two-phased constructor.
Comments :
Return values: CCameraAppPortraitView object pointer
-----------------------------------------------------------------------------
*/
CCameraAppPortraitView* CCameraAppPortraitView::NewLC( CCameraAppController&
aController )
{
CCameraAppPortraitView* self = new( ELeave ) CCameraAppPortraitView( aController );
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
/*
-----------------------------------------------------------------------------
CCameraAppPortraitView::~CCameraAppPortraitView()
Description: destructor
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
CCameraAppPortraitView::~CCameraAppPortraitView()
{
if ( iContainer )
{
AppUi()->RemoveFromViewStack( *this, iContainer );
}
delete iContainer;
}
/*
-----------------------------------------------------------------------------
TUid CCameraAppPortraitView::Id() const
Description: return the view ID
Comments :
Return values: return the view ID
-----------------------------------------------------------------------------
*/
TUid CCameraAppPortraitView::Id() const
{
return KViewIdPortrait;
}
/*
-----------------------------------------------------------------------------
void CCameraAppPortraitView::HandleCommandL(TInt aCommand)
Description: takes care of command handling
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppPortraitView::HandleCommandL(TInt aCommand)
{
switch ( aCommand )
{
case EAknSoftkeyBack:
{
AppUi()->HandleCommandL(EEikCmdExit);
break;
}
default:
{
AppUi()->HandleCommandL( aCommand );
break;
}
}
}
/*
-----------------------------------------------------------------------------
void CCameraAppPortraitView::HandleClientRectChange()
Description: called by framework when client rect changes
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppPortraitView::HandleClientRectChange()
{
if ( iContainer )
{
iContainer->SetRect( ClientRect() );
}
}
/*
-----------------------------------------------------------------------------
void CCameraAppPortraitView::DoActivateL( const TVwsViewId& aPrevViewId,
TUid aCustomMessageId, const TDesC8& aCustomMessage )
Description: called by framework when view is activated
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppPortraitView::DoActivateL(
const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
if (!iContainer)
{
iContainer = new (ELeave) CCameraAppPortraitContainer( iController );
iContainer->SetMopParent(this);
// Set the controller to the correct mode before the viewfinding
iController.SetCameraMode( ECameraPortraitMode );
iContainer->ConstructL( ClientRect() );
AppUi()->AddToStackL( *this, iContainer );
iContainer->SetFocus( ETrue );
}
}
/*
-----------------------------------------------------------------------------
void CCameraAppPortraitView::DoDeactivate()
Description: called by framework when view is deactivated
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppPortraitView::DoDeactivate()
{
if ( iContainer )
{
iContainer->SetFocus(EFalse);
AppUi()->RemoveFromViewStack( *this, iContainer );
delete iContainer;
iContainer = NULL;
}
}
/*
-----------------------------------------------------------------------------
void CCameraAppPortraitView::DynInitMenuPaneL(
TInt aResourceId,CEikMenuPane* aMenuPane)
Description: This function is called by the EIKON framework just before
it displays a menu pane. Its default implementation is empty,
and by overriding it, the application can set the state of menu
items dynamically according to the state of application data.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppPortraitView::DynInitMenuPaneL(
TInt aResourceId, CEikMenuPane* aMenuPane )
{
if ( aResourceId == R_CAMERAAPP_APP_MENU )
{
// If image has been converted, then hide the "Snap" menu item
TEngineState state = iController.GetEngineState();
// If the engine is not in the idle state, bar the "Snap" function
// from being accessed.
if ( state != EEngineIdle || iController.IsCameraUsedByAnotherApp() )
aMenuPane->SetItemDimmed( ECameraAppCmdSnap, ETrue );
// Only when the engine is in the converted state, show the "
// "New image" menu item
if ( state == EConverted )
aMenuPane->SetItemDimmed( ECameraAppCmdNewImage, EFalse );
else
aMenuPane->SetItemDimmed( ECameraAppCmdNewImage, ETrue );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -