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

📄 testmyhttpclientappview.cpp

📁 一个简单的http客户端
💻 CPP
字号:
/*
 ============================================================================
 Name		: testMyHttpClientAppView.cpp
 Author	  : 
 Copyright   : Your copyright notice
 Description : Application view implementation
 ============================================================================
 */

// INCLUDE FILES
#include <coemain.h>
#include "testMyHttpClientAppView.h"
#include <eikedwin.h> 

// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CtestMyHttpClientAppView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CtestMyHttpClientAppView* CtestMyHttpClientAppView::NewL(const TRect& aRect)
{
	CtestMyHttpClientAppView* self = CtestMyHttpClientAppView::NewLC(aRect);
	CleanupStack::Pop(self);
	return self;
}

// -----------------------------------------------------------------------------
// CtestMyHttpClientAppView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CtestMyHttpClientAppView* CtestMyHttpClientAppView::NewLC(const TRect& aRect)
{
	CtestMyHttpClientAppView* self = new ( ELeave ) CtestMyHttpClientAppView;
	CleanupStack::PushL(self);
	self->ConstructL(aRect);
	return self;
}

// -----------------------------------------------------------------------------
// CtestMyHttpClientAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CtestMyHttpClientAppView::ConstructL(const TRect& aRect)
{
	// Create a window for this application view
	CreateWindowL();
	
	iEditor=new(ELeave) CEikEdwin();
	iEditor->SetContainerWindowL(*this);
	iEditor->ConstructL(0,800,1000,100);
	
	iEditor->CreatePreAllocatedScrollBarFrameL();	
	iEditor->ScrollBarFrame()->SetScrollBarVisibilityL ( CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
	
	iEditor->ActivateL();

	// Set the windows size
	SetRect(aRect);

	// Activate the window, which makes it ready to be drawn
	ActivateL();
}

// -----------------------------------------------------------------------------
// CtestMyHttpClientAppView::CtestMyHttpClientAppView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CtestMyHttpClientAppView::CtestMyHttpClientAppView()
{
	// No implementation required
}

// -----------------------------------------------------------------------------
// CtestMyHttpClientAppView::~CtestMyHttpClientAppView()
// Destructor.
// -----------------------------------------------------------------------------
//
CtestMyHttpClientAppView::~CtestMyHttpClientAppView()
{
	delete iEditor;
}

// -----------------------------------------------------------------------------
// CtestMyHttpClientAppView::Draw()
// Draws the display.
// -----------------------------------------------------------------------------
//
void CtestMyHttpClientAppView::Draw(const TRect& /*aRect*/) const
{
	// Get the standard graphics context
	CWindowGc& gc = SystemGc();

	// Gets the control's extent
	TRect drawRect(Rect());

	// Clears the screen
	gc.Clear(drawRect);

}

// -----------------------------------------------------------------------------
// CtestMyHttpClientAppView::SizeChanged()
// Called by framework when the view size is changed.
// -----------------------------------------------------------------------------
//
void CtestMyHttpClientAppView::SizeChanged()
{
	TInt scrollW=iEditor->ScrollBarFrame()->VerticalScrollBar()->Rect().Width();
	TRect rect=Rect();
	rect.SetWidth(rect.Width()-scrollW);
	iEditor->SetRect(rect);
}

TInt CtestMyHttpClientAppView::CountComponentControls() const
{
	return 1;
}

CCoeControl* CtestMyHttpClientAppView::ComponentControl(TInt /*aIndex*/) const
{
	return iEditor;
}

TKeyResponse CtestMyHttpClientAppView::OfferKeyEventL(
		const TKeyEvent &aKeyEvent, TEventCode aType)
{
	return iEditor->OfferKeyEventL(aKeyEvent,aType);
}
// End of File

void CtestMyHttpClientAppView::Display(const TDesC& aText)
{
	CPlainText* t=iEditor->Text();
	t->InsertL(t->DocumentLength(),aText);
	t->InsertL(t->DocumentLength(),_L("\f"));
	
	iEditor->SetCursorPosL(0,EFalse);
	iEditor->HandleTextChangedL();
}

void CtestMyHttpClientAppView::ClearScr()
{
	iEditor->SetCursorPosL(0,EFalse);
	iEditor->Text()->Reset();
	iEditor->HandleTextChangedL();
}

⌨️ 快捷键说明

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