?? httpexamplecontainer.cpp
字號:
/**
*
* @brief Definition of CHTTPExampleContainer
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDE FILES
// Class include
#include "HTTPExampleContainer.h"
// System includes
#include <eikedwin.h> // CEikEdwin::EReadOnly
#include <eikrted.h> // CEikRichTextEditor
#include <stringloader.h> // StringLoader
// CONSTANTS
const TInt KEditorMaxLines = 6;
const TInt KEditorMaxChars = 0;
// ================= MEMBER FUNCTIONS =======================
/**
* Symbian OS 2nd phase constructor. Creates a Window for the controls, which it contains.
* Constructs a label and adds it to the window, which it then activates.
* @param aRect The rectangle for this window
*/
void CHTTPExampleContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
iEditor = new (ELeave) CEikRichTextEditor;
iEditor->SetContainerWindowL(*this);
iEditor->ConstructL(this, KEditorMaxLines, KEditorMaxChars,
CEikEdwin::EReadOnly|CEikEdwin::ELineCursor|CEikEdwin::ENoAutoSelection);
iEditor->ActivateL();
// Add a scrollbar if necessary. N.B. We don't take ownership of
// this despite the pointer.
CEikScrollBarFrame* scrollBarFrame = iEditor->CreatePreAllocatedScrollBarFrameL();
scrollBarFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
iEditor->SetFocus(ETrue);
SetRect(aRect);
ActivateL();
}
/**
* Symbian OS 2 phase constructor.
* Constructs the CHTTPExampleContainer using the NewLC method, popping
* the constructed object from the CleanupStack before returning it.
*
* @param aRect The rectangle for this window
* @return The newly constructed CHTTPExampleContainer
*/
CHTTPExampleContainer* CHTTPExampleContainer::NewL(const TRect& aRect)
{
CHTTPExampleContainer* self = new (ELeave) CHTTPExampleContainer;
CleanupStack::PushL(self);
self->ConstructL(aRect);
CleanupStack::Pop(self);
return self;
}
/**
* Destructor. Frees up memory for the iLabel.
*/
CHTTPExampleContainer::~CHTTPExampleContainer()
{
delete iEditor;
}
/**
*
* Called by framework when the view size is changed. Resizes the
* iLabel accordingly.
*
*/
void CHTTPExampleContainer::SizeChanged()
{
iEditor->SetRect(Rect());
}
/**
* Called by the framework in compound controls
* @return The number of controls in this CHTTPExampleContainer
*/
TInt CHTTPExampleContainer::CountComponentControls() const
{
return 1; // return number of controls inside this container
}
/**
* Called by the framework in compound controls
* @param The index of the control to return
* @return The control for aIndex
*/
CCoeControl* CHTTPExampleContainer::ComponentControl(TInt aIndex) const
{
switch (aIndex)
{
case 0:
return iEditor;
default:
return NULL;
}
}
/**
* Called by the framework to draw this control. Clears the area in
* aRect.
* @param aRect in which to draw
*/
void CHTTPExampleContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.Clear(aRect);
}
/**
* Set the text in the rich text editor control.
* @param aText Text to insert into the rich text editor
*/
void CHTTPExampleContainer::SetTextL(const TDesC& aText)
{
iEditor->SetTextL(&aText);
}
/**
* Override of CCoeControl method to handle key events.
*/
TKeyResponse CHTTPExampleContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
if ((iEditor != NULL) && (aType == EEventKey))
{
if (aKeyEvent.iCode == EKeyDownArrow)
{
iEditor->MoveCursorL(TCursorPosition::EFPageDown, EFalse);
}
else if (aKeyEvent.iCode == EKeyUpArrow)
{
iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);
}
else
{
iEditor->OfferKeyEventL(aKeyEvent, aType);
}
return EKeyWasConsumed;
}
return EKeyWasNotConsumed;
}
// End of File
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -