📄 example_e1122138.cpp
字号:
#include <avkon.hrh>
#include <aknnotewrappers.h>
#include <AknGlobalNote.h>
#include <commdb.h>
#include <cdbcols.h>
#include <EIKENV.H>
#include <aknmessagequerydialog.h>
#include <EIKMENUP.H>
#include <eikstart.h>
#include <browseruisdkcrkeys.h>
#include <centralrepository.h>
#include <APGCLI.H>
#include <BAUTILS.H>
#include "Example_E1122138.h"
#include "Example_E1122138.hrh"
#include <Example_E1122138.rsg>
#include "Splash_Screen.h"
#include "Main_Screen.h"
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
void CExampleAppUi::ConstructL()
{
BaseConstructL(CAknAppUi::EAknEnableSkin);
iMySplashScreen = CMySplashScreen::NewL(ApplicationRect());
AddToStackL(iMySplashScreen);
iScWrapper = CScShortcutEngineWrapper::NewL(CEikonEnv::Static()->FsSession(), *this );
iScWrapper->AsynchronouslyPrepareShortcutListL( iScArray );
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
CExampleAppUi::CExampleAppUi()
{
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
CExampleAppUi::~CExampleAppUi()
{
if(iMySplashScreen)
{
RemoveFromStack(iMySplashScreen);
delete iMySplashScreen;
}
if(iMyMainScreen)
{
RemoveFromStack(iMyMainScreen);
delete iMyMainScreen;
}
iScArray.ResetAndDestroy();
delete iScWrapper;
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
void CExampleAppUi::HandleStatusPaneSizeChange()
{
if(iMySplashScreen)
{
iMySplashScreen->SetRect(ApplicationRect());
}
if(iMyMainScreen)
{
iMyMainScreen->SetRect(ClientRect());
}
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
void CExampleAppUi::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
case ESetRightSK:
case ESetLeftSK:
if(iMyMainScreen && iScWrapper)
{
TInt index= iMyMainScreen->SelectedIndex();
CScShortcutEngineWrapper::TKeyType keyType(CScShortcutEngineWrapper::EKeyTypeRight);
if(aCommand == ESetLeftSK)
{
keyType = CScShortcutEngineWrapper::EKeyTypeLeft;
}
iScWrapper->SetShortcutL(keyType,index);
}
break;
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
case EClose2:
// splash screen buttons, not handled..
break;
default:
break;
}
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
void CExampleAppUi::HandleShortcutEvent( TScShortcutEvent aEvent )
{
switch ( aEvent )
{
case EAllShortcutsChanged:
ShowNoteL(_L("Shortcuts Changed"));
break;
case EShortcutListChanged:
ShowNoteL(_L("Shortcut List Changed"));
break;
case EShortcutListComplete:
if(iScWrapper)
{
Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT);
Cba()->DrawDeferred();
iMyMainScreen = CMyMainScreen::NewL(ClientRect(),iScArray);
if(iMySplashScreen)
{
RemoveFromStack(iMySplashScreen);
}
delete iMySplashScreen;
iMySplashScreen = NULL;
AddToStackL(iMyMainScreen);
}
break;
default:
break;
}
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
void CExampleAppUi::HandleShortcutError(TScShortcutEvent aEvent, TInt aError )
{
TBuf<150> jhelppBuf;
switch(aEvent)
{
case EAllShortcutsChanged:
jhelppBuf.Copy(_L("Cuts Changed, Err = "));
break;
case EShortcutListChanged:
jhelppBuf.Copy(_L("List Changed, Err = "));
break;
case EShortcutListComplete:
{
jhelppBuf.Copy(_L("Complete, Err = "));
}
break;
};
jhelppBuf.AppendNum(aError);
ShowNoteL(jhelppBuf);
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CExampleAppUi::ShowNoteL(const TDesC& aMessage)
{
CAknGlobalNote* dialog = CAknGlobalNote::NewLC();
TInt NoteId = dialog->ShowNoteL(EAknGlobalInformationNote,aMessage);
User::After(2000000);
dialog->CancelNoteL(NoteId);
CleanupStack::PopAndDestroy(dialog);;
}
/*
-----------------------------------------------------------------
****************** CExampleDocument ***********************
-----------------------------------------------------------------
*/
CExampleDocument* CExampleDocument::NewL(CEikApplication& aApp)
{
CExampleDocument* self = NewLC(aApp);
CleanupStack::Pop(self);
return self;
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
CExampleDocument* CExampleDocument::NewLC(CEikApplication& aApp)
{
CExampleDocument* self = new (ELeave) CExampleDocument(aApp);
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
void CExampleDocument::ConstructL()
{
// No implementation required
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
CExampleDocument::CExampleDocument(CEikApplication& aApp) : CAknDocument(aApp)
{
// No implementation required
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
CExampleDocument::~CExampleDocument()
{
// No implementation required
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
CEikAppUi* CExampleDocument::CreateAppUiL()
{
// Create the application user interface, and return a pointer to it;
// the framework takes ownership of this object
return (static_cast <CEikAppUi*> (new (ELeave) CExampleAppUi));
}
/*
-----------------------------------------------------------------
****************** CExampleApplication *****************
-----------------------------------------------------------------
*/
CApaDocument* CExampleApplication::CreateDocumentL()
{
// Create an HelloWorldBasic document, and return a pointer to it
return (static_cast<CApaDocument*>(CExampleDocument::NewL(*this)));
}
/*
-----------------------------------------------------------------
-----------------------------------------------------------------
*/
TUid CExampleApplication::AppDllUid() const
{
return KUidExampleApp;
}
/*
-----------------------------------------------------------------
****************** App framework stuff *************************
-----------------------------------------------------------------
*/
EXPORT_C CApaApplication* NewApplication()
{
return (new CExampleApplication);
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
GLDEF_C TInt E32Main()
{
return EikStart::RunApplication( NewApplication );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -