📄 worldview.cpp
字号:
/* Copyright (c) 2007, Nokia. All rights reserved */
#include "LDK008appui.h"
#include "WorldView.h"
#include "WorldContainer.h"
//#include "Projectname.hrh"
#include "LDK008.rsg"
#include "LDK008.hrh"
#include <aknnotewrappers.h>
CWorldView* CWorldView::NewL()
{
CWorldView* self = NewLC();
CleanupStack::Pop(self);
return self;
}
CWorldView* CWorldView::NewLC()
{
CWorldView* self = new (ELeave) CWorldView();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
void CWorldView::ConstructL()
{
BaseConstructL(R_EDIT_VIEW);
}
CWorldView::CWorldView()
{
iContainer = NULL;
}
CWorldView::~CWorldView()
{
}
TUid CWorldView::Id() const
{
return TUid::Uid(2);
}
void CWorldView::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
case EEditMenuStat:
{
//获得edit内容
TBuf<32> sBuf;
iContainer->GetText(sBuf);
//内容的指针
TPtrC ptr = sBuf.Ptr();
TInt nEnCount = 0;
TInt nCharCount = 0;
TInt nChCount = 0;
TInt i = 0;
//根据字符个数循环
for(i=0; i<sBuf.Length(); i++)
{
if(ptr[i] >= 0x30 && ptr[i] <= 0x39)
{//数字
nEnCount++;
}
else if(ptr[i] >= 'a' && ptr[i] <= 'z')
{//小写字符
nCharCount++;
}
else if(ptr[i] >= 'A' && ptr[i] <= 'Z')
{//大写字符
nCharCount++;
}
else
{//其它字符
nCharCount++;
}
}
//设置显示的格式和内容
TBuf<128> sShow;
sShow.Copy(_L("English Count:"));
sShow.AppendNum(nCharCount);
sShow.Append(_L("\n"));
sShow.Copy(_L("Digit Count:"));
sShow.AppendNum(nEnCount);
sShow.Append(_L("\n"));
sShow.Copy(_L("Other Count:"));
sShow.AppendNum(nCharCount);
sShow.Append(_L("\n"));
//显示内容
CAknInformationNote* informationNote = new ( ELeave ) CAknInformationNote;
informationNote->ExecuteLD( sShow );
}
break;
case EEditMenuBack:
{
AppUi()->ActivateLocalViewL(TUid::Uid(3));
}
break;
default:
AppUi()->HandleCommandL(aCommand);
break;
}
}
void CWorldView::HandleClientRectChange()
{
}
void CWorldView::DoActivateL(const TVwsViewId&, TUid, const TDesC8&)
{
iContainer = new( ELeave ) CWorldContainer();
iContainer->SetMopParent(this);
iContainer->ConstructL( ClientRect() );
AppUi()->AddToStackL( *this, iContainer );
}
void CWorldView::DoDeactivate()
{
if(iContainer)
{
AppUi()->RemoveFromStack( iContainer );
delete iContainer;
iContainer = NULL;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -