simpleex_view.cpp

来自「symbian下的几个小例子。。很值得学习」· C++ 代码 · 共 58 行

CPP
58
字号
// simpleEx_view.cpp
//
// Copyright (c) Symbian Software Ltd 1999 - 2007.  All rights reserved.
//

/*=================================================================
      This file contains the application view class for SimpleEx.
==================================================================*/

#include "eikenv.h"
#include <coemain.h>

#include "SimpleEx.h"

CSimpleExAppView* CSimpleExAppView::NewL(const TRect& aRect)
	{
    CSimpleExAppView* self = CSimpleExAppView::NewLC(aRect);
    CleanupStack::Pop(self);
    return self;
	}

CSimpleExAppView* CSimpleExAppView::NewLC(const TRect& aRect)
	{
    CSimpleExAppView* self = new (ELeave) CSimpleExAppView;
    CleanupStack::PushL(self);
    self->ConstructL(aRect);
    return self;
	}

void CSimpleExAppView::ConstructL(const TRect& aRect)
	{
    CreateWindowL();
    SetRect(aRect);
    ActivateL();
	}

void CSimpleExAppView::UpdateScreenText(const TDesC16& msg)
	{
   iScreenText.Copy(msg);
   DrawNow();
	}
 
void CSimpleExAppView::Draw(const TRect& ) const
	{
    CWindowGc& gc = SystemGc();   
	gc.Clear();

	const CFont* font = iEikonEnv->TitleFont();
	gc.UseFont(font);
	
	TRect drawRect = Rect();
	TInt baselineOffset=(drawRect.Height() - font->HeightInPixels())/2; 
	gc.DrawText(iScreenText,drawRect,baselineOffset,CGraphicsContext::ECenter, 0);
	gc.DiscardFont();
	}


⌨️ 快捷键说明

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