?? scantxtcontainer.cpp
字號(hào):
/*
* ============================================================================
* Name : CScanTxtContainer from CCoeControl, MCoeControlObserver
* Part of : Hello
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <EveryDay.rsg>
#include "EveryDay.hrh"
#include "ScanTxtContainer.h"
#include "Common.h"
#include <eiklabel.h>
#include <eikedwin.h>
#include <aknnotewrappers.h>
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CScanTxtContainer::CScanTxtContainer()
{
m_pScanLabel = NULL;
m_pScanLabel1 = NULL;
m_pScanEdit = NULL;
m_pScanEdit1 = NULL;
m_Scanmessage = new(ELeave) CMessage;
}
// EPOC default constructor can leave.
void CScanTxtContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
//Label
m_pScanLabel = new(ELeave) CEikLabel;
m_pScanLabel->SetContainerWindowL(*this);
TBuf<32> buf;
CEikonEnv::Static()->ReadResource(buf, R_QTN_NEWTXT_NEXTITLE);
m_pScanLabel->SetTextL(buf);
m_pScanLabel->SetExtent(TPoint(10,20), m_pScanLabel->MinimumSize());
//Label1
m_pScanLabel1 = new(ELeave) CEikLabel;
m_pScanLabel1->SetContainerWindowL(*this);
CEikonEnv::Static()->ReadResource(buf, R_QTN_NEWTXT_CONTENT);
m_pScanLabel1->SetTextL(buf);
m_pScanLabel1->SetExtent(TPoint(10,50), m_pScanLabel1->MinimumSize());
//Edit
m_pScanEdit = new(ELeave) CEikEdwin;
m_pScanEdit->SetContainerWindowL(*this);
m_pScanEdit->ConstructL(EAknEditorFlagDefault, 10, 10, 1);
m_pScanEdit->SetExtent(TPoint(55,20), TSize(100,20));
m_pScanEdit->SetTextL(&m_Scanmessage->GetTitleInfo());
m_pScanEdit->SetFocus(ETrue);
//m_pScanEdit->EReadOnly;
//Edit1
m_pScanEdit1 = new(ELeave) CEikEdwin;
m_pScanEdit1->SetContainerWindowL(*this);
m_pScanEdit1->ConstructL(EAknEditorFlagDefault, 10, 100, 1);
m_pScanEdit1->SetExtent(TPoint(40,50), TSize(120,80));
m_pScanEdit1->SetTextL(&m_Scanmessage->GetContInfo());
//m_pScanEdit1->EReadOnly;
SetRect(aRect);
ActivateL();
}
// Destructor
CScanTxtContainer::~CScanTxtContainer()
{
MEM_FREE(m_pScanLabel);
MEM_FREE(m_pScanLabel1);
MEM_FREE(m_pScanEdit);
MEM_FREE(m_pScanEdit1);
MEM_FREE(m_Scanmessage);
}
// ---------------------------------------------------------
// CScanTxtContainer::FocusTo(TInt aCommand)
// Change foccused control.
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CScanTxtContainer::FocusTo(TInt aCommand)
{
}
// ---------------------------------------------------------
// CScanTxtContainer::SizeChanged()
// Called by framework when the view size is changed
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CScanTxtContainer::SizeChanged()
{
}
// ---------------------------------------------------------
// CScanTxtContainer::CountComponentControls() const
// (other items were commented in a header).
// ---------------------------------------------------------
//
TInt CScanTxtContainer::CountComponentControls() const
{
return 4; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CScanTxtContainer::ComponentControl(TInt aIndex) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
CCoeControl* CScanTxtContainer::ComponentControl(TInt aIndex) const
{
switch (aIndex)
{
case 0:
{
return m_pScanLabel;
break;
}
case 1:
{
return m_pScanLabel1;
break;
}
case 2:
{
return m_pScanEdit;
break;
}
case 3:
{
return m_pScanEdit1;
break;
}
default:
{
return NULL;
break;
}
}
}
// ---------------------------------------------------------
// CScanTxtContainer::Draw(const TRect& aRect) const
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CScanTxtContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.SetPenStyle(CGraphicsContext::ENullPen);
gc.SetBrushColor(KRgbWhite);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.DrawRect(aRect);
gc.SetPenStyle(CGraphicsContext::ESolidPen);
gc.SetPenColor(KRgbBlack);
gc.DrawLine(TPoint (53,18),TPoint (150,18));
gc.DrawLine(TPoint (53,18),TPoint (53,40));
gc.DrawLine(TPoint (53,40),TPoint (150,40));
gc.DrawLine(TPoint (150,18),TPoint (150,40));
gc.DrawLine(TPoint (38,48),TPoint (162,48));
gc.DrawLine(TPoint (38,48),TPoint (38,132));
gc.DrawLine(TPoint (38,132),TPoint (162,132));
gc.DrawLine(TPoint (162,48),TPoint (162,132));
}
// ---------------------------------------------------------
// CScanTxtContainer::OfferKeyEventL(...)
// Notify key events to editors.
// (other items were commented in a header).
// ---------------------------------------------------------
//
TKeyResponse CScanTxtContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent, TEventCode aType)
{
if (m_pScanEdit)
{
if (m_pScanEdit->IsFocused())
{
if((aType == EEventKey) && (aKeyEvent.iCode == EKeyDownArrow))
{
m_pScanEdit->SetFocus(EFalse);
m_pScanEdit1->SetFocus(ETrue);
return EKeyWasConsumed;
}
return m_pScanEdit->OfferKeyEventL(aKeyEvent, aType);
}
}
if (m_pScanEdit1)
{
if (m_pScanEdit1->IsFocused())
{
if((aType == EEventKey) && (aKeyEvent.iCode == EKeyUpArrow))
{
m_pScanEdit->SetFocus(ETrue);
m_pScanEdit1->SetFocus(EFalse);
return EKeyWasConsumed;
}
return m_pScanEdit1->OfferKeyEventL(aKeyEvent, aType);
}
}
return EKeyWasNotConsumed;
}
// ---------------------------------------------------------
// CScanTxtContainer::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CScanTxtContainer::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
}
void CScanTxtContainer::LIstInfo(CMessage& afile)
{
m_Scanmessage->SetTitleInfo(afile.GetTitleInfo());
m_Scanmessage->SetContInfo(afile.GetContInfo());
}
// End of File
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -