www.pudn.com > Example2D.rar > 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#include #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