×
Namespaces

Variants
Actions

Splash screen with image using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search

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

Article Metadata
CompatibilityArticle
Created: symbianyucca (20 Mar 2007)
Last edited: hamishwillee (30 May 2013)

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

Version Hint

Windows Phone: [[Category:Windows Phone]]
[[Category:Windows Phone 7.5]]
[[Category:Windows Phone 8]]

Nokia Asha: [[Category:Nokia Asha]]
[[Category:Nokia Asha Platform 1.0]]

Series 40: [[Category:Series 40]]
[[Category:Series 40 1st Edition]] [[Category:Series 40 2nd Edition]]
[[Category:Series 40 3rd Edition (initial release)]] [[Category:Series 40 3rd Edition FP1]] [[Category:Series 40 3rd Edition FP2]]
[[Category:Series 40 5th Edition (initial release)]] [[Category:Series 40 5th Edition FP1]]
[[Category:Series 40 6th Edition (initial release)]] [[Category:Series 40 6th Edition FP1]] [[Category:Series 40 Developer Platform 1.0]] [[Category:Series 40 Developer Platform 1.1]] [[Category:Series 40 Developer Platform 2.0]]

Symbian: [[Category:Symbian]]
[[Category:S60 1st Edition]] [[Category:S60 2nd Edition (initial release)]] [[Category:S60 2nd Edition FP1]] [[Category:S60 2nd Edition FP2]] [[Category:S60 2nd Edition FP3]]
[[Category:S60 3rd Edition (initial release)]] [[Category:S60 3rd Edition FP1]] [[Category:S60 3rd Edition FP2]]
[[Category:S60 5th Edition]]
[[Category:Symbian^3]] [[Category:Symbian Anna]] [[Category:Nokia Belle]]

This page was last modified on 30 May 2013, at 07:35.
86 page views in the last 30 days.
×