📄 point24containerview.cpp
字号:
/*
========================================================================
Name : Point24ContainerView.cpp
Author : luomao2000
Copyright : luomao2000@tom.com
Reserved
Description :
========================================================================
*/
#include <aknviewappui.h>
#include <eikmenub.h>
#include <avkon.hrh>
#include <barsread.h>
#include <stringloader.h>
#include <gdi.h>
#include <eikedwin.h>
#include <eikenv.h>
#include <eiklabel.h>
#include <akncontext.h>
#include <akntitle.h>
#include <eikbtgpc.h>
#include <Point24.rsg>
#include <aknstaticnotedialog.h>
#include "Point24.hrh"
#include "Point24ContainerView.h"
#include "Point24Container.hrh"
#include "Point24Container.h"
/**
* First phase of Symbian two-phase construction. Should not contain any
* code that could leave.
*/
CPoint24ContainerView::CPoint24ContainerView()
{
iPoint24Container = NULL;
}
/**
* The view's destructor removes the container from the control
* stack and destroys it.
*/
CPoint24ContainerView::~CPoint24ContainerView()
{
delete iPoint24Container;
iPoint24Container = NULL;
}
/**
* Symbian two-phase constructor.
* This creates an instance then calls the second-phase constructor
* without leaving the instance on the cleanup stack.
* @return new instance of CPoint24ContainerView
*/
CPoint24ContainerView* CPoint24ContainerView::NewL()
{
CPoint24ContainerView* self = CPoint24ContainerView::NewLC();
CleanupStack::Pop( self );
return self;
}
/**
* Symbian two-phase constructor.
* This creates an instance, pushes it on the cleanup stack,
* then calls the second-phase constructor.
* @return new instance of CPoint24ContainerView
*/
CPoint24ContainerView* CPoint24ContainerView::NewLC()
{
CPoint24ContainerView* self = new ( ELeave ) CPoint24ContainerView();
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
/**
* Second-phase constructor for view.
* Initialize contents from resource.
*/
void CPoint24ContainerView::ConstructL()
{
BaseConstructL( R_POINT24_CONTAINER_POINT24_CONTAINER_VIEW );
}
/**
* @return The UID for this view
*/
TUid CPoint24ContainerView::Id() const
{
return TUid::Uid( EPoint24ContainerViewId );
}
/**
* Handle a command for this view (override)
* @param aCommand command id to be handled
*/
void CPoint24ContainerView::HandleCommandL( TInt aCommand )
{
TBool commandHandled = EFalse;
switch ( aCommand )
{
// code to dispatch to the AknView's menu and CBA commands is generated here
case EPoint24ContainerViewAboutMenuItemCommand:
{
ShowMessageL();
commandHandled = ETrue;
break;
}
default:
break;
}
if ( !commandHandled )
{
if ( aCommand == EAknSoftkeyExit )
{
AppUi()->HandleCommandL( EEikCmdExit );
}
}
}
/**
* Handles user actions during activation of the view,
* such as initializing the content.
*/
void CPoint24ContainerView::DoActivateL(
const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/ )
{
SetupStatusPaneL();
if ( !iPoint24Container )
{
iPoint24Container = CPoint24Container::NewL( ClientRect(), NULL, this );
iPoint24Container->SetMopParent( this );
AppUi()->AddToStackL( *this, iPoint24Container );
}
}
/**
*/
void CPoint24ContainerView::DoDeactivate()
{
CleanupStatusPane();
if ( iPoint24Container )
{
AppUi()->RemoveFromViewStack( *this, iPoint24Container );
delete iPoint24Container;
iPoint24Container = NULL;
}
}
void CPoint24ContainerView::SetupStatusPaneL()
{
// reset the context pane
TUid contextPaneUid = TUid::Uid( EEikStatusPaneUidContext );
CEikStatusPaneBase::TPaneCapabilities subPaneContext =
StatusPane()->PaneCapabilities( contextPaneUid );
if ( subPaneContext.IsPresent() && subPaneContext.IsAppOwned() )
{
CAknContextPane* context = static_cast< CAknContextPane* > (
StatusPane()->ControlL( contextPaneUid ) );
context->SetPictureToDefaultL();
}
// setup the title pane
TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle );
CEikStatusPaneBase::TPaneCapabilities subPaneTitle =
StatusPane()->PaneCapabilities( titlePaneUid );
if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() )
{
CAknTitlePane* title = static_cast< CAknTitlePane* >(
StatusPane()->ControlL( titlePaneUid ) );
TResourceReader reader;
iEikonEnv->CreateResourceReaderLC( reader, R_POINT24_CONTAINER_TITLE_RESOURCE );
title->SetFromResourceL( reader );
CleanupStack::PopAndDestroy(); // reader internal state
}
}
void CPoint24ContainerView::CleanupStatusPane()
{
}
/**
* Handle status pane size change for this view (override)
*/
void CPoint24ContainerView::HandleStatusPaneSizeChange()
{
CAknView::HandleStatusPaneSizeChange();
// this may fail, but we're not able to propagate exceptions here
TInt result;
TRAP( result, SetupStatusPaneL() );
}
void CPoint24ContainerView::ShowMessageL()
{
CAknStaticNoteDialog* note = new( ELeave )CAknStaticNoteDialog();
CleanupStack::PushL( note );
note->PrepareLC( R_POINT24_CONTAINER_MESSAGE_NOTE );
_LIT( KMessage, "Written by Luomao2000@tom.com" );
note->SetTextL( KMessage );
note->SetTone( CAknNoteDialog::EConfirmationTone );
note->RunLD();
CleanupStack::Pop( note );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -