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

📄 splashview.cpp

📁 该源码实现个人日程管理以及备忘功能
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CSplashView from CSplashView.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 <eikdef.h>
#include "SplashView.h"
//#include "SplashDocument.h"
//#include "SplashAppUi.h"
#include "CalendarAPIexample.hrh" 
#include <aknviewappui.h>
#include <MYAGENDA.mbg>
#include "CalendarAPIexampleSearchView.h"
#include "CalendarAPIexampleEntryView.h"
#include "CalendarAPIexampleEntriesView.h"
#include "CalendarAPIexampleGridView.h" 

// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CSplashView::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSplashView::ConstructL(const TRect& aRect,CAknViewAppUi& view)
{
	/*Recuperation de la vue de l'application principale*/
	AppView=&view;
	
	_LIT(KDrawBitmapPath, "myagenda.mbm");
	_LIT(MyAgendaPath2, "Z:\\system\\data\\MYAGENDA.mbm");
	TBuf16<150> AppBmp(KDrawBitmapPath);
	CompleteWithAppPath(AppBmp);
	iBitmap = new (ELeave) CFbsBitmap();
	//NOKIA :: User::LeaveIfError(iBitmap->Load(AppBmp, EMbmMyagendaMyagenda));
	User::LeaveIfError(iBitmap->Load(MyAgendaPath2, EMbmMyagendaMyagenda)); //EMUL EPOC
    //
    // Create and activate the main window
    //
    CreateWindowL();
    SetRect(aRect);
    ActivateL();

    //
    // Create the SplashScreen
    // Set the refresh rate of the screen to 1000 micro-seconds 
    //
    CSplashContainer::ConstructL(aRect);
    SetTimerTick(3000);

    //
    // Configure some internal counters that are used for displaying
    // the splash screen (app specific) - not par or the CSplashContainer
    // 
    // iPreCount is the duration (in Ticks, 1 ticks = 1000 micro-sec according to
    //           previous initialisation) of the "black screen" before the text
    //           starts to appear
    // iColorCount is the value that shall be used for each R,G and B component of
    //           displayed text color
    // iPostCount is the duration (in Ticks) of display of the splash screen after
    //           the animation
    iPreCount  =10;
    iColorCount=0;
    iPostCount =20;

    //
    // Activate the splashscreen animation
    //
	StartTimer();
}

// Destructor
CSplashView::~CSplashView()
{
}


TUid CSplashView::Id() const
{
	return KSplashViewId;
}

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

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

// ---------------------------------------------------------
// CSplashView::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CSplashView::ComponentControl(TInt /*aIndex*/) const
    {

            return NULL;

    }

// ---------------------------------------------------------
// CSplashView::DrawSplash(const TRect& aRect) const
// Equivalent of the CCoeControl Draw function while in Splash
// mode (i.e. until a call to SetState(<new mode>))
// ---------------------------------------------------------
//
void CSplashView::DrawSplash(const TRect& /*aRect*/) const
{
    CWindowGc& gc = SystemGc();
    TRect    rect = Rect();

    //
    // Draw Black background
    //
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.SetBrushStyle(CGraphicsContext::ENullBrush);
    gc.SetBrushColor(KRgbBlack);
    //gc.DrawRect(rect);
	gc.DrawBitmap(TRect(TPoint(0,0),iBitmap->SizeInPixels()), iBitmap);
   	gc.BitBlt(TPoint(3,0), iBitmap);
    //
    // Select default font for title
    // The color will change from black -> white with the increase of iColorCount
    //
    const CFont* font = iEikonEnv->TitleFont();
    gc.UseFont(font);
    gc.SetPenStyle(CGraphicsContext::ESolidPen);
    gc.SetPenColor(TRgb(255-iColorCount,255-iColorCount,255-iColorCount));

    //
    // Draw the text, horizontally centered and vertically slightly below center
    //
    TSize aSize(rect.Width(),font->HeightInPixels()+5);
    rect.SetRect(TPoint(0,(rect.Height()/2)-font->HeightInPixels()-5),aSize);
    gc.DrawText(_L(" Agenda"),rect,font->AscentInPixels(),CGraphicsContext::ELeft);

    rect.Move(0,font->HeightInPixels()+2);
    gc.DrawText(_L(" Pour"),rect,font->AscentInPixels(),CGraphicsContext::ELeft);
 
    rect.Move(0,font->HeightInPixels()+2);
    gc.DrawText(_L(" Symbian OS"),rect,font->AscentInPixels(),CGraphicsContext::ELeft);
    gc.DiscardFont(); 
}

// ---------------------------------------------------------
// CSplashView::DrawMain(const TRect& aRect) const
// Equivalent of the CCoeControl Draw function while in main
// mode (i.e. after splash). Normally during the lifetime
// of your app.
// ---------------------------------------------------------
//
void CSplashView::DrawMain(const TRect& aRect) const
{
	CWindowGc& gc = SystemGc();
    // TODO: Add your drawing code here
    // example code...
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.SetBrushColor(KRgbWhite);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.DrawRect(aRect);
}

// ---------------------------------------------------------
// CSplashView::DrawExiting(const TRect& aRect) const
// Equivalent of the CCoeControl Draw function before exiting
// the App (not used in this app)
// ---------------------------------------------------------
//
void CSplashView::DrawExiting(const TRect& /*aRect*/) const
{
}

// ---------------------------------------------------------
// CSplashView::Tick()
// This function is called periodically each <tick> microsecond.
// The tick value has been initialised in the CSplashView::ConstructL
// function.
// If the function return ETrue, then a screen redraw will be 
// requested by the base class.
// ---------------------------------------------------------
//
TBool CSplashView::Tick()
{
    //
    // Start by precount
    // (during precount iColorCount is zero, so splash text will be displayed
    // in black and then not visible)
    if(iPreCount>0)
    {
        iPreCount--;
    }
    //
    // After PreCount, fade the text to white with a 15 increment.
    //
    else if(iColorCount<255) 
    {
        iColorCount+=15; //USE 1 WITH NOKIA 6600 BUT 15 WITH EMULATOR YC
    }
    //
    // When the text is white, wait for iPostCount Tick before switching
    // to main state
    //
    else if(iPostCount>0)
    {
        iPostCount--;
    }
    else
    {
    	
	    SetState(CSplashContainer::EMain);
	    StopTimer();
	    ((CCalendarAPIexampleAppUi*)AppView)->ConstructAllL();
	    //state=ETrue;
    }
	return ETrue;
}


// ---------------------------------------------------------
// CSplashView::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CSplashView::HandleControlEventL(CCoeControl* aControl, MCoeControlObserver::TCoeEvent aEventType)
    {
    // TODO: Add your control event handler code here
    }

// End of File  

⌨️ 快捷键说明

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