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

📄 splashcontainer.cpp

📁 设置屏幕特效的symbian series60平台程序
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CSplashContainer from SplashContainer.h
*  Part of  : Splash
*  Created  : 17/02/2003 by Eric@NewLC
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: 
* ============================================================================
*/

// INCLUDE FILES
#include "SplashContainer.h"

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CSplashContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSplashContainer::ConstructL(const TRect& /*aRect*/)
{
    // 
    // Initialise mode to Splash.
    // The iTick value is set to three seconds by default. This is enough for a
    // fixed screen but will not allow animation unless you redefine the tick value
    // using SetTimerTick()
    iState=CSplashContainer::ESplash;
    iTick = 3000000;

    // Create a periodic timer but don't start it yet
	iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityStandard);
}

// Destructor
CSplashContainer::~CSplashContainer()
{
    StopTimer();
	delete iPeriodicTimer;
	iPeriodicTimer = NULL;
}

// ---------------------------------------------------------
// CSplashContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
EXPORT_C  void CSplashContainer::SizeChanged()
    {
    }

// ---------------------------------------------------------
// CSplashContainer::CountComponentControls() const
// ---------------------------------------------------------
//
EXPORT_C TInt CSplashContainer::CountComponentControls() const
    {
    return 0; // return nbr of controls inside this container
    }

// ---------------------------------------------------------
// CSplashContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
EXPORT_C CCoeControl* CSplashContainer::ComponentControl(TInt /*aIndex*/) const
    {
            return NULL;
    }

// ---------------------------------------------------------
// CSplashContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
EXPORT_C void CSplashContainer::Draw(const TRect& aRect) const
{
    //
    // Call the appropriate Draw function depending of the current mode
    // (Each Draw function is a non-pure virtual function). If it is not
    // defined by the child class, there won't be any error but nothing 
    // will be drawn.
    //
    switch(iState)
    {
    case CSplashContainer::ESplash:
        DrawSplash(aRect);
        break;
    case CSplashContainer::EMain:
        DrawMain(aRect);
        break;
    case CSplashContainer::EExiting:
        DrawExiting(aRect);
        break;
    }
}



void CSplashContainer::DrawSplash(const TRect& /*aRect*/) const
{
}

void CSplashContainer::DrawMain(const TRect& /*aRect*/) const
{
}

void CSplashContainer::DrawExiting(const TRect& /*aRect*/) const
{
}


// ---------------------------------------------------------
// CSplashContainer::SetState(CSplashContainer::TState aState) 
// Change the mode of the container (possible values are
// ESplash, EMain, EExiting)
// ---------------------------------------------------------
//
EXPORT_C void CSplashContainer::SetState(CSplashContainer::TState aState)
{
	iState=aState;
}

// ---------------------------------------------------------
// CSplashContainer::State() 
// Get the current mode. 
// ---------------------------------------------------------
//
EXPORT_C CSplashContainer::TState CSplashContainer::State()
{
	return iState;
}

// ---------------------------------------------------------
// CSplashContainer::SetTimerTick(TTimeIntervalMicroSeconds32  aTick) 
// Set the Tick value (duration between two screen redraw)
// ---------------------------------------------------------
//
EXPORT_C void CSplashContainer::SetTimerTick(TTimeIntervalMicroSeconds32  aTick)
{
	iTick=aTick;
}


// ---------------------------------------------------------
// CSplashContainer::DoPeriod() 
// Function that is called periodically by the timer.
// Call the child Tick() treatment and request a screen 
// redraw if needed.
// ---------------------------------------------------------
//
void CSplashContainer::DoPeriod()
{
    if (Tick())
	{
		// Update the screen
	    CWindowGc& gc = SystemGc();
	    gc.Activate(*DrawableWindow());
	    Draw(Rect());
	    gc.Deactivate();
	}
}

// This function is called by the periodic timer
TInt CSplashContainer::Period(TAny * aPtr)
{
    ((CSplashContainer*)aPtr)->DoPeriod();
    //returning a value of TRUE indicates the callback should be done again
	return TRUE;
}

// Default treatment for a Tick: do nothing!
// (this is a virtual function that should be defined in child class)
TBool CSplashContainer::Tick()
{
	return EFalse;
}


// ---------------------------------------------------------
// CSplashContainer::StartTimer() 
// Start the timer (required for animated SplashScreen)
// Optional but useful for static ones.
// ---------------------------------------------------------
//
EXPORT_C void CSplashContainer::StartTimer()
{
	//If the timer is not already running, start it
	if (!iPeriodicTimer->IsActive())
	{
		iPeriodicTimer->Start(iTick,iTick,TCallBack(CSplashContainer::Period,this));
	}
}

// ---------------------------------------------------------
// CSplashContainer::StopTimer() 
// 
// ---------------------------------------------------------
//
EXPORT_C void CSplashContainer::StopTimer()
{
	//Stop the timer if it is active
	if (iPeriodicTimer->IsActive())
	{
		iPeriodicTimer->Cancel();
	}
}

EXPORT_C TInt E32Dll(TDllReason)
{
    return 0;
}


// End of File  

⌨️ 快捷键说明

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