📄 audioplayerappui.cpp
字号:
/**
*
* @brief Definition of CAudioPlayerAppUi
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDE FILES
// Class include
#include "AudioPlayerAppUi.h"
// System includes
#include <uikon.hrh> // EEikCmdExit
#include <eikmenup.h>
#include <eikbtgpc.h>
#include <AudioPlayer.rsg>
// User includes
#include "AudioPlayer.hrh" // menu commands
#include "AudioPlayerView.h" // CAudioPlayerAppView
#include "AudioPlayerApplication.h" // app uid
#include "AudioPlayerEngine.h" // for state, so that appropriate menu can be drawn
/**
* Destructor.
*/
CAudioPlayerAppUi::~CAudioPlayerAppUi()
{
if (iView)
{
RemoveFromStack(iView);
delete iView;
}
}
/**
* Symbian OS 2nd phase constructor. Constructs the application's view.
* Add the view to the control stack so it can receive user input
*/
void CAudioPlayerAppUi::ConstructL()
{
BaseConstructL();
iView = CAudioPlayerView::NewL(ClientRect());
iView->SetMopParent(this);
AddToStackL(iView);
Cba()->MakeVisible(ETrue);
}
/**
* From CEikAppUi, takes care of command handling for the view.
*
* @param aCommand command to be handled
*/
void CAudioPlayerAppUi::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
case EAknSoftkeyExit:
case EAknSoftkeyBack:
Exit();
break;
case EAudioPlayerMenuPlayTone:
iView->PlayToneL();
break;
case EAudioPlayerMenuPlayStream:
iView->PlayStreamL();
break;
case EAudioPlayerMenuPlayFileWav:
iView->PlayWavL();
break;
case EAudioPlayerMenuPlayFileMidi:
iView->PlayMidiL();
break;
case EAudioPlayerMenuStop:
iView->StopL();
break;
default:
break;
}
}
/**
* Framework function called prior to displaying a menu so that, in the current
* application context, irrelevant items can be hidden and relevant items displayed.
*
* @param aResourceId The ID of the menu from its resource declaration
* @param aMenuPane The menu as a usable object
*/
void CAudioPlayerAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
// updates the menu according to the state of the engine and if the view is showing the messages
{
#ifdef __WINS__
// Grey out the MIDI option on the emulator.
if (aResourceId == R_AUDIOPLAYER_MENU_PLAYFILELIST)
{
aMenuPane->SetItemDimmed(EAudioPlayerMenuPlayFileMidi, ETrue);
}
#endif
if (aResourceId != R_AUDIOPLAYER_MENU)
{
return;
}
switch (iView->State())
{
case CAudioPlayerEngine::EStopped:
aMenuPane->SetItemDimmed(EAudioPlayerMenuPlayTone, EFalse);
aMenuPane->SetItemDimmed(EAudioPlayerMenuPlayFile, EFalse);
aMenuPane->SetItemDimmed(EAudioPlayerMenuPlayStream, EFalse);
aMenuPane->SetItemDimmed(EAudioPlayerMenuStop, ETrue);
break;
case CAudioPlayerEngine::EPlaying:
aMenuPane->SetItemDimmed(EAudioPlayerMenuPlayTone, ETrue);
aMenuPane->SetItemDimmed(EAudioPlayerMenuPlayFile, ETrue);
aMenuPane->SetItemDimmed(EAudioPlayerMenuPlayStream, ETrue);
aMenuPane->SetItemDimmed(EAudioPlayerMenuStop, EFalse);
break;
default:
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -