Namespaces
Variants
Actions
Revision as of 06:54, 5 December 2012 by hamishwillee (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Splash screen with image using Symbian C++

Jump to: navigation, search

This code snippet shows very simple Symbian C++ implementation of an splash screen which displays an image.

Article Metadata

Article
Created: symbianyucca (20 Mar 2007)
Last edited: hamishwillee (05 Dec 2012)

Contents

Introduction

CSimpleSplashScreen.cpp defines a simple splash screen which displays an image file in multi bitmap format (the first image in splash.mbm). For real implementations replace the <My SID> with your applications secure identifier and store the image in your private folder.

To use CSimpleSplashScreen, just construct it in your application user interface class and start a timer, and when the timer expires, just destroy the splash screen and start your application normal start screen.

Library Needed:

LIBRARY  fbscli.lib

SimpleSplashScreen.cpp

#include <EIKENV.H>
#include <EIKAPPUI.H>
#include <aknutils.h>
#include <eikapp.h>
#include "SimpleSplashScreen.h"
 
_LIT(KtxMySplashImage,"\\private\\<My SID>\\splash.mbm" );
 
CSimpleSplashScreen::~CSimpleSplashScreen()
{
delete iBgPic;
}
 
CSimpleSplashScreen* CSimpleSplashScreen::NewL(void)
{
CSimpleSplashScreen* self = new(ELeave)CSimpleSplashScreen();
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
 
void CSimpleSplashScreen::ConstructL(void)
{
CreateWindowL();
SetRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
 
TFindFile AppFile(CCoeEnv::Static()->FsSession());
 
if(KErrNone == AppFile.FindByDir(KtxMySplashImage, KNullDesC))
{
iBgPic = new (ELeave) CFbsBitmap();
User::LeaveIfError(iBgPic->Load(AppFile.File(),0));
}
 
ActivateL();
DrawNow();
}
 
void CSimpleSplashScreen::Draw(const TRect& /*aRect*/) const
{
CWindowGc& gc = SystemGc();
 
gc.SetBrushColor(KRgbWhite);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.Clear(Rect());
 
if(iBgPic)
{
if(iBgPic->Handle())
{
gc.DrawBitmap(Rect(),iBgPic);
}
}
}

SimpleSplashScreen.h

#include <coecntrl.h>       // CCoeControl
#include <fbs.h> //CFbsBitmap
 
class CFbsBitmap;
 
//-------------------------------------------------------------------
//
//-------------------------------------------------------------------
class CSimpleSplashScreen : public CCoeControl
{
public:
static CSimpleSplashScreen* NewL(void);
~CSimpleSplashScreen();
private:
void ConstructL(void);
void Draw(const TRect& aRect) const;
private:
CFbsBitmap* iBgPic;
};

Link

How to display splash screen in a non GUI thread


185 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved