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

📄 smsmaincontainer.cpp

📁 symbian 2rd 备忘录
💻 CPP
字号:

#include <gulicon.h>
#include <aknutils.h>    // definition of AKN_LAF_COLOR()
#include <avkon.hrh>
#include <akntitle.h>
#include <aknnotewrappers.h>
#include <stringloader.h> // StringLoader
#include <eikclbd.h>

#include "SMSMainContainer.h"
#include "AssistantAppUi.h"
#include "Assistant.rsg"
#include "Assistant.mbg"
#include "SMSMainView.h"
#include "Assistant.hrh"


const TInt  BoxSize_Least = 0;
const TInt	BoxSize_Max = 4 ;

//////////////////////////////////////////////////////////////////////////
CSMSMainContainer::CSMSMainContainer()
{

	n_Status = 0;
	m_pSMSMainView = NULL;

}	

// EPOC default constructor can leave.
void CSMSMainContainer::ConstructL(const TRect& aRect,CSMSMainView* aView)
{
    CreateWindowL();
	m_pSMSMainView = aView;

	CAssistantAppUi* pApp = (CAssistantAppUi*)CEikonEnv::Static()->AppUi();
	m_Array.Append(pApp->LoadGraphicsL1(17));
	m_Array.Append(pApp->LoadGraphicsL1(10));
	m_Array.Append(pApp->LoadGraphicsL1(11));
	m_Array.Append(pApp->LoadGraphicsL1(12));
	m_Array.Append(pApp->LoadGraphicsL1(13));
	m_Array.Append(pApp->LoadGraphicsL1(14));
	SetRect( aRect );
    ActivateL();

}

// destructor
CSMSMainContainer::~CSMSMainContainer()
{

	m_Array.ResetAndDestroy();
}

void CSMSMainContainer::SizeChanged()
{

}

// ---------------------------------------------------------
// CSMSMainContainer::CountComponentControls() const
// return the number of controls
// ---------------------------------------------------------
//
TInt CSMSMainContainer::CountComponentControls() const
{
	// return number of controls inside this container
	return 0; 
}

// ---------------------------------------------------------
// CSMSMainContainer::ComponentControl(TInt aIndex) const
// return the pointer to specified control.
// ---------------------------------------------------------
//
CCoeControl* CSMSMainContainer::ComponentControl( TInt /*aIndex*/ ) const
{
	return NULL;
}

// ---------------------------------------------------------
// CSMSMainContainer::Draw(const TRect& aRect) const
// handle the SMS when client region must be redrawn.
// ---------------------------------------------------------
//
void CSMSMainContainer::Draw( const TRect& /*aRect*/ ) const
{
	CWindowGc& gc = SystemGc();
 //	gc.DrawRect(Rect());  注掉表示去掉最外面的边框
	gc.Clear();
	gc.SetBrushStyle(CGraphicsContext::ESolidBrush);  
 	gc.SetBrushColor(KRgbWhite);

	gc.DrawLine(TPoint(43,0),TPoint(43,142));  //画线
	gc.DrawLine(TPoint(43,142),TPoint(174,142));


	TRect aTect;

	//背景图
	aTect.SetRect(1,5+28*n_Status,174,28+28*n_Status);
	gc.DrawBitmap(aTect, m_Array[0]);

	//写信息图
	aTect.SetRect(6,5,36,29);
	gc.DrawBitmap(aTect, m_Array[1]);

	//发件箱
 	aTect.SetRect(6,33,36,57);
 	gc.DrawBitmap(aTect, m_Array[2]);

	//收件箱
	//aTect.SetRect(6,33,36,57);
	aTect.SetRect(6,61,36,85);
	gc.DrawBitmap(aTect, m_Array[3]);

	//已发信息
//	aTect.SetRect(6,61,36,85);
	aTect.SetRect(6,89,36,113);
	gc.DrawBitmap(aTect, m_Array[4]);

	//草稿箱
//	aTect.SetRect(6,89,36,113);
	aTect.SetRect(6,117,36,141);
	gc.DrawBitmap(aTect, m_Array[5]);

	//添加文字
	const CFont* iFontTemp = iEikonEnv->LegendFont();
	gc.UseFont(iFontTemp);
	TBuf<32> sBuf;
	CEikonEnv::Static()->ReadResource(sBuf, R_QTN_ASSISTANT_WRITEMESSAGE);
	gc.DrawText(sBuf, TPoint(50,21));
	CEikonEnv::Static()->ReadResource(sBuf, R_QTN_ASSISTANT_OUTBOX);
	gc.DrawText(sBuf, TPoint(50,49));
	CEikonEnv::Static()->ReadResource(sBuf, R_QTN_ASSISTANT_INBOX);
//	gc.DrawText(sBuf, TPoint(50,49));
	gc.DrawText(sBuf, TPoint(50,77));	
	CEikonEnv::Static()->ReadResource(sBuf, R_QTN_ASSISTANT_SENDBOX);
//	gc.DrawText(sBuf, TPoint(50,77));
	gc.DrawText(sBuf, TPoint(50,105));
	CEikonEnv::Static()->ReadResource(sBuf, R_QTN_ASSISTANT_DRAFT);
//	gc.DrawText(sBuf, TPoint(50,105));
	gc.DrawText(sBuf, TPoint(50,133));
}

// ---------------------------------------------------------
// CAknExGridContainer::OfferKeyEventL(
//           const TKeyEvent& aKeyEvent, TEventCode aType )
// Handles the key events.
// ---------------------------------------------------------
//
TKeyResponse CSMSMainContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType )
{

	if( (aKeyEvent.iCode == EKeyUpArrow) && (aType == EEventKey))
	{
		if(n_Status == BoxSize_Least)
		{
			n_Status = BoxSize_Max;
		}
		else
		{
			n_Status--;
		}
		DrawDeferred();
	}
	
	else if( (aKeyEvent.iCode == EKeyDownArrow) && (aType == EEventKey))
	{
		if(n_Status == BoxSize_Max)
		{
			n_Status = BoxSize_Least;
		}
		else
		{
			n_Status++;
		}
		DrawDeferred();
	}
	
	else if(aKeyEvent.iCode == 0XF845)
	{
		m_pSMSMainView->HandleCommandL(EAssistantOpen);
		return EKeyWasConsumed;
	}

	return EKeyWasConsumed;

}
TInt CSMSMainContainer::GetIndex()
{
	return n_Status;
}


⌨️ 快捷键说明

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