📄 orchelpcontainer.cpp
字号:
#define KEditorPosition TPoint(0,0)
#include <gulicon.h>
#include <aknutils.h>
#include <avkon.hrh>
#include <akntitle.h>
#include <eiklabel.h>
#include <barsread.h>//Martin
#include <StringLoader.h>//Martin
//Martin
#include "ORCHelpContainer.h"
#include "orcer.rsg"
#include "RichTextEditorRichTextEditor.h"
CORCHelpContainer::CORCHelpContainer()
{
}
//Martin
CORCHelpContainer* CORCHelpContainer::NewL(const TRect& aRect)
{
CORCHelpContainer* self = CORCHelpContainer::NewLC(aRect);
CleanupStack::Pop(self);
return self;
}
CORCHelpContainer* CORCHelpContainer::NewLC(const TRect& aRect)
{
CORCHelpContainer* self = new (ELeave) CORCHelpContainer;
CleanupStack::PushL(self);
self->ConstructL(aRect);
return self;
}
//
// EPOC default constructor can leave.
void CORCHelpContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
//Martin
//帮助文档
m_pHelp = CRichTextEditorRichTextEditor::NewL();
m_pHelp->SetContainerWindowL(*this);
AddTextToEditorL();
SetRect(aRect);
ActivateL();
m_pHelp->DisplayStartOfHelpTextL();
}
// destructor
CORCHelpContainer::~CORCHelpContainer()
{//Martin
if (m_pHelp) {
delete m_pHelp;
}
}
void CORCHelpContainer::SizeChanged()
{//Martin
m_pHelp->SetExtent(KEditorPosition, m_pHelp->MinimumSize());
}
// ---------------------------------------------------------
// CORCHelpContainer::CountComponentControls() const
// return the number of controls
// ---------------------------------------------------------
//
TInt CORCHelpContainer::CountComponentControls() const
{
// return number of controls inside this container
return 1;
}
// ---------------------------------------------------------
// CORCHelpContainer::ComponentControl(TInt aIndex) const
// return the pointer to specified control.
// ---------------------------------------------------------
//
CCoeControl* CORCHelpContainer::ComponentControl( TInt aIndex ) const
{//Martin
switch(aIndex) {
case 0:
return m_pHelp;
break;
default:
return NULL;
break;
}
}
// ---------------------------------------------------------
// CORCHelpContainer::Draw(const TRect& aRect) const
// handle the message when client region must be redrawn.
// ---------------------------------------------------------
//
void CORCHelpContainer::Draw( const TRect& /*aRect*/ ) const
{
CWindowGc& gc = SystemGc();
gc.Clear(Rect());
// gc.DrawRect(TRect(TPoint(10, 10), TSize(20, 20)));
}
// ---------------------------------------------------------
// CAknExGridContainer::OfferKeyEventL(
// const TKeyEvent& aKeyEvent, TEventCode aType )
// Handles the key events.
// ---------------------------------------------------------
//
TKeyResponse CORCHelpContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType )
{//Martin
// return EKeyWasNotConsumed;
if (m_pHelp)
return m_pHelp->OfferKeyEventL(aKeyEvent, aType);
else
return CCoeControl::OfferKeyEventL(aKeyEvent, aType);
}
//Martin
void CORCHelpContainer::AddTextToEditorL()
{
if (m_pHelp)
{
HBufC* document = StringLoader::LoadLC (R_ORCER_HELP_DOCUMENT);
m_pHelp->AddTextL (*document);
m_pHelp->ApplyCharFormatL();
m_pHelp->ApplyCharFormatL();
CleanupStack::PopAndDestroy(document);
HBufC* documentname = StringLoader::LoadLC (R_ORCER_HELP_DOCUMENTNAME);
m_pHelp->AddTextL (*documentname);
m_pHelp->ApplyCharFormatL();
m_pHelp->ApplyCharFormatL();
CleanupStack::PopAndDestroy(documentname);
HBufC* people = StringLoader::LoadLC (R_ORCER_HELP_PEOPLE);
m_pHelp->AddTextL (*people);
m_pHelp->ApplyCharFormatL();
m_pHelp->ApplyCharFormatL();
CleanupStack::PopAndDestroy(people);
HBufC* introduce = StringLoader::LoadLC (R_ORCER_HELP_INTRODUCE);
m_pHelp->SetUnderlineOn(ETrue);
m_pHelp->SetBoldOn(ETrue);
m_pHelp->AddTextL (*introduce);
CleanupStack::PopAndDestroy(introduce);
m_pHelp->ApplyCharFormatL();
m_pHelp->SetUnderlineOn(EFalse);
m_pHelp->SetBoldOn(EFalse);
HBufC* enrol = StringLoader::LoadLC (R_ORCER_HELP_ENROL);
m_pHelp->AddTextL (*enrol);
m_pHelp->ApplyCharFormatL();
m_pHelp->ApplyCharFormatL();
CleanupStack::PopAndDestroy(enrol);
HBufC* logon = StringLoader::LoadLC (R_ORCER_HELP_LOGON);
m_pHelp->AddTextL (*logon);
m_pHelp->ApplyCharFormatL();
m_pHelp->ApplyCharFormatL();
CleanupStack::PopAndDestroy(logon);
HBufC* update = StringLoader::LoadLC (R_ORCER_HELP_UPDATE);
m_pHelp->AddTextL (*update);
m_pHelp->ApplyCharFormatL();
m_pHelp->ApplyCharFormatL();
CleanupStack::PopAndDestroy(update);
HBufC* download = StringLoader::LoadLC (R_ORCER_HELP_DOWNLOAD);
m_pHelp->AddTextL (*download);
m_pHelp->ApplyCharFormatL();
m_pHelp->ApplyCharFormatL();
CleanupStack::PopAndDestroy(download);
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -