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

📄 appview.cpp

📁 在symbian下用Visual C++开发的网络络天室的程序
💻 CPP
字号:
// appview.cpp
//
// Copyright (c) 2000 Symbian Ltd.  All rights reserved.
//

#include "appview.h"

#include <eikenv.h>
#include <eiklabel.h>
#include <rgcpchat.rsg>

// app view

void CGameAppView::ConstructL(CGameEngine* aEngine, const TRect& aRect)
	{
	iEngine=aEngine;
	CreateWindowL();
//	SetRectL(aRect);
	SetRect(aRect);
	// set up last-message views
	TRect rectTop=Rect();
	rectTop.iBr.iY=Rect().iBr.iY/2;
	TRect rectBottom=Rect();
	rectBottom.iTl.iY=rectTop.iBr.iY;
	iLastSentLabel=new(ELeave) CEikLabel;
	iLastSentLabel->SetContainerWindowL(*this);
//	iLastSentLabel->SetRectL(rectTop);
	iLastSentLabel->SetRect(rectTop);
	iLastSentLabel->SetTextL(iEngine->LastSent());
	iLastReceivedLabel=new(ELeave) CEikLabel;
	iLastReceivedLabel->SetContainerWindowL(*this);
//	iLastReceivedLabel->SetRectL(rectBottom);
	iLastReceivedLabel->SetRect(rectBottom);
	iLastReceivedLabel->SetTextL(iEngine->LastReceived());
	// activate
	ActivateL(); // ready for drawing etc
	}

CGameAppView::~CGameAppView()
	{
	delete iLastSentLabel;
	delete iLastReceivedLabel;
	}

void CGameAppView::SetEngineL(CGameEngine* aEngine)
	{
	iEngine=aEngine;
	iLastSentLabel->SetTextL(iEngine->LastSent());
	iLastReceivedLabel->SetTextL(iEngine->LastReceived());
	DrawNow();
	}

void CGameAppView::Draw(const TRect& aRect) const
	{
	CWindowGc& gc=SystemGc();
	gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	gc.SetPenStyle(CGraphicsContext::ENullPen);
	gc.SetBrushColor(KRgbWhite);
	gc.DrawRect(aRect);
	}

TKeyResponse CGameAppView::OfferKeyEventL(const TKeyEvent& /* aKeyEvent */,TEventCode /* aType */)
	{
	// don't handle keys when this view is hidden
	if (!IsVisible())
		return EKeyWasNotConsumed;
	// do nothing, for now
	return EKeyWasNotConsumed;
	}

TInt CGameAppView::CountComponentControls() const
	{
	return 2;
	}

CCoeControl* CGameAppView::ComponentControl(TInt aIndex) const
	{
	switch (aIndex)
		{
	case 0: return iLastSentLabel;
	case 1: return iLastReceivedLabel;
		}
	return 0;
	}

⌨️ 快捷键说明

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