📄 chinesedisplay1container.cpp
字号:
/*
============================================================================
Name : CChineseDisplay1Container from ChineseDisplay1Container.h
Author :
Version :
Copyright : Your copyright notice
Description : Container control implementation
============================================================================
*/
// INCLUDE FILES
#include "ChineseDisplay1Container.h"
#include <eiklabel.h> // for example label control
#include <charconv.h>
#include <EIKENV.H>
#include <AknNoteWrappers.h>
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CChineseDisplay1Container::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CChineseDisplay1Container::ConstructL(const TRect& aRect)
{
CreateWindowL();
CCnvCharacterSetConverter* converter = CCnvCharacterSetConverter::NewLC();
TBool chineseLanguageSupported = EFalse;
if( converter->PrepareToConvertToOrFromL( KCharacterSetIdentifierGbk,
CEikonEnv::Static()->FsSession()) == CCnvCharacterSetConverter::EAvailable )
{
chineseLanguageSupported = ETrue;
}
else if ( converter->PrepareToConvertToOrFromL( KCharacterSetIdentifierGb2312,
CEikonEnv::Static()->FsSession() ) == CCnvCharacterSetConverter::EAvailable )
{
chineseLanguageSupported = ETrue;
}
//TText8 *str = (TText8*)"诺基亚";
TText8 *str = (TText8*)"c:\\吴文涛.txt";
TInt state=CCnvCharacterSetConverter::KStateDefault;
TPtrC8 source( str );
iInfoText = HBufC::NewL( source.Length() );
TPtr16 ptr = iInfoText->Des();
if( chineseLanguageSupported )
{
TRAP_IGNORE( converter->ConvertToUnicode( ptr, source, state ) )
CAknInformationNote* note = new (ELeave) CAknInformationNote;
note->ExecuteLD(ptr);
}
CleanupStack::PopAndDestroy(); // converter
iFs.Connect();
iFile.Open(iFs,ptr,EFileRead);
TInt aFileLength = 0;
iFile.Size(aFileLength);
if(aFileLength > 0)
{
CAknInformationNote* note = new (ELeave) CAknInformationNote;
note->ExecuteLD(_L("Open OK"));
}
SetRect(aRect);
ActivateL();
}
// Destructor
CChineseDisplay1Container::~CChineseDisplay1Container()
{
}
// ---------------------------------------------------------
// CChineseDisplay1Container::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CChineseDisplay1Container::SizeChanged()
{
// TODO: Add here control resize code etc.
}
// ---------------------------------------------------------
// CChineseDisplay1Container::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CChineseDisplay1Container::CountComponentControls() const
{
return 0; // return nbr of controls inside this container
}
// ---------------------------------------------------------
// CChineseDisplay1Container::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CChineseDisplay1Container::ComponentControl(TInt aIndex) const
{
return NULL;
}
// ---------------------------------------------------------
// CChineseDisplay1Container::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CChineseDisplay1Container::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
// TODO: Add your drawing code here
// example code...
}
// ---------------------------------------------------------
// CChineseDisplay1Container::HandleControlEventL(
// CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CChineseDisplay1Container::HandleControlEventL(
CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
{
// TODO: Add your control event handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -