?? cameraappview.cpp
字號:
/*
* ============================================================================
* Name : CCameraAppView from CameraAppView.cpp
* Part of : CameraApp
* Created : 05/06/2006 by Forum Nokia
* Version : 2.0
* Copyright: Nokia Corporation, 2006
* ============================================================================
*/
#include <aknviewappui.h>
#include <avkon.hrh>
#include <eikmenup.h>
#include <CameraApp.rsg>
#include "CameraAppView.h"
#include "CameraAppContainer.h"
#include "CameraApp.hrh"
#include "CameraAppController.h"
/*
-----------------------------------------------------------------------------
void CCameraAppView::ConstructL()
Description: Symbian 2nd phase constructor can leave.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppView::ConstructL()
{
BaseConstructL( R_CAMERAAPP_VIEW1 );
}
/*
-----------------------------------------------------------------------------
CCameraAppView* CCameraAppView::NewLC( CCameraAppController& aController )
Description: Two-phased constructor.
Comments :
Return values: CCameraAppView object pointer
-----------------------------------------------------------------------------
*/
CCameraAppView* CCameraAppView::NewLC( CCameraAppController& aController )
{
CCameraAppView* self = new( ELeave ) CCameraAppView( aController );
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
/*
-----------------------------------------------------------------------------
CCameraAppView::~CCameraAppView()
Description: destructor, free allocated resources
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
CCameraAppView::~CCameraAppView()
{
if ( iContainer )
{
AppUi()->RemoveFromViewStack( *this, iContainer );
}
delete iContainer;
}
/*
-----------------------------------------------------------------------------
TUid CCameraAppView::Id() const
Description: return the view ID
Comments :
Return values: return the view ID
-----------------------------------------------------------------------------
*/
TUid CCameraAppView::Id() const
{
return KViewIdStandard;
}
/*
-----------------------------------------------------------------------------
void CCameraAppView::HandleCommandL(TInt aCommand)
Description: takes care of command handling
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppView::HandleCommandL(TInt aCommand)
{
switch ( aCommand )
{
case EAknSoftkeyOk:
{
break;
}
case EAknSoftkeyBack:
{
AppUi()->HandleCommandL(EEikCmdExit);
break;
}
default:
{
AppUi()->HandleCommandL( aCommand );
break;
}
}
}
/*
-----------------------------------------------------------------------------
void CCameraAppView::DoActivateL( const TVwsViewId& aPrevViewId,
TUid aCustomMessageId, const TDesC8& aCustomMessage )
Description: called by framework when view is activated
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppView::DoActivateL(
const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
iController.InitializeCameraL( ClientRect() );
if (!iContainer)
{
iContainer = new (ELeave) CCameraAppContainer( iController );
iContainer->SetMopParent( this );
// Set the controller to the correct mode before the viewfinding
iController.SetCameraMode( ECameraLandscapeMode );
iContainer->ConstructL( ClientRect() );
AppUi()->AddToStackL( *this, iContainer );
iContainer->SetFocus( ETrue );
iController.StartViewFinderL();
}
}
/*
-----------------------------------------------------------------------------
void CCameraAppView::DoDeactivate()
Description: called by framework when view is deactivated
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppView::DoDeactivate()
{
if ( iContainer )
{
iContainer->SetFocus(EFalse);
AppUi()->RemoveFromViewStack( *this, iContainer );
delete iContainer;
iContainer = NULL;
}
}
/*
-----------------------------------------------------------------------------
void CCameraAppView::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 CCameraAppView::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 );
if( !iController.IsAutoFocusSupported() )
aMenuPane->SetItemDimmed( ECameraAppCmdFocusRange, ETrue );
}
}
/*
-----------------------------------------------------------------------------
void CCameraAppView::HandleStatusPaneSizeChange()
Description: Called by framework when resource is changed.
Comments :
Return values: N/A
-----------------------------------------------------------------------------
*/
void CCameraAppView::HandleStatusPaneSizeChange()
{
CAknView::HandleStatusPaneSizeChange(); //call to upper class
if (iContainer)
iContainer->SetRect(ClientRect());
}
// End of file
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -