⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 splash_screen.cpp

📁 symbian快捷方式添加的实例.3版的例子,添加快捷方式.
💻 CPP
字号:


#include "Splash_Screen.h"
#include <EIKENV.H>
#include <EIKAPPUI.H>
#include <aknutils.h>
#include <eikapp.h>
#include <AknGlobalNote.h>

#include "Example_E1122138.h"


// CMySplashScreen
//
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
CMySplashScreen::~CMySplashScreen()
{
	delete iBgPic;
	iBgPic = NULL;
	delete iBgMsk;
	iBgMsk = NULL;
	delete iBgContext;
	iBgContext = NULL;
}   
/* 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
CMySplashScreen* CMySplashScreen::NewL(const TRect& aRect)
    {
    CMySplashScreen* self = new(ELeave)CMySplashScreen();
    CleanupStack::PushL(self);
    self->ConstructL(aRect);
    CleanupStack::Pop(self);
    return self;
    }
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/

void CMySplashScreen::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
	// make first with no size at all
	
	if(aRect.Height() == CEikonEnv::Static()->EikAppUi()->ClientRect().Height())
		iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,TRect(0,0,1,1), ETrue);
	else
		iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen,TRect(0,0,1,1), ETrue);

	// Setting rect will cause SizeChanged to be called
	// and iBgContext size & position is updated accordingly.
	SetRect(aRect);
	
	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  	
    AknsUtils::CreateAppIconLC(skin,KUidExampleApp,  EAknsAppIconTypeContext,iBgPic,iBgMsk);

	TSize IconSiz((Rect().Width() /2),(Rect().Height() /2));

	AknIconUtils::SetSize(iBgPic,IconSiz);  
	AknIconUtils::SetSize(iBgMsk,IconSiz);  

	CleanupStack::Pop(2);

	
	ActivateL();	
	DrawNow();
}

/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CMySplashScreen::SizeChanged()
{
	if ( iBgContext )
	{
		iBgContext->SetRect(Rect());

		if ( &Window() )
		{
			iBgContext->SetParentPos( PositionRelativeToScreen() );
		}
	}
}

/*
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
*/
TTypeUid::Ptr CMySplashScreen::MopSupplyObject(TTypeUid aId)
{	
	if (iBgContext)
	{
		return MAknsControlContext::SupplyMopObject(aId, iBgContext );
	}
	
	return CCoeControl::MopSupplyObject(aId);
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CMySplashScreen::Draw(const TRect& /*aRect*/) const
{
	CWindowGc& gc = SystemGc();
    
  	// draw background skin first.
  	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
	AknsDrawUtils::Background( skin, iBgContext, this, gc, Rect() );
    
    if(iBgPic && iBgMsk)
	{
		if(iBgPic->Handle() && iBgMsk->Handle())
		{
			TSize ImgSiz(iBgPic->SizeInPixels());
			TSize RectSiz();
			
			TInt Xpoint = ((Rect().Width() - ImgSiz.iWidth) / 2);
			TInt Ypoint = ((Rect().Height()- ImgSiz.iHeight)/ 2);
		
			TRect DestRect(Xpoint,Ypoint,(Xpoint + ImgSiz.iWidth),(Ypoint + ImgSiz.iHeight));
			TRect SrcRect(0,0,ImgSiz.iWidth,ImgSiz.iHeight);
			
			gc.DrawBitmapMasked(DestRect,iBgPic,SrcRect,iBgMsk, EFalse);
		}	
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -