lafagnosticuifoundation/bmpanimation/tef/Tanctl.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code 
       
    20 */
       
    21 
       
    22 #if !defined(__TANCTL_H__)
       
    23 #define __TANCTL_H__
       
    24 
       
    25 #if !defined(__COECNTRL_H__)
       
    26 #include <coecntrl.h>
       
    27 #endif
       
    28 
       
    29 class TResourceReader;
       
    30 class RAnimDll;
       
    31 class RBitmapAnim;
       
    32 class CBitmapAnimClientData;
       
    33 class CBitmapFrameData;
       
    34 
       
    35 _LIT(KTBmpAnimMBMFilePath, "z:\\resource\\apps\\tbmpanim\\mbm\\tbmpanim.mbm");
       
    36 
       
    37 enum TEikAnimationPanic
       
    38 	{
       
    39 	EEikPanicAnimationNoControlContext,
       
    40 	EEikPanicAnimationNoRAnimation,
       
    41 	EEikPanicAnimationNoWindow
       
    42 	};
       
    43 
       
    44 //
       
    45 //	CBitmapAnimIdler
       
    46 //
       
    47 
       
    48 class CBitmapAnimIdler : public CIdle
       
    49 	{
       
    50 public:
       
    51 	static CBitmapAnimIdler* NewL();
       
    52 private:
       
    53 	CBitmapAnimIdler() : CIdle(EPriorityLow) { }
       
    54 	};
       
    55 
       
    56 
       
    57 class CAnimateFramesCtl : public CCoeControl
       
    58 	{
       
    59 public:
       
    60 	static CAnimateFramesCtl* NewL();
       
    61 	virtual ~CAnimateFramesCtl();
       
    62 public:
       
    63 	inline RBitmapAnim* Animation() { return iAnimation; }
       
    64 	inline CBitmapAnimClientData* BitmapAnimData() { return iBitmapAnimData; }
       
    65 	void CancelAnimationL();
       
    66 	void SetAnimationCtlWindowL(CCoeControl* aParent);
       
    67 	inline void SetFileName(TDesC& aAppFileName) { iFileName = aAppFileName; }
       
    68 	void SetBitmapAnimationDataL();
       
    69 	void SetFrameIndexL(TInt aIndex);
       
    70 	void SetFrameIntervalL(TInt aInterval);
       
    71 	void StartAnimationL();
       
    72 	void StaticConstructL(TInt aResourceId);
       
    73 	void Panic(TEikAnimationPanic aPanic);
       
    74 	void CompleteAnimationInitialisationL();
       
    75 public: // from CCoeControl
       
    76 	virtual void ConstructFromResourceL(TResourceReader& aResourceReader);
       
    77 	virtual TSize MinimumSize();
       
    78 private:
       
    79 	enum TInternalFlags
       
    80 		{
       
    81 		EInitialisationCompleted	=	0x0001,
       
    82 		EWaitForRedrawing			=	0x0002
       
    83 		};
       
    84 private: // from CCoeControl
       
    85 	virtual void SizeChanged();
       
    86 	virtual void PositionChanged();
       
    87 private:
       
    88 	CAnimateFramesCtl();
       
    89 	void BaseConstructL();
       
    90 	inline TBool IsInitialisationComnpleted() { return iFlags&EInitialisationCompleted; }
       
    91 	CBitmapFrameData* ReadFrameDataFromResourceL(TResourceReader& aFramesReader, const TDesC& aFileName);
       
    92 	TBool SetWindowOnServerSideL();
       
    93 	TBool SetAnimationWindowL();
       
    94 	void CreateAndStartIdlerL();
       
    95 	static TInt StartAnimationCallBackL(TAny* aThis);
       
    96 private:
       
    97 	CBitmapAnimClientData* iBitmapAnimData;
       
    98 	RAnimDll iAnimDll;
       
    99 	RBitmapAnim* iAnimation;
       
   100 	TInt iFlags;
       
   101 	TFileName iFileName;
       
   102 	CBitmapAnimIdler* iStartAnimationIdler;
       
   103 	};
       
   104 
       
   105 #endif
       
   106 
       
   107