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

📄 chttpcontainer.cpp

📁 Symbian手机上一个简单的http server 服务器代码
💻 CPP
字号:
/**
 * HttpContainer implementation
 *
 * This file is part of HttpServer.
 *
 * HttpServer is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * HttpServer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with HttpServer; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "HttpServer.h"

_LIT(KInitTextFormat, "HttpServer (C) SWelcom 2004");
_LIT(KCursor, "_");

CHttpContainer::CHttpContainer(CHttpView *view)
{
	TBuf <50> buf;
	
	lines = 0;
	
	buf.Format(KInitTextFormat);
	line[lines++].Copy(buf);
}

void CHttpContainer::ConstructL(const TRect &rc)
{
	// text = iEikonEnv->AllocReadResourceL(R_HTTPSERVER_TEXT_HELLO);
	
	CreateWindowL();
	SetRect(rc);
	
	CWindowGc &gc = SystemGc();
	CBitmapDevice *device = (CBitmapDevice *) gc.Device();
	
	ActivateL();
}

CHttpContainer::~CHttpContainer()
{
}

void CHttpContainer::Draw(const TRect &rc) const
{
	CWindowGc &gc = SystemGc();	// System Graphics Context
	TRect dr = Rect();		// Our drawing area
	const CFont *font;		// Font
	//TInt baselineOffset;
	TInt i;
	
	// Clear the drawing area.
	gc.Clear();
	
	// Shrink the drawing area to leave a margin.
	// dr.Shrink(10, 10);
	
	// Draw a bounding rectangle.
	// gc.DrawRect(dr);
	
	// Create the font as a default title font.
	font = iEikonEnv->DenseFont();
	gc.UseFont(font);
	
	// Draw some text in the middle.
	//baselineOffset = (dr.Height() - font->HeightInPixels()) / 2;
	for (i = 0; i < lines; i++)
	{
		gc.DrawText(line[i], dr, (i+1)*font->HeightInPixels(), CGraphicsContext::ELeft, 0);
	}
	gc.DrawText(KCursor, dr, (i+1)*font->HeightInPixels(), CGraphicsContext::ELeft, 0);
	
	// Clean up.
	gc.DiscardFont();
}

void CHttpContainer::PrintL(const TDesC &str)
{
	TInt i;
	const TDesC &next = str;
	
	if (lines >= 10)
	{
		for (i = 0; i < 9; i++) line[i] = line[i+1];
		lines = 9;
	}
	if (next.Length() <= 30)
	{
		line[lines++].Copy(next);
		DrawDeferred();
		return;
	}
	
	line[lines++].Copy(next.Left(30));
	PrintL(next.Mid(30));
}

⌨️ 快捷键说明

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