📄 example2dcontainer.h
字号:
/*
* ============================================================================
* Name : CExample2DContainer from Example2DContainer.h
* Part of : Example2D
* Created : 23.09.2005 by
* Description:
* Declares container control for application.
* Version :
* Copyright:
* ============================================================================
*/
#ifndef __EXAMPLE2DCONTAINER_H__
#define __EXAMPLE2DCONTAINER_H__
// INCLUDES
#include <coecntrl.h>
#include <coemain.h>
#include "MSystem.h"
#include "MTimingCall.h"
#include "MAudioSource.h"
// FORWARD DECLARATIONS
class CBitmap;
class MModel;
class CTiming;
class CAudio;
class TAudioClip
{
public:
inline TAudioClip( const TPtrC8& aData )
: iPosition( 0 )
, iData( aData )
{
}
TInt iPosition; /// play position
TPtrC8 iData; /// pointer to audio data
};
// CLASS DECLARATION
/**
* CExample2DContainer container control class.
*
*/
class CExample2DContainer
: public CCoeControl
, public MCoeForegroundObserver
, public MSystem
, public MTimingCall
, public MAudioSource
{
public: // Constructors and destructor
void ConstructL(const TRect& aRect);
~CExample2DContainer();
private: // CCoeControl
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
private: // MCoeForegroundObserver
void HandleGainingForeground();
void HandleLosingForeground();
public: // MSystem
void Exit();
void ChangeModelL( TModel aModel );
TBool KeyState( TInt aKey );
const TFileName& Path();
void AddAudio( const TDesC8& aAudio );
void ToggleAudio();
void PrepareExit();
void LoadMusic();
TUint8 ExitKey();
TUint8 SelectKey();
TUint8 OkKey();
TUint8 BackKey();
public: // MTimingCall
void TimingCall();
public: // MAudioSource
void FillAudio( TInt16* aBuffer, TInt aLength );
public:
// called from AppUi's HandleWsEventL
void HandleScreenDeviceChanged();
private: // new methods
/**
* Inits variables by phone model
*/
void InitPhone();
/**
* Starts audio playback
*/
void StartAudio();
private:
TUint16* iScreenPtr; /// Pointer to screen data
CFbsBitmap iBitmap; /// Screen bitmap
TBool iForeGround; /// Application is foreground or not
CBitmap* iBmScreen; /// Screen bitmap as CBitmap
TUint8 iKeyState[ 256 ]; /// Key press status for each key
TUint8 iExitKey; /// Exit key value
TUint8 iSelectKey; /// Select key value
TUint8 iOkKey; /// Ok key value
TUint8 iBackKey; /// Back key value
CTiming* iTiming; /// Timing class, provides callbacks
TInt iPos; /// Window ordinal position
TTime iLastTime; /// Last screen update time
TPhone iPhone; /// Phone model at use
TFileName iPath; /// Application path
CAudio* iAudio; /// Audio player
MModel* iCurrentModel; /// current ( active ) model
RPointerArray< MModel >iModel; /// list of all models
TBool iChangeModel; /// Model change initiated
TModel iNextModel; /// Next model
TBool iExitFromModel;
TUint8* iMusicData; /// Music data
TInt iMusicLength; /// Music data length
RArray< TAudioClip >iAudioSource; /// list of audio sources
TBool iAudioState; /// Audio on / off
};
#endif
// End of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -