📄 senddatacontainer.cpp
字号:
/*
* ============================================================================
* Name : CSendDataContainer from CCoeControl, MCoeControlObserver
* Part of : SendData
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <eiklabel.h> // for example label control
#include <barsread.h> // for resource reader
#include <eikedwin.h> // for CEikEdwin
#include <eikgted.h> // for CEikGlobalTextEditor
#include <MClassExample.rsg>
#include "MClassExample.hrh"
#include "SendDataContainer.h"
//
// // Definitions
#define EDWIN_POS TPoint(10, 25)
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CSendDataContainer::CSendDataContainer()
{
iEdwin = NULL;
}
// EPOC default constructor can leave.
void CSendDataContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
iEdwin = new(ELeave)CEikEdwin;
iEdwin->SetContainerWindowL(*this);
iEdwin->ConstructL(EEikEdwinNoAutoSelection | EEikEdwinIgnoreVirtualCursor, 10, 10, 1);
iEdwin->SetFocus(ETrue);
SetRect(aRect);
ActivateL();
}
// Destructor
CSendDataContainer::~CSendDataContainer()
{
delete iEdwin;
}
// ---------------------------------------------------------
// CSendDataContainer::FocusTo(TInt aCommand)
// Change foccused control.
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CSendDataContainer::FocusTo(TInt aCommand)
{
}
// ---------------------------------------------------------
// CSendDataContainer::SizeChanged()
// Called by framework when the view size is changed
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CSendDataContainer::SizeChanged()
{
if (iEdwin)
{
iEdwin->SetExtent(EDWIN_POS,iEdwin->MinimumSize());
}
}
// ---------------------------------------------------------
// CSendDataContainer::CountComponentControls() const
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CSendDataContainer::CountComponentControls() const
{
return 1; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CSendDataContainer::ComponentControl(TInt aIndex) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
CCoeControl* CSendDataContainer::ComponentControl(TInt aIndex) const
{
switch (aIndex)
{
case 0:
return iEdwin;
default:
return NULL;
}
// return NULL;
}
// ---------------------------------------------------------
// CSendDataContainer::Draw(const TRect& aRect) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CSendDataContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushColor(KRgbGray);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
}
// ---------------------------------------------------------
// CSendDataContainer::OfferKeyEventL(...)
// Notify key events to editors.
// (other items were commented in a header).
// ---------------------------------------------------------
//
TKeyResponse CSendDataContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent, TEventCode aType)
{
return EKeyWasNotConsumed;
}
// ---------------------------------------------------------
// CSendDataContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CSendDataContainer::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
}
void CSendDataContainer::GetInput(TDes& aInput)
{
iEdwin->GetText(aInput);
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -