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

📄 myedwin.cpp

📁 symbian下开发聊天
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CMyEdwin from MyEdwin.h
*  Part of  : Mdnvbaox
*  Created  : 17.09.2007 by chenziteng@163.com
*  Implementation notes:
*     
*  Version  :
*  Copyright: 
* ============================================================================
*/

// INCLUDE FILES
#include <eikenv.h>
#include <Utfjjwvx.mbg>
#include "MyEdwin.h"


// =================== CUSTOM DRAW =========================
class CMyCustomDraw : public CLafEdwinCustomDrawBase
    {
public:
	static CMyCustomDraw* NewL(const MLafEnv& aEnv,const CCoeControl& aControl);
    ~CMyCustomDraw();

public: // from MFormCustomDraw
	void DrawBackground(const TParam& aParam,const TRgb& aBackground,TRect& aDrawn) const;
	TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;

public:
	void LineSpacingChanged();

private:
	CMyCustomDraw(const MLafEnv& aEnv,const CCoeControl& aControl);
    void ConstructL();

private:
    CFbsBitmap* iBitmap;
	};

CMyCustomDraw* CMyCustomDraw::NewL(const MLafEnv& aEnv,const CCoeControl& aControl)
    {
    CMyCustomDraw* self = new(ELeave) CMyCustomDraw(aEnv, aControl);
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop(self);
    return self;
    }

CMyCustomDraw::~CMyCustomDraw()
    {
    delete iBitmap;
    }

void CMyCustomDraw::DrawBackground(const TParam& aParam,const TRgb& aBackground,TRect& aDrawn) const
    {
    CLafEdwinCustomDrawBase::DrawBackground(aParam, aBackground, aDrawn);
    if((iBitmap!=NULL)&&(iBitmap->Handle()!=0))
        {
        TRect rect = TRect(TPoint(0,0), iBitmap->SizeInPixels());
        aParam.iGc.SetClippingRect(aParam.iDrawRect);
        aParam.iGc.DrawBitmap(rect, iBitmap);
        }
    }

TRgb CMyCustomDraw::SystemColor(TUint aColorIndex,TRgb aDefaultColor) const
    {
    return CLafEdwinCustomDrawBase::SystemColor(aColorIndex, aDefaultColor);
    }

void CMyCustomDraw::LineSpacingChanged()
    {
    CLafEdwinCustomDrawBase::LineSpacingChanged();
    }

CMyCustomDraw::CMyCustomDraw(const MLafEnv& aEnv,const CCoeControl& aControl)
 : CLafEdwinCustomDrawBase(aEnv, aControl)
    {
    }

void CMyCustomDraw::ConstructL()
    {
#ifdef _DEBUG
    _LIT(KMbmFile, "z:\\system\\apps\\Mdnvbaox\\Mdnvbaox.mbm");
#else
    _LIT(KMbmFile, "c:\\system\\apps\\Mdnvbaox\\Mdnvbaox.mbm");
#endif
    iBitmap = new(ELeave) CFbsBitmap;
    TInt err = iBitmap->Load(KMbmFile, EMbmUtfjjwvxFlag);
    User::LeaveIfError(err);
    }

// ================= MEMBER FUNCTIONS =======================
CLafEdwinCustomDrawBase* CMyEdwin::CreateCustomDrawL()
    {
    return CMyCustomDraw::NewL(iEikonEnv->LafEnv(), *this);
    }

⌨️ 快捷键说明

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