📄 ctrlpanesappui.cpp
字号:
/*
* ============================================================================
* Name : CCtrlPanesAppUi from CtrlPanesAppui.cpp
* Part of : CtrlPanes
* Created : 14.05.2006 by ToBeReplacedByAuthor
* Implementation notes:
* Initial content was generated by Series 60 Application Wizard.
* Version :
* Copyright: ToBeReplacedByCopyright
* ============================================================================
*/
// INCLUDE FILES
#include <avkon.hrh>
#include <eikbtgpc.h> // for CEikButtonGroupContainer
#include <CtrlPanes.rsg>
#include "CtrlPanesAppui.h"
#include "CtrlPanesContainer.h"
#include "CtrlPanes.hrh"
// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CCtrlPanesAppUi::ConstructL()
//
// ----------------------------------------------------------
//
void CCtrlPanesAppUi::ConstructL()
{
BaseConstructL();
iAppContainer = new (ELeave) CCtrlPanesContainer;
iAppContainer->SetMopParent( this );
iAppContainer->ConstructL( ClientRect() );
AddToStackL( iAppContainer );
}
// ----------------------------------------------------
// CCtrlPanesAppUi::~CCtrlPanesAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CCtrlPanesAppUi::~CCtrlPanesAppUi()
{
if (iAppContainer)
{
RemoveFromStack( iAppContainer );
delete iAppContainer;
}
}
// ------------------------------------------------------------------------------
// CCtrlPanesAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
// This function is called by the EIKON framework just before it displays
// a menu pane. Its default implementation is empty, and by overriding it,
// the application can set the state of menu items dynamically according
// to the state of application data.
// ------------------------------------------------------------------------------
//
void CCtrlPanesAppUi::DynInitMenuPaneL(
TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
{
}
// ----------------------------------------------------
// CCtrlPanesAppUi::HandleKeyEventL(
// const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// takes care of key event handling
// ----------------------------------------------------
//
TKeyResponse CCtrlPanesAppUi::HandleKeyEventL(
const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
{
return EKeyWasNotConsumed;
}
// ----------------------------------------------------
// CCtrlPanesAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void CCtrlPanesAppUi::HandleCommandL(TInt aCommand)
{
switch ( aCommand )
{
case EAknSoftkeyBack:
case EEikCmdExit:
{
Exit();
break;
}
case ECtrlPanesCmdChangeCba:
{
SetCbaL(R_CTRLPANES_SOFTKEYS_RESTORE_KEEP);
break;
}
case ECtrlPanesCmdSetCommand:
{
SetCommandL();
break;
}
case ECtrlPanesCmdAddCommand:
{
AddCommandL();
break;
}
case ECtrlPanesSoftkeyRestore:
{
RestoreCba();
break;
}
case ECtrlPanesSoftkeyRemove:
{
RemoveCommand();
break;
}
// TODO: Add Your command handling code here
default:
break;
}
}
// new private functions
void CCtrlPanesAppUi::SetCbaL(TInt aCba)
{
CEikButtonGroupContainer* cba = Cba();
cba->SetCommandSetL(aCba);
cba->DrawDeferred();
}
void CCtrlPanesAppUi::RestoreCba()
{
CEikButtonGroupContainer* cba = Cba();
cba->RemoveCommandFromStack(0, ECtrlPanesSoftkeyRestore);
cba->RemoveCommandFromStack(2, ECtrlPanesSoftkeyKeep);
cba->DrawDeferred();
}
void CCtrlPanesAppUi::SetCommandL()
{
CEikButtonGroupContainer* cba = Cba();
_LIT(KTextMenu, "Menu");
cba->SetCommandL(0, EAknSoftkeyOptions, KTextMenu());
cba->SetCommandL(2, EAknSoftkeyEmpty, KNullDesC());
cba->DrawDeferred();
}
void CCtrlPanesAppUi::AddCommandL()
{
CEikButtonGroupContainer* cba = Cba();
_LIT(KTextRemove, "Remove");
cba->AddCommandToStackL(0, ECtrlPanesSoftkeyRemove, KTextRemove());
cba->DrawDeferred();
}
void CCtrlPanesAppUi::RemoveCommand()
{
CEikButtonGroupContainer* cba = Cba();
cba->RemoveCommandFromStack(0, ECtrlPanesSoftkeyRemove);
cba->DrawDeferred();
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -